1
0
forked from VimPlug/jedi

Make it possible to search folders __init__ files

This commit is contained in:
Dave Halter
2020-03-07 13:57:14 +01:00
parent 7f2f025866
commit eecdf31601
4 changed files with 61 additions and 6 deletions

View File

@@ -193,14 +193,15 @@ def gitignored_lines(folder_io, file_io):
return ignored_paths, ignored_names
def recurse_find_python_files(folder_io, except_paths=()):
def recurse_find_python_folders_and_files(folder_io, except_paths=()):
except_paths = set(except_paths)
for root_folder_io, folder_ios, file_ios in folder_io.walk():
# Delete folders that we don't want to iterate over.
for file_io in file_ios:
path = file_io.path
if path.endswith('.py') or path.endswith('.pyi'):
if path not in except_paths:
yield file_io
yield None, file_io
if path.endswith('.gitignore'):
ignored_paths, ignored_names = \
@@ -213,6 +214,14 @@ def recurse_find_python_files(folder_io, except_paths=()):
if folder_io.path not in except_paths
and folder_io.get_base_name() not in _IGNORE_FOLDERS
]
for folder_io in folder_ios:
yield folder_io, None
def recurse_find_python_files(folder_io, except_paths=()):
for folder_io, file_io in recurse_find_python_folders_and_files(folder_io, except_paths):
if file_io is not None:
yield file_io
def _find_python_files_in_sys_path(inference_state, module_contexts):