-
Notifications
You must be signed in to change notification settings - Fork 0
/
license_stats
executable file
·37 lines (31 loc) · 1.12 KB
/
license_stats
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
34
35
36
37
#!/usr/bin/python -B
# -*- coding: utf-8 -*-
###############################################################################
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
###############################################################################
#
# This script prints various stats about a slic output file.
import json
import sys
import re
from slic_results import SlicResults
# Load occurrence data file
occurrences = SlicResults()
occurrences.load_json(sys.argv[1])
file_count = 0
boilerplate_count = 0
licenses = {}
for data in occurrences.itervalues():
boilerplate_count = boilerplate_count + 1
file_count = file_count + len(data['files'])
tag = data['tag']
tag = re.sub("_.*", "", tag)
licenses[tag] = 1
print "Unique license boilerplate instances: %i" % boilerplate_count
print "Unique license tags: %i" % len(occurrences)
print "Unique licenses: %i" % len(licenses)
print "Files: %i" % file_count
# for tag in sorted(licenses.keys()):
# print tag