Merge ca1628cf2b1abc60b2cceda31c50c1b40dab18e1 into 68f9b2859d45a60e699839f87b1b9558cd36a329

This commit is contained in:
Jarkko 2023-10-11 15:38:38 -06:00 committed by GitHub
commit d8f85d6db9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,9 +111,9 @@ def get_all_imports(
candidates += [os.path.splitext(fn)[0] for fn in files]
for file_name in files:
file_name = os.path.join(root, file_name)
with open(file_name, "r", encoding=encoding) as f:
contents = f.read()
try:
with open(file_name, "r", encoding=encoding) as f:
contents = f.read()
tree = ast.parse(contents)
for node in ast.walk(tree):
if isinstance(node, ast.Import):