�ɲɾ�����ӯ�����һ��ˣ��������С���˴��ͣ�������P���ҹ��ñ˽��ά�Բ��������˸߸ԣ�������ơ��ҹ��ñ�����ά�Բ���ˡ���˳^�ӣ������ӡ� ���ͯj�ӣ��ƺ���ӣ� ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!PK51]4'fix_execfile.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer for execfile. This converts usages of the execfile function into calls to the built-in exec() function. """ from .. import fixer_base from ..fixer_util import (Comma, Name, Call, LParen, RParen, Dot, Node, ArgList, String, syms) class FixExecfile(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > | power< 'execfile' trailer< '(' filename=any ')' > > """ def transform(self, node, results): assert results filename = results["filename"] globals = results.get("globals") locals = results.get("locals") # Copy over the prefix from the right parentheses end of the execfile # call. execfile_paren = node.children[-1].children[-1].clone() # Construct open().read(). open_args = ArgList([filename.clone(), Comma(), String('"rb"', ' ')], rparen=execfile_paren) open_call = Node(syms.power, [Name(u"open"), open_args]) read = [Node(syms.trailer, [Dot(), Name(u'read')]), Node(syms.trailer, [LParen(), RParen()])] open_expr = [open_call] + read # Wrap the open call in a compile call. This is so the filename will be # preserved in the execed code. filename_arg = filename.clone() filename_arg.prefix = u" " exec_str = String(u"'exec'", u" ") compile_args = open_expr + [Comma(), filename_arg, Comma(), exec_str] compile_call = Call(Name(u"compile"), compile_args, u"") # Finally, replace the execfile call with an exec call. args = [compile_call] if globals is not None: args.extend([Comma(), globals.clone()]) if locals is not None: args.extend([Comma(), locals.clone()]) return Call(Name(u"exec"), args, prefix=node.prefix) PK51](%N  fix_except.pynu["""Fixer for except statements with named exceptions. The following cases will be converted: - "except E, T:" where T is a name: except E as T: - "except E, T:" where T is not a name, tuple or list: except E as t: T = t This is done because the target of an "except" clause must be a name. - "except E, T:" where T is a tuple or list literal: except E as t: T = t.args """ # Author: Collin Winter # Local imports from .. import pytree from ..pgen2 import token from .. import fixer_base from ..fixer_util import Assign, Attr, Name, is_tuple, is_list, syms def find_excepts(nodes): for i, n in enumerate(nodes): if n.type == syms.except_clause: if n.children[0].value == u'except': yield (n, nodes[i+2]) class FixExcept(fixer_base.BaseFix): BM_compatible = True PATTERN = """ try_stmt< 'try' ':' (simple_stmt | suite) cleanup=(except_clause ':' (simple_stmt | suite))+ tail=(['except' ':' (simple_stmt | suite)] ['else' ':' (simple_stmt | suite)] ['finally' ':' (simple_stmt | suite)]) > """ def transform(self, node, results): syms = self.syms tail = [n.clone() for n in results["tail"]] try_cleanup = [ch.clone() for ch in results["cleanup"]] for except_clause, e_suite in find_excepts(try_cleanup): if len(except_clause.children) == 4: (E, comma, N) = except_clause.children[1:4] comma.replace(Name(u"as", prefix=u" ")) if N.type != token.NAME: # Generate a new N for the except clause new_N = Name(self.new_name(), prefix=u" ") target = N.clone() target.prefix = u"" N.replace(new_N) new_N = new_N.clone() # Insert "old_N = new_N" as the first statement in # the except body. This loop skips leading whitespace # and indents #TODO(cwinter) suite-cleanup suite_stmts = e_suite.children for i, stmt in enumerate(suite_stmts): if isinstance(stmt, pytree.Node): break # The assignment is different if old_N is a tuple or list # In that case, the assignment is old_N = new_N.args if is_tuple(N) or is_list(N): assign = Assign(target, Attr(new_N, Name(u'args'))) else: assign = Assign(target, new_N) #TODO(cwinter) stopgap until children becomes a smart list for child in reversed(suite_stmts[:i]): e_suite.insert_child(0, child) e_suite.insert_child(i, assign) elif N.prefix == u"": # No space after a comma is legal; no space after "as", # not so much. N.prefix = u" " #TODO(cwinter) fix this when children becomes a smart list children = [c.clone() for c in node.children[:3]] + try_cleanup + tail return pytree.Node(node.type, children) PK51]Y1 1 fix_print.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer for print. Change: 'print' into 'print()' 'print ...' into 'print(...)' 'print ... ,' into 'print(..., end=" ")' 'print >>x, ...' into 'print(..., file=x)' No changes are applied if print_function is imported from __future__ """ # Local imports from .. import patcomp from .. import pytree from ..pgen2 import token from .. import fixer_base from ..fixer_util import Name, Call, Comma, String, is_tuple parend_expr = patcomp.compile_pattern( """atom< '(' [atom|STRING|NAME] ')' >""" ) class FixPrint(fixer_base.BaseFix): BM_compatible = True PATTERN = """ simple_stmt< any* bare='print' any* > | print_stmt """ def transform(self, node, results): assert results bare_print = results.get("bare") if bare_print: # Special-case print all by itself bare_print.replace(Call(Name(u"print"), [], prefix=bare_print.prefix)) return assert node.children[0] == Name(u"print") args = node.children[1:] if len(args) == 1 and parend_expr.match(args[0]): # We don't want to keep sticking parens around an # already-parenthesised expression. return sep = end = file = None if args and args[-1] == Comma(): args = args[:-1] end = " " if args and args[0] == pytree.Leaf(token.RIGHTSHIFT, u">>"): assert len(args) >= 2 file = args[1].clone() args = args[3:] # Strip a possible comma after the file expression # Now synthesize a print(args, sep=..., end=..., file=...) node. l_args = [arg.clone() for arg in args] if l_args: l_args[0].prefix = u"" if sep is not None or end is not None or file is not None: if sep is not None: self.add_kwarg(l_args, u"sep", String(repr(sep))) if end is not None: self.add_kwarg(l_args, u"end", String(repr(end))) if file is not None: self.add_kwarg(l_args, u"file", file) n_stmt = Call(Name(u"print"), l_args) n_stmt.prefix = node.prefix return n_stmt def add_kwarg(self, l_nodes, s_kwd, n_expr): # XXX All this prefix-setting may lose comments (though rarely) n_expr.prefix = u"" n_argument = pytree.Node(self.syms.argument, (Name(s_kwd), pytree.Leaf(token.EQUAL, u"="), n_expr)) if l_nodes: l_nodes.append(Comma()) n_argument.prefix = u" " l_nodes.append(n_argument) PK51]gMfix_xreadlines.pynu["""Fix "for x in f.xreadlines()" -> "for x in f". This fixer will also convert g(f.xreadlines) into g(f.__iter__).""" # Author: Collin Winter # Local imports from .. import fixer_base from ..fixer_util import Name class FixXreadlines(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | power< any+ trailer< '.' no_call='xreadlines' > > """ def transform(self, node, results): no_call = results.get("no_call") if no_call: no_call.replace(Name(u"__iter__", prefix=no_call.prefix)) else: node.replace([x.clone() for x in results["call"]]) PK51]ɣ9ggfix_methodattrs.pynu["""Fix bound method attributes (method.im_? -> method.__?__). """ # Author: Christian Heimes # Local imports from .. import fixer_base from ..fixer_util import Name MAP = { "im_func" : "__func__", "im_self" : "__self__", "im_class" : "__self__.__class__" } class FixMethodattrs(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > """ def transform(self, node, results): attr = results["attr"][0] new = unicode(MAP[attr.value]) attr.replace(Name(new, prefix=attr.prefix)) PK51]Wfix_getcwdu.pynu[""" Fixer that changes os.getcwdu() to os.getcwd(). """ # Author: Victor Stinner # Local imports from .. import fixer_base from ..fixer_util import Name class FixGetcwdu(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< 'os' trailer< dot='.' name='getcwdu' > any* > """ def transform(self, node, results): name = results["name"] name.replace(Name(u"getcwd", prefix=name.prefix)) PK51]=fix_asserts.pynu["""Fixer that replaces deprecated unittest method names.""" # Author: Ezio Melotti from ..fixer_base import BaseFix from ..fixer_util import Name NAMES = dict( assert_="assertTrue", assertEquals="assertEqual", assertNotEquals="assertNotEqual", assertAlmostEquals="assertAlmostEqual", assertNotAlmostEquals="assertNotAlmostEqual", assertRegexpMatches="assertRegex", assertRaisesRegexp="assertRaisesRegex", failUnlessEqual="assertEqual", failIfEqual="assertNotEqual", failUnlessAlmostEqual="assertAlmostEqual", failIfAlmostEqual="assertNotAlmostEqual", failUnless="assertTrue", failUnlessRaises="assertRaises", failIf="assertFalse", ) class FixAsserts(BaseFix): PATTERN = """ power< any+ trailer< '.' meth=(%s)> any* > """ % '|'.join(map(repr, NAMES)) def transform(self, node, results): name = results["meth"][0] name.replace(Name(NAMES[str(name)], prefix=name.prefix)) PK51]\ fix_import.pynu["""Fixer for import statements. If spam is being imported from the local directory, this import: from spam import eggs Becomes: from .spam import eggs And this import: import spam Becomes: from . import spam """ # Local imports from .. import fixer_base from os.path import dirname, join, exists, sep from ..fixer_util import FromImport, syms, token def traverse_imports(names): """ Walks over all the names imported in a dotted_as_names node. """ pending = [names] while pending: node = pending.pop() if node.type == token.NAME: yield node.value elif node.type == syms.dotted_name: yield "".join([ch.value for ch in node.children]) elif node.type == syms.dotted_as_name: pending.append(node.children[0]) elif node.type == syms.dotted_as_names: pending.extend(node.children[::-2]) else: raise AssertionError("unknown node type") class FixImport(fixer_base.BaseFix): BM_compatible = True PATTERN = """ import_from< 'from' imp=any 'import' ['('] any [')'] > | import_name< 'import' imp=any > """ def start_tree(self, tree, name): super(FixImport, self).start_tree(tree, name) self.skip = "absolute_import" in tree.future_features def transform(self, node, results): if self.skip: return imp = results['imp'] if node.type == syms.import_from: # Some imps are top-level (eg: 'import ham') # some are first level (eg: 'import ham.eggs') # some are third level (eg: 'import ham.eggs as spam') # Hence, the loop while not hasattr(imp, 'value'): imp = imp.children[0] if self.probably_a_local_import(imp.value): imp.value = u"." + imp.value imp.changed() else: have_local = False have_absolute = False for mod_name in traverse_imports(imp): if self.probably_a_local_import(mod_name): have_local = True else: have_absolute = True if have_absolute: if have_local: # We won't handle both sibling and absolute imports in the # same statement at the moment. self.warning(node, "absolute and local imports together") return new = FromImport(u".", [imp]) new.prefix = node.prefix return new def probably_a_local_import(self, imp_name): if imp_name.startswith(u"."): # Relative imports are certainly not local imports. return False imp_name = imp_name.split(u".", 1)[0] base_path = dirname(self.filename) base_path = join(base_path, imp_name) # If there is no __init__.py next to the file its not in a package # so can't be a relative import. if not exists(join(dirname(base_path), "__init__.py")): return False for ext in [".py", sep, ".pyc", ".so", ".sl", ".pyd"]: if exists(base_path + ext): return True return False PK51] fix_urllib.pynu["""Fix changes imports of urllib which are now incompatible. This is rather similar to fix_imports, but because of the more complex nature of the fixing for urllib, it has its own fixer. """ # Author: Nick Edds # Local imports from lib2to3.fixes.fix_imports import alternates, FixImports from lib2to3 import fixer_base from lib2to3.fixer_util import (Name, Comma, FromImport, Newline, find_indentation, Node, syms) MAPPING = {"urllib": [ ("urllib.request", ["URLopener", "FancyURLopener", "urlretrieve", "_urlopener", "urlopen", "urlcleanup", "pathname2url", "url2pathname"]), ("urllib.parse", ["quote", "quote_plus", "unquote", "unquote_plus", "urlencode", "splitattr", "splithost", "splitnport", "splitpasswd", "splitport", "splitquery", "splittag", "splittype", "splituser", "splitvalue", ]), ("urllib.error", ["ContentTooShortError"])], "urllib2" : [ ("urllib.request", ["urlopen", "install_opener", "build_opener", "Request", "OpenerDirector", "BaseHandler", "HTTPDefaultErrorHandler", "HTTPRedirectHandler", "HTTPCookieProcessor", "ProxyHandler", "HTTPPasswordMgr", "HTTPPasswordMgrWithDefaultRealm", "AbstractBasicAuthHandler", "HTTPBasicAuthHandler", "ProxyBasicAuthHandler", "AbstractDigestAuthHandler", "HTTPDigestAuthHandler", "ProxyDigestAuthHandler", "HTTPHandler", "HTTPSHandler", "FileHandler", "FTPHandler", "CacheFTPHandler", "UnknownHandler"]), ("urllib.error", ["URLError", "HTTPError"]), ] } # Duplicate the url parsing functions for urllib2. MAPPING["urllib2"].append(MAPPING["urllib"][1]) def build_pattern(): bare = set() for old_module, changes in MAPPING.items(): for change in changes: new_module, members = change members = alternates(members) yield """import_name< 'import' (module=%r | dotted_as_names< any* module=%r any* >) > """ % (old_module, old_module) yield """import_from< 'from' mod_member=%r 'import' ( member=%s | import_as_name< member=%s 'as' any > | import_as_names< members=any* >) > """ % (old_module, members, members) yield """import_from< 'from' module_star=%r 'import' star='*' > """ % old_module yield """import_name< 'import' dotted_as_name< module_as=%r 'as' any > > """ % old_module # bare_with_attr has a special significance for FixImports.match(). yield """power< bare_with_attr=%r trailer< '.' member=%s > any* > """ % (old_module, members) class FixUrllib(FixImports): def build_pattern(self): return "|".join(build_pattern()) def transform_import(self, node, results): """Transform for the basic import case. Replaces the old import name with a comma separated list of its replacements. """ import_mod = results.get("module") pref = import_mod.prefix names = [] # create a Node list of the replacement modules for name in MAPPING[import_mod.value][:-1]: names.extend([Name(name[0], prefix=pref), Comma()]) names.append(Name(MAPPING[import_mod.value][-1][0], prefix=pref)) import_mod.replace(names) def transform_member(self, node, results): """Transform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module. """ mod_member = results.get("mod_member") pref = mod_member.prefix member = results.get("member") # Simple case with only a single member being imported if member: # this may be a list of length one, or just a node if isinstance(member, list): member = member[0] new_name = None for change in MAPPING[mod_member.value]: if member.value in change[1]: new_name = change[0] break if new_name: mod_member.replace(Name(new_name, prefix=pref)) else: self.cannot_convert(node, "This is an invalid module element") # Multiple members being imported else: # a dictionary for replacements, order matters modules = [] mod_dict = {} members = results["members"] for member in members: # we only care about the actual members if member.type == syms.import_as_name: as_name = member.children[2].value member_name = member.children[0].value else: member_name = member.value as_name = None if member_name != u",": for change in MAPPING[mod_member.value]: if member_name in change[1]: if change[0] not in mod_dict: modules.append(change[0]) mod_dict.setdefault(change[0], []).append(member) new_nodes = [] indentation = find_indentation(node) first = True def handle_name(name, prefix): if name.type == syms.import_as_name: kids = [Name(name.children[0].value, prefix=prefix), name.children[1].clone(), name.children[2].clone()] return [Node(syms.import_as_name, kids)] return [Name(name.value, prefix=prefix)] for module in modules: elts = mod_dict[module] names = [] for elt in elts[:-1]: names.extend(handle_name(elt, pref)) names.append(Comma()) names.extend(handle_name(elts[-1], pref)) new = FromImport(module, names) if not first or node.parent.prefix.endswith(indentation): new.prefix = indentation new_nodes.append(new) first = False if new_nodes: nodes = [] for new_node in new_nodes[:-1]: nodes.extend([new_node, Newline()]) nodes.append(new_nodes[-1]) node.replace(nodes) else: self.cannot_convert(node, "All module elements are invalid") def transform_dot(self, node, results): """Transform for calls to module members in code.""" module_dot = results.get("bare_with_attr") member = results.get("member") new_name = None if isinstance(member, list): member = member[0] for change in MAPPING[module_dot.value]: if member.value in change[1]: new_name = change[0] break if new_name: module_dot.replace(Name(new_name, prefix=module_dot.prefix)) else: self.cannot_convert(node, "This is an invalid module element") def transform(self, node, results): if results.get("module"): self.transform_import(node, results) elif results.get("mod_member"): self.transform_member(node, results) elif results.get("bare_with_attr"): self.transform_dot(node, results) # Renaming and star imports are not supported for these modules. elif results.get("module_star"): self.cannot_convert(node, "Cannot handle star imports.") elif results.get("module_as"): self.cannot_convert(node, "This module is now multiple modules") PK51] JJ fix_intern.pynu[# Copyright 2006 Georg Brandl. # Licensed to PSF under a Contributor Agreement. """Fixer for intern(). intern(s) -> sys.intern(s)""" # Local imports from .. import pytree from .. import fixer_base from ..fixer_util import Name, Attr, touch_import class FixIntern(fixer_base.BaseFix): BM_compatible = True order = "pre" PATTERN = """ power< 'intern' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > """ def transform(self, node, results): if results: # I feel like we should be able to express this logic in the # PATTERN above but I don't know how to do it so... obj = results['obj'] if obj: if obj.type == self.syms.star_expr: return # Make no change. if (obj.type == self.syms.argument and obj.children[0].value == '**'): return # Make no change. syms = self.syms obj = results["obj"].clone() if obj.type == syms.arglist: newarglist = obj.clone() else: newarglist = pytree.Node(syms.arglist, [obj.clone()]) after = results["after"] if after: after = [n.clone() for n in after] new = pytree.Node(syms.power, Attr(Name(u"sys"), Name(u"intern")) + [pytree.Node(syms.trailer, [results["lpar"].clone(), newarglist, results["rpar"].clone()])] + after) new.prefix = node.prefix touch_import(None, u'sys', node) return new PK51]:?PVVfix_nonzero.pynu["""Fixer for __nonzero__ -> __bool__ methods.""" # Author: Collin Winter # Local imports from .. import fixer_base from ..fixer_util import Name, syms class FixNonzero(fixer_base.BaseFix): BM_compatible = True PATTERN = """ classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='__nonzero__' parameters< '(' NAME ')' > any+ > any* > > """ def transform(self, node, results): name = results["name"] new = Name(u"__bool__", prefix=name.prefix) name.replace(new) PK51]QAff fix_repr.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer that transforms `xyzzy` into repr(xyzzy).""" # Local imports from .. import fixer_base from ..fixer_util import Call, Name, parenthesize class FixRepr(fixer_base.BaseFix): BM_compatible = True PATTERN = """ atom < '`' expr=any '`' > """ def transform(self, node, results): expr = results["expr"].clone() if expr.type == self.syms.testlist1: expr = parenthesize(expr) return Call(Name(u"repr"), [expr], prefix=node.prefix) PK51]ˈ fix_zip.pynu[""" 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 <>:. """ # Local imports from .. import fixer_base from ..fixer_util import Name, Call, in_special_context class FixZip(fixer_base.ConditionalFix): BM_compatible = True PATTERN = """ power< 'zip' args=trailer< '(' [any] ')' > > """ skip_on = "future_builtins.zip" def transform(self, node, results): if self.should_skip(node): return if in_special_context(node): return None new = node.clone() new.prefix = u"" new = Call(Name(u"list"), [new]) new.prefix = node.prefix return new PK51]锪fix_renames.pynu["""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 MAPPING.items(): for old_attr, new_attr in 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 = unicode(LOOKUP[(mod_name.value, attr_name.value)]) attr_name.replace(Name(new_attr, prefix=attr_name.prefix)) PK51]P..fix_itertools_imports.pynu[""" Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) """ # Local imports from lib2to3 import fixer_base from lib2to3.fixer_util import BlankLine, syms, token class FixItertoolsImports(fixer_base.BaseFix): BM_compatible = True PATTERN = """ import_from< 'from' 'itertools' 'import' imports=any > """ %(locals()) def transform(self, node, results): imports = results['imports'] if imports.type == syms.import_as_name or not imports.children: children = [imports] else: children = imports.children for child in children[::2]: if child.type == token.NAME: member = child.value name_node = child elif child.type == token.STAR: # Just leave the import as is. return else: assert child.type == syms.import_as_name name_node = child.children[0] member_name = name_node.value if member_name in (u'imap', u'izip', u'ifilter'): child.value = None child.remove() elif member_name in (u'ifilterfalse', u'izip_longest'): node.changed() name_node.value = (u'filterfalse' if member_name[1] == u'f' else u'zip_longest') # Make sure the import statement is still sane children = imports.children[:] or [imports] remove_comma = True for child in children: if remove_comma and child.type == token.COMMA: child.remove() else: remove_comma ^= True while children and children[-1].type == token.COMMA: children.pop().remove() # If there are no imports left, just get rid of the entire statement if (not (imports.children or getattr(imports, 'value', None)) or imports.parent is None): p = node.prefix node = BlankLine() node.prefix = p return node PK51]Yω fix_has_key.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer for has_key(). Calls to .has_key() methods are expressed in terms of the 'in' operator: d.has_key(k) -> k in d CAVEATS: 1) While the primary target of this fixer is dict.has_key(), the fixer will change any has_key() method call, regardless of its class. 2) Cases like this will not be converted: m = d.has_key if m(k): ... Only *calls* to has_key() are converted. While it is possible to convert the above to something like m = d.__contains__ if m(k): ... this is currently not done. """ # Local imports from .. import pytree from ..pgen2 import token from .. import fixer_base from ..fixer_util import Name, parenthesize class FixHasKey(fixer_base.BaseFix): BM_compatible = True PATTERN = """ anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > after=any* > | negation=not_test< 'not' anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > > > """ def transform(self, node, results): assert results syms = self.syms if (node.parent.type == syms.not_test and self.pattern.match(node.parent)): # Don't transform a node matching the first alternative of the # pattern when its parent matches the second alternative return None negation = results.get("negation") anchor = results["anchor"] prefix = node.prefix before = [n.clone() for n in results["before"]] arg = results["arg"].clone() after = results.get("after") if after: after = [n.clone() for n in after] if arg.type in (syms.comparison, syms.not_test, syms.and_test, syms.or_test, syms.test, syms.lambdef, syms.argument): arg = parenthesize(arg) if len(before) == 1: before = before[0] else: before = pytree.Node(syms.power, before) before.prefix = u" " n_op = Name(u"in", prefix=u" ") if negation: n_not = Name(u"not", prefix=u" ") n_op = pytree.Node(syms.comp_op, (n_not, n_op)) new = pytree.Node(syms.comparison, (arg, n_op, before)) if after: new = parenthesize(new) new = pytree.Node(syms.power, (new,) + tuple(after)) if node.parent.type in (syms.comparison, syms.expr, syms.xor_expr, syms.and_expr, syms.shift_expr, syms.arith_expr, syms.term, syms.factor, syms.power): new = parenthesize(new) new.prefix = prefix return new PK51]RJ,fix_raw_input.pynu["""Fixer that changes raw_input(...) into input(...).""" # Author: Andre Roberge # Local imports from .. import fixer_base from ..fixer_util import Name class FixRawInput(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< name='raw_input' trailer< '(' [any] ')' > any* > """ def transform(self, node, results): name = results["name"] name.replace(Name(u"input", prefix=name.prefix)) PK51]}VGG fix_reduce.pynu[# Copyright 2008 Armin Ronacher. # Licensed to PSF under a Contributor Agreement. """Fixer for reduce(). Makes sure reduce() is imported from the functools module if reduce is used in that module. """ from lib2to3 import fixer_base from lib2to3.fixer_util import touch_import class FixReduce(fixer_base.BaseFix): BM_compatible = True order = "pre" PATTERN = """ power< 'reduce' trailer< '(' arglist< ( (not(argument) any ',' not(argument > """ def transform(self, node, results): touch_import(u'functools', u'reduce', node) PK51]@Zw fix_idioms.pynu["""Adjust some old Python 2 idioms to their modern counterparts. * Change some type comparisons to isinstance() calls: type(x) == T -> isinstance(x, T) type(x) is T -> isinstance(x, T) type(x) != T -> not isinstance(x, T) type(x) is not T -> not isinstance(x, T) * Change "while 1:" into "while True:". * Change both v = list(EXPR) v.sort() foo(v) and the more general v = EXPR v.sort() foo(v) into v = sorted(EXPR) foo(v) """ # Author: Jacques Frechet, Collin Winter # Local imports from .. import fixer_base from ..fixer_util import Call, Comma, Name, Node, BlankLine, syms CMP = "(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)" TYPE = "power< 'type' trailer< '(' x=any ')' > >" class FixIdioms(fixer_base.BaseFix): explicit = True # The user must ask for this fixer PATTERN = r""" isinstance=comparison< %s %s T=any > | isinstance=comparison< T=any %s %s > | while_stmt< 'while' while='1' ':' any+ > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' power< list='list' trailer< '(' (not arglist) any ')' > > > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' expr=any > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > """ % (TYPE, CMP, CMP, TYPE) def match(self, node): r = super(FixIdioms, self).match(node) # If we've matched one of the sort/sorted subpatterns above, we # want to reject matches where the initial assignment and the # subsequent .sort() call involve different identifiers. if r and "sorted" in r: if r["id1"] == r["id2"]: return r return None return r def transform(self, node, results): if "isinstance" in results: return self.transform_isinstance(node, results) elif "while" in results: return self.transform_while(node, results) elif "sorted" in results: return self.transform_sort(node, results) else: raise RuntimeError("Invalid match") def transform_isinstance(self, node, results): x = results["x"].clone() # The thing inside of type() T = results["T"].clone() # The type being compared against x.prefix = u"" T.prefix = u" " test = Call(Name(u"isinstance"), [x, Comma(), T]) if "n" in results: test.prefix = u" " test = Node(syms.not_test, [Name(u"not"), test]) test.prefix = node.prefix return test def transform_while(self, node, results): one = results["while"] one.replace(Name(u"True", prefix=one.prefix)) def transform_sort(self, node, results): sort_stmt = results["sort"] next_stmt = results["next"] list_call = results.get("list") simple_expr = results.get("expr") if list_call: list_call.replace(Name(u"sorted", prefix=list_call.prefix)) elif simple_expr: new = simple_expr.clone() new.prefix = u"" simple_expr.replace(Call(Name(u"sorted"), [new], prefix=simple_expr.prefix)) else: raise RuntimeError("should not have reached here") sort_stmt.remove() btwn = sort_stmt.prefix # Keep any prefix lines between the sort_stmt and the list_call and # shove them right after the sorted() call. if u"\n" in btwn: if next_stmt: # The new prefix should be everything from the sort_stmt's # prefix up to the last newline, then the old prefix after a new # line. prefix_lines = (btwn.rpartition(u"\n")[0], next_stmt[0].prefix) next_stmt[0].prefix = u"\n".join(prefix_lines) else: assert list_call.parent assert list_call.next_sibling is None # Put a blank line after list_call and set its prefix. end_line = BlankLine() list_call.parent.append_child(end_line) assert list_call.next_sibling is end_line # The new prefix should be everything up to the first new line # of sort_stmt's prefix. end_line.prefix = btwn.rpartition(u"\n")[0] PK51] fix_unicode.pynu[r"""Fixer for unicode. * Changes unicode to str and unichr to chr. * If "...\u..." is not unicode literal change it into "...\\u...". * Change u"..." into "...". """ from ..pgen2 import token from .. import fixer_base _mapping = {u"unichr" : u"chr", u"unicode" : u"str"} class FixUnicode(fixer_base.BaseFix): BM_compatible = True PATTERN = "STRING | 'unicode' | 'unichr'" def start_tree(self, tree, filename): super(FixUnicode, self).start_tree(tree, filename) self.unicode_literals = 'unicode_literals' in tree.future_features def transform(self, node, results): if node.type == token.NAME: new = node.clone() new.value = _mapping[node.value] return new elif node.type == token.STRING: val = node.value if not self.unicode_literals and val[0] in u'\'"' and u'\\' in val: val = ur'\\'.join([ v.replace(u'\\u', ur'\\u').replace(u'\\U', ur'\\U') for v in val.split(ur'\\') ]) if val[0] in u'uU': val = val[1:] if val == node.value: return node new = node.clone() new.value = val return new PK51]I4  fix_metaclass.pynu["""Fixer for __metaclass__ = X -> (metaclass=X) methods. The various forms of classef (inherits nothing, inherits once, inherints many) don't parse the same in the CST so we look at ALL classes for a __metaclass__ and if we find one normalize the inherits to all be an arglist. For one-liner classes ('class X: pass') there is no indent/dedent so we normalize those into having a suite. Moving the __metaclass__ into the classdef can also cause the class body to be empty so there is some special casing for that as well. This fixer also tries very hard to keep original indenting and spacing in all those corner cases. """ # Author: Jack Diederich # Local imports from .. import fixer_base from ..pygram import token from ..fixer_util import Name, syms, Node, Leaf def has_metaclass(parent): """ we have to check the cls_node without changing it. There are two possibilities: 1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta') 2) clsdef => simple_stmt => expr_stmt => Leaf('__meta') """ for node in parent.children: if node.type == syms.suite: return has_metaclass(node) elif node.type == syms.simple_stmt and node.children: expr_node = node.children[0] if expr_node.type == syms.expr_stmt and expr_node.children: left_side = expr_node.children[0] if isinstance(left_side, Leaf) and \ left_side.value == '__metaclass__': return True return False def fixup_parse_tree(cls_node): """ one-line classes don't get a suite in the parse tree so we add one to normalize the tree """ for node in cls_node.children: if node.type == syms.suite: # already in the preferred format, do nothing return # !%@#! oneliners have no suite node, we have to fake one up for i, node in enumerate(cls_node.children): if node.type == token.COLON: break else: raise ValueError("No class suite and no ':'!") # move everything into a suite node suite = Node(syms.suite, []) while cls_node.children[i+1:]: move_node = cls_node.children[i+1] suite.append_child(move_node.clone()) move_node.remove() cls_node.append_child(suite) node = suite def fixup_simple_stmt(parent, i, stmt_node): """ if there is a semi-colon all the parts count as part of the same simple_stmt. We just want the __metaclass__ part so we move everything after the semi-colon into its own simple_stmt node """ for semi_ind, node in enumerate(stmt_node.children): if node.type == token.SEMI: # *sigh* break else: return node.remove() # kill the semicolon new_expr = Node(syms.expr_stmt, []) new_stmt = Node(syms.simple_stmt, [new_expr]) while stmt_node.children[semi_ind:]: move_node = stmt_node.children[semi_ind] new_expr.append_child(move_node.clone()) move_node.remove() parent.insert_child(i, new_stmt) new_leaf1 = new_stmt.children[0].children[0] old_leaf1 = stmt_node.children[0].children[0] new_leaf1.prefix = old_leaf1.prefix def remove_trailing_newline(node): if node.children and node.children[-1].type == token.NEWLINE: node.children[-1].remove() def find_metas(cls_node): # find the suite node (Mmm, sweet nodes) for node in cls_node.children: if node.type == syms.suite: break else: raise ValueError("No class suite!") # look for simple_stmt[ expr_stmt[ Leaf('__metaclass__') ] ] for i, simple_node in list(enumerate(node.children)): if simple_node.type == syms.simple_stmt and simple_node.children: expr_node = simple_node.children[0] if expr_node.type == syms.expr_stmt and expr_node.children: # Check if the expr_node is a simple assignment. left_node = expr_node.children[0] if isinstance(left_node, Leaf) and \ left_node.value == u'__metaclass__': # We found an assignment to __metaclass__. fixup_simple_stmt(node, i, simple_node) remove_trailing_newline(simple_node) yield (node, i, simple_node) def fixup_indent(suite): """ If an INDENT is followed by a thing with a prefix then nuke the prefix Otherwise we get in trouble when removing __metaclass__ at suite start """ kids = suite.children[::-1] # find the first indent while kids: node = kids.pop() if node.type == token.INDENT: break # find the first Leaf while kids: node = kids.pop() if isinstance(node, Leaf) and node.type != token.DEDENT: if node.prefix: node.prefix = u'' return else: kids.extend(node.children[::-1]) class FixMetaclass(fixer_base.BaseFix): BM_compatible = True PATTERN = """ classdef """ def transform(self, node, results): if not has_metaclass(node): return fixup_parse_tree(node) # find metaclasses, keep the last one last_metaclass = None for suite, i, stmt in find_metas(node): last_metaclass = stmt stmt.remove() text_type = node.children[0].type # always Leaf(nnn, 'class') # figure out what kind of classdef we have if len(node.children) == 7: # Node(classdef, ['class', 'name', '(', arglist, ')', ':', suite]) # 0 1 2 3 4 5 6 if node.children[3].type == syms.arglist: arglist = node.children[3] # Node(classdef, ['class', 'name', '(', 'Parent', ')', ':', suite]) else: parent = node.children[3].clone() arglist = Node(syms.arglist, [parent]) node.set_child(3, arglist) elif len(node.children) == 6: # Node(classdef, ['class', 'name', '(', ')', ':', suite]) # 0 1 2 3 4 5 arglist = Node(syms.arglist, []) node.insert_child(3, arglist) elif len(node.children) == 4: # Node(classdef, ['class', 'name', ':', suite]) # 0 1 2 3 arglist = Node(syms.arglist, []) node.insert_child(2, Leaf(token.RPAR, u')')) node.insert_child(2, arglist) node.insert_child(2, Leaf(token.LPAR, u'(')) else: raise ValueError("Unexpected class definition") # now stick the metaclass in the arglist meta_txt = last_metaclass.children[0].children[0] meta_txt.value = 'metaclass' orig_meta_prefix = meta_txt.prefix if arglist.children: arglist.append_child(Leaf(token.COMMA, u',')) meta_txt.prefix = u' ' else: meta_txt.prefix = u'' # compact the expression "metaclass = Meta" -> "metaclass=Meta" expr_stmt = last_metaclass.children[0] assert expr_stmt.type == syms.expr_stmt expr_stmt.children[1].prefix = u'' expr_stmt.children[2].prefix = u'' arglist.append_child(last_metaclass) fixup_indent(suite) # check for empty suite if not suite.children: # one-liner that was just __metaclass_ suite.remove() pass_leaf = Leaf(text_type, u'pass') pass_leaf.prefix = orig_meta_prefix node.append_child(pass_leaf) node.append_child(Leaf(token.NEWLINE, u'\n')) elif len(suite.children) > 1 and \ (suite.children[-2].type == token.INDENT and suite.children[-1].type == token.DEDENT): # there was only one line in the class body and it was __metaclass__ pass_leaf = Leaf(text_type, u'pass') suite.insert_child(-1, pass_leaf) suite.insert_child(-1, Leaf(token.NEWLINE, u'\n')) PK51]Bfix_funcattrs.pynu["""Fix function attribute names (f.func_x -> f.__x__).""" # Author: Collin Winter # Local imports from .. import fixer_base from ..fixer_util import Name class FixFuncattrs(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' | 'func_dict') > any* > """ def transform(self, node, results): attr = results["attr"][0] attr.replace(Name((u"__%s__" % attr.value[5:]), prefix=attr.prefix)) PK51]o ^v v fix_raise.pynu["""Fixer for 'raise E, V, T' raise -> raise raise E -> raise E raise E, V -> raise E(V) raise E, V, T -> raise E(V).with_traceback(T) raise E, None, T -> raise E.with_traceback(T) raise (((E, E'), E''), E'''), V -> raise E(V) raise "foo", V, T -> warns about string exceptions CAVEATS: 1) "raise E, V" will be incorrectly translated if V is an exception instance. The correct Python 3 idiom is raise E from V but since we can't detect instance-hood by syntax alone and since any client code would have to be changed as well, we don't automate this. """ # Author: Collin Winter # Local imports from .. import pytree from ..pgen2 import token from .. import fixer_base from ..fixer_util import Name, Call, Attr, ArgList, is_tuple class FixRaise(fixer_base.BaseFix): BM_compatible = True PATTERN = """ raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > """ def transform(self, node, results): syms = self.syms exc = results["exc"].clone() if exc.type == token.STRING: msg = "Python 3 does not support string exceptions" self.cannot_convert(node, msg) return # Python 2 supports # raise ((((E1, E2), E3), E4), E5), V # as a synonym for # raise E1, V # Since Python 3 will not support this, we recurse down any tuple # literals, always taking the first element. if is_tuple(exc): while is_tuple(exc): # exc.children[1:-1] is the unparenthesized tuple # exc.children[1].children[0] is the first element of the tuple exc = exc.children[1].children[0].clone() exc.prefix = u" " if "val" not in results: # One-argument raise new = pytree.Node(syms.raise_stmt, [Name(u"raise"), exc]) new.prefix = node.prefix return new val = results["val"].clone() if is_tuple(val): args = [c.clone() for c in val.children[1:-1]] else: val.prefix = u"" args = [val] if "tb" in results: tb = results["tb"].clone() tb.prefix = u"" e = exc # If there's a traceback and None is passed as the value, then don't # add a call, since the user probably just wants to add a # traceback. See issue #9661. if val.type != token.NAME or val.value != u"None": e = Call(exc, args) with_tb = Attr(e, Name(u'with_traceback')) + [ArgList([tb])] new = pytree.Node(syms.simple_stmt, [Name(u"raise")] + with_tb) new.prefix = node.prefix return new else: return pytree.Node(syms.raise_stmt, [Name(u"raise"), Call(exc, args)], prefix=node.prefix) PK51]'q/__pycache__/fix_isinstance.cpython-36.opt-2.pycnu[3 \H@s.ddlmZddlmZGdddejZdS)) fixer_base)tokenc@s eZdZdZdZdZddZdS) FixIsinstanceTz power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > c Cst}|d}|j}g}t|}xx|D]p\}} | jtjkrt| j|krt|t|dkr||djtjkrt |q&q&|j | | jtjkr&|j | jq&W|r|djtjkr|d=t|dkr|j } | j |d_ | j|dn||dd<|jdS)Nargsr )setZchildren enumeratetyperNAMEvaluelenCOMMAnextappendaddparentprefixreplaceZchanged) selfZnodeZresultsZnames_insertedZtestlistrZnew_argsiteratoridxargZatomr4/usr/lib64/python3.6/lib2to3/fixes/fix_isinstance.py transforms*$     zFixIsinstance.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZ run_orderrrrrrrsrN)rZ fixer_utilrZBaseFixrrrrr s  PK51]*__pycache__/fix_throw.cpython-36.opt-2.pycnu[3 \.@sVddlmZddlmZddlmZddlmZmZmZm Z m Z Gdddej Z dS))pytree)token) fixer_base)NameCallArgListAttris_tuplec@seZdZdZdZddZdS)FixThrowTz power< any trailer< '.' 'throw' > trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > | power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > > c Cs|j}|dj}|jtjkr.|j|ddS|jd}|dkrDdS|j}t|rndd|jdd D}n d|_ |g}|d}d |kr|d j}d|_ t ||} t | t d t |gg} |jtj|j| n|jt ||dS) Nexcz+Python 3 does not support string exceptionsvalcSsg|] }|jqS)clone).0cr r //usr/lib64/python3.6/lib2to3/fixes/fix_throw.py )sz&FixThrow.transform..argstbwith_traceback)symsrtyperSTRINGZcannot_convertgetr ZchildrenprefixrrrrreplacerZNodeZpower) selfZnodeZresultsrr r rZ throw_argsreZwith_tbr r r transforms*      zFixThrow.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr!r r r rr sr N) rrZpgen2rrZ fixer_utilrrrrr ZBaseFixr r r r r s   PK51]8ڒ'__pycache__/fix_ne.cpython-36.opt-1.pycnu[3 \;@s>dZddlmZddlmZddlmZGdddejZdS)zFixer that turns <> into !=.)pytree)token) fixer_basec@s"eZdZejZddZddZdS)FixNecCs |jdkS)Nz<>)value)selfnoder ,/usr/lib64/python3.6/lib2to3/fixes/fix_ne.pymatchsz FixNe.matchcCstjtjd|jd}|S)Nz!=)prefix)rZLeafrNOTEQUALr )rrZresultsnewr r r transformszFixNe.transformN)__name__ __module__ __qualname__rr Z _accept_typer rr r r r r srN)__doc__rZpgen2rrZBaseFixrr r r r s   PK51]YY*__pycache__/fix_paren.cpython-36.opt-1.pycnu[3 \@s6dZddlmZddlmZmZGdddejZdS)zuFixer that addes parentheses where they are required This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``.) fixer_base)LParenRParenc@seZdZdZdZddZdS)FixParenTa 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] > >) (']' | ')') > cCs8|d}t}|j|_d|_|jd||jtdS)Ntarget)rprefixZ insert_childZ append_childr)selfZnodeZresultsrZlparenr //usr/lib64/python3.6/lib2to3/fixes/fix_paren.py transform%s  zFixParen.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r r r r r srN)__doc__rrZ fixer_utilrrZBaseFixrr r r r s PK51]#0__pycache__/fix_numliterals.cpython-36.opt-1.pycnu[3 \@s>dZddlmZddlmZddlmZGdddejZdS)z-Fixer that turns 1L into 1, 0755 into 0o755. )token) fixer_base)Numberc@s"eZdZejZddZddZdS)FixNumliteralscCs|jjdp|jddkS)N0Ll)value startswith)selfnoder5/usr/lib64/python3.6/lib2to3/fixes/fix_numliterals.pymatchszFixNumliterals.matchcCs`|j}|ddkr |dd}n2|jdrR|jrRtt|dkrRd|dd}t||jdS)NrrrZ0o)prefixr r )r r isdigitlensetrr)r r Zresultsvalrrr transforms  "zFixNumliterals.transformN)__name__ __module__ __qualname__rNUMBERZ _accept_typerrrrrrr srN) __doc__Zpgen2rrZ fixer_utilrZBaseFixrrrrrs   PK51]نuu%__pycache__/fix_intern.cpython-36.pycnu[3 \@s6dZddlmZddlmZmZGdddejZdS)z/Fixer for intern(). intern(s) -> sys.intern(s)) fixer_base) ImportAndCall touch_importc@s eZdZdZdZdZddZdS) FixInternTZprez power< 'intern' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > cCsd|rD|d}|rD|j|jjkr"dS|j|jjkrD|jdjdkrDdSd}t|||}tdd||S)Nobjz**sysintern)rr )typeZsymsZ star_exprZargumentZchildrenvaluerr)selfZnodeZresultsrnamesnewr0/usr/lib64/python3.6/lib2to3/fixes/fix_intern.py transforms  zFixIntern.transformN)__name__ __module__ __qualname__Z BM_compatibleorderZPATTERNrrrrrr s rN)__doc__rZ fixer_utilrrZBaseFixrrrrrs PK51]{4,__pycache__/fix_nonzero.cpython-36.opt-1.pycnu[3 \O@s2dZddlmZddlmZGdddejZdS)z*Fixer for __nonzero__ -> __bool__ methods.) fixer_base)Namec@seZdZdZdZddZdS) FixNonzeroTz classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='__nonzero__' parameters< '(' NAME ')' > any+ > any* > > cCs$|d}td|jd}|j|dS)Nname__bool__)prefix)rrreplace)selfZnodeZresultsrnewr 1/usr/lib64/python3.6/lib2to3/fixes/fix_nonzero.py transformszFixNonzero.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r r r r rsrN)__doc__rZ fixer_utilrZBaseFixrr r r r s  PK51]Bp  )__pycache__/fix_dict.cpython-36.opt-2.pycnu[3 \@sfddlmZddlmZddlmZddlmZmZmZddlmZejdhBZ Gdddej Z d S) )pytree)patcomp) fixer_base)NameCallDot) fixer_utiliterc@s@eZdZdZdZddZdZejeZ dZ eje Z ddZ d S) FixDictTa power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues'| 'viewkeys'|'viewitems'|'viewvalues') > parens=trailer< '(' ')' > tail=any* > c Cs|d}|dd}|d}|j}|j}|jd}|jd} |sD| rP|dd}dd |D}d d |D}| o||j||} |tj|jtt||j d g|d j g} tj|j | } | p| sd | _ t t|rdnd| g} |rtj|j | g|} |j | _ | S)Nheadmethodtailr ZviewcSsg|] }|jqS)clone).0nrr./usr/lib64/python3.6/lib2to3/fixes/fix_dict.py Asz%FixDict.transform..cSsg|] }|jqSr)r)rrrrrrBs)prefixZparenslist) symsvalue startswithin_special_contextrZNodeZtrailerrrrrZpowerr) selfnoderesultsr r rrZ method_nameisiterZisviewZspecialargsnewrrr transform6s2      zFixDict.transformz3power< func=NAME trailer< '(' node=any ')' > any* >zmfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > cCs|jdkrdSi}|jjdk r^|jj|jj|r^|d|kr^|rN|djtkS|djtjkS|sfdS|jj|j|o|d|kS)NFrfunc)parentp1matchr iter_exemptrconsuming_callsp2)rrr rrrrrZs   zFixDict.in_special_contextN) __name__ __module__ __qualname__Z BM_compatibleZPATTERNr#ZP1rZcompile_patternr&ZP2r*rrrrrr )s   r N) rrrrrrrrr)r(ZBaseFixr rrrrs     PK51]+__pycache__/fix_buffer.cpython-36.opt-1.pycnu[3 \N@s2dZddlmZddlmZGdddejZdS)z4Fixer that changes buffer(...) into memoryview(...).) fixer_base)Namec@s eZdZdZdZdZddZdS) FixBufferTzR power< name='buffer' trailer< '(' [any] ')' > any* > cCs |d}|jtd|jddS)Nname memoryview)prefix)replacerr)selfZnodeZresultsrr 0/usr/lib64/python3.6/lib2to3/fixes/fix_buffer.py transformszFixBuffer.transformN)__name__ __module__ __qualname__Z BM_compatibleZexplicitZPATTERNr r r r r r srN)__doc__rZ fixer_utilrZBaseFixrr r r r s  PK51]>fhh#__pycache__/fix_exec.cpython-36.pycnu[3 \@s:dZddlmZddlmZmZmZGdddejZdS)zFixer for exec. This converts usages of the exec statement into calls to a built-in exec() function. exec code in ns1, ns2 -> exec(code, ns1, ns2) ) fixer_base)CommaNameCallc@seZdZdZdZddZdS)FixExecTzx exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > | exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > cCs|st|j}|d}|jd}|jd}|jg}d|d_|dk rZ|jt|jg|dk rv|jt|jgttd||jdS)Nabcexec)prefix) AssertionErrorsymsgetZcloner extendrrr)selfZnodeZresultsrrrr argsr./usr/lib64/python3.6/lib2to3/fixes/fix_exec.py transforms    zFixExec.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrrrsrN) __doc__r rZ fixer_utilrrrZBaseFixrrrrr s PK51]6H770__pycache__/fix_set_literal.cpython-36.opt-2.pycnu[3 \@s6ddlmZmZddlmZmZGdddejZdS)) fixer_basepytree)tokensymsc@s eZdZdZdZdZddZdS) FixSetLiteralTajpower< 'set' trailer< '(' (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) > | single=any) ']' > | atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > ) ')' > > c Cs|jd}|r2tjtj|jg}|j||}n|d}tjtj dg}|j dd|j D|j tjtj d|jj|d _tjtj|}|j|_t|j dkr|j d }|j|j|j d _|S) Nsingleitems{css|]}|jVqdS)N)clone).0nr 5/usr/lib64/python3.6/lib2to3/fixes/fix_set_literal.py 'sz*FixSetLiteral.transform..}r)getrZNoderZ listmakerr replaceZLeafrLBRACEextendZchildrenappendRBRACEZ next_siblingprefixZ dictsetmakerlenremove) selfZnodeZresultsrZfakerliteralZmakerr r r r transforms"   zFixSetLiteral.transformN)__name__ __module__ __qualname__Z BM_compatibleZexplicitZPATTERNr r r r rr s rN)Zlib2to3rrZlib2to3.fixer_utilrrZBaseFixrr r r rsPK51] OO%__pycache__/fix_urllib.cpython-36.pycnu[3 \ @sdZddlmZmZddlmZmZmZmZm Z m Z m Z dddddd d d d gfd dddddddddddddddgfddgfgdd dd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5gfdd6d7gfgd8Z e d9j e d:d;dd?d?eZd@S)AzFix changes imports of urllib which are now incompatible. This is rather similar to fix_imports, but because of the more complex nature of the fixing for urllib, it has its own fixer. ) alternates FixImports)NameComma FromImportNewlinefind_indentationNodesymszurllib.requestZ URLopenerZFancyURLopenerZ urlretrieveZ _urlopenerZurlopenZ urlcleanupZ pathname2urlZ url2pathnamez urllib.parseZquoteZ quote_plusZunquoteZ unquote_plusZ urlencodeZ splitattrZ splithostZ splitnportZ splitpasswdZ splitportZ splitqueryZsplittagZ splittypeZ splituserZ splitvaluez urllib.errorZContentTooShortErrorZinstall_openerZ build_openerZRequestZOpenerDirectorZ BaseHandlerZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZ ProxyHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZ HTTPHandlerZ HTTPSHandlerZ FileHandlerZ FTPHandlerZCacheFTPHandlerZUnknownHandlerZURLErrorZ HTTPError)urlliburllib2r r ccs~t}xrtjD]f\}}x\|D]T}|\}}t|}d||fVd|||fVd|Vd|Vd||fVqWqWdS)Nzimport_name< 'import' (module=%r | dotted_as_names< any* module=%r any* >) > zimport_from< 'from' mod_member=%r 'import' ( member=%s | import_as_name< member=%s 'as' any > | import_as_names< members=any* >) > zIimport_from< 'from' module_star=%r 'import' star='*' > ztimport_name< 'import' dotted_as_name< module_as=%r 'as' any > > zKpower< bare_with_attr=%r trailer< '.' member=%s > any* > )setMAPPINGitemsr)ZbareZ old_moduleZchangeschangeZ new_modulemembersr0/usr/lib64/python3.6/lib2to3/fixes/fix_urllib.py build_pattern0s   rc@s4eZdZddZddZddZddZd d Zd S) FixUrllibcCs djtS)N|)joinr)selfrrrrIszFixUrllib.build_patterncCsz|jd}|j}g}x6t|jddD] }|jt|d|dtgq(W|jtt|jdd|d|j|dS)zTransform for the basic import case. Replaces the old import name with a comma separated list of its replacements. moduleNr r)prefixr) getrrvalueextendrrappendreplace)rnoderesultsZ import_modprefnamesnamerrrtransform_importLs   zFixUrllib.transform_importcCs>|jd}|j}|jd}|rt|tr0|d}d}x*t|jD]}|j|dkr@|d}Pq@W|rx|jt||dn |j|dng}i} |d} x| D]}|j t j kr|j d j} |j dj} n |j} d} | d krxPt|jD]B}| |dkr|d| kr|j |d| j|dgj |qWqWg} t|}d }d d }x|D]}| |}g}x2|ddD]"}|j||||j tqlW|j||d|t||}| s|jjj|r||_| j |d}qNW| r.g}x&| ddD]}|j|tgqW|j | d|j|n |j|ddS)zTransform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module. mod_membermemberrNr )rz!This is an invalid module elementr,TcSsX|jtjkrHt|jdj|d|jdj|jdjg}ttj|gSt|j|dgS)Nr)rr r*)typer import_as_namerchildrenrZcloner )r&rZkidsrrr handle_names   z/FixUrllib.transform_member..handle_nameFzAll module elements are invalidrrrr)rr isinstancelistrrr!rcannot_convertr,r r-r.r setdefaultrrrrparentendswithr)rr"r#r(r$r)new_namermodulesZmod_dictrZas_name member_nameZ new_nodesZ indentationfirstr/rZeltsr%ZeltnewZnodesZnew_noderrrtransform_member\sh            zFixUrllib.transform_membercCs|jd}|jd}d}t|tr*|d}x*t|jD]}|j|dkr6|d}Pq6W|rp|jt||jdn |j|ddS)z.Transform for calls to module members in code.bare_with_attrr)Nrr )rz!This is an invalid module element) rr0r1rrr!rrr2)rr"r#Z module_dotr)r6rrrr transform_dots   zFixUrllib.transform_dotcCsz|jdr|j||n^|jdr0|j||nF|jdrH|j||n.|jdr`|j|dn|jdrv|j|ddS)Nrr(r<Z module_starzCannot handle star imports.Z module_asz#This module is now multiple modules)rr'r;r=r2)rr"r#rrr transforms     zFixUrllib.transformN)__name__ __module__ __qualname__rr'r;r=r>rrrrrGs LrN)__doc__Zlib2to3.fixes.fix_importsrrZlib2to3.fixer_utilrrrrrr r rr rrrrrrs@$ PK51] UU%__pycache__/fix_reduce.cpython-36.pycnu[3 \E@s2dZddlmZddlmZGdddejZdS)zqFixer for reduce(). Makes sure reduce() is imported from the functools module if reduce is used in that module. ) fixer_base) touch_importc@s eZdZdZdZdZddZdS) FixReduceTZpreai power< 'reduce' trailer< '(' arglist< ( (not(argument) any ',' not(argument > cCstdd|dS)N functoolsreduce)r)selfZnodeZresultsr0/usr/lib64/python3.6/lib2to3/fixes/fix_reduce.py transform"szFixReduce.transformN)__name__ __module__ __qualname__Z BM_compatibleorderZPATTERNr rrrr rsrN)__doc__Zlib2to3rZlib2to3.fixer_utilrZBaseFixrrrrr s  PK51]tu55+__pycache__/fix_reload.cpython-36.opt-2.pycnu[3 \@s2ddlmZddlmZmZGdddejZdS)) fixer_base) ImportAndCall touch_importc@s eZdZdZdZdZddZdS) FixReloadTZprez power< 'reload' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > cCsd|rD|d}|rD|j|jjkr"dS|j|jjkrD|jdjdkrDdSd}t|||}tdd||S)Nobjz**impreload)rr )typeZsymsZ star_exprZargumentZchildrenvaluerr)selfZnodeZresultsrnamesnewr0/usr/lib64/python3.6/lib2to3/fixes/fix_reload.py transforms  zFixReload.transformN)__name__ __module__ __qualname__Z BM_compatibleorderZPATTERNrrrrrr s rN)rZ fixer_utilrrZBaseFixrrrrrs PK51] 'O!(__pycache__/fix_funcattrs.cpython-36.pycnu[3 \@s2dZddlmZddlmZGdddejZdS)z3Fix function attribute names (f.func_x -> f.__x__).) fixer_base)Namec@seZdZdZdZddZdS) FixFuncattrsTz power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' | 'func_dict') > any* > cCs2|dd}|jtd|jdd|jddS)Nattrz__%s__)prefix)replacervaluer)selfZnodeZresultsrr 3/usr/lib64/python3.6/lib2to3/fixes/fix_funcattrs.py transforms zFixFuncattrs.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrr r r r r srN)__doc__rZ fixer_utilrZBaseFixrr r r r s  PK51]Ndd,__pycache__/fix_sys_exc.cpython-36.opt-1.pycnu[3 \ @sJdZddlmZddlmZmZmZmZmZm Z m Z Gdddej Z dS)zFixer for sys.exc_{type, value, traceback} sys.exc_type -> sys.exc_info()[0] sys.exc_value -> sys.exc_info()[1] sys.exc_traceback -> sys.exc_info()[2] ) fixer_base)AttrCallNameNumber SubscriptNodesymsc@s:eZdZdddgZdZddjddeDZd d Zd S) FixSysExcexc_type exc_value exc_tracebackTzN power< 'sys' trailer< dot='.' attribute=(%s) > > |ccs|]}d|VqdS)z'%s'N).0err1/usr/lib64/python3.6/lib2to3/fixes/fix_sys_exc.py szFixSysExc.cCst|dd}t|jj|j}ttd|jd}ttd|}|dj|djd_|j t |t t j ||jdS)NZ attributeexc_info)prefixsysdot)rrindexvaluerrrrZchildrenappendrrr Zpower)selfZnodeZresultsZsys_attrrZcallattrrrr transforms zFixSysExc.transformN)__name__ __module__ __qualname__rZ BM_compatiblejoinZPATTERNrrrrrr s r N) __doc__rZ fixer_utilrrrrrrr ZBaseFixr rrrrs $PK51]]fEE*__pycache__/fix_raise.cpython-36.opt-2.pycnu[3 \n @sVddlmZddlmZddlmZddlmZmZmZm Z m Z Gdddej Z dS))pytree)token) fixer_base)NameCallAttrArgListis_tuplec@seZdZdZdZddZdS)FixRaiseTzB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > c Csl|j}|dj}|jtjkr2d}|j||dSt|rbx t|rZ|jdjdj}qDsz&FixRaise.transform..tbNonewith_traceback)prefix)symsrtyperSTRINGZcannot_convertr ZchildrenrrZNodeZ raise_stmtrNAMEvaluerrrZ simple_stmt) selfZnodeZresultsrr msgnewrargsreZwith_tbrrr transform&s@        zFixRaise.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr'rrrrr sr N) rrZpgen2rrZ fixer_utilrrrrr ZBaseFixr rrrrs   PK51] ~aNN-__pycache__/fix_ws_comma.cpython-36.opt-1.pycnu[3 \B@s>dZddlmZddlmZddlmZGdddejZdS)zFixer that changes 'a ,b' into 'a, b'. This also changes '{a :b}' into '{a: b}', but does not touch other uses of colons. It does not touch other uses of whitespace. )pytree)token) fixer_basec@s@eZdZdZdZejejdZejej dZ ee fZ ddZ dS) FixWsCommaTzH any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]> ,:cCsd|j}d}xR|jD]H}||jkrD|j}|jr>d|kr>d|_d}q|rX|j}|sXd|_d}qW|S)NF T )ZcloneZchildrenSEPSprefixisspace)selfZnodeZresultsnewZcommaZchildr r2/usr/lib64/python3.6/lib2to3/fixes/fix_ws_comma.py transforms  zFixWsComma.transformN) __name__ __module__ __qualname__ZexplicitZPATTERNrZLeafrCOMMACOLONr rrrrrr s rN)__doc__r rZpgen2rrZBaseFixrrrrrs   PK51]D.?440__pycache__/fix_itertools_imports.cpython-36.pycnu[3 \&@s:dZddlmZddlmZmZmZGdddejZdS)zA Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) ) fixer_base) BlankLinesymstokenc@s"eZdZdZdeZddZdS)FixItertoolsImportsTzT import_from< 'from' 'itertools' 'import' imports=any > c Cs~|d}|jtjks|j r$|g}n|j}x|dddD]}|jtjkrV|j}|}n*|jtjkrfdS|jtjksvt|jd}|j}|dkrd|_|j q:|dkr:|j |d d krd nd |_q:W|jddp|g}d } x2|D]*}| r|jtj kr|j q| d N} qWx*|r>|djtj kr>|j j qW|jpRt |dd sd|jdkrz|j} t}| |_|SdS)Nimportsrimapizipifilter ifilterfalse izip_longestf filterfalse zip_longestTvalue)r r r )r r )typerZimport_as_namechildrenrNAMErSTARAssertionErrorremoveZchangedCOMMApopgetattrparentprefixr) selfZnodeZresultsrrZchildmemberZ name_node member_nameZ remove_commapr#;/usr/lib64/python3.6/lib2to3/fixes/fix_itertools_imports.py transformsD         zFixItertoolsImports.transformN)__name__ __module__ __qualname__Z BM_compatiblelocalsZPATTERNr%r#r#r#r$rs rN) __doc__Zlib2to3rZlib2to3.fixer_utilrrrZBaseFixrr#r#r#r$s PK51]Ѐ,__pycache__/fix_standarderror.cpython-36.pycnu[3 \@s2dZddlmZddlmZGdddejZdS)z%Fixer for StandardError -> Exception.) fixer_base)Namec@seZdZdZdZddZdS)FixStandarderrorTz- 'StandardError' cCstd|jdS)N Exception)prefix)rr)selfZnodeZresultsr7/usr/lib64/python3.6/lib2to3/fixes/fix_standarderror.py transformszFixStandarderror.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrr r srN)__doc__rZ fixer_utilrZBaseFixrrrrr s  PK51] ~aNN'__pycache__/fix_ws_comma.cpython-36.pycnu[3 \B@s>dZddlmZddlmZddlmZGdddejZdS)zFixer that changes 'a ,b' into 'a, b'. This also changes '{a :b}' into '{a: b}', but does not touch other uses of colons. It does not touch other uses of whitespace. )pytree)token) fixer_basec@s@eZdZdZdZejejdZejej dZ ee fZ ddZ dS) FixWsCommaTzH any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]> ,:cCsd|j}d}xR|jD]H}||jkrD|j}|jr>d|kr>d|_d}q|rX|j}|sXd|_d}qW|S)NF T )ZcloneZchildrenSEPSprefixisspace)selfZnodeZresultsnewZcommaZchildr r2/usr/lib64/python3.6/lib2to3/fixes/fix_ws_comma.py transforms  zFixWsComma.transformN) __name__ __module__ __qualname__ZexplicitZPATTERNrZLeafrCOMMACOLONr rrrrrr s rN)__doc__r rZpgen2rrZBaseFixrrrrrs   PK51]sLUU/__pycache__/fix_basestring.cpython-36.opt-2.pycnu[3 \@@s.ddlmZddlmZGdddejZdS)) fixer_base)Namec@seZdZdZdZddZdS) FixBasestringTz 'basestring'cCstd|jdS)Nstr)prefix)rr)selfZnodeZresultsr4/usr/lib64/python3.6/lib2to3/fixes/fix_basestring.py transform szFixBasestring.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrr rsrN)rZ fixer_utilrZBaseFixrrrrr s  PK51]؈]].__pycache__/fix_metaclass.cpython-36.opt-2.pycnu[3 \ @srddlmZddlmZddlmZmZmZddZddZ dd Z d d Z d d Z ddZ GdddejZdS)) fixer_base)token)symsNodeLeafcCsxxr|jD]h}|jtjkr t|S|jtjkr|jr|jd}|jtjkr|jr|jd}t|tr|j dkrdSqWdS)N __metaclass__TF) childrentypersuite has_metaclass simple_stmt expr_stmt isinstancervalue)parentnode expr_nodeZ left_sider3/usr/lib64/python3.6/lib2to3/fixes/fix_metaclass.pyr s      r cCsx|jD]}|jtjkrdSqWx,t|jD]\}}|jtjkr,Pq,Wtdttjg}x:|j|ddr|j|d}|j |j |j q\W|j ||}dS)NzNo class suite and no ':'!) r r rr enumeraterCOLON ValueErrorr append_childcloneremove)cls_noderir move_noderrrfixup_parse_tree-s      r c Csx(t|jD]\}}|jtjkr Pq WdS|jttjg}ttj |g}x2|j|dr~|j|}|j |j |jqNW|j |||jdjd}|jdjd} | j |_ dS)Nr)rr r rSEMIrrrrr rr insert_childprefix) rrZ stmt_nodeZsemi_indrZnew_exprZnew_stmtrZ new_leaf1Z old_leaf1rrrfixup_simple_stmtGs     r$cCs*|jr&|jdjtjkr&|jdjdS)Nrr%)r r rNEWLINEr)rrrrremove_trailing_newline_sr'ccsx$|jD]}|jtjkrPqWtdxtt|jD]t\}}|jtjkr6|jr6|jd}|jtjkr6|jr6|jd}t |t r6|j dkr6t |||t ||||fVq6WdS)NzNo class suite!rr)r r rr rlistrr rrrrr$r')rrrZ simple_noderZ left_noderrr find_metasds       r)cCs|jddd}x|r.|j}|jtjkrPqWxL|r||j}t|trd|jtjkrd|jr`d|_dS|j |jdddq2WdS)Nrr%r%) r popr rINDENTrrDEDENTr#extend)r Zkidsrrrr fixup_indent{s r/c@seZdZdZdZddZdS) FixMetaclassTz classdef cCs<t|s dSt|d}x"t|D]\}}}|}|jq"W|jdj}t|jdkr|jdjtjkrt|jd}n(|jdj } t tj| g}|j d|nt|jdkrt tjg}|j d|nZt|jdkrt tjg}|j dt tjd|j d||j dt tjdntd |jdjd} d | _| j} |jr^|jt tjd d | _nd | _|jd} d | jd_d | jd_|j|t||js|jt |d} | | _|j| |jt tjdnbt|jdkr8|jdjtjkr8|jdjtjkr8t |d} |j d| |j dt tjddS)Nrr)(zUnexpected class definition metaclass, r*rpass r%r%r%)r r r)rr r lenrarglistrrZ set_childr"rrRPARLPARrrr#rCOMMAr/r&r,r-)selfrZresultsZlast_metaclassr rZstmtZ text_typer>rZmeta_txtZorig_meta_prefixrZ pass_leafrrr transforms^              zFixMetaclass.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrCrrrrr0sr0N)r*rZpygramrZ fixer_utilrrrr r r$r'r)r/ZBaseFixr0rrrrs  PK51]&"6__pycache__/fix_itertools_imports.cpython-36.opt-2.pycnu[3 \&@s6ddlmZddlmZmZmZGdddejZdS)) fixer_base) BlankLinesymstokenc@s"eZdZdZdeZddZdS)FixItertoolsImportsTzT import_from< 'from' 'itertools' 'import' imports=any > c Csl|d}|jtjks|j r$|g}n|j}x|dddD]z}|jtjkrV|j}|}n|jtjkrfdS|jd}|j}|dkrd|_|jq:|dkr:|j |d d krd nd |_q:W|jddp|g}d } x0|D](}| o|jtj kr|jq| d N} qWx*|r,|djtj kr,|j jqW|jp@t |dd sR|j dkrh|j} t}| |_|SdS)Nimportsrimapizipifilter ifilterfalse izip_longestf filterfalse zip_longestTvalue)r r r )r r )typerZimport_as_namechildrenrNAMErSTARremoveZchangedCOMMApopgetattrparentprefixr) selfZnodeZresultsrrZchildmemberZ name_node member_nameZ remove_commapr";/usr/lib64/python3.6/lib2to3/fixes/fix_itertools_imports.py transformsB         zFixItertoolsImports.transformN)__name__ __module__ __qualname__Z BM_compatiblelocalsZPATTERNr$r"r"r"r#rs rN)Zlib2to3rZlib2to3.fixer_utilrrrZBaseFixrr"r"r"r#s PK51]Yٜxx'__pycache__/fix_operator.cpython-36.pycnu[3 \ @sNdZddlZddlmZddlmZmZmZmZddZ Gdddej Z dS) aFixer for operator functions. operator.isCallable(obj) -> hasattr(obj, '__call__') operator.sequenceIncludes(obj) -> operator.contains(obj) operator.isSequenceType(obj) -> isinstance(obj, collections.Sequence) operator.isMappingType(obj) -> isinstance(obj, collections.Mapping) operator.isNumberType(obj) -> isinstance(obj, numbers.Number) operator.repeat(obj, n) -> operator.mul(obj, n) operator.irepeat(obj, n) -> operator.imul(obj, n) N) fixer_base)CallNameString touch_importcsfdd}|S)Ncs |_|S)N) invocation)f)s2/usr/lib64/python3.6/lib2to3/fixes/fix_operator.pydecszinvocation..decr )r r r )r r rs rc@seZdZdZdZdZdZdeeedZddZ e d d d Z e d d dZ e dddZ e dddZe dddZe dddZe dddZddZd d!Zd"d#Zd$S)% FixOperatorTZprez method=('isCallable'|'sequenceIncludes' |'isSequenceType'|'isMappingType'|'isNumberType' |'repeat'|'irepeat') z'(' obj=any ')'z power< module='operator' trailer< '.' %(methods)s > trailer< %(obj)s > > | power< %(methods)s trailer< %(obj)s > > )methodsobjcCs"|j||}|dk r|||SdS)N) _check_method)selfnoderesultsmethodr r r transform+s zFixOperator.transformzoperator.contains(%s)cCs|j||dS)Ncontains)_handle_rename)rrrr r r _sequenceIncludes0szFixOperator._sequenceIncludeszhasattr(%s, '__call__')cCs2|d}|jtdtdg}ttd||jdS)Nrz, z '__call__'hasattr)prefix)clonerrrr)rrrrargsr r r _isCallable4szFixOperator._isCallablezoperator.mul(%s)cCs|j||dS)Nmul)r)rrrr r r _repeat:szFixOperator._repeatzoperator.imul(%s)cCs|j||dS)Nimul)r)rrrr r r _irepeat>szFixOperator._irepeatz$isinstance(%s, collections.Sequence)cCs|j||ddS)N collectionsSequence)_handle_type2abc)rrrr r r _isSequenceTypeBszFixOperator._isSequenceTypez#isinstance(%s, collections.Mapping)cCs|j||ddS)Nr"Mapping)r$)rrrr r r _isMappingTypeFszFixOperator._isMappingTypezisinstance(%s, numbers.Number)cCs|j||ddS)NZnumbersNumber)r$)rrrr r r _isNumberTypeJszFixOperator._isNumberTypecCs|dd}||_|jdS)Nrr)valueZchanged)rrrnamerr r r rNs zFixOperator._handle_renamecCsFtd|||d}|jtddj||gg}ttd||jdS)Nrz, . isinstance)r)rrrjoinrrr)rrrmoduleabcrrr r r r$Ss zFixOperator._handle_type2abccCs\t|d|ddj}t|tjrXd|kr0|St|df}|j|}|j|d|dS)N_rrr/rzYou should use '%s' here.)getattrr*r-r"CallablestrrZwarning)rrrrsubZinvocation_strr r r rYs  zFixOperator._check_methodN)__name__ __module__ __qualname__Z BM_compatibleorderrrdictZPATTERNrrrrrr!r%r'r)rr$rr r r r r s r ) __doc__r"Zlib2to3rZlib2to3.fixer_utilrrrrrZBaseFixr r r r r  s  PK51]7'__pycache__/fix_ne.cpython-36.opt-2.pycnu[3 \;@s:ddlmZddlmZddlmZGdddejZdS))pytree)token) fixer_basec@s"eZdZejZddZddZdS)FixNecCs |jdkS)Nz<>)value)selfnoder ,/usr/lib64/python3.6/lib2to3/fixes/fix_ne.pymatchsz FixNe.matchcCstjtjd|jd}|S)Nz!=)prefix)rZLeafrNOTEQUALr )rrZresultsnewr r r transformszFixNe.transformN)__name__ __module__ __qualname__rr Z _accept_typer rr r r r r srN)rZpgen2rrZBaseFixrr r r r s   PK51]j&__pycache__/fix_unicode.cpython-36.pycnu[3 \@s<dZddlmZddlmZdddZGdddejZd S) zFixer for unicode. * Changes unicode to str and unichr to chr. * If "...\u..." is not unicode literal change it into "...\\u...". * Change u"..." into "...". )token) fixer_basechrstr)ZunichrZunicodecs,eZdZdZdZfddZddZZS) FixUnicodeTzSTRING | 'unicode' | 'unichr'cs"tt|j||d|jk|_dS)Nunicode_literals)superr start_treeZfuture_featuresr)selfZtreefilename) __class__1/usr/lib64/python3.6/lib2to3/fixes/fix_unicode.pyr szFixUnicode.start_treecCs|jtjkr$|j}t|j|_|S|jtjkr|j}|j rl|ddkrld|krldjdd|j dD}|ddkr|dd}||jkr|S|j}||_|SdS) Nz'"\z\\cSs g|]}|jddjddqS)z\uz\\uz\Uz\\U)replace).0vr r r !sz(FixUnicode.transform..ZuU) typerNAMEZclone_mappingvalueSTRINGrjoinsplit)r ZnodeZresultsnewvalr r r transforms"      zFixUnicode.transform)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r __classcell__r r )r rrs rN)__doc__Zpgen2rrrZBaseFixrr r r r s   PK51]Xz.(__pycache__/fix_map.cpython-36.opt-2.pycnu[3 \8@sbddlmZddlmZddlmZmZmZmZm Z ddl m Z ddl mZGdddejZdS) )token) fixer_base)NameArgListCallListCompin_special_context)python_symbols)Nodec@s eZdZdZdZdZddZdS)FixMapTaL map_none=power< 'map' trailer< '(' arglist< 'None' ',' arg=any [','] > ')' > [extra_trailers=trailer*] > | map_lambda=power< 'map' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > [extra_trailers=trailer*] > | power< 'map' args=trailer< '(' [any] ')' > [extra_trailers=trailer*] > zfuture_builtins.mapcCs|j|rdSg}d|kr:x|dD]}|j|jq$W|jjtjkrv|j|d|j}d|_t t d|g}n&d|krt |dj|dj|dj}t tj |g|dd }nd |kr|d j}d|_nd |krj|d }|jtjkrL|jd jtjkrL|jd jdjtjkrL|jd jdjdkrL|j|ddSt tj t d|jg}d|_t|rxdSt tj t dt|gg|}d|_|j|_|S)NZextra_trailerszYou should use a for loop herelistZ map_lambdaZxpfpit)prefixZmap_noneargargsNonezjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequencemap)Z should_skipappendZcloneparenttypesymsZ simple_stmtZwarningrrrrr ZpowerZtrailerZchildrenZarglistrNAMEvaluerr)selfZnodeZresultsZtrailerstnewrr -/usr/lib64/python3.6/lib2to3/fixes/fix_map.py transform@sF        zFixMap.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZskip_onr"r r r r!r sr N)Zpgen2rr rZ fixer_utilrrrrrZpygramr rZpytreer ZConditionalFixr r r r r!s    PK51]Cpb$__pycache__/fix_raise.cpython-36.pycnu[3 \n @sZdZddlmZddlmZddlmZddlmZmZm Z m Z m Z Gdddej Z dS) a[Fixer for 'raise E, V, T' raise -> raise raise E -> raise E raise E, V -> raise E(V) raise E, V, T -> raise E(V).with_traceback(T) raise E, None, T -> raise E.with_traceback(T) raise (((E, E'), E''), E'''), V -> raise E(V) raise "foo", V, T -> warns about string exceptions CAVEATS: 1) "raise E, V" will be incorrectly translated if V is an exception instance. The correct Python 3 idiom is raise E from V but since we can't detect instance-hood by syntax alone and since any client code would have to be changed as well, we don't automate this. )pytree)token) fixer_base)NameCallAttrArgListis_tuplec@seZdZdZdZddZdS)FixRaiseTzB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > c Csl|j}|dj}|jtjkr2d}|j||dSt|rbx t|rZ|jdjdj}qDsz&FixRaise.transform..tbNonewith_traceback)prefix)symsrtyperSTRINGZcannot_convertr ZchildrenrrZNodeZ raise_stmtrNAMEvaluerrrZ simple_stmt) selfZnodeZresultsrr msgnewrargsreZwith_tbrrr transform&s@        zFixRaise.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr'rrrrr sr N)__doc__rrZpgen2rrZ fixer_utilrrrrr ZBaseFixr rrrrs    PK51]^(__pycache__/fix_metaclass.cpython-36.pycnu[3 \ @svdZddlmZddlmZddlmZmZmZddZ ddZ d d Z d d Z d dZ ddZGdddejZdS)aFixer for __metaclass__ = X -> (metaclass=X) methods. The various forms of classef (inherits nothing, inherits once, inherints many) don't parse the same in the CST so we look at ALL classes for a __metaclass__ and if we find one normalize the inherits to all be an arglist. For one-liner classes ('class X: pass') there is no indent/dedent so we normalize those into having a suite. Moving the __metaclass__ into the classdef can also cause the class body to be empty so there is some special casing for that as well. This fixer also tries very hard to keep original indenting and spacing in all those corner cases. ) fixer_base)token)symsNodeLeafcCsxxr|jD]h}|jtjkr t|S|jtjkr|jr|jd}|jtjkr|jr|jd}t|tr|j dkrdSqWdS)z we have to check the cls_node without changing it. There are two possibilities: 1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta') 2) clsdef => simple_stmt => expr_stmt => Leaf('__meta') __metaclass__TF) childrentypersuite has_metaclass simple_stmt expr_stmt isinstancervalue)parentnode expr_nodeZ left_sider3/usr/lib64/python3.6/lib2to3/fixes/fix_metaclass.pyr s      r cCsx|jD]}|jtjkrdSqWx,t|jD]\}}|jtjkr,Pq,Wtdttjg}x:|j|ddr|j|d}|j |j |j q\W|j ||}dS)zf one-line classes don't get a suite in the parse tree so we add one to normalize the tree NzNo class suite and no ':'!) r r rr enumeraterCOLON ValueErrorr append_childcloneremove)cls_noderir move_noderrrfixup_parse_tree-s      r c Csx(t|jD]\}}|jtjkr Pq WdS|jttjg}ttj |g}x2|j|dr~|j|}|j |j |jqNW|j |||jdjd}|jdjd} | j |_ dS)z if there is a semi-colon all the parts count as part of the same simple_stmt. We just want the __metaclass__ part so we move everything after the semi-colon into its own simple_stmt node Nr)rr r rSEMIrrrrr rr insert_childprefix) rrZ stmt_nodeZsemi_indrZnew_exprZnew_stmtrZ new_leaf1Z old_leaf1rrrfixup_simple_stmtGs     r$cCs*|jr&|jdjtjkr&|jdjdS)Nrr%)r r rNEWLINEr)rrrrremove_trailing_newline_sr'ccsx$|jD]}|jtjkrPqWtdxtt|jD]t\}}|jtjkr6|jr6|jd}|jtjkr6|jr6|jd}t |t r6|j dkr6t |||t ||||fVq6WdS)NzNo class suite!rr)r r rr rlistrr rrrrr$r')rrrZ simple_noderZ left_noderrr find_metasds       r)cCs|jddd}x|r.|j}|jtjkrPqWxL|r||j}t|trd|jtjkrd|jr`d|_dS|j |jdddq2WdS)z If an INDENT is followed by a thing with a prefix then nuke the prefix Otherwise we get in trouble when removing __metaclass__ at suite start Nrr%r%) r popr rINDENTrrDEDENTr#extend)r Zkidsrrrr fixup_indent{s r/c@seZdZdZdZddZdS) FixMetaclassTz classdef cCsNt|s dSt|d}x"t|D]\}}}|}|jq"W|jdj}t|jdkr|jdjtjkrt|jd}n(|jdj } t tj| g}|j d|nt|jdkrt tjg}|j d|nZt|jdkrt tjg}|j dt tjd|j d||j dt tjdntd |jdjd} d | _| j} |jr^|jt tjd d | _nd | _|jd} | jtjkstd | jd_d | jd_|j|t||js|jt |d} | | _|j| |jt tjdnbt|jdkrJ|jdjtjkrJ|jdjtjkrJt |d} |j d| |j dt tjddS)Nrr)(zUnexpected class definition metaclass, r*rpass r%r%r%)r r r)rr r lenrarglistrrZ set_childr"rrRPARLPARrrr#rCOMMArAssertionErrorr/r&r,r-)selfrZresultsZlast_metaclassr rZstmtZ text_typer>rZmeta_txtZorig_meta_prefixrZ pass_leafrrr transforms`              zFixMetaclass.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrDrrrrr0sr0N)__doc__r*rZpygramrZ fixer_utilrrrr r r$r'r)r/ZBaseFixr0rrrrs  PK51]Qv )__pycache__/fix_next.cpython-36.opt-2.pycnu[3 \f @sjddlmZddlmZddlmZddlmZm Z m Z dZ Gdddej Z dd Zd d Zd d ZdS))token)python_symbols) fixer_base)NameCall find_bindingz;Calls to builtin next() possibly shadowed by global bindingcs0eZdZdZdZdZfddZddZZS)FixNextTa power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > > | power< head=any+ trailer< '.' attr='next' > not trailer< '(' ')' > > | classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='next' parameters< '(' NAME ')' > any+ > any* > > | global=global_stmt< 'global' any* 'next' any* > Zprecs>tt|j||td|}|r4|j|td|_nd|_dS)NnextTF)superr start_treerwarning bind_warning shadowed_next)selfZtreefilenamen) __class__./usr/lib64/python3.6/lib2to3/fixes/fix_next.pyr $s   zFixNext.start_treecCs|jd}|jd}|jd}|rr|jr>|jtd|jdqdd|D}d|d _|jttd |jd|n|rtd|jd}|j|nj|rt|r|d }djd d|Djd kr|j |t dS|jtdnd|kr|j |t d|_dS)Nbaseattrname__next__)prefixcSsg|] }|jqSr)Zclone).0rrrr 9sz%FixNext.transform..r headcSsg|] }t|qSr)str)rrrrrrEsZ __builtin__globalT) getrreplacerrris_assign_targetjoinstripr r )rnodeZresultsrrrrrrrr transform.s,       zFixNext.transform) __name__ __module__ __qualname__Z BM_compatibleZPATTERNorderr r' __classcell__rr)rrrs  rcCsFt|}|dkrdSx,|jD]"}|jtjkr0dSt||rdSqWdS)NFT) find_assignchildrentyperEQUAL is_subtree)r&ZassignZchildrrrr#Qs   r#cCs4|jtjkr|S|jtjks&|jdkr*dSt|jS)N)r/symsZ expr_stmtZ simple_stmtparentr-)r&rrrr-]s  r-cs$|kr dStfdd|jDS)NTc3s|]}t|VqdS)N)r1)rc)r&rr gszis_subtree..)anyr.)rootr&r)r&rr1dsr1N)Zpgen2rZpygramrr2rrZ fixer_utilrrrr ZBaseFixrr#r-r1rrrr s   @ PK51]O +__pycache__/fix_xrange.cpython-36.opt-1.pycnu[3 \ @sFdZddlmZddlmZmZmZddlmZGdddejZ dS)z/Fixer that changes xrange(...) into range(...).) fixer_base)NameCallconsuming_calls)patcompcsheZdZdZdZfddZddZddZd d Zd d Z d Z e j e Z dZe j eZddZZS) FixXrangeTz power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > cstt|j||t|_dS)N)superr start_treesettransformed_xranges)selftreefilename) __class__0/usr/lib64/python3.6/lib2to3/fixes/fix_xrange.pyr szFixXrange.start_treecCs d|_dS)N)r )r r rrrr finish_treeszFixXrange.finish_treecCsD|d}|jdkr|j||S|jdkr4|j||Stt|dS)NnameZxrangerange)valuetransform_xrangetransform_range ValueErrorrepr)r noderesultsrrrr transforms     zFixXrange.transformcCs0|d}|jtd|jd|jjt|dS)Nrr)prefix)replacerrr addid)r rrrrrrr$szFixXrange.transform_xrangecCslt||jkrh|j| rhttd|djg}ttd|g|jd}x|dD]}|j|qRW|SdS)Nrargslist)rrest)r r in_special_contextrrZclonerZ append_child)r rrZ range_callZ list_callnrrrr*s   zFixXrange.transform_rangez3power< func=NAME trailer< '(' node=any ')' > any* >zfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > | comparison< any 'in' node=any any*> cCsf|jdkrdSi}|jjdk rJ|jj|jj|rJ|d|krJ|djtkS|jj|j|od|d|kS)NFrfunc)parentp1matchrrp2)r rrrrrr$?s   zFixXrange.in_special_context)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrrZP1rZcompile_patternr(ZP2r*r$ __classcell__rr)rrr s     rN) __doc__rZ fixer_utilrrrrZBaseFixrrrrrs  PK51]Ѐ2__pycache__/fix_standarderror.cpython-36.opt-1.pycnu[3 \@s2dZddlmZddlmZGdddejZdS)z%Fixer for StandardError -> Exception.) fixer_base)Namec@seZdZdZdZddZdS)FixStandarderrorTz- 'StandardError' cCstd|jdS)N Exception)prefix)rr)selfZnodeZresultsr7/usr/lib64/python3.6/lib2to3/fixes/fix_standarderror.py transformszFixStandarderror.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrr r srN)__doc__rZ fixer_utilrZBaseFixrrrrr s  PK51]:\NN)__pycache__/fix_exec.cpython-36.opt-1.pycnu[3 \@s:dZddlmZddlmZmZmZGdddejZdS)zFixer for exec. This converts usages of the exec statement into calls to a built-in exec() function. exec code in ns1, ns2 -> exec(code, ns1, ns2) ) fixer_base)CommaNameCallc@seZdZdZdZddZdS)FixExecTzx exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > | exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > cCs|j}|d}|jd}|jd}|jg}d|d_|dk rR|jt|jg|dk rn|jt|jgttd||jdS)Nabcexec)prefix)symsgetZcloner extendrrr)selfZnodeZresultsrrrr argsr./usr/lib64/python3.6/lib2to3/fixes/fix_exec.py transforms    zFixExec.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrrrsrN) __doc__r rZ fixer_utilrrrZBaseFixrrrrr s PK51]Zļ*__pycache__/fix_apply.cpython-36.opt-2.pycnu[3 \~ @sNddlmZddlmZddlmZddlmZmZmZGdddej Z dS))pytree)token) fixer_base)CallComma parenthesizec@seZdZdZdZddZdS)FixApplyTa. power< 'apply' trailer< '(' arglist< (not argument ')' > > c Cs>|j}|d}|d}|jd}|rX|j|jjkr6dS|j|jjkrX|jdjdkrXdS|r~|j|jjkr~|jdjdkr~dS|j}|j}|jt j |j fkr|j|j ks|jd jt j krt|}d|_|j}d|_|dk r|j}d|_tjt jd|g}|dk r0|jttjt j d|gd |d _t|||d S) Nfuncargskwdsz**r* )prefixr)symsgettypeZ star_exprZargumentZchildrenvaluerZclonerNAMEZatomZpower DOUBLESTARrrZLeafSTARextendrr) selfZnodeZresultsrr r r rZ l_newargsr//usr/lib64/python3.6/lib2to3/fixes/fix_apply.py transforms@     zFixApply.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrrrsrN) r rZpgen2rrZ fixer_utilrrrZBaseFixrrrrr s   PK51]̻$__pycache__/fix_apply.cpython-36.pycnu[3 \~ @sRdZddlmZddlmZddlmZddlmZmZm Z Gdddej Z dS) zIFixer for apply(). This converts apply(func, v, k) into (func)(*v, **k).)pytree)token) fixer_base)CallComma parenthesizec@seZdZdZdZddZdS)FixApplyTa. power< 'apply' trailer< '(' arglist< (not argument ')' > > c CsF|j}|st|d}|d}|jd}|r`|j|jjkr>dS|j|jjkr`|jdjdkr`dS|r|j|jjkr|jdjdkrdS|j}|j }|jt j |j fkr|j|j ks|jd jt jkrt|}d|_|j }d|_|dk r|j }d|_tjt jd|g}|dk r8|jttjt jd|gd |d _t|||d S) Nfuncargskwdsz**r* )prefixr)symsAssertionErrorgettypeZ star_exprZargumentZchildrenvaluerZclonerNAMEZatomZpower DOUBLESTARrrZLeafSTARextendrr) selfZnodeZresultsrr r r rZ l_newargsr//usr/lib64/python3.6/lib2to3/fixes/fix_apply.py transformsB     zFixApply.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrrrsrN) __doc__r rZpgen2rrZ fixer_utilrrrZBaseFixrrrrrs    PK51]폏)__pycache__/__init__.cpython-36.opt-1.pycnu[3 \/@sdS)Nrrr./usr/lib64/python3.6/lib2to3/fixes/__init__.pysPK51](__pycache__/fix_raw_input.cpython-36.pycnu[3 \@s2dZddlmZddlmZGdddejZdS)z2Fixer that changes raw_input(...) into input(...).) fixer_base)Namec@seZdZdZdZddZdS) FixRawInputTzU power< name='raw_input' trailer< '(' [any] ')' > any* > cCs |d}|jtd|jddS)Nnameinput)prefix)replacerr)selfZnodeZresultsrr 3/usr/lib64/python3.6/lib2to3/fixes/fix_raw_input.py transformszFixRawInput.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r r r r rsrN)__doc__rZ fixer_utilrZBaseFixrr r r r s  PK51]?dd,__pycache__/fix_renames.cpython-36.opt-2.pycnu[3 \@sRddlmZddlmZmZdddiiZiZddZdd ZGd d d ej Z d S) ) fixer_base)Name attr_chainsysZmaxintmaxsizecCsddjtt|dS)N(|))joinmaprepr)membersr1/usr/lib64/python3.6/lib2to3/fixes/fix_renames.py alternatessrccsbx\ttjD]L\}}xBt|jD]2\}}|t||f<d|||fVd||fVq$WqWdS)Nz import_from< 'from' module_name=%r 'import' ( attr_name=%r | import_as_name< attr_name=%r 'as' any >) > z^ power< module_name=%r trailer< '.' attr_name=%r > any* > )listMAPPINGitemsLOOKUP)modulereplaceZold_attrnew_attrrrr build_patterns  rcs8eZdZdZdjeZdZfddZddZ Z S) FixRenamesTrZprecs@tt|j|}|r5sz#FixRenames.match..parentF)superrranyr)selfnoderesults) __class__)rrr1s zFixRenames.matchcCsD|jd}|jd}|r@|r@t|j|jf}|jt||jddS)NZ module_name attr_name)prefix)getrvaluerrr&)r!r"r#Zmod_namer%rrrr transform>s   zFixRenames.transform) __name__ __module__ __qualname__Z BM_compatibler rZPATTERNorderrr) __classcell__rr)r$rr*s   rN) rZ fixer_utilrrrrrrZBaseFixrrrrr s  PK51]!i +__pycache__/fix_idioms.cpython-36.opt-2.pycnu[3 \ @sJddlmZddlmZmZmZmZmZmZdZ dZ Gdddej Z dS)) fixer_base)CallCommaNameNode BlankLinesymsz0(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)z(power< 'type' trailer< '(' x=any ')' > >csPeZdZdZdeeeefZfddZddZddZ d d Z d d Z Z S) FixIdiomsTa isinstance=comparison< %s %s T=any > | isinstance=comparison< T=any %s %s > | while_stmt< 'while' while='1' ':' any+ > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' power< list='list' trailer< '(' (not arglist) any ')' > > > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' expr=any > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > cs8tt|j|}|r4d|kr4|d|dkr0|SdS|S)NsortedZid1Zid2)superr match)selfnoder) __class__0/usr/lib64/python3.6/lib2to3/fixes/fix_idioms.pyr Os  zFixIdioms.matchcCsHd|kr|j||Sd|kr(|j||Sd|kr<|j||StddS)N isinstancewhiler z Invalid match)transform_isinstancetransform_whiletransform_sort RuntimeError)r rresultsrrr transformZs   zFixIdioms.transformcCsh|dj}|dj}d|_d|_ttd|t|g}d|kr\d|_ttjtd|g}|j|_|S)NxT rnnot)cloneprefixrrrrrZnot_test)r rrrrZtestrrrrds  zFixIdioms.transform_isinstancecCs |d}|jtd|jddS)NrTrue)r")replacerr")r rrZonerrrrpszFixIdioms.transform_whilec Cs|d}|d}|jd}|jd}|r>|jtd|jdn8|rn|j}d|_|jttd|g|jdntd|j|j}d |kr|r|jd d |d jf} d j | |d _n"t } |j j | |jd d | _dS) Nsortnextlistexprr )r"rzshould not have reached here ) getr$rr"r!rrremove rpartitionjoinrparentZ append_child) r rrZ sort_stmtZ next_stmtZ list_callZ simple_exprnewZbtwnZ prefix_linesZend_linerrrrts*   zFixIdioms.transform_sort) __name__ __module__ __qualname__ZexplicitTYPECMPZPATTERNr rrrr __classcell__rr)rrr %s'   r N) rrZ fixer_utilrrrrrrr5r4ZBaseFixr rrrrs  PK51]U-__pycache__/fix_exitfunc.cpython-36.opt-2.pycnu[3 \ @sFddlmZmZddlmZmZmZmZmZm Z Gdddej Z dS))pytree fixer_base)NameAttrCallCommaNewlinesymscs<eZdZdZdZdZfddZfddZddZZ S) FixExitfuncTa ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) cstt|j|dS)N)superr __init__)selfargs) __class__2/usr/lib64/python3.6/lib2to3/fixes/fix_exitfunc.pyr szFixExitfunc.__init__cstt|j||d|_dS)N)r r start_tree sys_import)r Ztreefilename)rrrr!szFixExitfunc.start_treec Cs&d|kr |jdkr|d|_dS|dj}d|_tjtjttdtd}t ||g|j}|j ||jdkr|j |ddS|jj d}|j tjkr|jt|jtddnj|jj}|j j|j}|j} tjtjtd tddg} tjtj| g} |j|dt|j|d | dS) NrfuncatexitregisterzKCan't find sys import; Please add an atexit import at the top of your file. import)rZcloneprefixrZNoder ZpowerrrrreplaceZwarningZchildrentypeZdotted_as_namesZ append_childrparentindexZ import_nameZ simple_stmtZ insert_childr) r ZnodeZresultsrrZcallnamesZcontaining_stmtZpositionZstmt_containerZ new_importnewrrr transform%s2         zFixExitfunc.transform) __name__ __module__ __qualname__Zkeep_line_orderZ BM_compatibleZPATTERNr rr$ __classcell__rr)rrr s   r N) Zlib2to3rrZlib2to3.fixer_utilrrrrrr ZBaseFixr rrrrs PK51]Ⱥ&__pycache__/fix_asserts.cpython-36.pycnu[3 \@sTdZddlmZddlmZedddddd d dddddd d d ZGdddeZdS)z5Fixer that replaces deprecated unittest method names.)BaseFix)NameZ assertTrueZ assertEqualZassertNotEqualZassertAlmostEqualZassertNotAlmostEqualZ assertRegexZassertRaisesRegexZ assertRaisesZ assertFalse)Zassert_Z assertEqualsZassertNotEqualsZassertAlmostEqualsZassertNotAlmostEqualsZassertRegexpMatchesZassertRaisesRegexpZfailUnlessEqualZ failIfEqualZfailUnlessAlmostEqualZfailIfAlmostEqualZ failUnlessZfailUnlessRaisesZfailIfc@s(eZdZddjeeeZddZdS) FixAssertszH power< any+ trailer< '.' meth=(%s)> any* > |cCs,|dd}|jttt||jddS)Nmeth)prefix)replacerNAMESstrr)selfZnodeZresultsnamer1/usr/lib64/python3.6/lib2to3/fixes/fix_asserts.py transform s zFixAsserts.transformN) __name__ __module__ __qualname__joinmapreprr ZPATTERNrrrrrrsrN)__doc__Z fixer_baserZ fixer_utilrdictr rrrrrs$  PK51]"^%$__pycache__/fix_throw.cpython-36.pycnu[3 \.@sZdZddlmZddlmZddlmZddlmZmZm Z m Z m Z Gdddej Z dS) zFixer for generator.throw(E, V, T). g.throw(E) -> g.throw(E) g.throw(E, V) -> g.throw(E(V)) g.throw(E, V, T) -> g.throw(E(V).with_traceback(T)) g.throw("foo"[, V[, T]]) will warn about string exceptions.)pytree)token) fixer_base)NameCallArgListAttris_tuplec@seZdZdZdZddZdS)FixThrowTz power< any trailer< '.' 'throw' > trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > | power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > > c Cs|j}|dj}|jtjkr.|j|ddS|jd}|dkrDdS|j}t|rndd|jdd D}n d|_ |g}|d}d |kr|d j}d|_ t ||} t | t d t |gg} |jtj|j| n|jt ||dS) Nexcz+Python 3 does not support string exceptionsvalcSsg|] }|jqS)clone).0cr r //usr/lib64/python3.6/lib2to3/fixes/fix_throw.py )sz&FixThrow.transform..argstbwith_traceback)symsrtyperSTRINGZcannot_convertgetr ZchildrenprefixrrrrreplacerZNodeZpower) selfZnodeZresultsrr r rZ throw_argsreZwith_tbr r r transforms*      zFixThrow.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr!r r r rr sr N)__doc__rrZpgen2rrZ fixer_utilrrrrr ZBaseFixr r r r rs    PK51]K(__pycache__/fix_itertools.cpython-36.pycnu[3 \ @s2dZddlmZddlmZGdddejZdS)aT Fixer for itertools.(imap|ifilter|izip) --> (map|filter|zip) and itertools.ifilterfalse --> itertools.filterfalse (bugs 2360-2363) imports from itertools are fixed in fix_itertools_import.py If itertools is imported as something else (ie: import itertools as it; it.izip(spam, eggs)) method calls will not get fixed. ) fixer_base)Namec@s*eZdZdZdZdeZdZddZdS) FixItertoolsTz7('imap'|'ifilter'|'izip'|'izip_longest'|'ifilterfalse')z power< it='itertools' trailer< dot='.' func=%(it_funcs)s > trailer< '(' [any] ')' > > | power< func=%(it_funcs)s trailer< '(' [any] ')' > > cCsd}|dd}d|krV|jd krV|d|d}}|j}|j|j|jj||p^|j}|jt|jdd|ddS) Nfuncit ifilterfalse izip_longestdot)prefix)r r )valuer removeparentreplacer)selfZnodeZresultsr rr rr3/usr/lib64/python3.6/lib2to3/fixes/fix_itertools.py transforms    zFixItertools.transformN) __name__ __module__ __qualname__Z BM_compatibleZit_funcslocalsZPATTERNZ run_orderrrrrrrs  rN)__doc__rZ fixer_utilrZBaseFixrrrrrs  PK51]o>+__pycache__/fix_idioms.cpython-36.opt-1.pycnu[3 \ @sNdZddlmZddlmZmZmZmZmZm Z dZ dZ Gdddej Z dS) aAdjust some old Python 2 idioms to their modern counterparts. * Change some type comparisons to isinstance() calls: type(x) == T -> isinstance(x, T) type(x) is T -> isinstance(x, T) type(x) != T -> not isinstance(x, T) type(x) is not T -> not isinstance(x, T) * Change "while 1:" into "while True:". * Change both v = list(EXPR) v.sort() foo(v) and the more general v = EXPR v.sort() foo(v) into v = sorted(EXPR) foo(v) ) fixer_base)CallCommaNameNode BlankLinesymsz0(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)z(power< 'type' trailer< '(' x=any ')' > >csPeZdZdZdeeeefZfddZddZddZ d d Z d d Z Z S) FixIdiomsTa isinstance=comparison< %s %s T=any > | isinstance=comparison< T=any %s %s > | while_stmt< 'while' while='1' ':' any+ > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' power< list='list' trailer< '(' (not arglist) any ')' > > > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' expr=any > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > cs8tt|j|}|r4d|kr4|d|dkr0|SdS|S)NsortedZid1Zid2)superr match)selfnoder) __class__0/usr/lib64/python3.6/lib2to3/fixes/fix_idioms.pyr Os  zFixIdioms.matchcCsHd|kr|j||Sd|kr(|j||Sd|kr<|j||StddS)N isinstancewhiler z Invalid match)transform_isinstancetransform_whiletransform_sort RuntimeError)r rresultsrrr transformZs   zFixIdioms.transformcCsh|dj}|dj}d|_d|_ttd|t|g}d|kr\d|_ttjtd|g}|j|_|S)NxT rnnot)cloneprefixrrrrrZnot_test)r rrrrZtestrrrrds  zFixIdioms.transform_isinstancecCs |d}|jtd|jddS)NrTrue)r")replacerr")r rrZonerrrrpszFixIdioms.transform_whilec Cs|d}|d}|jd}|jd}|r>|jtd|jdn8|rn|j}d|_|jttd|g|jdntd|j|j}d |kr|r|jd d |d jf} d j | |d _n"t } |j j | |jd d | _dS) Nsortnextlistexprr )r"rzshould not have reached here ) getr$rr"r!rrremove rpartitionjoinrparentZ append_child) r rrZ sort_stmtZ next_stmtZ list_callZ simple_exprnewZbtwnZ prefix_linesZend_linerrrrts*   zFixIdioms.transform_sort) __name__ __module__ __qualname__ZexplicitTYPECMPZPATTERNr rrrr __classcell__rr)rrr %s'   r N)__doc__rrZ fixer_utilrrrrrrr5r4ZBaseFixr rrrrs   PK51]ȽHH/__pycache__/fix_xreadlines.cpython-36.opt-1.pycnu[3 \@s2dZddlmZddlmZGdddejZdS)zpFix "for x in f.xreadlines()" -> "for x in f". This fixer will also convert g(f.xreadlines) into g(f.__iter__).) fixer_base)Namec@seZdZdZdZddZdS) FixXreadlinesTz power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | power< any+ trailer< '.' no_call='xreadlines' > > cCs@|jd}|r$|jtd|jdn|jdd|dDdS)Nno_call__iter__)prefixcSsg|] }|jqS)Zclone).0xrr4/usr/lib64/python3.6/lib2to3/fixes/fix_xreadlines.py sz+FixXreadlines.transform..Zcall)getreplacerr)selfZnodeZresultsrrrr transforms zFixXreadlines.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrr r srN)__doc__rZ fixer_utilrZBaseFixrrrrr s  PK51]+8nL +__pycache__/fix_import.cpython-36.opt-2.pycnu[3 \ @sVddlmZddlmZmZmZmZddlmZm Z m Z ddZ Gdddej Z d S) ) fixer_base)dirnamejoinexistssep) FromImportsymstokenccs|g}x|r|j}|jtjkr*|jVq|jtjkrPdjdd|jDVq|jtj krn|j |jdq|jtj kr|j |jdddqt dqWdS)NcSsg|] }|jqS)value).0Zchr r 0/usr/lib64/python3.6/lib2to3/fixes/fix_import.py sz$traverse_imports..rrzunknown node type)poptyper NAMEr r Z dotted_namerchildrenZdotted_as_nameappendZdotted_as_namesextendAssertionError)namespendingnoder r rtraverse_importss     rcs4eZdZdZdZfddZddZddZZS) FixImportTzj import_from< 'from' imp=any 'import' ['('] any [')'] > | import_name< 'import' imp=any > cs"tt|j||d|jk|_dS)NZabsolute_import)superr start_treeZfuture_featuresskip)selfZtreename) __class__r rr/szFixImport.start_treecCs|jr dS|d}|jtjkrZxt|ds6|jd}q W|j|jrd|j|_|jn^d}d}x$t |D]}|j|rd}qld}qlW|r|r|j |ddSt d|g}|j |_ |SdS)Nimpr r.FTz#absolute and local imports together) r rr Z import_fromhasattrrprobably_a_local_importr ZchangedrZwarningrprefix)r!rZresultsr$Z have_localZ have_absoluteZmod_namenewr r r transform3s,        zFixImport.transformcCsv|jdrdS|jddd}t|j}t||}ttt|dsHdSx(dtddd d gD]}t||rZd SqZWdS) Nr%Frz __init__.pyz.pyz.pycz.soz.slz.pydT) startswithsplitrfilenamerrr)r!Zimp_name base_pathZextr r rr'Us    z!FixImport.probably_a_local_import) __name__ __module__ __qualname__Z BM_compatibleZPATTERNrr*r' __classcell__r r )r#rr&s  "rN)r rZos.pathrrrrZ fixer_utilrr r rZBaseFixrr r r rs PK51]6#3ll)__pycache__/fix_long.cpython-36.opt-2.pycnu[3 \@s.ddlmZddlmZGdddejZdS)) fixer_base)is_probably_builtinc@seZdZdZdZddZdS)FixLongTz'long'cCst|rd|_|jdS)Nint)rvalueZchanged)selfZnodeZresultsr./usr/lib64/python3.6/lib2to3/fixes/fix_long.py transformszFixLong.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrr r srN)Zlib2to3rZlib2to3.fixer_utilrZBaseFixrrrrr s  PK51]نuu+__pycache__/fix_intern.cpython-36.opt-1.pycnu[3 \@s6dZddlmZddlmZmZGdddejZdS)z/Fixer for intern(). intern(s) -> sys.intern(s)) fixer_base) ImportAndCall touch_importc@s eZdZdZdZdZddZdS) FixInternTZprez power< 'intern' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > cCsd|rD|d}|rD|j|jjkr"dS|j|jjkrD|jdjdkrDdSd}t|||}tdd||S)Nobjz**sysintern)rr )typeZsymsZ star_exprZargumentZchildrenvaluerr)selfZnodeZresultsrnamesnewr0/usr/lib64/python3.6/lib2to3/fixes/fix_intern.py transforms  zFixIntern.transformN)__name__ __module__ __qualname__Z BM_compatibleorderZPATTERNrrrrrr s rN)__doc__rZ fixer_utilrrZBaseFixrrrrrs PK51]ȽHH)__pycache__/fix_xreadlines.cpython-36.pycnu[3 \@s2dZddlmZddlmZGdddejZdS)zpFix "for x in f.xreadlines()" -> "for x in f". This fixer will also convert g(f.xreadlines) into g(f.__iter__).) fixer_base)Namec@seZdZdZdZddZdS) FixXreadlinesTz power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | power< any+ trailer< '.' no_call='xreadlines' > > cCs@|jd}|r$|jtd|jdn|jdd|dDdS)Nno_call__iter__)prefixcSsg|] }|jqS)Zclone).0xrr4/usr/lib64/python3.6/lib2to3/fixes/fix_xreadlines.py sz+FixXreadlines.transform..Zcall)getreplacerr)selfZnodeZresultsrrrr transforms zFixXreadlines.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrr r srN)__doc__rZ fixer_utilrZBaseFixrrrrr s  PK51]qXF&__pycache__/fix_renames.cpython-36.pycnu[3 \@sVdZddlmZddlmZmZdddiiZiZddZd d Z Gd d d ej Z d S)z?Fix incompatible renames Fixes: * sys.maxint -> sys.maxsize ) fixer_base)Name attr_chainsysZmaxintmaxsizecCsddjtt|dS)N(|))joinmaprepr)membersr1/usr/lib64/python3.6/lib2to3/fixes/fix_renames.py alternatessrccsbx\ttjD]L\}}xBt|jD]2\}}|t||f<d|||fVd||fVq$WqWdS)Nz import_from< 'from' module_name=%r 'import' ( attr_name=%r | import_as_name< attr_name=%r 'as' any >) > z^ power< module_name=%r trailer< '.' attr_name=%r > any* > )listMAPPINGitemsLOOKUP)modulereplaceZold_attrnew_attrrrr build_patterns  rcs8eZdZdZdjeZdZfddZddZ Z S) FixRenamesTrZprecs@tt|j|}|r5sz#FixRenames.match..parentF)superrranyr)selfnoderesults) __class__)rrr1s zFixRenames.matchcCsD|jd}|jd}|r@|r@t|j|jf}|jt||jddS)NZ module_name attr_name)prefix)getrvaluerrr&)r!r"r#Zmod_namer%rrrr transform>s   zFixRenames.transform) __name__ __module__ __qualname__Z BM_compatibler rZPATTERNorderrr) __classcell__rr)r$rr*s   rN) __doc__rZ fixer_utilrrrrrrZBaseFixrrrrrs  PK51]/Za)__pycache__/fix_repr.cpython-36.opt-2.pycnu[3 \e@s6ddlmZddlmZmZmZGdddejZdS)) fixer_base)CallName parenthesizec@seZdZdZdZddZdS)FixReprTz7 atom < '`' expr=any '`' > cCs8|dj}|j|jjkr"t|}ttd|g|jdS)Nexprrepr)prefix)ZclonetypeZsymsZ testlist1rrrr )selfZnodeZresultsrr ./usr/lib64/python3.6/lib2to3/fixes/fix_repr.py transforms zFixRepr.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrr r r r r srN)rZ fixer_utilrrrZBaseFixrr r r r s PK51]9ss*__pycache__/fix_apply.cpython-36.opt-1.pycnu[3 \~ @sRdZddlmZddlmZddlmZddlmZmZm Z Gdddej Z dS) zIFixer for apply(). This converts apply(func, v, k) into (func)(*v, **k).)pytree)token) fixer_base)CallComma parenthesizec@seZdZdZdZddZdS)FixApplyTa. power< 'apply' trailer< '(' arglist< (not argument ')' > > c Cs>|j}|d}|d}|jd}|rX|j|jjkr6dS|j|jjkrX|jdjdkrXdS|r~|j|jjkr~|jdjdkr~dS|j}|j}|jt j |j fkr|j|j ks|jd jt j krt|}d|_|j}d|_|dk r|j}d|_tjt jd|g}|dk r0|jttjt j d|gd |d _t|||d S) Nfuncargskwdsz**r* )prefixr)symsgettypeZ star_exprZargumentZchildrenvaluerZclonerNAMEZatomZpower DOUBLESTARrrZLeafSTARextendrr) selfZnodeZresultsrr r r rZ l_newargsr//usr/lib64/python3.6/lib2to3/fixes/fix_apply.py transforms@     zFixApply.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrrrsrN) __doc__r rZpgen2rrZ fixer_utilrrrZBaseFixrrrrrs    PK51]l5 5 ,__pycache__/fix_has_key.cpython-36.opt-1.pycnu[3 \| @sBdZddlmZddlmZddlmZmZGdddejZdS)a&Fixer for has_key(). Calls to .has_key() methods are expressed in terms of the 'in' operator: d.has_key(k) -> k in d CAVEATS: 1) While the primary target of this fixer is dict.has_key(), the fixer will change any has_key() method call, regardless of its class. 2) Cases like this will not be converted: m = d.has_key if m(k): ... Only *calls* to has_key() are converted. While it is possible to convert the above to something like m = d.__contains__ if m(k): ... this is currently not done. )pytree) fixer_base)Name parenthesizec@seZdZdZdZddZdS) FixHasKeyTa anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > after=any* > | negation=not_test< 'not' anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > > > c Cs||j}|jj|jkr&|jj|jr&dS|jd}|d}|j}dd|dD}|dj}|jd} | rxdd| D} |j|j |j|j |j |j |j |jfkrt|}t|d kr|d }ntj|j|}d |_td d d } |rtdd d } tj|j| | f} tj|j || |f} | r8t| } tj|j| ft| } |jj|j |j|j|j|j|j|j|j|jf krrt| } || _| S)NnegationanchorcSsg|] }|jqS)clone).0nr r 1/usr/lib64/python3.6/lib2to3/fixes/fix_has_key.py Rsz'FixHasKey.transform..beforeargaftercSsg|] }|jqSr )r )r r r r r rVs in)prefixnot)symsparenttypeZnot_testpatternmatchgetrr Z comparisonZand_testZor_testZtestZlambdefZargumentrlenrZNodeZpowerrZcomp_optupleexprZxor_exprZand_exprZ shift_exprZ arith_exprZtermZfactor) selfZnodeZresultsrrrrrrrZn_opZn_notnewr r r transformGsD       zFixHasKey.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr#r r r r r&srN) __doc__rrZ fixer_utilrrZBaseFixrr r r r s  PK51]^\.__pycache__/fix_raw_input.cpython-36.opt-2.pycnu[3 \@s.ddlmZddlmZGdddejZdS)) fixer_base)Namec@seZdZdZdZddZdS) FixRawInputTzU power< name='raw_input' trailer< '(' [any] ')' > any* > cCs |d}|jtd|jddS)Nnameinput)prefix)replacerr)selfZnodeZresultsrr 3/usr/lib64/python3.6/lib2to3/fixes/fix_raw_input.py transformszFixRawInput.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r r r r rsrN)rZ fixer_utilrZBaseFixrr r r r s  PK51]rD*__pycache__/fix_methodattrs.cpython-36.pycnu[3 \^@s>dZddlmZddlmZddddZGdd d ejZd S) z;Fix bound method attributes (method.im_? -> method.__?__). ) fixer_base)Name__func____self__z__self__.__class__)Zim_funcZim_selfZim_classc@seZdZdZdZddZdS)FixMethodattrsTzU power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > cCs.|dd}t|j}|jt||jddS)Nattr)prefix)MAPvaluereplacerr )selfZnodeZresultsrnewr5/usr/lib64/python3.6/lib2to3/fixes/fix_methodattrs.py transforms  zFixMethodattrs.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrrrsrN)__doc__rZ fixer_utilrr ZBaseFixrrrrrs   PK51]> %__pycache__/fix_future.cpython-36.pycnu[3 \#@s2dZddlmZddlmZGdddejZdS)zVRemove __future__ imports from __future__ import foo is replaced with an empty line. ) fixer_base) BlankLinec@s eZdZdZdZdZddZdS) FixFutureTz;import_from< 'from' module_name="__future__" 'import' any > cCst}|j|_|S)N)rprefix)selfZnodeZresultsnewr 0/usr/lib64/python3.6/lib2to3/fixes/fix_future.py transformszFixFuture.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZ run_orderr r r r r r srN)__doc__rZ fixer_utilrZBaseFixrr r r r s  PK51]&Fam,__pycache__/fix_getcwdu.cpython-36.opt-1.pycnu[3 \@s2dZddlmZddlmZGdddejZdS)z1 Fixer that changes os.getcwdu() to os.getcwd(). ) fixer_base)Namec@seZdZdZdZddZdS) FixGetcwduTzR power< 'os' trailer< dot='.' name='getcwdu' > any* > cCs |d}|jtd|jddS)Nnamegetcwd)prefix)replacerr)selfZnodeZresultsrr 1/usr/lib64/python3.6/lib2to3/fixes/fix_getcwdu.py transformszFixGetcwdu.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r r r r r srN)__doc__rZ fixer_utilrZBaseFixrr r r r s  PK51]Ȍ %__pycache__/fix_import.cpython-36.pycnu[3 \ @sZdZddlmZddlmZmZmZmZddlm Z m Z m Z ddZ Gdd d ej Zd S) zFixer for import statements. If spam is being imported from the local directory, this import: from spam import eggs Becomes: from .spam import eggs And this import: import spam Becomes: from . import spam ) fixer_base)dirnamejoinexistssep) FromImportsymstokenccs|g}x|r|j}|jtjkr*|jVq|jtjkrPdjdd|jDVq|jtj krn|j |jdq|jtj kr|j |jdddqt dqWdS) zF Walks over all the names imported in a dotted_as_names node. cSsg|] }|jqS)value).0Zchr r 0/usr/lib64/python3.6/lib2to3/fixes/fix_import.py sz$traverse_imports..rNrzunknown node type)poptyper NAMEr r Z dotted_namerchildrenZdotted_as_nameappendZdotted_as_namesextendAssertionError)namespendingnoder r rtraverse_importss     rcs4eZdZdZdZfddZddZddZZS) FixImportTzj import_from< 'from' imp=any 'import' ['('] any [')'] > | import_name< 'import' imp=any > cs"tt|j||d|jk|_dS)NZabsolute_import)superr start_treeZfuture_featuresskip)selfZtreename) __class__r rr/szFixImport.start_treecCs|jr dS|d}|jtjkrZxt|ds6|jd}q W|j|jrd|j|_|jn^d}d}x$t |D]}|j|rd}qld}qlW|r|r|j |ddSt d|g}|j |_ |SdS)Nimpr r.FTz#absolute and local imports together) r rr Z import_fromhasattrrprobably_a_local_importr ZchangedrZwarningrprefix)r!rZresultsr$Z have_localZ have_absoluteZmod_namenewr r r transform3s,        zFixImport.transformcCsv|jdrdS|jddd}t|j}t||}ttt|dsHdSx(dtddd d gD]}t||rZd SqZWdS) Nr%Frz __init__.pyz.pyz.pycz.soz.slz.pydT) startswithsplitrfilenamerrr)r!Zimp_name base_pathZextr r rr'Us    z!FixImport.probably_a_local_import) __name__ __module__ __qualname__Z BM_compatibleZPATTERNrr*r' __classcell__r r )r#rr&s  "rN)__doc__r rZos.pathrrrrZ fixer_utilrr r rZBaseFixrr r r r s  PK51]>GG0__pycache__/fix_methodattrs.cpython-36.opt-2.pycnu[3 \^@s:ddlmZddlmZddddZGdddejZd S) ) fixer_base)Name__func____self__z__self__.__class__)Zim_funcZim_selfZim_classc@seZdZdZdZddZdS)FixMethodattrsTzU power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > cCs.|dd}t|j}|jt||jddS)Nattr)prefix)MAPvaluereplacerr )selfZnodeZresultsrnewr5/usr/lib64/python3.6/lib2to3/fixes/fix_methodattrs.py transforms  zFixMethodattrs.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrrrsrN)rZ fixer_utilrr ZBaseFixrrrrrs  PK51]5ڍ_ "__pycache__/fix_map.cpython-36.pycnu[3 \8@sfdZddlmZddlmZddlmZmZmZm Z m Z ddl m Z ddlmZGdddejZd S) aFixer that changes map(F, ...) into list(map(F, ...)) unless there exists a 'from future_builtins import map' statement in the top-level namespace. As a special case, map(None, X) is changed into list(X). (This is necessary because the semantics are changed in this case -- the new map(None, X) is equivalent to [(x,) for x in X].) We avoid the transformation (except for the special case mentioned above) if the map() call is directly contained in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. NOTE: This is still not correct if the original code was depending on map(F, X, Y, ...) to go on until the longest argument is exhausted, substituting None for missing values -- like zip(), it now stops as soon as the shortest argument is exhausted. )token) fixer_base)NameArgListCallListCompin_special_context)python_symbols)Nodec@s eZdZdZdZdZddZdS)FixMapTaL map_none=power< 'map' trailer< '(' arglist< 'None' ',' arg=any [','] > ')' > [extra_trailers=trailer*] > | map_lambda=power< 'map' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > [extra_trailers=trailer*] > | power< 'map' args=trailer< '(' [any] ')' > [extra_trailers=trailer*] > zfuture_builtins.mapcCs|j|rdSg}d|kr:x|dD]}|j|jq$W|jjtjkrv|j|d|j}d|_t t d|g}n&d|krt |dj|dj|dj}t tj |g|dd }nd |kr|d j}d|_nd |krj|d }|jtjkrL|jd jtjkrL|jd jdjtjkrL|jd jdjdkrL|j|ddSt tj t d|jg}d|_t|rxdSt tj t dt|gg|}d|_|j|_|S)NZextra_trailerszYou should use a for loop herelistZ map_lambdaZxpfpit)prefixZmap_noneargargsNonezjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequencemap)Z should_skipappendZcloneparenttypesymsZ simple_stmtZwarningrrrrr ZpowerZtrailerZchildrenZarglistrNAMEvaluerr)selfZnodeZresultsZtrailerstnewrr -/usr/lib64/python3.6/lib2to3/fixes/fix_map.py transform@sF        zFixMap.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZskip_onr"r r r r!r sr N)__doc__Zpgen2rr rZ fixer_utilrrrrrZpygramr rZpytreer ZConditionalFixr r r r r!s     PK51]T|1__pycache__/fix_tuple_params.cpython-36.opt-1.pycnu[3 \@sdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z ddZ Gdd d ejZd d Zd d ZgdfddZddZdS)a:Fixer for function definitions with tuple parameters. def func(((a, b), c), d): ... -> def func(x, d): ((a, b), c) = x ... It will also support lambdas: lambda (x, y): x + y -> lambda t: t[0] + t[1] # The parens are a syntax error in Python 3 lambda (x): x + y -> lambda x: x + y )pytree)token) fixer_base)AssignNameNewlineNumber SubscriptsymscCst|tjo|jdjtjkS)N) isinstancerNodechildrentyperSTRING)stmtr6/usr/lib64/python3.6/lib2to3/fixes/fix_tuple_params.py is_docstrings rc@s(eZdZdZdZdZddZddZdS) FixTupleParamsTa funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > c sd|krj||Sg|d}|d}|djdjtjkrZd}|djdj}tnd}d}tjtjddfd d }|jt j kr||n@|jt j krx2t |jD]$\}} | jt j kr|| |dkd qWsdSxD]} |d| _ qW|} |dkrd d_n&t|dj|r8|d_|d} xD]} |d| _ q>W|dj| | <x4t| d| tdD]}||dj|_qW|djdS)Nlambdasuiteargsr rz; Fcs\tj}|j}d|_t||j}|r2d|_|j|jtjt j |jgdS)Nr ) rnew_namecloneprefixrreplaceappendrr r Z simple_stmt)Z tuple_arg add_prefixnargr)end new_linesselfrr handle_tupleCs   z.FixTupleParams.transform..handle_tuple)r"r)F)transform_lambdarrrINDENTvaluerrZLeafr ZtfpdefZ typedargslist enumerateparentrrrangelenZchanged) r'noderesultsrrstartindentr(ir$lineafterr)r%r&r'r transform.sF           zFixTupleParams.transformc Cs|d}|d}t|d}|jtjkrD|j}d|_|j|dSt|}t|}|j t |}t |dd} |j| jxd|j D]X} | jtjkr| j |krdd|| j D} tjtj| jg| } | j| _| j| qWdS)Nrbodyinnerr)rcSsg|] }|jqSr)r).0crrr sz3FixTupleParams.transform_lambda..) simplify_argsrrNAMErrr find_params map_to_indexr tuple_namerZ post_orderr+rr r Zpower) r'r0r1rr8r9ZparamsZto_indexZtup_nameZ new_paramr#Z subscriptsnewrrrr)ns(    zFixTupleParams.transform_lambdaN)__name__ __module__ __qualname__Z run_orderZ BM_compatibleZPATTERNr7r)rrrrrs  @rcCsR|jtjtjfkr|S|jtjkrBx|jtjkr<|jd}q$W|Std|dS)NrzReceived unexpected node %s)rr Zvfplistrr>vfpdefr RuntimeError)r0rrrr=s r=cCs<|jtjkrt|jdS|jtjkr,|jSdd|jDS)NrcSs g|]}|jtjkrt|qSr)rrCOMMAr?)r:r;rrrr<szfind_params..)rr rFr?rrr>r+)r0rrrr?s   r?NcCs^|dkr i}xLt|D]@\}}ttt|g}t|trJt|||dq||||<qW|S)N)d)r,r rstrr listr@) param_listrrIr4objZtrailerrrrr@s r@cCs@g}x0|D](}t|tr(|jt|q |j|q Wdj|S)N_)r rKr!rAjoin)rLlrMrrrrAs   rA)__doc__rrZpgen2rrZ fixer_utilrrrrr r rZBaseFixrr=r?r@rArrrrs    l  PK51]#*__pycache__/fix_numliterals.cpython-36.pycnu[3 \@s>dZddlmZddlmZddlmZGdddejZdS)z-Fixer that turns 1L into 1, 0755 into 0o755. )token) fixer_base)Numberc@s"eZdZejZddZddZdS)FixNumliteralscCs|jjdp|jddkS)N0Ll)value startswith)selfnoder5/usr/lib64/python3.6/lib2to3/fixes/fix_numliterals.pymatchszFixNumliterals.matchcCs`|j}|ddkr |dd}n2|jdrR|jrRtt|dkrRd|dd}t||jdS)NrrrZ0o)prefixr r )r r isdigitlensetrr)r r Zresultsvalrrr transforms  "zFixNumliterals.transformN)__name__ __module__ __qualname__rNUMBERZ _accept_typerrrrrrr srN) __doc__Zpgen2rrZ fixer_utilrZBaseFixrrrrrs   PK51]qXF,__pycache__/fix_renames.cpython-36.opt-1.pycnu[3 \@sVdZddlmZddlmZmZdddiiZiZddZd d Z Gd d d ej Z d S)z?Fix incompatible renames Fixes: * sys.maxint -> sys.maxsize ) fixer_base)Name attr_chainsysZmaxintmaxsizecCsddjtt|dS)N(|))joinmaprepr)membersr1/usr/lib64/python3.6/lib2to3/fixes/fix_renames.py alternatessrccsbx\ttjD]L\}}xBt|jD]2\}}|t||f<d|||fVd||fVq$WqWdS)Nz import_from< 'from' module_name=%r 'import' ( attr_name=%r | import_as_name< attr_name=%r 'as' any >) > z^ power< module_name=%r trailer< '.' attr_name=%r > any* > )listMAPPINGitemsLOOKUP)modulereplaceZold_attrnew_attrrrr build_patterns  rcs8eZdZdZdjeZdZfddZddZ Z S) FixRenamesTrZprecs@tt|j|}|r5sz#FixRenames.match..parentF)superrranyr)selfnoderesults) __class__)rrr1s zFixRenames.matchcCsD|jd}|jd}|r@|r@t|j|jf}|jt||jddS)NZ module_name attr_name)prefix)getrvaluerrr&)r!r"r#Zmod_namer%rrrr transform>s   zFixRenames.transform) __name__ __module__ __qualname__Z BM_compatibler rZPATTERNorderrr) __classcell__rr)r$rr*s   rN) __doc__rZ fixer_utilrrrrrrZBaseFixrrrrrs  PK51]T|+__pycache__/fix_tuple_params.cpython-36.pycnu[3 \@sdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z ddZ Gdd d ejZd d Zd d ZgdfddZddZdS)a:Fixer for function definitions with tuple parameters. def func(((a, b), c), d): ... -> def func(x, d): ((a, b), c) = x ... It will also support lambdas: lambda (x, y): x + y -> lambda t: t[0] + t[1] # The parens are a syntax error in Python 3 lambda (x): x + y -> lambda x: x + y )pytree)token) fixer_base)AssignNameNewlineNumber SubscriptsymscCst|tjo|jdjtjkS)N) isinstancerNodechildrentyperSTRING)stmtr6/usr/lib64/python3.6/lib2to3/fixes/fix_tuple_params.py is_docstrings rc@s(eZdZdZdZdZddZddZdS) FixTupleParamsTa funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > c sd|krj||Sg|d}|d}|djdjtjkrZd}|djdj}tnd}d}tjtjddfd d }|jt j kr||n@|jt j krx2t |jD]$\}} | jt j kr|| |dkd qWsdSxD]} |d| _ qW|} |dkrd d_n&t|dj|r8|d_|d} xD]} |d| _ q>W|dj| | <x4t| d| tdD]}||dj|_qW|djdS)Nlambdasuiteargsr rz; Fcs\tj}|j}d|_t||j}|r2d|_|j|jtjt j |jgdS)Nr ) rnew_namecloneprefixrreplaceappendrr r Z simple_stmt)Z tuple_arg add_prefixnargr)end new_linesselfrr handle_tupleCs   z.FixTupleParams.transform..handle_tuple)r"r)F)transform_lambdarrrINDENTvaluerrZLeafr ZtfpdefZ typedargslist enumerateparentrrrangelenZchanged) r'noderesultsrrstartindentr(ir$lineafterr)r%r&r'r transform.sF           zFixTupleParams.transformc Cs|d}|d}t|d}|jtjkrD|j}d|_|j|dSt|}t|}|j t |}t |dd} |j| jxd|j D]X} | jtjkr| j |krdd|| j D} tjtj| jg| } | j| _| j| qWdS)Nrbodyinnerr)rcSsg|] }|jqSr)r).0crrr sz3FixTupleParams.transform_lambda..) simplify_argsrrNAMErrr find_params map_to_indexr tuple_namerZ post_orderr+rr r Zpower) r'r0r1rr8r9ZparamsZto_indexZtup_nameZ new_paramr#Z subscriptsnewrrrr)ns(    zFixTupleParams.transform_lambdaN)__name__ __module__ __qualname__Z run_orderZ BM_compatibleZPATTERNr7r)rrrrrs  @rcCsR|jtjtjfkr|S|jtjkrBx|jtjkr<|jd}q$W|Std|dS)NrzReceived unexpected node %s)rr Zvfplistrr>vfpdefr RuntimeError)r0rrrr=s r=cCs<|jtjkrt|jdS|jtjkr,|jSdd|jDS)NrcSs g|]}|jtjkrt|qSr)rrCOMMAr?)r:r;rrrr<szfind_params..)rr rFr?rrr>r+)r0rrrr?s   r?NcCs^|dkr i}xLt|D]@\}}ttt|g}t|trJt|||dq||||<qW|S)N)d)r,r rstrr listr@) param_listrrIr4objZtrailerrrrr@s r@cCs@g}x0|D](}t|tr(|jt|q |j|q Wdj|S)N_)r rKr!rAjoin)rLlrMrrrrAs   rA)__doc__rrZpgen2rrZ fixer_utilrrrrr r rZBaseFixrr=r?r@rArrrrs    l  PK51]*wGV*__pycache__/fix_print.cpython-36.opt-2.pycnu[3 \ @shddlmZddlmZddlmZddlmZddlmZmZm Z m Z ej dZ Gdddej Zd S) )patcomp)pytree)token) fixer_base)NameCallCommaStringz"atom< '(' [atom|STRING|NAME] ')' >c@s$eZdZdZdZddZddZdS)FixPrintTzP simple_stmt< any* bare='print' any* > | print_stmt c Cs`|jd}|r,|jttdg|jddS|jdd}t|dkrXtj|drXdSd}}}|r|dt kr|dd}d}|r|dt j t j dkr|dj}|dd}d d |D}|rd |d_|dk s|dk s|dk rF|dk r|j|d tt||dk r.|j|d tt||dk rF|j|d|ttd|} |j| _| S)NZbareprint)prefix z>>cSsg|] }|jqS)clone).0argrr//usr/lib64/python3.6/lib2to3/fixes/fix_print.py ?sz&FixPrint.transform..sependfiler)getreplacerrr Zchildrenlen parend_exprmatchrrLeafr RIGHTSHIFTr add_kwargr repr) selfZnodeZresultsZ bare_printargsrrrZl_argsZn_stmtrrr transform%s8          zFixPrint.transformcCsNd|_tj|jjt|tjtjd|f}|r@|j t d|_|j |dS)Nr=r) r rZNodeZsymsZargumentrr!rEQUALappendr)r%Zl_nodesZs_kwdZn_exprZ n_argumentrrrr#Ms   zFixPrint.add_kwargN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr'r#rrrrr s(r N)rrrZpgen2rrZ fixer_utilrrrr Zcompile_patternrZBaseFixr rrrrs    PK51] W@'__pycache__/fix_imports2.cpython-36.pycnu[3 \!@s0dZddlmZdddZGdddejZdS)zTFix incompatible imports and module references that must be fixed after fix_imports.) fix_importsZdbm)ZwhichdbZanydbmc@seZdZdZeZdS) FixImports2N)__name__ __module__ __qualname__Z run_orderMAPPINGmappingr r 2/usr/lib64/python3.6/lib2to3/fixes/fix_imports2.pyr srN)__doc__rrZ FixImportsrr r r r s PK51]g2.__pycache__/fix_itertools.cpython-36.opt-2.pycnu[3 \ @s.ddlmZddlmZGdddejZdS)) fixer_base)Namec@s*eZdZdZdZdeZdZddZdS) FixItertoolsTz7('imap'|'ifilter'|'izip'|'izip_longest'|'ifilterfalse')z power< it='itertools' trailer< dot='.' func=%(it_funcs)s > trailer< '(' [any] ')' > > | power< func=%(it_funcs)s trailer< '(' [any] ')' > > cCsd}|dd}d|krV|jd krV|d|d}}|j}|j|j|jj||p^|j}|jt|jdd|ddS) Nfuncit ifilterfalse izip_longestdot)prefix)r r )valuer removeparentreplacer)selfZnodeZresultsr rr rr3/usr/lib64/python3.6/lib2to3/fixes/fix_itertools.py transforms    zFixItertools.transformN) __name__ __module__ __qualname__Z BM_compatibleZit_funcslocalsZPATTERNZ run_orderrrrrrrs  rN)rZ fixer_utilrZBaseFixrrrrr s  PK51]k/*__pycache__/fix_types.cpython-36.opt-1.pycnu[3 \@spdZddlmZddlmZddddddd d d d d d ddddddddddZddeDZGdddejZdS)aFixer for removing uses of the types module. These work for only the known names in the types module. The forms above can include types. or not. ie, It is assumed the module is imported either as: import types from types import ... # either * or specific types The import statements are not modified. There should be another fixer that handles at least the following constants: type([]) -> list type(()) -> tuple type('') -> str ) fixer_base)Namebool memoryviewtypecomplexdictztype(Ellipsis)floatintlistobjectz type(None)ztype(NotImplemented)slicebytesz(str,)tuplestrrange)Z BooleanTypeZ BufferTypeZ ClassTypeZ ComplexTypeZDictTypeZDictionaryTypeZ EllipsisTypeZ FloatTypeZIntTypeZListTypeZLongTypeZ ObjectTypeZNoneTypeZNotImplementedTypeZ SliceTypeZ StringTypeZ StringTypesZ TupleTypeZTypeTypeZ UnicodeTypeZ XRangeTypecCsg|] }d|qS)z)power< 'types' trailer< '.' name='%s' > >).0trr//usr/lib64/python3.6/lib2to3/fixes/fix_types.py 3src@s"eZdZdZdjeZddZdS)FixTypesT|cCs&tj|dj}|r"t||jdSdS)Nname)prefix) _TYPE_MAPPINGgetvaluerr)selfZnodeZresultsZ new_valuerrr transform9szFixTypes.transformN)__name__ __module__ __qualname__Z BM_compatiblejoin_patsZPATTERNrrrrrr5s rN) __doc__rZ fixer_utilrrr$ZBaseFixrrrrrs2  PK51]8ڒ!__pycache__/fix_ne.cpython-36.pycnu[3 \;@s>dZddlmZddlmZddlmZGdddejZdS)zFixer that turns <> into !=.)pytree)token) fixer_basec@s"eZdZejZddZddZdS)FixNecCs |jdkS)Nz<>)value)selfnoder ,/usr/lib64/python3.6/lib2to3/fixes/fix_ne.pymatchsz FixNe.matchcCstjtjd|jd}|S)Nz!=)prefix)rZLeafrNOTEQUALr )rrZresultsnewr r r transformszFixNe.transformN)__name__ __module__ __qualname__rr Z _accept_typer rr r r r r srN)__doc__rZpgen2rrZBaseFixrr r r r s   PK51])__pycache__/fix_basestring.cpython-36.pycnu[3 \@@s2dZddlmZddlmZGdddejZdS)zFixer for basestring -> str.) fixer_base)Namec@seZdZdZdZddZdS) FixBasestringTz 'basestring'cCstd|jdS)Nstr)prefix)rr)selfZnodeZresultsr4/usr/lib64/python3.6/lib2to3/fixes/fix_basestring.py transform szFixBasestring.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrr rsrN)__doc__rZ fixer_utilrZBaseFixrrrrr s  PK51]C,__pycache__/fix_sys_exc.cpython-36.opt-2.pycnu[3 \ @sFddlmZddlmZmZmZmZmZmZm Z Gdddej Z dS)) fixer_base)AttrCallNameNumber SubscriptNodesymsc@s:eZdZdddgZdZddjddeDZd d Zd S) FixSysExcexc_type exc_value exc_tracebackTzN power< 'sys' trailer< dot='.' attribute=(%s) > > |ccs|]}d|VqdS)z'%s'N).0err1/usr/lib64/python3.6/lib2to3/fixes/fix_sys_exc.py szFixSysExc.cCst|dd}t|jj|j}ttd|jd}ttd|}|dj|djd_|j t |t t j ||jdS)NZ attributeexc_info)prefixsysdot)rrindexvaluerrrrZchildrenappendrrr Zpower)selfZnodeZresultsZsys_attrrZcallattrrrr transforms zFixSysExc.transformN)__name__ __module__ __qualname__rZ BM_compatiblejoinZPATTERNrrrrrr s r N) rZ fixer_utilrrrrrrr ZBaseFixr rrrr s $PK51]8`0__pycache__/fix_set_literal.cpython-36.opt-1.pycnu[3 \@s:dZddlmZmZddlmZmZGdddejZdS)z: Optional fixer to transform set() calls to set literals. ) fixer_basepytree)tokensymsc@s eZdZdZdZdZddZdS) FixSetLiteralTajpower< 'set' trailer< '(' (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) > | single=any) ']' > | atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > ) ')' > > c Cs|jd}|r2tjtj|jg}|j||}n|d}tjtj dg}|j dd|j D|j tjtj d|jj|d _tjtj|}|j|_t|j dkr|j d }|j|j|j d _|S) Nsingleitems{css|]}|jVqdS)N)clone).0nr 5/usr/lib64/python3.6/lib2to3/fixes/fix_set_literal.py 'sz*FixSetLiteral.transform..}r)getrZNoderZ listmakerr replaceZLeafrLBRACEextendZchildrenappendRBRACEZ next_siblingprefixZ dictsetmakerlenremove) selfZnodeZresultsrZfakerliteralZmakerr r r r transforms"   zFixSetLiteral.transformN)__name__ __module__ __qualname__Z BM_compatibleZexplicitZPATTERNr r r r rr s rN) __doc__Zlib2to3rrZlib2to3.fixer_utilrrZBaseFixrr r r rsPK51]w"__pycache__/fix_zip.cpython-36.pycnu[3 \ @sRdZddlmZddlmZddlmZddlm Z m Z m Z Gdddej Z dS) a7 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 <>:. ) fixer_base)Node)python_symbols)NameArgListin_special_contextc@s eZdZdZdZdZddZdS)FixZipTzN power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*] > zfuture_builtins.zipcCs|j|rdSt|rdS|dj}d|_g}d|kr^dd|dD}x|D] }d|_qPWttjtd|gdd}ttjtdt|gg|}|j|_|S) NargstrailerscSsg|] }|jqS)clone).0nr r -/usr/lib64/python3.6/lib2to3/fixes/fix_zip.py 'sz$FixZip.transform..zip)prefixlist) Z should_skiprr rrsymsZpowerrr)selfZnodeZresultsr r rnewr r r transforms    zFixZip.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZskip_onrr r r rrsrN)__doc__r rZpytreerZpygramrrZ fixer_utilrrrZConditionalFixrr r r rs    PK51]2__pycache__/fix_standarderror.cpython-36.opt-2.pycnu[3 \@s.ddlmZddlmZGdddejZdS)) fixer_base)Namec@seZdZdZdZddZdS)FixStandarderrorTz- 'StandardError' cCstd|jdS)N Exception)prefix)rr)selfZnodeZresultsr7/usr/lib64/python3.6/lib2to3/fixes/fix_standarderror.py transformszFixStandarderror.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrr r srN)rZ fixer_utilrZBaseFixrrrrr s  PK51]{4&__pycache__/fix_nonzero.cpython-36.pycnu[3 \O@s2dZddlmZddlmZGdddejZdS)z*Fixer for __nonzero__ -> __bool__ methods.) fixer_base)Namec@seZdZdZdZddZdS) FixNonzeroTz classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='__nonzero__' parameters< '(' NAME ')' > any+ > any* > > cCs$|d}td|jd}|j|dS)Nname__bool__)prefix)rrreplace)selfZnodeZresultsrnewr 1/usr/lib64/python3.6/lib2to3/fixes/fix_nonzero.py transformszFixNonzero.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r r r r rsrN)__doc__rZ fixer_utilrZBaseFixrr r r r s  PK51]4PXX+__pycache__/fix_filter.cpython-36.opt-2.pycnu[3 \[ @sRddlmZddlmZddlmZddlmZm Z m Z m Z Gdddej Z dS)) fixer_base)Node)python_symbols)NameArgListListCompin_special_contextc@s eZdZdZdZdZddZdS) FixFilterTaV filter_lambda=power< 'filter' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > [extra_trailers=trailer*] > | power< 'filter' trailer< '(' arglist< none='None' ',' seq=any > ')' > [extra_trailers=trailer*] > | power< 'filter' args=trailer< '(' [any] ')' > [extra_trailers=trailer*] > zfuture_builtins.filtercCs2|j|rdSg}d|kr:x|dD]}|j|jq$Wd|krt|jdj|jdj|jdj|jdj}ttj|g|dd}nd|krttd td |d jtd }ttj|g|dd}nTt |rdS|d j}ttjtd |gdd}ttjtd t |gg|}d|_ |j |_ |S)NZextra_trailersZ filter_lambdafpitZxp)prefixZnoneZ_fseqargsfilterlist) Z should_skipappendZclonergetrsymsZpowerrrrr )selfZnodeZresultsZtrailerstnewrr0/usr/lib64/python3.6/lib2to3/fixes/fix_filter.py transform:s4      zFixFilter.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZskip_onrrrrrr sr N)r rZpytreerZpygramrrZ fixer_utilrrrrZConditionalFixr rrrrs   PK51]Yٜxx-__pycache__/fix_operator.cpython-36.opt-1.pycnu[3 \ @sNdZddlZddlmZddlmZmZmZmZddZ Gdddej Z dS) aFixer for operator functions. operator.isCallable(obj) -> hasattr(obj, '__call__') operator.sequenceIncludes(obj) -> operator.contains(obj) operator.isSequenceType(obj) -> isinstance(obj, collections.Sequence) operator.isMappingType(obj) -> isinstance(obj, collections.Mapping) operator.isNumberType(obj) -> isinstance(obj, numbers.Number) operator.repeat(obj, n) -> operator.mul(obj, n) operator.irepeat(obj, n) -> operator.imul(obj, n) N) fixer_base)CallNameString touch_importcsfdd}|S)Ncs |_|S)N) invocation)f)s2/usr/lib64/python3.6/lib2to3/fixes/fix_operator.pydecszinvocation..decr )r r r )r r rs rc@seZdZdZdZdZdZdeeedZddZ e d d d Z e d d dZ e dddZ e dddZe dddZe dddZe dddZddZd d!Zd"d#Zd$S)% FixOperatorTZprez method=('isCallable'|'sequenceIncludes' |'isSequenceType'|'isMappingType'|'isNumberType' |'repeat'|'irepeat') z'(' obj=any ')'z power< module='operator' trailer< '.' %(methods)s > trailer< %(obj)s > > | power< %(methods)s trailer< %(obj)s > > )methodsobjcCs"|j||}|dk r|||SdS)N) _check_method)selfnoderesultsmethodr r r transform+s zFixOperator.transformzoperator.contains(%s)cCs|j||dS)Ncontains)_handle_rename)rrrr r r _sequenceIncludes0szFixOperator._sequenceIncludeszhasattr(%s, '__call__')cCs2|d}|jtdtdg}ttd||jdS)Nrz, z '__call__'hasattr)prefix)clonerrrr)rrrrargsr r r _isCallable4szFixOperator._isCallablezoperator.mul(%s)cCs|j||dS)Nmul)r)rrrr r r _repeat:szFixOperator._repeatzoperator.imul(%s)cCs|j||dS)Nimul)r)rrrr r r _irepeat>szFixOperator._irepeatz$isinstance(%s, collections.Sequence)cCs|j||ddS)N collectionsSequence)_handle_type2abc)rrrr r r _isSequenceTypeBszFixOperator._isSequenceTypez#isinstance(%s, collections.Mapping)cCs|j||ddS)Nr"Mapping)r$)rrrr r r _isMappingTypeFszFixOperator._isMappingTypezisinstance(%s, numbers.Number)cCs|j||ddS)NZnumbersNumber)r$)rrrr r r _isNumberTypeJszFixOperator._isNumberTypecCs|dd}||_|jdS)Nrr)valueZchanged)rrrnamerr r r rNs zFixOperator._handle_renamecCsFtd|||d}|jtddj||gg}ttd||jdS)Nrz, . isinstance)r)rrrjoinrrr)rrrmoduleabcrrr r r r$Ss zFixOperator._handle_type2abccCs\t|d|ddj}t|tjrXd|kr0|St|df}|j|}|j|d|dS)N_rrr/rzYou should use '%s' here.)getattrr*r-r"CallablestrrZwarning)rrrrsubZinvocation_strr r r rYs  zFixOperator._check_methodN)__name__ __module__ __qualname__Z BM_compatibleorderrrdictZPATTERNrrrrrr!r%r'r)rr$rr r r r r s r ) __doc__r"Zlib2to3rZlib2to3.fixer_utilrrrrrZBaseFixr r r r r  s  PK51] 'O!.__pycache__/fix_funcattrs.cpython-36.opt-1.pycnu[3 \@s2dZddlmZddlmZGdddejZdS)z3Fix function attribute names (f.func_x -> f.__x__).) fixer_base)Namec@seZdZdZdZddZdS) FixFuncattrsTz power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' | 'func_dict') > any* > cCs2|dd}|jtd|jdd|jddS)Nattrz__%s__)prefix)replacervaluer)selfZnodeZresultsrr 3/usr/lib64/python3.6/lib2to3/fixes/fix_funcattrs.py transforms zFixFuncattrs.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrr r r r r srN)__doc__rZ fixer_utilrZBaseFixrr r r r s  PK51]8`*__pycache__/fix_set_literal.cpython-36.pycnu[3 \@s:dZddlmZmZddlmZmZGdddejZdS)z: Optional fixer to transform set() calls to set literals. ) fixer_basepytree)tokensymsc@s eZdZdZdZdZddZdS) FixSetLiteralTajpower< 'set' trailer< '(' (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) > | single=any) ']' > | atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > ) ')' > > c Cs|jd}|r2tjtj|jg}|j||}n|d}tjtj dg}|j dd|j D|j tjtj d|jj|d _tjtj|}|j|_t|j dkr|j d }|j|j|j d _|S) Nsingleitems{css|]}|jVqdS)N)clone).0nr 5/usr/lib64/python3.6/lib2to3/fixes/fix_set_literal.py 'sz*FixSetLiteral.transform..}r)getrZNoderZ listmakerr replaceZLeafrLBRACEextendZchildrenappendRBRACEZ next_siblingprefixZ dictsetmakerlenremove) selfZnodeZresultsrZfakerliteralZmakerr r r r transforms"   zFixSetLiteral.transformN)__name__ __module__ __qualname__Z BM_compatibleZexplicitZPATTERNr r r r rr s rN) __doc__Zlib2to3rrZlib2to3.fixer_utilrrZBaseFixrr r r rsPK51]ZO#/KK,__pycache__/fix_nonzero.cpython-36.opt-2.pycnu[3 \O@s.ddlmZddlmZGdddejZdS)) fixer_base)Namec@seZdZdZdZddZdS) FixNonzeroTz classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='__nonzero__' parameters< '(' NAME ')' > any+ > any* > > cCs$|d}td|jd}|j|dS)Nname__bool__)prefix)rrreplace)selfZnodeZresultsrnewr 1/usr/lib64/python3.6/lib2to3/fixes/fix_nonzero.py transformszFixNonzero.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r r r r rsrN)rZ fixer_utilrZBaseFixrr r r r s  PK51]3\\*__pycache__/fix_input.cpython-36.opt-2.pycnu[3 \@sHddlmZddlmZmZddlmZejdZGdddejZ dS)) fixer_base)CallName)patcompz&power< 'eval' trailer< '(' any ')' > >c@seZdZdZdZddZdS)FixInputTzL power< 'input' args=trailer< '(' [any] ')' > > cCs6tj|jjrdS|j}d|_ttd|g|jdS)Neval)prefix)contextmatchparentZcloner rr)selfZnodeZresultsnewr//usr/lib64/python3.6/lib2to3/fixes/fix_input.py transforms zFixInput.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrrr srN) rrZ fixer_utilrrrZcompile_patternr ZBaseFixrrrrrs   PK51]&Fam&__pycache__/fix_getcwdu.cpython-36.pycnu[3 \@s2dZddlmZddlmZGdddejZdS)z1 Fixer that changes os.getcwdu() to os.getcwd(). ) fixer_base)Namec@seZdZdZdZddZdS) FixGetcwduTzR power< 'os' trailer< dot='.' name='getcwdu' > any* > cCs |d}|jtd|jddS)Nnamegetcwd)prefix)replacerr)selfZnodeZresultsrr 1/usr/lib64/python3.6/lib2to3/fixes/fix_getcwdu.py transformszFixGetcwdu.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r r r r r srN)__doc__rZ fixer_utilrZBaseFixrr r r r s  PK51]A uu%__pycache__/fix_reload.cpython-36.pycnu[3 \@s6dZddlmZddlmZmZGdddejZdS)z/Fixer for reload(). reload(s) -> imp.reload(s)) fixer_base) ImportAndCall touch_importc@s eZdZdZdZdZddZdS) FixReloadTZprez power< 'reload' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > cCsd|rD|d}|rD|j|jjkr"dS|j|jjkrD|jdjdkrDdSd}t|||}tdd||S)Nobjz**impreload)rr )typeZsymsZ star_exprZargumentZchildrenvaluerr)selfZnodeZresultsrnamesnewr0/usr/lib64/python3.6/lib2to3/fixes/fix_reload.py transforms  zFixReload.transformN)__name__ __module__ __qualname__Z BM_compatibleorderZPATTERNrrrrrr s rN)__doc__rZ fixer_utilrrZBaseFixrrrrrs PK51] OO+__pycache__/fix_urllib.cpython-36.opt-1.pycnu[3 \ @sdZddlmZmZddlmZmZmZmZm Z m Z m Z dddddd d d d gfd dddddddddddddddgfddgfgdd dd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5gfdd6d7gfgd8Z e d9j e d:d;dd?d?eZd@S)AzFix changes imports of urllib which are now incompatible. This is rather similar to fix_imports, but because of the more complex nature of the fixing for urllib, it has its own fixer. ) alternates FixImports)NameComma FromImportNewlinefind_indentationNodesymszurllib.requestZ URLopenerZFancyURLopenerZ urlretrieveZ _urlopenerZurlopenZ urlcleanupZ pathname2urlZ url2pathnamez urllib.parseZquoteZ quote_plusZunquoteZ unquote_plusZ urlencodeZ splitattrZ splithostZ splitnportZ splitpasswdZ splitportZ splitqueryZsplittagZ splittypeZ splituserZ splitvaluez urllib.errorZContentTooShortErrorZinstall_openerZ build_openerZRequestZOpenerDirectorZ BaseHandlerZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZ ProxyHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZ HTTPHandlerZ HTTPSHandlerZ FileHandlerZ FTPHandlerZCacheFTPHandlerZUnknownHandlerZURLErrorZ HTTPError)urlliburllib2r r ccs~t}xrtjD]f\}}x\|D]T}|\}}t|}d||fVd|||fVd|Vd|Vd||fVqWqWdS)Nzimport_name< 'import' (module=%r | dotted_as_names< any* module=%r any* >) > zimport_from< 'from' mod_member=%r 'import' ( member=%s | import_as_name< member=%s 'as' any > | import_as_names< members=any* >) > zIimport_from< 'from' module_star=%r 'import' star='*' > ztimport_name< 'import' dotted_as_name< module_as=%r 'as' any > > zKpower< bare_with_attr=%r trailer< '.' member=%s > any* > )setMAPPINGitemsr)ZbareZ old_moduleZchangeschangeZ new_modulemembersr0/usr/lib64/python3.6/lib2to3/fixes/fix_urllib.py build_pattern0s   rc@s4eZdZddZddZddZddZd d Zd S) FixUrllibcCs djtS)N|)joinr)selfrrrrIszFixUrllib.build_patterncCsz|jd}|j}g}x6t|jddD] }|jt|d|dtgq(W|jtt|jdd|d|j|dS)zTransform for the basic import case. Replaces the old import name with a comma separated list of its replacements. moduleNr r)prefixr) getrrvalueextendrrappendreplace)rnoderesultsZ import_modprefnamesnamerrrtransform_importLs   zFixUrllib.transform_importcCs>|jd}|j}|jd}|rt|tr0|d}d}x*t|jD]}|j|dkr@|d}Pq@W|rx|jt||dn |j|dng}i} |d} x| D]}|j t j kr|j d j} |j dj} n |j} d} | d krxPt|jD]B}| |dkr|d| kr|j |d| j|dgj |qWqWg} t|}d }d d }x|D]}| |}g}x2|ddD]"}|j||||j tqlW|j||d|t||}| s|jjj|r||_| j |d}qNW| r.g}x&| ddD]}|j|tgqW|j | d|j|n |j|ddS)zTransform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module. mod_membermemberrNr )rz!This is an invalid module elementr,TcSsX|jtjkrHt|jdj|d|jdj|jdjg}ttj|gSt|j|dgS)Nr)rr r*)typer import_as_namerchildrenrZcloner )r&rZkidsrrr handle_names   z/FixUrllib.transform_member..handle_nameFzAll module elements are invalidrrrr)rr isinstancelistrrr!rcannot_convertr,r r-r.r setdefaultrrrrparentendswithr)rr"r#r(r$r)new_namermodulesZmod_dictrZas_name member_nameZ new_nodesZ indentationfirstr/rZeltsr%ZeltnewZnodesZnew_noderrrtransform_member\sh            zFixUrllib.transform_membercCs|jd}|jd}d}t|tr*|d}x*t|jD]}|j|dkr6|d}Pq6W|rp|jt||jdn |j|ddS)z.Transform for calls to module members in code.bare_with_attrr)Nrr )rz!This is an invalid module element) rr0r1rrr!rrr2)rr"r#Z module_dotr)r6rrrr transform_dots   zFixUrllib.transform_dotcCsz|jdr|j||n^|jdr0|j||nF|jdrH|j||n.|jdr`|j|dn|jdrv|j|ddS)Nrr(r<Z module_starzCannot handle star imports.Z module_asz#This module is now multiple modules)rr'r;r=r2)rr"r#rrr transforms     zFixUrllib.transformN)__name__ __module__ __qualname__rr'r;r=r>rrrrrGs LrN)__doc__Zlib2to3.fixes.fix_importsrrZlib2to3.fixer_utilrrrrrr r rr rrrrrrs@$ PK51]Ⱥ,__pycache__/fix_asserts.cpython-36.opt-1.pycnu[3 \@sTdZddlmZddlmZedddddd d dddddd d d ZGdddeZdS)z5Fixer that replaces deprecated unittest method names.)BaseFix)NameZ assertTrueZ assertEqualZassertNotEqualZassertAlmostEqualZassertNotAlmostEqualZ assertRegexZassertRaisesRegexZ assertRaisesZ assertFalse)Zassert_Z assertEqualsZassertNotEqualsZassertAlmostEqualsZassertNotAlmostEqualsZassertRegexpMatchesZassertRaisesRegexpZfailUnlessEqualZ failIfEqualZfailUnlessAlmostEqualZfailIfAlmostEqualZ failUnlessZfailUnlessRaisesZfailIfc@s(eZdZddjeeeZddZdS) FixAssertszH power< any+ trailer< '.' meth=(%s)> any* > |cCs,|dd}|jttt||jddS)Nmeth)prefix)replacerNAMESstrr)selfZnodeZresultsnamer1/usr/lib64/python3.6/lib2to3/fixes/fix_asserts.py transform s zFixAsserts.transformN) __name__ __module__ __qualname__joinmapreprr ZPATTERNrrrrrrsrN)__doc__Z fixer_baserZ fixer_utilrdictr rrrrrs$  PK51].]55+__pycache__/fix_intern.cpython-36.opt-2.pycnu[3 \@s2ddlmZddlmZmZGdddejZdS)) fixer_base) ImportAndCall touch_importc@s eZdZdZdZdZddZdS) FixInternTZprez power< 'intern' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > cCsd|rD|d}|rD|j|jjkr"dS|j|jjkrD|jdjdkrDdSd}t|||}tdd||S)Nobjz**sysintern)rr )typeZsymsZ star_exprZargumentZchildrenvaluerr)selfZnodeZresultsrnamesnewr0/usr/lib64/python3.6/lib2to3/fixes/fix_intern.py transforms  zFixIntern.transformN)__name__ __module__ __qualname__Z BM_compatibleorderZPATTERNrrrrrr s rN)rZ fixer_utilrrZBaseFixrrrrr s PK51]Zq )__pycache__/fix_dict.cpython-36.opt-1.pycnu[3 \@sjdZddlmZddlmZddlmZddlmZmZmZddlmZej dhBZ Gdd d ej Z d S) ajFixer for dict methods. d.keys() -> list(d.keys()) d.items() -> list(d.items()) d.values() -> list(d.values()) d.iterkeys() -> iter(d.keys()) d.iteritems() -> iter(d.items()) d.itervalues() -> iter(d.values()) d.viewkeys() -> d.keys() d.viewitems() -> d.items() d.viewvalues() -> d.values() Except in certain very specific contexts: the iter() can be dropped when the context is list(), sorted(), iter() or for...in; the list() can be dropped when the context is list() or sorted() (but not iter() or for...in!). Special contexts that apply to both: list(), sorted(), tuple() set(), any(), all(), sum(). Note: iter(d.keys()) could be written as iter(d) but since the original d.iterkeys() was also redundant we don't fix this. And there are (rare) contexts where it makes a difference (e.g. when passing it as an argument to a function that introspects the argument). )pytree)patcomp) fixer_base)NameCallDot) fixer_utiliterc@s@eZdZdZdZddZdZejeZ dZ eje Z ddZ d S) FixDictTa power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues'| 'viewkeys'|'viewitems'|'viewvalues') > parens=trailer< '(' ')' > tail=any* > c Cs|d}|dd}|d}|j}|j}|jd}|jd} |sD| rP|dd}dd |D}d d |D}| o||j||} |tj|jtt||j d g|d j g} tj|j | } | p| sd | _ t t|rdnd| g} |rtj|j | g|} |j | _ | S)Nheadmethodtailr ZviewcSsg|] }|jqS)clone).0nrr./usr/lib64/python3.6/lib2to3/fixes/fix_dict.py Asz%FixDict.transform..cSsg|] }|jqSr)r)rrrrrrBs)prefixZparenslist) symsvalue startswithin_special_contextrZNodeZtrailerrrrrZpowerr) selfnoderesultsr r rrZ method_nameisiterZisviewZspecialargsnewrrr transform6s2      zFixDict.transformz3power< func=NAME trailer< '(' node=any ')' > any* >zmfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > cCs|jdkrdSi}|jjdk r^|jj|jj|r^|d|kr^|rN|djtkS|djtjkS|sfdS|jj|j|o|d|kS)NFrfunc)parentp1matchr iter_exemptrconsuming_callsp2)rrr rrrrrZs   zFixDict.in_special_contextN) __name__ __module__ __qualname__Z BM_compatibleZPATTERNr#ZP1rZcompile_patternr&ZP2r*rrrrrr )s   r N) __doc__rrrrrrrrr)r(ZBaseFixr rrrrs     PK51] W@-__pycache__/fix_imports2.cpython-36.opt-1.pycnu[3 \!@s0dZddlmZdddZGdddejZdS)zTFix incompatible imports and module references that must be fixed after fix_imports.) fix_importsZdbm)ZwhichdbZanydbmc@seZdZdZeZdS) FixImports2N)__name__ __module__ __qualname__Z run_orderMAPPINGmappingr r 2/usr/lib64/python3.6/lib2to3/fixes/fix_imports2.pyr srN)__doc__rrZ FixImportsrr r r r s PK51]tҵ0,__pycache__/fix_asserts.cpython-36.opt-2.pycnu[3 \@sPddlmZddlmZeddddddd dddddd d d ZGd ddeZdS))BaseFix)NameZ assertTrueZ assertEqualZassertNotEqualZassertAlmostEqualZassertNotAlmostEqualZ assertRegexZassertRaisesRegexZ assertRaisesZ assertFalse)Zassert_Z assertEqualsZassertNotEqualsZassertAlmostEqualsZassertNotAlmostEqualsZassertRegexpMatchesZassertRaisesRegexpZfailUnlessEqualZ failIfEqualZfailUnlessAlmostEqualZfailIfAlmostEqualZ failUnlessZfailUnlessRaisesZfailIfc@s(eZdZddjeeeZddZdS) FixAssertszH power< any+ trailer< '.' meth=(%s)> any* > |cCs,|dd}|jttt||jddS)Nmeth)prefix)replacerNAMESstrr)selfZnodeZresultsnamer1/usr/lib64/python3.6/lib2to3/fixes/fix_asserts.py transform s zFixAsserts.transformN) __name__ __module__ __qualname__joinmapreprr ZPATTERNrrrrrrsrN)Z fixer_baserZ fixer_utilrdictr rrrrrs"  PK51]/__pycache__/fix_basestring.cpython-36.opt-1.pycnu[3 \@@s2dZddlmZddlmZGdddejZdS)zFixer for basestring -> str.) fixer_base)Namec@seZdZdZdZddZdS) FixBasestringTz 'basestring'cCstd|jdS)Nstr)prefix)rr)selfZnodeZresultsr4/usr/lib64/python3.6/lib2to3/fixes/fix_basestring.py transform szFixBasestring.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrr rsrN)__doc__rZ fixer_utilrZBaseFixrrrrr s  PK51]a;888#__pycache__/fix_repr.cpython-36.pycnu[3 \e@s:dZddlmZddlmZmZmZGdddejZdS)z/Fixer that transforms `xyzzy` into repr(xyzzy).) fixer_base)CallName parenthesizec@seZdZdZdZddZdS)FixReprTz7 atom < '`' expr=any '`' > cCs8|dj}|j|jjkr"t|}ttd|g|jdS)Nexprrepr)prefix)ZclonetypeZsymsZ testlist1rrrr )selfZnodeZresultsrr ./usr/lib64/python3.6/lib2to3/fixes/fix_repr.py transforms zFixRepr.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrr r r r r srN) __doc__rZ fixer_utilrrrZBaseFixrr r r r s PK51]y #__pycache__/fix_next.cpython-36.pycnu[3 \f @sndZddlmZddlmZddlmZddlm Z m Z m Z dZ Gdddej Zd d Zd d Zd dZdS)z.Fixer for it.next() -> next(it), per PEP 3114.)token)python_symbols) fixer_base)NameCall find_bindingz;Calls to builtin next() possibly shadowed by global bindingcs0eZdZdZdZdZfddZddZZS)FixNextTa power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > > | power< head=any+ trailer< '.' attr='next' > not trailer< '(' ')' > > | classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='next' parameters< '(' NAME ')' > any+ > any* > > | global=global_stmt< 'global' any* 'next' any* > Zprecs>tt|j||td|}|r4|j|td|_nd|_dS)NnextTF)superr start_treerwarning bind_warning shadowed_next)selfZtreefilenamen) __class__./usr/lib64/python3.6/lib2to3/fixes/fix_next.pyr $s   zFixNext.start_treecCs|st|jd}|jd}|jd}|rz|jrF|jtd|jdn2dd|D}d|d _|jttd |jd|n|rtd|jd}|j|nl|rt|r|d }djd d|Dj d kr|j |t dS|jtdnd|kr|j |t d|_dS)Nbaseattrname__next__)prefixcSsg|] }|jqSr)Zclone).0rrrr 9sz%FixNext.transform..r headcSsg|] }t|qSr)str)rrrrrrEsZ __builtin__globalT) AssertionErrorgetrreplacerrris_assign_targetjoinstripr r )rnodeZresultsrrrrrrrr transform.s.        zFixNext.transform) __name__ __module__ __qualname__Z BM_compatibleZPATTERNorderr r( __classcell__rr)rrrs  rcCsFt|}|dkrdSx,|jD]"}|jtjkr0dSt||rdSqWdS)NFT) find_assignchildrentyperEQUAL is_subtree)r'ZassignZchildrrrr$Qs   r$cCs4|jtjkr|S|jtjks&|jdkr*dSt|jS)N)r0symsZ expr_stmtZ simple_stmtparentr.)r'rrrr.]s  r.cs$|kr dStfdd|jDS)NTc3s|]}t|VqdS)N)r2)rc)r'rr gszis_subtree..)anyr/)rootr'r)r'rr2dsr2N)__doc__Zpgen2rZpygramrr3rrZ fixer_utilrrrr ZBaseFixrr$r.r2rrrrs   @ PK51]O %__pycache__/fix_xrange.cpython-36.pycnu[3 \ @sFdZddlmZddlmZmZmZddlmZGdddejZ dS)z/Fixer that changes xrange(...) into range(...).) fixer_base)NameCallconsuming_calls)patcompcsheZdZdZdZfddZddZddZd d Zd d Z d Z e j e Z dZe j eZddZZS) FixXrangeTz power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > cstt|j||t|_dS)N)superr start_treesettransformed_xranges)selftreefilename) __class__0/usr/lib64/python3.6/lib2to3/fixes/fix_xrange.pyr szFixXrange.start_treecCs d|_dS)N)r )r r rrrr finish_treeszFixXrange.finish_treecCsD|d}|jdkr|j||S|jdkr4|j||Stt|dS)NnameZxrangerange)valuetransform_xrangetransform_range ValueErrorrepr)r noderesultsrrrr transforms     zFixXrange.transformcCs0|d}|jtd|jd|jjt|dS)Nrr)prefix)replacerrr addid)r rrrrrrr$szFixXrange.transform_xrangecCslt||jkrh|j| rhttd|djg}ttd|g|jd}x|dD]}|j|qRW|SdS)Nrargslist)rrest)r r in_special_contextrrZclonerZ append_child)r rrZ range_callZ list_callnrrrr*s   zFixXrange.transform_rangez3power< func=NAME trailer< '(' node=any ')' > any* >zfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > | comparison< any 'in' node=any any*> cCsf|jdkrdSi}|jjdk rJ|jj|jj|rJ|d|krJ|djtkS|jj|j|od|d|kS)NFrfunc)parentp1matchrrp2)r rrrrrr$?s   zFixXrange.in_special_context)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrrZP1rZcompile_patternr(ZP2r*r$ __classcell__rr)rrr s     rN) __doc__rZ fixer_utilrrrrZBaseFixrrrrrs  PK51]A uu+__pycache__/fix_reload.cpython-36.opt-1.pycnu[3 \@s6dZddlmZddlmZmZGdddejZdS)z/Fixer for reload(). reload(s) -> imp.reload(s)) fixer_base) ImportAndCall touch_importc@s eZdZdZdZdZddZdS) FixReloadTZprez power< 'reload' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > cCsd|rD|d}|rD|j|jjkr"dS|j|jjkrD|jdjdkrDdSd}t|||}tdd||S)Nobjz**impreload)rr )typeZsymsZ star_exprZargumentZchildrenvaluerr)selfZnodeZresultsrnamesnewr0/usr/lib64/python3.6/lib2to3/fixes/fix_reload.py transforms  zFixReload.transformN)__name__ __module__ __qualname__Z BM_compatibleorderZPATTERNrrrrrr s rN)__doc__rZ fixer_utilrrZBaseFixrrrrrs PK51]R2P9+__pycache__/fix_future.cpython-36.opt-2.pycnu[3 \#@s.ddlmZddlmZGdddejZdS)) fixer_base) BlankLinec@s eZdZdZdZdZddZdS) FixFutureTz;import_from< 'from' module_name="__future__" 'import' any > cCst}|j|_|S)N)rprefix)selfZnodeZresultsnewr 0/usr/lib64/python3.6/lib2to3/fixes/fix_future.py transformszFixFuture.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZ run_orderr r r r r r srN)rZ fixer_utilrZBaseFixrr r r r s  PK51]j,__pycache__/fix_unicode.cpython-36.opt-1.pycnu[3 \@s<dZddlmZddlmZdddZGdddejZd S) zFixer for unicode. * Changes unicode to str and unichr to chr. * If "...\u..." is not unicode literal change it into "...\\u...". * Change u"..." into "...". )token) fixer_basechrstr)ZunichrZunicodecs,eZdZdZdZfddZddZZS) FixUnicodeTzSTRING | 'unicode' | 'unichr'cs"tt|j||d|jk|_dS)Nunicode_literals)superr start_treeZfuture_featuresr)selfZtreefilename) __class__1/usr/lib64/python3.6/lib2to3/fixes/fix_unicode.pyr szFixUnicode.start_treecCs|jtjkr$|j}t|j|_|S|jtjkr|j}|j rl|ddkrld|krldjdd|j dD}|ddkr|dd}||jkr|S|j}||_|SdS) Nz'"\z\\cSs g|]}|jddjddqS)z\uz\\uz\Uz\\U)replace).0vr r r !sz(FixUnicode.transform..ZuU) typerNAMEZclone_mappingvalueSTRINGrjoinsplit)r ZnodeZresultsnewvalr r r transforms"      zFixUnicode.transform)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r __classcell__r r )r rrs rN)__doc__Zpgen2rrrZBaseFixrr r r r s   PK51]9z$__pycache__/fix_input.cpython-36.pycnu[3 \@sLdZddlmZddlmZmZddlmZejdZGdddej Z dS) z4Fixer that changes input(...) into eval(input(...)).) fixer_base)CallName)patcompz&power< 'eval' trailer< '(' any ')' > >c@seZdZdZdZddZdS)FixInputTzL power< 'input' args=trailer< '(' [any] ')' > > cCs6tj|jjrdS|j}d|_ttd|g|jdS)Neval)prefix)contextmatchparentZcloner rr)selfZnodeZresultsnewr//usr/lib64/python3.6/lib2to3/fixes/fix_input.py transforms zFixInput.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrrr srN) __doc__rrZ fixer_utilrrrZcompile_patternr ZBaseFixrrrrrs    PK51]rD0__pycache__/fix_methodattrs.cpython-36.opt-1.pycnu[3 \^@s>dZddlmZddlmZddddZGdd d ejZd S) z;Fix bound method attributes (method.im_? -> method.__?__). ) fixer_base)Name__func____self__z__self__.__class__)Zim_funcZim_selfZim_classc@seZdZdZdZddZdS)FixMethodattrsTzU power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > cCs.|dd}t|j}|jt||jddS)Nattr)prefix)MAPvaluereplacerr )selfZnodeZresultsrnewr5/usr/lib64/python3.6/lib2to3/fixes/fix_methodattrs.py transforms  zFixMethodattrs.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrrrsrN)__doc__rZ fixer_utilrr ZBaseFixrrrrrs   PK51]Ndd&__pycache__/fix_sys_exc.cpython-36.pycnu[3 \ @sJdZddlmZddlmZmZmZmZmZm Z m Z Gdddej Z dS)zFixer for sys.exc_{type, value, traceback} sys.exc_type -> sys.exc_info()[0] sys.exc_value -> sys.exc_info()[1] sys.exc_traceback -> sys.exc_info()[2] ) fixer_base)AttrCallNameNumber SubscriptNodesymsc@s:eZdZdddgZdZddjddeDZd d Zd S) FixSysExcexc_type exc_value exc_tracebackTzN power< 'sys' trailer< dot='.' attribute=(%s) > > |ccs|]}d|VqdS)z'%s'N).0err1/usr/lib64/python3.6/lib2to3/fixes/fix_sys_exc.py szFixSysExc.cCst|dd}t|jj|j}ttd|jd}ttd|}|dj|djd_|j t |t t j ||jdS)NZ attributeexc_info)prefixsysdot)rrindexvaluerrrrZchildrenappendrrr Zpower)selfZnodeZresultsZsys_attrrZcallattrrrr transforms zFixSysExc.transformN)__name__ __module__ __qualname__rZ BM_compatiblejoinZPATTERNrrrrrr s r N) __doc__rZ fixer_utilrrrrrrr ZBaseFixr rrrrs $PK51].__pycache__/fix_raw_input.cpython-36.opt-1.pycnu[3 \@s2dZddlmZddlmZGdddejZdS)z2Fixer that changes raw_input(...) into input(...).) fixer_base)Namec@seZdZdZdZddZdS) FixRawInputTzU power< name='raw_input' trailer< '(' [any] ')' > any* > cCs |d}|jtd|jddS)Nnameinput)prefix)replacerr)selfZnodeZresultsrr 3/usr/lib64/python3.6/lib2to3/fixes/fix_raw_input.py transformszFixRawInput.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r r r r rsrN)__doc__rZ fixer_utilrZBaseFixrr r r r s  PK51]w2l.__pycache__/fix_metaclass.cpython-36.opt-1.pycnu[3 \ @svdZddlmZddlmZddlmZmZmZddZ ddZ d d Z d d Z d dZ ddZGdddejZdS)aFixer for __metaclass__ = X -> (metaclass=X) methods. The various forms of classef (inherits nothing, inherits once, inherints many) don't parse the same in the CST so we look at ALL classes for a __metaclass__ and if we find one normalize the inherits to all be an arglist. For one-liner classes ('class X: pass') there is no indent/dedent so we normalize those into having a suite. Moving the __metaclass__ into the classdef can also cause the class body to be empty so there is some special casing for that as well. This fixer also tries very hard to keep original indenting and spacing in all those corner cases. ) fixer_base)token)symsNodeLeafcCsxxr|jD]h}|jtjkr t|S|jtjkr|jr|jd}|jtjkr|jr|jd}t|tr|j dkrdSqWdS)z we have to check the cls_node without changing it. There are two possibilities: 1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta') 2) clsdef => simple_stmt => expr_stmt => Leaf('__meta') __metaclass__TF) childrentypersuite has_metaclass simple_stmt expr_stmt isinstancervalue)parentnode expr_nodeZ left_sider3/usr/lib64/python3.6/lib2to3/fixes/fix_metaclass.pyr s      r cCsx|jD]}|jtjkrdSqWx,t|jD]\}}|jtjkr,Pq,Wtdttjg}x:|j|ddr|j|d}|j |j |j q\W|j ||}dS)zf one-line classes don't get a suite in the parse tree so we add one to normalize the tree NzNo class suite and no ':'!) r r rr enumeraterCOLON ValueErrorr append_childcloneremove)cls_noderir move_noderrrfixup_parse_tree-s      r c Csx(t|jD]\}}|jtjkr Pq WdS|jttjg}ttj |g}x2|j|dr~|j|}|j |j |jqNW|j |||jdjd}|jdjd} | j |_ dS)z if there is a semi-colon all the parts count as part of the same simple_stmt. We just want the __metaclass__ part so we move everything after the semi-colon into its own simple_stmt node Nr)rr r rSEMIrrrrr rr insert_childprefix) rrZ stmt_nodeZsemi_indrZnew_exprZnew_stmtrZ new_leaf1Z old_leaf1rrrfixup_simple_stmtGs     r$cCs*|jr&|jdjtjkr&|jdjdS)Nrr%)r r rNEWLINEr)rrrrremove_trailing_newline_sr'ccsx$|jD]}|jtjkrPqWtdxtt|jD]t\}}|jtjkr6|jr6|jd}|jtjkr6|jr6|jd}t |t r6|j dkr6t |||t ||||fVq6WdS)NzNo class suite!rr)r r rr rlistrr rrrrr$r')rrrZ simple_noderZ left_noderrr find_metasds       r)cCs|jddd}x|r.|j}|jtjkrPqWxL|r||j}t|trd|jtjkrd|jr`d|_dS|j |jdddq2WdS)z If an INDENT is followed by a thing with a prefix then nuke the prefix Otherwise we get in trouble when removing __metaclass__ at suite start Nrr%r%) r popr rINDENTrrDEDENTr#extend)r Zkidsrrrr fixup_indent{s r/c@seZdZdZdZddZdS) FixMetaclassTz classdef cCs<t|s dSt|d}x"t|D]\}}}|}|jq"W|jdj}t|jdkr|jdjtjkrt|jd}n(|jdj } t tj| g}|j d|nt|jdkrt tjg}|j d|nZt|jdkrt tjg}|j dt tjd|j d||j dt tjdntd |jdjd} d | _| j} |jr^|jt tjd d | _nd | _|jd} d | jd_d | jd_|j|t||js|jt |d} | | _|j| |jt tjdnbt|jdkr8|jdjtjkr8|jdjtjkr8t |d} |j d| |j dt tjddS)Nrr)(zUnexpected class definition metaclass, r*rpass r%r%r%)r r r)rr r lenrarglistrrZ set_childr"rrRPARLPARrrr#rCOMMAr/r&r,r-)selfrZresultsZlast_metaclassr rZstmtZ text_typer>rZmeta_txtZorig_meta_prefixrZ pass_leafrrr transforms^              zFixMetaclass.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrCrrrrr0sr0N)__doc__r*rZpygramrZ fixer_utilrrrr r r$r'r)r/ZBaseFixr0rrrrs  PK51]G$ $ +__pycache__/fix_filter.cpython-36.opt-1.pycnu[3 \[ @sVdZddlmZddlmZddlmZddlm Z m Z m Z m Z Gdddej ZdS) aFixer that changes filter(F, X) into list(filter(F, X)). We avoid the transformation if the filter() call is directly contained in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. NOTE: This is still not correct if the original code was depending on filter(F, X) to return a string if X is a string and a tuple if X is a tuple. That would require type inference, which we don't do. Let Python 2.6 figure it out. ) fixer_base)Node)python_symbols)NameArgListListCompin_special_contextc@s eZdZdZdZdZddZdS) FixFilterTaV filter_lambda=power< 'filter' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > [extra_trailers=trailer*] > | power< 'filter' trailer< '(' arglist< none='None' ',' seq=any > ')' > [extra_trailers=trailer*] > | power< 'filter' args=trailer< '(' [any] ')' > [extra_trailers=trailer*] > zfuture_builtins.filtercCs2|j|rdSg}d|kr:x|dD]}|j|jq$Wd|krt|jdj|jdj|jdj|jdj}ttj|g|dd}nd|krttd td |d jtd }ttj|g|dd}nTt |rdS|d j}ttjtd |gdd}ttjtd t |gg|}d|_ |j |_ |S)NZextra_trailersZ filter_lambdafpitZxp)prefixZnoneZ_fseqargsfilterlist) Z should_skipappendZclonergetrsymsZpowerrrrr )selfZnodeZresultsZtrailerstnewrr0/usr/lib64/python3.6/lib2to3/fixes/fix_filter.py transform:s4      zFixFilter.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZskip_onrrrrrr sr N)__doc__r rZpytreerZpygramrrZ fixer_utilrrrrZConditionalFixr rrrrs    PK51]\<ֶ*__pycache__/fix_print.cpython-36.opt-1.pycnu[3 \ @sldZddlmZddlmZddlmZddlmZddlmZm Z m Z m Z ej dZ Gdd d ejZd S) a Fixer for print. Change: 'print' into 'print()' 'print ...' into 'print(...)' 'print ... ,' into 'print(..., end=" ")' 'print >>x, ...' into 'print(..., file=x)' No changes are applied if print_function is imported from __future__ )patcomp)pytree)token) fixer_base)NameCallCommaStringz"atom< '(' [atom|STRING|NAME] ')' >c@s$eZdZdZdZddZddZdS)FixPrintTzP simple_stmt< any* bare='print' any* > | print_stmt c Cs`|jd}|r,|jttdg|jddS|jdd}t|dkrXtj|drXdSd}}}|r|dt kr|dd}d}|r|dt j t j dkr|dj}|dd}d d |D}|rd |d_|dk s|dk s|dk rF|dk r|j|d tt||dk r.|j|d tt||dk rF|j|d|ttd|} |j| _| S)NZbareprint)prefix z>>cSsg|] }|jqS)clone).0argrr//usr/lib64/python3.6/lib2to3/fixes/fix_print.py ?sz&FixPrint.transform..sependfiler)getreplacerrr Zchildrenlen parend_exprmatchrrLeafr RIGHTSHIFTr add_kwargr repr) selfZnodeZresultsZ bare_printargsrrrZl_argsZn_stmtrrr transform%s8          zFixPrint.transformcCsNd|_tj|jjt|tjtjd|f}|r@|j t d|_|j |dS)Nr=r) r rZNodeZsymsZargumentrr!rEQUALappendr)r%Zl_nodesZs_kwdZn_exprZ n_argumentrrrr#Ms   zFixPrint.add_kwargN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr'r#rrrrr s(r N)__doc__rrrZpgen2rrZ fixer_utilrrrr Zcompile_patternrZBaseFixr rrrrs    PK51]dL,__pycache__/fix_imports.cpython-36.opt-2.pycnu[3 \41@sddlmZddlmZmZdddddddd d d d d d d ddddddddddddddddddd d!d!d"d#d$d%d&d'd'd'd(d)d)d*d+d,0Zd-d.Zefd/d0ZGd1d2d2ejZ d3S)4) fixer_base)Name attr_chainiopicklebuiltinscopyregZqueueZ socketserverZ configparserreprlibztkinter.filedialogztkinter.simpledialogztkinter.colorchooserztkinter.commondialogztkinter.dialogz tkinter.dndz tkinter.fontztkinter.messageboxztkinter.scrolledtextztkinter.constantsz tkinter.tixz tkinter.ttkZtkinterZ _markupbasewinreg_threadZ _dummy_threadzdbm.bsdzdbm.dumbzdbm.ndbmzdbm.gnuz xmlrpc.clientz xmlrpc.serverz http.clientz html.entitiesz html.parserz http.cookieszhttp.cookiejarz http.server subprocess collectionsz urllib.parsezurllib.robotparser)0StringIOZ cStringIOZcPickleZ __builtin__Zcopy_regZQueueZ SocketServerZ ConfigParserreprZ FileDialogZ tkFileDialogZ SimpleDialogZtkSimpleDialogZtkColorChooserZtkCommonDialogZDialogZTkdndZtkFontZ tkMessageBoxZ ScrolledTextZ TkconstantsZTixZttkZTkinterZ markupbase_winregZthreadZ dummy_threadZdbhashZdumbdbmZdbmZgdbmZ xmlrpclibZDocXMLRPCServerZSimpleXMLRPCServerZhttplibZhtmlentitydefsZ HTMLParserZCookieZ cookielibZBaseHTTPServerZSimpleHTTPServerZ CGIHTTPServerZcommands UserStringUserListZurlparseZ robotparsercCsddjtt|dS)N(|))joinmapr)membersr1/usr/lib64/python3.6/lib2to3/fixes/fix_imports.py alternates=srccsTdjdd|D}t|j}d||fVd|Vd||fVd|VdS)Nz | cSsg|] }d|qS)zmodule_name='%s'r).0keyrrr Bsz!build_pattern..zyname_import=import_name< 'import' ((%s) | multiple_imports=dotted_as_names< any* (%s) any* >) > zimport_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > zimport_name< 'import' (dotted_as_name< (%s) 'as' any > | multiple_imports=dotted_as_names< any* dotted_as_name< (%s) 'as' any > any* >) > z3power< bare_with_attr=(%s) trailer<'.' any > any* >)rrkeys)mappingZmod_listZ bare_namesrrr build_patternAs   r!csTeZdZdZdZeZdZddZfddZ fddZ fd d Z d d Z Z S) FixImportsTcCsdjt|jS)Nr)rr!r )selfrrrr!`szFixImports.build_patterncs|j|_tt|jdS)N)r!ZPATTERNsuperr"compile_pattern)r$) __class__rrr&cs zFixImports.compile_patterncsHtt|j|}|rDd|kr@tfddt|dDr@dS|SdS)Nbare_with_attrc3s|]}|VqdS)Nr)robj)matchrr qsz#FixImports.match..parentF)r%r"r*anyr)r$noderesults)r')r*rr*js zFixImports.matchcstt|j||i|_dS)N)r%r" start_treereplace)r$Ztreefilename)r'rrr0vszFixImports.start_treecCs|jd}|rh|j}|j|}|jt||jdd|krD||j|<d|kr|j|}|r|j||n2|dd}|jj|j}|r|jt||jddS)NZ module_name)prefixZ name_importZmultiple_importsr()getvaluer r1rr3r* transform)r$r.r/Z import_modZmod_namenew_nameZ bare_namerrrr7zs     zFixImports.transform)__name__ __module__ __qualname__Z BM_compatibleZkeep_line_orderMAPPINGr Z run_orderr!r&r*r0r7 __classcell__rr)r'rr"Us  r"N) rZ fixer_utilrrr<rr!ZBaseFixr"rrrrsh  PK51]C +__pycache__/fix_xrange.cpython-36.opt-2.pycnu[3 \ @sBddlmZddlmZmZmZddlmZGdddejZdS)) fixer_base)NameCallconsuming_calls)patcompcsheZdZdZdZfddZddZddZd d Zd d Z d Z e j e Z dZe j eZddZZS) FixXrangeTz power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > cstt|j||t|_dS)N)superr start_treesettransformed_xranges)selftreefilename) __class__0/usr/lib64/python3.6/lib2to3/fixes/fix_xrange.pyr szFixXrange.start_treecCs d|_dS)N)r )r r rrrr finish_treeszFixXrange.finish_treecCsD|d}|jdkr|j||S|jdkr4|j||Stt|dS)NnameZxrangerange)valuetransform_xrangetransform_range ValueErrorrepr)r noderesultsrrrr transforms     zFixXrange.transformcCs0|d}|jtd|jd|jjt|dS)Nrr)prefix)replacerrr addid)r rrrrrrr$szFixXrange.transform_xrangecCslt||jkrh|j| rhttd|djg}ttd|g|jd}x|dD]}|j|qRW|SdS)Nrargslist)rrest)r r in_special_contextrrZclonerZ append_child)r rrZ range_callZ list_callnrrrr*s   zFixXrange.transform_rangez3power< func=NAME trailer< '(' node=any ')' > any* >zfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > | comparison< any 'in' node=any any*> cCsf|jdkrdSi}|jjdk rJ|jj|jj|rJ|d|krJ|djtkS|jj|j|od|d|kS)NFrfunc)parentp1matchrrp2)r rrrrrr$?s   zFixXrange.in_special_context)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrrZP1rZcompile_patternr(ZP2r*r$ __classcell__rr)rrr s     rN) rZ fixer_utilrrrrZBaseFixrrrrrs  PK51]"*#__pycache__/fix_long.cpython-36.pycnu[3 \@s2dZddlmZddlmZGdddejZdS)z/Fixer that turns 'long' into 'int' everywhere. ) fixer_base)is_probably_builtinc@seZdZdZdZddZdS)FixLongTz'long'cCst|rd|_|jdS)Nint)rvalueZchanged)selfZnodeZresultsr./usr/lib64/python3.6/lib2to3/fixes/fix_long.py transformszFixLong.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrr r srN)__doc__Zlib2to3rZlib2to3.fixer_utilrZBaseFixrrrrr s  PK51]YY$__pycache__/fix_paren.cpython-36.pycnu[3 \@s6dZddlmZddlmZmZGdddejZdS)zuFixer that addes parentheses where they are required This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``.) fixer_base)LParenRParenc@seZdZdZdZddZdS)FixParenTa 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] > >) (']' | ')') > cCs8|d}t}|j|_d|_|jd||jtdS)Ntarget)rprefixZ insert_childZ append_childr)selfZnodeZresultsrZlparenr //usr/lib64/python3.6/lib2to3/fixes/fix_paren.py transform%s  zFixParen.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r r r r r srN)__doc__rrZ fixer_utilrrZBaseFixrr r r r s PK51]9xx-__pycache__/fix_execfile.cpython-36.opt-1.pycnu[3 \@sVdZddlmZddlmZmZmZmZmZm Z m Z m Z m Z m Z GdddejZdS)zoFixer for execfile. This converts usages of the execfile function into calls to the built-in exec() function. ) fixer_base) CommaNameCallLParenRParenDotNodeArgListStringsymsc@seZdZdZdZddZdS) FixExecfileTz power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > | power< 'execfile' trailer< '(' filename=any ')' > > cCs&|d}|jd}|jd}|jdjdj}t|jttddg|d}ttjt d|g}ttj t t d gttj t t gg} |g| } |j} d| _td d} | t| t| g} tt d | d }|g}|dk r|jt|jg|dk r|jt|jgtt d ||jdS)Nfilenameglobalslocalsz"rb" )Zrparenopenreadz'exec'compileexec)prefixr)getZchildrenZcloner rr r r ZpowerrZtrailerrrrrrextend)selfZnodeZresultsrrrZexecfile_parenZ open_argsZ open_callrZ open_exprZ filename_argZexec_strZ compile_argsZ compile_callargsr2/usr/lib64/python3.6/lib2to3/fixes/fix_execfile.py transforms*     zFixExecfile.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrrr sr N)__doc__rrZ fixer_utilrrrrrrr r r r ZBaseFixr rrrrs 0PK51]w(__pycache__/fix_zip.cpython-36.opt-1.pycnu[3 \ @sRdZddlmZddlmZddlmZddlm Z m Z m Z Gdddej Z dS) a7 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 <>:. ) fixer_base)Node)python_symbols)NameArgListin_special_contextc@s eZdZdZdZdZddZdS)FixZipTzN power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*] > zfuture_builtins.zipcCs|j|rdSt|rdS|dj}d|_g}d|kr^dd|dD}x|D] }d|_qPWttjtd|gdd}ttjtdt|gg|}|j|_|S) NargstrailerscSsg|] }|jqS)clone).0nr r -/usr/lib64/python3.6/lib2to3/fixes/fix_zip.py 'sz$FixZip.transform..zip)prefixlist) Z should_skiprr rrsymsZpowerrr)selfZnodeZresultsr r rnewr r r transforms    zFixZip.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZskip_onrr r r rrsrN)__doc__r rZpytreerZpygramrrZ fixer_utilrrrZConditionalFixrr r r rs    PK51]a;888)__pycache__/fix_repr.cpython-36.opt-1.pycnu[3 \e@s:dZddlmZddlmZmZmZGdddejZdS)z/Fixer that transforms `xyzzy` into repr(xyzzy).) fixer_base)CallName parenthesizec@seZdZdZdZddZdS)FixReprTz7 atom < '`' expr=any '`' > cCs8|dj}|j|jjkr"t|}ttd|g|jdS)Nexprrepr)prefix)ZclonetypeZsymsZ testlist1rrrr )selfZnodeZresultsrr ./usr/lib64/python3.6/lib2to3/fixes/fix_repr.py transforms zFixRepr.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrr r r r r srN) __doc__rZ fixer_utilrrrZBaseFixrr r r r s PK51] UU+__pycache__/fix_reduce.cpython-36.opt-1.pycnu[3 \E@s2dZddlmZddlmZGdddejZdS)zqFixer for reduce(). Makes sure reduce() is imported from the functools module if reduce is used in that module. ) fixer_base) touch_importc@s eZdZdZdZdZddZdS) FixReduceTZpreai power< 'reduce' trailer< '(' arglist< ( (not(argument) any ',' not(argument > cCstdd|dS)N functoolsreduce)r)selfZnodeZresultsr0/usr/lib64/python3.6/lib2to3/fixes/fix_reduce.py transform"szFixReduce.transformN)__name__ __module__ __qualname__Z BM_compatibleorderZPATTERNr rrrr rsrN)__doc__Zlib2to3rZlib2to3.fixer_utilrZBaseFixrrrrr s  PK51] `+__pycache__/fix_reduce.cpython-36.opt-2.pycnu[3 \E@s.ddlmZddlmZGdddejZdS)) fixer_base) touch_importc@s eZdZdZdZdZddZdS) FixReduceTZpreai power< 'reduce' trailer< '(' arglist< ( (not(argument) any ',' not(argument > cCstdd|dS)N functoolsreduce)r)selfZnodeZresultsr0/usr/lib64/python3.6/lib2to3/fixes/fix_reduce.py transform"szFixReduce.transformN)__name__ __module__ __qualname__Z BM_compatibleorderZPATTERNr rrrr rsrN)Zlib2to3rZlib2to3.fixer_utilrZBaseFixrrrrr  s  PK51]:~(__pycache__/fix_zip.cpython-36.opt-2.pycnu[3 \ @sNddlmZddlmZddlmZddlmZm Z m Z Gdddej Z dS)) fixer_base)Node)python_symbols)NameArgListin_special_contextc@s eZdZdZdZdZddZdS)FixZipTzN power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*] > zfuture_builtins.zipcCs|j|rdSt|rdS|dj}d|_g}d|kr^dd|dD}x|D] }d|_qPWttjtd|gdd}ttjtdt|gg|}|j|_|S) NargstrailerscSsg|] }|jqS)clone).0nr r -/usr/lib64/python3.6/lib2to3/fixes/fix_zip.py 'sz$FixZip.transform..zip)prefixlist) Z should_skiprr rrsymsZpowerrr)selfZnodeZresultsr r rnewr r r transforms    zFixZip.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZskip_onrr r r rrsrN) r rZpytreerZpygramrrZ fixer_utilrrrZConditionalFixrr r r r s   PK51] )__pycache__/fix_next.cpython-36.opt-1.pycnu[3 \f @sndZddlmZddlmZddlmZddlm Z m Z m Z dZ Gdddej Zd d Zd d Zd dZdS)z.Fixer for it.next() -> next(it), per PEP 3114.)token)python_symbols) fixer_base)NameCall find_bindingz;Calls to builtin next() possibly shadowed by global bindingcs0eZdZdZdZdZfddZddZZS)FixNextTa power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > > | power< head=any+ trailer< '.' attr='next' > not trailer< '(' ')' > > | classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='next' parameters< '(' NAME ')' > any+ > any* > > | global=global_stmt< 'global' any* 'next' any* > Zprecs>tt|j||td|}|r4|j|td|_nd|_dS)NnextTF)superr start_treerwarning bind_warning shadowed_next)selfZtreefilenamen) __class__./usr/lib64/python3.6/lib2to3/fixes/fix_next.pyr $s   zFixNext.start_treecCs|jd}|jd}|jd}|rr|jr>|jtd|jdqdd|D}d|d _|jttd |jd|n|rtd|jd}|j|nj|rt|r|d }djd d|Djd kr|j |t dS|jtdnd|kr|j |t d|_dS)Nbaseattrname__next__)prefixcSsg|] }|jqSr)Zclone).0rrrr 9sz%FixNext.transform..r headcSsg|] }t|qSr)str)rrrrrrEsZ __builtin__globalT) getrreplacerrris_assign_targetjoinstripr r )rnodeZresultsrrrrrrrr transform.s,       zFixNext.transform) __name__ __module__ __qualname__Z BM_compatibleZPATTERNorderr r' __classcell__rr)rrrs  rcCsFt|}|dkrdSx,|jD]"}|jtjkr0dSt||rdSqWdS)NFT) find_assignchildrentyperEQUAL is_subtree)r&ZassignZchildrrrr#Qs   r#cCs4|jtjkr|S|jtjks&|jdkr*dSt|jS)N)r/symsZ expr_stmtZ simple_stmtparentr-)r&rrrr-]s  r-cs$|kr dStfdd|jDS)NTc3s|]}t|VqdS)N)r1)rc)r&rr gszis_subtree..)anyr.)rootr&r)r&rr1dsr1N)__doc__Zpgen2rZpygramrr2rrZ fixer_utilrrrr ZBaseFixrr#r-r1rrrrs   @ PK51]ݛuu.__pycache__/fix_funcattrs.cpython-36.opt-2.pycnu[3 \@s.ddlmZddlmZGdddejZdS)) fixer_base)Namec@seZdZdZdZddZdS) FixFuncattrsTz power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' | 'func_dict') > any* > cCs2|dd}|jtd|jdd|jddS)Nattrz__%s__)prefix)replacervaluer)selfZnodeZresultsrr 3/usr/lib64/python3.6/lib2to3/fixes/fix_funcattrs.py transforms zFixFuncattrs.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrr r r r r srN)rZ fixer_utilrZBaseFixrr r r r s  PK51]a/__pycache__/fix_isinstance.cpython-36.opt-1.pycnu[3 \H@s2dZddlmZddlmZGdddejZdS)a,Fixer that cleans up a tuple argument to isinstance after the tokens in it were fixed. This is mainly used to remove double occurrences of tokens as a leftover of the long -> int / unicode -> str conversion. eg. isinstance(x, (int, long)) -> isinstance(x, (int, int)) -> isinstance(x, int) ) fixer_base)tokenc@s eZdZdZdZdZddZdS) FixIsinstanceTz power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > c Cst}|d}|j}g}t|}xx|D]p\}} | jtjkrt| j|krt|t|dkr||djtjkrt |q&q&|j | | jtjkr&|j | jq&W|r|djtjkr|d=t|dkr|j } | j |d_ | j|dn||dd<|jdS)Nargsr )setZchildren enumeratetyperNAMEvaluelenCOMMAnextappendaddparentprefixreplaceZchanged) selfZnodeZresultsZnames_insertedZtestlistrZnew_argsiteratoridxargZatomr4/usr/lib64/python3.6/lib2to3/fixes/fix_isinstance.py transforms*$     zFixIsinstance.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZ run_orderrrrrrrsrN)__doc__rZ fixer_utilrZBaseFixrrrrr s  PK51].]  $__pycache__/fix_print.cpython-36.pycnu[3 \ @sldZddlmZddlmZddlmZddlmZddlmZm Z m Z m Z ej dZ Gdd d ejZd S) a Fixer for print. Change: 'print' into 'print()' 'print ...' into 'print(...)' 'print ... ,' into 'print(..., end=" ")' 'print >>x, ...' into 'print(..., file=x)' No changes are applied if print_function is imported from __future__ )patcomp)pytree)token) fixer_base)NameCallCommaStringz"atom< '(' [atom|STRING|NAME] ')' >c@s$eZdZdZdZddZddZdS)FixPrintTzP simple_stmt< any* bare='print' any* > | print_stmt c Cs|st|jd}|r4|jttdg|jddS|jdtdksJt|jdd}t|dkrvtj |drvdSd}}}|r|dt kr|dd}d}|r|dt j t jdkrt|dkst|dj}|d d}d d |D}|rd |d_|dk s"|dk s"|dk rz|dk rB|j|d tt||dk rb|j|dtt||dk rz|j|d|ttd|} |j| _| S)NZbareprint)prefix z>>rcSsg|] }|jqS)clone).0argrr//usr/lib64/python3.6/lib2to3/fixes/fix_print.py ?sz&FixPrint.transform..sependfiler)AssertionErrorgetreplacerrr Zchildrenlen parend_exprmatchrrLeafr RIGHTSHIFTr add_kwargr repr) selfZnodeZresultsZ bare_printargsrrrZl_argsZn_stmtrrr transform%s>          zFixPrint.transformcCsNd|_tj|jjt|tjtjd|f}|r@|j t d|_|j |dS)Nr=r) r rZNodeZsymsZargumentrr"rEQUALappendr)r&Zl_nodesZs_kwdZn_exprZ n_argumentrrrr$Ms   zFixPrint.add_kwargN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr(r$rrrrr s(r N)__doc__rrrZpgen2rrZ fixer_utilrrrr Zcompile_patternr ZBaseFixr rrrrs    PK51]7N/__pycache__/fix_xreadlines.cpython-36.opt-2.pycnu[3 \@s.ddlmZddlmZGdddejZdS)) fixer_base)Namec@seZdZdZdZddZdS) FixXreadlinesTz power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | power< any+ trailer< '.' no_call='xreadlines' > > cCs@|jd}|r$|jtd|jdn|jdd|dDdS)Nno_call__iter__)prefixcSsg|] }|jqS)Zclone).0xrr4/usr/lib64/python3.6/lib2to3/fixes/fix_xreadlines.py sz+FixXreadlines.transform..Zcall)getreplacerr)selfZnodeZresultsrrrr transforms zFixXreadlines.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrr r srN)rZ fixer_utilrZBaseFixrrrrr s  PK51]/Ii,__pycache__/fix_getcwdu.cpython-36.opt-2.pycnu[3 \@s.ddlmZddlmZGdddejZdS)) fixer_base)Namec@seZdZdZdZddZdS) FixGetcwduTzR power< 'os' trailer< dot='.' name='getcwdu' > any* > cCs |d}|jtd|jddS)Nnamegetcwd)prefix)replacerr)selfZnodeZresultsrr 1/usr/lib64/python3.6/lib2to3/fixes/fix_getcwdu.py transformszFixGetcwdu.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r r r r r srN)rZ fixer_utilrZBaseFixrr r r r s  PK51]^D:6__pycache__/fix_itertools_imports.cpython-36.opt-1.pycnu[3 \&@s:dZddlmZddlmZmZmZGdddejZdS)zA Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) ) fixer_base) BlankLinesymstokenc@s"eZdZdZdeZddZdS)FixItertoolsImportsTzT import_from< 'from' 'itertools' 'import' imports=any > c Csl|d}|jtjks|j r$|g}n|j}x|dddD]z}|jtjkrV|j}|}n|jtjkrfdS|jd}|j}|dkrd|_|jq:|dkr:|j |d d krd nd |_q:W|jddp|g}d } x0|D](}| o|jtj kr|jq| d N} qWx*|r,|djtj kr,|j jqW|jp@t |dd sR|j dkrh|j} t}| |_|SdS)Nimportsrimapizipifilter ifilterfalse izip_longestf filterfalse zip_longestTvalue)r r r )r r )typerZimport_as_namechildrenrNAMErSTARremoveZchangedCOMMApopgetattrparentprefixr) selfZnodeZresultsrrZchildmemberZ name_node member_nameZ remove_commapr";/usr/lib64/python3.6/lib2to3/fixes/fix_itertools_imports.py transformsB         zFixItertoolsImports.transformN)__name__ __module__ __qualname__Z BM_compatiblelocalsZPATTERNr$r"r"r"r#rs rN) __doc__Zlib2to3rZlib2to3.fixer_utilrrrZBaseFixrr"r"r"r#s PK51]-__pycache__/fix_operator.cpython-36.opt-2.pycnu[3 \ @sJddlZddlmZddlmZmZmZmZddZGdddej Z dS)N) fixer_base)CallNameString touch_importcsfdd}|S)Ncs |_|S)N) invocation)f)s2/usr/lib64/python3.6/lib2to3/fixes/fix_operator.pydecszinvocation..decr )r r r )r r rs rc@seZdZdZdZdZdZdeeedZddZ e d d d Z e d d dZ e dddZ e dddZe dddZe dddZe dddZddZd d!Zd"d#Zd$S)% FixOperatorTZprez method=('isCallable'|'sequenceIncludes' |'isSequenceType'|'isMappingType'|'isNumberType' |'repeat'|'irepeat') z'(' obj=any ')'z power< module='operator' trailer< '.' %(methods)s > trailer< %(obj)s > > | power< %(methods)s trailer< %(obj)s > > )methodsobjcCs"|j||}|dk r|||SdS)N) _check_method)selfnoderesultsmethodr r r transform+s zFixOperator.transformzoperator.contains(%s)cCs|j||dS)Ncontains)_handle_rename)rrrr r r _sequenceIncludes0szFixOperator._sequenceIncludeszhasattr(%s, '__call__')cCs2|d}|jtdtdg}ttd||jdS)Nrz, z '__call__'hasattr)prefix)clonerrrr)rrrrargsr r r _isCallable4szFixOperator._isCallablezoperator.mul(%s)cCs|j||dS)Nmul)r)rrrr r r _repeat:szFixOperator._repeatzoperator.imul(%s)cCs|j||dS)Nimul)r)rrrr r r _irepeat>szFixOperator._irepeatz$isinstance(%s, collections.Sequence)cCs|j||ddS)N collectionsSequence)_handle_type2abc)rrrr r r _isSequenceTypeBszFixOperator._isSequenceTypez#isinstance(%s, collections.Mapping)cCs|j||ddS)Nr"Mapping)r$)rrrr r r _isMappingTypeFszFixOperator._isMappingTypezisinstance(%s, numbers.Number)cCs|j||ddS)NZnumbersNumber)r$)rrrr r r _isNumberTypeJszFixOperator._isNumberTypecCs|dd}||_|jdS)Nrr)valueZchanged)rrrnamerr r r rNs zFixOperator._handle_renamecCsFtd|||d}|jtddj||gg}ttd||jdS)Nrz, . isinstance)r)rrrjoinrrr)rrrmoduleabcrrr r r r$Ss zFixOperator._handle_type2abccCs\t|d|ddj}t|tjrXd|kr0|St|df}|j|}|j|d|dS)N_rrr/rzYou should use '%s' here.)getattrr*r-r"CallablestrrZwarning)rrrrsubZinvocation_strr r r rYs  zFixOperator._check_methodN)__name__ __module__ __qualname__Z BM_compatibleorderrrdictZPATTERNrrrrrr!r%r'r)rr$rr r r r r s r ) r"Zlib2to3rZlib2to3.fixer_utilrrrrrZBaseFixr r r r r  s PK51]G**%__pycache__/fix_idioms.cpython-36.pycnu[3 \ @sNdZddlmZddlmZmZmZmZmZm Z dZ dZ Gdddej Z dS) aAdjust some old Python 2 idioms to their modern counterparts. * Change some type comparisons to isinstance() calls: type(x) == T -> isinstance(x, T) type(x) is T -> isinstance(x, T) type(x) != T -> not isinstance(x, T) type(x) is not T -> not isinstance(x, T) * Change "while 1:" into "while True:". * Change both v = list(EXPR) v.sort() foo(v) and the more general v = EXPR v.sort() foo(v) into v = sorted(EXPR) foo(v) ) fixer_base)CallCommaNameNode BlankLinesymsz0(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)z(power< 'type' trailer< '(' x=any ')' > >csPeZdZdZdeeeefZfddZddZddZ d d Z d d Z Z S) FixIdiomsTa isinstance=comparison< %s %s T=any > | isinstance=comparison< T=any %s %s > | while_stmt< 'while' while='1' ':' any+ > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' power< list='list' trailer< '(' (not arglist) any ')' > > > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' expr=any > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > cs8tt|j|}|r4d|kr4|d|dkr0|SdS|S)NsortedZid1Zid2)superr match)selfnoder) __class__0/usr/lib64/python3.6/lib2to3/fixes/fix_idioms.pyr Os  zFixIdioms.matchcCsHd|kr|j||Sd|kr(|j||Sd|kr<|j||StddS)N isinstancewhiler z Invalid match)transform_isinstancetransform_whiletransform_sort RuntimeError)r rresultsrrr transformZs   zFixIdioms.transformcCsh|dj}|dj}d|_d|_ttd|t|g}d|kr\d|_ttjtd|g}|j|_|S)NxT rnnot)cloneprefixrrrrrZnot_test)r rrrrZtestrrrrds  zFixIdioms.transform_isinstancecCs |d}|jtd|jddS)NrTrue)r")replacerr")r rrZonerrrrpszFixIdioms.transform_whilec Cs|d}|d}|jd}|jd}|r>|jtd|jdn8|rn|j}d|_|jttd|g|jdntd|j|j}d |kr|r|jd d |d jf} d j | |d _nH|j st |j dkst t } |j j| |j | kst |jd d | _dS) Nsortnextlistexprr )r"rzshould not have reached here )getr$rr"r!rrremove rpartitionjoinparentAssertionErrorZ next_siblingrZ append_child) r rrZ sort_stmtZ next_stmtZ list_callZ simple_exprnewZbtwnZ prefix_linesZend_linerrrrts0     zFixIdioms.transform_sort) __name__ __module__ __qualname__ZexplicitTYPECMPZPATTERNr rrrr __classcell__rr)rrr %s'   r N)__doc__rrZ fixer_utilrrrrrrr6r5ZBaseFixr rrrrs   PK51]"^%*__pycache__/fix_throw.cpython-36.opt-1.pycnu[3 \.@sZdZddlmZddlmZddlmZddlmZmZm Z m Z m Z Gdddej Z dS) zFixer for generator.throw(E, V, T). g.throw(E) -> g.throw(E) g.throw(E, V) -> g.throw(E(V)) g.throw(E, V, T) -> g.throw(E(V).with_traceback(T)) g.throw("foo"[, V[, T]]) will warn about string exceptions.)pytree)token) fixer_base)NameCallArgListAttris_tuplec@seZdZdZdZddZdS)FixThrowTz power< any trailer< '.' 'throw' > trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > | power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > > c Cs|j}|dj}|jtjkr.|j|ddS|jd}|dkrDdS|j}t|rndd|jdd D}n d|_ |g}|d}d |kr|d j}d|_ t ||} t | t d t |gg} |jtj|j| n|jt ||dS) Nexcz+Python 3 does not support string exceptionsvalcSsg|] }|jqS)clone).0cr r //usr/lib64/python3.6/lib2to3/fixes/fix_throw.py )sz&FixThrow.transform..argstbwith_traceback)symsrtyperSTRINGZcannot_convertgetr ZchildrenprefixrrrrreplacerZNodeZpower) selfZnodeZresultsrr r rZ throw_argsreZwith_tbr r r transforms*      zFixThrow.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr!r r r rr sr N)__doc__rrZpgen2rrZ fixer_utilrrrrr ZBaseFixr r r r rs    PK51]폏)__pycache__/__init__.cpython-36.opt-2.pycnu[3 \/@sdS)Nrrr./usr/lib64/python3.6/lib2to3/fixes/__init__.pysPK51]CyF*__pycache__/fix_paren.cpython-36.opt-2.pycnu[3 \@s2ddlmZddlmZmZGdddejZdS)) fixer_base)LParenRParenc@seZdZdZdZddZdS)FixParenTa 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] > >) (']' | ')') > cCs8|d}t}|j|_d|_|jd||jtdS)Ntarget)rprefixZ insert_childZ append_childr)selfZnodeZresultsrZlparenr //usr/lib64/python3.6/lib2to3/fixes/fix_paren.py transform%s  zFixParen.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r r r r r srN)rrZ fixer_utilrrZBaseFixrr r r r s PK51]1__pycache__/fix_tuple_params.cpython-36.opt-2.pycnu[3 \@sddlmZddlmZddlmZddlmZmZmZm Z m Z m Z ddZ Gdddej Zd d Zd d Zgd fddZddZd S))pytree)token) fixer_base)AssignNameNewlineNumber SubscriptsymscCst|tjo|jdjtjkS)N) isinstancerNodechildrentyperSTRING)stmtr6/usr/lib64/python3.6/lib2to3/fixes/fix_tuple_params.py is_docstrings rc@s(eZdZdZdZdZddZddZdS) FixTupleParamsTa funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > c sd|krj||Sg|d}|d}|djdjtjkrZd}|djdj}tnd}d}tjtjddfd d }|jt j kr||n@|jt j krx2t |jD]$\}} | jt j kr|| |dkd qWsdSxD]} |d| _ qW|} |dkrd d_n&t|dj|r8|d_|d} xD]} |d| _ q>W|dj| | <x4t| d| tdD]}||dj|_qW|djdS)Nlambdasuiteargsr rz; Fcs\tj}|j}d|_t||j}|r2d|_|j|jtjt j |jgdS)Nr ) rnew_namecloneprefixrreplaceappendrr r Z simple_stmt)Z tuple_arg add_prefixnargr)end new_linesselfrr handle_tupleCs   z.FixTupleParams.transform..handle_tuple)r"r)F)transform_lambdarrrINDENTvaluerrZLeafr ZtfpdefZ typedargslist enumerateparentrrrangelenZchanged) r'noderesultsrrstartindentr(ir$lineafterr)r%r&r'r transform.sF           zFixTupleParams.transformc Cs|d}|d}t|d}|jtjkrD|j}d|_|j|dSt|}t|}|j t |}t |dd} |j| jxd|j D]X} | jtjkr| j |krdd|| j D} tjtj| jg| } | j| _| j| qWdS)Nrbodyinnerr)rcSsg|] }|jqSr)r).0crrr sz3FixTupleParams.transform_lambda..) simplify_argsrrNAMErrr find_params map_to_indexr tuple_namerZ post_orderr+rr r Zpower) r'r0r1rr8r9ZparamsZto_indexZtup_nameZ new_paramr#Z subscriptsnewrrrr)ns(    zFixTupleParams.transform_lambdaN)__name__ __module__ __qualname__Z run_orderZ BM_compatibleZPATTERNr7r)rrrrrs  @rcCsR|jtjtjfkr|S|jtjkrBx|jtjkr<|jd}q$W|Std|dS)NrzReceived unexpected node %s)rr Zvfplistrr>vfpdefr RuntimeError)r0rrrr=s r=cCs<|jtjkrt|jdS|jtjkr,|jSdd|jDS)NrcSs g|]}|jtjkrt|qSr)rrCOMMAr?)r:r;rrrr<szfind_params..)rr rFr?rrr>r+)r0rrrr?s   r?NcCs^|dkr i}xLt|D]@\}}ttt|g}t|trJt|||dq||||<qW|S)N)d)r,r rstrr listr@) param_listrrIr4objZtrailerrrrr@s r@cCs@g}x0|D](}t|tr(|jt|q |j|q Wdj|S)N_)r rKr!rAjoin)rLlrMrrrrAs   rA)rrZpgen2rrZ fixer_utilrrrrr r rZBaseFixrr=r?r@rArrrrs    l  PK51]I4'__pycache__/fix_exitfunc.cpython-36.pycnu[3 \ @sJdZddlmZmZddlmZmZmZmZm Z m Z Gdddej Z dS)z7 Convert use of sys.exitfunc to use the atexit module. )pytree fixer_base)NameAttrCallCommaNewlinesymscs<eZdZdZdZdZfddZfddZddZZ S) FixExitfuncTa ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) cstt|j|dS)N)superr __init__)selfargs) __class__2/usr/lib64/python3.6/lib2to3/fixes/fix_exitfunc.pyr szFixExitfunc.__init__cstt|j||d|_dS)N)r r start_tree sys_import)r Ztreefilename)rrrr!szFixExitfunc.start_treec Cs&d|kr |jdkr|d|_dS|dj}d|_tjtjttdtd}t ||g|j}|j ||jdkr|j |ddS|jj d}|j tjkr|jt|jtddnj|jj}|j j|j}|j} tjtjtd tddg} tjtj| g} |j|dt|j|d | dS) NrfuncatexitregisterzKCan't find sys import; Please add an atexit import at the top of your file. import)rZcloneprefixrZNoder ZpowerrrrreplaceZwarningZchildrentypeZdotted_as_namesZ append_childrparentindexZ import_nameZ simple_stmtZ insert_childr) r ZnodeZresultsrrZcallnamesZcontaining_stmtZpositionZstmt_containerZ new_importnewrrr transform%s2         zFixExitfunc.transform) __name__ __module__ __qualname__Zkeep_line_orderZ BM_compatibleZPATTERNr rr$ __classcell__rr)rrr s   r N) __doc__Zlib2to3rrZlib2to3.fixer_utilrrrrrr ZBaseFixr rrrrs PK51]a)__pycache__/fix_isinstance.cpython-36.pycnu[3 \H@s2dZddlmZddlmZGdddejZdS)a,Fixer that cleans up a tuple argument to isinstance after the tokens in it were fixed. This is mainly used to remove double occurrences of tokens as a leftover of the long -> int / unicode -> str conversion. eg. isinstance(x, (int, long)) -> isinstance(x, (int, int)) -> isinstance(x, int) ) fixer_base)tokenc@s eZdZdZdZdZddZdS) FixIsinstanceTz power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > c Cst}|d}|j}g}t|}xx|D]p\}} | jtjkrt| j|krt|t|dkr||djtjkrt |q&q&|j | | jtjkr&|j | jq&W|r|djtjkr|d=t|dkr|j } | j |d_ | j|dn||dd<|jdS)Nargsr )setZchildren enumeratetyperNAMEvaluelenCOMMAnextappendaddparentprefixreplaceZchanged) selfZnodeZresultsZnames_insertedZtestlistrZnew_argsiteratoridxargZatomr4/usr/lib64/python3.6/lib2to3/fixes/fix_isinstance.py transforms*$     zFixIsinstance.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZ run_orderrrrrrrsrN)__doc__rZ fixer_utilrZBaseFixrrrrr s  PK51]G$ $ %__pycache__/fix_filter.cpython-36.pycnu[3 \[ @sVdZddlmZddlmZddlmZddlm Z m Z m Z m Z Gdddej ZdS) aFixer that changes filter(F, X) into list(filter(F, X)). We avoid the transformation if the filter() call is directly contained in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. NOTE: This is still not correct if the original code was depending on filter(F, X) to return a string if X is a string and a tuple if X is a tuple. That would require type inference, which we don't do. Let Python 2.6 figure it out. ) fixer_base)Node)python_symbols)NameArgListListCompin_special_contextc@s eZdZdZdZdZddZdS) FixFilterTaV filter_lambda=power< 'filter' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > [extra_trailers=trailer*] > | power< 'filter' trailer< '(' arglist< none='None' ',' seq=any > ')' > [extra_trailers=trailer*] > | power< 'filter' args=trailer< '(' [any] ')' > [extra_trailers=trailer*] > zfuture_builtins.filtercCs2|j|rdSg}d|kr:x|dD]}|j|jq$Wd|krt|jdj|jdj|jdj|jdj}ttj|g|dd}nd|krttd td |d jtd }ttj|g|dd}nTt |rdS|d j}ttjtd |gdd}ttjtd t |gg|}d|_ |j |_ |S)NZextra_trailersZ filter_lambdafpitZxp)prefixZnoneZ_fseqargsfilterlist) Z should_skipappendZclonergetrsymsZpowerrrrr )selfZnodeZresultsZtrailerstnewrr0/usr/lib64/python3.6/lib2to3/fixes/fix_filter.py transform:s4      zFixFilter.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZskip_onrrrrrr sr N)__doc__r rZpytreerZpygramrrZ fixer_utilrrrrZConditionalFixr rrrrs    PK51]E3'__pycache__/fix_execfile.cpython-36.pycnu[3 \@sVdZddlmZddlmZmZmZmZmZm Z m Z m Z m Z m Z GdddejZdS)zoFixer for execfile. This converts usages of the execfile function into calls to the built-in exec() function. ) fixer_base) CommaNameCallLParenRParenDotNodeArgListStringsymsc@seZdZdZdZddZdS) FixExecfileTz power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > | power< 'execfile' trailer< '(' filename=any ')' > > cCs0|st|d}|jd}|jd}|jdjdj}t|jttddg|d}ttj t d|g}ttj t t d gttj t tgg} |g| } |j} d| _td d} | t| t| g} tt d | d }|g}|dk r|jt|jg|dk r|jt|jgtt d ||jdS)Nfilenameglobalslocalsz"rb" )Zrparenopenreadz'exec'compileexec)prefixr)AssertionErrorgetZchildrenZcloner rr r r ZpowerrZtrailerrrrrrextend)selfZnodeZresultsrrrZexecfile_parenZ open_argsZ open_callrZ open_exprZ filename_argZexec_strZ compile_argsZ compile_callargsr2/usr/lib64/python3.6/lib2to3/fixes/fix_execfile.py transforms,      zFixExecfile.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr!rrrr r sr N)__doc__rrZ fixer_utilrrrrrrr r r r ZBaseFixr rrrr s 0PK51]a-__pycache__/fix_ws_comma.cpython-36.opt-2.pycnu[3 \B@s:ddlmZddlmZddlmZGdddejZdS))pytree)token) fixer_basec@s@eZdZdZdZejejdZejej dZ ee fZ ddZ dS) FixWsCommaTzH any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]> ,:cCsd|j}d}xR|jD]H}||jkrD|j}|jr>d|kr>d|_d}q|rX|j}|sXd|_d}qW|S)NF T )ZcloneZchildrenSEPSprefixisspace)selfZnodeZresultsnewZcommaZchildr r2/usr/lib64/python3.6/lib2to3/fixes/fix_ws_comma.py transforms  zFixWsComma.transformN) __name__ __module__ __qualname__ZexplicitZPATTERNrZLeafrCOMMACOLONr rrrrrr s rN)r rZpgen2rrZBaseFixrrrrrs   PK51]> +__pycache__/fix_future.cpython-36.opt-1.pycnu[3 \#@s2dZddlmZddlmZGdddejZdS)zVRemove __future__ imports from __future__ import foo is replaced with an empty line. ) fixer_base) BlankLinec@s eZdZdZdZdZddZdS) FixFutureTz;import_from< 'from' module_name="__future__" 'import' any > cCst}|j|_|S)N)rprefix)selfZnodeZresultsnewr 0/usr/lib64/python3.6/lib2to3/fixes/fix_future.py transformszFixFuture.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZ run_orderr r r r r r srN)__doc__rZ fixer_utilrZBaseFixrr r r r s  PK51]Cpb*__pycache__/fix_raise.cpython-36.opt-1.pycnu[3 \n @sZdZddlmZddlmZddlmZddlmZmZm Z m Z m Z Gdddej Z dS) a[Fixer for 'raise E, V, T' raise -> raise raise E -> raise E raise E, V -> raise E(V) raise E, V, T -> raise E(V).with_traceback(T) raise E, None, T -> raise E.with_traceback(T) raise (((E, E'), E''), E'''), V -> raise E(V) raise "foo", V, T -> warns about string exceptions CAVEATS: 1) "raise E, V" will be incorrectly translated if V is an exception instance. The correct Python 3 idiom is raise E from V but since we can't detect instance-hood by syntax alone and since any client code would have to be changed as well, we don't automate this. )pytree)token) fixer_base)NameCallAttrArgListis_tuplec@seZdZdZdZddZdS)FixRaiseTzB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > c Csl|j}|dj}|jtjkr2d}|j||dSt|rbx t|rZ|jdjdj}qDsz&FixRaise.transform..tbNonewith_traceback)prefix)symsrtyperSTRINGZcannot_convertr ZchildrenrrZNodeZ raise_stmtrNAMEvaluerrrZ simple_stmt) selfZnodeZresultsrr msgnewrargsreZwith_tbrrr transform&s@        zFixRaise.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr'rrrrr sr N)__doc__rrZpgen2rrZ fixer_utilrrrrr ZBaseFixr rrrrs    PK51]hRN)__pycache__/fix_exec.cpython-36.opt-2.pycnu[3 \@s6ddlmZddlmZmZmZGdddejZdS)) fixer_base)CommaNameCallc@seZdZdZdZddZdS)FixExecTzx exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > | exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > cCs|j}|d}|jd}|jd}|jg}d|d_|dk rR|jt|jg|dk rn|jt|jgttd||jdS)Nabcexec)prefix)symsgetZcloner extendrrr)selfZnodeZresultsrrrr argsr./usr/lib64/python3.6/lib2to3/fixes/fix_exec.py transforms    zFixExec.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrrrsrN)r rZ fixer_utilrrrZBaseFixrrrrr s PK51]+??,__pycache__/fix_unicode.cpython-36.opt-2.pycnu[3 \@s8ddlmZddlmZdddZGdddejZdS) )token) fixer_basechrstr)ZunichrZunicodecs,eZdZdZdZfddZddZZS) FixUnicodeTzSTRING | 'unicode' | 'unichr'cs"tt|j||d|jk|_dS)Nunicode_literals)superr start_treeZfuture_featuresr)selfZtreefilename) __class__1/usr/lib64/python3.6/lib2to3/fixes/fix_unicode.pyr szFixUnicode.start_treecCs|jtjkr$|j}t|j|_|S|jtjkr|j}|j rl|ddkrld|krldjdd|j dD}|ddkr|dd}||jkr|S|j}||_|SdS) Nz'"\z\\cSs g|]}|jddjddqS)z\uz\\uz\Uz\\U)replace).0vr r r !sz(FixUnicode.transform..ZuU) typerNAMEZclone_mappingvalueSTRINGrjoinsplit)r ZnodeZresultsnewvalr r r transforms"      zFixUnicode.transform)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr r __classcell__r r )r rrs rN)Zpgen2rrrZBaseFixrr r r r s   PK51]~66*__pycache__/fix_types.cpython-36.opt-2.pycnu[3 \@slddlmZddlmZdddddddd d d d d d dddddddddZddeDZGdddejZdS)) fixer_base)Namebool memoryviewtypecomplexdictztype(Ellipsis)floatintlistobjectz type(None)ztype(NotImplemented)slicebytesz(str,)tuplestrrange)Z BooleanTypeZ BufferTypeZ ClassTypeZ ComplexTypeZDictTypeZDictionaryTypeZ EllipsisTypeZ FloatTypeZIntTypeZListTypeZLongTypeZ ObjectTypeZNoneTypeZNotImplementedTypeZ SliceTypeZ StringTypeZ StringTypesZ TupleTypeZTypeTypeZ UnicodeTypeZ XRangeTypecCsg|] }d|qS)z)power< 'types' trailer< '.' name='%s' > >).0trr//usr/lib64/python3.6/lib2to3/fixes/fix_types.py 3src@s"eZdZdZdjeZddZdS)FixTypesT|cCs&tj|dj}|r"t||jdSdS)Nname)prefix) _TYPE_MAPPINGgetvaluerr)selfZnodeZresultsZ new_valuerrr transform9szFixTypes.transformN)__name__ __module__ __qualname__Z BM_compatiblejoin_patsZPATTERNrrrrrr5s rN)rZ fixer_utilrrr$ZBaseFixrrrrrs0  PK51]k/$__pycache__/fix_types.cpython-36.pycnu[3 \@spdZddlmZddlmZddddddd d d d d d ddddddddddZddeDZGdddejZdS)aFixer for removing uses of the types module. These work for only the known names in the types module. The forms above can include types. or not. ie, It is assumed the module is imported either as: import types from types import ... # either * or specific types The import statements are not modified. There should be another fixer that handles at least the following constants: type([]) -> list type(()) -> tuple type('') -> str ) fixer_base)Namebool memoryviewtypecomplexdictztype(Ellipsis)floatintlistobjectz type(None)ztype(NotImplemented)slicebytesz(str,)tuplestrrange)Z BooleanTypeZ BufferTypeZ ClassTypeZ ComplexTypeZDictTypeZDictionaryTypeZ EllipsisTypeZ FloatTypeZIntTypeZListTypeZLongTypeZ ObjectTypeZNoneTypeZNotImplementedTypeZ SliceTypeZ StringTypeZ StringTypesZ TupleTypeZTypeTypeZ UnicodeTypeZ XRangeTypecCsg|] }d|qS)z)power< 'types' trailer< '.' name='%s' > >).0trr//usr/lib64/python3.6/lib2to3/fixes/fix_types.py 3src@s"eZdZdZdjeZddZdS)FixTypesT|cCs&tj|dj}|r"t||jdSdS)Nname)prefix) _TYPE_MAPPINGgetvaluerr)selfZnodeZresultsZ new_valuerrr transform9szFixTypes.transformN)__name__ __module__ __qualname__Z BM_compatiblejoin_patsZPATTERNrrrrrr5s rN) __doc__rZ fixer_utilrrr$ZBaseFixrrrrrs2  PK51]Ȍ +__pycache__/fix_import.cpython-36.opt-1.pycnu[3 \ @sZdZddlmZddlmZmZmZmZddlm Z m Z m Z ddZ Gdd d ej Zd S) zFixer for import statements. If spam is being imported from the local directory, this import: from spam import eggs Becomes: from .spam import eggs And this import: import spam Becomes: from . import spam ) fixer_base)dirnamejoinexistssep) FromImportsymstokenccs|g}x|r|j}|jtjkr*|jVq|jtjkrPdjdd|jDVq|jtj krn|j |jdq|jtj kr|j |jdddqt dqWdS) zF Walks over all the names imported in a dotted_as_names node. cSsg|] }|jqS)value).0Zchr r 0/usr/lib64/python3.6/lib2to3/fixes/fix_import.py sz$traverse_imports..rNrzunknown node type)poptyper NAMEr r Z dotted_namerchildrenZdotted_as_nameappendZdotted_as_namesextendAssertionError)namespendingnoder r rtraverse_importss     rcs4eZdZdZdZfddZddZddZZS) FixImportTzj import_from< 'from' imp=any 'import' ['('] any [')'] > | import_name< 'import' imp=any > cs"tt|j||d|jk|_dS)NZabsolute_import)superr start_treeZfuture_featuresskip)selfZtreename) __class__r rr/szFixImport.start_treecCs|jr dS|d}|jtjkrZxt|ds6|jd}q W|j|jrd|j|_|jn^d}d}x$t |D]}|j|rd}qld}qlW|r|r|j |ddSt d|g}|j |_ |SdS)Nimpr r.FTz#absolute and local imports together) r rr Z import_fromhasattrrprobably_a_local_importr ZchangedrZwarningrprefix)r!rZresultsr$Z have_localZ have_absoluteZmod_namenewr r r transform3s,        zFixImport.transformcCsv|jdrdS|jddd}t|j}t||}ttt|dsHdSx(dtddd d gD]}t||rZd SqZWdS) Nr%Frz __init__.pyz.pyz.pycz.soz.slz.pydT) startswithsplitrfilenamerrr)r!Zimp_name base_pathZextr r rr'Us    z!FixImport.probably_a_local_import) __name__ __module__ __qualname__Z BM_compatibleZPATTERNrr*r' __classcell__r r )r#rr&s  "rN)__doc__r rZos.pathrrrrZ fixer_utilrr r rZBaseFixrr r r r s  PK51]N #__pycache__/fix_dict.cpython-36.pycnu[3 \@sjdZddlmZddlmZddlmZddlmZmZmZddlmZej dhBZ Gdd d ej Z d S) ajFixer for dict methods. d.keys() -> list(d.keys()) d.items() -> list(d.items()) d.values() -> list(d.values()) d.iterkeys() -> iter(d.keys()) d.iteritems() -> iter(d.items()) d.itervalues() -> iter(d.values()) d.viewkeys() -> d.keys() d.viewitems() -> d.items() d.viewvalues() -> d.values() Except in certain very specific contexts: the iter() can be dropped when the context is list(), sorted(), iter() or for...in; the list() can be dropped when the context is list() or sorted() (but not iter() or for...in!). Special contexts that apply to both: list(), sorted(), tuple() set(), any(), all(), sum(). Note: iter(d.keys()) could be written as iter(d) but since the original d.iterkeys() was also redundant we don't fix this. And there are (rare) contexts where it makes a difference (e.g. when passing it as an argument to a function that introspects the argument). )pytree)patcomp) fixer_base)NameCallDot) fixer_utiliterc@s@eZdZdZdZddZdZejeZ dZ eje Z ddZ d S) FixDictTa power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues'| 'viewkeys'|'viewitems'|'viewvalues') > parens=trailer< '(' ')' > tail=any* > c Cs|d}|dd}|d}|j}|j}|jd}|jd} |sD| rP|dd}|dksdtt|d d |D}d d |D}| o|j||} |tj|jt t ||j dg|dj g} tj|j | } | p| sd| _ tt |rdnd| g} |rtj|j | g|} |j | _ | S)Nheadmethodtailr ZviewkeysitemsvaluescSsg|] }|jqS)clone).0nrr./usr/lib64/python3.6/lib2to3/fixes/fix_dict.py Asz%FixDict.transform..cSsg|] }|jqSr)r)rrrrrrBs)prefixZparenslist)rrr)symsvalue startswithAssertionErrorreprin_special_contextrZNodeZtrailerrrrrZpowerr) selfnoderesultsr r rrZ method_nameisiterZisviewZspecialargsnewrrr transform6s4      zFixDict.transformz3power< func=NAME trailer< '(' node=any ')' > any* >zmfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > cCs|jdkrdSi}|jjdk r^|jj|jj|r^|d|kr^|rN|djtkS|djtjkS|sfdS|jj|j|o|d|kS)NFr#func)parentp1matchr iter_exemptrconsuming_callsp2)r"r#r%r$rrrr!Zs   zFixDict.in_special_contextN) __name__ __module__ __qualname__Z BM_compatibleZPATTERNr(ZP1rZcompile_patternr+ZP2r/r!rrrrr )s   r N) __doc__rrrrrrrrr.r-ZBaseFixr rrrrs     PK51]I4-__pycache__/fix_exitfunc.cpython-36.opt-1.pycnu[3 \ @sJdZddlmZmZddlmZmZmZmZm Z m Z Gdddej Z dS)z7 Convert use of sys.exitfunc to use the atexit module. )pytree fixer_base)NameAttrCallCommaNewlinesymscs<eZdZdZdZdZfddZfddZddZZ S) FixExitfuncTa ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) cstt|j|dS)N)superr __init__)selfargs) __class__2/usr/lib64/python3.6/lib2to3/fixes/fix_exitfunc.pyr szFixExitfunc.__init__cstt|j||d|_dS)N)r r start_tree sys_import)r Ztreefilename)rrrr!szFixExitfunc.start_treec Cs&d|kr |jdkr|d|_dS|dj}d|_tjtjttdtd}t ||g|j}|j ||jdkr|j |ddS|jj d}|j tjkr|jt|jtddnj|jj}|j j|j}|j} tjtjtd tddg} tjtj| g} |j|dt|j|d | dS) NrfuncatexitregisterzKCan't find sys import; Please add an atexit import at the top of your file. import)rZcloneprefixrZNoder ZpowerrrrreplaceZwarningZchildrentypeZdotted_as_namesZ append_childrparentindexZ import_nameZ simple_stmtZ insert_childr) r ZnodeZresultsrrZcallnamesZcontaining_stmtZpositionZstmt_containerZ new_importnewrrr transform%s2         zFixExitfunc.transform) __name__ __module__ __qualname__Zkeep_line_orderZ BM_compatibleZPATTERNr rr$ __classcell__rr)rrr s   r N) __doc__Zlib2to3rrZlib2to3.fixer_utilrrrrrr ZBaseFixr rrrrs PK51]k-O %__pycache__/fix_except.cpython-36.pycnu[3 \ @sfdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z ddZ Gdd d ejZd S) aFixer for except statements with named exceptions. The following cases will be converted: - "except E, T:" where T is a name: except E as T: - "except E, T:" where T is not a name, tuple or list: except E as t: T = t This is done because the target of an "except" clause must be a name. - "except E, T:" where T is a tuple or list literal: except E as t: T = t.args )pytree)token) fixer_base)AssignAttrNameis_tupleis_listsymsccsHxBt|D]6\}}|jtjkr |jdjdkr |||dfVq WdS)Nexceptr) enumeratetyper except_clausechildrenvalue)Znodesinr0/usr/lib64/python3.6/lib2to3/fixes/fix_except.py find_exceptss rc@seZdZdZdZddZdS) FixExceptTa1 try_stmt< 'try' ':' (simple_stmt | suite) cleanup=(except_clause ':' (simple_stmt | suite))+ tail=(['except' ':' (simple_stmt | suite)] ['else' ':' (simple_stmt | suite)] ['finally' ':' (simple_stmt | suite)]) > cCs|j}dd|dD}dd|dD}x*t|D]\}}t|jdkr6|jdd\}} } | jtdd d | jtjkrDt|j d d } | j } d | _ | j| | j } |j} x"t | D]\}}t |tjrPqWt| st| rt| t| td }n t| | }x&t| d|D]}|jd |q W|j||q6| j d kr6d | _ q6Wdd|jddD||}tj|j|S)NcSsg|] }|jqSr)clone).0rrrr 2sz'FixExcept.transform..tailcSsg|] }|jqSr)r)rZchrrrr4sZcleanupas )prefixargsr cSsg|] }|jqSr)r)rcrrrr\s)r rlenrreplacerrrNAMEnew_namerr r isinstancerZNoderr rrreversedZ insert_child)selfZnodeZresultsr rZ try_cleanuprZe_suiteEZcommaNZnew_NtargetZ suite_stmtsrZstmtZassignZchildrrrr transform/s6      zFixExcept.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr/rrrrr$srN)__doc__r!rZpgen2rrZ fixer_utilrrrrr r rZBaseFixrrrrrs     PK51]K.__pycache__/fix_itertools.cpython-36.opt-1.pycnu[3 \ @s2dZddlmZddlmZGdddejZdS)aT Fixer for itertools.(imap|ifilter|izip) --> (map|filter|zip) and itertools.ifilterfalse --> itertools.filterfalse (bugs 2360-2363) imports from itertools are fixed in fix_itertools_import.py If itertools is imported as something else (ie: import itertools as it; it.izip(spam, eggs)) method calls will not get fixed. ) fixer_base)Namec@s*eZdZdZdZdeZdZddZdS) FixItertoolsTz7('imap'|'ifilter'|'izip'|'izip_longest'|'ifilterfalse')z power< it='itertools' trailer< dot='.' func=%(it_funcs)s > trailer< '(' [any] ')' > > | power< func=%(it_funcs)s trailer< '(' [any] ')' > > cCsd}|dd}d|krV|jd krV|d|d}}|j}|j|j|jj||p^|j}|jt|jdd|ddS) Nfuncit ifilterfalse izip_longestdot)prefix)r r )valuer removeparentreplacer)selfZnodeZresultsr rr rr3/usr/lib64/python3.6/lib2to3/fixes/fix_itertools.py transforms    zFixItertools.transformN) __name__ __module__ __qualname__Z BM_compatibleZit_funcslocalsZPATTERNZ run_orderrrrrrrs  rN)__doc__rZ fixer_utilrZBaseFixrrrrrs  PK51]5ڍ_ (__pycache__/fix_map.cpython-36.opt-1.pycnu[3 \8@sfdZddlmZddlmZddlmZmZmZm Z m Z ddl m Z ddlmZGdddejZd S) aFixer that changes map(F, ...) into list(map(F, ...)) unless there exists a 'from future_builtins import map' statement in the top-level namespace. As a special case, map(None, X) is changed into list(X). (This is necessary because the semantics are changed in this case -- the new map(None, X) is equivalent to [(x,) for x in X].) We avoid the transformation (except for the special case mentioned above) if the map() call is directly contained in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. NOTE: This is still not correct if the original code was depending on map(F, X, Y, ...) to go on until the longest argument is exhausted, substituting None for missing values -- like zip(), it now stops as soon as the shortest argument is exhausted. )token) fixer_base)NameArgListCallListCompin_special_context)python_symbols)Nodec@s eZdZdZdZdZddZdS)FixMapTaL map_none=power< 'map' trailer< '(' arglist< 'None' ',' arg=any [','] > ')' > [extra_trailers=trailer*] > | map_lambda=power< 'map' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > [extra_trailers=trailer*] > | power< 'map' args=trailer< '(' [any] ')' > [extra_trailers=trailer*] > zfuture_builtins.mapcCs|j|rdSg}d|kr:x|dD]}|j|jq$W|jjtjkrv|j|d|j}d|_t t d|g}n&d|krt |dj|dj|dj}t tj |g|dd }nd |kr|d j}d|_nd |krj|d }|jtjkrL|jd jtjkrL|jd jdjtjkrL|jd jdjdkrL|j|ddSt tj t d|jg}d|_t|rxdSt tj t dt|gg|}d|_|j|_|S)NZextra_trailerszYou should use a for loop herelistZ map_lambdaZxpfpit)prefixZmap_noneargargsNonezjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequencemap)Z should_skipappendZcloneparenttypesymsZ simple_stmtZwarningrrrrr ZpowerZtrailerZchildrenZarglistrNAMEvaluerr)selfZnodeZresultsZtrailerstnewrr -/usr/lib64/python3.6/lib2to3/fixes/fix_map.py transform@sF        zFixMap.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNZskip_onr"r r r r!r sr N)__doc__Zpgen2rr rZ fixer_utilrrrrrZpygramr rZpytreer ZConditionalFixr r r r r!s     PK51]m2-__pycache__/fix_execfile.cpython-36.opt-2.pycnu[3 \@sRddlmZddlmZmZmZmZmZmZm Z m Z m Z m Z Gdddej ZdS)) fixer_base) CommaNameCallLParenRParenDotNodeArgListStringsymsc@seZdZdZdZddZdS) FixExecfileTz power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > | power< 'execfile' trailer< '(' filename=any ')' > > cCs&|d}|jd}|jd}|jdjdj}t|jttddg|d}ttjt d|g}ttj t t d gttj t t gg} |g| } |j} d| _td d} | t| t| g} tt d | d }|g}|dk r|jt|jg|dk r|jt|jgtt d ||jdS)Nfilenameglobalslocalsz"rb" )Zrparenopenreadz'exec'compileexec)prefixr)getZchildrenZcloner rr r r ZpowerrZtrailerrrrrrextend)selfZnodeZresultsrrrZexecfile_parenZ open_argsZ open_callrZ open_exprZ filename_argZexec_strZ compile_argsZ compile_callargsr2/usr/lib64/python3.6/lib2to3/fixes/fix_execfile.py transforms*     zFixExecfile.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrrr sr N)rrZ fixer_utilrrrrrrr r r r ZBaseFixr rrrr s 0PK51]9z*__pycache__/fix_input.cpython-36.opt-1.pycnu[3 \@sLdZddlmZddlmZmZddlmZejdZGdddej Z dS) z4Fixer that changes input(...) into eval(input(...)).) fixer_base)CallName)patcompz&power< 'eval' trailer< '(' any ')' > >c@seZdZdZdZddZdS)FixInputTzL power< 'input' args=trailer< '(' [any] ')' > > cCs6tj|jjrdS|j}d|_ttd|g|jdS)Neval)prefix)contextmatchparentZcloner rr)selfZnodeZresultsnewr//usr/lib64/python3.6/lib2to3/fixes/fix_input.py transforms zFixInput.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNrrrrrr srN) __doc__rrZ fixer_utilrrrZcompile_patternr ZBaseFixrrrrrs    PK51]"*)__pycache__/fix_long.cpython-36.opt-1.pycnu[3 \@s2dZddlmZddlmZGdddejZdS)z/Fixer that turns 'long' into 'int' everywhere. ) fixer_base)is_probably_builtinc@seZdZdZdZddZdS)FixLongTz'long'cCst|rd|_|jdS)Nint)rvalueZchanged)selfZnodeZresultsr./usr/lib64/python3.6/lib2to3/fixes/fix_long.py transformszFixLong.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr rrrr r srN)__doc__Zlib2to3rZlib2to3.fixer_utilrZBaseFixrrrrr s  PK51]T0__pycache__/fix_numliterals.cpython-36.opt-2.pycnu[3 \@s:ddlmZddlmZddlmZGdddejZdS))token) fixer_base)Numberc@s"eZdZejZddZddZdS)FixNumliteralscCs|jjdp|jddkS)N0Ll)value startswith)selfnoder5/usr/lib64/python3.6/lib2to3/fixes/fix_numliterals.pymatchszFixNumliterals.matchcCs`|j}|ddkr |dd}n2|jdrR|jrRtt|dkrRd|dd}t||jdS)NrrrZ0o)prefixr r )r r isdigitlensetrr)r r Zresultsvalrrr transforms  "zFixNumliterals.transformN)__name__ __module__ __qualname__rNUMBERZ _accept_typerrrrrrr srN)Zpgen2rrZ fixer_utilrZBaseFixrrrrrs   PK51]Kt!!+__pycache__/fix_urllib.cpython-36.opt-2.pycnu[3 \ @sddlmZmZddlmZmZmZmZmZm Z m Z ddddddd d d gfd d ddddddddddddddgfddgfgddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4gfdd5d6gfgd7Z e d8j e d9d:d;d<Z Gd=d>d>eZd?S)@) alternates FixImports)NameComma FromImportNewlinefind_indentationNodesymszurllib.requestZ URLopenerZFancyURLopenerZ urlretrieveZ _urlopenerZurlopenZ urlcleanupZ pathname2urlZ url2pathnamez urllib.parseZquoteZ quote_plusZunquoteZ unquote_plusZ urlencodeZ splitattrZ splithostZ splitnportZ splitpasswdZ splitportZ splitqueryZsplittagZ splittypeZ splituserZ splitvaluez urllib.errorZContentTooShortErrorZinstall_openerZ build_openerZRequestZOpenerDirectorZ BaseHandlerZHTTPDefaultErrorHandlerZHTTPRedirectHandlerZHTTPCookieProcessorZ ProxyHandlerZHTTPPasswordMgrZHTTPPasswordMgrWithDefaultRealmZAbstractBasicAuthHandlerZHTTPBasicAuthHandlerZProxyBasicAuthHandlerZAbstractDigestAuthHandlerZHTTPDigestAuthHandlerZProxyDigestAuthHandlerZ HTTPHandlerZ HTTPSHandlerZ FileHandlerZ FTPHandlerZCacheFTPHandlerZUnknownHandlerZURLErrorZ HTTPError)urlliburllib2r r ccs~t}xrtjD]f\}}x\|D]T}|\}}t|}d||fVd|||fVd|Vd|Vd||fVqWqWdS)Nzimport_name< 'import' (module=%r | dotted_as_names< any* module=%r any* >) > zimport_from< 'from' mod_member=%r 'import' ( member=%s | import_as_name< member=%s 'as' any > | import_as_names< members=any* >) > zIimport_from< 'from' module_star=%r 'import' star='*' > ztimport_name< 'import' dotted_as_name< module_as=%r 'as' any > > zKpower< bare_with_attr=%r trailer< '.' member=%s > any* > )setMAPPINGitemsr)ZbareZ old_moduleZchangeschangeZ new_modulemembersr0/usr/lib64/python3.6/lib2to3/fixes/fix_urllib.py build_pattern0s   rc@s4eZdZddZddZddZddZd d Zd S) FixUrllibcCs djtS)N|)joinr)selfrrrrIszFixUrllib.build_patterncCsz|jd}|j}g}x6t|jddD] }|jt|d|dtgq(W|jtt|jdd|d|j|dS)Nmoduler r)prefixr) getrrvalueextendrrappendreplace)rnoderesultsZ import_modprefnamesnamerrrtransform_importLs   zFixUrllib.transform_importcCs>|jd}|j}|jd}|rt|tr0|d}d}x*t|jD]}|j|dkr@|d}Pq@W|rx|jt||dn |j|dng}i} |d} x| D]}|j t j kr|j dj} |j dj} n |j} d} | d krxPt|jD]B}| |dkr|d| kr|j |d| j|dgj |qWqWg} t|}d }d d }x|D]}| |}g}x2|ddD]"}|j||||j tqlW|j||d|t||}| s|jjj|r||_| j |d }qNW| r.g}x&| ddD]}|j|tgqW|j | d|j|n |j|ddS)N mod_membermemberrr )rz!This is an invalid module elementr,TcSsX|jtjkrHt|jdj|d|jdj|jdjg}ttj|gSt|j|dgS)Nr)rr r*)typer import_as_namerchildrenrZcloner )r&rZkidsrrr handle_names   z/FixUrllib.transform_member..handle_nameFzAll module elements are invalidrrrr)rr isinstancelistrrr!rcannot_convertr,r r-r.r setdefaultrrrrparentendswithr)rr"r#r(r$r)new_namermodulesZmod_dictrZas_name member_nameZ new_nodesZ indentationfirstr/rZeltsr%ZeltnewZnodesZnew_noderrrtransform_member\sh            zFixUrllib.transform_membercCs|jd}|jd}d}t|tr*|d}x*t|jD]}|j|dkr6|d}Pq6W|rp|jt||jdn |j|ddS)Nbare_with_attrr)rr )rz!This is an invalid module element) rr0r1rrr!rrr2)rr"r#Z module_dotr)r6rrrr transform_dots   zFixUrllib.transform_dotcCsz|jdr|j||n^|jdr0|j||nF|jdrH|j||n.|jdr`|j|dn|jdrv|j|ddS)Nrr(r<Z module_starzCannot handle star imports.Z module_asz#This module is now multiple modules)rr'r;r=r2)rr"r#rrr transforms     zFixUrllib.transformN)__name__ __module__ __qualname__rr'r;r=r>rrrrrGs LrN)Zlib2to3.fixes.fix_importsrrZlib2to3.fixer_utilrrrrrr r rr rrrrrrs>$ PK51]k-O +__pycache__/fix_except.cpython-36.opt-1.pycnu[3 \ @sfdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z ddZ Gdd d ejZd S) aFixer for except statements with named exceptions. The following cases will be converted: - "except E, T:" where T is a name: except E as T: - "except E, T:" where T is not a name, tuple or list: except E as t: T = t This is done because the target of an "except" clause must be a name. - "except E, T:" where T is a tuple or list literal: except E as t: T = t.args )pytree)token) fixer_base)AssignAttrNameis_tupleis_listsymsccsHxBt|D]6\}}|jtjkr |jdjdkr |||dfVq WdS)Nexceptr) enumeratetyper except_clausechildrenvalue)Znodesinr0/usr/lib64/python3.6/lib2to3/fixes/fix_except.py find_exceptss rc@seZdZdZdZddZdS) FixExceptTa1 try_stmt< 'try' ':' (simple_stmt | suite) cleanup=(except_clause ':' (simple_stmt | suite))+ tail=(['except' ':' (simple_stmt | suite)] ['else' ':' (simple_stmt | suite)] ['finally' ':' (simple_stmt | suite)]) > cCs|j}dd|dD}dd|dD}x*t|D]\}}t|jdkr6|jdd\}} } | jtdd d | jtjkrDt|j d d } | j } d | _ | j| | j } |j} x"t | D]\}}t |tjrPqWt| st| rt| t| td }n t| | }x&t| d|D]}|jd |q W|j||q6| j d kr6d | _ q6Wdd|jddD||}tj|j|S)NcSsg|] }|jqSr)clone).0rrrr 2sz'FixExcept.transform..tailcSsg|] }|jqSr)r)rZchrrrr4sZcleanupas )prefixargsr cSsg|] }|jqSr)r)rcrrrr\s)r rlenrreplacerrrNAMEnew_namerr r isinstancerZNoderr rrreversedZ insert_child)selfZnodeZresultsr rZ try_cleanuprZe_suiteEZcommaNZnew_NtargetZ suite_stmtsrZstmtZassignZchildrrrr transform/s6      zFixExcept.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr/rrrrr$srN)__doc__r!rZpgen2rrZ fixer_utilrrrrr r rZBaseFixrrrrrs     PK51]91+__pycache__/fix_buffer.cpython-36.opt-2.pycnu[3 \N@s.ddlmZddlmZGdddejZdS)) fixer_base)Namec@s eZdZdZdZdZddZdS) FixBufferTzR power< name='buffer' trailer< '(' [any] ')' > any* > cCs |d}|jtd|jddS)Nname memoryview)prefix)replacerr)selfZnodeZresultsrr 0/usr/lib64/python3.6/lib2to3/fixes/fix_buffer.py transformszFixBuffer.transformN)__name__ __module__ __qualname__Z BM_compatibleZexplicitZPATTERNr r r r r r srN)rZ fixer_utilrZBaseFixrr r r r s  PK51]%ځ&__pycache__/fix_imports.cpython-36.pycnu[3 \41@sdZddlmZddlmZmZddddddd d d d d d d ddddddddddddddddddd d!d"d"d#d$d%d&d'd(d(d(d)d*d*d+d,d-0Zd.d/Zefd0d1ZGd2d3d3ej Z d4S)5z/Fix incompatible imports and module references.) fixer_base)Name attr_chainiopicklebuiltinscopyregZqueueZ socketserverZ configparserreprlibztkinter.filedialogztkinter.simpledialogztkinter.colorchooserztkinter.commondialogztkinter.dialogz tkinter.dndz tkinter.fontztkinter.messageboxztkinter.scrolledtextztkinter.constantsz tkinter.tixz tkinter.ttkZtkinterZ _markupbasewinreg_threadZ _dummy_threadzdbm.bsdzdbm.dumbzdbm.ndbmzdbm.gnuz xmlrpc.clientz xmlrpc.serverz http.clientz html.entitiesz html.parserz http.cookieszhttp.cookiejarz http.server subprocess collectionsz urllib.parsezurllib.robotparser)0StringIOZ cStringIOZcPickleZ __builtin__Zcopy_regZQueueZ SocketServerZ ConfigParserreprZ FileDialogZ tkFileDialogZ SimpleDialogZtkSimpleDialogZtkColorChooserZtkCommonDialogZDialogZTkdndZtkFontZ tkMessageBoxZ ScrolledTextZ TkconstantsZTixZttkZTkinterZ markupbase_winregZthreadZ dummy_threadZdbhashZdumbdbmZdbmZgdbmZ xmlrpclibZDocXMLRPCServerZSimpleXMLRPCServerZhttplibZhtmlentitydefsZ HTMLParserZCookieZ cookielibZBaseHTTPServerZSimpleHTTPServerZ CGIHTTPServerZcommands UserStringUserListZurlparseZ robotparsercCsddjtt|dS)N(|))joinmapr)membersr1/usr/lib64/python3.6/lib2to3/fixes/fix_imports.py alternates=srccsTdjdd|D}t|j}d||fVd|Vd||fVd|VdS)Nz | cSsg|] }d|qS)zmodule_name='%s'r).0keyrrr Bsz!build_pattern..zyname_import=import_name< 'import' ((%s) | multiple_imports=dotted_as_names< any* (%s) any* >) > zimport_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > zimport_name< 'import' (dotted_as_name< (%s) 'as' any > | multiple_imports=dotted_as_names< any* dotted_as_name< (%s) 'as' any > any* >) > z3power< bare_with_attr=(%s) trailer<'.' any > any* >)rrkeys)mappingZmod_listZ bare_namesrrr build_patternAs   r!csTeZdZdZdZeZdZddZfddZ fddZ fd d Z d d Z Z S) FixImportsTcCsdjt|jS)Nr)rr!r )selfrrrr!`szFixImports.build_patterncs|j|_tt|jdS)N)r!ZPATTERNsuperr"compile_pattern)r$) __class__rrr&cs zFixImports.compile_patterncsHtt|j|}|rDd|kr@tfddt|dDr@dS|SdS)Nbare_with_attrc3s|]}|VqdS)Nr)robj)matchrr qsz#FixImports.match..parentF)r%r"r*anyr)r$noderesults)r')r*rr*js zFixImports.matchcstt|j||i|_dS)N)r%r" start_treereplace)r$Ztreefilename)r'rrr0vszFixImports.start_treecCs|jd}|rh|j}|j|}|jt||jdd|krD||j|<d|kr|j|}|r|j||n2|dd}|jj|j}|r|jt||jddS)NZ module_name)prefixZ name_importZmultiple_importsr()getvaluer r1rr3r* transform)r$r.r/Z import_modZmod_namenew_nameZ bare_namerrrr7zs     zFixImports.transform)__name__ __module__ __qualname__Z BM_compatibleZkeep_line_orderMAPPINGr Z run_orderr!r&r*r0r7 __classcell__rr)r'rr"Us  r"N) __doc__rZ fixer_utilrrr<rr!ZBaseFixr"rrrrsj  PK51]%ځ,__pycache__/fix_imports.cpython-36.opt-1.pycnu[3 \41@sdZddlmZddlmZmZddddddd d d d d d d ddddddddddddddddddd d!d"d"d#d$d%d&d'd(d(d(d)d*d*d+d,d-0Zd.d/Zefd0d1ZGd2d3d3ej Z d4S)5z/Fix incompatible imports and module references.) fixer_base)Name attr_chainiopicklebuiltinscopyregZqueueZ socketserverZ configparserreprlibztkinter.filedialogztkinter.simpledialogztkinter.colorchooserztkinter.commondialogztkinter.dialogz tkinter.dndz tkinter.fontztkinter.messageboxztkinter.scrolledtextztkinter.constantsz tkinter.tixz tkinter.ttkZtkinterZ _markupbasewinreg_threadZ _dummy_threadzdbm.bsdzdbm.dumbzdbm.ndbmzdbm.gnuz xmlrpc.clientz xmlrpc.serverz http.clientz html.entitiesz html.parserz http.cookieszhttp.cookiejarz http.server subprocess collectionsz urllib.parsezurllib.robotparser)0StringIOZ cStringIOZcPickleZ __builtin__Zcopy_regZQueueZ SocketServerZ ConfigParserreprZ FileDialogZ tkFileDialogZ SimpleDialogZtkSimpleDialogZtkColorChooserZtkCommonDialogZDialogZTkdndZtkFontZ tkMessageBoxZ ScrolledTextZ TkconstantsZTixZttkZTkinterZ markupbase_winregZthreadZ dummy_threadZdbhashZdumbdbmZdbmZgdbmZ xmlrpclibZDocXMLRPCServerZSimpleXMLRPCServerZhttplibZhtmlentitydefsZ HTMLParserZCookieZ cookielibZBaseHTTPServerZSimpleHTTPServerZ CGIHTTPServerZcommands UserStringUserListZurlparseZ robotparsercCsddjtt|dS)N(|))joinmapr)membersr1/usr/lib64/python3.6/lib2to3/fixes/fix_imports.py alternates=srccsTdjdd|D}t|j}d||fVd|Vd||fVd|VdS)Nz | cSsg|] }d|qS)zmodule_name='%s'r).0keyrrr Bsz!build_pattern..zyname_import=import_name< 'import' ((%s) | multiple_imports=dotted_as_names< any* (%s) any* >) > zimport_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > zimport_name< 'import' (dotted_as_name< (%s) 'as' any > | multiple_imports=dotted_as_names< any* dotted_as_name< (%s) 'as' any > any* >) > z3power< bare_with_attr=(%s) trailer<'.' any > any* >)rrkeys)mappingZmod_listZ bare_namesrrr build_patternAs   r!csTeZdZdZdZeZdZddZfddZ fddZ fd d Z d d Z Z S) FixImportsTcCsdjt|jS)Nr)rr!r )selfrrrr!`szFixImports.build_patterncs|j|_tt|jdS)N)r!ZPATTERNsuperr"compile_pattern)r$) __class__rrr&cs zFixImports.compile_patterncsHtt|j|}|rDd|kr@tfddt|dDr@dS|SdS)Nbare_with_attrc3s|]}|VqdS)Nr)robj)matchrr qsz#FixImports.match..parentF)r%r"r*anyr)r$noderesults)r')r*rr*js zFixImports.matchcstt|j||i|_dS)N)r%r" start_treereplace)r$Ztreefilename)r'rrr0vszFixImports.start_treecCs|jd}|rh|j}|j|}|jt||jdd|krD||j|<d|kr|j|}|r|j||n2|dd}|jj|j}|r|jt||jddS)NZ module_name)prefixZ name_importZmultiple_importsr()getvaluer r1rr3r* transform)r$r.r/Z import_modZmod_namenew_nameZ bare_namerrrr7zs     zFixImports.transform)__name__ __module__ __qualname__Z BM_compatibleZkeep_line_orderMAPPINGr Z run_orderr!r&r*r0r7 __classcell__rr)r'rr"Us  r"N) __doc__rZ fixer_utilrrr<rr!ZBaseFixr"rrrrsj  PK51],__pycache__/fix_has_key.cpython-36.opt-2.pycnu[3 \| @s>ddlmZddlmZddlmZmZGdddejZdS))pytree) fixer_base)Name parenthesizec@seZdZdZdZddZdS) FixHasKeyTa anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > after=any* > | negation=not_test< 'not' anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > > > c Cs||j}|jj|jkr&|jj|jr&dS|jd}|d}|j}dd|dD}|dj}|jd} | rxdd| D} |j|j |j|j |j |j |j |jfkrt|}t|d kr|d }ntj|j|}d |_td d d } |rtdd d } tj|j| | f} tj|j || |f} | r8t| } tj|j| ft| } |jj|j |j|j|j|j|j|j|j|jf krrt| } || _| S)NnegationanchorcSsg|] }|jqS)clone).0nr r 1/usr/lib64/python3.6/lib2to3/fixes/fix_has_key.py Rsz'FixHasKey.transform..beforeargaftercSsg|] }|jqSr )r )r r r r r rVs in)prefixnot)symsparenttypeZnot_testpatternmatchgetrr Z comparisonZand_testZor_testZtestZlambdefZargumentrlenrZNodeZpowerrZcomp_optupleexprZxor_exprZand_exprZ shift_exprZ arith_exprZtermZfactor) selfZnodeZresultsrrrrrrrZn_opZn_notnewr r r transformGsD       zFixHasKey.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr#r r r r r&srN)rrZ fixer_utilrrZBaseFixrr r r r !s  PK51]!ZH/ / +__pycache__/fix_except.cpython-36.opt-2.pycnu[3 \ @sbddlmZddlmZddlmZddlmZmZmZm Z m Z m Z ddZ Gdddej Zd S) )pytree)token) fixer_base)AssignAttrNameis_tupleis_listsymsccsHxBt|D]6\}}|jtjkr |jdjdkr |||dfVq WdS)Nexceptr) enumeratetyper except_clausechildrenvalue)Znodesinr0/usr/lib64/python3.6/lib2to3/fixes/fix_except.py find_exceptss rc@seZdZdZdZddZdS) FixExceptTa1 try_stmt< 'try' ':' (simple_stmt | suite) cleanup=(except_clause ':' (simple_stmt | suite))+ tail=(['except' ':' (simple_stmt | suite)] ['else' ':' (simple_stmt | suite)] ['finally' ':' (simple_stmt | suite)]) > cCs|j}dd|dD}dd|dD}x*t|D]\}}t|jdkr6|jdd\}} } | jtdd d | jtjkrDt|j d d } | j } d | _ | j| | j } |j} x"t | D]\}}t |tjrPqWt| st| rt| t| td }n t| | }x&t| d|D]}|jd |q W|j||q6| j d kr6d | _ q6Wdd|jddD||}tj|j|S)NcSsg|] }|jqSr)clone).0rrrr 2sz'FixExcept.transform..tailcSsg|] }|jqSr)r)rZchrrrr4sZcleanupas )prefixargsr cSsg|] }|jqSr)r)rcrrrr\s)r rlenrreplacerrrNAMEnew_namerr r isinstancerZNoderr rrreversedZ insert_child)selfZnodeZresultsr rZ try_cleanuprZe_suiteEZcommaNZnew_NtargetZ suite_stmtsrZstmtZassignZchildrrrr transform/s6      zFixExcept.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr/rrrrr$srN)r!rZpgen2rrZ fixer_utilrrrrr r rZBaseFixrrrrrs    PK51]oH+Q Q &__pycache__/fix_has_key.cpython-36.pycnu[3 \| @sBdZddlmZddlmZddlmZmZGdddejZdS)a&Fixer for has_key(). Calls to .has_key() methods are expressed in terms of the 'in' operator: d.has_key(k) -> k in d CAVEATS: 1) While the primary target of this fixer is dict.has_key(), the fixer will change any has_key() method call, regardless of its class. 2) Cases like this will not be converted: m = d.has_key if m(k): ... Only *calls* to has_key() are converted. While it is possible to convert the above to something like m = d.__contains__ if m(k): ... this is currently not done. )pytree) fixer_base)Name parenthesizec@seZdZdZdZddZdS) FixHasKeyTa anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > after=any* > | negation=not_test< 'not' anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > > > c Cs|st|j}|jj|jkr.|jj|jr.dS|jd}|d}|j}dd|dD}|dj }|jd} | rdd| D} |j|j |j|j |j |j |j|jfkrt|}t|d kr|d }ntj|j|}d |_td d d } |rtdd d } tj|j| | f} tj|j || |f} | rBt| } tj|j| ft| } |jj|j |j|j|j|j|j|j|j|jf kr|t| } || _| S)NnegationanchorcSsg|] }|jqS)clone).0nr r 1/usr/lib64/python3.6/lib2to3/fixes/fix_has_key.py Rsz'FixHasKey.transform..beforeargaftercSsg|] }|jqSr )r )r r r r r rVs in)prefixnot)AssertionErrorsymsparenttypeZnot_testpatternmatchgetrr Z comparisonZand_testZor_testZtestZlambdefZargumentrlenrZNodeZpowerrZcomp_optupleexprZxor_exprZand_exprZ shift_exprZ arith_exprZtermZfactor) selfZnodeZresultsrrrrrrrZn_opZn_notnewr r r transformGsF       zFixHasKey.transformN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr$r r r r r&srN) __doc__rrZ fixer_utilrrZBaseFixrr r r r s  PK51]%__pycache__/fix_buffer.cpython-36.pycnu[3 \N@s2dZddlmZddlmZGdddejZdS)z4Fixer that changes buffer(...) into memoryview(...).) fixer_base)Namec@s eZdZdZdZdZddZdS) FixBufferTzR power< name='buffer' trailer< '(' [any] ')' > any* > cCs |d}|jtd|jddS)Nname memoryview)prefix)replacerr)selfZnodeZresultsrr 0/usr/lib64/python3.6/lib2to3/fixes/fix_buffer.py transformszFixBuffer.transformN)__name__ __module__ __qualname__Z BM_compatibleZexplicitZPATTERNr r r r r r srN)__doc__rZ fixer_utilrZBaseFixrr r r r s  PK51]폏#__pycache__/__init__.cpython-36.pycnu[3 \/@sdS)Nrrr./usr/lib64/python3.6/lib2to3/fixes/__init__.pysPK51]aI䖪-__pycache__/fix_imports2.cpython-36.opt-2.pycnu[3 \!@s,ddlmZdddZGdddejZdS)) fix_importsZdbm)ZwhichdbZanydbmc@seZdZdZeZdS) FixImports2N)__name__ __module__ __qualname__Z run_orderMAPPINGmappingr r 2/usr/lib64/python3.6/lib2to3/fixes/fix_imports2.pyr srN)rrZ FixImportsrr r r r s PK51]y fix_apply.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer for apply(). This converts apply(func, v, k) into (func)(*v, **k).""" # Local imports from .. import pytree from ..pgen2 import token from .. import fixer_base from ..fixer_util import Call, Comma, parenthesize class FixApply(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< 'apply' trailer< '(' arglist< (not argument ')' > > """ def transform(self, node, results): syms = self.syms assert results func = results["func"] args = results["args"] kwds = results.get("kwds") # I feel like we should be able to express this logic in the # PATTERN above but I don't know how to do it so... if args: if args.type == self.syms.star_expr: return # Make no change. if (args.type == self.syms.argument and args.children[0].value == '**'): return # Make no change. if kwds and (kwds.type == self.syms.argument and kwds.children[0].value == '**'): return # Make no change. prefix = node.prefix func = func.clone() if (func.type not in (token.NAME, syms.atom) and (func.type != syms.power or func.children[-2].type == token.DOUBLESTAR)): # Need to parenthesize func = parenthesize(func) func.prefix = "" args = args.clone() args.prefix = "" if kwds is not None: kwds = kwds.clone() kwds.prefix = "" l_newargs = [pytree.Leaf(token.STAR, u"*"), args] if kwds is not None: l_newargs.extend([Comma(), pytree.Leaf(token.DOUBLESTAR, u"**"), kwds]) l_newargs[-2].prefix = u" " # that's the ** token # XXX Sometimes we could be cleverer, e.g. apply(f, (x, y) + t) # can be translated into f(x, y, *t) instead of f(*(x, y) + t) #new = pytree.Node(syms.power, (func, ArgList(l_newargs))) return Call(func, l_newargs, prefix=prefix) PK51]IIfix_isinstance.pynu[# Copyright 2008 Armin Ronacher. # Licensed to PSF under a Contributor Agreement. """Fixer that cleans up a tuple argument to isinstance after the tokens in it were fixed. This is mainly used to remove double occurrences of tokens as a leftover of the long -> int / unicode -> str conversion. eg. isinstance(x, (int, long)) -> isinstance(x, (int, int)) -> isinstance(x, int) """ from .. import fixer_base from ..fixer_util import token class FixIsinstance(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > """ run_order = 6 def transform(self, node, results): names_inserted = set() testlist = results["args"] args = testlist.children new_args = [] iterator = enumerate(args) for idx, arg in iterator: if arg.type == token.NAME and arg.value in names_inserted: if idx < len(args) - 1 and args[idx + 1].type == token.COMMA: iterator.next() continue else: new_args.append(arg) if arg.type == token.NAME: names_inserted.add(arg.value) if new_args and new_args[-1].type == token.COMMA: del new_args[-1] if len(new_args) == 1: atom = testlist.parent new_args[0].prefix = atom.prefix atom.replace(new_args[0]) else: args[:] = new_args node.changed() PK51]PTfix_set_literal.pynu[""" Optional fixer to transform set() calls to set literals. """ # Author: Benjamin Peterson from lib2to3 import fixer_base, pytree from lib2to3.fixer_util import token, syms class FixSetLiteral(fixer_base.BaseFix): BM_compatible = True explicit = True PATTERN = """power< 'set' trailer< '(' (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) > | single=any) ']' > | atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > ) ')' > > """ def transform(self, node, results): single = results.get("single") if single: # Make a fake listmaker fake = pytree.Node(syms.listmaker, [single.clone()]) single.replace(fake) items = fake else: items = results["items"] # Build the contents of the literal literal = [pytree.Leaf(token.LBRACE, u"{")] literal.extend(n.clone() for n in items.children) literal.append(pytree.Leaf(token.RBRACE, u"}")) # Set the prefix of the right brace to that of the ')' or ']' literal[-1].prefix = items.next_sibling.prefix maker = pytree.Node(syms.dictsetmaker, literal) maker.prefix = node.prefix # If the original was a one tuple, we need to remove the extra comma. if len(maker.children) == 4: n = maker.children[2] n.remove() maker.children[-1].prefix = n.prefix # Finally, replace the set call with our shiny new literal. return maker PK51]8r == fix_ne.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer that turns <> into !=.""" # Local imports from .. import pytree from ..pgen2 import token from .. import fixer_base class FixNe(fixer_base.BaseFix): # This is so simple that we don't need the pattern compiler. _accept_type = token.NOTEQUAL def match(self, node): # Override return node.value == u"<>" def transform(self, node, results): new = pytree.Leaf(token.NOTEQUAL, u"!=", prefix=node.prefix) return new PK51]& fix_reload.pynu["""Fixer for reload(). reload(s) -> imp.reload(s)""" # Local imports from .. import fixer_base from ..fixer_util import ImportAndCall, touch_import class FixReload(fixer_base.BaseFix): BM_compatible = True order = "pre" PATTERN = """ power< 'reload' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > """ def transform(self, node, results): if results: # I feel like we should be able to express this logic in the # PATTERN above but I don't know how to do it so... obj = results['obj'] if obj: if obj.type == self.syms.star_expr: return # Make no change. if (obj.type == self.syms.argument and obj.children[0].value == '**'): return # Make no change. names = ('imp', 'reload') new = ImportAndCall(node, results, names) touch_import(None, 'imp', node) return new PK51]fix_itertools.pynu[""" Fixer for itertools.(imap|ifilter|izip) --> (map|filter|zip) and itertools.ifilterfalse --> itertools.filterfalse (bugs 2360-2363) imports from itertools are fixed in fix_itertools_import.py If itertools is imported as something else (ie: import itertools as it; it.izip(spam, eggs)) method calls will not get fixed. """ # Local imports from .. import fixer_base from ..fixer_util import Name class FixItertools(fixer_base.BaseFix): BM_compatible = True it_funcs = "('imap'|'ifilter'|'izip'|'izip_longest'|'ifilterfalse')" PATTERN = """ power< it='itertools' trailer< dot='.' func=%(it_funcs)s > trailer< '(' [any] ')' > > | power< func=%(it_funcs)s trailer< '(' [any] ')' > > """ %(locals()) # Needs to be run after fix_(map|zip|filter) run_order = 6 def transform(self, node, results): prefix = None func = results['func'][0] if ('it' in results and func.value not in (u'ifilterfalse', u'izip_longest')): dot, it = (results['dot'], results['it']) # Remove the 'itertools' prefix = it.prefix it.remove() # Replace the node which contains ('.', 'function') with the # function (to be consistent with the second part of the pattern) dot.remove() func.parent.replace(func) prefix = prefix or func.prefix func.replace(Name(func.value[1:], prefix=prefix)) PK51]n fix_paren.pynu["""Fixer that addes 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 = u"" # Make it hug the parentheses target.insert_child(0, lparen) target.append_child(RParen()) PK51]{ fix_exitfunc.pynu[""" Convert use of sys.exitfunc to use the atexit module. """ # Author: Benjamin Peterson from lib2to3 import pytree, fixer_base from lib2to3.fixer_util import Name, Attr, Call, Comma, Newline, syms class FixExitfunc(fixer_base.BaseFix): keep_line_order = True BM_compatible = True PATTERN = """ ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) """ def __init__(self, *args): super(FixExitfunc, self).__init__(*args) def start_tree(self, tree, filename): super(FixExitfunc, self).start_tree(tree, filename) self.sys_import = None def transform(self, node, results): # First, find the sys import. We'll just hope it's global scope. if "sys_import" in results: if self.sys_import is None: self.sys_import = results["sys_import"] return func = results["func"].clone() func.prefix = u"" register = pytree.Node(syms.power, Attr(Name(u"atexit"), Name(u"register")) ) call = Call(register, [func], node.prefix) node.replace(call) if self.sys_import is None: # That's interesting. self.warning(node, "Can't find sys import; Please add an atexit " "import at the top of your file.") return # Now add an atexit import after the sys import. names = self.sys_import.children[1] if names.type == syms.dotted_as_names: names.append_child(Comma()) names.append_child(Name(u"atexit", u" ")) else: containing_stmt = self.sys_import.parent position = containing_stmt.children.index(self.sys_import) stmt_container = containing_stmt.parent new_import = pytree.Node(syms.import_name, [Name(u"import"), Name(u"atexit", u" ")] ) new = pytree.Node(syms.simple_stmt, [new_import]) containing_stmt.insert_child(position + 1, Newline()) containing_stmt.insert_child(position + 2, new) PK51]Bo fix_dict.pynu[# Copyright 2007 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer for dict methods. d.keys() -> list(d.keys()) d.items() -> list(d.items()) d.values() -> list(d.values()) d.iterkeys() -> iter(d.keys()) d.iteritems() -> iter(d.items()) d.itervalues() -> iter(d.values()) d.viewkeys() -> d.keys() d.viewitems() -> d.items() d.viewvalues() -> d.values() Except in certain very specific contexts: the iter() can be dropped when the context is list(), sorted(), iter() or for...in; the list() can be dropped when the context is list() or sorted() (but not iter() or for...in!). Special contexts that apply to both: list(), sorted(), tuple() set(), any(), all(), sum(). Note: iter(d.keys()) could be written as iter(d) but since the original d.iterkeys() was also redundant we don't fix this. And there are (rare) contexts where it makes a difference (e.g. when passing it as an argument to a function that introspects the argument). """ # Local imports from .. import pytree from .. import patcomp from ..pgen2 import token from .. import fixer_base from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot from .. import fixer_util iter_exempt = fixer_util.consuming_calls | set(["iter"]) class FixDict(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues'| 'viewkeys'|'viewitems'|'viewvalues') > parens=trailer< '(' ')' > tail=any* > """ def transform(self, node, results): head = results["head"] method = results["method"][0] # Extract node for method name tail = results["tail"] syms = self.syms method_name = method.value isiter = method_name.startswith(u"iter") isview = method_name.startswith(u"view") if isiter or isview: method_name = method_name[4:] assert method_name in (u"keys", u"items", u"values"), repr(method) head = [n.clone() for n in head] tail = [n.clone() for n in tail] special = not tail and self.in_special_context(node, isiter) args = head + [pytree.Node(syms.trailer, [Dot(), Name(method_name, prefix=method.prefix)]), results["parens"].clone()] new = pytree.Node(syms.power, args) if not (special or isview): new.prefix = u"" new = Call(Name(u"iter" if isiter else u"list"), [new]) if tail: new = pytree.Node(syms.power, [new] + tail) new.prefix = node.prefix return new P1 = "power< func=NAME trailer< '(' node=any ')' > any* >" p1 = patcomp.compile_pattern(P1) P2 = """for_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > """ p2 = patcomp.compile_pattern(P2) def in_special_context(self, node, isiter): if node.parent is None: return False results = {} if (node.parent.parent is not None and self.p1.match(node.parent.parent, results) and results["node"] is node): if isiter: # iter(d.iterkeys()) -> iter(d.keys()), etc. return results["func"].value in iter_exempt else: # list(d.keys()) -> list(d.keys()), etc. return results["func"].value in fixer_util.consuming_calls if not isiter: return False # for ... in d.iterkeys() -> for ... in d.keys(), etc. return self.p2.match(node.parent, results) and results["node"] is node PK51]^ Km m fix_next.pynu["""Fixer for it.next() -> next(it), per PEP 3114.""" # Author: Collin Winter # Things that currently aren't covered: # - listcomp "next" names aren't warned # - "with" statement targets aren't checked # Local imports from ..pgen2 import token from ..pygram import python_symbols as syms from .. import fixer_base from ..fixer_util import Name, Call, find_binding bind_warning = "Calls to builtin next() possibly shadowed by global binding" class FixNext(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > > | power< head=any+ trailer< '.' attr='next' > not trailer< '(' ')' > > | classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='next' parameters< '(' NAME ')' > any+ > any* > > | global=global_stmt< 'global' any* 'next' any* > """ order = "pre" # Pre-order tree traversal def start_tree(self, tree, filename): super(FixNext, self).start_tree(tree, filename) n = find_binding(u'next', tree) if n: self.warning(n, bind_warning) self.shadowed_next = True else: self.shadowed_next = False def transform(self, node, results): assert results base = results.get("base") attr = results.get("attr") name = results.get("name") if base: if self.shadowed_next: attr.replace(Name(u"__next__", prefix=attr.prefix)) else: base = [n.clone() for n in base] base[0].prefix = u"" node.replace(Call(Name(u"next", prefix=node.prefix), base)) elif name: n = Name(u"__next__", prefix=name.prefix) name.replace(n) elif attr: # We don't do this transformation if we're assigning to "x.next". # Unfortunately, it doesn't seem possible to do this in PATTERN, # so it's being done here. if is_assign_target(node): head = results["head"] if "".join([str(n) for n in head]).strip() == u'__builtin__': self.warning(node, bind_warning) return attr.replace(Name(u"__next__")) elif "global" in results: self.warning(node, bind_warning) self.shadowed_next = True ### The following functions help test if node is part of an assignment ### target. def is_assign_target(node): assign = find_assign(node) if assign is None: return False for child in assign.children: if child.type == token.EQUAL: return False elif is_subtree(child, node): return True return False def find_assign(node): if node.type == syms.expr_stmt: return node if node.type == syms.simple_stmt or node.parent is None: return None return find_assign(node.parent) def is_subtree(root, node): if root == node: return True return any(is_subtree(c, node) for c in root.children) PK51]lSOO fix_buffer.pynu[# Copyright 2007 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer that changes buffer(...) into memoryview(...).""" # Local imports from .. import fixer_base from ..fixer_util import Name class FixBuffer(fixer_base.BaseFix): BM_compatible = True explicit = True # The user must ask for this fixer PATTERN = """ power< name='buffer' trailer< '(' [any] ')' > any* > """ def transform(self, node, results): name = results["name"] name.replace(Name(u"memoryview", prefix=name.prefix)) PK51]ݔN fix_long.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer that turns 'long' into 'int' everywhere. """ # Local imports from lib2to3 import fixer_base from lib2to3.fixer_util import is_probably_builtin class FixLong(fixer_base.BaseFix): BM_compatible = True PATTERN = "'long'" def transform(self, node, results): if is_probably_builtin(node): node.value = u"int" node.changed() PK51]ܬ'!!fix_imports2.pynu["""Fix incompatible imports and module references that must be fixed after fix_imports.""" from . import fix_imports MAPPING = { 'whichdb': 'dbm', 'anydbm': 'dbm', } class FixImports2(fix_imports.FixImports): run_order = 7 mapping = MAPPING PK51]DY fix_map.pynu[# Copyright 2007 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer that changes map(F, ...) into list(map(F, ...)) unless there exists a 'from future_builtins import map' statement in the top-level namespace. As a special case, map(None, X) is changed into list(X). (This is necessary because the semantics are changed in this case -- the new map(None, X) is equivalent to [(x,) for x in X].) We avoid the transformation (except for the special case mentioned above) if the map() call is directly contained in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. NOTE: This is still not correct if the original code was depending on map(F, X, Y, ...) to go on until the longest argument is exhausted, substituting None for missing values -- like zip(), it now stops as soon as the shortest argument is exhausted. """ # Local imports from ..pgen2 import token from .. import fixer_base from ..fixer_util import Name, Call, ListComp, in_special_context from ..pygram import python_symbols as syms class FixMap(fixer_base.ConditionalFix): BM_compatible = True PATTERN = """ map_none=power< 'map' trailer< '(' arglist< 'None' ',' arg=any [','] > ')' > > | map_lambda=power< 'map' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > > | power< 'map' trailer< '(' [arglist=any] ')' > > """ skip_on = 'future_builtins.map' def transform(self, node, results): if self.should_skip(node): return if node.parent.type == syms.simple_stmt: self.warning(node, "You should use a for loop here") new = node.clone() new.prefix = u"" new = Call(Name(u"list"), [new]) elif "map_lambda" in results: new = ListComp(results["xp"].clone(), results["fp"].clone(), results["it"].clone()) else: if "map_none" in results: new = results["arg"].clone() else: if "arglist" in results: args = results["arglist"] if args.type == syms.arglist and \ args.children[0].type == token.NAME and \ args.children[0].value == "None": self.warning(node, "cannot convert map(None, ...) " "with multiple arguments because map() " "now truncates to the shortest sequence") return if in_special_context(node): return None new = node.clone() new.prefix = u"" new = Call(Name(u"list"), [new]) new.prefix = node.prefix return new PK51]i( fix_exec.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer for exec. This converts usages of the exec statement into calls to a built-in exec() function. exec code in ns1, ns2 -> exec(code, ns1, ns2) """ # Local imports from .. import pytree from .. import fixer_base from ..fixer_util import Comma, Name, Call class FixExec(fixer_base.BaseFix): BM_compatible = True PATTERN = """ exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > | exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > """ def transform(self, node, results): assert results syms = self.syms a = results["a"] b = results.get("b") c = results.get("c") args = [a.clone()] args[0].prefix = "" if b is not None: args.extend([Comma(), b.clone()]) if c is not None: args.extend([Comma(), c.clone()]) return Call(Name(u"exec"), args, prefix=node.prefix) PK51]7h## fix_future.pynu["""Remove __future__ imports from __future__ import foo is replaced with an empty line. """ # Author: Christian Heimes # Local imports from .. import fixer_base from ..fixer_util import BlankLine class FixFuture(fixer_base.BaseFix): BM_compatible = True PATTERN = """import_from< 'from' module_name="__future__" 'import' any >""" # This should be run last -- some things check for the import run_order = 10 def transform(self, node, results): new = BlankLine() new.prefix = node.prefix return new PK51]Н ==fix_imports.pynu["""Fix incompatible imports and module references.""" # Authors: Collin Winter, Nick Edds # Local imports from .. import fixer_base from ..fixer_util import Name, attr_chain MAPPING = {'StringIO': 'io', 'cStringIO': 'io', 'cPickle': 'pickle', '__builtin__' : 'builtins', 'copy_reg': 'copyreg', 'Queue': 'queue', 'SocketServer': 'socketserver', 'ConfigParser': 'configparser', 'repr': 'reprlib', 'FileDialog': 'tkinter.filedialog', 'tkFileDialog': 'tkinter.filedialog', 'SimpleDialog': 'tkinter.simpledialog', 'tkSimpleDialog': 'tkinter.simpledialog', 'tkColorChooser': 'tkinter.colorchooser', 'tkCommonDialog': 'tkinter.commondialog', 'Dialog': 'tkinter.dialog', 'Tkdnd': 'tkinter.dnd', 'tkFont': 'tkinter.font', 'tkMessageBox': 'tkinter.messagebox', 'ScrolledText': 'tkinter.scrolledtext', 'Tkconstants': 'tkinter.constants', 'Tix': 'tkinter.tix', 'ttk': 'tkinter.ttk', 'Tkinter': 'tkinter', 'markupbase': '_markupbase', '_winreg': 'winreg', 'thread': '_thread', 'dummy_thread': '_dummy_thread', # anydbm and whichdb are handled by fix_imports2 'dbhash': 'dbm.bsd', 'dumbdbm': 'dbm.dumb', 'dbm': 'dbm.ndbm', 'gdbm': 'dbm.gnu', 'xmlrpclib': 'xmlrpc.client', 'DocXMLRPCServer': 'xmlrpc.server', 'SimpleXMLRPCServer': 'xmlrpc.server', 'httplib': 'http.client', 'htmlentitydefs' : 'html.entities', 'HTMLParser' : 'html.parser', 'Cookie': 'http.cookies', 'cookielib': 'http.cookiejar', 'BaseHTTPServer': 'http.server', 'SimpleHTTPServer': 'http.server', 'CGIHTTPServer': 'http.server', #'test.test_support': 'test.support', 'commands': 'subprocess', 'UserString' : 'collections', 'UserList' : 'collections', 'urlparse' : 'urllib.parse', 'robotparser' : 'urllib.robotparser', } def alternates(members): return "(" + "|".join(map(repr, members)) + ")" def build_pattern(mapping=MAPPING): mod_list = ' | '.join(["module_name='%s'" % key for key in mapping]) bare_names = alternates(mapping.keys()) yield """name_import=import_name< 'import' ((%s) | multiple_imports=dotted_as_names< any* (%s) any* >) > """ % (mod_list, mod_list) yield """import_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > """ % mod_list yield """import_name< 'import' (dotted_as_name< (%s) 'as' any > | multiple_imports=dotted_as_names< any* dotted_as_name< (%s) 'as' any > any* >) > """ % (mod_list, mod_list) # Find usages of module members in code e.g. thread.foo(bar) yield "power< bare_with_attr=(%s) trailer<'.' any > any* >" % bare_names class FixImports(fixer_base.BaseFix): BM_compatible = True keep_line_order = True # This is overridden in fix_imports2. mapping = MAPPING # We want to run this fixer late, so fix_import doesn't try to make stdlib # renames into relative imports. run_order = 6 def build_pattern(self): return "|".join(build_pattern(self.mapping)) def compile_pattern(self): # We override this, so MAPPING can be pragmatically altered and the # changes will be reflected in PATTERN. self.PATTERN = self.build_pattern() super(FixImports, self).compile_pattern() # Don't match the node if it's within another match. def match(self, node): match = super(FixImports, self).match results = match(node) if results: # Module usage could be in the trailer of an attribute lookup, so we # might have nested matches when "bare_with_attr" is present. if "bare_with_attr" not in results and \ any(match(obj) for obj in attr_chain(node, "parent")): return False return results return False def start_tree(self, tree, filename): super(FixImports, self).start_tree(tree, filename) self.replace = {} def transform(self, node, results): import_mod = results.get("module_name") if import_mod: mod_name = import_mod.value new_name = unicode(self.mapping[mod_name]) import_mod.replace(Name(new_name, prefix=import_mod.prefix)) if "name_import" in results: # If it's not a "from x import x, y" or "import x as y" import, # marked its usage to be replaced. self.replace[mod_name] = new_name if "multiple_imports" in results: # This is a nasty hack to fix multiple imports on a line (e.g., # "import StringIO, urlparse"). The problem is that I can't # figure out an easy way to make a pattern recognize the keys of # MAPPING randomly sprinkled in an import statement. results = self.match(node) if results: self.transform(node, results) else: # Replace usage of the module. bare_name = results["bare_with_attr"][0] new_name = self.replace.get(bare_name.value) if new_name: bare_name.replace(Name(new_name, prefix=bare_name.prefix)) PK51]H| fix_xrange.pynu[# Copyright 2007 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer that changes xrange(...) into range(...).""" # Local imports from .. import fixer_base from ..fixer_util import Name, Call, consuming_calls from .. import patcomp class FixXrange(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > """ def start_tree(self, tree, filename): super(FixXrange, self).start_tree(tree, filename) self.transformed_xranges = set() def finish_tree(self, tree, filename): self.transformed_xranges = None def transform(self, node, results): name = results["name"] if name.value == u"xrange": return self.transform_xrange(node, results) elif name.value == u"range": return self.transform_range(node, results) else: raise ValueError(repr(name)) def transform_xrange(self, node, results): name = results["name"] name.replace(Name(u"range", prefix=name.prefix)) # This prevents the new range call from being wrapped in a list later. self.transformed_xranges.add(id(node)) def transform_range(self, node, results): if (id(node) not in self.transformed_xranges and not self.in_special_context(node)): range_call = Call(Name(u"range"), [results["args"].clone()]) # Encase the range call in list(). list_call = Call(Name(u"list"), [range_call], prefix=node.prefix) # Put things that were after the range() call after the list call. for n in results["rest"]: list_call.append_child(n) return list_call P1 = "power< func=NAME trailer< '(' node=any ')' > any* >" p1 = patcomp.compile_pattern(P1) P2 = """for_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > | comparison< any 'in' node=any any*> """ p2 = patcomp.compile_pattern(P2) def in_special_context(self, node): if node.parent is None: return False results = {} if (node.parent.parent is not None and self.p1.match(node.parent.parent, results) and results["node"] is node): # list(d.keys()) -> list(d.keys()), etc. return results["func"].value in consuming_calls # for ... in d.iterkeys() -> for ... in d.keys(), etc. return self.p2.match(node.parent, results) and results["node"] is node PK51]@`;; fix_filter.pynu[# Copyright 2007 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer that changes filter(F, X) into list(filter(F, X)). We avoid the transformation if the filter() call is directly contained in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. NOTE: This is still not correct if the original code was depending on filter(F, X) to return a string if X is a string and a tuple if X is a tuple. That would require type inference, which we don't do. Let Python 2.6 figure it out. """ # Local imports from ..pgen2 import token from .. import fixer_base from ..fixer_util import Name, Call, ListComp, in_special_context class FixFilter(fixer_base.ConditionalFix): BM_compatible = True PATTERN = """ filter_lambda=power< 'filter' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > > | power< 'filter' trailer< '(' arglist< none='None' ',' seq=any > ')' > > | power< 'filter' args=trailer< '(' [any] ')' > > """ skip_on = "future_builtins.filter" def transform(self, node, results): if self.should_skip(node): return if "filter_lambda" in results: new = ListComp(results.get("fp").clone(), results.get("fp").clone(), results.get("it").clone(), results.get("xp").clone()) elif "none" in results: new = ListComp(Name(u"_f"), Name(u"_f"), results["seq"].clone(), Name(u"_f")) else: if in_special_context(node): return None new = node.clone() new.prefix = u"" new = Call(Name(u"list"), [new]) new.prefix = node.prefix return new PK51]\fix_standarderror.pynu[# Copyright 2007 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer for StandardError -> Exception.""" # Local imports from .. import fixer_base from ..fixer_util import Name class FixStandarderror(fixer_base.BaseFix): BM_compatible = True PATTERN = """ 'StandardError' """ def transform(self, node, results): return Name(u"Exception", prefix=node.prefix) PK51]pV\ fix_operator.pynu["""Fixer for operator functions. operator.isCallable(obj) -> hasattr(obj, '__call__') operator.sequenceIncludes(obj) -> operator.contains(obj) operator.isSequenceType(obj) -> isinstance(obj, collections.Sequence) operator.isMappingType(obj) -> isinstance(obj, collections.Mapping) operator.isNumberType(obj) -> isinstance(obj, numbers.Number) operator.repeat(obj, n) -> operator.mul(obj, n) operator.irepeat(obj, n) -> operator.imul(obj, n) """ # Local imports from lib2to3 import fixer_base from lib2to3.fixer_util import Call, Name, String, touch_import def invocation(s): def dec(f): f.invocation = s return f return dec class FixOperator(fixer_base.BaseFix): BM_compatible = True order = "pre" methods = """ method=('isCallable'|'sequenceIncludes' |'isSequenceType'|'isMappingType'|'isNumberType' |'repeat'|'irepeat') """ obj = "'(' obj=any ')'" PATTERN = """ power< module='operator' trailer< '.' %(methods)s > trailer< %(obj)s > > | power< %(methods)s trailer< %(obj)s > > """ % dict(methods=methods, obj=obj) def transform(self, node, results): method = self._check_method(node, results) if method is not None: return method(node, results) @invocation("operator.contains(%s)") def _sequenceIncludes(self, node, results): return self._handle_rename(node, results, u"contains") @invocation("hasattr(%s, '__call__')") def _isCallable(self, node, results): obj = results["obj"] args = [obj.clone(), String(u", "), String(u"'__call__'")] return Call(Name(u"hasattr"), args, prefix=node.prefix) @invocation("operator.mul(%s)") def _repeat(self, node, results): return self._handle_rename(node, results, u"mul") @invocation("operator.imul(%s)") def _irepeat(self, node, results): return self._handle_rename(node, results, u"imul") @invocation("isinstance(%s, collections.Sequence)") def _isSequenceType(self, node, results): return self._handle_type2abc(node, results, u"collections", u"Sequence") @invocation("isinstance(%s, collections.Mapping)") def _isMappingType(self, node, results): return self._handle_type2abc(node, results, u"collections", u"Mapping") @invocation("isinstance(%s, numbers.Number)") def _isNumberType(self, node, results): return self._handle_type2abc(node, results, u"numbers", u"Number") def _handle_rename(self, node, results, name): method = results["method"][0] method.value = name method.changed() def _handle_type2abc(self, node, results, module, abc): touch_import(None, module, node) obj = results["obj"] args = [obj.clone(), String(u", " + u".".join([module, abc]))] return Call(Name(u"isinstance"), args, prefix=node.prefix) def _check_method(self, node, results): method = getattr(self, "_" + results["method"][0].value.encode("ascii")) if callable(method): if "module" in results: return method else: sub = (unicode(results["obj"]),) invocation_str = unicode(method.invocation) % sub self.warning(node, u"You should use '%s' here." % invocation_str) return None PK51]c^GGfix_ws_comma.pynu["""Fixer that changes 'a ,b' into 'a, b'. This also changes '{a :b}' into '{a: b}', but does not touch other uses of colons. It does not touch other uses of whitespace. """ from .. import pytree from ..pgen2 import token from .. import fixer_base class FixWsComma(fixer_base.BaseFix): explicit = True # The user must ask for this fixers PATTERN = """ any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]> """ COMMA = pytree.Leaf(token.COMMA, u",") COLON = pytree.Leaf(token.COLON, u":") SEPS = (COMMA, COLON) def transform(self, node, results): new = node.clone() comma = False for child in new.children: if child in self.SEPS: prefix = child.prefix if prefix.isspace() and u"\n" not in prefix: child.prefix = u"" comma = True else: if comma: prefix = child.prefix if not prefix: child.prefix = u" " comma = False return new PK51]+E22 fix_throw.pynu["""Fixer for generator.throw(E, V, T). g.throw(E) -> g.throw(E) g.throw(E, V) -> g.throw(E(V)) g.throw(E, V, T) -> g.throw(E(V).with_traceback(T)) g.throw("foo"[, V[, T]]) will warn about string exceptions.""" # Author: Collin Winter # Local imports from .. import pytree from ..pgen2 import token from .. import fixer_base from ..fixer_util import Name, Call, ArgList, Attr, is_tuple class FixThrow(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< any trailer< '.' 'throw' > trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > | power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > > """ def transform(self, node, results): syms = self.syms exc = results["exc"].clone() if exc.type is token.STRING: self.cannot_convert(node, "Python 3 does not support string exceptions") return # Leave "g.throw(E)" alone val = results.get(u"val") if val is None: return val = val.clone() if is_tuple(val): args = [c.clone() for c in val.children[1:-1]] else: val.prefix = u"" args = [val] throw_args = results["args"] if "tb" in results: tb = results["tb"].clone() tb.prefix = u"" e = Call(exc, args) with_tb = Attr(e, Name(u'with_traceback')) + [ArgList([tb])] throw_args.replace(pytree.Node(syms.power, with_tb)) else: throw_args.replace(Call(exc, args)) PK51]:^Sfix_sys_exc.pynu["""Fixer for sys.exc_{type, value, traceback} sys.exc_type -> sys.exc_info()[0] sys.exc_value -> sys.exc_info()[1] sys.exc_traceback -> sys.exc_info()[2] """ # By Jeff Balogh and Benjamin Peterson # Local imports from .. import fixer_base from ..fixer_util import Attr, Call, Name, Number, Subscript, Node, syms class FixSysExc(fixer_base.BaseFix): # This order matches the ordering of sys.exc_info(). exc_info = [u"exc_type", u"exc_value", u"exc_traceback"] BM_compatible = True PATTERN = """ power< 'sys' trailer< dot='.' attribute=(%s) > > """ % '|'.join("'%s'" % e for e in exc_info) def transform(self, node, results): sys_attr = results["attribute"][0] index = Number(self.exc_info.index(sys_attr.value)) call = Call(Name(u"exc_info"), prefix=sys_attr.prefix) attr = Attr(Name(u"sys"), call) attr[1].children[0].prefix = results["dot"].prefix attr.append(Subscript(index)) return Node(syms.power, attr, prefix=node.prefix) PK51]s fix_input.pynu["""Fixer that changes input(...) into eval(input(...)).""" # Author: Andre Roberge # Local imports from .. import fixer_base from ..fixer_util import Call, Name from .. import patcomp context = patcomp.compile_pattern("power< 'eval' trailer< '(' any ')' > >") class FixInput(fixer_base.BaseFix): BM_compatible = True PATTERN = """ power< 'input' args=trailer< '(' [any] ')' > > """ def transform(self, node, results): # If we're already wrapped in an eval() call, we're done. if context.match(node.parent.parent): return new = node.clone() new.prefix = u"" return Call(Name(u"eval"), [new], prefix=node.prefix) PK51]E[// __init__.pynu[# Dummy file to make this directory a package. PK51]&1 fix_types.pynu[# Copyright 2007 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer for removing uses of the types module. These work for only the known names in the types module. The forms above can include types. or not. ie, It is assumed the module is imported either as: import types from types import ... # either * or specific types The import statements are not modified. There should be another fixer that handles at least the following constants: type([]) -> list type(()) -> tuple type('') -> str """ # Local imports from ..pgen2 import token from .. import fixer_base from ..fixer_util import Name _TYPE_MAPPING = { 'BooleanType' : 'bool', 'BufferType' : 'memoryview', 'ClassType' : 'type', 'ComplexType' : 'complex', 'DictType': 'dict', 'DictionaryType' : 'dict', 'EllipsisType' : 'type(Ellipsis)', #'FileType' : 'io.IOBase', 'FloatType': 'float', 'IntType': 'int', 'ListType': 'list', 'LongType': 'int', 'ObjectType' : 'object', 'NoneType': 'type(None)', 'NotImplementedType' : 'type(NotImplemented)', 'SliceType' : 'slice', 'StringType': 'bytes', # XXX ? 'StringTypes' : '(str,)', # XXX ? 'TupleType': 'tuple', 'TypeType' : 'type', 'UnicodeType': 'str', 'XRangeType' : 'range', } _pats = ["power< 'types' trailer< '.' name='%s' > >" % t for t in _TYPE_MAPPING] class FixTypes(fixer_base.BaseFix): BM_compatible = True PATTERN = '|'.join(_pats) def transform(self, node, results): new_value = unicode(_TYPE_MAPPING.get(results["name"].value)) if new_value: return Name(new_value, prefix=node.prefix) return None PK51]gpAAfix_basestring.pynu["""Fixer for basestring -> str.""" # Author: Christian Heimes # Local imports from .. import fixer_base from ..fixer_util import Name class FixBasestring(fixer_base.BaseFix): BM_compatible = True PATTERN = "'basestring'" def transform(self, node, results): return Name(u"str", prefix=node.prefix) PK51]{Ffix_numliterals.pynu["""Fixer that turns 1L into 1, 0755 into 0o755. """ # Copyright 2007 Georg Brandl. # Licensed to PSF under a Contributor Agreement. # Local imports from ..pgen2 import token from .. import fixer_base from ..fixer_util import Number class FixNumliterals(fixer_base.BaseFix): # This is so simple that we don't need the pattern compiler. _accept_type = token.NUMBER def match(self, node): # Override return (node.value.startswith(u"0") or node.value[-1] in u"Ll") def transform(self, node, results): val = node.value if val[-1] in u'Ll': val = val[:-1] elif val.startswith(u'0') and val.isdigit() and len(set(val)) > 1: val = u"0o" + val[1:] return Number(val, prefix=node.prefix) PK51] 6dfix_tuple_params.pynu["""Fixer for function definitions with tuple parameters. def func(((a, b), c), d): ... -> def func(x, d): ((a, b), c) = x ... It will also support lambdas: lambda (x, y): x + y -> lambda t: t[0] + t[1] # The parens are a syntax error in Python 3 lambda (x): x + y -> lambda x: x + y """ # Author: Collin Winter # Local imports from .. import pytree from ..pgen2 import token from .. import fixer_base from ..fixer_util import Assign, Name, Newline, Number, Subscript, syms def is_docstring(stmt): return isinstance(stmt, pytree.Node) and \ stmt.children[0].type == token.STRING class FixTupleParams(fixer_base.BaseFix): run_order = 4 #use a lower order since lambda is part of other #patterns BM_compatible = True PATTERN = """ funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > """ def transform(self, node, results): if "lambda" in results: return self.transform_lambda(node, results) new_lines = [] suite = results["suite"] args = results["args"] # This crap is so "def foo(...): x = 5; y = 7" is handled correctly. # TODO(cwinter): suite-cleanup if suite[0].children[1].type == token.INDENT: start = 2 indent = suite[0].children[1].value end = Newline() else: start = 0 indent = u"; " end = pytree.Leaf(token.INDENT, u"") # We need access to self for new_name(), and making this a method # doesn't feel right. Closing over self and new_lines makes the # code below cleaner. def handle_tuple(tuple_arg, add_prefix=False): n = Name(self.new_name()) arg = tuple_arg.clone() arg.prefix = u"" stmt = Assign(arg, n.clone()) if add_prefix: n.prefix = u" " tuple_arg.replace(n) new_lines.append(pytree.Node(syms.simple_stmt, [stmt, end.clone()])) if args.type == syms.tfpdef: handle_tuple(args) elif args.type == syms.typedargslist: for i, arg in enumerate(args.children): if arg.type == syms.tfpdef: # Without add_prefix, the emitted code is correct, # just ugly. handle_tuple(arg, add_prefix=(i > 0)) if not new_lines: return # This isn't strictly necessary, but it plays nicely with other fixers. # TODO(cwinter) get rid of this when children becomes a smart list for line in new_lines: line.parent = suite[0] # TODO(cwinter) suite-cleanup after = start if start == 0: new_lines[0].prefix = u" " elif is_docstring(suite[0].children[start]): new_lines[0].prefix = indent after = start + 1 for line in new_lines: line.parent = suite[0] suite[0].children[after:after] = new_lines for i in range(after+1, after+len(new_lines)+1): suite[0].children[i].prefix = indent suite[0].changed() def transform_lambda(self, node, results): args = results["args"] body = results["body"] inner = simplify_args(results["inner"]) # Replace lambda ((((x)))): x with lambda x: x if inner.type == token.NAME: inner = inner.clone() inner.prefix = u" " args.replace(inner) return params = find_params(args) to_index = map_to_index(params) tup_name = self.new_name(tuple_name(params)) new_param = Name(tup_name, prefix=u" ") args.replace(new_param.clone()) for n in body.post_order(): if n.type == token.NAME and n.value in to_index: subscripts = [c.clone() for c in to_index[n.value]] new = pytree.Node(syms.power, [new_param.clone()] + subscripts) new.prefix = n.prefix n.replace(new) ### Helper functions for transform_lambda() def simplify_args(node): if node.type in (syms.vfplist, token.NAME): return node elif node.type == syms.vfpdef: # These look like vfpdef< '(' x ')' > where x is NAME # or another vfpdef instance (leading to recursion). while node.type == syms.vfpdef: node = node.children[1] return node raise RuntimeError("Received unexpected node %s" % node) def find_params(node): if node.type == syms.vfpdef: return find_params(node.children[1]) elif node.type == token.NAME: return node.value return [find_params(c) for c in node.children if c.type != token.COMMA] def map_to_index(param_list, prefix=[], d=None): if d is None: d = {} for i, obj in enumerate(param_list): trailer = [Subscript(Number(unicode(i)))] if isinstance(obj, list): map_to_index(obj, trailer, d=d) else: d[obj] = prefix + trailer return d def tuple_name(param_list): l = [] for obj in param_list: if isinstance(obj, list): l.append(tuple_name(obj)) else: l.append(obj) return u"_".join(l) PK81]]fix_metaclass.pycnu[ {fc@sdZddlmZddlmZddlmZmZmZm Z dZ dZ dZ dZ d Zd Zd ejfd YZd S(sFixer for __metaclass__ = X -> (metaclass=X) methods. The various forms of classef (inherits nothing, inherits once, inherints many) don't parse the same in the CST so we look at ALL classes for a __metaclass__ and if we find one normalize the inherits to all be an arglist. For one-liner classes ('class X: pass') there is no indent/dedent so we normalize those into having a suite. Moving the __metaclass__ into the classdef can also cause the class body to be empty so there is some special casing for that as well. This fixer also tries very hard to keep original indenting and spacing in all those corner cases. i(t fixer_base(ttoken(tNametsymstNodetLeafcCsx|jD]}|jtjkr,t|S|jtjkr |jr |jd}|jtjkr|jr|jd}t|tr|j dkrt Sqq q Wt S(s we have to check the cls_node without changing it. There are two possibilities: 1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta') 2) clsdef => simple_stmt => expr_stmt => Leaf('__meta') it __metaclass__( tchildrenttypeRtsuitet has_metaclasst simple_stmtt expr_stmtt isinstanceRtvaluetTruetFalse(tparenttnodet expr_nodet left_side((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pyR s   cCsx'|jD]}|jtjkr dSq Wx?t|jD]"\}}|jtjkr:Pq:q:Wtdttjg}xC|j|dr|j|d}|j |j |j qW|j ||}dS(sf one-line classes don't get a suite in the parse tree so we add one to normalize the tree NsNo class suite and no ':'!i( RRRR t enumerateRtCOLONt ValueErrorRt append_childtclonetremove(tcls_nodeRtiR t move_node((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pytfixup_parse_tree-s  c Csx7t|jD]"\}}|jtjkrPqqWdS|jttjg}ttj |g}x;|j|r|j|}|j |j |jqnW|j |||jdjd}|jdjd} | j |_ dS(s if there is a semi-colon all the parts count as part of the same simple_stmt. We just want the __metaclass__ part so we move everything after the semi-colon into its own simple_stmt node Ni(RRRRtSEMIRRRR R RRt insert_childtprefix( RRt stmt_nodetsemi_indRtnew_exprtnew_stmtRt new_leaf1t old_leaf1((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pytfixup_simple_stmtGs  cCs:|jr6|jdjtjkr6|jdjndS(Ni(RRRtNEWLINER(R((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pytremove_trailing_newline_s"ccsx3|jD]}|jtjkr Pq q Wtdxtt|jD]\}}|jtjkrL|jrL|jd}|jtjkr|jr|jd}t |t r|j dkrt |||t ||||fVqqqLqLWdS(NsNo class suite!iu __metaclass__(RRRR RtlistRR R R RRR(R*(RRRt simple_nodeRt left_node((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pyt find_metasds "   cCs|jddd}x,|rD|j}|jtjkrPqqWxm|r|j}t|tr|jtjkr|jrd|_ndS|j |jdddqHWdS(s If an INDENT is followed by a thing with a prefix then nuke the prefix Otherwise we get in trouble when removing __metaclass__ at suite start Niu( RtpopRRtINDENTR RtDEDENTR!textend(R tkidsR((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pyt fixup_indent{s    !  t FixMetaclasscBseZeZdZdZRS(s classdef cCs't|sdSt|d}x-t|D]\}}}|}|jq-W|jdj}t|jdkr|jdjtj kr|jd}q|jdj } t tj | g}|j d|nt|jdkrt tj g}|j d|n~t|jdkrt tj g}|j dttjd|j d||j dttjdn td |jdjd} d | _| j} |jr|jttjd d | _n d | _|jd} | jtjkstd | jd_d | jd_|j|t||js|jt|d} | | _|j| |jttjdnt|jdkr#|jdjtjkr#|jdjtjkr#t|d} |j d| |j dttjdndS(Niiiiiiu)u(sUnexpected class definitiont metaclassu,u uiupassu ii(R RtNoneR.RRRtlenRtarglistRRt set_childR RRtRPARtLPARRRR!RtCOMMAR tAssertionErrorR4R)R0R1(tselfRtresultstlast_metaclassR Rtstmtt text_typeR9Rtmeta_txttorig_meta_prefixR t pass_leaf((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pyt transforms`               (t__name__t __module__Rt BM_compatibletPATTERNRG(((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pyR5sN(t__doc__tRtpygramRt fixer_utilRRRRR RR(R*R.R4tBaseFixR5(((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pyts"      PK81]6 fix_ne.pycnu[ {fc@sSdZddlmZddlmZddlmZdejfdYZdS(sFixer that turns <> into !=.i(tpytree(ttoken(t fixer_basetFixNecBs#eZejZdZdZRS(cCs |jdkS(Nu<>(tvalue(tselftnode((s,/usr/lib64/python2.7/lib2to3/fixes/fix_ne.pytmatchscCs"tjtjdd|j}|S(Nu!=tprefix(RtLeafRtNOTEQUALR(RRtresultstnew((s,/usr/lib64/python2.7/lib2to3/fixes/fix_ne.pyt transforms(t__name__t __module__RR t _accept_typeRR (((s,/usr/lib64/python2.7/lib2to3/fixes/fix_ne.pyR s  N(t__doc__tRtpgen2RRtBaseFixR(((s,/usr/lib64/python2.7/lib2to3/fixes/fix_ne.pytsPK81]e˺ fix_dict.pycnu[ {fc@sdZddlmZddlmZddlmZddlmZddlmZm Z m Z m Z m Z m Z ddlmZejedgBZd ejfd YZd S( sjFixer for dict methods. d.keys() -> list(d.keys()) d.items() -> list(d.items()) d.values() -> list(d.values()) d.iterkeys() -> iter(d.keys()) d.iteritems() -> iter(d.items()) d.itervalues() -> iter(d.values()) d.viewkeys() -> d.keys() d.viewitems() -> d.items() d.viewvalues() -> d.values() Except in certain very specific contexts: the iter() can be dropped when the context is list(), sorted(), iter() or for...in; the list() can be dropped when the context is list() or sorted() (but not iter() or for...in!). Special contexts that apply to both: list(), sorted(), tuple() set(), any(), all(), sum(). Note: iter(d.keys()) could be written as iter(d) but since the original d.iterkeys() was also redundant we don't fix this. And there are (rare) contexts where it makes a difference (e.g. when passing it as an argument to a function that introspects the argument). i(tpytree(tpatcomp(ttoken(t fixer_base(tNametCalltLParentRParentArgListtDot(t fixer_utiltitertFixDictcBsPeZeZdZdZdZejeZ dZ eje Z dZ RS(s power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues'| 'viewkeys'|'viewitems'|'viewvalues') > parens=trailer< '(' ')' > tail=any* > cCs|d}|dd}|d}|j}|j}|jd}|jd} |s^| rk|d}n|dkstt|g|D]} | j^q}g|D]} | j^q}| o|j||} |tj|j t t |d |j g|d jg} tj|j | } | p?| srd | _ tt |r]dnd| g} n|rtj|j | g|} n|j | _ | S(Ntheadtmethodittailuiteruviewiukeysuitemsuvaluestprefixtparensuulist(ukeysuitemsuvalues(tsymstvaluet startswithtAssertionErrortreprtclonetin_special_contextRtNodettrailerR RRtpowerR(tselftnodetresultsR RRRt method_nametisitertisviewtntspecialtargstnew((s./usr/lib64/python2.7/lib2to3/fixes/fix_dict.pyt transform7s4         ' s3power< func=NAME trailer< '(' node=any ')' > any* >smfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > cCs|jdkrtSi}|jjdk r|jj|jj|r|d|kr|rm|djtkS|djtjkSn|stS|j j|j|o|d|kS(NRtfunc( tparenttNonetFalsetp1tmatchRt iter_exemptR tconsuming_callstp2(RRR R((s./usr/lib64/python2.7/lib2to3/fixes/fix_dict.pyR[s( t__name__t __module__tTruet BM_compatibletPATTERNR&tP1Rtcompile_patternR+tP2R/R(((s./usr/lib64/python2.7/lib2to3/fixes/fix_dict.pyR *s  N(t__doc__tRRtpgen2RRR RRRRRR R.tsetR-tBaseFixR (((s./usr/lib64/python2.7/lib2to3/fixes/fix_dict.pyts.PK81]\g7''fix_basestring.pyonu[ {fc@sCdZddlmZddlmZdejfdYZdS(sFixer for basestring -> str.i(t fixer_base(tNamet FixBasestringcBseZeZdZdZRS(s 'basestring'cCstdd|jS(Nustrtprefix(RR(tselftnodetresults((s4/usr/lib64/python2.7/lib2to3/fixes/fix_basestring.pyt transform s(t__name__t __module__tTruet BM_compatibletPATTERNR(((s4/usr/lib64/python2.7/lib2to3/fixes/fix_basestring.pyRsN(t__doc__tRt fixer_utilRtBaseFixR(((s4/usr/lib64/python2.7/lib2to3/fixes/fix_basestring.pytsPK81]Pr  fix_itertools.pycnu[ {fc@sCdZddlmZddlmZdejfdYZdS(sT Fixer for itertools.(imap|ifilter|izip) --> (map|filter|zip) and itertools.ifilterfalse --> itertools.filterfalse (bugs 2360-2363) imports from itertools are fixed in fix_itertools_import.py If itertools is imported as something else (ie: import itertools as it; it.izip(spam, eggs)) method calls will not get fixed. i(t fixer_base(tNamet FixItertoolscBs0eZeZdZdeZdZdZRS(s7('imap'|'ifilter'|'izip'|'izip_longest'|'ifilterfalse')s power< it='itertools' trailer< dot='.' func=%(it_funcs)s > trailer< '(' [any] ')' > > | power< func=%(it_funcs)s trailer< '(' [any] ')' > > icCsd}|dd}d|krt|jd krt|d|d}}|j}|j|j|jj|n|p|j}|jt|jdd|dS( Ntfuncititu ifilterfalseu izip_longesttdotitprefix(u ifilterfalseu izip_longest(tNonetvalueRtremovetparenttreplaceR(tselftnodetresultsRRRR((s3/usr/lib64/python2.7/lib2to3/fixes/fix_itertools.pyt transforms    ( t__name__t __module__tTruet BM_compatibletit_funcstlocalstPATTERNt run_orderR(((s3/usr/lib64/python2.7/lib2to3/fixes/fix_itertools.pyRs  N(t__doc__tRt fixer_utilRtBaseFixR(((s3/usr/lib64/python2.7/lib2to3/fixes/fix_itertools.pytsPK81]CTw fix_renames.pycnu[ {fc@sudZddlmZddlmZmZiidd6d6ZiZdZdZ d ej fd YZ d S( s?Fix incompatible renames Fixes: * sys.maxint -> sys.maxsize i(t fixer_base(tNamet attr_chaintmaxsizetmaxinttsyscCsddjtt|dS(Nt(t|t)(tjointmaptrepr(tmembers((s1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pyt alternatessccsoxhtjD]Z\}}xK|jD]=\}}|t||f) > s^ power< module_name=%r trailer< '.' attr_name=%r > any* > (tMAPPINGtitemstLOOKUP(tmoduletreplacetold_attrtnew_attr((s1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pyt build_patterns  t FixRenamescBs8eZeZdjeZdZdZdZ RS(RtprecsUtt|j|}|rQtfdt|dDrMtS|StS(Nc3s|]}|VqdS(N((t.0tobj(tmatch(s1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pys 5stparent(tsuperRRtanyRtFalse(tselftnodetresults((Rs1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pyR1s %cCsi|jd}|jd}|re|rett|j|jf}|jt|d|jndS(Nt module_namet attr_nametprefix(tgettunicodeRtvalueRRR$(RR R!tmod_nameR#R((s1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pyt transform>s  ( t__name__t __module__tTruet BM_compatibleR RtPATTERNtorderRR)(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pyR*s  N( t__doc__tRt fixer_utilRRRRR RtBaseFixR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pyts  PK81]WW fix_long.pycnu[ {fc@sCdZddlmZddlmZdejfdYZdS(s/Fixer that turns 'long' into 'int' everywhere. i(t fixer_base(tis_probably_builtintFixLongcBseZeZdZdZRS(s'long'cCs&t|r"d|_|jndS(Nuint(Rtvaluetchanged(tselftnodetresults((s./usr/lib64/python2.7/lib2to3/fixes/fix_long.pyt transforms  (t__name__t __module__tTruet BM_compatibletPATTERNR(((s./usr/lib64/python2.7/lib2to3/fixes/fix_long.pyR sN(t__doc__tlib2to3Rtlib2to3.fixer_utilRtBaseFixR(((s./usr/lib64/python2.7/lib2to3/fixes/fix_long.pytsPK81] fix_throw.pyonu[ {fc@s{dZddlmZddlmZddlmZddlmZmZm Z m Z m Z dej fdYZ dS( sFixer for generator.throw(E, V, T). g.throw(E) -> g.throw(E) g.throw(E, V) -> g.throw(E(V)) g.throw(E, V, T) -> g.throw(E(V).with_traceback(T)) g.throw("foo"[, V[, T]]) will warn about string exceptions.i(tpytree(ttoken(t fixer_base(tNametCalltArgListtAttrtis_tupletFixThrowcBseZeZdZdZRS(s power< any trailer< '.' 'throw' > trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > | power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > > c CsP|j}|dj}|jtjkr?|j|ddS|jd}|dkr^dS|j}t|rg|j dd!D]}|j^q}nd|_ |g}|d}d|kr6|dj} d| _ t ||} t | t d t| gg} |jtj|j| n|jt ||dS( Ntexcs+Python 3 does not support string exceptionsuvaliiutargsttbuwith_traceback(tsymstclonettypeRtSTRINGtcannot_converttgettNoneRtchildrentprefixRRRRtreplaceRtNodetpower( tselftnodetresultsR R tvaltcR t throw_argsR tetwith_tb((s//usr/lib64/python2.7/lib2to3/fixes/fix_throw.pyt transforms*    ,     %(t__name__t __module__tTruet BM_compatibletPATTERNR (((s//usr/lib64/python2.7/lib2to3/fixes/fix_throw.pyRsN(t__doc__tRtpgen2RRt fixer_utilRRRRRtBaseFixR(((s//usr/lib64/python2.7/lib2to3/fixes/fix_throw.pyts (PK81]_;>fix_set_literal.pyonu[ {fc@sOdZddlmZmZddlmZmZdejfdYZdS(s: Optional fixer to transform set() calls to set literals. i(t fixer_basetpytree(ttokentsymst FixSetLiteralcBs#eZeZeZdZdZRS(sjpower< 'set' trailer< '(' (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) > | single=any) ']' > | atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > ) ')' > > c Cs|jd}|rItjtj|jg}|j||}n |d}tjtj dg}|j d|j D|j tjtj d|jj|d_tjtj|}|j|_t|j dkr|j d}|j|j|j d_n|S( Ntsingletitemsu{css|]}|jVqdS(N(tclone(t.0tn((s5/usr/lib64/python2.7/lib2to3/fixes/fix_set_literal.pys 'su}iii(tgetRtNodeRt listmakerRtreplacetLeafRtLBRACEtextendtchildrentappendtRBRACEt next_siblingtprefixt dictsetmakertlentremove( tselftnodetresultsRtfakeRtliteraltmakerR ((s5/usr/lib64/python2.7/lib2to3/fixes/fix_set_literal.pyt transforms"      (t__name__t __module__tTruet BM_compatibletexplicittPATTERNR(((s5/usr/lib64/python2.7/lib2to3/fixes/fix_set_literal.pyR s N( t__doc__tlib2to3RRtlib2to3.fixer_utilRRtBaseFixR(((s5/usr/lib64/python2.7/lib2to3/fixes/fix_set_literal.pytsPK81]d{fix_raw_input.pyonu[ {fc@sCdZddlmZddlmZdejfdYZdS(s2Fixer that changes raw_input(...) into input(...).i(t fixer_base(tNamet FixRawInputcBseZeZdZdZRS(sU power< name='raw_input' trailer< '(' [any] ')' > any* > cCs*|d}|jtdd|jdS(Ntnameuinputtprefix(treplaceRR(tselftnodetresultsR((s3/usr/lib64/python2.7/lib2to3/fixes/fix_raw_input.pyt transforms (t__name__t __module__tTruet BM_compatibletPATTERNR (((s3/usr/lib64/python2.7/lib2to3/fixes/fix_raw_input.pyRsN(t__doc__tRt fixer_utilRtBaseFixR(((s3/usr/lib64/python2.7/lib2to3/fixes/fix_raw_input.pytsPK81]d{fix_raw_input.pycnu[ {fc@sCdZddlmZddlmZdejfdYZdS(s2Fixer that changes raw_input(...) into input(...).i(t fixer_base(tNamet FixRawInputcBseZeZdZdZRS(sU power< name='raw_input' trailer< '(' [any] ')' > any* > cCs*|d}|jtdd|jdS(Ntnameuinputtprefix(treplaceRR(tselftnodetresultsR((s3/usr/lib64/python2.7/lib2to3/fixes/fix_raw_input.pyt transforms (t__name__t __module__tTruet BM_compatibletPATTERNR (((s3/usr/lib64/python2.7/lib2to3/fixes/fix_raw_input.pyRsN(t__doc__tRt fixer_utilRtBaseFixR(((s3/usr/lib64/python2.7/lib2to3/fixes/fix_raw_input.pytsPK81]v fix_map.pycnu[ {fc@sudZddlmZddlmZddlmZmZmZm Z ddl m Z dej fdYZdS( sFixer that changes map(F, ...) into list(map(F, ...)) unless there exists a 'from future_builtins import map' statement in the top-level namespace. As a special case, map(None, X) is changed into list(X). (This is necessary because the semantics are changed in this case -- the new map(None, X) is equivalent to [(x,) for x in X].) We avoid the transformation (except for the special case mentioned above) if the map() call is directly contained in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. NOTE: This is still not correct if the original code was depending on map(F, X, Y, ...) to go on until the longest argument is exhausted, substituting None for missing values -- like zip(), it now stops as soon as the shortest argument is exhausted. i(ttoken(t fixer_base(tNametCalltListComptin_special_context(tpython_symbolstFixMapcBs#eZeZdZdZdZRS(s map_none=power< 'map' trailer< '(' arglist< 'None' ',' arg=any [','] > ')' > > | map_lambda=power< 'map' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > > | power< 'map' trailer< '(' [arglist=any] ')' > > sfuture_builtins.mapcCs|j|rdS|jjtjkrh|j|d|j}d|_tt d|g}n d|krt |dj|dj|dj}nd|kr|d j}nd |kr4|d }|jtj kr4|j d jt jkr4|j d jd kr4|j|d dSnt|rDdS|j}d|_tt d|g}|j|_|S(NsYou should use a for loop hereuulistt map_lambdatxptfptittmap_nonetargtarglistitNonesjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequence(t should_skiptparentttypetsymst simple_stmttwarningtclonetprefixRRRRtchildrenRtNAMEtvalueRR(tselftnodetresultstnewtargs((s-/usr/lib64/python2.7/lib2to3/fixes/fix_map.pyt transform;s6           (t__name__t __module__tTruet BM_compatibletPATTERNtskip_onR (((s-/usr/lib64/python2.7/lib2to3/fixes/fix_map.pyRsN(t__doc__tpgen2RtRt fixer_utilRRRRtpygramRRtConditionalFixR(((s-/usr/lib64/python2.7/lib2to3/fixes/fix_map.pyts "PK81]!x PP fix_zip.pycnu[ {fc@sOdZddlmZddlmZmZmZdejfdYZdS(s7 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 <>:. i(t fixer_base(tNametCalltin_special_contexttFixZipcBs#eZeZdZdZdZRS(s: power< 'zip' args=trailer< '(' [any] ')' > > sfuture_builtins.zipcCs`|j|rdSt|r#dS|j}d|_ttd|g}|j|_|S(Nuulist(t should_skipRtNonetclonetprefixRR(tselftnodetresultstnew((s-/usr/lib64/python2.7/lib2to3/fixes/fix_zip.pyt transforms    (t__name__t __module__tTruet BM_compatibletPATTERNtskip_onR (((s-/usr/lib64/python2.7/lib2to3/fixes/fix_zip.pyRsN( t__doc__tRt fixer_utilRRRtConditionalFixR(((s-/usr/lib64/python2.7/lib2to3/fixes/fix_zip.pytsPK81]J fix_exec.pycnu[ {fc@s_dZddlmZddlmZddlmZmZmZdejfdYZ dS(sFixer for exec. This converts usages of the exec statement into calls to a built-in exec() function. exec code in ns1, ns2 -> exec(code, ns1, ns2) i(tpytree(t fixer_base(tCommatNametCalltFixExeccBseZeZdZdZRS(sx exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > | exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > cCs|s t|j}|d}|jd}|jd}|jg}d|d_|dk r|jt|jgn|dk r|jt|jgntt d|d|jS(Ntatbtctiuexectprefix( tAssertionErrortsymstgettcloneR tNonetextendRRR(tselftnodetresultsR RRRtargs((s./usr/lib64/python2.7/lib2to3/fixes/fix_exec.pyt transforms      (t__name__t __module__tTruet BM_compatibletPATTERNR(((s./usr/lib64/python2.7/lib2to3/fixes/fix_exec.pyRsN( t__doc__R RRt fixer_utilRRRtBaseFixR(((s./usr/lib64/python2.7/lib2to3/fixes/fix_exec.pyt sPK81]!x PP fix_zip.pyonu[ {fc@sOdZddlmZddlmZmZmZdejfdYZdS(s7 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 <>:. i(t fixer_base(tNametCalltin_special_contexttFixZipcBs#eZeZdZdZdZRS(s: power< 'zip' args=trailer< '(' [any] ')' > > sfuture_builtins.zipcCs`|j|rdSt|r#dS|j}d|_ttd|g}|j|_|S(Nuulist(t should_skipRtNonetclonetprefixRR(tselftnodetresultstnew((s-/usr/lib64/python2.7/lib2to3/fixes/fix_zip.pyt transforms    (t__name__t __module__tTruet BM_compatibletPATTERNtskip_onR (((s-/usr/lib64/python2.7/lib2to3/fixes/fix_zip.pyRsN( t__doc__tRt fixer_utilRRRtConditionalFixR(((s-/usr/lib64/python2.7/lib2to3/fixes/fix_zip.pytsPK81]5 fix_exitfunc.pycnu[ {fc@sgdZddlmZmZddlmZmZmZmZm Z m Z dej fdYZ dS(s7 Convert use of sys.exitfunc to use the atexit module. i(tpytreet fixer_base(tNametAttrtCalltCommatNewlinetsymst FixExitfunccBs5eZeZeZdZdZdZdZRS(s ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) cGstt|j|dS(N(tsuperRt__init__(tselftargs((s2/usr/lib64/python2.7/lib2to3/fixes/fix_exitfunc.pyR scCs&tt|j||d|_dS(N(R Rt start_treetNonet sys_import(R ttreetfilename((s2/usr/lib64/python2.7/lib2to3/fixes/fix_exitfunc.pyR !sc Csd|kr/|jdkr+|d|_ndS|dj}d|_tjtjtt dt d}t ||g|j}|j ||jdkr|j |ddS|jj d}|jtjkr|jt|jt ddn|jj}|j j|j}|j} tjtjt d t ddg} tjtj| g} |j|dt|j|d | dS( NRtfuncuuatexituregistersKCan't find sys import; Please add an atexit import at the top of your file.iu uimporti(RRtclonetprefixRtNodeRtpowerRRRtreplacetwarningtchildrenttypetdotted_as_namest append_childRtparenttindext import_namet simple_stmtt insert_childR( R tnodetresultsRtregistertcalltnamestcontaining_stmttpositiontstmt_containert new_importtnew((s2/usr/lib64/python2.7/lib2to3/fixes/fix_exitfunc.pyt transform%s2       ( t__name__t __module__tTruetkeep_line_ordert BM_compatibletPATTERNR R R,(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_exitfunc.pyR s   N( t__doc__tlib2to3RRtlib2to3.fixer_utilRRRRRRtBaseFixR(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_exitfunc.pyts.PK81]WW fix_long.pyonu[ {fc@sCdZddlmZddlmZdejfdYZdS(s/Fixer that turns 'long' into 'int' everywhere. i(t fixer_base(tis_probably_builtintFixLongcBseZeZdZdZRS(s'long'cCs&t|r"d|_|jndS(Nuint(Rtvaluetchanged(tselftnodetresults((s./usr/lib64/python2.7/lib2to3/fixes/fix_long.pyt transforms  (t__name__t __module__tTruet BM_compatibletPATTERNR(((s./usr/lib64/python2.7/lib2to3/fixes/fix_long.pyR sN(t__doc__tlib2to3Rtlib2to3.fixer_utilRtBaseFixR(((s./usr/lib64/python2.7/lib2to3/fixes/fix_long.pytsPK81]ܾfix_xreadlines.pyonu[ {fc@sCdZddlmZddlmZdejfdYZdS(spFix "for x in f.xreadlines()" -> "for x in f". This fixer will also convert g(f.xreadlines) into g(f.__iter__).i(t fixer_base(tNamet FixXreadlinescBseZeZdZdZRS(s power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | power< any+ trailer< '.' no_call='xreadlines' > > cCsb|jd}|r4|jtdd|jn*|jg|dD]}|j^qEdS(Ntno_callu__iter__tprefixtcall(tgettreplaceRRtclone(tselftnodetresultsRtx((s4/usr/lib64/python2.7/lib2to3/fixes/fix_xreadlines.pyt transforms(t__name__t __module__tTruet BM_compatibletPATTERNR (((s4/usr/lib64/python2.7/lib2to3/fixes/fix_xreadlines.pyR sN(t__doc__tRt fixer_utilRtBaseFixR(((s4/usr/lib64/python2.7/lib2to3/fixes/fix_xreadlines.pytsPK81]1Wlfix_sys_exc.pyonu[ {fc@sgdZddlmZddlmZmZmZmZmZm Z m Z dej fdYZ dS(sFixer for sys.exc_{type, value, traceback} sys.exc_type -> sys.exc_info()[0] sys.exc_value -> sys.exc_info()[1] sys.exc_traceback -> sys.exc_info()[2] i(t fixer_base(tAttrtCalltNametNumbert SubscripttNodetsymst FixSysExccBsCeZdddgZeZddjdeDZdZRS(uexc_typeu exc_valueu exc_tracebacksN power< 'sys' trailer< dot='.' attribute=(%s) > > t|ccs|]}d|VqdS(s'%s'N((t.0te((s1/usr/lib64/python2.7/lib2to3/fixes/fix_sys_exc.pys scCs|dd}t|jj|j}ttdd|j}ttd|}|dj|djd_|j t |t t j |d|jS(Nt attributeiuexc_infotprefixusystdoti(Rtexc_infotindextvalueRRR RtchildrentappendRRRtpower(tselftnodetresultstsys_attrRtcalltattr((s1/usr/lib64/python2.7/lib2to3/fixes/fix_sys_exc.pyt transforms(t__name__t __module__RtTruet BM_compatibletjointPATTERNR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_sys_exc.pyRsN( t__doc__tRt fixer_utilRRRRRRRtBaseFixR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_sys_exc.pyts4PK81]?յ fix_import.pycnu[ {fc@szdZddlmZddlmZmZmZmZddlm Z m Z m Z dZ dej fdYZd S( sFixer for import statements. If spam is being imported from the local directory, this import: from spam import eggs Becomes: from .spam import eggs And this import: import spam Becomes: from . import spam i(t fixer_basei(tdirnametjointexiststsep(t FromImporttsymsttokenccs|g}x|r|j}|jtjkr;|jVq |jtjkrwdjg|jD]}|j^q]Vq |jtj kr|j |jdq |jtj kr|j |jdddq t dq WdS(sF Walks over all the names imported in a dotted_as_names node. tiNisunknown node type(tpopttypeRtNAMEtvalueRt dotted_nameRtchildrentdotted_as_nametappendtdotted_as_namestextendtAssertionError(tnamestpendingtnodetch((s0/usr/lib64/python2.7/lib2to3/fixes/fix_import.pyttraverse_importss    * t FixImportcBs/eZeZdZdZdZdZRS(sj import_from< 'from' imp=any 'import' ['('] any [')'] > | import_name< 'import' imp=any > cCs/tt|j||d|jk|_dS(Ntabsolute_import(tsuperRt start_treetfuture_featurestskip(tselfttreetname((s0/usr/lib64/python2.7/lib2to3/fixes/fix_import.pyR/scCs|jr dS|d}|jtjkr~x t|dsK|jd}q,W|j|jrd|j|_|jqnt }t }x2t |D]$}|j|rt }qt }qW|r|r|j |dndSt d|g}|j|_|SdS(NtimpR iu.s#absolute and local imports together(RR Rt import_fromthasattrRtprobably_a_local_importR tchangedtFalseRtTruetwarningRtprefix(RRtresultsR"t have_localt have_absolutetmod_nametnew((s0/usr/lib64/python2.7/lib2to3/fixes/fix_import.pyt transform3s,     cCs|jdrtS|jddd}t|j}t||}ttt|dsftSx4dtdddd gD]}t||rtSqWtS( Nu.iis __init__.pys.pys.pycs.sos.sls.pyd( t startswithR'tsplitRtfilenameRRRR((Rtimp_namet base_pathtext((s0/usr/lib64/python2.7/lib2to3/fixes/fix_import.pyR%Us(t__name__t __module__R(t BM_compatibletPATTERNRR0R%(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_import.pyR&s   "N(t__doc__RRtos.pathRRRRt fixer_utilRRRRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_import.pyt s " PK81]8|gfix_execfile.pyonu[ {fc@sydZddlmZddlmZmZmZmZmZm Z m Z m Z m Z m Z dejfdYZdS(soFixer for execfile. This converts usages of the execfile function into calls to the built-in exec() function. i(t fixer_base( tCommatNametCalltLParentRParentDottNodetArgListtStringtsymst FixExecfilecBseZeZdZdZRS(s power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > | power< 'execfile' trailer< '(' filename=any ')' > > cCs|d}|jd}|jd}|jdjdj}t|jttddgd|}ttjt d|g}ttj t t d gttj t t gg} |g| } |j} d | _td d } | t| t| g} tt d | d }|g}|dk re|jt|jgn|dk r|jt|jgntt d|d|jS(Ntfilenametglobalstlocalsis"rb"t trparenuopenureadu u'exec'ucompileuuexectprefix(tgettchildrentcloneRRR RR tpowerRttrailerRRRRRtNonetextend(tselftnodetresultsR R Rtexecfile_parent open_argst open_calltreadt open_exprt filename_argtexec_strt compile_argst compile_calltargs((s2/usr/lib64/python2.7/lib2to3/fixes/fix_execfile.pyt transforms* $ !      (t__name__t __module__tTruet BM_compatibletPATTERNR&(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_execfile.pyR sN(t__doc__tRt fixer_utilRRRRRRRRR R tBaseFixR (((s2/usr/lib64/python2.7/lib2to3/fixes/fix_execfile.pytsFPK81]tfix_asserts.pycnu[ {fc@sdZddlmZddlmZedddddd d d d d dddddddd dd dd ddddddZdefdYZdS(s5Fixer that replaces deprecated unittest method names.i(tBaseFix(tNametassert_t assertTruet assertEqualst assertEqualtassertNotEqualstassertNotEqualtassertAlmostEqualstassertAlmostEqualtassertNotAlmostEqualstassertNotAlmostEqualtassertRegexpMatchest assertRegextassertRaisesRegexptassertRaisesRegextfailUnlessEqualt failIfEqualtfailUnlessAlmostEqualtfailIfAlmostEqualt failUnlesstfailUnlessRaisest assertRaisestfailIft assertFalset FixAssertscBs-eZddjeeeZdZRS(sH power< any+ trailer< '.' meth=(%s)> any* > t|cCs8|dd}|jttt|d|jdS(Ntmethitprefix(treplaceRtNAMEStstrR(tselftnodetresultstname((s1/usr/lib64/python2.7/lib2to3/fixes/fix_asserts.pyt transform s(t__name__t __module__tjointmaptreprRtPATTERNR$(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_asserts.pyRsN(t__doc__t fixer_baseRt fixer_utilRtdictRR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_asserts.pyts$ PK81]cۛfix_metaclass.pyonu[ {fc@sdZddlmZddlmZddlmZmZmZm Z dZ dZ dZ dZ d Zd Zd ejfd YZd S(sFixer for __metaclass__ = X -> (metaclass=X) methods. The various forms of classef (inherits nothing, inherits once, inherints many) don't parse the same in the CST so we look at ALL classes for a __metaclass__ and if we find one normalize the inherits to all be an arglist. For one-liner classes ('class X: pass') there is no indent/dedent so we normalize those into having a suite. Moving the __metaclass__ into the classdef can also cause the class body to be empty so there is some special casing for that as well. This fixer also tries very hard to keep original indenting and spacing in all those corner cases. i(t fixer_base(ttoken(tNametsymstNodetLeafcCsx|jD]}|jtjkr,t|S|jtjkr |jr |jd}|jtjkr|jr|jd}t|tr|j dkrt Sqq q Wt S(s we have to check the cls_node without changing it. There are two possibilities: 1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta') 2) clsdef => simple_stmt => expr_stmt => Leaf('__meta') it __metaclass__( tchildrenttypeRtsuitet has_metaclasst simple_stmtt expr_stmtt isinstanceRtvaluetTruetFalse(tparenttnodet expr_nodet left_side((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pyR s   cCsx'|jD]}|jtjkr dSq Wx?t|jD]"\}}|jtjkr:Pq:q:Wtdttjg}xC|j|dr|j|d}|j |j |j qW|j ||}dS(sf one-line classes don't get a suite in the parse tree so we add one to normalize the tree NsNo class suite and no ':'!i( RRRR t enumerateRtCOLONt ValueErrorRt append_childtclonetremove(tcls_nodeRtiR t move_node((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pytfixup_parse_tree-s  c Csx7t|jD]"\}}|jtjkrPqqWdS|jttjg}ttj |g}x;|j|r|j|}|j |j |jqnW|j |||jdjd}|jdjd} | j |_ dS(s if there is a semi-colon all the parts count as part of the same simple_stmt. We just want the __metaclass__ part so we move everything after the semi-colon into its own simple_stmt node Ni(RRRRtSEMIRRRR R RRt insert_childtprefix( RRt stmt_nodetsemi_indRtnew_exprtnew_stmtRt new_leaf1t old_leaf1((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pytfixup_simple_stmtGs  cCs:|jr6|jdjtjkr6|jdjndS(Ni(RRRtNEWLINER(R((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pytremove_trailing_newline_s"ccsx3|jD]}|jtjkr Pq q Wtdxtt|jD]\}}|jtjkrL|jrL|jd}|jtjkr|jr|jd}t |t r|j dkrt |||t ||||fVqqqLqLWdS(NsNo class suite!iu __metaclass__(RRRR RtlistRR R R RRR(R*(RRRt simple_nodeRt left_node((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pyt find_metasds "   cCs|jddd}x,|rD|j}|jtjkrPqqWxm|r|j}t|tr|jtjkr|jrd|_ndS|j |jdddqHWdS(s If an INDENT is followed by a thing with a prefix then nuke the prefix Otherwise we get in trouble when removing __metaclass__ at suite start Niu( RtpopRRtINDENTR RtDEDENTR!textend(R tkidsR((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pyt fixup_indent{s    !  t FixMetaclasscBseZeZdZdZRS(s classdef cCst|sdSt|d}x-t|D]\}}}|}|jq-W|jdj}t|jdkr|jdjtj kr|jd}q|jdj } t tj | g}|j d|nt|jdkrt tj g}|j d|n~t|jdkrt tj g}|j dttjd|j d||j dttjdn td |jdjd} d | _| j} |jr|jttjd d | _n d | _|jd} d | jd_d | jd_|j|t||js|jt|d} | | _|j| |jttjdnt|jdkr |jdjtjkr |jdjtjkr t|d} |j d| |j dttjdndS(Niiiiiiu)u(sUnexpected class definitiont metaclassu,u uiupassu ii(R RtNoneR.RRRtlenRtarglistRRt set_childR RRtRPARtLPARRRR!RtCOMMAR4R)R0R1(tselfRtresultstlast_metaclassR Rtstmtt text_typeR9Rtmeta_txttorig_meta_prefixR t pass_leaf((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pyt transforms^               (t__name__t __module__Rt BM_compatibletPATTERNRF(((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pyR5sN(t__doc__tRtpygramRt fixer_utilRRRRR RR(R*R.R4tBaseFixR5(((s3/usr/lib64/python2.7/lib2to3/fixes/fix_metaclass.pyts"      PK81]tڢfix_buffer.pyonu[ {fc@sCdZddlmZddlmZdejfdYZdS(s4Fixer that changes buffer(...) into memoryview(...).i(t fixer_base(tNamet FixBuffercBs#eZeZeZdZdZRS(sR power< name='buffer' trailer< '(' [any] ')' > any* > cCs*|d}|jtdd|jdS(Ntnameu memoryviewtprefix(treplaceRR(tselftnodetresultsR((s0/usr/lib64/python2.7/lib2to3/fixes/fix_buffer.pyt transforms (t__name__t __module__tTruet BM_compatibletexplicittPATTERNR (((s0/usr/lib64/python2.7/lib2to3/fixes/fix_buffer.pyR sN(t__doc__tRt fixer_utilRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_buffer.pytsPK81]RRfix_numliterals.pycnu[ {fc@sSdZddlmZddlmZddlmZdejfdYZdS(s-Fixer that turns 1L into 1, 0755 into 0o755. i(ttoken(t fixer_base(tNumbertFixNumliteralscBs#eZejZdZdZRS(cCs#|jjdp"|jddkS(Nu0iuLl(tvaluet startswith(tselftnode((s5/usr/lib64/python2.7/lib2to3/fixes/fix_numliterals.pytmatchscCs}|j}|ddkr&|d }nD|jdrj|jrjtt|dkrjd|d}nt|d|jS(NiuLlu0iu0otprefix(RRtisdigittlentsetRR (RRtresultstval((s5/usr/lib64/python2.7/lib2to3/fixes/fix_numliterals.pyt transforms   3(t__name__t __module__RtNUMBERt _accept_typeRR(((s5/usr/lib64/python2.7/lib2to3/fixes/fix_numliterals.pyR s  N( t__doc__tpgen2RtRt fixer_utilRtBaseFixR(((s5/usr/lib64/python2.7/lib2to3/fixes/fix_numliterals.pytsPK81]0|| fix_input.pyonu[ {fc@shdZddlmZddlmZmZddlmZejdZdej fdYZ dS( s4Fixer that changes input(...) into eval(input(...)).i(t fixer_base(tCalltName(tpatcomps&power< 'eval' trailer< '(' any ')' > >tFixInputcBseZeZdZdZRS(sL power< 'input' args=trailer< '(' [any] ')' > > cCsMtj|jjrdS|j}d|_ttd|gd|jS(Nuuevaltprefix(tcontexttmatchtparenttcloneRRR(tselftnodetresultstnew((s//usr/lib64/python2.7/lib2to3/fixes/fix_input.pyt transforms   (t__name__t __module__tTruet BM_compatibletPATTERNR(((s//usr/lib64/python2.7/lib2to3/fixes/fix_input.pyR sN( t__doc__tRt fixer_utilRRRtcompile_patternRtBaseFixR(((s//usr/lib64/python2.7/lib2to3/fixes/fix_input.pyts PK81]fix_future.pyonu[ {fc@sCdZddlmZddlmZdejfdYZdS(sVRemove __future__ imports from __future__ import foo is replaced with an empty line. i(t fixer_base(t BlankLinet FixFuturecBs#eZeZdZdZdZRS(s;import_from< 'from' module_name="__future__" 'import' any >i cCst}|j|_|S(N(Rtprefix(tselftnodetresultstnew((s0/usr/lib64/python2.7/lib2to3/fixes/fix_future.pyt transforms  (t__name__t __module__tTruet BM_compatibletPATTERNt run_orderR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_future.pyR sN(t__doc__tRt fixer_utilRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_future.pytsPK81]fix_operator.pyonu[ {fc@s^dZddlmZddlmZmZmZmZdZdej fdYZ dS(sFixer for operator functions. operator.isCallable(obj) -> hasattr(obj, '__call__') operator.sequenceIncludes(obj) -> operator.contains(obj) operator.isSequenceType(obj) -> isinstance(obj, collections.Sequence) operator.isMappingType(obj) -> isinstance(obj, collections.Mapping) operator.isNumberType(obj) -> isinstance(obj, numbers.Number) operator.repeat(obj, n) -> operator.mul(obj, n) operator.irepeat(obj, n) -> operator.imul(obj, n) i(t fixer_base(tCalltNametStringt touch_importcsfd}|S(Ncs |_|S(N(t invocation(tf(ts(s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pytdecs ((RR((Rs2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyRst FixOperatorcBseZeZdZdZdZdededeZdZ e ddZ e d d Z e d d Z e d dZe ddZe ddZe ddZdZdZdZRS(tpres method=('isCallable'|'sequenceIncludes' |'isSequenceType'|'isMappingType'|'isNumberType' |'repeat'|'irepeat') s'(' obj=any ')'s power< module='operator' trailer< '.' %(methods)s > trailer< %(obj)s > > | power< %(methods)s trailer< %(obj)s > > tmethodstobjcCs/|j||}|dk r+|||SdS(N(t _check_methodtNone(tselftnodetresultstmethod((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt transform)s soperator.contains(%s)cCs|j||dS(Nucontains(t_handle_rename(RRR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt_sequenceIncludes.sshasattr(%s, '__call__')cCsG|d}|jtdtdg}ttd|d|jS(NR u, u '__call__'uhasattrtprefix(tcloneRRRR(RRRR targs((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt _isCallable2s !soperator.mul(%s)cCs|j||dS(Numul(R(RRR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt_repeat8ssoperator.imul(%s)cCs|j||dS(Nuimul(R(RRR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt_irepeat<ss$isinstance(%s, collections.Sequence)cCs|j||ddS(Nu collectionsuSequence(t_handle_type2abc(RRR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt_isSequenceType@ss#isinstance(%s, collections.Mapping)cCs|j||ddS(Nu collectionsuMapping(R(RRR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt_isMappingTypeDssisinstance(%s, numbers.Number)cCs|j||ddS(NunumbersuNumber(R(RRR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt _isNumberTypeHscCs%|dd}||_|jdS(NRi(tvaluetchanged(RRRtnameR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyRLs cCsatd|||d}|jtddj||gg}ttd|d|jS(NR u, u.u isinstanceR(RRRRtjoinRRR(RRRtmoduletabcR R((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyRQs +cCst|d|ddjjd}t|rd|krC|St|df}t|j|}|j|d|ndS(Nt_RitasciiR$R uYou should use '%s' here.(tgetattrR tencodetcallabletunicodeRtwarningR(RRRRtsubtinvocation_str((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyR Ws'  (t__name__t __module__tTruet BM_compatibletorderR R tdicttPATTERNRRRRRRRRRRRR (((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyR s    N( t__doc__tlib2to3Rtlib2to3.fixer_utilRRRRRtBaseFixR (((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt s" PK81]ؒ __init__.pycnu[ {fc@sdS(N((((s./usr/lib64/python2.7/lib2to3/fixes/__init__.pyttPK81]CTw fix_renames.pyonu[ {fc@sudZddlmZddlmZmZiidd6d6ZiZdZdZ d ej fd YZ d S( s?Fix incompatible renames Fixes: * sys.maxint -> sys.maxsize i(t fixer_base(tNamet attr_chaintmaxsizetmaxinttsyscCsddjtt|dS(Nt(t|t)(tjointmaptrepr(tmembers((s1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pyt alternatessccsoxhtjD]Z\}}xK|jD]=\}}|t||f) > s^ power< module_name=%r trailer< '.' attr_name=%r > any* > (tMAPPINGtitemstLOOKUP(tmoduletreplacetold_attrtnew_attr((s1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pyt build_patterns  t FixRenamescBs8eZeZdjeZdZdZdZ RS(RtprecsUtt|j|}|rQtfdt|dDrMtS|StS(Nc3s|]}|VqdS(N((t.0tobj(tmatch(s1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pys 5stparent(tsuperRRtanyRtFalse(tselftnodetresults((Rs1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pyR1s %cCsi|jd}|jd}|re|rett|j|jf}|jt|d|jndS(Nt module_namet attr_nametprefix(tgettunicodeRtvalueRRR$(RR R!tmod_nameR#R((s1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pyt transform>s  ( t__name__t __module__tTruet BM_compatibleR RtPATTERNtorderRR)(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pyR*s  N( t__doc__tRt fixer_utilRRRRR RtBaseFixR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_renames.pyts  PK81]\fix_unicode.pycnu[ {fc@sWdZddlmZddlmZidd6dd6Zdejfd YZd S( sFixer for unicode. * Changes unicode to str and unichr to chr. * If "...\u..." is not unicode literal change it into "...\\u...". * Change u"..." into "...". i(ttoken(t fixer_baseuchruunichrustruunicodet FixUnicodecBs&eZeZdZdZdZRS(sSTRING | 'unicode' | 'unichr'cCs/tt|j||d|jk|_dS(Ntunicode_literals(tsuperRt start_treetfuture_featuresR(tselfttreetfilename((s1/usr/lib64/python2.7/lib2to3/fixes/fix_unicode.pyRscCs|jtjkr2|j}t|j|_|S|jtjkr|j}|j r|ddkrd|krdjg|j dD]$}|j ddj dd^q}n|dd kr|d }n||jkr|S|j}||_|SdS( Niu'"u\u\\u\uu\\uu\Uu\\UuuUi( ttypeRtNAMEtclonet_mappingtvaluetSTRINGRtjointsplittreplace(Rtnodetresultstnewtvaltv((s1/usr/lib64/python2.7/lib2to3/fixes/fix_unicode.pyt transforms"  &=   (t__name__t __module__tTruet BM_compatibletPATTERNRR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_unicode.pyRs N(t__doc__tpgen2RtRR tBaseFixR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_unicode.pyt sPK81]_;>fix_set_literal.pycnu[ {fc@sOdZddlmZmZddlmZmZdejfdYZdS(s: Optional fixer to transform set() calls to set literals. i(t fixer_basetpytree(ttokentsymst FixSetLiteralcBs#eZeZeZdZdZRS(sjpower< 'set' trailer< '(' (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) > | single=any) ']' > | atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > ) ')' > > c Cs|jd}|rItjtj|jg}|j||}n |d}tjtj dg}|j d|j D|j tjtj d|jj|d_tjtj|}|j|_t|j dkr|j d}|j|j|j d_n|S( Ntsingletitemsu{css|]}|jVqdS(N(tclone(t.0tn((s5/usr/lib64/python2.7/lib2to3/fixes/fix_set_literal.pys 'su}iii(tgetRtNodeRt listmakerRtreplacetLeafRtLBRACEtextendtchildrentappendtRBRACEt next_siblingtprefixt dictsetmakertlentremove( tselftnodetresultsRtfakeRtliteraltmakerR ((s5/usr/lib64/python2.7/lib2to3/fixes/fix_set_literal.pyt transforms"      (t__name__t __module__tTruet BM_compatibletexplicittPATTERNR(((s5/usr/lib64/python2.7/lib2to3/fixes/fix_set_literal.pyR s N( t__doc__tlib2to3RRtlib2to3.fixer_utilRRtBaseFixR(((s5/usr/lib64/python2.7/lib2to3/fixes/fix_set_literal.pytsPK81],b fix_raise.pyonu[ {fc@s{dZddlmZddlmZddlmZddlmZmZm Z m Z m Z dej fdYZ dS( s[Fixer for 'raise E, V, T' raise -> raise raise E -> raise E raise E, V -> raise E(V) raise E, V, T -> raise E(V).with_traceback(T) raise E, None, T -> raise E.with_traceback(T) raise (((E, E'), E''), E'''), V -> raise E(V) raise "foo", V, T -> warns about string exceptions CAVEATS: 1) "raise E, V" will be incorrectly translated if V is an exception instance. The correct Python 3 idiom is raise E from V but since we can't detect instance-hood by syntax alone and since any client code would have to be changed as well, we don't automate this. i(tpytree(ttoken(t fixer_base(tNametCalltAttrtArgListtis_tupletFixRaisecBseZeZdZdZRS(sB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > c Cs |j}|dj}|jtjkrEd}|j||dSt|rx*t|r}|jdjdj}qTWd|_nd|krt j |j t d|g}|j|_|S|dj}t|rg|jdd!D]}|j^q} nd |_|g} d |kr|d j} d | _|} |jtj ksm|jd krt|| } nt| t d t| gg} t j |jt dg| }|j|_|St j |j t dt|| gd |jSdS(Ntexcs+Python 3 does not support string exceptionsiiu tvaluraiseiuttbuNoneuwith_tracebacktprefix(tsymstclonettypeRtSTRINGtcannot_convertRtchildrenR RtNodet raise_stmtRtNAMEtvalueRRRt simple_stmt( tselftnodetresultsR R tmsgtnewR tctargsR tetwith_tb((s//usr/lib64/python2.7/lib2to3/fixes/fix_raise.pyt transform&s@    !  ,    !%"  (t__name__t __module__tTruet BM_compatibletPATTERNR!(((s//usr/lib64/python2.7/lib2to3/fixes/fix_raise.pyRsN(t__doc__tRtpgen2RRt fixer_utilRRRRRtBaseFixR(((s//usr/lib64/python2.7/lib2to3/fixes/fix_raise.pyts (PK81]:C ttfix_ws_comma.pycnu[ {fc@sSdZddlmZddlmZddlmZdejfdYZdS(sFixer that changes 'a ,b' into 'a, b'. This also changes '{a :b}' into '{a: b}', but does not touch other uses of colons. It does not touch other uses of whitespace. i(tpytree(ttoken(t fixer_baset FixWsCommacBsSeZeZdZejejdZejej dZ ee fZ dZ RS(sH any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]> u,u:cCs|j}t}x|jD]u}||jkrg|j}|jr^d|kr^d|_nt}q|r|j}|sd|_qnt}qW|S(Nu uu (tclonetFalsetchildrentSEPStprefixtisspacetTrue(tselftnodetresultstnewtcommatchildR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_ws_comma.pyt transforms      ( t__name__t __module__R texplicittPATTERNRtLeafRtCOMMAtCOLONRR(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_ws_comma.pyR s  N(t__doc__tRtpgen2RRtBaseFixR(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_ws_comma.pytsPK81]Zfix_itertools_imports.pyonu[ {fc@sOdZddlmZddlmZmZmZdejfdYZdS(sA Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) i(t fixer_base(t BlankLinetsymsttokentFixItertoolsImportscBs$eZeZdeZdZRS(sT import_from< 'from' 'itertools' 'import' imports=any > c Cs|d}|jtjks&|j r2|g}n |j}x|dddD]}|jtjkry|j}|}n#|jtjkrdS|jd}|j}|dkrd|_|j qO|dkrO|j |d d krd nd |_qOqOW|jp|g}t } x=|D]5}| rN|jtj krN|j q#| t N} q#Wx0|r|d jtj kr|j j q_W|jpt|dd s|jdkr|j} t}| |_|SdS(Ntimportsiiuimapuizipuifilteru ifilterfalseu izip_longestiufu filterfalseu zip_longestitvalue(uimapuizipuifilter(u ifilterfalseu izip_longest(ttypeRtimport_as_nametchildrenRtNAMERtSTARtNonetremovetchangedtTruetCOMMAtpoptgetattrtparenttprefixR( tselftnodetresultsRR tchildtmembert name_nodet member_namet remove_commatp((s;/usr/lib64/python2.7/lib2to3/fixes/fix_itertools_imports.pyt transformsB                 (t__name__t __module__Rt BM_compatibletlocalstPATTERNR(((s;/usr/lib64/python2.7/lib2to3/fixes/fix_itertools_imports.pyRs N( t__doc__tlib2to3Rtlib2to3.fixer_utilRRRtBaseFixR(((s;/usr/lib64/python2.7/lib2to3/fixes/fix_itertools_imports.pytsPK81]~&fix_urllib.pycnu[ {fc@ssdZddlmZmZddlmZddlmZmZm Z m Z m Z m Z m Z iddddd d d d d gfddddddddddddddddgfddgfgd 6dd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7gfdd8d9gfgd:6Zed:jed d;d<Zd=efd>YZd?S(@sFix changes imports of urllib which are now incompatible. This is rather similar to fix_imports, but because of the more complex nature of the fixing for urllib, it has its own fixer. i(t alternatest FixImports(t fixer_base(tNametCommat FromImporttNewlinetfind_indentationtNodetsymssurllib.requestt URLopenertFancyURLopenert urlretrievet _urlopenerturlopent urlcleanupt pathname2urlt url2pathnames urllib.parsetquotet quote_plustunquotet unquote_plust urlencodet splitattrt splithostt splitnportt splitpasswdt splitportt splitquerytsplittagt splittypet splitusert splitvalues urllib.errortContentTooShortErrorturllibtinstall_openert build_openertRequesttOpenerDirectort BaseHandlertHTTPDefaultErrorHandlertHTTPRedirectHandlertHTTPCookieProcessort ProxyHandlertHTTPPasswordMgrtHTTPPasswordMgrWithDefaultRealmtAbstractBasicAuthHandlertHTTPBasicAuthHandlertProxyBasicAuthHandlertAbstractDigestAuthHandlertHTTPDigestAuthHandlertProxyDigestAuthHandlert HTTPHandlert HTTPSHandlert FileHandlert FTPHandlertCacheFTPHandlertUnknownHandlertURLErrort HTTPErrorturllib2iccst}xtjD]w\}}xh|D]`}|\}}t|}d||fVd|||fVd|Vd|Vd||fVq)WqWdS(Nsimport_name< 'import' (module=%r | dotted_as_names< any* module=%r any* >) > simport_from< 'from' mod_member=%r 'import' ( member=%s | import_as_name< member=%s 'as' any > | import_as_names< members=any* >) > sIimport_from< 'from' module_star=%r 'import' star='*' > stimport_name< 'import' dotted_as_name< module_as=%r 'as' any > > sKpower< bare_with_attr=%r trailer< '.' member=%s > any* > (tsettMAPPINGtitemsR(tbaret old_moduletchangestchanget new_moduletmembers((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyt build_pattern1s      t FixUrllibcBs5eZdZdZdZdZdZRS(cCsdjtS(Nt|(tjoinRF(tself((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyRFJscCs|jd}|j}g}x?t|jd D],}|jt|dd|tgq0W|jtt|jddd||j|dS(sTransform for the basic import case. Replaces the old import name with a comma separated list of its replacements. tmoduleiitprefixN( tgetRLR>tvaluetextendRRtappendtreplace(RJtnodetresultst import_modtpreftnamestname((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyttransform_importMs *(cCs|jd}|j}|jd}|rt|trI|d}nd }x6t|jD]'}|j|dkr]|d}Pq]q]W|r|jt|d|q|j |dn/g}i} |d} x| D]}|j t j kr|j dj} |j dj} n|j} d } | d krxlt|jD]Z}| |dkr>|d| krx|j|dn| j|dgj|q>q>WqqWg} t|}t}d }x|D]}| |}g}x8|d D],}|j||||jtqW|j||d |t||}| sa|jjj|rm||_n| j|t}qW| rg}x(| d D]}|j|tgqW|j| d |j|n|j |d d S(sTransform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module. t mod_membertmemberiiRLs!This is an invalid module elementREiu,cSsz|jtjkrdt|jdjd||jdj|jdjg}ttj|gSt|jd|gS(NiRLii(ttypeR timport_as_nameRtchildrenRNtcloneR(RWRLtkids((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyt handle_names isAll module elements are invalidN(RMRLt isinstancetlisttNoneR>RNRQRtcannot_convertR[R R\R]RPt setdefaultRtTrueRORRtparenttendswithtFalseR(RJRRRSRYRURZtnew_nameRCtmodulestmod_dictREtas_namet member_namet new_nodest indentationtfirstR`RKteltsRVtelttnewtnodestnew_node((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyttransform_member]sh       +       cCs|jd}|jd}d}t|tr@|d}nx6t|jD]'}|j|dkrN|d}PqNqNW|r|jt|d|jn|j |ddS(s.Transform for calls to module members in code.tbare_with_attrRZiiRLs!This is an invalid module elementN( RMRcRaRbR>RNRQRRLRd(RJRRRSt module_dotRZRjRC((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyt transform_dots  cCs|jdr"|j||n|jdrD|j||nf|jdrf|j||nD|jdr|j|dn"|jdr|j|dndS(NRKRYRxt module_starsCannot handle star imports.t module_ass#This module is now multiple modules(RMRXRwRzRd(RJRRRS((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyt transforms(t__name__t __module__RFRXRwRzR}(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyRGHs    L N(t__doc__tlib2to3.fixes.fix_importsRRtlib2to3Rtlib2to3.fixer_utilRRRRRRR R>RPRFRG(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pytsD4           PK81]uccfix_standarderror.pycnu[ {fc@sCdZddlmZddlmZdejfdYZdS(s%Fixer for StandardError -> Exception.i(t fixer_base(tNametFixStandarderrorcBseZeZdZdZRS(s- 'StandardError' cCstdd|jS(Nu Exceptiontprefix(RR(tselftnodetresults((s7/usr/lib64/python2.7/lib2to3/fixes/fix_standarderror.pyt transforms(t__name__t __module__tTruet BM_compatibletPATTERNR(((s7/usr/lib64/python2.7/lib2to3/fixes/fix_standarderror.pyR sN(t__doc__tRt fixer_utilRtBaseFixR(((s7/usr/lib64/python2.7/lib2to3/fixes/fix_standarderror.pytsPK81]5 fix_exitfunc.pyonu[ {fc@sgdZddlmZmZddlmZmZmZmZm Z m Z dej fdYZ dS(s7 Convert use of sys.exitfunc to use the atexit module. i(tpytreet fixer_base(tNametAttrtCalltCommatNewlinetsymst FixExitfunccBs5eZeZeZdZdZdZdZRS(s ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) cGstt|j|dS(N(tsuperRt__init__(tselftargs((s2/usr/lib64/python2.7/lib2to3/fixes/fix_exitfunc.pyR scCs&tt|j||d|_dS(N(R Rt start_treetNonet sys_import(R ttreetfilename((s2/usr/lib64/python2.7/lib2to3/fixes/fix_exitfunc.pyR !sc Csd|kr/|jdkr+|d|_ndS|dj}d|_tjtjtt dt d}t ||g|j}|j ||jdkr|j |ddS|jj d}|jtjkr|jt|jt ddn|jj}|j j|j}|j} tjtjt d t ddg} tjtj| g} |j|dt|j|d | dS( NRtfuncuuatexituregistersKCan't find sys import; Please add an atexit import at the top of your file.iu uimporti(RRtclonetprefixRtNodeRtpowerRRRtreplacetwarningtchildrenttypetdotted_as_namest append_childRtparenttindext import_namet simple_stmtt insert_childR( R tnodetresultsRtregistertcalltnamestcontaining_stmttpositiontstmt_containert new_importtnew((s2/usr/lib64/python2.7/lib2to3/fixes/fix_exitfunc.pyt transform%s2       ( t__name__t __module__tTruetkeep_line_ordert BM_compatibletPATTERNR R R,(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_exitfunc.pyR s   N( t__doc__tlib2to3RRtlib2to3.fixer_utilRRRRRRtBaseFixR(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_exitfunc.pyts.PK81]:C ttfix_ws_comma.pyonu[ {fc@sSdZddlmZddlmZddlmZdejfdYZdS(sFixer that changes 'a ,b' into 'a, b'. This also changes '{a :b}' into '{a: b}', but does not touch other uses of colons. It does not touch other uses of whitespace. i(tpytree(ttoken(t fixer_baset FixWsCommacBsSeZeZdZejejdZejej dZ ee fZ dZ RS(sH any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]> u,u:cCs|j}t}x|jD]u}||jkrg|j}|jr^d|kr^d|_nt}q|r|j}|sd|_qnt}qW|S(Nu uu (tclonetFalsetchildrentSEPStprefixtisspacetTrue(tselftnodetresultstnewtcommatchildR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_ws_comma.pyt transforms      ( t__name__t __module__R texplicittPATTERNRtLeafRtCOMMAtCOLONRR(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_ws_comma.pyR s  N(t__doc__tRtpgen2RRtBaseFixR(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_ws_comma.pytsPK81]\g7''fix_basestring.pycnu[ {fc@sCdZddlmZddlmZdejfdYZdS(sFixer for basestring -> str.i(t fixer_base(tNamet FixBasestringcBseZeZdZdZRS(s 'basestring'cCstdd|jS(Nustrtprefix(RR(tselftnodetresults((s4/usr/lib64/python2.7/lib2to3/fixes/fix_basestring.pyt transform s(t__name__t __module__tTruet BM_compatibletPATTERNR(((s4/usr/lib64/python2.7/lib2to3/fixes/fix_basestring.pyRsN(t__doc__tRt fixer_utilRtBaseFixR(((s4/usr/lib64/python2.7/lib2to3/fixes/fix_basestring.pytsPK81]s<<fix_isinstance.pyonu[ {fc@sCdZddlmZddlmZdejfdYZdS(s,Fixer that cleans up a tuple argument to isinstance after the tokens in it were fixed. This is mainly used to remove double occurrences of tokens as a leftover of the long -> int / unicode -> str conversion. eg. isinstance(x, (int, long)) -> isinstance(x, (int, int)) -> isinstance(x, int) i(t fixer_base(ttokent FixIsinstancecBs#eZeZdZdZdZRS(s power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > ic CsUt}|d}|j}g}t|}x|D]\}} | jtjkr| j|kr|t|dkr||djtjkr|j q5qq5|j | | jtjkr5|j | jq5q5W|r|djtjkr|d=nt|dkr@|j } | j |d_ | j|dn||(|jdS(Ntargsiii(tsettchildrent enumeratettypeRtNAMEtvaluetlentCOMMAtnexttappendtaddtparenttprefixtreplacetchanged( tselftnodetresultstnames_insertedttestlistRtnew_argstiteratortidxtargtatom((s4/usr/lib64/python2.7/lib2to3/fixes/fix_isinstance.pyt transforms*    !0     (t__name__t __module__tTruet BM_compatibletPATTERNt run_orderR(((s4/usr/lib64/python2.7/lib2to3/fixes/fix_isinstance.pyRsN(t__doc__tRt fixer_utilRtBaseFixR(((s4/usr/lib64/python2.7/lib2to3/fixes/fix_isinstance.pyt sPK81]Rfix_imports.pyonu[ {fc@sdZddlmZddlmZmZi0dd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6dCdD6dCdE6dFdG6dHdI6dJdK6dLdM6dNdO6dPdQ6dPdR6dPdS6dTdU6dVdW6dVdX6dYdZ6d[d\6Zd]Zed^Zd_ej fd`YZ daS(bs/Fix incompatible imports and module references.i(t fixer_base(tNamet attr_chaintiotStringIOt cStringIOtpickletcPickletbuiltinst __builtin__tcopyregtcopy_regtqueuetQueuet socketservert SocketServert configparsert ConfigParsertreprlibtreprstkinter.filedialogt FileDialogt tkFileDialogstkinter.simpledialogt SimpleDialogttkSimpleDialogstkinter.colorchooserttkColorChooserstkinter.commondialogttkCommonDialogstkinter.dialogtDialogs tkinter.dndtTkdnds tkinter.fontttkFontstkinter.messageboxt tkMessageBoxstkinter.scrolledtextt ScrolledTextstkinter.constantst Tkconstantss tkinter.tixtTixs tkinter.ttktttkttkintertTkintert _markupbaset markupbasetwinregt_winregt_threadtthreadt _dummy_threadt dummy_threadsdbm.bsdtdbhashsdbm.dumbtdumbdbmsdbm.ndbmtdbmsdbm.gnutgdbms xmlrpc.clientt xmlrpclibs xmlrpc.servertDocXMLRPCServertSimpleXMLRPCServers http.clientthttplibs html.entitiesthtmlentitydefss html.parsert HTMLParsers http.cookiestCookieshttp.cookiejart cookielibs http.servertBaseHTTPServertSimpleHTTPServert CGIHTTPServert subprocesstcommandst collectionst UserStringtUserLists urllib.parseturlparsesurllib.robotparsert robotparsercCsddjtt|dS(Nt(t|t)(tjointmapR(tmembers((s1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pyt alternates=sccsldjg|D]}d|^q }t|j}d||fVd|Vd||fVd|VdS(Ns | smodule_name='%s'syname_import=import_name< 'import' ((%s) | multiple_imports=dotted_as_names< any* (%s) any* >) > simport_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > simport_name< 'import' (dotted_as_name< (%s) 'as' any > | multiple_imports=dotted_as_names< any* dotted_as_name< (%s) 'as' any > any* >) > s3power< bare_with_attr=(%s) trailer<'.' any > any* >(RERHtkeys(tmappingtkeytmod_listt bare_names((s1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pyt build_patternAs & t FixImportscBsMeZeZeZeZdZdZdZ dZ dZ dZ RS(icCsdjt|jS(NRC(RERNRJ(tself((s1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pyRN`scCs&|j|_tt|jdS(N(RNtPATTERNtsuperROtcompile_pattern(RP((s1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pyRScscsatt|j|}|r]d|krYtfdt|dDrYtS|StS(Ntbare_with_attrc3s|]}|VqdS(N((t.0tobj(tmatch(s1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pys qstparent(RRRORWtanyRtFalse(RPtnodetresults((RWs1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pyRWjs  %cCs&tt|j||i|_dS(N(RRROt start_treetreplace(RPttreetfilename((s1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pyR]vscCs|jd}|r|j}t|j|}|jt|d|jd|kri||j|sj    PK81]cfix_filter.pycnu[ {fc@sedZddlmZddlmZddlmZmZmZm Z dej fdYZ dS(sFixer that changes filter(F, X) into list(filter(F, X)). We avoid the transformation if the filter() call is directly contained in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. NOTE: This is still not correct if the original code was depending on filter(F, X) to return a string if X is a string and a tuple if X is a tuple. That would require type inference, which we don't do. Let Python 2.6 figure it out. i(ttoken(t fixer_base(tNametCalltListComptin_special_contextt FixFiltercBs#eZeZdZdZdZRS(s filter_lambda=power< 'filter' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > > | power< 'filter' trailer< '(' arglist< none='None' ',' seq=any > ')' > > | power< 'filter' args=trailer< '(' [any] ')' > > sfuture_builtins.filtercCs|j|rdSd|krst|jdj|jdj|jdj|jdj}n}d|krttdtd|djtd}n=t|rdS|j}d|_ttd |g}|j|_|S( Nt filter_lambdatfptittxptnoneu_ftsequulist( t should_skipRtgettcloneRRtNonetprefixR(tselftnodetresultstnew((s0/usr/lib64/python2.7/lib2to3/fixes/fix_filter.pyt transform5s&         (t__name__t __module__tTruet BM_compatibletPATTERNtskip_onR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_filter.pyRsN( t__doc__tpgen2RtRt fixer_utilRRRRtConditionalFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_filter.pyts"PK81] fix_except.pyonu[ {fc@sdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z dZ dejfdYZd S( sFixer for except statements with named exceptions. The following cases will be converted: - "except E, T:" where T is a name: except E as T: - "except E, T:" where T is not a name, tuple or list: except E as t: T = t This is done because the target of an "except" clause must be a name. - "except E, T:" where T is a tuple or list literal: except E as t: T = t.args i(tpytree(ttoken(t fixer_base(tAssigntAttrtNametis_tupletis_listtsymsccsbx[t|D]M\}}|jtjkr |jdjdkrZ|||dfVqZq q WdS(Niuexcepti(t enumeratettypeRt except_clausetchildrentvalue(tnodestitn((s0/usr/lib64/python2.7/lib2to3/fixes/fix_except.pyt find_exceptsst FixExceptcBseZeZdZdZRS(s1 try_stmt< 'try' ':' (simple_stmt | suite) cleanup=(except_clause ':' (simple_stmt | suite))+ tail=(['except' ':' (simple_stmt | suite)] ['else' ':' (simple_stmt | suite)] ['finally' ':' (simple_stmt | suite)]) > cCs,|j}g|dD]}|j^q}g|dD]}|j^q7}xt|D]\}} t|jdkr\|jdd!\} } } | jtddd| jtj krt|j dd} | j}d|_ | j| | j} | j}x0t |D]"\}}t |tjrPqqWt| s[t| r|t|t| td }nt|| }x(t|| D]}| jd |qW| j||q| j dkrd| _ qq\q\Wg|jd D]}|j^q||}tj|j|S( Nttailtcleanupiiuastprefixu uuargsii(RtcloneRtlenR treplaceRR RtNAMEtnew_nameRR t isinstanceRtNodeRRRRtreversedt insert_child(tselftnodetresultsRRRtcht try_cleanupR te_suitetEtcommatNtnew_Nttargett suite_stmtsRtstmttassigntchildtcR ((s0/usr/lib64/python2.7/lib2to3/fixes/fix_except.pyt transform/s6 ##     !.(t__name__t __module__tTruet BM_compatibletPATTERNR/(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_except.pyR$sN(t__doc__tRtpgen2RRt fixer_utilRRRRRRRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_except.pyts . PK81]xA fix_next.pyonu[ {fc@sdZddlmZddlmZddlmZddlm Z m Z m Z dZ dej fdYZd Zd Zd Zd S( s.Fixer for it.next() -> next(it), per PEP 3114.i(ttoken(tpython_symbols(t fixer_base(tNametCallt find_bindings;Calls to builtin next() possibly shadowed by global bindingtFixNextcBs,eZeZdZdZdZdZRS(s power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > > | power< head=any+ trailer< '.' attr='next' > not trailer< '(' ')' > > | classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='next' parameters< '(' NAME ')' > any+ > any* > > | global=global_stmt< 'global' any* 'next' any* > tprecCsWtt|j||td|}|rJ|j|tt|_n t|_dS(Nunext( tsuperRt start_treeRtwarningt bind_warningtTruet shadowed_nexttFalse(tselfttreetfilenametn((s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyR $s  cCs|jd}|jd}|jd}|r|jr[|jtdd|jqg|D]}|j^qb}d|d_|jttdd|j|n|rtdd|j}|j|n|rWt|rA|d }d jg|D]}t |^qj d kr=|j |t ndS|jtdn(d |kr|j |t t |_ndS( Ntbasetattrtnameu__next__tprefixuiunexttheadtu __builtin__tglobal(tgetR treplaceRRtcloneRtis_assign_targettjointstrtstripR R R (RtnodetresultsRRRRR((s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyt transform.s,  (  4 (t__name__t __module__R t BM_compatibletPATTERNtorderR R#(((s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyRs  cCs]t|}|dkrtSx:|jD]/}|jtjkrBtSt||r&tSq&WtS(N( t find_assigntNoneRtchildrenttypeRtEQUALt is_subtreeR (R!tassigntchild((s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyRQs  cCsH|jtjkr|S|jtjks7|jdkr;dSt|jS(N(R,tsymst expr_stmtt simple_stmttparentR*R)(R!((s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyR)]s !cs-|krtStfd|jDS(Nc3s|]}t|VqdS(N(R.(t.0tc(R!(s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pys gs(R tanyR+(trootR!((R!s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyR.ds N(t__doc__tpgen2RtpygramRR1RRt fixer_utilRRRR tBaseFixRRR)R.(((s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyts@ PK81]tڢfix_buffer.pycnu[ {fc@sCdZddlmZddlmZdejfdYZdS(s4Fixer that changes buffer(...) into memoryview(...).i(t fixer_base(tNamet FixBuffercBs#eZeZeZdZdZRS(sR power< name='buffer' trailer< '(' [any] ')' > any* > cCs*|d}|jtdd|jdS(Ntnameu memoryviewtprefix(treplaceRR(tselftnodetresultsR((s0/usr/lib64/python2.7/lib2to3/fixes/fix_buffer.pyt transforms (t__name__t __module__tTruet BM_compatibletexplicittPATTERNR (((s0/usr/lib64/python2.7/lib2to3/fixes/fix_buffer.pyR sN(t__doc__tRt fixer_utilRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_buffer.pytsPK81]Hmfix_itertools_imports.pycnu[ {fc@sOdZddlmZddlmZmZmZdejfdYZdS(sA Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) i(t fixer_base(t BlankLinetsymsttokentFixItertoolsImportscBs$eZeZdeZdZRS(sT import_from< 'from' 'itertools' 'import' imports=any > c Cs|d}|jtjks&|j r2|g}n |j}x|dddD]}|jtjkry|j}|}n;|jtjkrdS|jtjkst|jd}|j}|dkrd|_|j qO|dkrO|j |d d kr d nd |_qOqOW|jp+|g}t } x=|D]5}| rf|jtj krf|j q;| t N} q;Wx0|r|d jtj kr|jj qwW|jpt|dd s|jdkr|j} t}| |_|SdS(Ntimportsiiuimapuizipuifilteru ifilterfalseu izip_longestiufu filterfalseu zip_longestitvalue(uimapuizipuifilter(u ifilterfalseu izip_longest(ttypeRtimport_as_nametchildrenRtNAMERtSTARtAssertionErrortNonetremovetchangedtTruetCOMMAtpoptgetattrtparenttprefixR( tselftnodetresultsRR tchildtmembert name_nodet member_namet remove_commatp((s;/usr/lib64/python2.7/lib2to3/fixes/fix_itertools_imports.pyt transformsD                 (t__name__t __module__Rt BM_compatibletlocalstPATTERNR(((s;/usr/lib64/python2.7/lib2to3/fixes/fix_itertools_imports.pyRs N( t__doc__tlib2to3Rtlib2to3.fixer_utilRRRtBaseFixR(((s;/usr/lib64/python2.7/lib2to3/fixes/fix_itertools_imports.pytsPK81]?յ fix_import.pyonu[ {fc@szdZddlmZddlmZmZmZmZddlm Z m Z m Z dZ dej fdYZd S( sFixer for import statements. If spam is being imported from the local directory, this import: from spam import eggs Becomes: from .spam import eggs And this import: import spam Becomes: from . import spam i(t fixer_basei(tdirnametjointexiststsep(t FromImporttsymsttokenccs|g}x|r|j}|jtjkr;|jVq |jtjkrwdjg|jD]}|j^q]Vq |jtj kr|j |jdq |jtj kr|j |jdddq t dq WdS(sF Walks over all the names imported in a dotted_as_names node. tiNisunknown node type(tpopttypeRtNAMEtvalueRt dotted_nameRtchildrentdotted_as_nametappendtdotted_as_namestextendtAssertionError(tnamestpendingtnodetch((s0/usr/lib64/python2.7/lib2to3/fixes/fix_import.pyttraverse_importss    * t FixImportcBs/eZeZdZdZdZdZRS(sj import_from< 'from' imp=any 'import' ['('] any [')'] > | import_name< 'import' imp=any > cCs/tt|j||d|jk|_dS(Ntabsolute_import(tsuperRt start_treetfuture_featurestskip(tselfttreetname((s0/usr/lib64/python2.7/lib2to3/fixes/fix_import.pyR/scCs|jr dS|d}|jtjkr~x t|dsK|jd}q,W|j|jrd|j|_|jqnt }t }x2t |D]$}|j|rt }qt }qW|r|r|j |dndSt d|g}|j|_|SdS(NtimpR iu.s#absolute and local imports together(RR Rt import_fromthasattrRtprobably_a_local_importR tchangedtFalseRtTruetwarningRtprefix(RRtresultsR"t have_localt have_absolutetmod_nametnew((s0/usr/lib64/python2.7/lib2to3/fixes/fix_import.pyt transform3s,     cCs|jdrtS|jddd}t|j}t||}ttt|dsftSx4dtdddd gD]}t||rtSqWtS( Nu.iis __init__.pys.pys.pycs.sos.sls.pyd( t startswithR'tsplitRtfilenameRRRR((Rtimp_namet base_pathtext((s0/usr/lib64/python2.7/lib2to3/fixes/fix_import.pyR%Us(t__name__t __module__R(t BM_compatibletPATTERNRR0R%(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_import.pyR&s   "N(t__doc__RRtos.pathRRRRt fixer_utilRRRRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_import.pyt s " PK81]G~Z fix_repr.pycnu[ {fc@sOdZddlmZddlmZmZmZdejfdYZdS(s/Fixer that transforms `xyzzy` into repr(xyzzy).i(t fixer_base(tCalltNamet parenthesizetFixReprcBseZeZdZdZRS(s7 atom < '`' expr=any '`' > cCsS|dj}|j|jjkr4t|}nttd|gd|jS(Ntexprureprtprefix(tclonettypetsymst testlist1RRRR(tselftnodetresultsR((s./usr/lib64/python2.7/lib2to3/fixes/fix_repr.pyt transforms(t__name__t __module__tTruet BM_compatibletPATTERNR(((s./usr/lib64/python2.7/lib2to3/fixes/fix_repr.pyR sN( t__doc__tRt fixer_utilRRRtBaseFixR(((s./usr/lib64/python2.7/lib2to3/fixes/fix_repr.pytsPK81]ifix_idioms.pycnu[ {fc@smdZddlmZddlmZmZmZmZmZm Z dZ dZ dej fdYZ dS( sAdjust some old Python 2 idioms to their modern counterparts. * Change some type comparisons to isinstance() calls: type(x) == T -> isinstance(x, T) type(x) is T -> isinstance(x, T) type(x) != T -> not isinstance(x, T) type(x) is not T -> not isinstance(x, T) * Change "while 1:" into "while True:". * Change both v = list(EXPR) v.sort() foo(v) and the more general v = EXPR v.sort() foo(v) into v = sorted(EXPR) foo(v) i(t fixer_base(tCalltCommatNametNodet BlankLinetsymss0(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)s(power< 'type' trailer< '(' x=any ')' > >t FixIdiomscBsQeZeZdeeeefZdZdZdZ dZ dZ RS(s isinstance=comparison< %s %s T=any > | isinstance=comparison< T=any %s %s > | while_stmt< 'while' while='1' ':' any+ > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' power< list='list' trailer< '(' (not arglist) any ')' > > > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' expr=any > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > cCsJtt|j|}|rFd|krF|d|dkrB|SdS|S(Ntsortedtid1tid2(tsuperRtmatchtNone(tselftnodetr((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyR Os cCsdd|kr|j||Sd|kr8|j||Sd|krT|j||StddS(Nt isinstancetwhileRs Invalid match(ttransform_isinstancettransform_whilettransform_sortt RuntimeError(RRtresults((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyt transformZs   cCs|dj}|dj}d|_d|_ttd|t|g}d|krd|_ttjtd|g}n|j|_|S(NtxtTuu u isinstancetnunot(tclonetprefixRRRRRtnot_test(RRRRRttest((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyRds  !  ! cCs*|d}|jtdd|jdS(NRuTrueR(treplaceRR(RRRtone((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyRps c Csv|d}|d}|jd}|jd}|rW|jtdd|jnR|r|j}d|_|jttd|gd|jn td|j|j}d |krr|r|jd d |d jf} d j | |d _qr|j st |j dks+t t} |j j| |j | ksYt |jd d | _ndS( NtsorttnexttlisttexprusortedRusshould not have reached hereu i(tgetR RRRRRtremovet rpartitiontjointparenttAssertionErrort next_siblingR Rt append_child( RRRt sort_stmtt next_stmtt list_callt simple_exprtnewtbtwnt prefix_linestend_line((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyRts0          ( t__name__t __module__tTruetexplicittTYPEtCMPtPATTERNR RRRR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyR%s' N(t__doc__tRt fixer_utilRRRRRRR;R:tBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyts .PK81]uccfix_standarderror.pyonu[ {fc@sCdZddlmZddlmZdejfdYZdS(s%Fixer for StandardError -> Exception.i(t fixer_base(tNametFixStandarderrorcBseZeZdZdZRS(s- 'StandardError' cCstdd|jS(Nu Exceptiontprefix(RR(tselftnodetresults((s7/usr/lib64/python2.7/lib2to3/fixes/fix_standarderror.pyt transforms(t__name__t __module__tTruet BM_compatibletPATTERNR(((s7/usr/lib64/python2.7/lib2to3/fixes/fix_standarderror.pyR sN(t__doc__tRt fixer_utilRtBaseFixR(((s7/usr/lib64/python2.7/lib2to3/fixes/fix_standarderror.pytsPK81]fix_operator.pycnu[ {fc@s^dZddlmZddlmZmZmZmZdZdej fdYZ dS(sFixer for operator functions. operator.isCallable(obj) -> hasattr(obj, '__call__') operator.sequenceIncludes(obj) -> operator.contains(obj) operator.isSequenceType(obj) -> isinstance(obj, collections.Sequence) operator.isMappingType(obj) -> isinstance(obj, collections.Mapping) operator.isNumberType(obj) -> isinstance(obj, numbers.Number) operator.repeat(obj, n) -> operator.mul(obj, n) operator.irepeat(obj, n) -> operator.imul(obj, n) i(t fixer_base(tCalltNametStringt touch_importcsfd}|S(Ncs |_|S(N(t invocation(tf(ts(s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pytdecs ((RR((Rs2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyRst FixOperatorcBseZeZdZdZdZdededeZdZ e ddZ e d d Z e d d Z e d dZe ddZe ddZe ddZdZdZdZRS(tpres method=('isCallable'|'sequenceIncludes' |'isSequenceType'|'isMappingType'|'isNumberType' |'repeat'|'irepeat') s'(' obj=any ')'s power< module='operator' trailer< '.' %(methods)s > trailer< %(obj)s > > | power< %(methods)s trailer< %(obj)s > > tmethodstobjcCs/|j||}|dk r+|||SdS(N(t _check_methodtNone(tselftnodetresultstmethod((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt transform)s soperator.contains(%s)cCs|j||dS(Nucontains(t_handle_rename(RRR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt_sequenceIncludes.sshasattr(%s, '__call__')cCsG|d}|jtdtdg}ttd|d|jS(NR u, u '__call__'uhasattrtprefix(tcloneRRRR(RRRR targs((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt _isCallable2s !soperator.mul(%s)cCs|j||dS(Numul(R(RRR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt_repeat8ssoperator.imul(%s)cCs|j||dS(Nuimul(R(RRR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt_irepeat<ss$isinstance(%s, collections.Sequence)cCs|j||ddS(Nu collectionsuSequence(t_handle_type2abc(RRR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt_isSequenceType@ss#isinstance(%s, collections.Mapping)cCs|j||ddS(Nu collectionsuMapping(R(RRR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt_isMappingTypeDssisinstance(%s, numbers.Number)cCs|j||ddS(NunumbersuNumber(R(RRR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt _isNumberTypeHscCs%|dd}||_|jdS(NRi(tvaluetchanged(RRRtnameR((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyRLs cCsatd|||d}|jtddj||gg}ttd|d|jS(NR u, u.u isinstanceR(RRRRtjoinRRR(RRRtmoduletabcR R((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyRQs +cCst|d|ddjjd}t|rd|krC|St|df}t|j|}|j|d|ndS(Nt_RitasciiR$R uYou should use '%s' here.(tgetattrR tencodetcallabletunicodeRtwarningR(RRRRtsubtinvocation_str((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyR Ws'  (t__name__t __module__tTruet BM_compatibletorderR R tdicttPATTERNRRRRRRRRRRRR (((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyR s    N( t__doc__tlib2to3Rtlib2to3.fixer_utilRRRRRtBaseFixR (((s2/usr/lib64/python2.7/lib2to3/fixes/fix_operator.pyt s" PK81]mU fix_paren.pycnu[ {fc@sIdZddlmZddlmZmZdejfdYZdS(suFixer that addes parentheses where they are required This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``.i(t fixer_base(tLParentRParentFixParencBseZeZdZdZRS(s 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] > >) (']' | ')') > cCsL|d}t}|j|_d|_|jd||jtdS(Nttargetui(Rtprefixt insert_childt append_childR(tselftnodetresultsRtlparen((s//usr/lib64/python2.7/lib2to3/fixes/fix_paren.pyt transform%s     (t__name__t __module__tTruet BM_compatibletPATTERNR (((s//usr/lib64/python2.7/lib2to3/fixes/fix_paren.pyR sN(t__doc__tRt fixer_utilRRtBaseFixR(((s//usr/lib64/python2.7/lib2to3/fixes/fix_paren.pytsPK81]Tv˒RRfix_tuple_params.pyonu[ {fc@sdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z dZ dejfdYZd Zd Zgd d Zd Zd S(s:Fixer for function definitions with tuple parameters. def func(((a, b), c), d): ... -> def func(x, d): ((a, b), c) = x ... It will also support lambdas: lambda (x, y): x + y -> lambda t: t[0] + t[1] # The parens are a syntax error in Python 3 lambda (x): x + y -> lambda x: x + y i(tpytree(ttoken(t fixer_base(tAssigntNametNewlinetNumbert SubscripttsymscCs)t|tjo(|jdjtjkS(Ni(t isinstanceRtNodetchildrenttypeRtSTRING(tstmt((s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyt is_docstringstFixTupleParamscBs,eZdZeZdZdZdZRS(is funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > c s0d|krj||Sg|d}|d}|djdjtjkryd}|djdj}tn!d}d}tjtjdt fd }|jt j kr||n`|jt j kr1xKt |jD]7\}} | jt j kr|| d |dkqqWns;dSxD]} |d| _qBW|} |dkr{d d_n1t|dj|r|d_|d} nxD]} |d| _qW|dj| | +x=t| d| tdD]}||dj|_qW|djdS( Ntlambdatsuitetargsiiiu; ucstj}|j}d|_t||j}|rNd|_n|j|jtjt j |jgdS(Nuu ( Rtnew_nametclonetprefixRtreplacetappendRR Rt simple_stmt(t tuple_argt add_prefixtntargR(tendt new_linestself(s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyt handle_tupleCs    Ru (ttransform_lambdaR R RtINDENTtvalueRRtLeaftFalseRttfpdeft typedargslistt enumeratetparentRRtrangetlentchanged( R tnodetresultsRRtstarttindentR!tiRtlinetafter((RRR s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyt transform.sF            (cCsN|d}|d}t|d}|jtjkr\|j}d|_|j|dSt|}t|}|j t |}t |dd} |j| jx|j D]} | jtjkr| j |krg|| j D]} | j^q} tjtj| jg| } | j| _| j| qqWdS(NRtbodytinneru R(t simplify_argsR RtNAMERRRt find_paramst map_to_indexRt tuple_nameRt post_orderR$RR Rtpower(R R.R/RR6R7tparamstto_indexttup_namet new_paramRtct subscriptstnew((s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyR"ns(       !&  (t__name__t __module__t run_ordertTruet BM_compatibletPATTERNR5R"(((s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyRs   @cCso|jtjtjfkr|S|jtjkr[x#|jtjkrV|jd}q4W|Std|dS(NisReceived unexpected node %s(R RtvfplistRR9tvfpdefR t RuntimeError(R.((s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyR8scCsn|jtjkr#t|jdS|jtjkr<|jSg|jD]$}|jtjkrFt|^qFS(Ni( R RRMR:R RR9R$tCOMMA(R.RC((s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyR:s cCs|dkri}nxht|D]Z\}}ttt|g}t|trnt||d|q"||||s. l  PK81]fix_future.pycnu[ {fc@sCdZddlmZddlmZdejfdYZdS(sVRemove __future__ imports from __future__ import foo is replaced with an empty line. i(t fixer_base(t BlankLinet FixFuturecBs#eZeZdZdZdZRS(s;import_from< 'from' module_name="__future__" 'import' any >i cCst}|j|_|S(N(Rtprefix(tselftnodetresultstnew((s0/usr/lib64/python2.7/lib2to3/fixes/fix_future.pyt transforms  (t__name__t __module__tTruet BM_compatibletPATTERNt run_orderR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_future.pyR sN(t__doc__tRt fixer_utilRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_future.pytsPK81]ĸ&fix_methodattrs.pyonu[ {fc@s^dZddlmZddlmZidd6dd6dd 6Zd ejfd YZd S( s;Fix bound method attributes (method.im_? -> method.__?__). i(t fixer_base(tNamet__func__tim_funct__self__tim_selfs__self__.__class__tim_classtFixMethodattrscBseZeZdZdZRS(sU power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > cCsA|dd}tt|j}|jt|d|jdS(Ntattritprefix(tunicodetMAPtvaluetreplaceRR (tselftnodetresultsRtnew((s5/usr/lib64/python2.7/lib2to3/fixes/fix_methodattrs.pyt transforms(t__name__t __module__tTruet BM_compatibletPATTERNR(((s5/usr/lib64/python2.7/lib2to3/fixes/fix_methodattrs.pyRsN(t__doc__tRt fixer_utilRR tBaseFixR(((s5/usr/lib64/python2.7/lib2to3/fixes/fix_methodattrs.pyts PK81]tfix_asserts.pyonu[ {fc@sdZddlmZddlmZedddddd d d d d dddddddd dd dd ddddddZdefdYZdS(s5Fixer that replaces deprecated unittest method names.i(tBaseFix(tNametassert_t assertTruet assertEqualst assertEqualtassertNotEqualstassertNotEqualtassertAlmostEqualstassertAlmostEqualtassertNotAlmostEqualstassertNotAlmostEqualtassertRegexpMatchest assertRegextassertRaisesRegexptassertRaisesRegextfailUnlessEqualt failIfEqualtfailUnlessAlmostEqualtfailIfAlmostEqualt failUnlesstfailUnlessRaisest assertRaisestfailIft assertFalset FixAssertscBs-eZddjeeeZdZRS(sH power< any+ trailer< '.' meth=(%s)> any* > t|cCs8|dd}|jttt|d|jdS(Ntmethitprefix(treplaceRtNAMEStstrR(tselftnodetresultstname((s1/usr/lib64/python2.7/lib2to3/fixes/fix_asserts.pyt transform s(t__name__t __module__tjointmaptreprRtPATTERNR$(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_asserts.pyRsN(t__doc__t fixer_baseRt fixer_utilRtdictRR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_asserts.pyts$ PK81]mU fix_paren.pyonu[ {fc@sIdZddlmZddlmZmZdejfdYZdS(suFixer that addes parentheses where they are required This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``.i(t fixer_base(tLParentRParentFixParencBseZeZdZdZRS(s 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] > >) (']' | ')') > cCsL|d}t}|j|_d|_|jd||jtdS(Nttargetui(Rtprefixt insert_childt append_childR(tselftnodetresultsRtlparen((s//usr/lib64/python2.7/lib2to3/fixes/fix_paren.pyt transform%s     (t__name__t __module__tTruet BM_compatibletPATTERNR (((s//usr/lib64/python2.7/lib2to3/fixes/fix_paren.pyR sN(t__doc__tRt fixer_utilRRtBaseFixR(((s//usr/lib64/python2.7/lib2to3/fixes/fix_paren.pytsPK81]Ҋ<<fix_execfile.pycnu[ {fc@sydZddlmZddlmZmZmZmZmZm Z m Z m Z m Z m Z dejfdYZdS(soFixer for execfile. This converts usages of the execfile function into calls to the built-in exec() function. i(t fixer_base( tCommatNametCalltLParentRParentDottNodetArgListtStringtsymst FixExecfilecBseZeZdZdZRS(s power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > | power< 'execfile' trailer< '(' filename=any ')' > > cCs|s t|d}|jd}|jd}|jdjdj}t|jttddgd|}ttj t d|g}ttj t t d gttj t tgg} |g| } |j} d | _td d } | t| t| g} tt d | d }|g}|dk rq|jt|jgn|dk r|jt|jgntt d|d|jS(Ntfilenametglobalstlocalsis"rb"t trparenuopenureadu u'exec'ucompileuuexectprefix(tAssertionErrortgettchildrentcloneRRR RR tpowerRttrailerRRRRRtNonetextend(tselftnodetresultsR R Rtexecfile_parent open_argst open_calltreadt open_exprt filename_argtexec_strt compile_argst compile_calltargs((s2/usr/lib64/python2.7/lib2to3/fixes/fix_execfile.pyt transforms,  $ !      (t__name__t __module__tTruet BM_compatibletPATTERNR'(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_execfile.pyR sN(t__doc__tRt fixer_utilRRRRRRRRR R tBaseFixR (((s2/usr/lib64/python2.7/lib2to3/fixes/fix_execfile.pytsFPK81]ؒ __init__.pyonu[ {fc@sdS(N((((s./usr/lib64/python2.7/lib2to3/fixes/__init__.pyttPK81]QQfix_idioms.pyonu[ {fc@smdZddlmZddlmZmZmZmZmZm Z dZ dZ dej fdYZ dS( sAdjust some old Python 2 idioms to their modern counterparts. * Change some type comparisons to isinstance() calls: type(x) == T -> isinstance(x, T) type(x) is T -> isinstance(x, T) type(x) != T -> not isinstance(x, T) type(x) is not T -> not isinstance(x, T) * Change "while 1:" into "while True:". * Change both v = list(EXPR) v.sort() foo(v) and the more general v = EXPR v.sort() foo(v) into v = sorted(EXPR) foo(v) i(t fixer_base(tCalltCommatNametNodet BlankLinetsymss0(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)s(power< 'type' trailer< '(' x=any ')' > >t FixIdiomscBsQeZeZdeeeefZdZdZdZ dZ dZ RS(s isinstance=comparison< %s %s T=any > | isinstance=comparison< T=any %s %s > | while_stmt< 'while' while='1' ':' any+ > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' power< list='list' trailer< '(' (not arglist) any ')' > > > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' expr=any > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > cCsJtt|j|}|rFd|krF|d|dkrB|SdS|S(Ntsortedtid1tid2(tsuperRtmatchtNone(tselftnodetr((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyR Os cCsdd|kr|j||Sd|kr8|j||Sd|krT|j||StddS(Nt isinstancetwhileRs Invalid match(ttransform_isinstancettransform_whilettransform_sortt RuntimeError(RRtresults((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyt transformZs   cCs|dj}|dj}d|_d|_ttd|t|g}d|krd|_ttjtd|g}n|j|_|S(NtxtTuu u isinstancetnunot(tclonetprefixRRRRRtnot_test(RRRRRttest((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyRds  !  ! cCs*|d}|jtdd|jdS(NRuTrueR(treplaceRR(RRRtone((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyRps c Cs=|d}|d}|jd}|jd}|rW|jtdd|jnR|r|j}d|_|jttd|gd|jn td|j|j}d |kr9|r|jd d |d jf} d j | |d _q9t } |j j | |jd d | _ndS( NtsorttnexttlisttexprusortedRusshould not have reached hereu i( tgetR RRRRRtremovet rpartitiontjoinRtparentt append_child( RRRt sort_stmtt next_stmtt list_callt simple_exprtnewtbtwnt prefix_linestend_line((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyRts*          ( t__name__t __module__tTruetexplicittTYPEtCMPtPATTERNR RRRR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyR%s' N(t__doc__tRt fixer_utilRRRRRRR9R8tBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_idioms.pyts .PK81]Pr  fix_itertools.pyonu[ {fc@sCdZddlmZddlmZdejfdYZdS(sT Fixer for itertools.(imap|ifilter|izip) --> (map|filter|zip) and itertools.ifilterfalse --> itertools.filterfalse (bugs 2360-2363) imports from itertools are fixed in fix_itertools_import.py If itertools is imported as something else (ie: import itertools as it; it.izip(spam, eggs)) method calls will not get fixed. i(t fixer_base(tNamet FixItertoolscBs0eZeZdZdeZdZdZRS(s7('imap'|'ifilter'|'izip'|'izip_longest'|'ifilterfalse')s power< it='itertools' trailer< dot='.' func=%(it_funcs)s > trailer< '(' [any] ')' > > | power< func=%(it_funcs)s trailer< '(' [any] ')' > > icCsd}|dd}d|krt|jd krt|d|d}}|j}|j|j|jj|n|p|j}|jt|jdd|dS( Ntfuncititu ifilterfalseu izip_longesttdotitprefix(u ifilterfalseu izip_longest(tNonetvalueRtremovetparenttreplaceR(tselftnodetresultsRRRR((s3/usr/lib64/python2.7/lib2to3/fixes/fix_itertools.pyt transforms    ( t__name__t __module__tTruet BM_compatibletit_funcstlocalstPATTERNt run_orderR(((s3/usr/lib64/python2.7/lib2to3/fixes/fix_itertools.pyRs  N(t__doc__tRt fixer_utilRtBaseFixR(((s3/usr/lib64/python2.7/lib2to3/fixes/fix_itertools.pytsPK81]҇ fix_print.pycnu[ {fc@sdZddlmZddlmZddlmZddlmZddlmZm Z m Z m Z m Z ej dZdejfd YZd S( s Fixer for print. Change: 'print' into 'print()' 'print ...' into 'print(...)' 'print ... ,' into 'print(..., end=" ")' 'print >>x, ...' into 'print(..., file=x)' No changes are applied if print_function is imported from __future__ i(tpatcomp(tpytree(ttoken(t fixer_base(tNametCalltCommatStringtis_tuples"atom< '(' [atom|STRING|NAME] ')' >tFixPrintcBs&eZeZdZdZdZRS(sP simple_stmt< any* bare='print' any* > | print_stmt c Cs2|s t|jd}|rJ|jttdgd|jdS|jdtdksit|jd}t|dkrtj |drdSd}}}|r|dt kr|d }d}n|r3|dt j tjdkr3t|d kst|dj}|d }ng|D]}|j^q:} | rhd | d_n|dk s|dk s|dk r |dk r|j| d tt|n|dk r|j| d tt|n|dk r |j| d|q nttd| } |j| _| S(Ntbareuprinttprefixiiit u>>iiuusepuendufile(tAssertionErrortgettreplaceRRR tchildrentlent parend_exprtmatchtNoneRRtLeafRt RIGHTSHIFTtclonet add_kwargRtrepr( tselftnodetresultst bare_printtargstseptendtfiletargtl_argstn_stmt((s//usr/lib64/python2.7/lib2to3/fixes/fix_print.pyt transform%s>   %  % $ " "  cCsrd|_tj|jjt|tjtjd|f}|ra|j t d|_n|j |dS(Nuu=u ( R RtNodetsymstargumentRRRtEQUALtappendR(Rtl_nodests_kwdtn_exprt n_argument((s//usr/lib64/python2.7/lib2to3/fixes/fix_print.pyRMs    (t__name__t __module__tTruet BM_compatibletPATTERNR%R(((s//usr/lib64/python2.7/lib2to3/fixes/fix_print.pyR s (N(t__doc__tRRtpgen2RRt fixer_utilRRRRRtcompile_patternRtBaseFixR (((s//usr/lib64/python2.7/lib2to3/fixes/fix_print.pyts( PK81]ĸ&fix_methodattrs.pycnu[ {fc@s^dZddlmZddlmZidd6dd6dd 6Zd ejfd YZd S( s;Fix bound method attributes (method.im_? -> method.__?__). i(t fixer_base(tNamet__func__tim_funct__self__tim_selfs__self__.__class__tim_classtFixMethodattrscBseZeZdZdZRS(sU power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > cCsA|dd}tt|j}|jt|d|jdS(Ntattritprefix(tunicodetMAPtvaluetreplaceRR (tselftnodetresultsRtnew((s5/usr/lib64/python2.7/lib2to3/fixes/fix_methodattrs.pyt transforms(t__name__t __module__tTruet BM_compatibletPATTERNR(((s5/usr/lib64/python2.7/lib2to3/fixes/fix_methodattrs.pyRsN(t__doc__tRt fixer_utilRR tBaseFixR(((s5/usr/lib64/python2.7/lib2to3/fixes/fix_methodattrs.pyts PK81]&[  fix_xrange.pycnu[ {fc@s_dZddlmZddlmZmZmZddlmZdejfdYZ dS(s/Fixer that changes xrange(...) into range(...).i(t fixer_base(tNametCalltconsuming_calls(tpatcompt FixXrangecBsteZeZdZdZdZdZdZdZ dZ e j e Z dZe j eZdZRS( s power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > cCs)tt|j||t|_dS(N(tsuperRt start_treetsetttransformed_xranges(tselfttreetfilename((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyRscCs d|_dS(N(tNoneR (R R R ((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyt finish_treescCs^|d}|jdkr)|j||S|jdkrH|j||Stt|dS(Ntnameuxrangeurange(tvaluettransform_xrangettransform_ranget ValueErrortrepr(R tnodetresultsR((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyt transforms  cCs@|d}|jtdd|j|jjt|dS(NRurangetprefix(treplaceRRR taddtid(R RRR((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyR$s cCst||jkr|j| rttd|djg}ttd|gd|j}x|dD]}|j|qsW|SdS(NurangetargsulistRtrest(RR tin_special_contextRRtcloneRt append_child(R RRt range_callt list_calltn((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyR*s" s3power< func=NAME trailer< '(' node=any ')' > any* >sfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > | comparison< any 'in' node=any any*> cCs|jdkrtSi}|jjdk rg|jj|jj|rg|d|krg|djtkS|jj|j|o|d|kS(NRtfunc(tparentR tFalsetp1tmatchRRtp2(R RR((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyR?s(t__name__t __module__tTruet BM_compatibletPATTERNRRRRRtP1Rtcompile_patternR'tP2R)R(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyR s    N( t__doc__tRt fixer_utilRRRRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pytsPK81]}ׄLLfix_nonzero.pycnu[ {fc@sIdZddlmZddlmZmZdejfdYZdS(s*Fixer for __nonzero__ -> __bool__ methods.i(t fixer_base(tNametsymst FixNonzerocBseZeZdZdZRS(s classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='__nonzero__' parameters< '(' NAME ')' > any+ > any* > > cCs0|d}tdd|j}|j|dS(Ntnameu__bool__tprefix(RRtreplace(tselftnodetresultsRtnew((s1/usr/lib64/python2.7/lib2to3/fixes/fix_nonzero.pyt transforms (t__name__t __module__tTruet BM_compatibletPATTERNR (((s1/usr/lib64/python2.7/lib2to3/fixes/fix_nonzero.pyRsN(t__doc__tRt fixer_utilRRtBaseFixR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_nonzero.pytsPK81] ] ] fix_has_key.pyonu[ {fc@sidZddlmZddlmZddlmZddlmZmZdej fdYZ dS( s&Fixer for has_key(). Calls to .has_key() methods are expressed in terms of the 'in' operator: d.has_key(k) -> k in d CAVEATS: 1) While the primary target of this fixer is dict.has_key(), the fixer will change any has_key() method call, regardless of its class. 2) Cases like this will not be converted: m = d.has_key if m(k): ... Only *calls* to has_key() are converted. While it is possible to convert the above to something like m = d.__contains__ if m(k): ... this is currently not done. i(tpytree(ttoken(t fixer_base(tNamet parenthesizet FixHasKeycBseZeZdZdZRS(s anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > after=any* > | negation=not_test< 'not' anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > > > c CsI|j}|jj|jkr7|jj|jr7dS|jd}|d}|j}g|dD]}|j ^qd}|dj } |jd} | rg| D]}|j ^q} n| j|j |j|j |j |j |j|jfkr t| } nt|dkr*|d}ntj|j|}d|_td d d} |rtd d d} tj|j| | f} ntj|j | | |f} | rt| } tj|j| ft| } n|jj|j |j|j|j|j|j|j|j|jf kr<t| } n|| _| S( Ntnegationtanchortbeforetargtafteriiu uintprefixunot(tsymstparentttypetnot_testtpatterntmatchtNonetgetR tclonet comparisontand_testtor_testttesttlambdeftargumentRtlenRtNodetpowerRtcomp_opttupletexprtxor_exprtand_exprt shift_exprt arith_exprttermtfactor(tselftnodetresultsR RRR tnRR R tn_optn_nottnew((s1/usr/lib64/python2.7/lib2to3/fixes/fix_has_key.pyt transformHsD   #"!   %   (t__name__t __module__tTruet BM_compatibletPATTERNR.(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_has_key.pyR'sN( t__doc__tRtpgen2RRt fixer_utilRRtBaseFixR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_has_key.pyts PK81]cfix_filter.pyonu[ {fc@sedZddlmZddlmZddlmZmZmZm Z dej fdYZ dS(sFixer that changes filter(F, X) into list(filter(F, X)). We avoid the transformation if the filter() call is directly contained in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. NOTE: This is still not correct if the original code was depending on filter(F, X) to return a string if X is a string and a tuple if X is a tuple. That would require type inference, which we don't do. Let Python 2.6 figure it out. i(ttoken(t fixer_base(tNametCalltListComptin_special_contextt FixFiltercBs#eZeZdZdZdZRS(s filter_lambda=power< 'filter' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > > | power< 'filter' trailer< '(' arglist< none='None' ',' seq=any > ')' > > | power< 'filter' args=trailer< '(' [any] ')' > > sfuture_builtins.filtercCs|j|rdSd|krst|jdj|jdj|jdj|jdj}n}d|krttdtd|djtd}n=t|rdS|j}d|_ttd |g}|j|_|S( Nt filter_lambdatfptittxptnoneu_ftsequulist( t should_skipRtgettcloneRRtNonetprefixR(tselftnodetresultstnew((s0/usr/lib64/python2.7/lib2to3/fixes/fix_filter.pyt transform5s&         (t__name__t __module__tTruet BM_compatibletPATTERNtskip_onR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_filter.pyRsN( t__doc__tpgen2RtRt fixer_utilRRRRtConditionalFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_filter.pyts"PK81]G~Z fix_repr.pyonu[ {fc@sOdZddlmZddlmZmZmZdejfdYZdS(s/Fixer that transforms `xyzzy` into repr(xyzzy).i(t fixer_base(tCalltNamet parenthesizetFixReprcBseZeZdZdZRS(s7 atom < '`' expr=any '`' > cCsS|dj}|j|jjkr4t|}nttd|gd|jS(Ntexprureprtprefix(tclonettypetsymst testlist1RRRR(tselftnodetresultsR((s./usr/lib64/python2.7/lib2to3/fixes/fix_repr.pyt transforms(t__name__t __module__tTruet BM_compatibletPATTERNR(((s./usr/lib64/python2.7/lib2to3/fixes/fix_repr.pyR sN( t__doc__tRt fixer_utilRRRtBaseFixR(((s./usr/lib64/python2.7/lib2to3/fixes/fix_repr.pytsPK81]&[  fix_xrange.pyonu[ {fc@s_dZddlmZddlmZmZmZddlmZdejfdYZ dS(s/Fixer that changes xrange(...) into range(...).i(t fixer_base(tNametCalltconsuming_calls(tpatcompt FixXrangecBsteZeZdZdZdZdZdZdZ dZ e j e Z dZe j eZdZRS( s power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > cCs)tt|j||t|_dS(N(tsuperRt start_treetsetttransformed_xranges(tselfttreetfilename((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyRscCs d|_dS(N(tNoneR (R R R ((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyt finish_treescCs^|d}|jdkr)|j||S|jdkrH|j||Stt|dS(Ntnameuxrangeurange(tvaluettransform_xrangettransform_ranget ValueErrortrepr(R tnodetresultsR((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyt transforms  cCs@|d}|jtdd|j|jjt|dS(NRurangetprefix(treplaceRRR taddtid(R RRR((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyR$s cCst||jkr|j| rttd|djg}ttd|gd|j}x|dD]}|j|qsW|SdS(NurangetargsulistRtrest(RR tin_special_contextRRtcloneRt append_child(R RRt range_callt list_calltn((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyR*s" s3power< func=NAME trailer< '(' node=any ')' > any* >sfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > | comparison< any 'in' node=any any*> cCs|jdkrtSi}|jjdk rg|jj|jj|rg|d|krg|djtkS|jj|j|o|d|kS(NRtfunc(tparentR tFalsetp1tmatchRRtp2(R RR((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyR?s(t__name__t __module__tTruet BM_compatibletPATTERNRRRRRtP1Rtcompile_patternR'tP2R)R(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pyR s    N( t__doc__tRt fixer_utilRRRRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_xrange.pytsPK81],V V fix_print.pyonu[ {fc@sdZddlmZddlmZddlmZddlmZddlmZm Z m Z m Z m Z ej dZdejfd YZd S( s Fixer for print. Change: 'print' into 'print()' 'print ...' into 'print(...)' 'print ... ,' into 'print(..., end=" ")' 'print >>x, ...' into 'print(..., file=x)' No changes are applied if print_function is imported from __future__ i(tpatcomp(tpytree(ttoken(t fixer_base(tNametCalltCommatStringtis_tuples"atom< '(' [atom|STRING|NAME] ')' >tFixPrintcBs&eZeZdZdZdZRS(sP simple_stmt< any* bare='print' any* > | print_stmt c Cs|jd}|r>|jttdgd|jdS|jd}t|dkrttj|drtdSd}}}|r|dt kr|d }d}n|r|dt j t jdkr|dj}|d }ng|D]}|j^q} | r%d | d_n|dk sI|dk sI|dk r|dk rw|j| d tt|n|dk r|j| d tt|n|dk r|j| d |qnttd| } |j| _| S(Ntbareuprinttprefixiiit u>>iuusepuendufile(tgettreplaceRRR tchildrentlent parend_exprtmatchtNoneRRtLeafRt RIGHTSHIFTtclonet add_kwargRtrepr( tselftnodetresultst bare_printtargstseptendtfiletargtl_argstn_stmt((s//usr/lib64/python2.7/lib2to3/fixes/fix_print.pyt transform%s8  %  % $ " "  cCsrd|_tj|jjt|tjtjd|f}|ra|j t d|_n|j |dS(Nuu=u ( R RtNodetsymstargumentRRRtEQUALtappendR(Rtl_nodests_kwdtn_exprt n_argument((s//usr/lib64/python2.7/lib2to3/fixes/fix_print.pyRMs    (t__name__t __module__tTruet BM_compatibletPATTERNR$R(((s//usr/lib64/python2.7/lib2to3/fixes/fix_print.pyR s (N(t__doc__tRRtpgen2RRt fixer_utilRRRRRtcompile_patternRtBaseFixR (((s//usr/lib64/python2.7/lib2to3/fixes/fix_print.pyts( PK81]s<<fix_isinstance.pycnu[ {fc@sCdZddlmZddlmZdejfdYZdS(s,Fixer that cleans up a tuple argument to isinstance after the tokens in it were fixed. This is mainly used to remove double occurrences of tokens as a leftover of the long -> int / unicode -> str conversion. eg. isinstance(x, (int, long)) -> isinstance(x, (int, int)) -> isinstance(x, int) i(t fixer_base(ttokent FixIsinstancecBs#eZeZdZdZdZRS(s power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > ic CsUt}|d}|j}g}t|}x|D]\}} | jtjkr| j|kr|t|dkr||djtjkr|j q5qq5|j | | jtjkr5|j | jq5q5W|r|djtjkr|d=nt|dkr@|j } | j |d_ | j|dn||(|jdS(Ntargsiii(tsettchildrent enumeratettypeRtNAMEtvaluetlentCOMMAtnexttappendtaddtparenttprefixtreplacetchanged( tselftnodetresultstnames_insertedttestlistRtnew_argstiteratortidxtargtatom((s4/usr/lib64/python2.7/lib2to3/fixes/fix_isinstance.pyt transforms*    !0     (t__name__t __module__tTruet BM_compatibletPATTERNt run_orderR(((s4/usr/lib64/python2.7/lib2to3/fixes/fix_isinstance.pyRsN(t__doc__tRt fixer_utilRtBaseFixR(((s4/usr/lib64/python2.7/lib2to3/fixes/fix_isinstance.pyt sPK81]k(Pzzfix_imports2.pycnu[ {fc@sGdZddlmZidd6dd6ZdejfdYZdS( sTFix incompatible imports and module references that must be fixed after fix_imports.i(t fix_importstdbmtwhichdbtanydbmt FixImports2cBseZdZeZRS(i(t__name__t __module__t run_ordertMAPPINGtmapping(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_imports2.pyR sN(t__doc__tRRt FixImportsR(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_imports2.pyts  PK81]sGћfix_getcwdu.pyonu[ {fc@sCdZddlmZddlmZdejfdYZdS(s1 Fixer that changes os.getcwdu() to os.getcwd(). i(t fixer_base(tNamet FixGetcwducBseZeZdZdZRS(sR power< 'os' trailer< dot='.' name='getcwdu' > any* > cCs*|d}|jtdd|jdS(Ntnameugetcwdtprefix(treplaceRR(tselftnodetresultsR((s1/usr/lib64/python2.7/lib2to3/fixes/fix_getcwdu.pyt transforms (t__name__t __module__tTruet BM_compatibletPATTERNR (((s1/usr/lib64/python2.7/lib2to3/fixes/fix_getcwdu.pyR sN(t__doc__tRt fixer_utilRtBaseFixR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_getcwdu.pytsPK81]v fix_map.pyonu[ {fc@sudZddlmZddlmZddlmZmZmZm Z ddl m Z dej fdYZdS( sFixer that changes map(F, ...) into list(map(F, ...)) unless there exists a 'from future_builtins import map' statement in the top-level namespace. As a special case, map(None, X) is changed into list(X). (This is necessary because the semantics are changed in this case -- the new map(None, X) is equivalent to [(x,) for x in X].) We avoid the transformation (except for the special case mentioned above) if the map() call is directly contained in iter(<>), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. NOTE: This is still not correct if the original code was depending on map(F, X, Y, ...) to go on until the longest argument is exhausted, substituting None for missing values -- like zip(), it now stops as soon as the shortest argument is exhausted. i(ttoken(t fixer_base(tNametCalltListComptin_special_context(tpython_symbolstFixMapcBs#eZeZdZdZdZRS(s map_none=power< 'map' trailer< '(' arglist< 'None' ',' arg=any [','] > ')' > > | map_lambda=power< 'map' trailer< '(' arglist< lambdef< 'lambda' (fp=NAME | vfpdef< '(' fp=NAME ')'> ) ':' xp=any > ',' it=any > ')' > > | power< 'map' trailer< '(' [arglist=any] ')' > > sfuture_builtins.mapcCs|j|rdS|jjtjkrh|j|d|j}d|_tt d|g}n d|krt |dj|dj|dj}nd|kr|d j}nd |kr4|d }|jtj kr4|j d jt jkr4|j d jd kr4|j|d dSnt|rDdS|j}d|_tt d|g}|j|_|S(NsYou should use a for loop hereuulistt map_lambdatxptfptittmap_nonetargtarglistitNonesjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequence(t should_skiptparentttypetsymst simple_stmttwarningtclonetprefixRRRRtchildrenRtNAMEtvalueRR(tselftnodetresultstnewtargs((s-/usr/lib64/python2.7/lib2to3/fixes/fix_map.pyt transform;s6           (t__name__t __module__tTruet BM_compatibletPATTERNtskip_onR (((s-/usr/lib64/python2.7/lib2to3/fixes/fix_map.pyRsN(t__doc__tpgen2RtRt fixer_utilRRRRtpygramRRtConditionalFixR(((s-/usr/lib64/python2.7/lib2to3/fixes/fix_map.pyts "PK81]sGћfix_getcwdu.pycnu[ {fc@sCdZddlmZddlmZdejfdYZdS(s1 Fixer that changes os.getcwdu() to os.getcwd(). i(t fixer_base(tNamet FixGetcwducBseZeZdZdZRS(sR power< 'os' trailer< dot='.' name='getcwdu' > any* > cCs*|d}|jtdd|jdS(Ntnameugetcwdtprefix(treplaceRR(tselftnodetresultsR((s1/usr/lib64/python2.7/lib2to3/fixes/fix_getcwdu.pyt transforms (t__name__t __module__tTruet BM_compatibletPATTERNR (((s1/usr/lib64/python2.7/lib2to3/fixes/fix_getcwdu.pyR sN(t__doc__tRt fixer_utilRtBaseFixR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_getcwdu.pytsPK81]u fix_next.pycnu[ {fc@sdZddlmZddlmZddlmZddlm Z m Z m Z dZ dej fdYZd Zd Zd Zd S( s.Fixer for it.next() -> next(it), per PEP 3114.i(ttoken(tpython_symbols(t fixer_base(tNametCallt find_bindings;Calls to builtin next() possibly shadowed by global bindingtFixNextcBs,eZeZdZdZdZdZRS(s power< base=any+ trailer< '.' attr='next' > trailer< '(' ')' > > | power< head=any+ trailer< '.' attr='next' > not trailer< '(' ')' > > | classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='next' parameters< '(' NAME ')' > any+ > any* > > | global=global_stmt< 'global' any* 'next' any* > tprecCsWtt|j||td|}|rJ|j|tt|_n t|_dS(Nunext( tsuperRt start_treeRtwarningt bind_warningtTruet shadowed_nexttFalse(tselfttreetfilenametn((s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyR $s  cCs|s t|jd}|jd}|jd}|r|jrg|jtdd|jqg|D]}|j^qn}d|d_|jttdd|j|n|rtdd|j}|j|n|rct|rM|d }d j g|D]}t |^qj d krI|j |t ndS|jtdn(d |kr|j |t t|_ndS( Ntbasetattrtnameu__next__tprefixuiunexttheadtu __builtin__tglobal(tAssertionErrortgetR treplaceRRtcloneRtis_assign_targettjointstrtstripR R R (RtnodetresultsRRRRR((s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyt transform.s.   (  4 (t__name__t __module__R t BM_compatibletPATTERNtorderR R$(((s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyRs  cCs]t|}|dkrtSx:|jD]/}|jtjkrBtSt||r&tSq&WtS(N( t find_assigntNoneRtchildrenttypeRtEQUALt is_subtreeR (R"tassigntchild((s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyRQs  cCsH|jtjkr|S|jtjks7|jdkr;dSt|jS(N(R-tsymst expr_stmtt simple_stmttparentR+R*(R"((s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyR*]s !cs-|krtStfd|jDS(Nc3s|]}t|VqdS(N(R/(t.0tc(R"(s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pys gs(R tanyR,(trootR"((R"s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyR/ds N(t__doc__tpgen2RtpygramRR2RRt fixer_utilRRRR tBaseFixRRR*R/(((s./usr/lib64/python2.7/lib2to3/fixes/fix_next.pyts@ PK81]6 fix_ne.pyonu[ {fc@sSdZddlmZddlmZddlmZdejfdYZdS(sFixer that turns <> into !=.i(tpytree(ttoken(t fixer_basetFixNecBs#eZejZdZdZRS(cCs |jdkS(Nu<>(tvalue(tselftnode((s,/usr/lib64/python2.7/lib2to3/fixes/fix_ne.pytmatchscCs"tjtjdd|j}|S(Nu!=tprefix(RtLeafRtNOTEQUALR(RRtresultstnew((s,/usr/lib64/python2.7/lib2to3/fixes/fix_ne.pyt transforms(t__name__t __module__RR t _accept_typeRR (((s,/usr/lib64/python2.7/lib2to3/fixes/fix_ne.pyR s  N(t__doc__tRtpgen2RRtBaseFixR(((s,/usr/lib64/python2.7/lib2to3/fixes/fix_ne.pytsPK81]ܾfix_xreadlines.pycnu[ {fc@sCdZddlmZddlmZdejfdYZdS(spFix "for x in f.xreadlines()" -> "for x in f". This fixer will also convert g(f.xreadlines) into g(f.__iter__).i(t fixer_base(tNamet FixXreadlinescBseZeZdZdZRS(s power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | power< any+ trailer< '.' no_call='xreadlines' > > cCsb|jd}|r4|jtdd|jn*|jg|dD]}|j^qEdS(Ntno_callu__iter__tprefixtcall(tgettreplaceRRtclone(tselftnodetresultsRtx((s4/usr/lib64/python2.7/lib2to3/fixes/fix_xreadlines.pyt transforms(t__name__t __module__tTruet BM_compatibletPATTERNR (((s4/usr/lib64/python2.7/lib2to3/fixes/fix_xreadlines.pyR sN(t__doc__tRt fixer_utilRtBaseFixR(((s4/usr/lib64/python2.7/lib2to3/fixes/fix_xreadlines.pytsPK81]J fix_types.pyonu[ {fc@s dZddlmZddlmZddlmZidd6dd6d d 6d d 6d d6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d d'6d(d)6d*d+6ZgeD]Zd,e^qZ d-ej fd.YZ d/S(0sFixer for removing uses of the types module. These work for only the known names in the types module. The forms above can include types. or not. ie, It is assumed the module is imported either as: import types from types import ... # either * or specific types The import statements are not modified. There should be another fixer that handles at least the following constants: type([]) -> list type(()) -> tuple type('') -> str i(ttoken(t fixer_base(tNametboolt BooleanTypet memoryviewt BufferTypettypet ClassTypetcomplext ComplexTypetdicttDictTypetDictionaryTypestype(Ellipsis)t EllipsisTypetfloatt FloatTypetinttIntTypetlisttListTypetLongTypetobjectt ObjectTypes type(None)tNoneTypestype(NotImplemented)tNotImplementedTypetslicet SliceTypetbytest StringTypes(str,)t StringTypesttuplet TupleTypetTypeTypetstrt UnicodeTypetranget XRangeTypes)power< 'types' trailer< '.' name='%s' > >tFixTypescBs&eZeZdjeZdZRS(t|cCs9ttj|dj}|r5t|d|jSdS(Ntnametprefix(tunicodet _TYPE_MAPPINGtgettvalueRR)tNone(tselftnodetresultst new_value((s//usr/lib64/python2.7/lib2to3/fixes/fix_types.pyt transform:s(t__name__t __module__tTruet BM_compatibletjoint_patstPATTERNR3(((s//usr/lib64/python2.7/lib2to3/fixes/fix_types.pyR&6sN( t__doc__tpgen2RtRt fixer_utilRR+ttR9tBaseFixR&(((s//usr/lib64/python2.7/lib2to3/fixes/fix_types.pyts6 PK81]Tv˒RRfix_tuple_params.pycnu[ {fc@sdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z dZ dejfdYZd Zd Zgd d Zd Zd S(s:Fixer for function definitions with tuple parameters. def func(((a, b), c), d): ... -> def func(x, d): ((a, b), c) = x ... It will also support lambdas: lambda (x, y): x + y -> lambda t: t[0] + t[1] # The parens are a syntax error in Python 3 lambda (x): x + y -> lambda x: x + y i(tpytree(ttoken(t fixer_base(tAssigntNametNewlinetNumbert SubscripttsymscCs)t|tjo(|jdjtjkS(Ni(t isinstanceRtNodetchildrenttypeRtSTRING(tstmt((s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyt is_docstringstFixTupleParamscBs,eZdZeZdZdZdZRS(is funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > c s0d|krj||Sg|d}|d}|djdjtjkryd}|djdj}tn!d}d}tjtjdt fd }|jt j kr||n`|jt j kr1xKt |jD]7\}} | jt j kr|| d |dkqqWns;dSxD]} |d| _qBW|} |dkr{d d_n1t|dj|r|d_|d} nxD]} |d| _qW|dj| | +x=t| d| tdD]}||dj|_qW|djdS( Ntlambdatsuitetargsiiiu; ucstj}|j}d|_t||j}|rNd|_n|j|jtjt j |jgdS(Nuu ( Rtnew_nametclonetprefixRtreplacetappendRR Rt simple_stmt(t tuple_argt add_prefixtntargR(tendt new_linestself(s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyt handle_tupleCs    Ru (ttransform_lambdaR R RtINDENTtvalueRRtLeaftFalseRttfpdeft typedargslistt enumeratetparentRRtrangetlentchanged( R tnodetresultsRRtstarttindentR!tiRtlinetafter((RRR s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyt transform.sF            (cCsN|d}|d}t|d}|jtjkr\|j}d|_|j|dSt|}t|}|j t |}t |dd} |j| jx|j D]} | jtjkr| j |krg|| j D]} | j^q} tjtj| jg| } | j| _| j| qqWdS(NRtbodytinneru R(t simplify_argsR RtNAMERRRt find_paramst map_to_indexRt tuple_nameRt post_orderR$RR Rtpower(R R.R/RR6R7tparamstto_indexttup_namet new_paramRtct subscriptstnew((s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyR"ns(       !&  (t__name__t __module__t run_ordertTruet BM_compatibletPATTERNR5R"(((s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyRs   @cCso|jtjtjfkr|S|jtjkr[x#|jtjkrV|jd}q4W|Std|dS(NisReceived unexpected node %s(R RtvfplistRR9tvfpdefR t RuntimeError(R.((s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyR8scCsn|jtjkr#t|jdS|jtjkr<|jSg|jD]$}|jtjkrFt|^qFS(Ni( R RRMR:R RR9R$tCOMMA(R.RC((s6/usr/lib64/python2.7/lib2to3/fixes/fix_tuple_params.pyR:s cCs|dkri}nxht|D]Z\}}ttt|g}t|trnt||d|q"||||s. l  PK81]m)ĥfix_reduce.pycnu[ {fc@sCdZddlmZddlmZdejfdYZdS(sqFixer for reduce(). Makes sure reduce() is imported from the functools module if reduce is used in that module. i(t fixer_base(t touch_importt FixReducecBs#eZeZdZdZdZRS(tpresi power< 'reduce' trailer< '(' arglist< ( (not(argument) any ',' not(argument > cCstdd|dS(Nu functoolsureduce(R(tselftnodetresults((s0/usr/lib64/python2.7/lib2to3/fixes/fix_reduce.pyt transform"s(t__name__t __module__tTruet BM_compatibletordertPATTERNR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_reduce.pyRsN(t__doc__tlib2to3Rtlib2to3.fixer_utilRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_reduce.pytsPK81]4  fix_apply.pyonu[ {fc@sodZddlmZddlmZddlmZddlmZmZm Z dej fdYZ dS( sIFixer for apply(). This converts apply(func, v, k) into (func)(*v, **k).i(tpytree(ttoken(t fixer_base(tCalltCommat parenthesizetFixApplycBseZeZdZdZRS(s. power< 'apply' trailer< '(' arglist< (not argument ')' > > c Cs|j}|d}|d}|jd}|r}|j|jjkrKdS|j|jjkr}|jdjdkr}dSn|r|j|jjkr|jdjdkrdS|j}|j}|jt j |j fkr|j|j ks |jdjt j krt|}nd|_|j}d|_|dk r^|j}d|_ntjt jd|g}|dk r|jttjt j d |gd |d_nt||d |S( Ntfunctargstkwdsis**itu*u**u tprefix(tsymstgetttypet star_exprtargumenttchildrentvalueR tcloneRtNAMEtatomtpowert DOUBLESTARRtNoneRtLeaftSTARtextendRR( tselftnodetresultsR RRR R t l_newargs((s//usr/lib64/python2.7/lib2to3/fixes/fix_apply.pyt transforms@              (t__name__t __module__tTruet BM_compatibletPATTERNR (((s//usr/lib64/python2.7/lib2to3/fixes/fix_apply.pyRsN( t__doc__R Rtpgen2RRt fixer_utilRRRtBaseFixR(((s//usr/lib64/python2.7/lib2to3/fixes/fix_apply.pyts PK81]_}<< fix_dict.pyonu[ {fc@sdZddlmZddlmZddlmZddlmZddlmZm Z m Z m Z m Z m Z ddlmZejedgBZd ejfd YZd S( sjFixer for dict methods. d.keys() -> list(d.keys()) d.items() -> list(d.items()) d.values() -> list(d.values()) d.iterkeys() -> iter(d.keys()) d.iteritems() -> iter(d.items()) d.itervalues() -> iter(d.values()) d.viewkeys() -> d.keys() d.viewitems() -> d.items() d.viewvalues() -> d.values() Except in certain very specific contexts: the iter() can be dropped when the context is list(), sorted(), iter() or for...in; the list() can be dropped when the context is list() or sorted() (but not iter() or for...in!). Special contexts that apply to both: list(), sorted(), tuple() set(), any(), all(), sum(). Note: iter(d.keys()) could be written as iter(d) but since the original d.iterkeys() was also redundant we don't fix this. And there are (rare) contexts where it makes a difference (e.g. when passing it as an argument to a function that introspects the argument). i(tpytree(tpatcomp(ttoken(t fixer_base(tNametCalltLParentRParentArgListtDot(t fixer_utiltitertFixDictcBsPeZeZdZdZdZejeZ dZ eje Z dZ RS(s power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues'| 'viewkeys'|'viewitems'|'viewvalues') > parens=trailer< '(' ')' > tail=any* > cCs|d}|dd}|d}|j}|j}|jd}|jd} |s^| rk|d}ng|D]} | j^qr}g|D]} | j^q}| o|j||} |tj|jtt |d|j g|d jg} tj|j | } | p!| sTd | _ t t |r?dnd | g} n|rytj|j | g|} n|j | _ | S( Ntheadtmethodittailuiteruviewitprefixtparensuulist( tsymstvaluet startswithtclonetin_special_contextRtNodettrailerR RRtpowerR(tselftnodetresultsR RRRt method_nametisitertisviewtntspecialtargstnew((s./usr/lib64/python2.7/lib2to3/fixes/fix_dict.pyt transform7s2         ' s3power< func=NAME trailer< '(' node=any ')' > any* >smfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > cCs|jdkrtSi}|jjdk r|jj|jj|r|d|kr|rm|djtkS|djtjkSn|stS|j j|j|o|d|kS(NRtfunc( tparenttNonetFalsetp1tmatchRt iter_exemptR tconsuming_callstp2(RRRR((s./usr/lib64/python2.7/lib2to3/fixes/fix_dict.pyR[s( t__name__t __module__tTruet BM_compatibletPATTERNR$tP1Rtcompile_patternR)tP2R-R(((s./usr/lib64/python2.7/lib2to3/fixes/fix_dict.pyR *s  N(t__doc__tRRtpgen2RRR RRRRRR R,tsetR+tBaseFixR (((s./usr/lib64/python2.7/lib2to3/fixes/fix_dict.pyts.PK81]k(Pzzfix_imports2.pyonu[ {fc@sGdZddlmZidd6dd6ZdejfdYZdS( sTFix incompatible imports and module references that must be fixed after fix_imports.i(t fix_importstdbmtwhichdbtanydbmt FixImports2cBseZdZeZRS(i(t__name__t __module__t run_ordertMAPPINGtmapping(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_imports2.pyR sN(t__doc__tRRt FixImportsR(((s2/usr/lib64/python2.7/lib2to3/fixes/fix_imports2.pyts  PK81] `pww fix_exec.pyonu[ {fc@s_dZddlmZddlmZddlmZmZmZdejfdYZ dS(sFixer for exec. This converts usages of the exec statement into calls to a built-in exec() function. exec code in ns1, ns2 -> exec(code, ns1, ns2) i(tpytree(t fixer_base(tCommatNametCalltFixExeccBseZeZdZdZRS(sx exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > | exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > cCs|j}|d}|jd}|jd}|jg}d|d_|dk rx|jt|jgn|dk r|jt|jgnttd|d|jS(Ntatbtctiuexectprefix( tsymstgettcloneR tNonetextendRRR(tselftnodetresultsR RRRtargs((s./usr/lib64/python2.7/lib2to3/fixes/fix_exec.pyt transforms     (t__name__t __module__tTruet BM_compatibletPATTERNR(((s./usr/lib64/python2.7/lib2to3/fixes/fix_exec.pyRsN( t__doc__R RRt fixer_utilRRRtBaseFixR(((s./usr/lib64/python2.7/lib2to3/fixes/fix_exec.pyt sPK81]m)ĥfix_reduce.pyonu[ {fc@sCdZddlmZddlmZdejfdYZdS(sqFixer for reduce(). Makes sure reduce() is imported from the functools module if reduce is used in that module. i(t fixer_base(t touch_importt FixReducecBs#eZeZdZdZdZRS(tpresi power< 'reduce' trailer< '(' arglist< ( (not(argument) any ',' not(argument > cCstdd|dS(Nu functoolsureduce(R(tselftnodetresults((s0/usr/lib64/python2.7/lib2to3/fixes/fix_reduce.pyt transform"s(t__name__t __module__tTruet BM_compatibletordertPATTERNR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_reduce.pyRsN(t__doc__tlib2to3Rtlib2to3.fixer_utilRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_reduce.pytsPK81]xWfix_intern.pyonu[ {fc@s_dZddlmZddlmZddlmZmZmZdejfdYZ dS(s/Fixer for intern(). intern(s) -> sys.intern(s)i(tpytree(t fixer_base(tNametAttrt touch_importt FixInterncBs#eZeZdZdZdZRS(tpres power< 'intern' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > c Cso|rd|d}|rd|j|jjkr/dS|j|jjkra|jdjdkradSqdn|j}|dj}|j|jkr|j}ntj |j|jg}|d}|rg|D]}|j^q}ntj |j t t dt dtj |j |dj||djgg|}|j|_tdd||S( Ntobjis**tafterusysuinterntlpartrpar(ttypetsymst star_exprtargumenttchildrentvaluetclonetarglistRtNodetpowerRRttrailertprefixRtNone( tselftnodetresultsRR t newarglistRtntnew((s0/usr/lib64/python2.7/lib2to3/fixes/fix_intern.pyt transforms*    " U (t__name__t __module__tTruet BM_compatibletordertPATTERNR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_intern.pyRs N( t__doc__tRRt fixer_utilRRRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_intern.pytsPK81]1Wlfix_sys_exc.pycnu[ {fc@sgdZddlmZddlmZmZmZmZmZm Z m Z dej fdYZ dS(sFixer for sys.exc_{type, value, traceback} sys.exc_type -> sys.exc_info()[0] sys.exc_value -> sys.exc_info()[1] sys.exc_traceback -> sys.exc_info()[2] i(t fixer_base(tAttrtCalltNametNumbert SubscripttNodetsymst FixSysExccBsCeZdddgZeZddjdeDZdZRS(uexc_typeu exc_valueu exc_tracebacksN power< 'sys' trailer< dot='.' attribute=(%s) > > t|ccs|]}d|VqdS(s'%s'N((t.0te((s1/usr/lib64/python2.7/lib2to3/fixes/fix_sys_exc.pys scCs|dd}t|jj|j}ttdd|j}ttd|}|dj|djd_|j t |t t j |d|jS(Nt attributeiuexc_infotprefixusystdoti(Rtexc_infotindextvalueRRR RtchildrentappendRRRtpower(tselftnodetresultstsys_attrRtcalltattr((s1/usr/lib64/python2.7/lib2to3/fixes/fix_sys_exc.pyt transforms(t__name__t __module__RtTruet BM_compatibletjointPATTERNR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_sys_exc.pyRsN( t__doc__tRt fixer_utilRRRRRRRtBaseFixR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_sys_exc.pyts4PK81]J fix_types.pycnu[ {fc@s dZddlmZddlmZddlmZidd6dd6d d 6d d 6d d6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d d'6d(d)6d*d+6ZgeD]Zd,e^qZ d-ej fd.YZ d/S(0sFixer for removing uses of the types module. These work for only the known names in the types module. The forms above can include types. or not. ie, It is assumed the module is imported either as: import types from types import ... # either * or specific types The import statements are not modified. There should be another fixer that handles at least the following constants: type([]) -> list type(()) -> tuple type('') -> str i(ttoken(t fixer_base(tNametboolt BooleanTypet memoryviewt BufferTypettypet ClassTypetcomplext ComplexTypetdicttDictTypetDictionaryTypestype(Ellipsis)t EllipsisTypetfloatt FloatTypetinttIntTypetlisttListTypetLongTypetobjectt ObjectTypes type(None)tNoneTypestype(NotImplemented)tNotImplementedTypetslicet SliceTypetbytest StringTypes(str,)t StringTypesttuplet TupleTypetTypeTypetstrt UnicodeTypetranget XRangeTypes)power< 'types' trailer< '.' name='%s' > >tFixTypescBs&eZeZdjeZdZRS(t|cCs9ttj|dj}|r5t|d|jSdS(Ntnametprefix(tunicodet _TYPE_MAPPINGtgettvalueRR)tNone(tselftnodetresultst new_value((s//usr/lib64/python2.7/lib2to3/fixes/fix_types.pyt transform:s(t__name__t __module__tTruet BM_compatibletjoint_patstPATTERNR3(((s//usr/lib64/python2.7/lib2to3/fixes/fix_types.pyR&6sN( t__doc__tpgen2RtRt fixer_utilRR+ttR9tBaseFixR&(((s//usr/lib64/python2.7/lib2to3/fixes/fix_types.pyts6 PK81]}ׄLLfix_nonzero.pyonu[ {fc@sIdZddlmZddlmZmZdejfdYZdS(s*Fixer for __nonzero__ -> __bool__ methods.i(t fixer_base(tNametsymst FixNonzerocBseZeZdZdZRS(s classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='__nonzero__' parameters< '(' NAME ')' > any+ > any* > > cCs0|d}tdd|j}|j|dS(Ntnameu__bool__tprefix(RRtreplace(tselftnodetresultsRtnew((s1/usr/lib64/python2.7/lib2to3/fixes/fix_nonzero.pyt transforms (t__name__t __module__tTruet BM_compatibletPATTERNR (((s1/usr/lib64/python2.7/lib2to3/fixes/fix_nonzero.pyRsN(t__doc__tRt fixer_utilRRtBaseFixR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_nonzero.pytsPK81]RRfix_numliterals.pyonu[ {fc@sSdZddlmZddlmZddlmZdejfdYZdS(s-Fixer that turns 1L into 1, 0755 into 0o755. i(ttoken(t fixer_base(tNumbertFixNumliteralscBs#eZejZdZdZRS(cCs#|jjdp"|jddkS(Nu0iuLl(tvaluet startswith(tselftnode((s5/usr/lib64/python2.7/lib2to3/fixes/fix_numliterals.pytmatchscCs}|j}|ddkr&|d }nD|jdrj|jrjtt|dkrjd|d}nt|d|jS(NiuLlu0iu0otprefix(RRtisdigittlentsetRR (RRtresultstval((s5/usr/lib64/python2.7/lib2to3/fixes/fix_numliterals.pyt transforms   3(t__name__t __module__RtNUMBERt _accept_typeRR(((s5/usr/lib64/python2.7/lib2to3/fixes/fix_numliterals.pyR s  N( t__doc__tpgen2RtRt fixer_utilRtBaseFixR(((s5/usr/lib64/python2.7/lib2to3/fixes/fix_numliterals.pytsPK81]~&fix_urllib.pyonu[ {fc@ssdZddlmZmZddlmZddlmZmZm Z m Z m Z m Z m Z iddddd d d d d gfddddddddddddddddgfddgfgd 6dd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7gfdd8d9gfgd:6Zed:jed d;d<Zd=efd>YZd?S(@sFix changes imports of urllib which are now incompatible. This is rather similar to fix_imports, but because of the more complex nature of the fixing for urllib, it has its own fixer. i(t alternatest FixImports(t fixer_base(tNametCommat FromImporttNewlinetfind_indentationtNodetsymssurllib.requestt URLopenertFancyURLopenert urlretrievet _urlopenerturlopent urlcleanupt pathname2urlt url2pathnames urllib.parsetquotet quote_plustunquotet unquote_plust urlencodet splitattrt splithostt splitnportt splitpasswdt splitportt splitquerytsplittagt splittypet splitusert splitvalues urllib.errortContentTooShortErrorturllibtinstall_openert build_openertRequesttOpenerDirectort BaseHandlertHTTPDefaultErrorHandlertHTTPRedirectHandlertHTTPCookieProcessort ProxyHandlertHTTPPasswordMgrtHTTPPasswordMgrWithDefaultRealmtAbstractBasicAuthHandlertHTTPBasicAuthHandlertProxyBasicAuthHandlertAbstractDigestAuthHandlertHTTPDigestAuthHandlertProxyDigestAuthHandlert HTTPHandlert HTTPSHandlert FileHandlert FTPHandlertCacheFTPHandlertUnknownHandlertURLErrort HTTPErrorturllib2iccst}xtjD]w\}}xh|D]`}|\}}t|}d||fVd|||fVd|Vd|Vd||fVq)WqWdS(Nsimport_name< 'import' (module=%r | dotted_as_names< any* module=%r any* >) > simport_from< 'from' mod_member=%r 'import' ( member=%s | import_as_name< member=%s 'as' any > | import_as_names< members=any* >) > sIimport_from< 'from' module_star=%r 'import' star='*' > stimport_name< 'import' dotted_as_name< module_as=%r 'as' any > > sKpower< bare_with_attr=%r trailer< '.' member=%s > any* > (tsettMAPPINGtitemsR(tbaret old_moduletchangestchanget new_moduletmembers((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyt build_pattern1s      t FixUrllibcBs5eZdZdZdZdZdZRS(cCsdjtS(Nt|(tjoinRF(tself((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyRFJscCs|jd}|j}g}x?t|jd D],}|jt|dd|tgq0W|jtt|jddd||j|dS(sTransform for the basic import case. Replaces the old import name with a comma separated list of its replacements. tmoduleiitprefixN( tgetRLR>tvaluetextendRRtappendtreplace(RJtnodetresultst import_modtpreftnamestname((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyttransform_importMs *(cCs|jd}|j}|jd}|rt|trI|d}nd }x6t|jD]'}|j|dkr]|d}Pq]q]W|r|jt|d|q|j |dn/g}i} |d} x| D]}|j t j kr|j dj} |j dj} n|j} d } | d krxlt|jD]Z}| |dkr>|d| krx|j|dn| j|dgj|q>q>WqqWg} t|}t}d }x|D]}| |}g}x8|d D],}|j||||jtqW|j||d |t||}| sa|jjj|rm||_n| j|t}qW| rg}x(| d D]}|j|tgqW|j| d |j|n|j |d d S(sTransform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module. t mod_membertmemberiiRLs!This is an invalid module elementREiu,cSsz|jtjkrdt|jdjd||jdj|jdjg}ttj|gSt|jd|gS(NiRLii(ttypeR timport_as_nameRtchildrenRNtcloneR(RWRLtkids((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyt handle_names isAll module elements are invalidN(RMRLt isinstancetlisttNoneR>RNRQRtcannot_convertR[R R\R]RPt setdefaultRtTrueRORRtparenttendswithtFalseR(RJRRRSRYRURZtnew_nameRCtmodulestmod_dictREtas_namet member_namet new_nodest indentationtfirstR`RKteltsRVtelttnewtnodestnew_node((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyttransform_member]sh       +       cCs|jd}|jd}d}t|tr@|d}nx6t|jD]'}|j|dkrN|d}PqNqNW|r|jt|d|jn|j |ddS(s.Transform for calls to module members in code.tbare_with_attrRZiiRLs!This is an invalid module elementN( RMRcRaRbR>RNRQRRLRd(RJRRRSt module_dotRZRjRC((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyt transform_dots  cCs|jdr"|j||n|jdrD|j||nf|jdrf|j||nD|jdr|j|dn"|jdr|j|dndS(NRKRYRxt module_starsCannot handle star imports.t module_ass#This module is now multiple modules(RMRXRwRzRd(RJRRRS((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyt transforms(t__name__t __module__RFRXRwRzR}(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pyRGHs    L N(t__doc__tlib2to3.fixes.fix_importsRRtlib2to3Rtlib2to3.fixer_utilRRRRRRR R>RPRFRG(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_urllib.pytsD4           PK81] fix_throw.pycnu[ {fc@s{dZddlmZddlmZddlmZddlmZmZm Z m Z m Z dej fdYZ dS( sFixer for generator.throw(E, V, T). g.throw(E) -> g.throw(E) g.throw(E, V) -> g.throw(E(V)) g.throw(E, V, T) -> g.throw(E(V).with_traceback(T)) g.throw("foo"[, V[, T]]) will warn about string exceptions.i(tpytree(ttoken(t fixer_base(tNametCalltArgListtAttrtis_tupletFixThrowcBseZeZdZdZRS(s power< any trailer< '.' 'throw' > trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > | power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > > c CsP|j}|dj}|jtjkr?|j|ddS|jd}|dkr^dS|j}t|rg|j dd!D]}|j^q}nd|_ |g}|d}d|kr6|dj} d| _ t ||} t | t d t| gg} |jtj|j| n|jt ||dS( Ntexcs+Python 3 does not support string exceptionsuvaliiutargsttbuwith_traceback(tsymstclonettypeRtSTRINGtcannot_converttgettNoneRtchildrentprefixRRRRtreplaceRtNodetpower( tselftnodetresultsR R tvaltcR t throw_argsR tetwith_tb((s//usr/lib64/python2.7/lib2to3/fixes/fix_throw.pyt transforms*    ,     %(t__name__t __module__tTruet BM_compatibletPATTERNR (((s//usr/lib64/python2.7/lib2to3/fixes/fix_throw.pyRsN(t__doc__tRtpgen2RRt fixer_utilRRRRRtBaseFixR(((s//usr/lib64/python2.7/lib2to3/fixes/fix_throw.pyts (PK81],b fix_raise.pycnu[ {fc@s{dZddlmZddlmZddlmZddlmZmZm Z m Z m Z dej fdYZ dS( s[Fixer for 'raise E, V, T' raise -> raise raise E -> raise E raise E, V -> raise E(V) raise E, V, T -> raise E(V).with_traceback(T) raise E, None, T -> raise E.with_traceback(T) raise (((E, E'), E''), E'''), V -> raise E(V) raise "foo", V, T -> warns about string exceptions CAVEATS: 1) "raise E, V" will be incorrectly translated if V is an exception instance. The correct Python 3 idiom is raise E from V but since we can't detect instance-hood by syntax alone and since any client code would have to be changed as well, we don't automate this. i(tpytree(ttoken(t fixer_base(tNametCalltAttrtArgListtis_tupletFixRaisecBseZeZdZdZRS(sB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > c Cs |j}|dj}|jtjkrEd}|j||dSt|rx*t|r}|jdjdj}qTWd|_nd|krt j |j t d|g}|j|_|S|dj}t|rg|jdd!D]}|j^q} nd |_|g} d |kr|d j} d | _|} |jtj ksm|jd krt|| } nt| t d t| gg} t j |jt dg| }|j|_|St j |j t dt|| gd |jSdS(Ntexcs+Python 3 does not support string exceptionsiiu tvaluraiseiuttbuNoneuwith_tracebacktprefix(tsymstclonettypeRtSTRINGtcannot_convertRtchildrenR RtNodet raise_stmtRtNAMEtvalueRRRt simple_stmt( tselftnodetresultsR R tmsgtnewR tctargsR tetwith_tb((s//usr/lib64/python2.7/lib2to3/fixes/fix_raise.pyt transform&s@    !  ,    !%"  (t__name__t __module__tTruet BM_compatibletPATTERNR!(((s//usr/lib64/python2.7/lib2to3/fixes/fix_raise.pyRsN(t__doc__tRtpgen2RRt fixer_utilRRRRRtBaseFixR(((s//usr/lib64/python2.7/lib2to3/fixes/fix_raise.pyts (PK81] fix_except.pycnu[ {fc@sdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z dZ dejfdYZd S( sFixer for except statements with named exceptions. The following cases will be converted: - "except E, T:" where T is a name: except E as T: - "except E, T:" where T is not a name, tuple or list: except E as t: T = t This is done because the target of an "except" clause must be a name. - "except E, T:" where T is a tuple or list literal: except E as t: T = t.args i(tpytree(ttoken(t fixer_base(tAssigntAttrtNametis_tupletis_listtsymsccsbx[t|D]M\}}|jtjkr |jdjdkrZ|||dfVqZq q WdS(Niuexcepti(t enumeratettypeRt except_clausetchildrentvalue(tnodestitn((s0/usr/lib64/python2.7/lib2to3/fixes/fix_except.pyt find_exceptsst FixExceptcBseZeZdZdZRS(s1 try_stmt< 'try' ':' (simple_stmt | suite) cleanup=(except_clause ':' (simple_stmt | suite))+ tail=(['except' ':' (simple_stmt | suite)] ['else' ':' (simple_stmt | suite)] ['finally' ':' (simple_stmt | suite)]) > cCs,|j}g|dD]}|j^q}g|dD]}|j^q7}xt|D]\}} t|jdkr\|jdd!\} } } | jtddd| jtj krt|j dd} | j}d|_ | j| | j} | j}x0t |D]"\}}t |tjrPqqWt| s[t| r|t|t| td }nt|| }x(t|| D]}| jd |qW| j||q| j dkrd| _ qq\q\Wg|jd D]}|j^q||}tj|j|S( Nttailtcleanupiiuastprefixu uuargsii(RtcloneRtlenR treplaceRR RtNAMEtnew_nameRR t isinstanceRtNodeRRRRtreversedt insert_child(tselftnodetresultsRRRtcht try_cleanupR te_suitetEtcommatNtnew_Nttargett suite_stmtsRtstmttassigntchildtcR ((s0/usr/lib64/python2.7/lib2to3/fixes/fix_except.pyt transform/s6 ##     !.(t__name__t __module__tTruet BM_compatibletPATTERNR/(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_except.pyR$sN(t__doc__tRtpgen2RRt fixer_utilRRRRRRRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_except.pyts . PK81]6zhhfix_funcattrs.pyonu[ {fc@sCdZddlmZddlmZdejfdYZdS(s3Fix function attribute names (f.func_x -> f.__x__).i(t fixer_base(tNamet FixFuncattrscBseZeZdZdZRS(s power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' | 'func_dict') > any* > cCs9|dd}|jtd|jdd|jdS(Ntattriu__%s__itprefix(treplaceRtvalueR(tselftnodetresultsR((s3/usr/lib64/python2.7/lib2to3/fixes/fix_funcattrs.pyt transforms(t__name__t __module__tTruet BM_compatibletPATTERNR (((s3/usr/lib64/python2.7/lib2to3/fixes/fix_funcattrs.pyR sN(t__doc__tRt fixer_utilRtBaseFixR(((s3/usr/lib64/python2.7/lib2to3/fixes/fix_funcattrs.pytsPK81]Rfix_imports.pycnu[ {fc@sdZddlmZddlmZmZi0dd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6dCdD6dCdE6dFdG6dHdI6dJdK6dLdM6dNdO6dPdQ6dPdR6dPdS6dTdU6dVdW6dVdX6dYdZ6d[d\6Zd]Zed^Zd_ej fd`YZ daS(bs/Fix incompatible imports and module references.i(t fixer_base(tNamet attr_chaintiotStringIOt cStringIOtpickletcPickletbuiltinst __builtin__tcopyregtcopy_regtqueuetQueuet socketservert SocketServert configparsert ConfigParsertreprlibtreprstkinter.filedialogt FileDialogt tkFileDialogstkinter.simpledialogt SimpleDialogttkSimpleDialogstkinter.colorchooserttkColorChooserstkinter.commondialogttkCommonDialogstkinter.dialogtDialogs tkinter.dndtTkdnds tkinter.fontttkFontstkinter.messageboxt tkMessageBoxstkinter.scrolledtextt ScrolledTextstkinter.constantst Tkconstantss tkinter.tixtTixs tkinter.ttktttkttkintertTkintert _markupbaset markupbasetwinregt_winregt_threadtthreadt _dummy_threadt dummy_threadsdbm.bsdtdbhashsdbm.dumbtdumbdbmsdbm.ndbmtdbmsdbm.gnutgdbms xmlrpc.clientt xmlrpclibs xmlrpc.servertDocXMLRPCServertSimpleXMLRPCServers http.clientthttplibs html.entitiesthtmlentitydefss html.parsert HTMLParsers http.cookiestCookieshttp.cookiejart cookielibs http.servertBaseHTTPServertSimpleHTTPServert CGIHTTPServert subprocesstcommandst collectionst UserStringtUserLists urllib.parseturlparsesurllib.robotparsert robotparsercCsddjtt|dS(Nt(t|t)(tjointmapR(tmembers((s1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pyt alternates=sccsldjg|D]}d|^q }t|j}d||fVd|Vd||fVd|VdS(Ns | smodule_name='%s'syname_import=import_name< 'import' ((%s) | multiple_imports=dotted_as_names< any* (%s) any* >) > simport_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > simport_name< 'import' (dotted_as_name< (%s) 'as' any > | multiple_imports=dotted_as_names< any* dotted_as_name< (%s) 'as' any > any* >) > s3power< bare_with_attr=(%s) trailer<'.' any > any* >(RERHtkeys(tmappingtkeytmod_listt bare_names((s1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pyt build_patternAs & t FixImportscBsMeZeZeZeZdZdZdZ dZ dZ dZ RS(icCsdjt|jS(NRC(RERNRJ(tself((s1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pyRN`scCs&|j|_tt|jdS(N(RNtPATTERNtsuperROtcompile_pattern(RP((s1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pyRScscsatt|j|}|r]d|krYtfdt|dDrYtS|StS(Ntbare_with_attrc3s|]}|VqdS(N((t.0tobj(tmatch(s1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pys qstparent(RRRORWtanyRtFalse(RPtnodetresults((RWs1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pyRWjs  %cCs&tt|j||i|_dS(N(RRROt start_treetreplace(RPttreetfilename((s1/usr/lib64/python2.7/lib2to3/fixes/fix_imports.pyR]vscCs|jd}|r|j}t|j|}|jt|d|jd|kri||j|sj    PK81]0|| fix_input.pycnu[ {fc@shdZddlmZddlmZmZddlmZejdZdej fdYZ dS( s4Fixer that changes input(...) into eval(input(...)).i(t fixer_base(tCalltName(tpatcomps&power< 'eval' trailer< '(' any ')' > >tFixInputcBseZeZdZdZRS(sL power< 'input' args=trailer< '(' [any] ')' > > cCsMtj|jjrdS|j}d|_ttd|gd|jS(Nuuevaltprefix(tcontexttmatchtparenttcloneRRR(tselftnodetresultstnew((s//usr/lib64/python2.7/lib2to3/fixes/fix_input.pyt transforms   (t__name__t __module__tTruet BM_compatibletPATTERNR(((s//usr/lib64/python2.7/lib2to3/fixes/fix_input.pyR sN( t__doc__tRt fixer_utilRRRtcompile_patternRtBaseFixR(((s//usr/lib64/python2.7/lib2to3/fixes/fix_input.pyts PK81]6zhhfix_funcattrs.pycnu[ {fc@sCdZddlmZddlmZdejfdYZdS(s3Fix function attribute names (f.func_x -> f.__x__).i(t fixer_base(tNamet FixFuncattrscBseZeZdZdZRS(s power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' | 'func_dict') > any* > cCs9|dd}|jtd|jdd|jdS(Ntattriu__%s__itprefix(treplaceRtvalueR(tselftnodetresultsR((s3/usr/lib64/python2.7/lib2to3/fixes/fix_funcattrs.pyt transforms(t__name__t __module__tTruet BM_compatibletPATTERNR (((s3/usr/lib64/python2.7/lib2to3/fixes/fix_funcattrs.pyR sN(t__doc__tRt fixer_utilRtBaseFixR(((s3/usr/lib64/python2.7/lib2to3/fixes/fix_funcattrs.pytsPK81]\fix_unicode.pyonu[ {fc@sWdZddlmZddlmZidd6dd6Zdejfd YZd S( sFixer for unicode. * Changes unicode to str and unichr to chr. * If "...\u..." is not unicode literal change it into "...\\u...". * Change u"..." into "...". i(ttoken(t fixer_baseuchruunichrustruunicodet FixUnicodecBs&eZeZdZdZdZRS(sSTRING | 'unicode' | 'unichr'cCs/tt|j||d|jk|_dS(Ntunicode_literals(tsuperRt start_treetfuture_featuresR(tselfttreetfilename((s1/usr/lib64/python2.7/lib2to3/fixes/fix_unicode.pyRscCs|jtjkr2|j}t|j|_|S|jtjkr|j}|j r|ddkrd|krdjg|j dD]$}|j ddj dd^q}n|dd kr|d }n||jkr|S|j}||_|SdS( Niu'"u\u\\u\uu\\uu\Uu\\UuuUi( ttypeRtNAMEtclonet_mappingtvaluetSTRINGRtjointsplittreplace(Rtnodetresultstnewtvaltv((s1/usr/lib64/python2.7/lib2to3/fixes/fix_unicode.pyt transforms"  &=   (t__name__t __module__tTruet BM_compatibletPATTERNRR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_unicode.pyRs N(t__doc__tpgen2RtRR tBaseFixR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_unicode.pyt sPK81]xWfix_intern.pycnu[ {fc@s_dZddlmZddlmZddlmZmZmZdejfdYZ dS(s/Fixer for intern(). intern(s) -> sys.intern(s)i(tpytree(t fixer_base(tNametAttrt touch_importt FixInterncBs#eZeZdZdZdZRS(tpres power< 'intern' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > c Cso|rd|d}|rd|j|jjkr/dS|j|jjkra|jdjdkradSqdn|j}|dj}|j|jkr|j}ntj |j|jg}|d}|rg|D]}|j^q}ntj |j t t dt dtj |j |dj||djgg|}|j|_tdd||S( Ntobjis**tafterusysuinterntlpartrpar(ttypetsymst star_exprtargumenttchildrentvaluetclonetarglistRtNodetpowerRRttrailertprefixRtNone( tselftnodetresultsRR t newarglistRtntnew((s0/usr/lib64/python2.7/lib2to3/fixes/fix_intern.pyt transforms*    " U (t__name__t __module__tTruet BM_compatibletordertPATTERNR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_intern.pyRs N( t__doc__tRRt fixer_utilRRRtBaseFixR(((s0/usr/lib64/python2.7/lib2to3/fixes/fix_intern.pytsPK81]-$$ fix_apply.pycnu[ {fc@sodZddlmZddlmZddlmZddlmZmZm Z dej fdYZ dS( sIFixer for apply(). This converts apply(func, v, k) into (func)(*v, **k).i(tpytree(ttoken(t fixer_base(tCalltCommat parenthesizetFixApplycBseZeZdZdZRS(s. power< 'apply' trailer< '(' arglist< (not argument ')' > > c Cs|j}|st|d}|d}|jd}|r|j|jjkrWdS|j|jjkr|jdjdkrdSn|r|j|jjkr|jdjdkrdS|j}|j }|jt j |j fkr(|j|j ks|jdjt jkr(t|}nd|_|j }d|_|dk rj|j }d|_ntjt jd|g}|dk r|jttjt jd |gd |d_nt||d |S( Ntfunctargstkwdsis**itu*u**u tprefix(tsymstAssertionErrortgetttypet star_exprtargumenttchildrentvalueR tcloneRtNAMEtatomtpowert DOUBLESTARRtNoneRtLeaftSTARtextendRR( tselftnodetresultsR RRR R t l_newargs((s//usr/lib64/python2.7/lib2to3/fixes/fix_apply.pyt transformsB               (t__name__t __module__tTruet BM_compatibletPATTERNR!(((s//usr/lib64/python2.7/lib2to3/fixes/fix_apply.pyRsN( t__doc__R Rtpgen2RRt fixer_utilRRRtBaseFixR(((s//usr/lib64/python2.7/lib2to3/fixes/fix_apply.pyts PK81]V%e~ ~ fix_has_key.pycnu[ {fc@sidZddlmZddlmZddlmZddlmZmZdej fdYZ dS( s&Fixer for has_key(). Calls to .has_key() methods are expressed in terms of the 'in' operator: d.has_key(k) -> k in d CAVEATS: 1) While the primary target of this fixer is dict.has_key(), the fixer will change any has_key() method call, regardless of its class. 2) Cases like this will not be converted: m = d.has_key if m(k): ... Only *calls* to has_key() are converted. While it is possible to convert the above to something like m = d.__contains__ if m(k): ... this is currently not done. i(tpytree(ttoken(t fixer_base(tNamet parenthesizet FixHasKeycBseZeZdZdZRS(s anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > after=any* > | negation=not_test< 'not' anchor=power< before=any+ trailer< '.' 'has_key' > trailer< '(' ( not(arglist | argument) arg=any ','> ) ')' > > > c CsU|s t|j}|jj|jkrC|jj|jrCdS|jd}|d}|j }g|dD]}|j ^qp}|dj } |jd} | rg| D]}|j ^q} n| j|j |j|j |j |j|j|jfkrt| } nt|dkr6|d}ntj|j|}d|_ td d d} |rtd d d} tj|j| | f} ntj|j | | |f} | rt| } tj|j| ft| } n|jj|j |j|j|j|j|j|j|j|jf krHt| } n|| _ | S( Ntnegationtanchortbeforetargtafteriiu uintprefixunot( tAssertionErrortsymstparentttypetnot_testtpatterntmatchtNonetgetR tclonet comparisontand_testtor_testttesttlambdeftargumentRtlenRtNodetpowerRtcomp_opttupletexprtxor_exprtand_exprt shift_exprt arith_exprttermtfactor(tselftnodetresultsR RRR tnRR R tn_optn_nottnew((s1/usr/lib64/python2.7/lib2to3/fixes/fix_has_key.pyt transformHsF    #"!   %   (t__name__t __module__tTruet BM_compatibletPATTERNR/(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_has_key.pyR'sN( t__doc__tRtpgen2RRt fixer_utilRRtBaseFixR(((s1/usr/lib64/python2.7/lib2to3/fixes/fix_has_key.pyts PK51]4'fix_execfile.pynu[PK51](%N  Gfix_except.pynu[PK51]Y1 1 fix_print.pynu[PK51]gM !fix_xreadlines.pynu[PK51]ɣ9gg#fix_methodattrs.pynu[PK51]W&fix_getcwdu.pynu[PK51]=(fix_asserts.pynu[PK51]\ ,fix_import.pynu[PK51] 9fix_urllib.pynu[PK51] JJ Zfix_intern.pynu[PK51]:?PVV;bfix_nonzero.pynu[PK51]QAff dfix_repr.pynu[PK51]ˈ pgfix_zip.pynu[PK51]锪2kfix_renames.pynu[PK51]P..tfix_itertools_imports.pynu[PK51]Yω |fix_has_key.pynu[PK51]RJ,ifix_raw_input.pynu[PK51]}VGG pfix_reduce.pynu[PK51]@Zw fix_idioms.pynu[PK51] Jfix_unicode.pynu[PK51]I4  }fix_metaclass.pynu[PK51]Bfix_funcattrs.pynu[PK51]o ^v v fix_raise.pynu[PK51]'q/L__pycache__/fix_isinstance.cpython-36.opt-2.pycnu[PK51]*n__pycache__/fix_throw.cpython-36.opt-2.pycnu[PK51]8ڒ'__pycache__/fix_ne.cpython-36.opt-1.pycnu[PK51]YY*?__pycache__/fix_paren.cpython-36.opt-1.pycnu[PK51]#0__pycache__/fix_numliterals.cpython-36.opt-1.pycnu[PK51]نuu%B__pycache__/fix_intern.cpython-36.pycnu[PK51]{4, __pycache__/fix_nonzero.cpython-36.opt-1.pycnu[PK51]Bp  )__pycache__/fix_dict.cpython-36.opt-2.pycnu[PK51]+c__pycache__/fix_buffer.cpython-36.opt-1.pycnu[PK51]>fhh#__pycache__/fix_exec.cpython-36.pycnu[PK51]6H770 __pycache__/fix_set_literal.cpython-36.opt-2.pycnu[PK51] OO%#__pycache__/fix_urllib.cpython-36.pycnu[PK51] UU%'__pycache__/fix_reduce.cpython-36.pycnu[PK51]tu55+q,__pycache__/fix_reload.cpython-36.opt-2.pycnu[PK51] 'O!(1__pycache__/fix_funcattrs.cpython-36.pycnu[PK51]Ndd,5__pycache__/fix_sys_exc.cpython-36.opt-1.pycnu[PK51]]fEE*:__pycache__/fix_raise.cpython-36.opt-2.pycnu[PK51] ~aNN-qA__pycache__/fix_ws_comma.cpython-36.opt-1.pycnu[PK51]D.?440F__pycache__/fix_itertools_imports.cpython-36.pycnu[PK51]Ѐ,L__pycache__/fix_standarderror.cpython-36.pycnu[PK51] ~aNN'O__pycache__/fix_ws_comma.cpython-36.pycnu[PK51]sLUU/lT__pycache__/fix_basestring.cpython-36.opt-2.pycnu[PK51]؈]]. W__pycache__/fix_metaclass.cpython-36.opt-2.pycnu[PK51]&"6f__pycache__/fix_itertools_imports.cpython-36.opt-2.pycnu[PK51]Yٜxx'l__pycache__/fix_operator.cpython-36.pycnu[PK51]7'}__pycache__/fix_ne.cpython-36.opt-2.pycnu[PK51]j& __pycache__/fix_unicode.cpython-36.pycnu[PK51]Xz.(R__pycache__/fix_map.cpython-36.opt-2.pycnu[PK51]Cpb$__pycache__/fix_raise.cpython-36.pycnu[PK51]^(__pycache__/fix_metaclass.cpython-36.pycnu[PK51]Qv )ٮ__pycache__/fix_next.cpython-36.opt-2.pycnu[PK51]O +__pycache__/fix_xrange.cpython-36.opt-1.pycnu[PK51]Ѐ2__pycache__/fix_standarderror.cpython-36.opt-1.pycnu[PK51]:\NN)__pycache__/fix_exec.cpython-36.opt-1.pycnu[PK51]Zļ*__pycache__/fix_apply.cpython-36.opt-2.pycnu[PK51]̻$__pycache__/fix_apply.cpython-36.pycnu[PK51]폏)__pycache__/__init__.cpython-36.opt-1.pycnu[PK51](__pycache__/fix_raw_input.cpython-36.pycnu[PK51]?dd,6__pycache__/fix_renames.cpython-36.opt-2.pycnu[PK51]!i +__pycache__/fix_idioms.cpython-36.opt-2.pycnu[PK51]U-?__pycache__/fix_exitfunc.cpython-36.opt-2.pycnu[PK51]Ⱥ&7__pycache__/fix_asserts.cpython-36.pycnu[PK51]"^%$q__pycache__/fix_throw.cpython-36.pycnu[PK51]K(__pycache__/fix_itertools.cpython-36.pycnu[PK51]o>+__pycache__/fix_idioms.cpython-36.opt-1.pycnu[PK51]ȽHH/H__pycache__/fix_xreadlines.cpython-36.opt-1.pycnu[PK51]+8nL +"__pycache__/fix_import.cpython-36.opt-2.pycnu[PK51]6#3ll),__pycache__/fix_long.cpython-36.opt-2.pycnu[PK51]نuu+/__pycache__/fix_intern.cpython-36.opt-1.pycnu[PK51]ȽHH)y4__pycache__/fix_xreadlines.cpython-36.pycnu[PK51]qXF&9__pycache__/fix_renames.cpython-36.pycnu[PK51]/Za)$A__pycache__/fix_repr.cpython-36.opt-2.pycnu[PK51]9ss*uD__pycache__/fix_apply.cpython-36.opt-1.pycnu[PK51]l5 5 ,BK__pycache__/fix_has_key.cpython-36.opt-1.pycnu[PK51]^\.V__pycache__/fix_raw_input.cpython-36.opt-2.pycnu[PK51]rD*Y__pycache__/fix_methodattrs.cpython-36.pycnu[PK51]> %]__pycache__/fix_future.cpython-36.pycnu[PK51]&Fam,1a__pycache__/fix_getcwdu.cpython-36.opt-1.pycnu[PK51]Ȍ %d__pycache__/fix_import.cpython-36.pycnu[PK51]>GG0o__pycache__/fix_methodattrs.cpython-36.opt-2.pycnu[PK51]5ڍ_ "Ys__pycache__/fix_map.cpython-36.pycnu[PK51]T|1__pycache__/fix_tuple_params.cpython-36.opt-1.pycnu[PK51]#*__pycache__/fix_numliterals.cpython-36.pycnu[PK51]qXF,5__pycache__/fix_renames.cpython-36.opt-1.pycnu[PK51]T|+E__pycache__/fix_tuple_params.cpython-36.pycnu[PK51]*wGV*__pycache__/fix_print.cpython-36.opt-2.pycnu[PK51] W@'p__pycache__/fix_imports2.cpython-36.pycnu[PK51]g2.ֺ__pycache__/fix_itertools.cpython-36.opt-2.pycnu[PK51]k/*ɿ__pycache__/fix_types.cpython-36.opt-1.pycnu[PK51]8ڒ!3__pycache__/fix_ne.cpython-36.pycnu[PK51])__pycache__/fix_basestring.cpython-36.pycnu[PK51]C,q__pycache__/fix_sys_exc.cpython-36.opt-2.pycnu[PK51]8`0__pycache__/fix_set_literal.cpython-36.opt-1.pycnu[PK51]w"j__pycache__/fix_zip.cpython-36.pycnu[PK51]2__pycache__/fix_standarderror.cpython-36.opt-2.pycnu[PK51]{4&__pycache__/fix_nonzero.cpython-36.pycnu[PK51]4PXX+__pycache__/fix_filter.cpython-36.opt-2.pycnu[PK51]Yٜxx-J__pycache__/fix_operator.cpython-36.opt-1.pycnu[PK51] 'O!.__pycache__/fix_funcattrs.cpython-36.opt-1.pycnu[PK51]8`*6__pycache__/fix_set_literal.cpython-36.pycnu[PK51]ZO#/KK, __pycache__/fix_nonzero.cpython-36.opt-2.pycnu[PK51]3\\* __pycache__/fix_input.cpython-36.opt-2.pycnu[PK51]&Fam&o__pycache__/fix_getcwdu.cpython-36.pycnu[PK51]A uu%__pycache__/fix_reload.cpython-36.pycnu[PK51] OO+__pycache__/fix_urllib.cpython-36.opt-1.pycnu[PK51]Ⱥ,81__pycache__/fix_asserts.cpython-36.opt-1.pycnu[PK51].]55+x6__pycache__/fix_intern.cpython-36.opt-2.pycnu[PK51]Zq );__pycache__/fix_dict.cpython-36.opt-1.pycnu[PK51] W@-G__pycache__/fix_imports2.cpython-36.opt-1.pycnu[PK51]tҵ0,gJ__pycache__/fix_asserts.cpython-36.opt-2.pycnu[PK51]/aO__pycache__/fix_basestring.cpython-36.opt-1.pycnu[PK51]a;888#BR__pycache__/fix_repr.cpython-36.pycnu[PK51]y #U__pycache__/fix_next.cpython-36.pycnu[PK51]O %a__pycache__/fix_xrange.cpython-36.pycnu[PK51]A uu+)l__pycache__/fix_reload.cpython-36.opt-1.pycnu[PK51]R2P9+p__pycache__/fix_future.cpython-36.opt-2.pycnu[PK51]j,s__pycache__/fix_unicode.cpython-36.opt-1.pycnu[PK51]9z$6z__pycache__/fix_input.cpython-36.pycnu[PK51]rD0+~__pycache__/fix_methodattrs.cpython-36.opt-1.pycnu[PK51]Ndd&__pycache__/fix_sys_exc.cpython-36.pycnu[PK51].؇__pycache__/fix_raw_input.cpython-36.opt-1.pycnu[PK51]w2l.<__pycache__/fix_metaclass.cpython-36.opt-1.pycnu[PK51]G$ $ +\__pycache__/fix_filter.cpython-36.opt-1.pycnu[PK51]\<ֶ*۩__pycache__/fix_print.cpython-36.opt-1.pycnu[PK51]dL,__pycache__/fix_imports.cpython-36.opt-2.pycnu[PK51]C +__pycache__/fix_xrange.cpython-36.opt-2.pycnu[PK51]"*#__pycache__/fix_long.cpython-36.pycnu[PK51]YY$__pycache__/fix_paren.cpython-36.pycnu[PK51]9xx-__pycache__/fix_execfile.cpython-36.opt-1.pycnu[PK51]w(`__pycache__/fix_zip.cpython-36.opt-1.pycnu[PK51]a;888)__pycache__/fix_repr.cpython-36.opt-1.pycnu[PK51] UU+a__pycache__/fix_reduce.cpython-36.opt-1.pycnu[PK51] `+__pycache__/fix_reduce.cpython-36.opt-2.pycnu[PK51]:~(?__pycache__/fix_zip.cpython-36.opt-2.pycnu[PK51] )d__pycache__/fix_next.cpython-36.opt-1.pycnu[PK51]ݛuu.__pycache__/fix_funcattrs.cpython-36.opt-2.pycnu[PK51]a/S__pycache__/fix_isinstance.cpython-36.opt-1.pycnu[PK51].]  $ __pycache__/fix_print.cpython-36.pycnu[PK51]7N/__pycache__/fix_xreadlines.cpython-36.opt-2.pycnu[PK51]/Ii,4__pycache__/fix_getcwdu.cpython-36.opt-2.pycnu[PK51]^D:6M__pycache__/fix_itertools_imports.cpython-36.opt-1.pycnu[PK51]-"__pycache__/fix_operator.cpython-36.opt-2.pycnu[PK51]G**%1__pycache__/fix_idioms.cpython-36.pycnu[PK51]"^%*0A__pycache__/fix_throw.cpython-36.opt-1.pycnu[PK51]폏)H__pycache__/__init__.cpython-36.opt-2.pycnu[PK51]CyF*YI__pycache__/fix_paren.cpython-36.opt-2.pycnu[PK51]1N__pycache__/fix_tuple_params.cpython-36.opt-2.pycnu[PK51]I4'x___pycache__/fix_exitfunc.cpython-36.pycnu[PK51]a)h__pycache__/fix_isinstance.cpython-36.pycnu[PK51]G$ $ %o__pycache__/fix_filter.cpython-36.pycnu[PK51]E3'x__pycache__/fix_execfile.cpython-36.pycnu[PK51]a-r__pycache__/fix_ws_comma.cpython-36.opt-2.pycnu[PK51]> +c__pycache__/fix_future.cpython-36.opt-1.pycnu[PK51]Cpb*__pycache__/fix_raise.cpython-36.opt-1.pycnu[PK51]hRN)Ǐ__pycache__/fix_exec.cpython-36.opt-2.pycnu[PK51]+??,ȓ__pycache__/fix_unicode.cpython-36.opt-2.pycnu[PK51]~66*c__pycache__/fix_types.cpython-36.opt-2.pycnu[PK51]k/$__pycache__/fix_types.cpython-36.pycnu[PK51]Ȍ +W__pycache__/fix_import.cpython-36.opt-1.pycnu[PK51]N #__pycache__/fix_dict.cpython-36.pycnu[PK51]I4-ľ__pycache__/fix_exitfunc.cpython-36.opt-1.pycnu[PK51]k-O %__pycache__/fix_except.cpython-36.pycnu[PK51]K.F__pycache__/fix_itertools.cpython-36.opt-1.pycnu[PK51]5ڍ_ (__pycache__/fix_map.cpython-36.opt-1.pycnu[PK51]m2-__pycache__/fix_execfile.cpython-36.opt-2.pycnu[PK51]9z*N__pycache__/fix_input.cpython-36.opt-1.pycnu[PK51]"*)I__pycache__/fix_long.cpython-36.opt-1.pycnu[PK51]T0N__pycache__/fix_numliterals.cpython-36.opt-2.pycnu[PK51]Kt!!+`__pycache__/fix_urllib.cpython-36.opt-2.pycnu[PK51]k-O + __pycache__/fix_except.cpython-36.opt-1.pycnu[PK51]91+$__pycache__/fix_buffer.cpython-36.opt-2.pycnu[PK51]%ځ&M__pycache__/fix_imports.cpython-36.pycnu[PK51]%ځ,,__pycache__/fix_imports.cpython-36.opt-1.pycnu[PK51],=__pycache__/fix_has_key.cpython-36.opt-2.pycnu[PK51]!ZH/ / +&G__pycache__/fix_except.cpython-36.opt-2.pycnu[PK51]oH+Q Q &P__pycache__/fix_has_key.cpython-36.pycnu[PK51]%W\__pycache__/fix_buffer.cpython-36.pycnu[PK51]폏#___pycache__/__init__.cpython-36.pycnu[PK51]aI䖪-`__pycache__/fix_imports2.cpython-36.opt-2.pycnu[PK51]y bfix_apply.pynu[PK51]IIWlfix_isinstance.pynu[PK51]PTrfix_set_literal.pynu[PK51]8r == yfix_ne.pynu[PK51]& <|fix_reload.pynu[PK51]fix_itertools.pynu[PK51]n Ifix_paren.pynu[PK51]{ Qfix_exitfunc.pynu[PK51]Bo Wfix_dict.pynu[PK51]^ Km m fix_next.pynu[PK51]lSOO *fix_buffer.pynu[PK51]ݔN fix_long.pynu[PK51]ܬ'!!ζfix_imports2.pynu[PK51]DY .fix_map.pynu[PK51]i( ^fix_exec.pynu[PK51]7h## fix_future.pynu[PK51]Н ==fix_imports.pynu[PK51]H| ^fix_xrange.pynu[PK51]@`;; &fix_filter.pynu[PK51]\fix_standarderror.pynu[PK51]pV\ fix_operator.pynu[PK51]c^GGsfix_ws_comma.pynu[PK51]+E22 fix_throw.pynu[PK51]:^Sgfix_sys_exc.pynu[PK51]s fix_input.pynu[PK51]E[// __init__.pynu[PK51]&1  fix_types.pynu[PK51]gpAAmfix_basestring.pynu[PK51]{Ffix_numliterals.pynu[PK51] 6d6#fix_tuple_params.pynu[PK81]]B9fix_metaclass.pycnu[PK81]6 PSfix_ne.pycnu[PK81]e˺ sWfix_dict.pycnu[PK81]\g7''hffix_basestring.pyonu[PK81]Pr  ifix_itertools.pycnu[PK81]CTw qfix_renames.pycnu[PK81]WW {fix_long.pycnu[PK81] ~fix_throw.pyonu[PK81]_;>fix_set_literal.pyonu[PK81]d{Ǝfix_raw_input.pyonu[PK81]d{fix_raw_input.pycnu[PK81]v fix_map.pycnu[PK81]!x PP ݢfix_zip.pycnu[PK81]J hfix_exec.pycnu[PK81]!x PP <fix_zip.pyonu[PK81]5 dzfix_exitfunc.pycnu[PK81]WW ̾fix_long.pyonu[PK81]ܾ_fix_xreadlines.pyonu[PK81]1Wl/fix_sys_exc.pyonu[PK81]?յ 'fix_import.pycnu[PK81]8|gfix_execfile.pyonu[PK81]tufix_asserts.pycnu[PK81]cۛfix_metaclass.pyonu[PK81]tڢfix_buffer.pyonu[PK81]RRfix_numliterals.pycnu[PK81]0||  fix_input.pyonu[PK81]fix_future.pyonu[PK81]{fix_operator.pyonu[PK81]ؒ )__init__.pycnu[PK81]CTw *fix_renames.pyonu[PK81]\4fix_unicode.pycnu[PK81]_;>;fix_set_literal.pycnu[PK81],b Cfix_raise.pyonu[PK81]:C ttMfix_ws_comma.pycnu[PK81]Z[Sfix_itertools_imports.pyonu[PK81]~&e[fix_urllib.pycnu[PK81]uccwfix_standarderror.pycnu[PK81]5 C{fix_exitfunc.pyonu[PK81]:C ttHfix_ws_comma.pyonu[PK81]\g7''fix_basestring.pycnu[PK81]s<<efix_isinstance.pyonu[PK81]Rfix_imports.pyonu[PK81]c&fix_filter.pycnu[PK81] Bfix_except.pyonu[PK81]xA Afix_next.pyonu[PK81]tڢ?fix_buffer.pycnu[PK81]HmAfix_itertools_imports.pycnu[PK81]?յ xfix_import.pyonu[PK81]G~Z kfix_repr.pycnu[PK81]ifix_idioms.pycnu[PK81]uccfix_standarderror.pyonu[PK81]Lfix_operator.pycnu[PK81]mU fix_paren.pycnu[PK81]Tv˒RRfix_tuple_params.pyonu[PK81]2fix_future.pycnu[PK81]ĸ&u6fix_methodattrs.pyonu[PK81]t8;fix_asserts.pyonu[PK81]mU Afix_paren.pyonu[PK81]Ҋ<<Gfix_execfile.pycnu[PK81]ؒ ^P__init__.pyonu[PK81]QQQfix_idioms.pyonu[PK81]Pr  bfix_itertools.pyonu[PK81]҇ ifix_print.pycnu[PK81]ĸ&tfix_methodattrs.pycnu[PK81]&[  yfix_xrange.pycnu[PK81]}ׄLLfix_nonzero.pycnu[PK81] ] ] fix_has_key.pyonu[PK81]c'fix_filter.pyonu[PK81]G~Z Cfix_repr.pyonu[PK81]&[  fix_xrange.pyonu[PK81],V V Ұfix_print.pyonu[PK81]s<<efix_isinstance.pycnu[PK81]k(Pzzfix_imports2.pycnu[PK81]sGћfix_getcwdu.pyonu[PK81]v fix_map.pyonu[PK81]sGћfix_getcwdu.pycnu[PK81]u fix_next.pycnu[PK81]6 fix_ne.pyonu[PK81]ܾfix_xreadlines.pycnu[PK81]J fix_types.pyonu[PK81]Tv˒RRfix_tuple_params.pycnu[PK81]m)ĥ# fix_reduce.pycnu[PK81]4  ] fix_apply.pyonu[PK81]_}<<  fix_dict.pyonu[PK81]k(Pzz+ fix_imports2.pyonu[PK81] `pww - fix_exec.pyonu[PK81]m)ĥ3 fix_reduce.pyonu[PK81]xW8 fix_intern.pyonu[PK81]1Wl? fix_sys_exc.pycnu[PK81]J F fix_types.pycnu[PK81]}ׄLLO fix_nonzero.pyonu[PK81]RRaT fix_numliterals.pyonu[PK81]~&Y fix_urllib.pyonu[PK81] u fix_throw.pycnu[PK81],b } fix_raise.pycnu[PK81]  fix_except.pycnu[PK81]6zhh fix_funcattrs.pyonu[PK81]R fix_imports.pycnu[PK81]0|| ڭ fix_input.pycnu[PK81]6zhh fix_funcattrs.pycnu[PK81]\< fix_unicode.pyonu[PK81]xW? fix_intern.pycnu[PK81]-$$  fix_apply.pycnu[PK81]V%e~ ~  fix_has_key.pycnu[PK<<r