rope.contrib.autoimport.utils
Utility functions for the autoimport code.
Functions
|
Get package name and type from a path. |
|
Detect the source of a given package. Rudimentary implementation. |
|
Get module name from a path in respect to package. |
|
Sort and deduplicate a list of name, source entries. |
|
Sort and deduplicate a list of name, module, source entries. |
|
|
|
Find all files to parse in a given path using __init__.py. |
Module Contents
- rope.contrib.autoimport.utils.get_package_tuple(package_path: pathlib.Path, project: rope.base.project.Project | None = None) rope.contrib.autoimport.defs.Package | None
Get package name and type from a path.
Checks for common issues, such as not being a viable python module Returns None if not a viable package.
- rope.contrib.autoimport.utils.get_package_source(package: pathlib.Path, project: rope.base.project.Project | None, name: str) rope.contrib.autoimport.defs.Source
Detect the source of a given package. Rudimentary implementation.
- rope.contrib.autoimport.utils.get_modname_from_path(modpath: pathlib.Path, package_path: pathlib.Path, add_package_name: bool = True) str
Get module name from a path in respect to package.
- rope.contrib.autoimport.utils.sort_and_deduplicate(results: List[Tuple[str, int]]) List[str]
Sort and deduplicate a list of name, source entries.
- rope.contrib.autoimport.utils.sort_and_deduplicate_tuple(results: List[Tuple[str, str, int]]) List[Tuple[str, str]]
Sort and deduplicate a list of name, module, source entries.
- rope.contrib.autoimport.utils.should_parse(path: pathlib.Path, underlined: bool) bool
- rope.contrib.autoimport.utils.get_files(package: rope.contrib.autoimport.defs.Package, underlined: bool = False) Generator[rope.contrib.autoimport.defs.ModuleInfo, None, None]
Find all files to parse in a given path using __init__.py.