44import configparser
55import sys
66from pathlib import Path
7- from typing import NoReturn
7+ from typing import NoReturn , Union
88
99
1010FAIL = "\033 [91m"
1111ENDC = "\033 [0m"
1212REPO_TYPES_CFG = "repo-types.cfg"
1313
1414
15- def check_if_allowed (path : Path ) -> bool | NoReturn :
15+ def check_if_allowed (path : Path ) -> Union [ bool , NoReturn ] :
1616 if REPO_TYPES_CFG not in (str (item ) for item in path .iterdir ()):
17- print (
18- f"{ FAIL } The current directory is not configured for repository management{ ENDC } "
19- )
17+ print (f"{ FAIL } The current directory is not configured for repository management{ ENDC } " )
2018 sys .exit (1 )
2119
2220 return True
@@ -79,7 +77,7 @@ def parse_repo_types() -> dict[str, set[str]]:
7977 return repo_types
8078
8179
82- def check_missing_repos (path : Path , repo_types : dict [str , set [str ]]) -> None | NoReturn :
80+ def check_missing_repos (path : Path , repo_types : dict [str , set [str ]]) -> Union [ None , NoReturn ] :
8381 missing = set ()
8482 directories = {str (directory ) for directory in path .iterdir ()}
8583
@@ -90,7 +88,7 @@ def check_missing_repos(path: Path, repo_types: dict[str, set[str]]) -> None | N
9088 if missing :
9189 print (f"{ FAIL } The following repositories are configured but do not exist:" )
9290 for repo in missing :
93- print ("\t {repo}" )
91+ print (f "\t { repo } " )
9492 sys .exit (1 )
9593
9694 return None
@@ -128,7 +126,11 @@ def main():
128126
129127 if args .unconfigured :
130128 for directory in sorted (path .iterdir ()):
131- if directory .is_dir () and str (directory ) not in repo_types ["all" ] and str (directory ) not in repo_types ["ignore" ]:
129+ if (
130+ directory .is_dir ()
131+ and str (directory ) not in repo_types ["all" ]
132+ and str (directory ) not in repo_types ["ignore" ]
133+ ):
132134 print (directory )
133135
134136 if args .list :
@@ -143,4 +145,3 @@ def main():
143145 if repo in seen :
144146 print (repo )
145147 seen .add (repo )
146-
0 commit comments