class FindModuleCache: (source)
Module finder with integrated cache.
Module locations and some intermediate results are cached internally and can be cleared with the clear() method.
All file system accesses are performed through a FileSystemCache, which is not ever cleared by this class. If necessary it must be cleared by client code.
Method | __init__ |
Undocumented |
Method | clear |
Undocumented |
Method | find_lib_path_dirs |
Find which elements of a lib_path have the directory a module needs to exist. |
Method | find_module |
Return the path of the module source file or why it wasn't found. |
Method | find_modules_recursive |
Undocumented |
Method | get_toplevel_possibilities |
Find which elements of lib_path could contain a particular top-level module. |
Instance Variable | fscache |
Undocumented |
Instance Variable | initial_components |
Undocumented |
Instance Variable | ns_ancestors |
Undocumented |
Instance Variable | options |
Undocumented |
Instance Variable | python_major_ver |
Undocumented |
Instance Variable | results |
Undocumented |
Instance Variable | search_paths |
Undocumented |
Instance Variable | stdlib_py_versions |
Undocumented |
Method | _can_find_module_in_parent_dir |
Test if a module can be found by checking the parent directories of the current working directory. |
Method | _find_module |
Undocumented |
Method | _find_module_non_stub_helper |
Undocumented |
Method | _is_compatible_stub_package |
Does a stub package support the target Python version? |
Method | _typeshed_has_version |
Undocumented |
Method | _update_ns_ancestors |
Undocumented |
Undocumented
Parameters | |
search_paths:SearchPaths | Undocumented |
fscache:Optional[ | Undocumented |
options:Optional[ | Undocumented |
stdlib_py_versions:Optional[ | Undocumented |
Find which elements of a lib_path have the directory a module needs to exist.
This is run for the python_path, mypy_path, and typeshed_path search paths.
Parameters | |
id:str | Undocumented |
lib_path:Tuple[ | Undocumented |
Returns | |
PackageDirs | Undocumented |
Return the path of the module source file or why it wasn't found.
If fast_path is True, prioritize performance over generating detailed error descriptions.
Parameters | |
id:str | Undocumented |
fast_path:bool | Undocumented |
Returns | |
ModuleSearchResult | Undocumented |
Find which elements of lib_path could contain a particular top-level module.
In practice, almost all modules can be routed to the correct entry in lib_path by looking at just the first component of the module name.
We take advantage of this by enumerating the contents of all of the directories on the lib_path and building a map of which entries in the lib_path could contain each potential top-level module that appears.
Parameters | |
lib_path:Tuple[ | Undocumented |
id:str | Undocumented |
Returns | |
List[ | Undocumented |
Parameters | |
id:str | Undocumented |
Returns | |
bool | Undocumented |
Undocumented
Parameters | |
id:str | Undocumented |
use_typeshed:bool | Undocumented |
Returns | |
ModuleSearchResult | Undocumented |
Undocumented
Parameters | |
components:List[ | Undocumented |
pkg_dir:str | Undocumented |
Returns | |
Union[ | Undocumented |
Does a stub package support the target Python version?
Stub packages may contain a metadata file which specifies whether the stubs are compatible with Python 2 and 3.
Parameters | |
stub_dir:str | Undocumented |
Returns | |
bool | Undocumented |