Class | CantImport |
Undocumented |
Function | common_dir_prefix |
Undocumented |
Function | default_py2_interpreter |
Find a system Python 2 interpreter. |
Function | fail_missing |
Undocumented |
Function | find_module_path_and_all_py2 |
Return tuple (module path, module __all__) for a Python 2 module. |
Function | find_module_path_and_all_py3 |
Find module and determine __all__ for a Python 3 module. |
Function | find_module_path_using_py2_sys_path |
Try to find the path of a .py file for a module using Python 2 sys.path. |
Function | find_module_path_using_sys_path |
Undocumented |
Function | generate_guarded |
Ignore or report errors during stub generation. |
Function | remove_misplaced_type_comments |
Remove comments from source that could be understood as misplaced type comments. |
Function | report_missing |
Undocumented |
Function | walk_packages |
Iterates through all packages and sub-packages in the given list. |
Constant | NOT_IMPORTABLE_MODULES |
Undocumented |
Constant | PY2_MODULES |
Undocumented |
Return tuple (module path, module __all__) for a Python 2 module.
The path refers to the .py/.py[co] file. The second tuple item is None if the module doesn't define __all__.
Raise CantImport if the module can't be imported, or exit if it's a C extension module.
Parameters | |
module:str | Undocumented |
interpreter:str | Undocumented |
Returns | |
Optional[ | Undocumented |
Find module and determine __all__ for a Python 3 module.
Return None if the module is a C module. Return (module_path, __all__) if it is a Python module. Raise CantImport if import failed.
Parameters | |
inspect:ModuleInspect | Undocumented |
module:str | Undocumented |
verbose:bool | Undocumented |
Returns | |
Optional[ | Undocumented |
Try to find the path of a .py file for a module using Python 2 sys.path.
Return None if no match was found.
Parameters | |
module:str | Undocumented |
interpreter:str | Undocumented |
Returns | |
Optional[ | Undocumented |
Undocumented
Parameters | |
module:str | Undocumented |
sys_path:List[ | Undocumented |
Returns | |
Optional[ | Undocumented |
Ignore or report errors during stub generation.
Optionally report success.
Parameters | |
mod:str | Undocumented |
target:str | Undocumented |
ignore_errors:bool | Undocumented |
verbose:bool | Undocumented |
Returns | |
Iterator[ | Undocumented |
Remove comments from source that could be understood as misplaced type comments.
Normal comments may look like misplaced type comments, and since they cause blocking parse errors, we want to avoid them.
Parameters | |
source:Union[ | Undocumented |
Returns | |
Union[ | Undocumented |
Iterates through all packages and sub-packages in the given list.
This uses runtime imports (in another process) to find both Python and C modules. For Python packages we simply pass the __path__ attribute to pkgutil.walk_packages() to get the content of the package (all subpackages and modules). However, packages in C extensions do not have this attribute, so we have to roll out our own logic: recursively find all modules imported in the package that have matching names.
Parameters | |
inspect:ModuleInspect | Undocumented |
packages:List[ | Undocumented |
verbose:bool | Undocumented |
Returns | |
Iterator[ | Undocumented |