@@ -21,7 +21,9 @@ def branches_from_devguide(devguide_dir: Path) -> list[str]:
2121 ]
2222
2323
24- def get_completion (clones_dir : str , repo : str ) -> tuple [float , 'TranslatorsData' , str , float ]:
24+ def get_completion (
25+ clones_dir : str , repo : str
26+ ) -> tuple [float , 'TranslatorsData' , str , float ]:
2527 clone_path = Path (clones_dir , repo )
2628 for branch in branches_from_devguide (Path (clones_dir , 'devguide' )) + ['master' ]:
2729 try :
@@ -46,19 +48,27 @@ def get_completion(clones_dir: str, repo: str) -> tuple[float, 'TranslatorsData'
4648 api_url = '' ,
4749 ).completion
4850
49- subprocess .run (['git' , 'checkout' , 'HEAD@{30 days ago}' ], cwd = clone_path , check = True )
50- with TemporaryDirectory () as tmpdir :
51- month_ago_completion = potodo .merge_and_scan_path (
52- clone_path ,
53- pot_path = Path (clones_dir , 'cpython/Doc/build/gettext' ),
54- merge_path = Path (tmpdir ),
55- hide_reserved = False ,
56- api_url = '' ,
57- ).completion
51+ try :
52+ subprocess .run (
53+ ['git' , 'checkout' , 'HEAD@{30 days ago}' ], cwd = clone_path , check = True
54+ )
55+ with TemporaryDirectory () as tmpdir :
56+ month_ago_completion = potodo .merge_and_scan_path (
57+ clone_path ,
58+ pot_path = Path (clones_dir , 'cpython/Doc/build/gettext' ),
59+ merge_path = Path (tmpdir ),
60+ hide_reserved = False ,
61+ api_url = '' ,
62+ ).completion
63+ except FileNotFoundError :
64+ print (f'{ repo } is empty' )
65+ month_ago_completion = 0.0
5866
5967 change = completion - month_ago_completion
68+
6069 return completion , translators_data , branch , change
6170
71+
6272@dataclass (frozen = True )
6373class TranslatorsData :
6474 number : int
0 commit comments