Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/vendor/current/Lib/ast.py

    r2 r388  
    3030
    3131
    32 def parse(expr, filename='<unknown>', mode='exec'):
    33     """
    34     Parse an expression into an AST node.
    35     Equivalent to compile(expr, filename, mode, PyCF_ONLY_AST).
    36     """
    37     return compile(expr, filename, mode, PyCF_ONLY_AST)
     32def parse(source, filename='<unknown>', mode='exec'):
     33    """
     34    Parse the source into an AST node.
     35    Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
     36    """
     37    return compile(source, filename, mode, PyCF_ONLY_AST)
    3838
    3939
     
    6565            if node.id in _safe_names:
    6666                return _safe_names[node.id]
     67        elif isinstance(node, BinOp) and \
     68             isinstance(node.op, (Add, Sub)) and \
     69             isinstance(node.right, Num) and \
     70             isinstance(node.right.n, complex) and \
     71             isinstance(node.left, Num) and \
     72             isinstance(node.left.n, (int, long, float)):
     73            left = node.left.n
     74            right = node.right.n
     75            if isinstance(node.op, Add):
     76                return left + right
     77            else:
     78                return left - right
    6779        raise ValueError('malformed string')
    6880    return _convert(node_or_string)
     
    141153    This is useful to "move code" to a different location in a file.
    142154    """
    143     if 'lineno' in node._attributes:
    144         node.lineno = getattr(node, 'lineno', 0) + n
    145155    for child in walk(node):
    146156        if 'lineno' in child._attributes:
     
    193203def walk(node):
    194204    """
    195     Recursively yield all child nodes of *node*, in no specified order.  This is
    196     useful if you only want to modify nodes in place and don't care about the
    197     context.
     205    Recursively yield all descendant nodes in the tree starting at *node*
     206    (including *node* itself), in no specified order.  This is useful if you
     207    only want to modify nodes in place and don't care about the context.
    198208    """
    199209    from collections import deque
Note: See TracChangeset for help on using the changeset viewer.