<s> import os <EOL> import csv <EOL> import time <EOL> import agate <EOL> import calculate <EOL> from github import Github <EOL> from pprint import pprint <EOL> from datetime import datetime <EOL> from csvkit import CSVKitDictWriter <EOL> from django . conf import settings <EOL> from calaccess_raw import get_model_list <EOL> from calaccess_raw . management . commands import CalAccessCommand <EOL> from django . contrib . humanize . templatetags . humanize import intcomma <EOL> class Command ( CalAccessCommand ) : <EOL> help = '<STR_LIT>' <EOL> def set_options ( self , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> self . data_dir = os . path . join ( <EOL> settings . BASE_DIR , <EOL> '<STR_LIT>' <EOL> ) <EOL> os . path . exists ( self . data_dir ) or os . mkdir ( self . data_dir ) <EOL> self . gh = Github ( os . getenv ( '<STR_LIT>' ) ) <EOL> self . org = self . gh . get_organization ( "<STR_LIT>" ) <EOL> self . repo_list = self . org . get_repos ( ) <EOL> def handle ( self , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> super ( Command , self ) . handle ( * args , ** kwargs ) <EOL> self . set_options ( ) <EOL> self . header ( "<STR_LIT>" ) <EOL> self . headers = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:name>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:location>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> self . outfile_path = os . path . join ( <EOL> self . data_dir , <EOL> '<STR_LIT>' <EOL> ) <EOL> self . outfile = CSVKitDictWriter ( <EOL> open ( self . outfile_path , '<STR_LIT:wb>' ) , <EOL> fieldnames = self . headers <EOL> ) <EOL> self . outfile . writeheader ( ) <EOL> for repo in self . repo_list : <EOL> self . log ( "<STR_LIT>" % repo . name ) <EOL> contributor_list = repo . get_contributors ( ) <EOL> for contrib in contributor_list : <EOL> d = dict ( <EOL> repo = repo . name , <EOL> name = contrib . login , <EOL> company = contrib . company , <EOL> location = contrib . location , <EOL> avatar_url = contrib . avatar_url , <EOL> contributions = contrib . contributions <EOL> ) <EOL> self . outfile . writerow ( d ) <EOL> time . sleep ( <NUM_LIT:1> ) </s>
