jinja2.nodes.FromImport

class jinja2.nodes.FromImport(*fields, **attributes)[source]

A node that represents the from import tag. It’s important to not pass unsafe names to the name attribute. The compiler translates the attribute lookups directly into getattr calls and does not use the subscript callback of the interface. As exported variables may not start with double underscores (which the parser asserts) this is not a problem for regular Jinja code, but if this node is used in an extension extra care must be taken.

The list of names may contain tuples if aliases are wanted.

Methods

__init__(*fields, **attributes)
find(node_type) Find the first node of a given type.
find_all(node_type) Find all the nodes of a given type.
iter_child_nodes([exclude, only]) Iterates over all direct child nodes of the node.
iter_fields([exclude, only]) This method iterates over all fields that are defined and yields (key, value) tuples.
set_ctx(ctx) Reset the context of a node and all child nodes.
set_environment(environment) Set the environment for all nodes.
set_lineno(lineno[, override]) Set the line numbers of the node and children.