9
9
10
10
def run_each_repo (username , token , reponame , save_csv = True ):
11
11
if save_csv :
12
- os .system (f' gts { username } :{ token } { reponame } ' )
12
+ os .system (f" gts { username } :{ token } { reponame } " )
13
13
else :
14
- os .system (f' gts { username } :{ token } { reponame } no_csv' )
14
+ os .system (f" gts { username } :{ token } { reponame } no_csv" )
15
15
16
16
17
- def get_top_paths (username : str , token : str , reponame : str ,
18
- save_csv : bool = True ):
17
+ def get_top_paths (
18
+ username : str , token : str , reponame : str , save_csv : bool = True
19
+ ):
19
20
20
21
now = dt .now ()
21
22
@@ -25,16 +26,16 @@ def get_top_paths(username: str, token: str, reponame: str,
25
26
if len (top_path_list ) > 0 :
26
27
result = [p .raw_data for p in top_path_list ]
27
28
df = pd .DataFrame .from_records (result )
28
- pandas_write_buffer (df , [' path' , ' count' , ' uniques' ], reponame )
29
- df .insert (loc = 0 , column = ' date' , value = now .strftime (' %Y-%m-%d' ))
29
+ pandas_write_buffer (df , [" path" , " count" , " uniques" ], reponame )
30
+ df .insert (loc = 0 , column = " date" , value = now .strftime (" %Y-%m-%d" ))
30
31
31
32
if save_csv :
32
33
outfile = f"{ now .strftime ('%Y-%m-%d-%Hh-%Mm' )} -paths-stats.csv"
33
34
path = Path (outfile )
34
35
if not path .exists ():
35
36
df .to_csv (path , index = False , header = True )
36
37
else :
37
- df .to_csv (path , mode = 'a' , index = False , header = False )
38
+ df .to_csv (path , mode = "a" , index = False , header = False )
38
39
else :
39
40
print (f"Empty top paths for { reponame } " )
40
41
@@ -45,4 +46,3 @@ def pandas_write_buffer(df, columns, reponame):
45
46
print (f"> { reponame } - Top paths" )
46
47
print (buffer .getvalue ())
47
48
buffer .close ()
48
-
0 commit comments