Module Expr Str Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias Assign NameStore ListLoad Str Str Str Str Str Str Str Assign NameStore Str Assign NameStore NameLoad TryExcept body ClassDef bases NameLoad body Assign NameStore NameStore Lambda arguments args defaults vararg NameLoad decorator_list Exec Str Dict Call NameLoad handlers ExceptHandler type NameLoad body Assign NameStore NameLoad Delete NameDel FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad NameLoad NameLoad ListLoad Str If Call NameLoad NameLoad Str body Assign NameStore AttributeLoad NameLoad attr orelse Assign NameStore ListComp NameLoad comprehension NameStore AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr ListComp TupleLoad NameLoad Call NameLoad NameLoad NameLoad comprehension NameStore NameLoad decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore ListLoad Str Str Str Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad Num Str NameLoad body Expr Str If Call NameLoad NameLoad NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad keyword AttributeLoad NameLoad attr orelse Assert Call NameLoad NameLoad AttributeLoad NameLoad attr BinOpMod Str NameLoad Assign AttributeStore NameLoad attr Str If CompareEq AttributeLoad NameLoad attr Str body Assign NameStore Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr ListLoad NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad keyword NameLoad If CompareIs NameLoad NameLoad body Assign NameStore NameLoad orelse If Call NameLoad NameLoad NameLoad body Assign NameStore SubscriptLoad Dict Str Str NameLoad NameLoad Index NameLoad Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Dict Str Str Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Assign SubscriptStore NameLoad Index Str Call NameLoad AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr Call NameLoad Num SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr AttributeLoad SubscriptLoad NameLoad Index Str attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return BoolOpAnd CompareEq Call NameLoad NameLoad Call NameLoad NameLoad CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Return UnaryOpNot CompareEq NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str TupleLoad AttributeLoad Call NameLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore ListLoad Assign NameStore Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return Call NameLoad AttributeLoad NameLoad attr NameLoad Dict Str NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore ListLoad Assign NameStore Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Exec AttributeLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list Assign NameStore Call NameLoad ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body If CompareIsNot NameLoad NameLoad body Assign NameStore BinOpMod Str TupleLoad Call NameLoad NameLoad NameLoad orelse Assign NameStore BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore ListLoad Str Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad ListLoad decorator_list FunctionDef arguments args NameParam defaults body Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpMod Str TupleLoad AttributeLoad Call NameLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Return Str decorator_list FunctionDef arguments args NameParam defaults vararg kwarg body Expr Str Assign NameStore NameLoad Raise Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list Assign NameStore NameStore NameStore NameLoad Assign NameStore NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Dict Str Str Str Str Str Str NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore NameLoad TryExcept body Assign NameStore Call NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body If Call NameLoad AttributeLoad NameLoad attr NameLoad body Raise orelse TryExcept body Assign NameStore SubscriptLoad NameLoad Index NameLoad handlers ExceptHandler type TupleLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore NameLoad If CompareEq Call NameLoad NameLoad Num body Assign NameStore SubscriptLoad NameLoad Index Num TryExcept body Return SubscriptLoad NameLoad Index NameLoad handlers ExceptHandler type TupleLoad NameLoad NameLoad NameLoad NameLoad name NameStore body If Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Return NameLoad Raise decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Raise NameLoad decorator_list NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore NameLoad Return Call NameLoad NameLoad keyword NameLoad decorator_list NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore NameLoad Raise Call NameLoad NameLoad keyword NameLoad decorator_list NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Str body Assign NameStore Call AttributeLoad NameLoad attr If CompareEq NameLoad Str body Assign NameStore ListComp Call AttributeLoad NameLoad attr comprehension NameStore Call AttributeLoad NameLoad attr If NameLoad body Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad Call NameLoad Call AttributeLoad Str attr SubscriptLoad NameLoad Slice Num attr If BoolOpAnd Call AttributeLoad Call AttributeLoad NameLoad attr attr Str UnaryOpNot Call AttributeLoad SubscriptLoad NameLoad Index Num attr body Assign NameStore Call AttributeLoad Str attr ListComp BinOpMod Str NameLoad comprehension NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Str attr ListLoad NameLoad NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad BinOpAdd Str NameLoad attr Str Return Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad Str NameLoad Num NameLoad body If UnaryOpNot NameLoad body Assign NameStore Str If NameLoad body If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str Str orelse If UnaryOpNot Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str Str If CompareLtE NameLoad Num body Assign NameStore Num If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad Dict Str NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad Call NameLoad attr NameLoad If CompareEq NameLoad Str body Assign NameStore BinOpMod Str BoolOpOr NameLoad Str orelse Assign NameStore Call AttributeLoad NameLoad attr If UnaryOpNot NameLoad body Assign NameStore Str orelse Assign NameStore SubscriptLoad NameLoad Index Num If CompareGt Call NameLoad NameLoad Num body AugAssignAdd NameStore Str Assign NameStore BinOpMod Str NameLoad Assign NameStore AttributeLoad Call NameLoad NameLoad attr Assign NameStore Call NameLoad NameLoad NameLoad NameLoad TryExcept body Return Call NameLoad NameLoad NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Return NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg kwarg body Assign NameStore Call NameLoad For TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr NameLoad body If CompareIn NameLoad NameLoad body Raise Call NameLoad Str Expr Call NameLoad NameLoad NameLoad NameLoad For TupleStore NameStore NameStore NameLoad body Expr Call NameLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Dict Str Str NameLoad NameLoad Assign NameStore Call NameLoad ListLoad Str Str Str Str Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr ListLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore Call NameLoad FunctionDef arguments args NameParam defaults body If BoolOpAnd UnaryOpNot NameLoad Call NameLoad NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If Call NameLoad NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr BoolOpOr AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad AttributeLoad NameLoad attr body For NameStore AttributeLoad NameLoad attr body Expr Call NameLoad NameLoad decorator_list If Call NameLoad NameLoad Str body For NameStore AttributeLoad NameLoad attr body Expr Call NameLoad NameLoad If Call NameLoad NameLoad Str body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If Call NameLoad NameLoad Str body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad Str body For NameStore AttributeLoad NameLoad attr body Expr Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If UnaryOpNot Call NameLoad AttributeLoad NameLoad attr NameLoad body TryExcept body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str handlers ExceptHandler type NameLoad body Return Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Str Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareGt Call NameLoad AttributeLoad NameLoad attr Num body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad TryFinally body Return Call AttributeLoad NameLoad attr NameLoad NameLoad finalbody Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareGt Call NameLoad AttributeLoad NameLoad attr Num body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareEq ListComp AttributeLoad NameLoad attr comprehension NameStore AttributeLoad NameLoad attr ListLoad Str body If NameLoad body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr Str ListLoad Call NameLoad AttributeLoad NameLoad attr Str Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr TupleLoad TupleLoad Return NameLoad If CompareGt Call NameLoad AttributeLoad NameLoad attr Num body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareGt Call NameLoad AttributeLoad NameLoad attr Num body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr TryFinally body Return Call AttributeLoad NameLoad attr NameLoad NameLoad finalbody Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore ListLoad For NameStore AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr ListComp Call AttributeLoad NameLoad attr NameLoad comprehension NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Delete SubscriptDel AttributeLoad NameLoad attr Slice UnaryOpUSub Call NameLoad AttributeLoad NameLoad attr Return NameLoad decorator_list Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr TryFinally body Return Call AttributeLoad NameLoad attr NameLoad NameLoad finalbody Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam defaults body If BoolOpAnd Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr CompareNotIn AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr NameLoad ListLoad NameLoad NameLoad ListLoad orelse If Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body If CompareGt Call NameLoad AttributeLoad NameLoad attr Num body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr AttributeLoad NameLoad attr Return NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body If UnaryOpNot Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Assign NameStore ListLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return Call NameLoad AttributeLoad NameLoad attr NameLoad NameLoad ListLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If BoolOpOr UnaryOpNot Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr UnaryOpNot Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Assign NameStore ListLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr TupleLoad Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Return Call NameLoad AttributeLoad NameLoad attr NameLoad NameLoad ListLoad decorator_list decorator_list
N/A N/A Support for "safe" evaluation of Python expressions. N/A builtins textwrap dedent types CodeType genshi.core Markup genshi.template.astutil ASTTransformer ASTCodeGenerator _ast parse genshi.template.base TemplateRuntimeError genshi.util flatten genshi.compat get_code_params build_code_chunk IS_PYTHON2 N/A __all__ N/A Code Expression Suite LenientLookup StrictLookup Undefined UndefinedError N/A __docformat__ restructuredtext en N/A has_star_import_bug False N/A N/A _FakeMapping N/A object N/A N/A __getitem__ __setitem__ N/A N/A N/A N/A a None N/A N/A from sys import * N/A N/A _FakeMapping N/A N/A N/A SystemError N/A N/A has_star_import_bug True N/A _FakeMapping _star_import_patch N/A N/A mapping modname N/A N/A N/A This function is used as helper if a Python version with a broken
    star-import opcode is in use.
     N/A module N/A __import__ modname None None N/A __all__ N/A N/A hasattr module __all__ N/A N/A members N/A module __all__ N/A N/A members N/A x N/A x N/A module __dict__ N/A N/A N/A x startswith _ N/A N/A N/A mapping update N/A N/A name N/A getattr module name N/A name members N/A Code N/A object N/A N/A Abstract base class for the `Expression` and `Suite` classes. N/A __slots__ N/A source code ast _globals __init__ N/A N/A self source filename lineno lookup xform N/A None -1 strict None N/A N/A Create the code object, either from a string, or from an AST node.
        
        :param source: either a string containing the source code, or an AST
                       node
        :param filename: the (preferably absolute) name of the file containing
                         the code
        :param lineno: the number of the line on which the code was found
        :param lookup: the lookup class that defines how variables are looked
                       up in the context; can be either "strict" (the default),
                       "lenient", or a custom lookup class
        :param xform: the AST transformer that should be applied to the code;
                      if `None`, the appropriate transformation is chosen
                      depending on the mode
         N/A N/A isinstance source str N/A N/A N/A self source source N/A node N/A _parse source mode N/A self mode N/A N/A N/A isinstance source N/A _ast AST N/A Expected string or AST node, but got %r source N/A N/A self source ? N/A N/A N/A self mode eval N/A N/A node N/A N/A _ast Expression N/A N/A node body source N/A N/A node N/A N/A _ast Module N/A N/A node body N/A source N/A N/A self ast node N/A N/A self code N/A _compile node N/A self source mode N/A self mode filename filename lineno lineno xform xform N/A N/A lookup None N/A N/A lookup LenientLookup N/A N/A N/A isinstance lookup str N/A N/A lookup N/A N/A lenient strict LenientLookup StrictLookup N/A lookup N/A N/A self _globals N/A lookup globals N/A __getstate__ N/A N/A self N/A N/A N/A state N/A source ast lookup N/A self source N/A self ast N/A N/A self _globals __self__ N/A N/A state N/A code N/A get_code_params N/A self code N/A state N/A __setstate__ N/A N/A self state N/A N/A N/A N/A self source N/A state N/A source N/A N/A self ast N/A state N/A ast N/A N/A self code N/A CodeType 0 N/A state N/A code N/A N/A self _globals N/A N/A state N/A lookup globals N/A __eq__ N/A N/A self other N/A N/A N/A N/A N/A N/A type other N/A type self N/A N/A self code N/A other code N/A __hash__ N/A N/A self N/A N/A N/A N/A hash N/A self code N/A __ne__ N/A N/A self other N/A N/A N/A N/A N/A self other N/A __repr__ N/A N/A self N/A N/A N/A N/A %s(%r) N/A N/A N/A type self __name__ N/A self source N/A N/A Expression N/A Code N/A N/A Evaluates Python expressions used in templates.

    >>> data = dict(test='Foo', items=[1, 2, 3], dict={'some': 'thing'})
    >>> Expression('test').evaluate(data)
    'Foo'

    >>> Expression('items[0]').evaluate(data)
    1
    >>> Expression('items[-1]').evaluate(data)
    3
    >>> Expression('dict["some"]').evaluate(data)
    'thing'
    
    Similar to e.g. Javascript, expressions in templates can use the dot
    notation for attribute access to access items in mappings:
    
    >>> Expression('dict.some').evaluate(data)
    'thing'
    
    This also works the other way around: item access can be used to access
    any object attribute:
    
    >>> class MyClass(object):
    ...     myattr = 'Bar'
    >>> data = dict(mine=MyClass(), key='myattr')
    >>> Expression('mine.myattr').evaluate(data)
    'Bar'
    >>> Expression('mine["myattr"]').evaluate(data)
    'Bar'
    >>> Expression('mine[key]').evaluate(data)
    'Bar'
    
    All of the standard Python operators are available to template expressions.
    Built-in functions such as ``len()`` are also available in template
    expressions:
    
    >>> data = dict(items=[1, 2, 3])
    >>> Expression('len(items)').evaluate(data)
    3
     N/A __slots__ N/A N/A mode eval evaluate N/A N/A self data N/A N/A N/A Evaluate the expression against the given data dictionary.
        
        :param data: a mapping containing the data to evaluate against
        :return: the result of the evaluation
         N/A __traceback_hide__ before_and_this N/A _globals N/A N/A self _globals data N/A N/A eval N/A self code _globals N/A __data__ data N/A N/A Suite N/A Code N/A N/A Executes Python statements used in templates.

    >>> data = dict(test='Foo', items=[1, 2, 3], dict={'some': 'thing'})
    >>> Suite("foo = dict['some']").execute(data)
    >>> data['foo']
    'thing'
     N/A __slots__ N/A N/A mode exec execute N/A N/A self data N/A N/A N/A Execute the suite in the given data dictionary.
        
        :param data: a mapping containing the data to execute in
         N/A __traceback_hide__ before_and_this N/A _globals N/A N/A self _globals data N/A N/A self code _globals data N/A N/A N/A UNDEFINED N/A object UndefinedError N/A TemplateRuntimeError N/A N/A Exception thrown when a template expression attempts to access a variable
    not defined in the context.
    
    :see: `LenientLookup`, `StrictLookup`
     __init__ N/A N/A self name owner N/A UNDEFINED N/A N/A N/A owner UNDEFINED N/A N/A message N/A %s has no member named "%s" N/A N/A repr owner name N/A N/A message N/A "%s" not defined name N/A N/A N/A TemplateRuntimeError __init__ self message N/A N/A Undefined N/A object N/A N/A Represents a reference to an undefined variable.
    
    Unlike the Python runtime, template expressions can refer to an undefined
    variable without causing a `NameError` to be raised. The result will be an
    instance of the `Undefined` class, which is treated the same as ``False`` in
    conditions, but raise an exception on any other operation:
    
    >>> foo = Undefined('foo')
    >>> bool(foo)
    False
    >>> list(foo)
    []
    >>> print(foo)
    undefined
    
    However, calling an undefined variable, or trying to access an attribute
    of that variable, will raise an exception that includes the name used to
    reference that undefined variable.
    
    >>> try:
    ...     foo('bar')
    ... except UndefinedError as e:
    ...     print(e.msg)
    "foo" not defined

    >>> try:
    ...     foo.bar
    ... except UndefinedError as e:
    ...     print(e.msg)
    "foo" not defined
    
    :see: `LenientLookup`
     N/A __slots__ N/A _name _owner __init__ N/A N/A self name owner N/A UNDEFINED N/A N/A Initialize the object.
        
        :param name: the name of the reference
        :param owner: the owning object, if the variable is accessed as a member
         N/A N/A self _name name N/A N/A self _owner owner N/A __iter__ N/A N/A self N/A N/A N/A N/A iter N/A N/A __bool__ N/A N/A self N/A N/A N/A False N/A __repr__ N/A N/A self N/A N/A N/A N/A <%s %r> N/A N/A N/A type self __name__ N/A self _name N/A __str__ N/A N/A self N/A N/A N/A undefined N/A _die N/A N/A self N/A args kwargs N/A N/A Raise an `UndefinedError`. N/A __traceback_hide__ True N/A N/A UndefinedError N/A self _name N/A self _owner N/A N/A __call__ __getattr__ __getitem__ _die N/A __length_hint__ None N/A LookupBase N/A object N/A N/A Abstract base class for variable lookup implementations. globals N/A N/A cls data N/A N/A N/A Construct the globals dictionary to use as the execution context for
        the expression or suite.
         N/A N/A __data__ _lookup_name _lookup_attr _lookup_item _star_import_patch UndefinedError data N/A cls lookup_name N/A cls lookup_attr N/A cls lookup_item _star_import_patch UndefinedError N/A classmethod lookup_name N/A N/A cls data name N/A N/A N/A __traceback_hide__ True N/A val N/A N/A data get name UNDEFINED N/A N/A val UNDEFINED N/A N/A val N/A N/A BUILTINS get name val N/A N/A val UNDEFINED N/A N/A val N/A N/A cls undefined name N/A val N/A classmethod lookup_attr N/A N/A cls obj key N/A N/A N/A __traceback_hide__ True N/A N/A N/A val N/A getattr obj key N/A N/A N/A AttributeError N/A N/A N/A hasattr N/A obj __class__ key N/A N/A N/A N/A N/A N/A val N/A obj N/A key N/A N/A N/A N/A KeyError TypeError N/A N/A val N/A N/A cls undefined key owner obj N/A val N/A classmethod lookup_item N/A N/A cls obj key N/A N/A N/A __traceback_hide__ True N/A N/A N/A len key 1 N/A N/A key N/A key N/A 0 N/A N/A N/A N/A obj N/A key N/A N/A N/A N/A AttributeError KeyError IndexError TypeError N/A e N/A N/A N/A isinstance key str N/A N/A val N/A getattr obj key UNDEFINED N/A N/A val UNDEFINED N/A N/A val N/A N/A cls undefined key owner obj N/A val N/A N/A classmethod undefined N/A N/A cls key owner N/A UNDEFINED N/A N/A Can be overridden by subclasses to specify behavior when undefined
        variables are accessed.
        
        :param key: the name of the variable
        :param owner: the owning object, if the variable is accessed as a member
         N/A NotImplementedError N/A classmethod N/A LenientLookup N/A LookupBase N/A N/A Default variable lookup mechanism for expressions.
    
    When an undefined variable is referenced using this lookup style, the
    reference evaluates to an instance of the `Undefined` class:
    
    >>> expr = Expression('nothing', lookup='lenient')
    >>> undef = expr.evaluate({})
    >>> undef
    <Undefined 'nothing'>
    
    The same will happen when a non-existing attribute or item is accessed on
    an existing object:
    
    >>> expr = Expression('something.nil', lookup='lenient')
    >>> expr.evaluate({'something': dict()})
    <Undefined 'nil'>
    
    See the documentation of the `Undefined` class for details on the behavior
    of such objects.
    
    :see: `StrictLookup`
     undefined N/A N/A cls key owner N/A UNDEFINED N/A N/A Return an ``Undefined`` object. N/A __traceback_hide__ True N/A N/A Undefined key owner owner N/A classmethod N/A StrictLookup N/A LookupBase N/A N/A Strict variable lookup mechanism for expressions.
    
    Referencing an undefined variable using this lookup style will immediately
    raise an ``UndefinedError``:
    
    >>> expr = Expression('nothing', lookup='strict')
    >>> try:
    ...     expr.evaluate({})
    ... except UndefinedError as e:
    ...     print(e.msg)
    "nothing" not defined
    
    The same happens when a non-existing attribute or item is accessed on an
    existing object:
    
    >>> expr = Expression('something.nil', lookup='strict')
    >>> try:
    ...     expr.evaluate({'something': dict()})
    ... except UndefinedError as e:
    ...     print(e.msg)
    {} has no member named "nil"
     undefined N/A N/A cls key owner N/A UNDEFINED N/A N/A Raise an ``UndefinedError`` immediately. N/A __traceback_hide__ True N/A N/A UndefinedError key owner owner N/A classmethod N/A _parse N/A N/A source mode N/A eval N/A N/A source N/A N/A source strip N/A N/A mode exec N/A N/A lines N/A N/A N/A line expandtabs N/A line N/A N/A source splitlines N/A lines N/A N/A first N/A lines N/A 0 N/A rest N/A N/A N/A dedent N/A N/A join N/A lines N/A 1 rstrip N/A N/A N/A N/A N/A N/A first rstrip endswith : N/A N/A N/A N/A rest N/A 0 isspace N/A N/A rest N/A N/A join N/A N/A     %s line N/A line N/A N/A rest splitlines N/A source N/A N/A join N/A first rest N/A N/A isinstance source str N/A N/A source N/A N/A N/A \ufeff source encode utf-8 N/A N/A parse source mode N/A _compile N/A N/A node source mode filename lineno xform N/A None eval None -1 None N/A N/A N/A filename N/A N/A filename <string> N/A IS_PYTHON2 N/A N/A N/A isinstance filename str N/A N/A filename N/A N/A filename encode utf-8 replace N/A N/A N/A N/A isinstance filename str N/A N/A filename N/A N/A filename decode utf-8 replace N/A N/A lineno 0 N/A N/A lineno 1 N/A N/A xform None N/A N/A xform N/A N/A N/A eval ExpressionASTTransformer get mode TemplateASTTransformer N/A tree N/A N/A N/A xform visit node N/A N/A mode eval N/A N/A name N/A <Expression %r> N/A source ? N/A N/A lines N/A N/A source splitlines N/A N/A lines N/A N/A extract N/A N/A extract N/A lines N/A 0 N/A N/A N/A len lines 1 N/A N/A extract  ... N/A name N/A <Suite %r> extract N/A new_source N/A N/A ASTCodeGenerator tree code N/A code N/A compile new_source filename mode N/A N/A N/A N/A build_code_chunk code filename name lineno N/A N/A N/A RuntimeError N/A N/A code N/A _new N/A N/A class_ N/A args kwargs N/A N/A ret N/A class_ N/A N/A attr value N/A zip N/A ret _fields args N/A N/A N/A attr kwargs N/A N/A N/A ValueError Field set both in args and kwargs N/A N/A setattr ret attr value N/A N/A attr value kwargs N/A N/A N/A setattr ret attr value N/A ret N/A N/A BUILTINS N/A N/A N/A builtins __dict__ copy N/A N/A N/A BUILTINS update N/A Markup Undefined Markup Undefined N/A CONSTANTS N/A frozenset N/A False True None NotImplemented Ellipsis TemplateASTTransformer N/A ASTTransformer N/A N/A Concrete AST transformer that implements the AST transformations needed
    for code embedded in templates.
     __init__ N/A N/A self N/A N/A N/A N/A self locals N/A CONSTANTS N/A _extract_names N/A N/A self node N/A N/A N/A names N/A set _process N/A N/A node N/A N/A N/A N/A N/A IS_PYTHON2 N/A isinstance node N/A _ast arg N/A N/A N/A N/A names add N/A node arg N/A N/A isinstance node N/A _ast Name N/A N/A N/A N/A names add N/A node id N/A N/A N/A isinstance node N/A _ast alias N/A N/A N/A N/A names add N/A N/A node asname N/A node name N/A N/A N/A isinstance node N/A _ast Tuple N/A N/A elt N/A node elts N/A N/A N/A _process elt N/A N/A N/A hasattr node args N/A N/A arg N/A node args N/A N/A N/A _process arg N/A N/A hasattr node vararg N/A N/A N/A N/A names add N/A node vararg N/A N/A hasattr node kwarg N/A N/A N/A N/A names add N/A node kwarg N/A N/A N/A hasattr node names N/A N/A elt N/A node names N/A N/A N/A _process elt N/A names N/A visit_Str N/A N/A self node N/A N/A N/A N/A N/A isinstance N/A node s str N/A N/A N/A N/A N/A N/A N/A node s decode ascii N/A N/A N/A ValueError N/A N/A N/A _new N/A _ast Str N/A N/A N/A node s decode utf-8 N/A node N/A visit_ClassDef N/A N/A self node N/A N/A N/A N/A N/A len N/A self locals 1 N/A N/A N/A N/A N/A N/A self locals N/A -1 add N/A node name N/A N/A N/A N/A self locals append N/A set N/A N/A N/A N/A N/A ASTTransformer visit_ClassDef self node N/A N/A N/A N/A N/A self locals pop N/A visit_Import N/A N/A self node N/A N/A N/A N/A N/A len N/A self locals 1 N/A N/A N/A N/A N/A N/A self locals N/A -1 update N/A N/A self _extract_names node N/A N/A N/A ASTTransformer visit_Import self node N/A visit_ImportFrom N/A N/A self node N/A N/A N/A N/A N/A N/A a name N/A a N/A node names N/A * N/A N/A has_star_import_bug N/A N/A node N/A _new N/A _ast Expr N/A _new N/A _ast Call N/A _new N/A _ast Name _star_import_patch N/A N/A _new N/A _ast Name __data__ N/A _new N/A _ast Str N/A node module N/A N/A N/A node N/A N/A N/A len N/A self locals 1 N/A N/A N/A N/A N/A N/A self locals N/A -1 update N/A N/A self _extract_names node N/A N/A N/A ASTTransformer visit_ImportFrom self node N/A visit_FunctionDef N/A N/A self node N/A N/A N/A N/A N/A len N/A self locals 1 N/A N/A N/A N/A N/A N/A self locals N/A -1 add N/A node name N/A N/A N/A N/A self locals append N/A N/A self _extract_names N/A node args N/A N/A N/A N/A N/A ASTTransformer visit_FunctionDef self node N/A N/A N/A N/A N/A self locals pop N/A visit_GeneratorExp N/A N/A self node N/A N/A N/A gens N/A N/A generator N/A node generators N/A N/A N/A N/A N/A self locals append N/A set N/A gen N/A _new N/A _ast comprehension N/A N/A self visit N/A generator target N/A N/A self visit N/A generator iter N/A N/A N/A self visit if_ N/A if_ N/A generator ifs N/A N/A N/A gens append gen N/A ret N/A _new N/A node __class__ N/A N/A self visit N/A node elt gens N/A N/A N/A self locals N/A N/A N/A len N/A node generators N/A ret N/A N/A visit_ListComp visit_GeneratorExp visit_Lambda N/A N/A self node N/A N/A N/A N/A N/A N/A self locals append N/A N/A self _extract_names N/A node args N/A N/A N/A N/A N/A ASTTransformer visit_Lambda self node N/A N/A N/A N/A N/A self locals pop N/A visit_Name N/A N/A self node N/A N/A N/A N/A N/A isinstance N/A node ctx N/A _ast Load N/A N/A node id N/A flatten N/A self locals N/A N/A name N/A _new N/A _ast Name _lookup_name N/A N/A _ast Load N/A namearg N/A _new N/A _ast Name __data__ N/A N/A _ast Load N/A strarg N/A _new N/A _ast Str N/A node id N/A node N/A _new N/A _ast Call name N/A namearg strarg N/A N/A N/A N/A isinstance N/A node ctx N/A _ast Store N/A N/A N/A N/A len N/A self locals 1 N/A N/A N/A N/A N/A N/A self locals N/A -1 add N/A node id N/A node N/A N/A ExpressionASTTransformer N/A TemplateASTTransformer N/A N/A Concrete AST transformer that implements the AST transformations needed
    for code embedded in templates.
     visit_Attribute N/A N/A self node N/A N/A N/A N/A N/A isinstance N/A node ctx N/A _ast Load N/A N/A N/A N/A ASTTransformer visit_Attribute self node N/A func N/A _new N/A _ast Name _lookup_attr N/A N/A _ast Load N/A args N/A N/A N/A self visit N/A node value N/A _new N/A _ast Str N/A node attr N/A N/A _new N/A _ast Call func args N/A N/A visit_Subscript N/A N/A self node N/A N/A N/A N/A N/A N/A isinstance N/A node ctx N/A _ast Load N/A N/A isinstance N/A node slice N/A _ast Index N/A N/A N/A N/A ASTTransformer visit_Subscript self node N/A func N/A _new N/A _ast Name _lookup_item N/A N/A _ast Load N/A args N/A N/A N/A self visit N/A node value N/A _new N/A _ast Tuple N/A N/A N/A self visit N/A N/A node slice value N/A N/A _ast Load N/A N/A _new N/A _ast Call func args N/A N/A N/A