MCPcopy
hub / github.com/python/mypy / SymbolTableNode

Class SymbolTableNode

mypy/nodes.py:4783–5047  ·  view source on GitHub ↗

Description of a name binding in a symbol table. These are only used as values in module (global), function (local) and class symbol tables (see SymbolTable). The name that is bound is the key in SymbolTable. Symbol tables don't contain direct references to AST nodes primarily

Source from the content-addressed store, hash-verified

4781
4782
4783class SymbolTableNode:
4784 """Description of a name binding in a symbol table.
4785
4786 These are only used as values in module (global), function (local)
4787 and class symbol tables (see SymbolTable). The name that is bound is
4788 the key in SymbolTable.
4789
4790 Symbol tables don't contain direct references to AST nodes primarily
4791 because there can be multiple symbol table references to a single
4792 AST node (due to imports and aliases), and different references can
4793 behave differently. This class describes the unique properties of
4794 each reference.
4795
4796 The most fundamental attribute is 'node', which is the AST node that
4797 the name refers to.
4798
4799 The kind is usually one of LDEF, GDEF or MDEF, depending on the scope
4800 of the definition. These three kinds can usually be used
4801 interchangeably and the difference between local, global and class
4802 scopes is mostly descriptive, with no semantic significance.
4803 However, some tools that consume mypy ASTs may care about these so
4804 they should be correct.
4805
4806 Attributes:
4807 _node: AST node of definition. Among others, this can be one of
4808 FuncDef, Var, TypeInfo, TypeVarExpr or MypyFile -- or None
4809 for cross_ref that hasn't been fixed up yet. Should not be accessed
4810 directly, only via the `node` property.
4811 kind: Kind of node. Possible values:
4812 - LDEF: local definition
4813 - GDEF: global (module-level) definition
4814 - MDEF: class member definition
4815 - UNBOUND_IMPORTED: temporary kind for imported names (we
4816 don't know the final kind yet)
4817 module_public: If False, this name won't be imported via
4818 'from <module> import *'. This has no effect on names within
4819 classes.
4820 module_hidden: If True, the name will never be exported (needed for
4821 stub files)
4822 cross_ref: For deserialized MypyFile nodes, the referenced module
4823 name; for other nodes, optionally the name of the referenced object.
4824 implicit: Was this defined by assignment to self attribute?
4825 plugin_generated: Was this symbol generated by a plugin?
4826 (And therefore needs to be removed in aststrip.)
4827 no_serialize: Do not serialize this node if True. This is used for internal
4828 and/or temporary symbols such as function redefinitions.
4829 unfixed: Indicates that this symbol is fresh after deserialization and
4830 needs fixup, such as resolving cross-references etc.
4831 stored_info: TypeInfo containing this symbol. Normally code accesses this
4832 on the `node` attribute, but it may be not ready during deserialization,
4833 so we temporarily store info on the symbol itself.
4834
4835 NOTE: No other attributes should be added to this class unless they
4836 are shared by all node kinds.
4837 """
4838
4839 __slots__ = (
4840 "kind",

Callers 15

intersect_instancesMethod · 0.90
prepare_fileMethod · 0.90
prepare_class_defMethod · 0.90
visit_importMethod · 0.90
visit_import_fromMethod · 0.90
analyze_member_lvalueMethod · 0.90
_lookupMethod · 0.90
get_module_symbolMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…