Skip to content
Snippets Groups Projects
Commit e2e34b88 authored by Craig Tiller's avatar Craig Tiller
Browse files

Line counter

parent 0fe74d35
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import subprocess
import datetime
def daterange(start, end):
for n in range(int((end - start).days)):
yield start + datetime.timedelta(n)
start_date = datetime.date(2014, 11, 26)
end_date = datetime.date(2017, 3, 26)
for dt in daterange(start_date, end_date):
dmy = dt.strftime('%Y-%m-%d')
print dmy
subprocess.check_call(['tools/line_count/yaml2csv.py', '-i', '../count/%s.yaml' % dmy, '-d', dmy, '-o', '../count/%s.csv' % dmy])
#!/usr/bin/env python
import yaml
import argparse
import datetime
import csv
argp = argparse.ArgumentParser(description='Convert cloc yaml to bigquery csv')
argp.add_argument('-i', '--input', type=str)
argp.add_argument('-d', '--date', type=str, default=datetime.date.today().strftime('%Y-%m-%d'))
argp.add_argument('-o', '--output', type=str, default='out.csv')
args = argp.parse_args()
data = yaml.load(open(args.input).read())
with open(args.output, 'w') as outf:
writer = csv.DictWriter(outf, ['date', 'name', 'language', 'code', 'comment', 'blank'])
for key, value in data.iteritems():
if key == 'header': continue
if key == 'SUM': continue
if key.startswith('third_party/'): continue
row = {'name': key, 'date': args.date}
row.update(value)
writer.writerow(row)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment