Back to index

python3.2  3.2.2
Classes | Functions | Variables
lib2to3.fixes.fix_next Namespace Reference

Classes

class  FixNext

Functions

def is_assign_target
def find_assign
def is_subtree

Variables

string bind_warning = "Calls to builtin next() possibly shadowed by global binding"

Detailed Description

Fixer for it.next() -> next(it), per PEP 3114.

Function Documentation

Definition at line 93 of file fix_next.py.

00093 
00094 def find_assign(node):
00095     if node.type == syms.expr_stmt:
00096         return node
00097     if node.type == syms.simple_stmt or node.parent is None:
00098         return None
00099     return find_assign(node.parent)

Here is the caller graph for this function:

Definition at line 81 of file fix_next.py.

00081 
00082 def is_assign_target(node):
00083     assign = find_assign(node)
00084     if assign is None:
00085         return False
00086 
00087     for child in assign.children:
00088         if child.type == token.EQUAL:
00089             return False
00090         elif is_subtree(child, node):
00091             return True
00092     return False

Here is the call graph for this function:

Here is the caller graph for this function:

def lib2to3.fixes.fix_next.is_subtree (   root,
  node 
)

Definition at line 100 of file fix_next.py.

00100 
00101 def is_subtree(root, node):
00102     if root == node:
00103         return True
00104     return any(is_subtree(c, node) for c in root.children)

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

string lib2to3.fixes.fix_next.bind_warning = "Calls to builtin next() possibly shadowed by global binding"

Definition at line 14 of file fix_next.py.