scripts/github_stats.py
def write_repo_json(self, date=(datetime.date.today()),
        organization='llnl', dict_to_write={}, path_ending_type='',
        is_list=False, is_dict=False):
        """
        #Writes repo specific data to JSON.
        """
        for repo in dict_to_write:
            path = ('../github-data/' + organization + '/' + repo + '/' +
                 path_ending_type + '/' + str(date) + '.json')
            self.checkDir(path)
            with open(path, 'w') as out:
                if is_list:
                    out.write('[')
                    for value in dict_to_write[repo]:
                        if is_dict:
                            for inner_dict in value:
                                out.write(json.dumps(inner_dict, sort_keys=True,
                                    indent=4, separators=(',', ': ')) + ',')
                        else:
                            out.write(json.dumps(value, sort_keys=True,
                                indent=4, separators=(',', ': ')) + ',')
                    out.seek(-1, os.SEEK_END)#kill last comma
                    out.truncate()
                    out.write(']')
                else:
                    out.write(json.dumps(dict_to_write[repo], sort_keys=True,
                        indent=4, separators=(',', ': ')))
            out.close()
def write_repo_json(self, date=(datetime.date.today()),
        organization='llnl', dict_to_write={}, path_ending_type='',
        is_list=False, is_dict=False):
        """
        #Writes repo specific data to JSON.
        """
        for repo in dict_to_write:
            path = ('../github-data/' + organization + '/' + repo + '/' +
                 path_ending_type + '/' + str(date) + '.json')
            self.checkDir(path)
            with open(path, 'w') as out:
                if is_list:
                    out.write('[')
                    for value in dict_to_write[repo]:
                        if is_dict:
                            for inner_dict in value:
                                out.write(json.dumps(inner_dict, sort_keys=True,
                                    indent=4, separators=(',', ': ')) + ',')
                        else:
                            out.write(json.dumps(value, sort_keys=True,
                                indent=4, separators=(',', ': ')) + ',')
                    out.seek(-1, os.SEEK_END)#kill last comma
                    out.truncate()
                    out.write(']')
                else:
                    out.write(json.dumps(dict_to_write[repo], sort_keys=True,
                        indent=4, separators=(',', ': ')))
            out.close()
def write_repo_json ( self , date = ( datetime . date . today ( ) ) , organization = 'llnl' , dict_to_write = { } , path_ending_type = '' , is_list = False , is_dict = False ) : for repo in dict_to_write : path = ( '../github-data/' + organization + '/' + repo + '/' + path_ending_type + '/' + str ( date ) + '.json' ) self . checkDir ( path ) with open ( path , 'w' ) as out : if is_list : out . write ( '[' ) for value in dict_to_write [ repo ] : if is_dict : for inner_dict in value : out . write ( json . dumps ( inner_dict , sort_keys = True , indent = 4 , separators = ( ',' , ': ' ) ) + ',' ) else : out . write ( json . dumps ( value , sort_keys = True , indent = 4 , separators = ( ',' , ': ' ) ) + ',' ) out . seek ( - 1 , os . SEEK_END ) #kill last comma out . truncate ( ) out . write ( ']' ) else : out . write ( json . dumps ( dict_to_write [ repo ] , sort_keys = True , indent = 4 , separators = ( ',' , ': ' ) ) ) out . close ( )
#Writes repo specific data to JSON.
#Writes repo specific data to JSON .