mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
transform izip_longest #11424
This commit is contained in:
parent
3f84b07816
commit
49d7149e6d
3 changed files with 32 additions and 16 deletions
|
@ -13,7 +13,7 @@ from ..fixer_util import Name
|
|||
|
||||
class FixItertools(fixer_base.BaseFix):
|
||||
BM_compatible = True
|
||||
it_funcs = "('imap'|'ifilter'|'izip'|'ifilterfalse')"
|
||||
it_funcs = "('imap'|'ifilter'|'izip'|'izip_longest'|'ifilterfalse')"
|
||||
PATTERN = """
|
||||
power< it='itertools'
|
||||
trailer<
|
||||
|
@ -28,7 +28,8 @@ class FixItertools(fixer_base.BaseFix):
|
|||
def transform(self, node, results):
|
||||
prefix = None
|
||||
func = results['func'][0]
|
||||
if 'it' in results and func.value != 'ifilterfalse':
|
||||
if ('it' in results and
|
||||
func.value not in ('ifilterfalse', 'izip_longest')):
|
||||
dot, it = (results['dot'], results['it'])
|
||||
# Remove the 'itertools'
|
||||
prefix = it.prefix
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue