aboutsummaryrefslogtreecommitdiff
path: root/license_summary.py
diff options
context:
space:
mode:
Diffstat (limited to 'license_summary.py')
-rw-r--r--license_summary.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/license_summary.py b/license_summary.py
index 7e7899c..e5edaba 100644
--- a/license_summary.py
+++ b/license_summary.py
@@ -2,9 +2,6 @@
import pandas as pd
-store = pd.HDFStore('cp.h5')
-cpf = store['cp_files']
-
def histogram(values):
hist = {}
@@ -14,8 +11,12 @@ def histogram(values):
return hist
-licenses = histogram(cpf['_license'])
+if __name__ == '__main__':
+ store = pd.HDFStore('cp.h5')
+ cpf = store['cp_files']
+
+ licenses = list(histogram(cpf['_license']))
-for (k, v) in sorted(licenses.iteritems(), key=lambda x: x[1], reverse=True):
- print '%-40s %6d' % (k.encode('utf8'), v)
+ for (k, v) in sorted(licenses, key=lambda x: x[1], reverse=True):
+ print '%-40s %6d' % (k.encode('utf8'), v)