<commit_before>#!/usr/bin/env python
from billy import db
from billy.conf import settings, base_arg_parser
from billy.utils import configure_logging
from billy.reports.bills import bill_report
from billy.reports.legislators import legislator_report
from billy.reports.committees import committee_report

def main():
    import sys
    import argparse

    parser = argparse.ArgumentParser(description='generate reports',
                                     parents=[base_arg_parser])
    parser.add_argument('abbrs', nargs='+',
                        help='states to update reports for')
    args = parser.parse_args()
    settings.update(args)
    configure_logging(args.verbose)

    for abbr in args.abbrs:
        report = db.reports.find_one({'_id': abbr})
        if not report:
            report = {'_id': abbr}
        print 'updating %s reports...' % abbr
        report['bills'] = bill_report(abbr)
        report['legislators'] = legislator_report(abbr)
        report['committees'] = committee_report(abbr)

    db.reports.save(report, safe=True)

if __name__ == '__main__':
    main()
<commit_msg>save all reports<commit_after>#!/usr/bin/env python
from billy import db
from billy.conf import settings, base_arg_parser
from billy.utils import configure_logging
from billy.reports.bills import bill_report
from billy.reports.legislators import legislator_report
from billy.reports.committees import committee_report

def main():
    import sys
    import argparse

    parser = argparse.ArgumentParser(description='generate reports',
                                     parents=[base_arg_parser])
    parser.add_argument('abbrs', nargs='+',
                        help='states to update reports for')
    args = parser.parse_args()
    settings.update(args)
    configure_logging(args.verbose)

    for abbr in args.abbrs:
        report = db.reports.find_one({'_id': abbr})
        if not report:
            report = {'_id': abbr}
        print 'updating %s reports...' % abbr
        report['bills'] = bill_report(abbr)
        report['legislators'] = legislator_report(abbr)
        report['committees'] = committee_report(abbr)

        db.reports.save(report, safe=True)

if __name__ == '__main__':
    main()

{'fraction_non_alphanumeric': 0.10300044782803404, 'fraction_numerical': 0.0, 'mean_word_length': 2.982174688057041, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5243729', 'n_tokens_mistral': 669, 'n_tokens_neox': 642, 'n_words': 158}