mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-07 03:55:22 +00:00
Merge ca1628cf2b1abc60b2cceda31c50c1b40dab18e1 into 68f9b2859d45a60e699839f87b1b9558cd36a329
This commit is contained in:
commit
d8f85d6db9
@ -111,9 +111,9 @@ def get_all_imports(
|
|||||||
candidates += [os.path.splitext(fn)[0] for fn in files]
|
candidates += [os.path.splitext(fn)[0] for fn in files]
|
||||||
for file_name in files:
|
for file_name in files:
|
||||||
file_name = os.path.join(root, file_name)
|
file_name = os.path.join(root, file_name)
|
||||||
with open(file_name, "r", encoding=encoding) as f:
|
|
||||||
contents = f.read()
|
|
||||||
try:
|
try:
|
||||||
|
with open(file_name, "r", encoding=encoding) as f:
|
||||||
|
contents = f.read()
|
||||||
tree = ast.parse(contents)
|
tree = ast.parse(contents)
|
||||||
for node in ast.walk(tree):
|
for node in ast.walk(tree):
|
||||||
if isinstance(node, ast.Import):
|
if isinstance(node, ast.Import):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user