Skip to main content Crate ruff_python_semantic Copy item path Source all Utilities for semantic analysis of __all__ definitions analyze cfg Alias Binding BindingFlags Flags on a Binding . BindingId ID uniquely identifying a Binding in a program. Bindings The bindings in a program. BranchId ID uniquely identifying a branch in a program. ContextualizedDefinition A Definition in a Python program with its resolved Visibility . ContextualizedDefinitions A collection of Definition structs in a Python program with resolved Visibility . DefinitionId Id uniquely identifying a definition in a program. Definitions The definitions within a Python program indexed by DefinitionId . Exceptions Export FromImport A binding for a member imported from a module, keyed on the name to which the member is bound.
Ex) from foo import bar would be keyed on “bar”.
Ex) from foo import bar as baz would be keyed on “baz”. Globals The set of global names for a given scope, represented as a map from the name of the global to
the range of the declaration in the source code. GlobalsId Id uniquely identifying the set of global names for a given scope. Import A binding for an import, keyed on the name to which the import is bound.
Ex) import foo would be keyed on “foo”.
Ex) import foo as bar would be keyed on “bar”. ImportedName Member A member of a Python module. MemberNameImport A representation of an individual name imported via a from ... import statement. Module A Python module. ModuleNameImport A representation of an individual name imported via an import statement. Modules A select list of Python modules that the semantic model can explicitly track. NameImports A list of names imported via any import statement. NodeId Id uniquely identifying an AST node in a program. Nodes The nodes of a program indexed by NodeId ResolvedReference A resolved read reference to a name in a program. ResolvedReferenceId Id uniquely identifying a read reference in a program. Scope ScopeFlags Flags on a Scope . ScopeId Id uniquely identifying a scope in a program. Scopes The scopes of a program indexed by ScopeId SemanticModel A semantic model for a Python module, to enable querying the module’s semantic information. SemanticModelFlags Flags indicating the current model state. ShadowedBinding Snapshot A snapshot of the SemanticModel at a given point in the AST traversal. StarImport SubmoduleImport A binding for a submodule imported from a module, keyed on the name of the parent module.
Ex) import foo.bar would be keyed on “foo”. UnresolvedReference An unresolved read reference to a name in a program. UnresolvedReferenceFlags AnyImport A wrapper around an import BindingKind that can be any of the three types of imports. BindingKind Definition A definition within a Python program. ExecutionContext GeneratorKind MemberKind ModuleKind ModuleSource A Python module can either be defined as a module path (i.e., the dot-separated path to the
module) or, if the module can’t be resolved, as a file path (i.e., the path to the file defining
the module). NameImport A representation of an individual name imported via any import statement. NodeRef A reference to an AST node. Like ruff_python_ast::AnyNodeRef , but wraps the node
itself (like Stmt ) rather than the narrowed type (like ruff_python_ast::StmtAssign ). ReadResult ScopeKind Symbol The result of looking up a symbol in a SemanticModel . TypingOnlyBindingsStatus FutureImport Imported A trait for imported symbols.