/usr/share/cagefs-skeleton/opt/alt/python311/lib64/python3.11/lib2to3/fixes
"""Fixer that adds parentheses where they are required This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``.""" # By Taek Joo Kim and Benjamin Peterson # Local imports from .. import fixer_base from ..fixer_util import LParen, RParen # XXX This doesn't support nested for loops like [x for x in 1, 2 for x in 1, 2] class FixParen(fixer_base.BaseFix): BM_compatible = True PATTERN = """ atom< ('[' | '(') (listmaker< any comp_for< 'for' NAME 'in' target=testlist_safe< any (',' any)+ [','] > [any] > > | testlist_gexp< any comp_for< 'for' NAME 'in' target=testlist_safe< any (',' any)+ [','] > [any] > >) (']' | ')') > """ def transform(self, node, results): target = results["target"] lparen = LParen() lparen.prefix = target.prefix target.prefix = "" # Make it hug the parentheses target.insert_child(0, lparen) target.append_child(RParen())
.
Edit
..
Edit
__init__.py
Edit
__pycache__
Edit
fix_apply.py
Edit
fix_asserts.py
Edit
fix_basestring.py
Edit
fix_buffer.py
Edit
fix_dict.py
Edit
fix_except.py
Edit
fix_exec.py
Edit
fix_execfile.py
Edit
fix_exitfunc.py
Edit
fix_filter.py
Edit
fix_funcattrs.py
Edit
fix_future.py
Edit
fix_getcwdu.py
Edit
fix_has_key.py
Edit
fix_idioms.py
Edit
fix_import.py
Edit
fix_imports.py
Edit
fix_imports2.py
Edit
fix_input.py
Edit
fix_intern.py
Edit
fix_isinstance.py
Edit
fix_itertools.py
Edit
fix_itertools_imports.py
Edit
fix_long.py
Edit
fix_map.py
Edit
fix_metaclass.py
Edit
fix_methodattrs.py
Edit
fix_ne.py
Edit
fix_next.py
Edit
fix_nonzero.py
Edit
fix_numliterals.py
Edit
fix_operator.py
Edit
fix_paren.py
Edit
fix_print.py
Edit
fix_raise.py
Edit
fix_raw_input.py
Edit
fix_reduce.py
Edit
fix_reload.py
Edit
fix_renames.py
Edit
fix_repr.py
Edit
fix_set_literal.py
Edit
fix_standarderror.py
Edit
fix_sys_exc.py
Edit
fix_throw.py
Edit
fix_tuple_params.py
Edit
fix_types.py
Edit
fix_unicode.py
Edit
fix_urllib.py
Edit
fix_ws_comma.py
Edit
fix_xrange.py
Edit
fix_xreadlines.py
Edit
fix_zip.py
Edit