@@ -21,7 +21,7 @@ def parse_import_statements(content, filepath):
21
21
"name" : subnode .name ,
22
22
"lineno" : node .lineno ,
23
23
"filepath" : filepath ,
24
- "from" : ""
24
+ "from" : "" ,
25
25
}
26
26
modules .append (module )
27
27
elif isinstance (node , ast .ImportFrom ) and node .level == 0 :
@@ -30,7 +30,7 @@ def parse_import_statements(content, filepath):
30
30
"name" : f"{ node .module } .{ subnode .name } " ,
31
31
"lineno" : node .lineno ,
32
32
"filepath" : filepath ,
33
- "from" : node .module
33
+ "from" : node .module ,
34
34
}
35
35
modules .append (module )
36
36
return modules
@@ -52,8 +52,9 @@ def parse(repo_root, rel_package_path, filename):
52
52
content = file .read ()
53
53
# From simple benchmarks, 2 workers gave the best performance here.
54
54
with concurrent .futures .ThreadPoolExecutor (max_workers = 2 ) as executor :
55
- modules_future = executor .submit (parse_import_statements , content ,
56
- rel_filepath )
55
+ modules_future = executor .submit (
56
+ parse_import_statements , content , rel_filepath
57
+ )
57
58
comments_future = executor .submit (parse_comments , content )
58
59
modules = modules_future .result ()
59
60
comments = comments_future .result ()
@@ -73,12 +74,11 @@ def main(stdin, stdout):
73
74
filenames = parse_request ["filenames" ]
74
75
outputs = list ()
75
76
if len (filenames ) == 1 :
76
- outputs .append (parse (repo_root , rel_package_path ,
77
- filenames [0 ]))
77
+ outputs .append (parse (repo_root , rel_package_path , filenames [0 ]))
78
78
else :
79
79
futures = [
80
- executor .submit (parse , repo_root , rel_package_path ,
81
- filename ) for filename in filenames
80
+ executor .submit (parse , repo_root , rel_package_path , filename )
81
+ for filename in filenames
82
82
if filename != ""
83
83
]
84
84
for future in concurrent .futures .as_completed (futures ):
0 commit comments