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
1 2 3 4 5 6 7 8 9

default

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);

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 2 3 4 5 6 7 8 9

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);

3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

manni

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010 #Script to compile the download statistics from Launchpad ppa for qgis #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855 from launchpadlib.launchpad import Launchpad import csv, datetime cachedir = "/home/madadh/.launchpadlib/cache/"

#Connect to launchpad as the ppastats user, using the edge development server since the #API docs launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’) team = launchpad.people[’ubuntugis’] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name=’ubuntugis-unstable’)

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

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,exact_match= result = getStats(binaries) return except: print "error"

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not completed scanni stack = [package.binary_package_name,package.binary_package_version,str(package.getDo stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str writeout(stats) return except: print "error getting stats" def writeout(data): try: #write the stats out to a csv for import into something more analytic(database,R)? d = datetime.datetime.today() datestring = d.strftime("%Y-%m-%d") filename = "ubuntugis-ppastats"+datestring+".csv" w=csv.writer(file(filename,’wb’)) w.writerows(data) return except csv.Error, e: sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))

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

4
1 2 3 4

perldoc

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 3

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

# Written by Alex Mandel # Version 0.1 Dec, 2010 #Script to compile the download statistics from Launchpad ppa for qgis #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855 from launchpadlib.launchpad import Launchpad import csv, datetime cachedir = "/home/madadh/.launchpadlib/cache/"

#Connect to launchpad as the ppastats user, using the edge development server since the #API docs launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’) team = launchpad.people[’ubuntugis’] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name=’ubuntugis-unstable’)

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

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not comple stack = [package.binary_package_name,package.binary_package_version,str(pac stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + writeout(stats) return except: print "error getting stats"

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

51 52 53 54 55 56 57 58 59 60 61 62 63 64

datestring = d.strftime("%Y-%m-%d") filename = "ubuntugis-ppastats"+datestring+".csv" w=csv.writer(file(filename,’wb’)) w.writerows(data) return except csv.Error, e: sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))

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

5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

borland

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010 #Script to compile the download statistics from Launchpad ppa for qgis #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855 from launchpadlib.launchpad import Launchpad import csv, datetime cachedir = "/home/madadh/.launchpadlib/cache/"

#Connect to launchpad as the ppastats user, using the edge development server since the main serv #API docs launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’) team = launchpad.people[’ubuntugis’] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name=’ubuntugis-unstable’)

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

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

return except: print "error"

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not comple stack = [package.binary_package_name,package.binary_package_version,str(pac stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + writeout(stats) return except: print "error getting stats"

def writeout(data): try: #write the stats out to a csv for import into something more analytic(database, d = datetime.datetime.today() datestring = d.strftime("%Y-%m-%d") filename = "ubuntugis-ppastats"+datestring+".csv" w=csv.writer(file(filename,’wb’)) w.writerows(data) return except csv.Error, e: sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))

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

6
1 2 3 4 5 6

colorful

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010 6

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

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

#Connect to launchpad as the ppastats user, using the edge development server since the main serv #API docs launchpad = Launchpad.login_with( ’ppastats’ , ’edge’ , cachedir, version= ’devel’ ) team = launchpad.people[ ’ubuntugis’ ] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name= ’ubuntugis-unstable’ )

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

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not completed scanni stack = [package.binary_package_name,package.binary_package_version,str(package.getDo stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str writeout(stats) return except: print "error getting stats" def writeout(data): try: #write the stats out to a csv for import into something more analytic(database,R)? d = datetime.datetime.today() datestring = d.strftime( "%Y-%m- %d " )

7

52 53 54 55 56 57 58 59 60 61 62 63 64

filename = "ubuntugis-ppastats" +datestring+ ".csv" w=csv.writer(file(filename, ’wb’ )) w.writerows(data) return except csv.Error, e: sys.exit( ’file %s , line

%d :

%s ’ % (filename, reader.line_num, e))

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

7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

murphy

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010 #Script to compile the download statistics from Launchpad ppa for qgis #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855 from launchpadlib.launchpad import Launchpad import csv, datetime cachedir = "/home/madadh/.launchpadlib/cache/"

#Connect to launchpad as the ppastats user, using the edge development server since the #API docs launchpad = Launchpad.login_with( ’ppastats’ , ’edge’ , cachedir, version= ’devel’ ) team = launchpad.people[ ’ubuntugis’ ] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name= ’ubuntugis-unstable’ )

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

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

return except: print "error"

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not completed scanni stack = [package.binary_package_name,package.binary_package_version,str(package.getDo stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str writeout(stats) return except: print "error getting stats" def writeout(data): try: #write the stats out to a csv for import into something more analytic(database,R)? d = datetime.datetime.today() datestring = d.strftime( "%Y-%m- %d " ) filename = "ubuntugis-ppastats" +datestring+ ".csv" w=csv.writer(file(filename, ’wb’ )) w.writerows(data) return except csv.Error, e: sys.exit( ’file %s , line

%d :

%s ’ % (filename, reader.line_num, e))

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

8
1 2 3 4 5

vs

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel 9

6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

# Version 0.1 Dec, 2010 #Script to compile the download statistics from Launchpad ppa for qgis #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855 from launchpadlib.launchpad import Launchpad import csv, datetime cachedir = "/home/madadh/.launchpadlib/cache/"

#Connect to launchpad as the ppastats user, using the edge development server since the #API docs launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’) team = launchpad.people[’ubuntugis’] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name=’ubuntugis-unstable’)

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

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not comple stack = [package.binary_package_name,package.binary_package_version,str(pac stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + writeout(stats) return except: print "error getting stats"

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

52 53 54 55 56 57 58 59 60 61 62 63 64

filename = "ubuntugis-ppastats"+datestring+".csv" w=csv.writer(file(filename,’wb’)) w.writerows(data) return except csv.Error, e: sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))

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

9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

trac

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010 #Script to compile the download statistics from Launchpad ppa for qgis #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855 from launchpadlib.launchpad import Launchpad import csv, datetime cachedir = "/home/madadh/.launchpadlib/cache/"

#Connect to launchpad as the ppastats user, using the edge development server since the main serv #API docs launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’) team = launchpad.people[’ubuntugis’] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name=’ubuntugis-unstable’)

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

30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

except: print "error"

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not comple stack = [package.binary_package_name,package.binary_package_version,str(pac stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + writeout(stats) return except: print "error getting stats"

def writeout(data): try: #write the stats out to a csv for import into something more analytic(database, d = datetime.datetime.today() datestring = d.strftime("%Y-%m-%d") filename = "ubuntugis-ppastats"+datestring+".csv" w=csv.writer(file(filename,’wb’)) w.writerows(data) return except csv.Error, e: sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))

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

10
1 2 3 4 5 6 7

tango

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010

12

8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

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

#Connect to launchpad as the ppastats user, using the edge development server since the main serv #API docs launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’) team = launchpad.people[’ubuntugis’] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name=’ubuntugis-unstable’)

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

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not completed scanni stack = [package.binary_package_name,package.binary_package_version,str(package.getDo stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str writeout(stats) return except: print "error getting stats" def writeout(data): try: #write the stats out to a csv for import into something more analytic(database,R)? d = datetime.datetime.today() datestring = d.strftime("%Y-%m-%d") filename = "ubuntugis-ppastats"+datestring+".csv" w=csv.writer(file(filename,’wb’)) 13

54 55 56 57 58 59 60 61 62 63 64

w.writerows(data) return except csv.Error, e: sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))

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

11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

fruity

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010 #Script to compile the download statistics from Launchpad ppa for qgis #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855 from launchpadlib.launchpad import Launchpad import csv, datetime cachedir = "/home/madadh/.launchpadlib/cache/"

#Connect to launchpad as the ppastats user, using the edge development server since th #API docs launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’) team = launchpad.people[’ubuntugis’] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name=’ubuntugis-unstable’)

#If you wanted to filter more here’s where you do it, you can do exact package

#desired_dist_and_arch = "https://api.edge.launchpad.net/devel/ubuntu/lucid/am binaries = getppa.getPublishedBinaries(status=’Published’,binary_name=’qgis’,ex result = getStats(binaries) return 14

30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

except: print "error"

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not completed scanni stack = [package.binary_package_name,package.binary_package_version,str(package.getDo stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str writeout(stats) return except: print "error getting stats" def writeout(data): try: #write the stats out to a csv for import into something more analytic(database,R)? d = datetime.datetime.today() datestring = d.strftime("%Y-%m-%d") filename = "ubuntugis-ppastats"+datestring+".csv" w=csv.writer(file(filename,’wb’)) w.writerows(data) return except csv.Error, e: sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))

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

12
1 2 3 4 5 6

autumn

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010 15

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

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

#Connect to launchpad as the ppastats user, using the edge development server since the #API docs launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’) team = launchpad.people[’ubuntugis’] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name=’ubuntugis-unstable’)

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

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not comple stack = [package.binary_package_name,package.binary_package_version,str(pac stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + writeout(stats) return except: print "error getting stats"

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

53 54 55 56 57 58 59 60 61 62 63 64

w=csv.writer(file(filename,’wb’)) w.writerows(data) return except csv.Error, e: sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))

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

13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

bw

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010 #Script to compile the download statistics from Launchpad ppa for qgis #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855 from launchpadlib.launchpad import Launchpad import csv, datetime cachedir = "/home/madadh/.launchpadlib/cache/"

#Connect to launchpad as the ppastats user, using the edge development server since the main serv #API docs launchpad = Launchpad.login_with(’ppastats’ , ’edge’ , cachedir, version=’devel’ ) team = launchpad.people[’ubuntugis’ ] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name=’ubuntugis-unstable’ )

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

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

print "error"

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not comple stack = [package.binary_package_name,package.binary_package_version,str(pac stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + writeout(stats) return except: print "error getting stats"

def writeout(data): try: #write the stats out to a csv for import into something more analytic(database, d = datetime.datetime.today() datestring = d.strftime("%Y-%m- %d " ) filename = "ubuntugis-ppastats" +datestring+".csv" w=csv.writer(file(filename,’wb’ )) w.writerows(data) return except csv.Error, e: sys.exit(’file %s , line %d : %s ’ % (filename, reader.line_num, e))

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

14
1 2 3 4 5 6 7 8

emacs

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010 #Script to compile the download statistics from Launchpad ppa for qgis 18

9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

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

#Connect to launchpad as the ppastats user, using the edge development server since the main serv #API docs launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’) team = launchpad.people[’ubuntugis’] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name=’ubuntugis-unstable’)

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

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not completed scanni stack = [package.binary_package_name,package.binary_package_version,str(package.getDo stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str writeout(stats) return except: print "error getting stats" def writeout(data): try: #write the stats out to a csv for import into something more analytic(database,R)? d = datetime.datetime.today() datestring = d.strftime("%Y-%m-%d") filename = "ubuntugis-ppastats"+datestring+".csv" w=csv.writer(file(filename,’wb’)) w.writerows(data) 19

55 56 57 58 59 60 61 62 63 64

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

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

15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

pastie

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010 #Script to compile the download statistics from Launchpad ppa for qgis #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855 from launchpadlib.launchpad import Launchpad import csv, datetime cachedir = "/home/madadh/.launchpadlib/cache/"

#Connect to launchpad as the ppastats user, using the edge development server since the #API docs launchpad = Launchpad.login_with( ’ppastats’ , ’edge’ , cachedir, version= ’devel’ ) team = launchpad.people[ ’ubuntugis’ ] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name= ’ubuntugis-unstable’ )

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

20

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not completed scanni stack = [package.binary_package_name,package.binary_package_version,str(package.getDo stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + "\t" + str writeout(stats) return except: print "error getting stats" def writeout(data): try: #write the stats out to a csv for import into something more analytic(database,R)? d = datetime.datetime.today() datestring = d.strftime( "%Y-%m- %d " ) filename = "ubuntugis-ppastats" +datestring+ ".csv" w=csv.writer(file(filename, ’wb’ )) w.writerows(data) return except csv.Error, e: sys.exit( ’file %s , line

%d :

%s ’ % (filename, reader.line_num, e))

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

16
1 2 3 4 5 6 7 8 9

friendly

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010 #Script to compile the download statistics from Launchpad ppa for qgis #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855 21

10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

from launchpadlib.launchpad import Launchpad import csv, datetime cachedir = "/home/madadh/.launchpadlib/cache/"

#Connect to launchpad as the ppastats user, using the edge development server since the #API docs launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’) team = launchpad.people[’ubuntugis’] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name=’ubuntugis-unstable’)

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

def getStats(ppafiles): try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not comple stack = [package.binary_package_name,package.binary_package_version,str(pac stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + writeout(stats) return except: print "error getting stats"

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

56 57 58 59 60 61 62 63 64

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

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

17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

native

#!/usr/bin/python # -*- coding: utf-8 -*# Licensed under the GPL v3 # Written by Alex Mandel # Version 0.1 Dec, 2010 #Script to compile the download statistics from Launchpad ppa for qgis #Based on ticket https://bugs.launchpad.net/soyuz/+bug/139855 from launchpadlib.launchpad import Launchpad import csv, datetime cachedir = "/home/madadh/.launchpadlib/cache/"

#Connect to launchpad as the ppastats user, using the edge development server since the main serv #API docs launchpad = Launchpad.login_with(’ppastats’, ’edge’, cachedir, version=’devel’) team = launchpad.people[’ubuntugis’] #Todo: Create a class for the launchpad connections def getData(team): try: #Todo: Create loop to look at all 3 ppas stable, testing and unstable getppa = team.getPPAByName(name=’ubuntugis-unstable’)

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

34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

try: #A list for holding the statistics stats = [] for package in ppafiles: #Note: Does not currently return the real value as launchpad has not comple stack = [package.binary_package_name,package.binary_package_version,str(pac stats.append(stack) #print package.binary_package_name +"\t"+ package.binary_package_version + writeout(stats) return except: print "error getting stats"

def writeout(data): try: #write the stats out to a csv for import into something more analytic(database, d = datetime.datetime.today() datestring = d.strftime("%Y-%m-%d") filename = "ubuntugis-ppastats"+datestring+".csv" w=csv.writer(file(filename,’wb’)) w.writerows(data) return except csv.Error, e: sys.exit(’file %s, line %d: %s’ % (filename, reader.line_num, e))

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

24

Sign up to vote on this title
UsefulNot useful