class documentation

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_value Determine the boolean value of this node.
Method callable Whether this node defines something that is callable.
Method display_type A human readable type of this node.
Method frame The node's frame node.
Method get_children Undocumented
Method implicit_parameters Undocumented
Method infer_call_result 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 Lookup where the given names is assigned.
Class Variable is_lambda 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_fields Undocumented
Class Variable _other_other_fields Undocumented

Inherited from FilterStmtsMixin:

Method assign_type Undocumented
Method _get_filtered_stmts 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_local_node 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_local 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_node append a child, linking it in the tree
Method _scope_lookup 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.
def __init__(self, lineno=None, col_offset=None, parent=None, *, end_lineno=None, end_col_offset=None): (source)
Parameters
lineno:int or NoneThe line that this node appears on in the source code.
col_offset:int or NoneThe column that this node appears on in the source code.
parent:NodeNG or NoneThe parent node in the syntax tree.
end_lineno:Optional[int]The last line this node appears on in the source code.
end_col_offset:Optional[int]The end column this node appears on in the source code. Note: This is after the last symbol.
def argnames(self): (source)

Get the names of each of the arguments.

Returns
list(str)The names of the arguments.
def bool_value(self, context=None): (source)

Determine the boolean value of this node.

Returns
boolThe boolean value of this node. For a Lambda this is always True.
def callable(self): (source)

Whether this node defines something that is callable.

Returns
boolTrue if this defines something that is callable, False otherwise. For a Lambda this is always True.
def display_type(self): (source)

A human readable type of this node.

Returns
strThe type of this node.
def frame(self: T, *, future: Literal[None, True] = None) -> T: (source)

The node's frame node.

A frame node is a Module, FunctionDef, ClassDef or Lambda.

Returns
TThe node itself.
def get_children(self): (source)

Undocumented

def implicit_parameters(self): (source)

Undocumented

def infer_call_result(self, caller, context=None): (source)

Infer what the function returns when called.

Parameters
caller:objectUnused
contextUndocumented
def postinit(self, args: Arguments, body): (source)

Do some setup after initialisation.

Parameters
args:ArgumentsThe arguments that the function takes.
body:list(NodeNG)The contents of the function body.
def pytype(self): (source)

Get the name of the type that this node represents.

Returns
strThe name of the type.
def scope_lookup(self, node, name, offset=0): (source)

Lookup where the given names is assigned.

Parameters
node:NodeNGThe node to look for assignments up to. Any assignments after the given node are ignored.
name:strThe name to find assignments for.
offset:intThe 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).
is_lambda: bool = (source)

Undocumented

name: str = (source)

Undocumented

args: Arguments = (source)

The arguments that the function takes.

The contents of the function body.

locals: dict = (source)

A map of the name of a local variable to the node defining it.

@property
type: str = (source)

Whether this is a method or function.

Returns
'method' if this is a method, 'function' otherwise.
_astroid_fields: tuple[str, ...] = (source)

Undocumented

_other_other_fields: tuple[str, ...] = (source)

Undocumented