Module Expr Str ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam NameParam NameParam defaults Str Str body Expr Str Return Call NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Dict Str Str Str NameLoad NameLoad NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad keyword Str If Call NameLoad NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body If Call NameLoad NameLoad NameLoad body Return AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad NameLoad body Return AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad NameLoad body Return Call NameLoad Call NameLoad NameLoad AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad NameLoad body Return Call NameLoad Call NameLoad NameLoad AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad NameLoad body Return Call NameLoad GeneratorExp TupleLoad Call NameLoad NameLoad Call NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad NameLoad body If CompareIn AttributeLoad NameLoad attr NameLoad body Return SubscriptLoad NameLoad Index AttributeLoad NameLoad attr orelse If BoolOpAnd Call NameLoad NameLoad NameLoad Call NameLoad AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Call NameLoad AttributeLoad NameLoad attr NameLoad Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call NameLoad AttributeLoad NameLoad attr NameLoad Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr TupleLoad NameLoad NameLoad NameLoad body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr If Call NameLoad AttributeLoad NameLoad attr NameLoad body Return BinOpAdd NameLoad NameLoad orelse Return BinOpSub NameLoad NameLoad Raise Call NameLoad Str decorator_list Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam defaults body If Call NameLoad NameLoad NameLoad body Assign NameStore ListComp TupleLoad NameLoad Call NameLoad NameLoad comprehension TupleStore NameStore NameStore Call NameLoad NameLoad Assign NameStore BinOpMod Str TupleLoad AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad Str attr IfExp NameLoad GeneratorExp BinOpMod Str NameLoad comprehension NameStore NameLoad GeneratorExp NameLoad comprehension TupleStore NameStore NameStore NameLoad If BoolOpAnd NameLoad AttributeLoad NameLoad attr body AugAssignAdd NameStore BoolOpOr BoolOpAnd NameLoad Str Str AugAssignAdd NameStore Call AttributeLoad Str attr GeneratorExp BinOpMod Str TupleLoad NameLoad Call NameLoad Call NameLoad NameLoad NameLoad comprehension NameStore AttributeLoad NameLoad attr Return BinOpAdd NameLoad Str orelse If Call NameLoad NameLoad NameLoad body Return BinOpMod Str Call AttributeLoad Str attr GeneratorExp Call NameLoad NameLoad comprehension NameStore NameLoad Return Call NameLoad NameLoad decorator_list If UnaryOpNot Call NameLoad NameLoad NameLoad body Raise Call NameLoad BinOpMod Str AttributeLoad AttributeLoad NameLoad attr attr Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str For NameStore TupleLoad Str Str body If BoolOpAnd CompareIn NameLoad AttributeLoad NameLoad attr CompareIn NameLoad AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad body Expr Call NameLoad NameLoad NameLoad Call NameLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body If CompareIn Str AttributeLoad NameLoad attr body If UnaryOpNot Call NameLoad NameLoad Str body Assign AttributeStore NameLoad attr NameLoad orelse Assign NameStore AttributeLoad NameLoad attr If CompareIn Str AttributeLoad NameLoad attr body If UnaryOpNot Call NameLoad NameLoad Str body Assign AttributeStore NameLoad attr NameLoad orelse Assign NameStore AttributeLoad NameLoad attr For NameStore Call NameLoad NameLoad body Expr Call NameLoad NameLoad NameLoad NameLoad decorator_list Expr Call NameLoad NameLoad Num Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Expr Str For NameStore Call NameLoad NameLoad body If CompareIn Str AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr BinOpAdd Call NameLoad NameLoad Str Num NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str For NameStore AttributeLoad NameLoad attr body TryExcept body Expr Yield TupleLoad NameLoad Call NameLoad NameLoad NameLoad handlers ExceptHandler type NameLoad body Pass decorator_list FunctionDef arguments args NameParam defaults body Expr Str For TupleStore NameStore NameStore Call NameLoad NameLoad body If Call NameLoad NameLoad NameLoad body Expr Yield NameLoad orelse If Call NameLoad NameLoad NameLoad body For NameStore NameLoad body If Call NameLoad NameLoad NameLoad body Expr Yield NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If UnaryOpNot Call NameLoad NameLoad TupleLoad NameLoad NameLoad NameLoad body Raise Call NameLoad BinOpMod Str AttributeLoad AttributeLoad NameLoad attr attr If BoolOpAnd AttributeLoad NameLoad attr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad Call NameLoad AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr NameLoad body If NameLoad body Import alias Return Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr attr Return AttributeLoad AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str ImportFrom alias Assign NameStore Call NameLoad ListLoad NameLoad While NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Expr Yield NameLoad decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore BinOpAdd Str AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call NameLoad NameLoad NameLoad AttributeLoad NameLoad attr Return Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str For TupleStore NameStore NameStore Call NameLoad NameLoad body If Call NameLoad NameLoad NameLoad body For NameStore NameLoad body If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad orelse If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore ListLoad For NameStore NameLoad body If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Continue orelse If UnaryOpNot Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Continue Expr Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Slice NameLoad orelse If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Expr Call NameLoad NameLoad NameLoad orelse Expr Call NameLoad NameLoad NameLoad NameLoad Return NameLoad decorator_list decorator_list
N/A N/A 
    ast
    ~~~

    The `ast` module helps Python applications to process trees of the Python
    abstract syntax grammar.  The abstract syntax itself might change with
    each Python release; this module helps to find out programmatically what
    the current grammar looks like and allows modifications of it.

    An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as
    a flag to the `compile()` builtin function or by using the `parse()`
    function from this module.  The result will be a tree of objects whose
    classes all inherit from `ast.AST`.

    A modified abstract syntax tree can be compiled into a Python code object
    using the built-in `compile()` function.

    Additionally various helper functions are provided that make working with
    the trees simpler.  The main intention of the helper functions and this
    module in general is to provide an easy to use interface for libraries
    that work tightly with the python syntax (template engines for example).


    :copyright: Copyright 2008 by Armin Ronacher.
    :license: Python License.
 _ast * _ast __version__ parse N/A N/A source filename mode N/A <unknown> exec N/A N/A 
    Parse the source into an AST node.
    Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
     N/A N/A compile source filename mode PyCF_ONLY_AST N/A literal_eval N/A N/A node_or_string N/A N/A N/A 
    Safely evaluate an expression node or a string containing a Python
    expression.  The string or node provided may only consist of the following
    Python literal structures: strings, numbers, tuples, lists, dicts, booleans,
    and None.
     N/A _safe_names N/A None True False None True False N/A N/A isinstance node_or_string basestring N/A N/A node_or_string N/A parse node_or_string mode eval N/A N/A isinstance node_or_string Expression N/A N/A node_or_string N/A node_or_string body _convert N/A N/A node N/A N/A N/A N/A isinstance node Str N/A N/A N/A node s N/A N/A N/A isinstance node Num N/A N/A N/A node n N/A N/A N/A isinstance node Tuple N/A N/A N/A tuple N/A map _convert N/A node elts N/A N/A N/A isinstance node List N/A N/A N/A list N/A map _convert N/A node elts N/A N/A N/A isinstance node Dict N/A N/A N/A dict N/A N/A N/A _convert k N/A _convert v N/A N/A k v N/A zip N/A node keys N/A node values N/A N/A N/A isinstance node Name N/A N/A N/A N/A node id _safe_names N/A N/A N/A _safe_names N/A N/A node id N/A N/A N/A N/A isinstance node BinOp N/A isinstance N/A node op N/A Add Sub N/A isinstance N/A node right Num N/A isinstance N/A N/A node right n complex N/A isinstance N/A node left Num N/A isinstance N/A N/A node left n N/A int long float N/A N/A left N/A N/A node left n N/A right N/A N/A node right n N/A N/A isinstance N/A node op Add N/A N/A N/A left right N/A N/A N/A left right N/A N/A ValueError malformed string N/A N/A N/A _convert node_or_string N/A dump N/A N/A node annotate_fields include_attributes N/A True False N/A N/A 
    Return a formatted dump of the tree in *node*.  This is mainly useful for
    debugging purposes.  The returned string will show the names and the values
    for fields.  This makes the code impossible to evaluate, so if evaluation is
    wanted *annotate_fields* must be set to False.  Attributes such as line
    numbers and column offsets are not dumped by default.  If this is wanted,
    *include_attributes* can be set to True.
     _format N/A N/A node N/A N/A N/A N/A isinstance node AST N/A N/A fields N/A N/A a N/A _format b N/A N/A a b N/A iter_fields node N/A rv N/A %s(%s N/A N/A N/A node __class__ __name__ N/A N/A ,  join N/A annotate_fields N/A N/A %s=%s field N/A field fields N/A b N/A N/A a b fields N/A N/A include_attributes N/A node _attributes N/A N/A rv N/A N/A fields ,  N/A rv N/A N/A ,  join N/A N/A %s=%s N/A a N/A _format N/A getattr node a N/A a N/A node _attributes N/A N/A rv ) N/A N/A N/A isinstance node list N/A N/A N/A [%s] N/A N/A ,  join N/A N/A _format x N/A x node N/A N/A repr node N/A N/A N/A N/A isinstance node AST N/A N/A N/A TypeError N/A expected AST, got %r N/A N/A node __class__ __name__ N/A N/A _format node N/A copy_location N/A N/A new_node old_node N/A N/A N/A 
    Copy source location (`lineno` and `col_offset` attributes) from
    *old_node* to *new_node* if possible, and return *new_node*.
     N/A attr N/A lineno col_offset N/A N/A N/A N/A attr N/A old_node _attributes N/A attr N/A new_node _attributes N/A hasattr old_node attr N/A N/A N/A setattr new_node attr N/A getattr old_node attr N/A new_node N/A fix_missing_locations N/A N/A node N/A N/A N/A 
    When you compile a node tree with compile(), the compiler expects lineno and
    col_offset attributes for every node that supports them.  This is rather
    tedious to fill in for generated nodes, so this helper adds these attributes
    recursively where not already set, by setting them to the values of the
    parent node.  It works recursively starting at *node*.
     _fix N/A N/A node lineno col_offset N/A N/A N/A N/A lineno N/A node _attributes N/A N/A N/A N/A hasattr node lineno N/A N/A N/A node lineno lineno N/A N/A lineno N/A node lineno N/A N/A col_offset N/A node _attributes N/A N/A N/A N/A hasattr node col_offset N/A N/A N/A node col_offset col_offset N/A N/A col_offset N/A node col_offset N/A child N/A iter_child_nodes node N/A N/A N/A _fix child lineno col_offset N/A N/A N/A _fix node 1 0 N/A node N/A increment_lineno N/A N/A node n N/A 1 N/A N/A 
    Increment the line number of each node in the tree starting at *node* by *n*.
    This is useful to "move code" to a different location in a file.
     N/A child N/A walk node N/A N/A N/A lineno N/A child _attributes N/A N/A N/A child lineno N/A N/A getattr child lineno 0 n N/A node N/A iter_fields N/A N/A node N/A N/A N/A 
    Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
    that is present on *node*.
     N/A field N/A node _fields N/A N/A N/A N/A N/A N/A field N/A getattr node field N/A N/A N/A AttributeError N/A N/A N/A iter_child_nodes N/A N/A node N/A N/A N/A 
    Yield all direct child nodes of *node*, that is, all fields that are nodes
    and all items of fields that are lists of nodes.
     N/A N/A name field N/A iter_fields node N/A N/A N/A isinstance field AST N/A N/A N/A field N/A N/A N/A isinstance field list N/A N/A item field N/A N/A N/A isinstance item AST N/A N/A N/A item N/A get_docstring N/A N/A node clean N/A True N/A N/A 
    Return the docstring for the given node or None if no docstring can
    be found.  If the node provided does not have docstrings a TypeError
    will be raised.
     N/A N/A N/A isinstance node N/A FunctionDef ClassDef Module N/A N/A N/A TypeError N/A %r can't have docstrings N/A N/A node __class__ __name__ N/A N/A N/A node body N/A isinstance N/A N/A node body N/A 0 Expr N/A isinstance N/A N/A N/A node body N/A 0 value Str N/A N/A clean N/A N/A inspect N/A N/A N/A inspect cleandoc N/A N/A N/A N/A node body N/A 0 value s N/A N/A N/A N/A N/A node body N/A 0 value s N/A walk N/A N/A node N/A N/A N/A 
    Recursively yield all descendant nodes in the tree starting at *node*
    (including *node* itself), in no specified order.  This is useful if you
    only want to modify nodes in place and don't care about the context.
     collections deque N/A todo N/A deque N/A node N/A todo N/A N/A node N/A N/A todo popleft N/A N/A N/A todo extend N/A iter_child_nodes node N/A N/A node N/A NodeVisitor N/A object N/A N/A 
    A node visitor base class that walks the abstract syntax tree and calls a
    visitor function for every node found.  This function may return a value
    which is forwarded by the `visit` method.

    This class is meant to be subclassed, with the subclass adding visitor
    methods.

    Per default the visitor functions for the nodes are ``'visit_'`` +
    class name of the node.  So a `TryFinally` node visit function would
    be `visit_TryFinally`.  This behavior can be changed by overriding
    the `visit` method.  If no visitor function exists for a node
    (return value `None`) the `generic_visit` visitor is used instead.

    Don't use the `NodeVisitor` if you want to apply changes to nodes during
    traversing.  For this a special visitor exists (`NodeTransformer`) that
    allows modifications.
     visit N/A N/A self node N/A N/A N/A Visit a node. N/A method N/A visit_ N/A N/A node __class__ __name__ N/A visitor N/A getattr self method N/A self generic_visit N/A N/A visitor node N/A generic_visit N/A N/A self node N/A N/A N/A Called if no explicit visitor function exists for a node. N/A N/A field value N/A iter_fields node N/A N/A N/A isinstance value list N/A N/A item value N/A N/A N/A isinstance item AST N/A N/A N/A N/A self visit item N/A N/A N/A isinstance value AST N/A N/A N/A N/A self visit value N/A N/A NodeTransformer N/A NodeVisitor N/A N/A 
    A :class:`NodeVisitor` subclass that walks the abstract syntax tree and
    allows modification of nodes.

    The `NodeTransformer` will walk the AST and use the return value of the
    visitor methods to replace or remove the old node.  If the return value of
    the visitor method is ``None``, the node will be removed from its location,
    otherwise it is replaced with the return value.  The return value may be the
    original node in which case no replacement takes place.

    Here is an example transformer that rewrites all occurrences of name lookups
    (``foo``) to ``data['foo']``::

       class RewriteName(NodeTransformer):

           def visit_Name(self, node):
               return copy_location(Subscript(
                   value=Name(id='data', ctx=Load()),
                   slice=Index(value=Str(s=node.id)),
                   ctx=node.ctx
               ), node)

    Keep in mind that if the node you're operating on has child nodes you must
    either transform the child nodes yourself or call the :meth:`generic_visit`
    method for the node first.

    For nodes that were part of a collection of statements (that applies to all
    statement nodes), the visitor may also return a list of nodes rather than
    just a single node.

    Usually you use the transformer like this::

       node = YourTransformer().visit(node)
     generic_visit N/A N/A self node N/A N/A N/A N/A field old_value N/A iter_fields node N/A N/A old_value N/A getattr node field None N/A N/A isinstance old_value list N/A N/A new_values N/A N/A value old_value N/A N/A N/A isinstance value AST N/A N/A value N/A N/A self visit value N/A N/A value None N/A N/A N/A N/A N/A N/A isinstance value AST N/A N/A N/A N/A new_values extend value N/A N/A N/A N/A new_values append value N/A N/A old_value N/A new_values N/A N/A N/A isinstance old_value AST N/A N/A new_node N/A N/A self visit old_value N/A N/A new_node None N/A N/A N/A delattr node field N/A N/A N/A setattr node field new_node N/A node N/A N/A