Merge 79a6483df5a7256e4f8803173386bcdffa8736d4 into 90102acdbb23c09574d27df8bd1f568d34e0cfd3

This commit is contained in:
William Kelemen 2021-05-06 09:25:55 +02:00 committed by GitHub
commit d0d86ebc14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,7 +100,7 @@ def get_all_imports(
raw_imports = set()
candidates = []
ignore_errors = False
ignore_dirs = [".hg", ".svn", ".git", ".tox", "__pycache__", "env", "venv"]
ignore_dirs = [".hg", ".svn", ".git", ".tox", "__pycache__", "env", "venv", ".venv"]
if extra_ignore_dirs:
ignore_dirs_parsed = []
@ -118,9 +118,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_func(file_name, "r", encoding=encoding) as f:
contents = f.read()
try:
with open_func(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):