class AbstractAttributeHandler(utils.ContextWeakrefMixin): (source)
Handler for abstract attributes.
Method | get |
Get the named attribute from the given object. |
Method | set |
Set an attribute on an object. |
Method | _check |
Verify that a given attribute is writable. Log an error if not. |
Method | _computable |
Undocumented |
Method | _filter |
Filter the variable by the node. |
Method | _get |
Get an attribute from an object or its class. |
Method | _get |
Call compute_function (if defined) to compute an attribute. |
Method | _get |
Flat attribute retrieval (no mro lookup). |
Method | _get |
Get an attribute from a super instance. |
Method | _get |
Get an attribute from a class. |
Method | _get |
Get an attribute from an instance. |
Method | _get |
Get a member of an object. |
Method | _get |
Get an attribute from a module. |
Method | _lookup |
Find an identifier in the MRO of the class. |
Method | _lookup |
Undocumented |
Method | _lookup |
Look for an identifier in a single base class from an MRO. |
Method | _maybe |
Undocumented |
Method | _set |
Set a member on an object. |
Method | _should |
Undocumented |
Inherited from ContextWeakrefMixin
:
Method | __init__ |
Undocumented |
Class Variable | __slots__ |
Undocumented |
Instance Variable | ctx |
Undocumented |
Property | ctx |
Undocumented |
Get the named attribute from the given object. Args: node: The current CFG node. obj: The object. name: The name of the attribute to retrieve. valself: A cfg.Binding to a self reference to include in the attribute's origins. If obj is an abstract.Class, valself can be a binding to: * an instance of obj - obj will be treated strictly as a class. * obj itself - obj will be treated as an instance of its metaclass. * None - if name == "__getitem__", obj is a type annotation; else, obj is strictly a class, but the attribute is left unbound. Else, valself is optional and should be a binding to obj when given. Returns: A tuple (CFGNode, cfg.Variable). If this attribute doesn't exist, the Variable will be None.
cfg.CFGNode
, obj: abstract.BaseValue
, name: str
, value: cfg.Variable
) -> cfg.CFGNode
:
(source)
¶
Set an attribute on an object. The attribute might already have a Variable in it and in that case we cannot overwrite it and instead need to add the elements of the new variable to the old variable. Args: node: The current CFG node. obj: The object. name: The name of the attribute to set. value: The Variable to store in it. Returns: A (possibly changed) CFG node. Raises: AttributeError: If the attribute cannot be set. NotImplementedError: If attribute setting is not implemented for obj.
Filter the variable by the node. Filters the variable data, including recursively expanded type parameter instances, by visibility at the node. A type parameter instance needs to be filtered at the moment of access because its value may change later. Args: node: The current node. var: A variable to filter. Returns: The filtered variable.
Get an attribute from an object or its class. The underlying method called by all of the (_)get_(x_)attribute methods. Attempts to resolve an attribute first with __getattribute__, then by fetching it from the object, then by fetching it from the class, and finally with __getattr__. Arguments: node: The current node. obj: The object. cls: The object's class, may be None. name: The attribute name. valself: The binding to the self reference. Returns: A tuple of the node and the attribute, or None if it was not found.
cfg.CFGNode
, cls: Union[ abstract.Class, abstract.AmbiguousOrEmptyType]
, name: str
, valself: cfg.Binding
, compute_function: str
) -> _NodeAndMaybeVarType
:
(source)
¶
Call compute_function (if defined) to compute an attribute.
special_builtins.SuperInstance
, name, valself):
(source)
¶
Get an attribute from a super instance.
cfg.CFGNode
, cls: abstract.Class
, name: str
, valself: Optional[ cfg.Binding]
= None) -> _NodeAndMaybeVarType
:
(source)
¶
Get an attribute from a class.
cfg.CFGNode
, obj: abstract.SimpleValue
, name: str
, valself: Optional[ cfg.Binding]
= None) -> _NodeAndMaybeVarType
:
(source)
¶
Get an attribute from an instance.
cfg.CFGNode
, module: abstract.Module
, name: str
, valself: Optional[ cfg.Binding]
= None) -> _NodeAndMaybeVarType
:
(source)
¶
Get an attribute from a module.
cfg.CFGNode
, obj: abstract.SimpleValue
, name: str
):
(source)
¶
Undocumented
cfg.CFGNode
, obj: abstract.SimpleValue
, name: str
, var: cfg.Variable
) -> cfg.CFGNode
:
(source)
¶
Set a member on an object.
abstract.Module
, attr_var: Optional[ cfg.Variable]
):
(source)
¶
Undocumented