1515
1616DEFAULT_TIMEOUT_SECONDS : float = 20
1717
18- IS_FILE_VALID = IS_FILE_INVALID = bool
19-
2018
2119def main (full_file_paths : Iterable [str ]) -> bool :
22- return validate_unique_names () and all (map (validate_notebook , full_file_paths ))
20+ return validate_unique_names () and all (map (is_valid_notebook , full_file_paths ))
2321
2422
25- def validate_notebook (
26- file_path : str , automatically_add_timeout : bool = True
27- ) -> IS_FILE_VALID :
23+ def is_valid_notebook (file_path : str , automatically_add_timeout : bool = True ) -> bool :
2824 file_name = os .path .basename (file_path )
2925
3026 errors = []
@@ -43,16 +39,16 @@ def validate_notebook(
4339
4440 if errors :
4541 spacing = "\n \t " # f-string cannot include backslash
46- print (f"file `{ file_path } ` has error:{ spacing } { spacing .join (errors )} " )
42+ print (f"File `{ file_path } ` has error(s) :{ spacing } { spacing .join (errors )} " )
4743
4844 return not errors
4945
5046
51- def _does_contain_dash_in_file_name (file_name : str ) -> IS_FILE_INVALID :
47+ def _does_contain_dash_in_file_name (file_name : str ) -> bool :
5248 return "-" in file_name
5349
5450
55- def _is_file_in_timeouts (file_name : str ) -> IS_FILE_VALID :
51+ def _is_file_in_timeouts (file_name : str ) -> bool :
5652 with TIMEOUTS_FILE .open ("r" ) as f :
5753 timeouts = yaml .safe_load (f )
5854
@@ -76,7 +72,7 @@ def validate_unique_names() -> bool:
7672 duplicate_names = [name for name , count in Counter (base_names ).items () if count > 1 ]
7773
7874 if duplicate_names :
79- print (f"notebooks with duplicate names found: { duplicate_names } " )
75+ print (f"Notebooks with duplicate names found: { duplicate_names } " )
8076
8177 is_ok = not duplicate_names
8278 return is_ok
0 commit comments