home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- """
- Fixer that changes zip(seq0, seq1, ...) into list(zip(seq0, seq1, ...)
- unless there exists a 'from future_builtins import zip' statement in the
- top-level namespace.
-
- We avoid the transformation if the zip() call is directly contained in
- iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:.
- """
- from import fixer_base
- from fixer_util import Name, Call, in_special_context
-
- class FixZip(fixer_base.ConditionalFix):
- PATTERN = "\n power< 'zip' args=trailer< '(' [any] ')' >\n >\n "
- skip_on = 'future_builtins.zip'
-
- def transform(self, node, results):
- if self.should_skip(node):
- return None
- if in_special_context(node):
- return None
- new = node.clone()
- new.set_prefix('')
- new = Call(Name('list'), [
- new])
- new.set_prefix(node.get_prefix())
- return new
-
-
-