mirror of
https://github.com/firmai/financial-machine-learning.git
synced 2026-08-24 00:08:09 +00:00
handle empty repo
This commit is contained in:
@@ -12,6 +12,7 @@ from git_util import get_github_client, get_repo_attributes_dict
|
|||||||
def convert_repo_list_to_df(repo_list, category):
|
def convert_repo_list_to_df(repo_list, category):
|
||||||
df_list = []
|
df_list = []
|
||||||
for repo in repo_list:
|
for repo in repo_list:
|
||||||
|
print(repo)
|
||||||
attr_dict = get_repo_attributes_dict(repo)
|
attr_dict = get_repo_attributes_dict(repo)
|
||||||
attr_dict['name'] = repo.name
|
attr_dict['name'] = repo.name
|
||||||
attr_dict['comment'] = 'NEW'
|
attr_dict['comment'] = 'NEW'
|
||||||
|
|||||||
+5
-1
@@ -1,4 +1,4 @@
|
|||||||
from github import Github, Repository
|
from github import Github, Repository, GithubException
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
@@ -39,6 +39,8 @@ def get_last_commit_date(input_repo: Repository):
|
|||||||
|
|
||||||
|
|
||||||
def get_repo_attributes_dict(input_repo: Repository, last_commit_within_years: int = 2):
|
def get_repo_attributes_dict(input_repo: Repository, last_commit_within_years: int = 2):
|
||||||
|
result_dict = {}
|
||||||
|
try:
|
||||||
result_dict = {
|
result_dict = {
|
||||||
'repo_path': input_repo.full_name,
|
'repo_path': input_repo.full_name,
|
||||||
'created_at': input_repo.created_at,
|
'created_at': input_repo.created_at,
|
||||||
@@ -59,5 +61,7 @@ def get_repo_attributes_dict(input_repo: Repository, last_commit_within_years: i
|
|||||||
else:
|
else:
|
||||||
repo_status = 'inactive'
|
repo_status = 'inactive'
|
||||||
result_dict['repo_status'] = repo_status
|
result_dict['repo_status'] = repo_status
|
||||||
|
except GithubException as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
return result_dict
|
return result_dict
|
||||||
|
|||||||
Reference in New Issue
Block a user