class Lambda(mixins.FilterStmtsMixin, LocalsDictNodeNG): (source)
Known subclasses: astroid.nodes.scoped_nodes.FunctionDef
Constructor: Lambda(lineno, col_offset, parent, end_lineno, end_col_offset)
Class representing an ast.Lambda node.
>>> import astroid >>> node = astroid.extract_node('lambda arg: arg + 1') >>> node <Lambda.<lambda> l.1 at 0x7f23b2e41518>
| Method | __init__ |
No summary |
| Method | argnames |
Get the names of each of the arguments. |
| Method | bool |
Determine the boolean value of this node. |
| Method | callable |
Whether this node defines something that is callable. |
| Method | display |
A human readable type of this node. |
| Method | frame |
The node's frame node. |
| Method | get |
Undocumented |
| Method | implicit |
Undocumented |
| Method | infer |
Infer what the function returns when called. |
| Method | postinit |
Do some setup after initialisation. |
| Method | pytype |
Get the name of the type that this node represents. |
| Method | scope |
Lookup where the given names is assigned. |
| Class Variable | is |
Undocumented |
| Class Variable | name |
Undocumented |
| Instance Variable | args |
The arguments that the function takes. |
| Instance Variable | body |
The contents of the function body. |
| Instance Variable | locals |
A map of the name of a local variable to the node defining it. |
| Property | type |
Whether this is a method or function. |
| Class Variable | _astroid |
Undocumented |
| Class Variable | _other |
Undocumented |
Inherited from FilterStmtsMixin:
| Method | assign |
Undocumented |
| Method | _get |
method used in _filter_stmts to get statements and trigger break |
Inherited from LocalsDictNodeNG (via FilterStmtsMixin):
| Method | __contains__ |
Check if a local is defined in this scope. |
| Method | __getitem__ |
The first node the defines the given local. |
| Method | __iter__ |
Iterate over the names of locals defined in this scoped node. |
| Method | add |
Append a child that should alter the locals of this scope node. |
| Method | items |
Get the names of the locals and the node that defines the local. |
| Method | keys |
The names of locals defined in this scoped node. |
| Method | qname |
Get the 'qualified' name of the node. |
| Method | scope |
The first parent node defining a new scope. |
| Method | set |
Define that the given name is declared in the given statement node. |
| Method | values |
The nodes that define the locals in this scoped node. |
| Method | _append |
append a child, linking it in the tree |
| Method | _scope |
XXX method for interfacing the scope lookup |
Inherited from LookupMixIn (via FilterStmtsMixin, LocalsDictNodeNG):
| Method | ilookup |
Lookup the inferred values of the given variable. |
| Method | lookup |
Lookup where the given variable is assigned. |
astroid.nodes.scoped_nodes.FunctionDef| Parameters | |
| lineno:int or None | The line that this node appears on in the source code. |
| col | The column that this node appears on in the source code. |
| parent:NodeNG or None | The parent node in the syntax tree. |
| end | The last line this node appears on in the source code. |
| end | The end column this node appears on in the source code. Note: This is after the last symbol. |
astroid.nodes.scoped_nodes.FunctionDefDetermine the boolean value of this node.
| Returns | |
| bool | The boolean value of this node.
For a Lambda this is always True. |
Whether this node defines something that is callable.
| Returns | |
| bool | True if this defines something that is callable,
False otherwise.
For a Lambda this is always True. |
astroid.nodes.scoped_nodes.FunctionDefThe node's frame node.
A frame node is a Module, FunctionDef,
ClassDef or Lambda.
| Returns | |
T | The node itself. |
astroid.nodes.scoped_nodes.FunctionDefInfer what the function returns when called.
| Parameters | |
| caller:object | Unused |
| context | Undocumented |
astroid.nodes.scoped_nodes.FunctionDefDo some setup after initialisation.
| Parameters | |
args:Arguments | The arguments that the function takes. |
| body:list(NodeNG) | The contents of the function body. |
astroid.objects.PropertyGet the name of the type that this node represents.
| Returns | |
| str | The name of the type. |
astroid.nodes.scoped_nodes.FunctionDefLookup where the given names is assigned.
| Parameters | |
| node:NodeNG | The node to look for assignments up to. Any assignments after the given node are ignored. |
| name:str | The name to find assignments for. |
| offset:int | The line offset to filter statements up to. |
| Returns | |
| tuple(str, list(NodeNG)) | This scope node and the list of assignments associated to the given name according to the scope where it has been found (locals, globals or builtin). |
astroid.nodes.scoped_nodes.FunctionDefWhether this is a method or function.
| Returns | |
| 'method' if this is a method, 'function' otherwise. |