mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-07 12:05:33 +00:00
Update pipreqs.py
This commit is contained in:
parent
e7571ea033
commit
4799ecbca1
@ -114,7 +114,7 @@ def get_all_imports(
|
|||||||
with open(file_name, "r", encoding=encoding) as f:
|
with open(file_name, "r", encoding=encoding) as f:
|
||||||
contents = f.read()
|
contents = f.read()
|
||||||
try:
|
try:
|
||||||
tree = ast.parse(contents)
|
tree = ast.parse(contents, filename=file_name)
|
||||||
for node in ast.walk(tree):
|
for node in ast.walk(tree):
|
||||||
if isinstance(node, ast.Import):
|
if isinstance(node, ast.Import):
|
||||||
for subnode in node.names:
|
for subnode in node.names:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user