99lib_path = os .path .abspath (os .path .join (current_dir , ".." , ".." ))
1010sys .path .insert (0 , lib_path )
1111
12+
1213def classify_file_category (path ):
1314
1415 relative_path = Path (path ).relative_to (lib_path )
@@ -30,28 +31,25 @@ def fetch_option_flags(flags):
3031
3132 for flag in flags :
3233 flag_list .append (
33- {
34- "name" : flag ["name" ].replace ("\\ " , "" ),
35- "instruction" : flag ["name" ].split ("-" )[- 1 ],
36- "description" : flag ["description" ]
37- }
38- )
34+ {
35+ "name" : flag ["name" ].replace ("\\ " , "" ),
36+ "instruction" : flag ["name" ].split ("-" )[- 1 ],
37+ "description" : flag ["description" ],
38+ }
39+ )
3940
4041 return flag_list
4142
4243
4344def fetch_all_files ():
44- main_files = [
45- os .path .join (lib_path , "linear_trainer.py" ),
46- os .path .join (lib_path , "torch_trainer.py" )
47- ]
45+ main_files = [os .path .join (lib_path , "linear_trainer.py" ), os .path .join (lib_path , "torch_trainer.py" )]
4846 lib_files = glob .glob (os .path .join (lib_path , "libmultilabel/**/*.py" ), recursive = True )
4947 file_set = set (map (os .path .abspath , main_files + lib_files ))
5048 return file_set
5149
5250
5351def find_config_usages_in_file (file_path , allowed_keys ):
54- pattern = re .compile (r' \bconfig\.([a-zA-Z_][a-zA-Z0-9_]*)' )
52+ pattern = re .compile (r" \bconfig\.([a-zA-Z_][a-zA-Z0-9_]*)" )
5553 detailed_results = {}
5654 try :
5755 with open (file_path , "r" , encoding = "utf-8" ) as f :
@@ -77,7 +75,7 @@ def move_duplicates_together(data, keep):
7775 duplicates = set ()
7876
7977 for i , key1 in enumerate (all_keys ):
80- for key2 in all_keys [i + 1 :]:
78+ for key2 in all_keys [i + 1 :]:
8179 duplicates |= data [key1 ] & data [key2 ]
8280
8381 data [keep ] |= duplicates
@@ -99,7 +97,7 @@ def classify(raw_flags):
9997 collected = {}
10098
10199 for file_path in file_set :
102- detailed_results = find_config_usages_in_file (file_path , allowed_keys )
100+ detailed_results = find_config_usages_in_file (file_path , allowed_keys )
103101 if detailed_results :
104102 usage_map [file_path ] = set (detailed_results .keys ())
105103 for k , v in detailed_results .items ():
@@ -125,7 +123,9 @@ def classify(raw_flags):
125123 for flag in flags :
126124 if flag ["category" ] not in result :
127125 result [flag ["category" ]] = []
128- result [flag ["category" ]].append ({"name" : flag ["name" ].replace ("--" , r"\-\-" ), "description" : flag ["description" ]})
126+ result [flag ["category" ]].append (
127+ {"name" : flag ["name" ].replace ("--" , r"\-\-" ), "description" : flag ["description" ]}
128+ )
129129
130130 result ["details" ] = []
131131 for k , v in collected .items ():
0 commit comments