You are on page 1of 24

Pygments options with Minted

Alex Mandel
February 2, 2011

I really wanted to know what color options the default styles included in
Pygments contain. Surprisingly there’s nowhere obvious to see a visual, and
lets face it reading 10+ files of color codes does not really answer the question.
I randomly picked a code file to run through the different styles seen here, I
welcome a more comprehensive code example that covers all the possible styling
options.

UPDATE ’Locations’ SET ’wgs84’ = MakePoint(’X’,’Y’,4236);


--Register the geometry field with spatialite metadata tables
SELECT RecoverGeometryColumn(’locations’,’wgs84’,4326,’POINT’,2);
--Add a new column to store a different projection
SELECT AddGeometryColumn(’locations’,’albers83’,3310,’POINT’,2);
--Reproject the points
UPDATE locations SET albers83 = Transform(wgs84,3310);
--after a select or create table recover the geom column
SELECT RecoverGeometryColumn(’locations’,’albers83’,3310,’POINT’,2);

1 default
1 UPDATE ’Locations’ SET ’wgs84’ = MakePoint(’X’,’Y’,4236);
2 --Register the geometry field with spatialite metadata tables
3 SELECT RecoverGeometryColumn(’locations’,’wgs84’,4326,’POINT’,2);
4 --Add a new column to store a different projection
5 SELECT AddGeometryColumn(’locations’,’albers83’,3310,’POINT’,2);
6 --Reproject the points
7 UPDATE locations SET albers83 = Transform(wgs84,3310);
8 --after a select or create table recover the geom column
9 SELECT RecoverGeometryColumn(’locations’,’albers83’,3310,’POINT’,2);

2 monokai
UPDATE ’Locations’ SET ’wgs84’ = MakePoint(’X’,’Y’,4236);
--Register the geometry field with spatialite metadata tables
SELECT RecoverGeometryColumn(’locations’,’wgs84’,4326,’POINT’,2);

1
--Add a new column to store a different projection
SELECT AddGeometryColumn(’locations’,’albers83’,3310,’POINT’,2);
--Reproject the points
UPDATE locations SET albers83 = Transform(wgs84,3310);
--after a select or create table recover the geom column
SELECT RecoverGeometryColumn(’locations’,’albers83’,3310,’POINT’,2);

1 UPDATE ’Locations’ SET ’wgs84’ = MakePoint(’X’,’Y’,4236);


2 --Register the geometry field with spatialite metadata tables
3 SELECT RecoverGeometryColumn(’locations’,’wgs84’,4326,’POINT’,2);
4 --Add a new column to store a different projection
5 SELECT AddGeometryColumn(’locations’,’albers83’,3310,’POINT’,2);
6 --Reproject the points
7 UPDATE locations SET albers83 = Transform(wgs84,3310);
8 --after a select or create table recover the geom column
9 SELECT RecoverGeometryColumn(’locations’,’albers83’,3310,’POINT’,2);

3 manni
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the
15 #API docs
16 launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’)
17 team = launchpad.people[’ubuntugis’]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name=’ubuntugis-unstable’)
24

25 #If you wanted to filter more here’s where you do it, you can do exact package
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd

2
27 binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,exact_match=
28 result = getStats(binaries)
29 return
30 except:
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not completed scanni
39 stack = [package.binary_package_name,package.binary_package_version,str(package.getDo
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,R)?
50 d = datetime.datetime.today()
51 datestring = d.strftime("%Y-%m-%d")
52 filename = "ubuntugis-ppastats"+datestring+".csv"
53 w=csv.writer(file(filename,’wb’))
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__":
63 getData(team)
64 print "Done"

4 perldoc
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3

3
5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the
15 #API docs
16 launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’)
17 team = launchpad.people[’ubuntugis’]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name=’ubuntugis-unstable’)
24

