class documentation

class ImportTracker: (source)

View In Hierarchy

Record necessary imports during stub generation.

Method __init__ Undocumented
Method add_import Undocumented
Method add_import_from Undocumented
Method import_lines The list of required import lines (as strings with python code).
Method reexport Mark a given non qualified name as needed in __all__.
Method require_name Undocumented
Instance Variable direct_imports Undocumented
Instance Variable module_for Undocumented
Instance Variable reexports Undocumented
Instance Variable required_names Undocumented
Instance Variable reverse_alias Undocumented
def __init__(self): (source)

Undocumented

def add_import(self, module: str, alias: str|None = None): (source)

Undocumented

def add_import_from(self, module: str, names: list[tuple[str, str|None]]): (source)

Undocumented

def import_lines(self) -> list[str]: (source)

The list of required import lines (as strings with python code).

def reexport(self, name: str): (source)

Mark a given non qualified name as needed in __all__. This means that in case it comes from a module, it should be imported with an alias even is the alias is the same as the name.

def require_name(self, name: str): (source)

Undocumented

direct_imports: dict[str, str] = (source)

Undocumented

module_for: dict[str, str|None] = (source)

Undocumented

reexports: set[str] = (source)

Undocumented

required_names: set[str] = (source)

Undocumented

reverse_alias: dict[str, str] = (source)

Undocumented