scripts/github_stats.py
def write_to_file(self, file_path='', date=str(datetime.date.today()),
        organization='N/A', members=0, teams=0):
        """
        Writes the current organization information to file (csv).
        """
        self.checkDir(file_path)
        with open(file_path, 'w+') as output:
            output.write('date,organization,members,teams,unique_contributors,'
            + 'repository,contributors,forks,stargazers,pull_requests,'
            + 'open_issues,has_readme,has_license,languages,pull_requests_open,'
            + 'pull_requests_closed,commits,closed_issues,issues\n' + date + ','
            + organization + ',' + str(members) + ',' + str(teams) + ','
            + str(len(self.unique_contributors)) + '\n')
            for repo in self.all_repos:
                output.write(',,,,,' + repo.name + ',' + str(repo.contributors)
                    + ',' + str(repo.forks) + ','
                    + str(repo.stargazers) + ',' + str(repo.pull_requests) + ','
                    + str(repo.open_issues) + ',' + str(repo.readme) + ','
                    + str(repo.license) + ',' + ' '.join(sorted(repo.languages))
                    + ',' + str(repo.pull_requests_open) + ','
                    + str(repo.pull_requests_closed) + ',' + str(repo.commits)
                    + ',' + str(repo.closed_issues) + ',' + str(repo.issues)
                    + '\n')
            output.write(',,,,total,' + str(self.total_repos) + ','
                + str(self.total_contributors) + ','
                + str(self.total_forks) + ',' + str(self.total_stars) + ','
                + str(self.total_pull_reqs) + ',' + str(self.total_open_issues)
                + ',' + str(self.total_readmes) + ',' + str(self.total_licenses)
                + ',,' + str(self.total_pull_reqs_open) + ','
                + str(self.total_pull_reqs_closed) + ','
                + str(self.total_commits) + ',' + str(self.total_closed_issues)
                + ',' + str(self.total_issues))
        output.close()
        #Update total
        self.write_totals(file_path="../github_stats_output/total.csv", date=date,
            organization=organization, members=members, teams=teams)
        #Update language sizes
        self.write_languages(file_path='../github_stats_output/languages.csv',
            date=date)
def write_to_file(self, file_path='', date=str(datetime.date.today()),
        organization='N/A', members=0, teams=0):
        """
        Writes the current organization information to file (csv).
        """
        self.checkDir(file_path)
        with open(file_path, 'w+') as output:
            output.write('date,organization,members,teams,unique_contributors,'
            + 'repository,contributors,forks,stargazers,pull_requests,'
            + 'open_issues,has_readme,has_license,languages,pull_requests_open,'
            + 'pull_requests_closed,commits,closed_issues,issues\n' + date + ','
            + organization + ',' + str(members) + ',' + str(teams) + ','
            + str(len(self.unique_contributors)) + '\n')
            for repo in self.all_repos:
                output.write(',,,,,' + repo.name + ',' + str(repo.contributors)
                    + ',' + str(repo.forks) + ','
                    + str(repo.stargazers) + ',' + str(repo.pull_requests) + ','
                    + str(repo.open_issues) + ',' + str(repo.readme) + ','
                    + str(repo.license) + ',' + ' '.join(sorted(repo.languages))
                    + ',' + str(repo.pull_requests_open) + ','
                    + str(repo.pull_requests_closed) + ',' + str(repo.commits)
                    + ',' + str(repo.closed_issues) + ',' + str(repo.issues)
                    + '\n')
            output.write(',,,,total,' + str(self.total_repos) + ','
                + str(self.total_contributors) + ','
                + str(self.total_forks) + ',' + str(self.total_stars) + ','
                + str(self.total_pull_reqs) + ',' + str(self.total_open_issues)
                + ',' + str(self.total_readmes) + ',' + str(self.total_licenses)
                + ',,' + str(self.total_pull_reqs_open) + ','
                + str(self.total_pull_reqs_closed) + ','
                + str(self.total_commits) + ',' + str(self.total_closed_issues)
                + ',' + str(self.total_issues))
        output.close()
        #Update total
        self.write_totals(file_path="../github_stats_output/total.csv", date=date,
            organization=organization, members=members, teams=teams)
        #Update language sizes
        self.write_languages(file_path='../github_stats_output/languages.csv',
            date=date)
def write_to_file ( self , file_path = '' , date = str ( datetime . date . today ( ) ) , organization = 'N/A' , members = 0 , teams = 0 ) : self . checkDir ( file_path ) with open ( file_path , 'w+' ) as output : output . write ( 'date,organization,members,teams,unique_contributors,' + 'repository,contributors,forks,stargazers,pull_requests,' + 'open_issues,has_readme,has_license,languages,pull_requests_open,' + 'pull_requests_closed,commits,closed_issues,issues\n' + date + ',' + organization + ',' + str ( members ) + ',' + str ( teams ) + ',' + str ( len ( self . unique_contributors ) ) + '\n' ) for repo in self . all_repos : output . write ( ',,,,,' + repo . name + ',' + str ( repo . contributors ) + ',' + str ( repo . forks ) + ',' + str ( repo . stargazers ) + ',' + str ( repo . pull_requests ) + ',' + str ( repo . open_issues ) + ',' + str ( repo . readme ) + ',' + str ( repo . license ) + ',' + ' ' . join ( sorted ( repo . languages ) ) + ',' + str ( repo . pull_requests_open ) + ',' + str ( repo . pull_requests_closed ) + ',' + str ( repo . commits ) + ',' + str ( repo . closed_issues ) + ',' + str ( repo . issues ) + '\n' ) output . write ( ',,,,total,' + str ( self . total_repos ) + ',' + str ( self . total_contributors ) + ',' + str ( self . total_forks ) + ',' + str ( self . total_stars ) + ',' + str ( self . total_pull_reqs ) + ',' + str ( self . total_open_issues ) + ',' + str ( self . total_readmes ) + ',' + str ( self . total_licenses ) + ',,' + str ( self . total_pull_reqs_open ) + ',' + str ( self . total_pull_reqs_closed ) + ',' + str ( self . total_commits ) + ',' + str ( self . total_closed_issues ) + ',' + str ( self . total_issues ) ) output . close ( ) #Update total self . write_totals ( file_path = "../github_stats_output/total.csv" , date = date , organization = organization , members = members , teams = teams ) #Update language sizes self . write_languages ( file_path = '../github_stats_output/languages.csv' , date = date )
Writes the current organization information to file (csv).
Writes the current organization information to file ( csv ) .