Skip to main content

analyze_module_ast

FunctionSource

v_1: dict[str, tuple[int, bool]] = analyze_module_ast(module: ModuleType)

Analyze the coding structure (AST) of a module, and return the entity information detected in the code.

Arguments

Requires

NameTypeRequired
Description
moduleModuleTypeThe module to be analyzed.

Returns

NameType
Description
v_1dict[str, tuple[int, bool]]

The mapping of name -> (lineno, is_alias).

The name is the entity name detected in the module.

An entity can be a class, function, variable, and imported aliases such as - class Foo - def bar - baz = ... - import x as y - from .sub import name - from external import name

lineno is the line number where the entity is specified in the code.

is_alias is a flag showing whether the entity is an alias. When it is True, it means that the name is imported/re-exported, but not defined directly in this module.