]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Lib/lib2to3/fixes/fix_xreadlines.py
1 """Fix "for x in f.xreadlines()" -> "for x in f".
3 This fixer will also convert g(f.xreadlines) into g(f.__iter__)."""
4 # Author: Collin Winter
7 from .. import fixer_base
8 from ..fixer_util
import Name
11 class FixXreadlines(fixer_base
.BaseFix
):
14 power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > >
16 power< any+ trailer< '.' no_call='xreadlines' > >
19 def transform(self
, node
, results
):
20 no_call
= results
.get("no_call")
23 no_call
.replace(Name(u
"__iter__", prefix
=no_call
.prefix
))
25 node
.replace([x
.clone() for x
in results
["call"]])