this module contains a set of functions to create astroid trees from scratch (build_* functions) or from living object (object_build_* functions)
Class |
|
class for building nodes from living object |
Function | attach |
create a Const node and register it in the locals of the given node with the specified name |
Function | attach |
create a dummy node and register it in the locals of the given node with the specified name |
Function | attach |
create a ImportFrom node and register it in the locals of the given node with the specified name |
Function | build |
Create and initialize an astroid ClassDef node. |
Function | build |
create and initialize an astroid ImportFrom import statement |
Function | build |
create and initialize an astroid FunctionDef node |
Function | build |
create and initialize an astroid Module node |
Function | object |
create astroid for a living class object |
Function | object |
create astroid for a living data descriptor object |
Function | object |
create astroid for a living function object |
Function | object |
create astroid for a living method descriptor object |
Function | register |
add given arguments to local |
Constant | TYPE |
Undocumented |
Constant | TYPE |
Undocumented |
Constant | TYPE |
Undocumented |
Variable | logger |
Undocumented |
Function | _add |
Add a __class__ member to the given func node, if we can determine it. |
Function | _astroid |
astroid bootstrapping the builtins module |
Function | _attach |
Undocumented |
Function | _base |
create astroid for a living class object, with a given set of base names (e.g. ancestors) |
Function | _build |
Undocumented |
Function | _get |
Returns args, posonlyargs, defaults, kwonlyargs. |
Function | _safe |
Required because unexpected RunTimeError can be raised. |
Function | _set |
Undocumented |
Constant | _BUILTINS |
Undocumented |
Constant | _CONST |
Undocumented |
Constant | _CONSTANTS |
Undocumented |
Type Alias | _ |
Undocumented |
str
, basenames: Iterable[ str]
= (), doc: str|None
= None) -> nodes.ClassDef
:
(source)
¶
Create and initialize an astroid ClassDef node.
str
, args: list[ str]|None
= None, posonlyargs: list[ str]|None
= None, defaults: list[ Any]|None
= None, doc: str|None
= None, kwonlyargs: list[ str]|None
= None, kwonlydefaults: list[ Any]|None
= None) -> nodes.FunctionDef
:
(source)
¶
create and initialize an astroid FunctionDef node
nodes.Module|nodes.ClassDef
, member: type
, localname: str
) -> nodes.ClassDef
:
(source)
¶
create astroid for a living class object
nodes.Module|nodes.ClassDef
, member: type
, name: str
) -> nodes.ClassDef
:
(source)
¶
create astroid for a living data descriptor object
nodes.Module|nodes.ClassDef
, member: _FunctionTypes
, localname: str
):
(source)
¶
create astroid for a living function object
nodes.Module|nodes.ClassDef
, member: _FunctionTypes
, localname: str
):
(source)
¶
create astroid for a living method descriptor object
add given arguments to local args is a list that may contains nested lists (i.e. def func(a, (b, c, d)): ...)
nodes.Module|nodes.ClassDef
, member: type
, basenames: list[ str]
, name: str|None
= None, localname: str|None
= None) -> nodes.ClassDef
:
(source)
¶
create astroid for a living class object, with a given set of base names (e.g. ancestors)
nodes.Module|nodes.ClassDef
, name: str
, member: _FunctionTypes
, module: types.ModuleType
):
(source)
¶
Undocumented
_FunctionTypes
) -> tuple[ list[ str], list[ str], list[ Any], list[ str], list[ Any]]
:
(source)
¶
Returns args, posonlyargs, defaults, kwonlyargs. :note: currently ignores the return annotation.
Required because unexpected RunTimeError can be raised. See https://github.com/PyCQA/astroid/issues/1958