25 #If you wanted to filter more here’s where you do it, you can do exact package
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd
27 binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,ex
28 result = getStats(binaries)
29 return
30 except:
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not comple
39 stack = [package.binary_package_name,package.binary_package_version,str(pac
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version +
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,
50 d = datetime.datetime.today()

4
51 datestring = d.strftime("%Y-%m-%d")
52 filename = "ubuntugis-ppastats"+datestring+".csv"
53 w=csv.writer(file(filename,’wb’))
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__":
63 getData(team)
64 print "Done"

5 borland
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the main serv
15 #API docs
16 launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’)
17 team = launchpad.people[’ubuntugis’]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name=’ubuntugis-unstable’)
24

25 #If you wanted to filter more here’s where you do it, you can do exact package names, dis
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd64"
27 binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,exact_match=
28 result = getStats(binaries)

5
29 return
30 except:
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not comple
39 stack = [package.binary_package_name,package.binary_package_version,str(pac
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version +
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,
50 d = datetime.datetime.today()
51 datestring = d.strftime("%Y-%m-%d")
52 filename = "ubuntugis-ppastats"+datestring+".csv"
53 w=csv.writer(file(filename,’wb’))
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__":
63 getData(team)
64 print "Done"

6 colorful
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010

6
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the main serv
15 #API docs
16 launchpad = Launchpad.login_with( ’ppastats’ , ’edge’ , cachedir, version= ’devel’ )
17 team = launchpad.people[ ’ubuntugis’ ]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name= ’ubuntugis-unstable’ )
24

25 #If you wanted to filter more here’s where you do it, you can do exact package names, dis
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd64"
27 binaries = getppa.getPublishedBinaries(status= ’Published’ ,binary_name= ’qgis’ ,exact_matc
28 result = getStats(binaries)
29 return
30 except:
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not completed scanni
39 stack = [package.binary_package_name,package.binary_package_version,str(package.getDo
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,R)?
50 d = datetime.datetime.today()
51 datestring = d.strftime( "%Y-%m- %d " )

7
52 filename = "ubuntugis-ppastats" +datestring+ ".csv"
53 w=csv.writer(file(filename, ’wb’ ))
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit( ’file %s , line %d : %s ’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__" :
63 getData(team)
64 print "Done"

7 murphy
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the
15 #API docs
16 launchpad = Launchpad.login_with( ’ppastats’ , ’edge’ , cachedir, version= ’devel’ )
17 team = launchpad.people[ ’ubuntugis’ ]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name= ’ubuntugis-unstable’ )
24

25 #If you wanted to filter more here’s where you do it, you can do exact package
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd
27 binaries = getppa.getPublishedBinaries(status= ’Published’ ,binary_name= ’qgis’ ,
28 result = getStats(binaries)

8
29 return
30 except:
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not completed scanni
39 stack = [package.binary_package_name,package.binary_package_version,str(package.getDo
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,R)?
50 d = datetime.datetime.today()
51 datestring = d.strftime( "%Y-%m- %d " )
52 filename = "ubuntugis-ppastats" +datestring+ ".csv"
53 w=csv.writer(file(filename, ’wb’ ))
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit( ’file %s , line %d : %s ’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__" :
63 getData(team)
64 print "Done"

8 vs
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel

9
6 # Version 0.1 Dec, 2010
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the
15 #API docs
16 launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’)
17 team = launchpad.people[’ubuntugis’]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name=’ubuntugis-unstable’)
24

25 #If you wanted to filter more here’s where you do it, you can do exact package
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd
27 binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,ex
28 result = getStats(binaries)
29 return
30 except:
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not comple
39 stack = [package.binary_package_name,package.binary_package_version,str(pac
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version +
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,
50 d = datetime.datetime.today()
51 datestring = d.strftime("%Y-%m-%d")

10
52 filename = "ubuntugis-ppastats"+datestring+".csv"
53 w=csv.writer(file(filename,’wb’))
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__":
63 getData(team)
64 print "Done"

9 trac
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the main serv
15 #API docs
16 launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’)
17 team = launchpad.people[’ubuntugis’]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name=’ubuntugis-unstable’)
24

25 #If you wanted to filter more here’s where you do it, you can do exact package names, dis
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd64"
27 binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,exact_match=
28 result = getStats(binaries)
29 return

11
30 except:
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not comple
39 stack = [package.binary_package_name,package.binary_package_version,str(pac
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version +
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,
50 d = datetime.datetime.today()
51 datestring = d.strftime("%Y-%m-%d")
52 filename = "ubuntugis-ppastats"+datestring+".csv"
53 w=csv.writer(file(filename,’wb’))
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__":
63 getData(team)
64 print "Done"

10 tango
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010
7

12
8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the main serv
15 #API docs
16 launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’)
17 team = launchpad.people[’ubuntugis’]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name=’ubuntugis-unstable’)
24

25 #If you wanted to filter more here’s where you do it, you can do exact package names, dis
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd64"
27 binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,exact_match=
28 result = getStats(binaries)
29 return
30 except:
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not completed scanni
39 stack = [package.binary_package_name,package.binary_package_version,str(package.getDo
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,R)?
50 d = datetime.datetime.today()
51 datestring = d.strftime("%Y-%m-%d")
52 filename = "ubuntugis-ppastats"+datestring+".csv"
53 w=csv.writer(file(filename,’wb’))

13
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__":
63 getData(team)
64 print "Done"

11 fruity
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since th
15 #API docs
16 launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’)
17 team = launchpad.people[’ubuntugis’]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name=’ubuntugis-unstable’)
24

25 #If you wanted to filter more here’s where you do it, you can do exact package
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/am
27 binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,ex
28 result = getStats(binaries)
29 return

14
30 except:
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not completed scanni
39 stack = [package.binary_package_name,package.binary_package_version,str(package.getDo
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,R)?
50 d = datetime.datetime.today()
51 datestring = d.strftime("%Y-%m-%d")
52 filename = "ubuntugis-ppastats"+datestring+".csv"
53 w=csv.writer(file(filename,’wb’))
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__":
63 getData(team)
64 print "Done"

12 autumn
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010

15
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the
15 #API docs
16 launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’)
17 team = launchpad.people[’ubuntugis’]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name=’ubuntugis-unstable’)
24

25 #If you wanted to filter more here’s where you do it, you can do exact package
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd
27 binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,ex
28 result = getStats(binaries)
29 return
30 except:
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not comple
39 stack = [package.binary_package_name,package.binary_package_version,str(pac
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version +
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,
50 d = datetime.datetime.today()
51 datestring = d.strftime("%Y-%m-%d")
52 filename = "ubuntugis-ppastats"+datestring+".csv"

16
53 w=csv.writer(file(filename,’wb’))
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__":
63 getData(team)
64 print "Done"

13 bw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the main serv
15 #API docs
16 launchpad = Launchpad.login_with(’ppastats’ , ’edge’ , cachedir, version=’devel’ )
17 team = launchpad.people[’ubuntugis’ ]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name=’ubuntugis-unstable’ )
24

25 #If you wanted to filter more here’s where you do it, you can do exact package names, dis
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd64"
27 binaries = getppa.getPublishedBinaries(status=’Published’ ,binary_name=’qgis’ ,exact_match
28 result = getStats(binaries)
29 return
30 except:

17
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not comple
39 stack = [package.binary_package_name,package.binary_package_version,str(pac
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version +
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,
50 d = datetime.datetime.today()
51 datestring = d.strftime("%Y-%m- %d " )
52 filename = "ubuntugis-ppastats" +datestring+".csv"
53 w=csv.writer(file(filename,’wb’ ))
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit(’file %s , line %d : %s ’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__" :
63 getData(team)
64 print "Done"

14 emacs
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010
7

8 #Script to compile the download statistics from Launchpad ppa for qgis

18
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the main serv
15 #API docs
16 launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’)
17 team = launchpad.people[’ubuntugis’]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name=’ubuntugis-unstable’)
24

25 #If you wanted to filter more here’s where you do it, you can do exact package names, dis
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd64"
27 binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,exact_match=
28 result = getStats(binaries)
29 return
30 except:
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not completed scanni
39 stack = [package.binary_package_name,package.binary_package_version,str(package.getDo
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,R)?
50 d = datetime.datetime.today()
51 datestring = d.strftime("%Y-%m-%d")
52 filename = "ubuntugis-ppastats"+datestring+".csv"
53 w=csv.writer(file(filename,’wb’))
54 w.writerows(data)

19
55 return
56

57 except csv.Error, e:
58 sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__":
63 getData(team)
64 print "Done"

15 pastie
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the
15 #API docs
16 launchpad = Launchpad.login_with( ’ppastats’ , ’edge’ , cachedir, version= ’devel’ )
17 team = launchpad.people[ ’ubuntugis’ ]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name= ’ubuntugis-unstable’ )
24

25 #If you wanted to filter more here’s where you do it, you can do exact package
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd
27 binaries = getppa.getPublishedBinaries(status= ’Published’ ,binary_name= ’qgis’ ,
28 result = getStats(binaries)
29 return
30 except:
31 print "error"
32

20
33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not completed scanni
39 stack = [package.binary_package_name,package.binary_package_version,str(package.getDo
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,R)?
50 d = datetime.datetime.today()
51 datestring = d.strftime( "%Y-%m- %d " )
52 filename = "ubuntugis-ppastats" +datestring+ ".csv"
53 w=csv.writer(file(filename, ’wb’ ))
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit( ’file %s , line %d : %s ’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__" :
63 getData(team)
64 print "Done"

16 friendly
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855

21
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the
15 #API docs
16 launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’)
17 team = launchpad.people[’ubuntugis’]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name=’ubuntugis-unstable’)
24

25 #If you wanted to filter more here’s where you do it, you can do exact package
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd
27 binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,ex
28 result = getStats(binaries)
29 return
30 except:
31 print "error"
32

33 def getStats(ppafiles):
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not comple
39 stack = [package.binary_package_name,package.binary_package_version,str(pac
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version +
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,
50 d = datetime.datetime.today()
51 datestring = d.strftime("%Y-%m-%d ")
52 filename = "ubuntugis-ppastats"+datestring+".csv"
53 w=csv.writer(file(filename,’wb’))
54 w.writerows(data)
55 return

22
56

57 except csv.Error, e:
58 sys.exit(’file %s , line %d : %s ’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__":
63 getData(team)
64 print "Done"

17 native
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3

4 # Licensed under the GPL v3


5 # Written by Alex Mandel
6 # Version 0.1 Dec, 2010
7

8 #Script to compile the download statistics from Launchpad ppa for qgis
9 #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855
10 from launchpadlib.launchpad import Launchpad
11 import csv, datetime
12 cachedir = "/home/madadh/.launchpadlib/cache/"
13

14 #Connect to launchpad as the ppastats user, using the edge development server since the main serv
15 #API docs
16 launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’)
17 team = launchpad.people[’ubuntugis’]
18 #Todo: Create a class for the launchpad connections
19

20 def getData(team):
21 try:
22 #Todo: Create loop to look at all 3 ppas stable, testing and unstable
23 getppa = team.getPPAByName(name=’ubuntugis-unstable’)
24

25 #If you wanted to filter more here’s where you do it, you can do exact package names, dis
26 #desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/amd64"
27 binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,exact_match=
28 result = getStats(binaries)
29 return
30 except:
31 print "error"
32

33 def getStats(ppafiles):

23
34 try:
35 #A list for holding the statistics
36 stats = []
37 for package in ppafiles:
38 #Note: Does not currently return the real value as launchpad has not comple
39 stack = [package.binary_package_name,package.binary_package_version,str(pac
40 stats.append(stack)
41 #print package.binary_package_name +"\t"+ package.binary_package_version +
42 writeout(stats)
43 return
44 except:
45 print "error getting stats"
46

47 def writeout(data):
48 try:
49 #write the stats out to a csv for import into something more analytic(database,
50 d = datetime.datetime.today()
51 datestring = d.strftime("%Y-%m-%d")
52 filename = "ubuntugis-ppastats"+datestring+".csv"
53 w=csv.writer(file(filename,’wb’))
54 w.writerows(data)
55 return
56

57 except csv.Error, e:
58 sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))
59

60

61

62 if __name__ == "__main__":
63 getData(team)
64 print "Done"

24

You might also like