class documentation

class ModuleInspect: (source)

View In Hierarchy

Perform runtime introspection of modules in a separate process. Reuse the process for multiple modules for efficiency. However, if there is an error, retry using a fresh process to avoid cross-contamination of state between modules. We use a separate process to isolate us from many side effects. For example, the import of a module may kill the current process, and we want to recover from that. Always use in a with statement for proper clean-up: with ModuleInspect() as m: p = m.get_package_properties('urllib.parse')

Method __enter__ Undocumented
Method __exit__ Undocumented
Method __init__ Undocumented
Method close Free any resources used.
Method get_package_properties Return some properties of a module/package using runtime introspection.
Instance Variable counter Undocumented
Instance Variable proc Undocumented
Instance Variable results Undocumented
Instance Variable tasks Undocumented
Method _get_from_queue Get value from the queue.
Method _start Undocumented
def __enter__(self) -> ModuleInspect: (source)

Undocumented

def __exit__(self, *args: object): (source)

Undocumented

def __init__(self): (source)

Undocumented

def close(self): (source)

Free any resources used.

def get_package_properties(self, package_id: str) -> ModuleProperties: (source)

Return some properties of a module/package using runtime introspection. Raise InspectError if the target couldn't be imported.

Undocumented

Undocumented

Undocumented

def _get_from_queue(self) -> (ModuleProperties|str)|None: (source)

Get value from the queue. Return the value read from the queue, or None if the process unexpectedly died.

def _start(self): (source)

Undocumented