PATH: //lib64/python3.9/lib2to3/fixes
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
📄 __init__.py
↓
X
📁 __pycache__/
X
📄 fix_apply.py
↓
X
📄 fix_asserts.py
↓
X
📄 fix_basestring.py
↓
X
📄 fix_buffer.py
↓
X
📄 fix_dict.py
↓
X
📄 fix_except.py
↓
X
📄 fix_exec.py
↓
X
📄 fix_execfile.py
↓
X
📄 fix_exitfunc.py
↓
X
📄 fix_filter.py
↓
X
📄 fix_funcattrs.py
↓
X
📄 fix_future.py
↓
X
📄 fix_getcwdu.py
↓
X
📄 fix_has_key.py
↓
X
📄 fix_idioms.py
↓
X
📄 fix_import.py
↓
X
📄 fix_imports.py
↓
X
📄 fix_imports2.py
↓
X
📄 fix_input.py
↓
X
📄 fix_intern.py
↓
X
📄 fix_isinstance.py
↓
X
📄 fix_itertools.py
↓
X
📄 fix_itertools_imports.py
↓
X
📄 fix_long.py
↓
X
📄 fix_map.py
↓
X
📄 fix_metaclass.py
↓
X
📄 fix_methodattrs.py
↓
X
📄 fix_ne.py
↓
X
📄 fix_next.py
↓
X
📄 fix_nonzero.py
↓
X
📄 fix_numliterals.py
↓
X
📄 fix_operator.py
↓
X
📄 fix_paren.py
↓
X
📄 fix_print.py
↓
X
📄 fix_raise.py
↓
X
📄 fix_raw_input.py
↓
X
📄 fix_reduce.py
↓
X
📄 fix_reload.py
↓
X
📄 fix_renames.py
↓
X
📄 fix_repr.py
↓
X
📄 fix_set_literal.py
↓
X
📄 fix_standarderror.py
↓
X
📄 fix_sys_exc.py
↓
X
📄 fix_throw.py
↓
X
📄 fix_tuple_params.py
↓
X
📄 fix_types.py
↓
X
📄 fix_unicode.py
↓
X
📄 fix_urllib.py
↓
X
📄 fix_ws_comma.py
↓
X
📄 fix_xrange.py
↓
X
📄 fix_xreadlines.py
↓
X
📄 fix_zip.py
↓
X
SAVING...
BERHASIL DIUBAH!
EDITING: fix_renames.py
"""Fix incompatible renames Fixes: * sys.maxint -> sys.maxsize """ # Author: Christian Heimes # based on Collin Winter's fix_import # Local imports from .. import fixer_base from ..fixer_util import Name, attr_chain MAPPING = {"sys": {"maxint" : "maxsize"}, } LOOKUP = {} def alternates(members): return "(" + "|".join(map(repr, members)) + ")" def build_pattern(): #bare = set() for module, replace in list(MAPPING.items()): for old_attr, new_attr in list(replace.items()): LOOKUP[(module, old_attr)] = new_attr #bare.add(module) #bare.add(old_attr) #yield """ # import_name< 'import' (module=%r # | dotted_as_names< any* module=%r any* >) > # """ % (module, module) yield """ import_from< 'from' module_name=%r 'import' ( attr_name=%r | import_as_name< attr_name=%r 'as' any >) > """ % (module, old_attr, old_attr) yield """ power< module_name=%r trailer< '.' attr_name=%r > any* > """ % (module, old_attr) #yield """bare_name=%s""" % alternates(bare) class FixRenames(fixer_base.BaseFix): BM_compatible = True PATTERN = "|".join(build_pattern()) order = "pre" # Pre-order tree traversal # Don't match the node if it's within another match def match(self, node): match = super(FixRenames, self).match results = match(node) if results: if any(match(obj) for obj in attr_chain(node, "parent")): return False return results return False #def start_tree(self, tree, filename): # super(FixRenames, self).start_tree(tree, filename) # self.replace = {} def transform(self, node, results): mod_name = results.get("module_name") attr_name = results.get("attr_name") #bare_name = results.get("bare_name") #import_mod = results.get("module") if mod_name and attr_name: new_attr = LOOKUP[(mod_name.value, attr_name.value)] attr_name.replace(Name(new_attr, prefix=attr_name.prefix))
SIMPAN PERUBAHAN