Low-level infrastructure to find modules.
This builds on fscache.py; find_sources.py builds on top of this.
Class | BuildSource |
A single source file. |
Class | FindModuleCache |
Module finder with integrated cache. |
Class | ModuleNotFoundReason |
Undocumented |
Function | add_py2_mypypath_entries |
Add corresponding @python2 subdirectories to mypypath. |
Function | compute_search_paths |
Compute the search paths as specified in PEP 561. |
Function | default_lib_path |
Return default standard library search paths. |
Function | expand_site_packages |
Expands .pth imports in site-packages directories |
Function | filter_redundant_py2_dirs |
If dirs has <dir>/@python2 followed by <dir>, filter out the latter. |
Function | get_prefixes |
Get the sys.base_prefix and sys.prefix for the given python. |
Function | get_site_packages_dirs |
Find package directories for given python. |
Function | highest_init_level |
Compute the highest level where an __init__ file is found. |
Function | load_stdlib_py_versions |
Return dict with minimum and maximum Python versions of stdlib modules. |
Function | matches_exclude |
Undocumented |
Function | mypy_path |
Undocumented |
Function | parse_version |
Undocumented |
Function | typeshed_py_version |
Return Python version used for checking whether module supports typeshed. |
Function | verify_module |
Check that all packages containing id have a __init__ file. |
Constant | PYTHON2_STUB_DIR |
Undocumented |
Constant | PYTHON_EXTENSIONS |
Undocumented |
Variable | ModuleSearchResult |
Undocumented |
Variable | OnePackageDir |
Undocumented |
Variable | PackageDirs |
Undocumented |
Variable | SearchPaths |
Undocumented |
Variable | StdlibVersions |
Undocumented |
Function | _make_abspath |
Take a path and make it absolute relative to root if not already absolute. |
Function | _parse_pth_file |
Mimics a subset of .pth import hook from Lib/site.py See https://github.com/python/cpython/blob/3.5/Lib/site.py#L146-L185 |
Add corresponding @python2 subdirectories to mypypath.
For each path entry 'x', add 'x/@python2' before 'x' if the latter is a directory.
Parameters | |
mypypath:List[ | Undocumented |
Returns | |
List[ | Undocumented |
Compute the search paths as specified in PEP 561.
There are the following 4 members created:
- User code (from sources
)
- MYPYPATH (set either via config or environment variable)
- installed package directories (which will later be split into stub-only and inline)
- typeshed
Parameters | |
sources:List[ | Undocumented |
options:Options | Undocumented |
data_dir:str | Undocumented |
alt_lib_path:Optional[ | Undocumented |
Returns | |
SearchPaths | Undocumented |
Parameters | |
data_dir:str | Undocumented |
pyversion:Tuple[ | Undocumented |
custom_typeshed_dir:Optional[ | Undocumented |
Returns | |
List[ | Undocumented |
Parameters | |
site_packages:List[ | Undocumented |
Returns | |
Tuple[ | Undocumented |
Parameters | |
dirs:List[ | Undocumented |
Returns | |
List[ | Undocumented |
Get the sys.base_prefix and sys.prefix for the given python.
This runs a subprocess call to get the prefix paths of the given Python executable. To avoid repeatedly calling a subprocess (which can be slow!) we lru_cache the results.
Parameters | |
python_executable:Optional[ | Undocumented |
Returns | |
Tuple[ | Undocumented |
Find package directories for given python.
This runs a subprocess call, which generates a list of the egg directories, and the site package directories. To avoid repeatedly calling a subprocess (which can be slow!) we lru_cache the results.
Parameters | |
python_executable:Optional[ | Undocumented |
Returns | |
Tuple[ | Undocumented |
Parameters | |
fscache:FileSystemCache | Undocumented |
id:str | Undocumented |
path:str | Undocumented |
prefix:str | Undocumented |
Returns | |
int | Undocumented |
Return dict with minimum and maximum Python versions of stdlib modules.
The contents look like {..., 'secrets': ((3, 6), None), 'symbol': ((2, 7), (3, 9)), ...}
None means there is no maximum version.
Parameters | |
custom_typeshed_dir:Optional[ | Undocumented |
Returns | |
StdlibVersions | Undocumented |
Undocumented
Parameters | |
subpath:str | Undocumented |
excludes:List[ | Undocumented |
fscache:FileSystemCache | Undocumented |
verbose:bool | Undocumented |
Returns | |
bool | Undocumented |
Parameters | |
options:Options | Undocumented |
Returns | |
Tuple[ | Undocumented |
Parameters | |
fscache:FileSystemCache | Undocumented |
id:str | Undocumented |
path:str | Undocumented |
prefix:str | Undocumented |
Returns | |
bool | Undocumented |
Parameters | |
path:str | Undocumented |
root:str | Undocumented |
Returns | |
str | Undocumented |
Parameters | |
dir:str | Undocumented |
pth_filename:str | Undocumented |
Returns | |
Iterator[ | Undocumented |