BaseContainer#

class astroid.nodes.BaseContainer(lineno: int | None, col_offset: int | None, parent: NodeNG | None, *, end_lineno: int | None, end_col_offset: int | None)[source]#

Bases: ParentAssignNode, Instance

Base class for Set, FrozenSet, Tuple and List.

bool_value(context: InferenceContext | None = None) bool[source]#

Determine the boolean value of this node.

Returns:

The boolean value of this node.

elts: list[SuccessfulInferenceResult]#

The elements in the node.

classmethod from_elements(elts: Iterable[Any]) Self[source]#

Create a node of this type from the given list of elements.

Parameters:

elts – The list of elements that the node should contain.

Returns:

A new node containing the given elements.

get_children()[source]#

Get the child nodes below this node.

itered()[source]#

An iterator over the elements this node contains.

Returns:

The contents of this node.

Return type:

iterable(NodeNG)

postinit(elts: list[SuccessfulInferenceResult]) None[source]#
abstract pytype() str[source]#

Get the name of the type that this node represents.

Returns:

The name of the type.