�ɲɾ�����ӯ�����һ��ˣ��������С���˴��ͣ�������P���ҹ��ñ˽��ά�Բ��������˸߸ԣ�������ơ��ҹ��ñ�����ά�Բ���ˡ���˳^�ӣ������ӡ� ���ͯj�ӣ��ƺ���ӣ� ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!PK1]+P"" fixer_base.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Base class for fixers (optional, but recommended).""" # Python imports import itertools # Local imports from .patcomp import PatternCompiler from . import pygram from .fixer_util import does_tree_import class BaseFix(object): """Optional base class for fixers. The subclass name must be FixFooBar where FooBar is the result of removing underscores and capitalizing the words of the fix name. For example, the class name for a fixer named 'has_key' should be FixHasKey. """ PATTERN = None # Most subclasses should override with a string literal pattern = None # Compiled pattern, set by compile_pattern() pattern_tree = None # Tree representation of the pattern options = None # Options object passed to initializer filename = None # The filename (set by set_filename) numbers = itertools.count(1) # For new_name() used_names = set() # A set of all used NAMEs order = "post" # Does the fixer prefer pre- or post-order traversal explicit = False # Is this ignored by refactor.py -f all? run_order = 5 # Fixers will be sorted by run order before execution # Lower numbers will be run first. _accept_type = None # [Advanced and not public] This tells RefactoringTool # which node type to accept when there's not a pattern. keep_line_order = False # For the bottom matcher: match with the # original line order BM_compatible = False # Compatibility with the bottom matching # module; every fixer should set this # manually # Shortcut for access to Python grammar symbols syms = pygram.python_symbols def __init__(self, options, log): """Initializer. Subclass may override. Args: options: a dict containing the options passed to RefactoringTool that could be used to customize the fixer through the command line. log: a list to append warnings and other messages to. """ self.options = options self.log = log self.compile_pattern() def compile_pattern(self): """Compiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match(). """ if self.PATTERN is not None: PC = PatternCompiler() self.pattern, self.pattern_tree = PC.compile_pattern(self.PATTERN, with_tree=True) def set_filename(self, filename): """Set the filename. The main refactoring tool should call this. """ self.filename = filename def match(self, node): """Returns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override. """ results = {"node": node} return self.pattern.match(node, results) and results def transform(self, node, results): """Returns the transformation for a given parse tree node. Args: node: the root of the parse tree that matched the fixer. results: a dict mapping symbolic names to part of the match. Returns: None, or a node that is a modified copy of the argument node. The node argument may also be modified in-place to effect the same change. Subclass *must* override. """ raise NotImplementedError() def new_name(self, template="xxx_todo_changeme"): """Return a string suitable for use as an identifier The new name is guaranteed not to conflict with other identifiers. """ name = template while name in self.used_names: name = template + str(next(self.numbers)) self.used_names.add(name) return name def log_message(self, message): if self.first_log: self.first_log = False self.log.append("### In file %s ###" % self.filename) self.log.append(message) def cannot_convert(self, node, reason=None): """Warn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. """ lineno = node.get_lineno() for_output = node.clone() for_output.prefix = "" msg = "Line %d: could not convert: %s" self.log_message(msg % (lineno, for_output)) if reason: self.log_message(reason) def warning(self, node, reason): """Used for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. """ lineno = node.get_lineno() self.log_message("Line %d: %s" % (lineno, reason)) def start_tree(self, tree, filename): """Some fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. """ self.used_names = tree.used_names self.set_filename(filename) self.numbers = itertools.count(1) self.first_log = True def finish_tree(self, tree, filename): """Some fixers need to maintain tree-wide state. This method is called once, at the conclusion of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. """ pass class ConditionalFix(BaseFix): """ Base class for fixers which not execute if an import is found. """ # This is the name of the import which, if found, will cause the test to be skipped skip_on = None def start_tree(self, *args): super(ConditionalFix, self).start_tree(*args) self._should_skip = None def should_skip(self, node): if self._should_skip is not None: return self._should_skip pkg = self.skip_on.split(".") name = pkg[-1] pkg = ".".join(pkg[:-1]) self._should_skip = does_tree_import(pkg, name, node) return self._should_skip PK1] =Brr pytree.pyonu[ {fc@sdZdZddlZddlZddlmZdZiadZdefdYZ d e fd YZ d e fd YZ d Z defdYZ de fdYZde fdYZde fdYZde fdYZdZdS(s Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here. s#Guido van Rossum iN(tStringIOicCshtsXddlm}x?|jjD]+\}}t|tkr&|t|((s&/usr/lib64/python2.7/lib2to3/pytree.pyt prev_siblings  ccs4x-|jD]"}x|jD] }|VqWq WdS(N(R)tleaves(RR>R3((s&/usr/lib64/python2.7/lib2to3/pytree.pyRAscCs$|jdkrdSd|jjS(Nii(R(R*tdepth(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRBscCs |j}|dkrdS|jS(s Return the string immediately following the invocant node. This is effectively equivalent to node.next_sibling.prefix uN(R?R*R"(Rtnext_sib((s&/usr/lib64/python2.7/lib2to3/pytree.pyt get_suffixs  iicCst|jdS(Ntascii(tunicodetencode(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyt__str__sN((ii(!t__name__t __module__t__doc__R*RR(R)R'R9t was_checkedRRt__hash__RRRRRR#R$R4R8R.R<tpropertyR?R@RARBRDtsyst version_infoRH(((s&/usr/lib64/python2.7/lib2to3/pytree.pyR s6            tNodecBseZdZddddZdZdZejdkrHeZ ndZ dZ dZ d Z d Zd ZeeeZd Zd ZdZRS(s+Concrete implementation for interior nodes.cCsm||_t||_x|jD]}||_q"W|dk rM||_n|r`||_n d|_dS(s Initializer. Takes a type constant (a symbol number >= 256), a sequence of child nodes, and an optional context keyword argument. As a side effect, the parent pointers of the children are updated. N(RR&R)R(R*R"tfixers_applied(RRR)tcontextR"RRR2((s&/usr/lib64/python2.7/lib2to3/pytree.pyt__init__s     cCs#d|jjt|j|jfS(s)Return a canonical string representation.s %s(%s, %r)(RRIR RR)(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyt__repr__ s  cCsdjtt|jS(sk Return a pretty string representation. This reproduces the input source exactly. u(tjointmapRFR)(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyt __unicode__siicCs"|j|jf|j|jfkS(sCompare two nodes for equality.(RR)(RR((s&/usr/lib64/python2.7/lib2to3/pytree.pyRscCs5t|jg|jD]}|j^qd|jS(s$Return a cloned (deep) copy of self.RR(RQRR)RRR(RR2((s&/usr/lib64/python2.7/lib2to3/pytree.pyR!s+ccs9x-|jD]"}x|jD] }|VqWq W|VdS(s*Return a post-order iterator for the tree.N(R)R(RR>R7((s&/usr/lib64/python2.7/lib2to3/pytree.pyR&s ccs9|Vx-|jD]"}x|jD] }|Vq"WqWdS(s)Return a pre-order iterator for the tree.N(R)R(RR>R7((s&/usr/lib64/python2.7/lib2to3/pytree.pyR-scCs|js dS|jdjS(sO The whitespace and comments preceding this node in the input. ti(R)R"(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyt_prefix_getter4s cCs |jr||jd_ndS(Ni(R)R"(RR"((s&/usr/lib64/python2.7/lib2to3/pytree.pyt_prefix_setter<s cCs4||_d|j|_||j|<|jdS(s Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. N(R(R*R)R.(RR;R>((s&/usr/lib64/python2.7/lib2to3/pytree.pyt set_childBs  cCs*||_|jj|||jdS(s Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. N(R(R)tinsertR.(RR;R>((s&/usr/lib64/python2.7/lib2to3/pytree.pyt insert_childLs cCs'||_|jj||jdS(s Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately. N(R(R)R-R.(RR>((s&/usr/lib64/python2.7/lib2to3/pytree.pyt append_childUs N(ii(RIRJRKR*RTRURXRORPRHRRRRRZR[RNR"R\R^R_(((s&/usr/lib64/python2.7/lib2to3/pytree.pyRQs$           R5cBseZdZdZdZdZddgdZdZdZ e j dkrZe Z ndZ dZd Zd Zd Zd Zd ZeeeZRS(s'Concrete implementation for leaf nodes.RYicCsb|dk r*|\|_\|_|_n||_||_|dk rT||_n||_dS(s Initializer. Takes a type constant (a token number < 256), a string value, and an optional context keyword argument. N(R*t_prefixR6tcolumnRtvalueRR(RRRbRSR"RR((s&/usr/lib64/python2.7/lib2to3/pytree.pyRThs     cCsd|jj|j|jfS(s)Return a canonical string representation.s %s(%r, %r)(RRIRRb(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRU{s cCs|jt|jS(sk Return a pretty string representation. This reproduces the input source exactly. (R"RFRb(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRXsicCs"|j|jf|j|jfkS(sCompare two nodes for equality.(RRb(RR((s&/usr/lib64/python2.7/lib2to3/pytree.pyRscCs4t|j|j|j|j|jffd|jS(s$Return a cloned (deep) copy of self.RR(R5RRbR"R6RaRR(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRsccs |VdS(N((R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRAsccs |VdS(s*Return a post-order iterator for the tree.N((R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRsccs |VdS(s)Return a pre-order iterator for the tree.N((R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRscCs|jS(sP The whitespace and comments preceding this token in the input. (R`(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRZscCs|j||_dS(N(R.R`(RR"((s&/usr/lib64/python2.7/lib2to3/pytree.pyR[s N(ii(RIRJRKR`R6RaR*RTRURXRORPRHRRRARRRZR[RNR"(((s&/usr/lib64/python2.7/lib2to3/pytree.pyR5_s&           cCsk|\}}}}|s'||jkrTt|dkrA|dSt||d|St||d|SdS(s Convert raw node information to a Node or Leaf instance. This is passed to the parser driver which calls it whenever a reduction of a grammar rule produces a new complete node, so that the tree is build strictly bottom-up. iiRSN(t number2symboltlenRQR5(tgrtraw_nodeRRbRSR)((s&/usr/lib64/python2.7/lib2to3/pytree.pytconverts t BasePatterncBs\eZdZdZdZdZdZdZdZ ddZ ddZ dZ RS(s A pattern is a tree matching pattern. It looks for a specific node type (token or symbol), and optionally for a specific content. This is an abstract base class. There are three concrete subclasses: - LeafPattern matches a single leaf node; - NodePattern matches a single node (usually non-leaf); - WildcardPattern matches a sequence of nodes of variable length. cOs tj|S(s>Constructor that prevents BasePattern from being instantiated.(RR(RRR((s&/usr/lib64/python2.7/lib2to3/pytree.pyRscCsht|j|j|jg}x!|rA|ddkrA|d=q!Wd|jjdjtt |fS(Nis%s(%s)s, ( R RtcontentR R*RRIRVRWtrepr(RR((s&/usr/lib64/python2.7/lib2to3/pytree.pyRUs cCs|S(s A subclass can define this as a hook for optimizations. Returns either self or another node with the same effect. ((R((s&/usr/lib64/python2.7/lib2to3/pytree.pytoptimizescCs|jdk r%|j|jkr%tS|jdk r~d}|dk rOi}n|j||setS|r~|j|q~n|dk r|jr|||j= 256). If the type is None this matches *any* single node (leaf or not), except if content is not None, in which it only matches non-leaf nodes that also match the content pattern. The content, if not None, must be a sequence of Patterns that must match the node's children exactly. If the content is given, the type must not be None. If a name is given, the matching node is stored in the results dict under that key. N( R*R&R:R%tWildcardPatternR,t wildcardsRRiR (RRRiR R;titem((s&/usr/lib64/python2.7/lib2to3/pytree.pyRTFs     cCs|jrhxXt|j|jD]A\}}|t|jkr|dk r\|j|ntSqWtSt|jt|jkrtSx9t |j|jD]"\}}|j ||stSqWtS(s Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. N( RwRsRiR)RdR*RmR,R'tzipRp(RR7RntcRot subpatternR>((s&/usr/lib64/python2.7/lib2to3/pytree.pyRlcs " "N(RIRJR'RwR*RTRl(((s&/usr/lib64/python2.7/lib2to3/pytree.pyRuBsRvcBsheZdZd ded dZdZd dZd dZdZ dZ dZ d Z RS( s A wildcard pattern can match zero or more nodes. This has all the flexibility needed to implement patterns like: .* .+ .? .{m,n} (a b c | d e | f) (...)* (...)+ (...)? (...){m,n} except it always uses non-greedy matching. icCs]|dk r5ttt|}x|D]}q(Wn||_||_||_||_dS(s Initializer. Args: content: optional sequence of subsequences of patterns; if absent, matches one node; if present, each subsequence is an alternative [*] min: optional minimum number of times to match, default 0 max: optional maximum number of times to match, default HUGE name: optional name assigned to this match [*] Thus, if content is [[a, b, c], [d, e], [f, g, h]] this is equivalent to (a b c | d e | f g h); if content is None, this is equivalent to '.' in regular expression terms. The min and max parameters work as follows: min=0, max=maxint: .* min=1, max=maxint: .+ min=0, max=1: .? min=1, max=1: . If content is not None, replace the dot with the parenthesized list of alternatives, e.g. (a b c | d e | f g h)* N(R*ttupleRWRitmintmaxR (RRiR}R~R talt((s&/usr/lib64/python2.7/lib2to3/pytree.pyRTs     cCs/d}|jdk rWt|jdkrWt|jddkrW|jdd}n|jdkr|jdkr|jdkrtd|jS|dk r|j|jkr|jSn|jdkr+t|t r+|jdkr+|j|jkr+t |j|j|j|j|j|jS|S(s+Optimize certain stacked wildcard patterns.iiR N( R*RiRdR}R~RuR RkR%Rv(RR{((s&/usr/lib64/python2.7/lib2to3/pytree.pyRks . !    cCs|j|g|S(s'Does this pattern exactly match a node?(Rr(RR7Rn((s&/usr/lib64/python2.7/lib2to3/pytree.pyRpscCsuxn|j|D]]\}}|t|kr|dk ri|j||jrit|||j s"   pN V,=#PK1]%asksk refactor.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Refactoring framework. Used as a main program, this can refactor any number of files and/or recursively descend down directories. Imported as a module, this provides infrastructure to write your own refactoring tool. """ __author__ = "Guido van Rossum " # Python imports import io import os import pkgutil import sys import logging import operator import collections from itertools import chain # Local imports from .pgen2 import driver, tokenize, token from .fixer_util import find_root from . import pytree, pygram from . import btm_matcher as bm def get_all_fix_names(fixer_pkg, remove_prefix=True): """Return a sorted list of all available fix names in the given package.""" pkg = __import__(fixer_pkg, [], [], ["*"]) fix_names = [] for finder, name, ispkg in pkgutil.iter_modules(pkg.__path__): if name.startswith("fix_"): if remove_prefix: name = name[4:] fix_names.append(name) return fix_names class _EveryNode(Exception): pass def _get_head_types(pat): """ Accepts a pytree Pattern Node and returns a set of the pattern types which will match first. """ if isinstance(pat, (pytree.NodePattern, pytree.LeafPattern)): # NodePatters must either have no type and no content # or a type and content -- so they don't get any farther # Always return leafs if pat.type is None: raise _EveryNode return {pat.type} if isinstance(pat, pytree.NegatedPattern): if pat.content: return _get_head_types(pat.content) raise _EveryNode # Negated Patterns don't have a type if isinstance(pat, pytree.WildcardPattern): # Recurse on each node in content r = set() for p in pat.content: for x in p: r.update(_get_head_types(x)) return r raise Exception("Oh no! I don't understand pattern %s" %(pat)) def _get_headnode_dict(fixer_list): """ Accepts a list of fixers and returns a dictionary of head node type --> fixer list. """ head_nodes = collections.defaultdict(list) every = [] for fixer in fixer_list: if fixer.pattern: try: heads = _get_head_types(fixer.pattern) except _EveryNode: every.append(fixer) else: for node_type in heads: head_nodes[node_type].append(fixer) else: if fixer._accept_type is not None: head_nodes[fixer._accept_type].append(fixer) else: every.append(fixer) for node_type in chain(pygram.python_grammar.symbol2number.values(), pygram.python_grammar.tokens): head_nodes[node_type].extend(every) return dict(head_nodes) def get_fixers_from_package(pkg_name): """ Return the fully qualified names for fixers in the package pkg_name. """ return [pkg_name + "." + fix_name for fix_name in get_all_fix_names(pkg_name, False)] def _identity(obj): return obj def _detect_future_features(source): have_docstring = False gen = tokenize.generate_tokens(io.StringIO(source).readline) def advance(): tok = next(gen) return tok[0], tok[1] ignore = frozenset({token.NEWLINE, tokenize.NL, token.COMMENT}) features = set() try: while True: tp, value = advance() if tp in ignore: continue elif tp == token.STRING: if have_docstring: break have_docstring = True elif tp == token.NAME and value == "from": tp, value = advance() if tp != token.NAME or value != "__future__": break tp, value = advance() if tp != token.NAME or value != "import": break tp, value = advance() if tp == token.OP and value == "(": tp, value = advance() while tp == token.NAME: features.add(value) tp, value = advance() if tp != token.OP or value != ",": break tp, value = advance() else: break except StopIteration: pass return frozenset(features) class FixerError(Exception): """A fixer could not be loaded.""" class RefactoringTool(object): _default_options = {"print_function" : False, "exec_function": False, "write_unchanged_files" : False} CLASS_PREFIX = "Fix" # The prefix for fixer classes FILE_PREFIX = "fix_" # The prefix for modules with a fixer within def __init__(self, fixer_names, options=None, explicit=None): """Initializer. Args: fixer_names: a list of fixers to import options: a dict with configuration. explicit: a list of fixers to run even if they are explicit. """ self.fixers = fixer_names self.explicit = explicit or [] self.options = self._default_options.copy() if options is not None: self.options.update(options) self.grammar = pygram.python_grammar.copy() if self.options['print_function']: del self.grammar.keywords["print"] elif self.options['exec_function']: del self.grammar.keywords["exec"] # When this is True, the refactor*() methods will call write_file() for # files processed even if they were not changed during refactoring. If # and only if the refactor method's write parameter was True. self.write_unchanged_files = self.options.get("write_unchanged_files") self.errors = [] self.logger = logging.getLogger("RefactoringTool") self.fixer_log = [] self.wrote = False self.driver = driver.Driver(self.grammar, convert=pytree.convert, logger=self.logger) self.pre_order, self.post_order = self.get_fixers() self.files = [] # List of files that were or should be modified self.BM = bm.BottomMatcher() self.bmi_pre_order = [] # Bottom Matcher incompatible fixers self.bmi_post_order = [] for fixer in chain(self.post_order, self.pre_order): if fixer.BM_compatible: self.BM.add_fixer(fixer) # remove fixers that will be handled by the bottom-up # matcher elif fixer in self.pre_order: self.bmi_pre_order.append(fixer) elif fixer in self.post_order: self.bmi_post_order.append(fixer) self.bmi_pre_order_heads = _get_headnode_dict(self.bmi_pre_order) self.bmi_post_order_heads = _get_headnode_dict(self.bmi_post_order) def get_fixers(self): """Inspects the options to load the requested patterns and handlers. Returns: (pre_order, post_order), where pre_order is the list of fixers that want a pre-order AST traversal, and post_order is the list that want post-order traversal. """ pre_order_fixers = [] post_order_fixers = [] for fix_mod_path in self.fixers: mod = __import__(fix_mod_path, {}, {}, ["*"]) fix_name = fix_mod_path.rsplit(".", 1)[-1] if fix_name.startswith(self.FILE_PREFIX): fix_name = fix_name[len(self.FILE_PREFIX):] parts = fix_name.split("_") class_name = self.CLASS_PREFIX + "".join([p.title() for p in parts]) try: fix_class = getattr(mod, class_name) except AttributeError: raise FixerError("Can't find %s.%s" % (fix_name, class_name)) from None fixer = fix_class(self.options, self.fixer_log) if fixer.explicit and self.explicit is not True and \ fix_mod_path not in self.explicit: self.log_message("Skipping optional fixer: %s", fix_name) continue self.log_debug("Adding transformation: %s", fix_name) if fixer.order == "pre": pre_order_fixers.append(fixer) elif fixer.order == "post": post_order_fixers.append(fixer) else: raise FixerError("Illegal fixer order: %r" % fixer.order) key_func = operator.attrgetter("run_order") pre_order_fixers.sort(key=key_func) post_order_fixers.sort(key=key_func) return (pre_order_fixers, post_order_fixers) def log_error(self, msg, *args, **kwds): """Called when an error occurs.""" raise def log_message(self, msg, *args): """Hook to log a message.""" if args: msg = msg % args self.logger.info(msg) def log_debug(self, msg, *args): if args: msg = msg % args self.logger.debug(msg) def print_output(self, old_text, new_text, filename, equal): """Called with the old version, new version, and filename of a refactored file.""" pass def refactor(self, items, write=False, doctests_only=False): """Refactor a list of files and directories.""" for dir_or_file in items: if os.path.isdir(dir_or_file): self.refactor_dir(dir_or_file, write, doctests_only) else: self.refactor_file(dir_or_file, write, doctests_only) def refactor_dir(self, dir_name, write=False, doctests_only=False): """Descends down a directory and refactor every Python file found. Python files are assumed to have a .py extension. Files and subdirectories starting with '.' are skipped. """ py_ext = os.extsep + "py" for dirpath, dirnames, filenames in os.walk(dir_name): self.log_debug("Descending into %s", dirpath) dirnames.sort() filenames.sort() for name in filenames: if (not name.startswith(".") and os.path.splitext(name)[1] == py_ext): fullname = os.path.join(dirpath, name) self.refactor_file(fullname, write, doctests_only) # Modify dirnames in-place to remove subdirs with leading dots dirnames[:] = [dn for dn in dirnames if not dn.startswith(".")] def _read_python_source(self, filename): """ Do our best to decode a Python source file correctly. """ try: f = open(filename, "rb") except OSError as err: self.log_error("Can't open %s: %s", filename, err) return None, None try: encoding = tokenize.detect_encoding(f.readline)[0] finally: f.close() with io.open(filename, "r", encoding=encoding, newline='') as f: return f.read(), encoding def refactor_file(self, filename, write=False, doctests_only=False): """Refactors a file.""" input, encoding = self._read_python_source(filename) if input is None: # Reading the file failed. return input += "\n" # Silence certain parse errors if doctests_only: self.log_debug("Refactoring doctests in %s", filename) output = self.refactor_docstring(input, filename) if self.write_unchanged_files or output != input: self.processed_file(output, filename, input, write, encoding) else: self.log_debug("No doctest changes in %s", filename) else: tree = self.refactor_string(input, filename) if self.write_unchanged_files or (tree and tree.was_changed): # The [:-1] is to take off the \n we added earlier self.processed_file(str(tree)[:-1], filename, write=write, encoding=encoding) else: self.log_debug("No changes in %s", filename) def refactor_string(self, data, name): """Refactor a given input string. Args: data: a string holding the code to be refactored. name: a human-readable name for use in error/log messages. Returns: An AST corresponding to the refactored input stream; None if there were errors during the parse. """ features = _detect_future_features(data) if "print_function" in features: self.driver.grammar = pygram.python_grammar_no_print_statement try: tree = self.driver.parse_string(data) except Exception as err: self.log_error("Can't parse %s: %s: %s", name, err.__class__.__name__, err) return finally: self.driver.grammar = self.grammar tree.future_features = features self.log_debug("Refactoring %s", name) self.refactor_tree(tree, name) return tree def refactor_stdin(self, doctests_only=False): input = sys.stdin.read() if doctests_only: self.log_debug("Refactoring doctests in stdin") output = self.refactor_docstring(input, "") if self.write_unchanged_files or output != input: self.processed_file(output, "", input) else: self.log_debug("No doctest changes in stdin") else: tree = self.refactor_string(input, "") if self.write_unchanged_files or (tree and tree.was_changed): self.processed_file(str(tree), "", input) else: self.log_debug("No changes in stdin") def refactor_tree(self, tree, name): """Refactors a parse tree (modifying the tree in place). For compatible patterns the bottom matcher module is used. Otherwise the tree is traversed node-to-node for matches. Args: tree: a pytree.Node instance representing the root of the tree to be refactored. name: a human-readable name for this tree. Returns: True if the tree was modified, False otherwise. """ for fixer in chain(self.pre_order, self.post_order): fixer.start_tree(tree, name) #use traditional matching for the incompatible fixers self.traverse_by(self.bmi_pre_order_heads, tree.pre_order()) self.traverse_by(self.bmi_post_order_heads, tree.post_order()) # obtain a set of candidate nodes match_set = self.BM.run(tree.leaves()) while any(match_set.values()): for fixer in self.BM.fixers: if fixer in match_set and match_set[fixer]: #sort by depth; apply fixers from bottom(of the AST) to top match_set[fixer].sort(key=pytree.Base.depth, reverse=True) if fixer.keep_line_order: #some fixers(eg fix_imports) must be applied #with the original file's line order match_set[fixer].sort(key=pytree.Base.get_lineno) for node in list(match_set[fixer]): if node in match_set[fixer]: match_set[fixer].remove(node) try: find_root(node) except ValueError: # this node has been cut off from a # previous transformation ; skip continue if node.fixers_applied and fixer in node.fixers_applied: # do not apply the same fixer again continue results = fixer.match(node) if results: new = fixer.transform(node, results) if new is not None: node.replace(new) #new.fixers_applied.append(fixer) for node in new.post_order(): # do not apply the fixer again to # this or any subnode if not node.fixers_applied: node.fixers_applied = [] node.fixers_applied.append(fixer) # update the original match set for # the added code new_matches = self.BM.run(new.leaves()) for fxr in new_matches: if not fxr in match_set: match_set[fxr]=[] match_set[fxr].extend(new_matches[fxr]) for fixer in chain(self.pre_order, self.post_order): fixer.finish_tree(tree, name) return tree.was_changed def traverse_by(self, fixers, traversal): """Traverse an AST, applying a set of fixers to each node. This is a helper method for refactor_tree(). Args: fixers: a list of fixer instances. traversal: a generator that yields AST nodes. Returns: None """ if not fixers: return for node in traversal: for fixer in fixers[node.type]: results = fixer.match(node) if results: new = fixer.transform(node, results) if new is not None: node.replace(new) node = new def processed_file(self, new_text, filename, old_text=None, write=False, encoding=None): """ Called when a file has been refactored and there may be changes. """ self.files.append(filename) if old_text is None: old_text = self._read_python_source(filename)[0] if old_text is None: return equal = old_text == new_text self.print_output(old_text, new_text, filename, equal) if equal: self.log_debug("No changes to %s", filename) if not self.write_unchanged_files: return if write: self.write_file(new_text, filename, old_text, encoding) else: self.log_debug("Not writing changes to %s", filename) def write_file(self, new_text, filename, old_text, encoding=None): """Writes a string to a file. It first shows a unified diff between the old text and the new text, and then rewrites the file; the latter is only done if the write option is set. """ try: fp = io.open(filename, "w", encoding=encoding, newline='') except OSError as err: self.log_error("Can't create %s: %s", filename, err) return with fp: try: fp.write(new_text) except OSError as err: self.log_error("Can't write %s: %s", filename, err) self.log_debug("Wrote changes to %s", filename) self.wrote = True PS1 = ">>> " PS2 = "... " def refactor_docstring(self, input, filename): """Refactors a docstring, looking for doctests. This returns a modified version of the input string. It looks for doctests, which start with a ">>>" prompt, and may be continued with "..." prompts, as long as the "..." is indented the same as the ">>>". (Unfortunately we can't use the doctest module's parser, since, like most parsers, it is not geared towards preserving the original source.) """ result = [] block = None block_lineno = None indent = None lineno = 0 for line in input.splitlines(keepends=True): lineno += 1 if line.lstrip().startswith(self.PS1): if block is not None: result.extend(self.refactor_doctest(block, block_lineno, indent, filename)) block_lineno = lineno block = [line] i = line.find(self.PS1) indent = line[:i] elif (indent is not None and (line.startswith(indent + self.PS2) or line == indent + self.PS2.rstrip() + "\n")): block.append(line) else: if block is not None: result.extend(self.refactor_doctest(block, block_lineno, indent, filename)) block = None indent = None result.append(line) if block is not None: result.extend(self.refactor_doctest(block, block_lineno, indent, filename)) return "".join(result) def refactor_doctest(self, block, lineno, indent, filename): """Refactors one doctest. A doctest is given as a block of lines, the first of which starts with ">>>" (possibly indented), while the remaining lines start with "..." (identically indented). """ try: tree = self.parse_block(block, lineno, indent) except Exception as err: if self.logger.isEnabledFor(logging.DEBUG): for line in block: self.log_debug("Source: %s", line.rstrip("\n")) self.log_error("Can't parse docstring in %s line %s: %s: %s", filename, lineno, err.__class__.__name__, err) return block if self.refactor_tree(tree, filename): new = str(tree).splitlines(keepends=True) # Undo the adjustment of the line numbers in wrap_toks() below. clipped, new = new[:lineno-1], new[lineno-1:] assert clipped == ["\n"] * (lineno-1), clipped if not new[-1].endswith("\n"): new[-1] += "\n" block = [indent + self.PS1 + new.pop(0)] if new: block += [indent + self.PS2 + line for line in new] return block def summarize(self): if self.wrote: were = "were" else: were = "need to be" if not self.files: self.log_message("No files %s modified.", were) else: self.log_message("Files that %s modified:", were) for file in self.files: self.log_message(file) if self.fixer_log: self.log_message("Warnings/messages while refactoring:") for message in self.fixer_log: self.log_message(message) if self.errors: if len(self.errors) == 1: self.log_message("There was 1 error:") else: self.log_message("There were %d errors:", len(self.errors)) for msg, args, kwds in self.errors: self.log_message(msg, *args, **kwds) def parse_block(self, block, lineno, indent): """Parses a block into a tree. This is necessary to get correct line number / offset information in the parser diagnostics and embedded into the parse tree. """ tree = self.driver.parse_tokens(self.wrap_toks(block, lineno, indent)) tree.future_features = frozenset() return tree def wrap_toks(self, block, lineno, indent): """Wraps a tokenize stream to systematically modify start/end.""" tokens = tokenize.generate_tokens(self.gen_lines(block, indent).__next__) for type, value, (line0, col0), (line1, col1), line_text in tokens: line0 += lineno - 1 line1 += lineno - 1 # Don't bother updating the columns; this is too complicated # since line_text would also have to be updated and it would # still break for tokens spanning lines. Let the user guess # that the column numbers for doctests are relative to the # end of the prompt string (PS1 or PS2). yield type, value, (line0, col0), (line1, col1), line_text def gen_lines(self, block, indent): """Generates lines as expected by tokenize from a list of lines. This strips the first len(indent + self.PS1) characters off each line. """ prefix1 = indent + self.PS1 prefix2 = indent + self.PS2 prefix = prefix1 for line in block: if line.startswith(prefix): yield line[len(prefix):] elif line == prefix.rstrip() + "\n": yield "\n" else: raise AssertionError("line=%r, prefix=%r" % (line, prefix)) prefix = prefix2 while True: yield "" class MultiprocessingUnsupported(Exception): pass class MultiprocessRefactoringTool(RefactoringTool): def __init__(self, *args, **kwargs): super(MultiprocessRefactoringTool, self).__init__(*args, **kwargs) self.queue = None self.output_lock = None def refactor(self, items, write=False, doctests_only=False, num_processes=1): if num_processes == 1: return super(MultiprocessRefactoringTool, self).refactor( items, write, doctests_only) try: import multiprocessing except ImportError: raise MultiprocessingUnsupported if self.queue is not None: raise RuntimeError("already doing multiple processes") self.queue = multiprocessing.JoinableQueue() self.output_lock = multiprocessing.Lock() processes = [multiprocessing.Process(target=self._child) for i in range(num_processes)] try: for p in processes: p.start() super(MultiprocessRefactoringTool, self).refactor(items, write, doctests_only) finally: self.queue.join() for i in range(num_processes): self.queue.put(None) for p in processes: if p.is_alive(): p.join() self.queue = None def _child(self): task = self.queue.get() while task is not None: args, kwargs = task try: super(MultiprocessRefactoringTool, self).refactor_file( *args, **kwargs) finally: self.queue.task_done() task = self.queue.get() def refactor_file(self, *args, **kwargs): if self.queue is not None: self.queue.put((args, kwargs)) else: return super(MultiprocessRefactoringTool, self).refactor_file( *args, **kwargs) PK1]Pц __main__.pycnu[ {fc@s3ddlZddlmZejeddS(iNi(tmains lib2to3.fixes(tsysRtexit(((s(/usr/lib64/python2.7/lib2to3/__main__.pyts PK1]ι ! btm_utils.pyonu[ {fc@sdZddlmZddlmZmZddlmZmZeZ eZ ej Z eZ dZdZdZdefd YZd d Zd Zd Zd S(s0Utility functions used by the btm_matcher modulei(tpytree(tgrammarttoken(tpattern_symbolstpython_symbolsiiitMinNodecBsAeZdZdddZdZdZdZdZRS(sThis class serves as an intermediate representation of the pattern tree during the conversion to sets of leaf-to-root subpatternscCsC||_||_g|_t|_d|_g|_g|_dS(N( ttypetnametchildrentFalsetleaftNonetparentt alternativestgroup(tselfRR((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyt__init__s      cCst|jdt|jS(Nt (tstrRR(R((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyt__repr__scCsU|}g}xB|rP|jtkr|jj|t|jt|jkr|t|jg}g|_|j}qq|j}d}Pn|jt kr|j j|t|j t|jkrt |j }g|_ |j}qq|j}d}Pn|jt j kr4|jr4|j|jn|j|j|j}qW|S(sInternal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a singleN(RtTYPE_ALTERNATIVESR tappendtlenRttupleR R t TYPE_GROUPRtget_characteristic_subpatternt token_labelstNAMER(Rtnodetsubp((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyt leaf_to_root!s8        cCs1x*|jD]}|j}|r |Sq WdS(sDrives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton's capabilities, leaf_to_root merges each group into a single choice based on 'characteristic'ity, i.e. (a|b c) -> (a|b) if b more characteristic than c Returns: The most 'characteristic'(as defined by get_characteristic_subpattern) path for the compiled pattern tree. N(tleavesR(RtlR((s)/usr/lib64/python2.7/lib2to3/btm_utils.pytget_linear_subpatternKs ccsEx-|jD]"}x|jD] }|VqWq W|jsA|VndS(s-Generator that returns the leaves of the treeN(RR(Rtchildtx((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyR`s   N( t__name__t __module__t__doc__R RRRR!R(((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyRs   * c Csd}|jtjkr(|jd}n|jtjkrt|jdkrht|jd|}qtdt }x|jD]P}|jj |drqnt||}|dk r|jj |qqWn$|jtj krxt|jdkr_tdt }x9|jD].}t||}|r|jj |qqW|jsud}quqt|jd|}n|jtjkrt|jdtjr|jdjdkrt|jd|St|jdtjr|jdjdks=t|jdkrAt|jddrA|jdjdkrAdSt}d}d}t}d} t} x|jD]}|jtjkrt}|}n<|jtjkrt}|} n|jtjkr|}nt|dro|jdkrot} qoqoW| rA|jd} t| drN| jdkrN|jd } qNn |jd} | jtjkr| jd krtdt}qTtt| jrtdtt| j}qTtdtt| j}n| jtjkr0| jjd } | tkrtdt| }qTtdtjd | }n$| jtjkrTt||}n|r| jdjd kryd}q| jdjdkrqt n|r|dk rxI|jdd!D]4}t||}|dk r|jj |qqWqn|r||_!n|S(s Internal function. Reduces a compiled pattern tree to an intermediate representation suitable for feeding the automaton. This also trims off any optional pattern elements(like [a], a*). iiRit(t[tvaluet=itanyt'Rt*t+iN("R RtsymstMatcherRt AlternativesRt reduce_treeRRtindexRt AlternativeRtUnitt isinstanceRtLeafR)thasattrtTrueR tDetailstRepeaterRRtTYPE_ANYtgetattrtpysymstSTRINGtstripttokenstNotImplementedErrorR ( RR tnew_nodeR"treducedR t details_nodetalternatives_nodet has_repeatert repeater_nodethas_variable_namet name_leafR((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyR2hs             cs,t|ts|St|dkr-|dSg}g}dddddgg}dx|D]}tt|d ratt|fd r|j|qtt|fd r|j|q|j|qaqaW|r|}n|r |}n|r|}nt|d tS( sPicks the most characteristic from a list of linear patterns Current order used is: names > common_names > common_chars iitintfortiftnotR s[]().,:cSst|tkS(N(RR(R#((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyttcst|to|kS(N(R6R(R#(t common_chars(s)/usr/lib64/python2.7/lib2to3/btm_utils.pyRORPcst|to|kS(N(R6R(R#(t common_names(s)/usr/lib64/python2.7/lib2to3/btm_utils.pyRORPtkey(R6tlistRR+trec_testRtmax(t subpatternstsubpatterns_with_namestsubpatterns_with_common_namestsubpatterns_with_common_charst subpattern((RQRRs)/usr/lib64/python2.7/lib2to3/btm_utils.pyRs2      ccsWxP|D]H}t|ttfrDx*t||D] }|Vq2Wq||VqWdS(sPTests test_func on all items of sequence and items of included sub-iterablesN(R6RTRRU(tsequencet test_funcR#ty((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyRUs   N(R&RPRtpgen2RRtpygramRRR/R>topmapRARR<RRtobjectRR R2RRU(((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyts X %PK1]-~ pygram.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Export the Python grammar and symbols.""" # Python imports import os # Local imports from .pgen2 import token from .pgen2 import driver from . import pytree # The grammar file _GRAMMAR_FILE = os.path.join(os.path.dirname(__file__), "Grammar.txt") _PATTERN_GRAMMAR_FILE = os.path.join(os.path.dirname(__file__), "PatternGrammar.txt") class Symbols(object): def __init__(self, grammar): """Initializer. Creates an attribute for each grammar symbol (nonterminal), whose value is the symbol's type (an int >= 256). """ for name, symbol in grammar.symbol2number.items(): setattr(self, name, symbol) python_grammar = driver.load_packaged_grammar("lib2to3", _GRAMMAR_FILE) python_symbols = Symbols(python_grammar) python_grammar_no_print_statement = python_grammar.copy() del python_grammar_no_print_statement.keywords["print"] python_grammar_no_print_and_exec_statement = python_grammar_no_print_statement.copy() del python_grammar_no_print_and_exec_statement.keywords["exec"] pattern_grammar = driver.load_packaged_grammar("lib2to3", _PATTERN_GRAMMAR_FILE) pattern_symbols = Symbols(pattern_grammar) PK1]S[9[9fixer_util.pyonu[ {fc @sdZddlmZddlmZddlmZmZddlm Z ddl m Z dZ d Zd Zd Zd5d Zd ZdZdZeedZd5d5dZdZdZd5dZdZd5dZd5dZdZdZdZ dZ!e"ddddd d!d"d#d$d%g Z#d&Z$d'a%d(a&d)a'e(a)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1e"e j2e j3gZ4d5d2Z5e"e j3e j2e j6gZ7d3Z8d5d4Z9d5S(6s1Utility functions, node construction macros, etc.i(tislicei(ttoken(tLeaftNode(tpython_symbols(tpatcompcCs%ttj|ttjd|gS(Nu=(RtsymstargumentRRtEQUAL(tkeywordtvalue((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt KeywordArgs cCsttjdS(Nu((RRtLPAR(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytLParenscCsttjdS(Nu)(RRtRPAR(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytRParenscCslt|ts|g}nt|ts?d|_|g}nttj|ttjdddg|S(sBuild an assignment statementu u=tprefix( t isinstancetlistRRRtatomRRR(ttargettsource((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytAssigns    cCsttj|d|S(sReturn a NAME leafR(RRtNAME(tnameR((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytName&scCs|ttjt|ggS(sA node tuple for obj.attr(RRttrailertDot(tobjtattr((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytAttr*scCsttjdS(s A comma leafu,(RRtCOMMA(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytComma.scCsttjdS(sA period (.) leafu.(RRtDOT(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyR2scCsMttj|j|jg}|rI|jdttj|n|S(s-A parenthesised argument list, used by Call()i(RRRtclonet insert_childtarglist(targstlparentrparentnode((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytArgList6s$cCs:ttj|t|g}|dk r6||_n|S(sA function callN(RRtpowerR)tNoneR(t func_nameR%RR(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytCall=s  cCsttjdS(sA newline literalu (RRtNEWLINE(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytNewlineDscCsttjdS(s A blank lineu(RRR.(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt BlankLineHscCsttj|d|S(NR(RRtNUMBER(tnR((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytNumberLscCs1ttjttjd|ttjdgS(sA numeric or string subscriptu[u](RRRRRtLBRACEtRBRACE(t index_node((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt SubscriptOscCsttj|d|S(s A string leafR(RRtSTRING(tstringR((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytStringUsc Csd|_d|_d|_ttjd}d|_ttjd}d|_||||g}|rd|_ttjd}d|_|jttj||gnttj|ttj |g}ttj ttj d|ttj dgS(suA list comprehension of the form [xp for fp in it if test]. If test is None, the "if test" part is omitted. uu uforuinuifu[u]( RRRRtappendRRtcomp_ift listmakertcomp_forRR4R5( txptfptitttesttfor_leaftin_leaft inner_argstif_leaftinner((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytListCompYs$       "$ cCsx|D]}|jqWttjdttj|ddttjdddttj|g}ttj|}|S(sO Return an import statement in the form: from package import name_leafsufromRu uimport(tremoveRRRRRtimport_as_namest import_from(t package_namet name_leafstleaftchildrentimp((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt FromImportqs cCst|tr.|jttgkr.tSt|tot|jdkot|jdtot|jdtot|jdto|jdjdko|jdjdkS(s(Does the node represent a tuple literal?iiiiu(u)( RRROR RtTruetlenRR (R(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytis_tuples*cCszt|toyt|jdkoyt|jdtoyt|jdtoy|jdjdkoy|jdjdkS(s'Does the node represent a list literal?iiiu[u](RRRSRORR (R(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytis_lists cCsttjt|tgS(N(RRRR R(R(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt parenthesizestsortedRtsettanytallttupletsumtmintmaxt enumerateccs4t||}x|r/|Vt||}qWdS(slFollow an attribute chain. If you have a chain of objects where a.foo -> b, b.foo-> c, etc, use this to iterate over all objects in the chain. Iteration is terminated by getattr(x, attr) is None. Args: obj: the starting object attr: the name of the chaining attribute Yields: Each successive object in the chain. N(tgetattr(RRtnext((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt attr_chains sefor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > s power< ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | 'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) ) trailer< '(' node=any ')' > any* > s` power< ( 'sorted' | 'enumerate' ) trailer< '(' arglist ')' > any* > cCsts<tjtatjtatjtatantttg}xRt|t|dD]8\}}i}|j ||rd|d|krdtSqdWt S(s Returns true if node is in an environment where all that is required of it is being iterable (ie, it doesn't matter if it returns a list or an iterator). See test_map_nochange in test_fixers.py for some examples and tests. tparentR(( t pats_builtRtcompile_patterntp0tp1tp2RRtzipRbtmatchtFalse(R(tpatternstpatternRctresults((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytin_special_contexts %"cCs|j}|dk r+|jtjkr+tS|j}|jtjtj fkrStS|jtj kr||j d|kr|tS|jtj ks|jtj kr|dk r|jtjks|j d|krtStS(sG Check that something isn't an attribute or function name etc. iN(t prev_siblingR+ttypeRR!RkRcRtfuncdeftclassdeft expr_stmtROt parameterst typedargslistRRR(R(tprevRc((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytis_probably_builtins  %cCspxi|dk rk|jtjkr_t|jdkr_|jd}|jtjkr_|jSn|j }qWdS(sFind the indentation of *node*.iiuN( R+RqRtsuiteRSRORtINDENTR Rc(R(tindent((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytfind_indentations'   cCsW|jtjkr|S|j}|jd}|_ttj|g}||_|S(N(RqRRyR"RcR+R(R(RcRy((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt make_suites  cCs;x4|jtjkr6|j}|stdqqW|S(sFind the top level namespace.s,root found before file_input node was found.(RqRt file_inputRct ValueError(R(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt find_roots  cCs"t|t||}t|S(s Returns true if name is imported from package at the top level of the tree which node belongs to. To cover the case of an import like 'import foo', use None for the package and 'foo' for the name. (t find_bindingRtbool(tpackageRR(tbinding((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytdoes_tree_importscCs|jtjtjfkS(s0Returns true if the node is an import statement.(RqRt import_nameRK(R(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt is_import"sc Csd}t|}t|||r+dSd}}xnt|jD]]\}}||scqEnx1t|j|D]\}}||swPqwqwW||}PqEW|dkrxbt|jD]N\}}|jtjkr|jr|jdjtjkr|d}PqqWn|dkr\t tj t tj dt tj |ddg} n$t|t tj |ddg} | tg} |j|t tj| dS(s\ Works like `does_tree_import` but adds an import statement if it was not imported. cSs,|jtjko+|jo+t|jdS(Ni(RqRt simple_stmtROR(R(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytis_import_stmt)sNiiuimportRu (RRR_RORqRRRR8R+RRRRRQR/R#( RRR(Rtroott insert_postoffsettidxtnode2timport_RO((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt touch_import&s4            !$cCsKxD|jD]9}d}|jtjkrst||jdrB|St|t|jd|}|r |}q n|jtjtj fkrt|t|jd|}|r |}q na|jtj kr|t|t|jd|}|r|}q xt |jdD]b\}}|jt j kr|jdkrt|t|j|d|}|ru|}quqqWn|jtkr|jdj|kr|}nvt|||r|}n[|jtjkrt|||}n4|jtjkr t||jdr |}q n|r |s0|St|rC|Sq q WdS( s Returns the node which binds variable name, otherwise None. If optional argument package is supplied, only imports will be returned. See test cases for examples.iiiit:iiN(ROR+RqRtfor_stmtt_findRR}tif_stmtt while_stmtttry_stmtR_RtCOLONR t _def_symst_is_import_bindingRRtR(RR(RtchildtretR2titkid((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyRTsH    !#%     cCs||g}xl|rw|j}|jdkrO|jtkrO|j|jq |jtjkr |j|kr |Sq WdS(Ni( tpopRqt _block_symstextendRORRR R+(RR(tnodes((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyRs   !cCs'|jtjkr| r|jd}|jtjkrx|jD]Z}|jtjkrw|jdj|kr|SqB|jtjkrB|j|krB|SqBWq#|jtjkr|jd}|jtjkr|j|kr|Sq#|jtjkr#|j|kr#|Sn|jtj kr#|rMt |jdj |krMdS|jd}|rst d|rsdS|jtjkrt ||r|S|jtjkr|jd}|jtjkr |j|kr |Sq#|jtjkr|j|kr|S|r#|jtjkr#|SndS(s Will reuturn node if node will import name, or node will import * from package. None is returned otherwise. See test cases for examples. iiiiuasN(RqRRROtdotted_as_namestdotted_as_nameR RRRKtunicodetstripR+RRJtimport_as_nametSTAR(R(RRRPRtlastR2((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyRs@ !  !!% ! !!N(:t__doc__t itertoolsRtpgen2RtpytreeRRtpygramRRtRR R RRR+RRR RR)R-R/R0R3R7R:RHRQRTRURVRXtconsuming_callsRbRfRgRhRkRdRoRxR|R}RRRRRsRrRRRRRR(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytsZ                       - * PK1]FmFm pytree.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """ Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here. """ __author__ = "Guido van Rossum " import sys from io import StringIO HUGE = 0x7FFFFFFF # maximum repeat count, default max _type_reprs = {} def type_repr(type_num): global _type_reprs if not _type_reprs: from .pygram import python_symbols # printing tokens is possible but not as useful # from .pgen2 import token // token.__dict__.items(): for name, val in python_symbols.__dict__.items(): if type(val) == int: _type_reprs[val] = name return _type_reprs.setdefault(type_num, type_num) class Base(object): """ Abstract base class for Node and Leaf. This provides some default functionality and boilerplate using the template pattern. A node may be a subnode of at most one parent. """ # Default values for instance variables type = None # int: token number (< 256) or symbol number (>= 256) parent = None # Parent node pointer, or None children = () # Tuple of subnodes was_changed = False was_checked = False def __new__(cls, *args, **kwds): """Constructor that prevents Base from being instantiated.""" assert cls is not Base, "Cannot instantiate Base" return object.__new__(cls) def __eq__(self, other): """ Compare two nodes for equality. This calls the method _eq(). """ if self.__class__ is not other.__class__: return NotImplemented return self._eq(other) __hash__ = None # For Py3 compatibility. def _eq(self, other): """ Compare two nodes for equality. This is called by __eq__ and __ne__. It is only called if the two nodes have the same type. This must be implemented by the concrete subclass. Nodes should be considered equal if they have the same structure, ignoring the prefix string and other context information. """ raise NotImplementedError def clone(self): """ Return a cloned (deep) copy of self. This must be implemented by the concrete subclass. """ raise NotImplementedError def post_order(self): """ Return a post-order iterator for the tree. This must be implemented by the concrete subclass. """ raise NotImplementedError def pre_order(self): """ Return a pre-order iterator for the tree. This must be implemented by the concrete subclass. """ raise NotImplementedError def replace(self, new): """Replace this node with a new one in the parent.""" assert self.parent is not None, str(self) assert new is not None if not isinstance(new, list): new = [new] l_children = [] found = False for ch in self.parent.children: if ch is self: assert not found, (self.parent.children, self, new) if new is not None: l_children.extend(new) found = True else: l_children.append(ch) assert found, (self.children, self, new) self.parent.changed() self.parent.children = l_children for x in new: x.parent = self.parent self.parent = None def get_lineno(self): """Return the line number which generated the invocant node.""" node = self while not isinstance(node, Leaf): if not node.children: return node = node.children[0] return node.lineno def changed(self): if self.parent: self.parent.changed() self.was_changed = True def remove(self): """ Remove the node from the tree. Returns the position of the node in its parent's children before it was removed. """ if self.parent: for i, node in enumerate(self.parent.children): if node is self: self.parent.changed() del self.parent.children[i] self.parent = None return i @property def next_sibling(self): """ The node immediately following the invocant in their parent's children list. If the invocant does not have a next sibling, it is None """ if self.parent is None: return None # Can't use index(); we need to test by identity for i, child in enumerate(self.parent.children): if child is self: try: return self.parent.children[i+1] except IndexError: return None @property def prev_sibling(self): """ The node immediately preceding the invocant in their parent's children list. If the invocant does not have a previous sibling, it is None. """ if self.parent is None: return None # Can't use index(); we need to test by identity for i, child in enumerate(self.parent.children): if child is self: if i == 0: return None return self.parent.children[i-1] def leaves(self): for child in self.children: yield from child.leaves() def depth(self): if self.parent is None: return 0 return 1 + self.parent.depth() def get_suffix(self): """ Return the string immediately following the invocant node. This is effectively equivalent to node.next_sibling.prefix """ next_sib = self.next_sibling if next_sib is None: return "" return next_sib.prefix if sys.version_info < (3, 0): def __str__(self): return str(self).encode("ascii") class Node(Base): """Concrete implementation for interior nodes.""" def __init__(self,type, children, context=None, prefix=None, fixers_applied=None): """ Initializer. Takes a type constant (a symbol number >= 256), a sequence of child nodes, and an optional context keyword argument. As a side effect, the parent pointers of the children are updated. """ assert type >= 256, type self.type = type self.children = list(children) for ch in self.children: assert ch.parent is None, repr(ch) ch.parent = self if prefix is not None: self.prefix = prefix if fixers_applied: self.fixers_applied = fixers_applied[:] else: self.fixers_applied = None def __repr__(self): """Return a canonical string representation.""" return "%s(%s, %r)" % (self.__class__.__name__, type_repr(self.type), self.children) def __unicode__(self): """ Return a pretty string representation. This reproduces the input source exactly. """ return "".join(map(str, self.children)) if sys.version_info > (3, 0): __str__ = __unicode__ def _eq(self, other): """Compare two nodes for equality.""" return (self.type, self.children) == (other.type, other.children) def clone(self): """Return a cloned (deep) copy of self.""" return Node(self.type, [ch.clone() for ch in self.children], fixers_applied=self.fixers_applied) def post_order(self): """Return a post-order iterator for the tree.""" for child in self.children: yield from child.post_order() yield self def pre_order(self): """Return a pre-order iterator for the tree.""" yield self for child in self.children: yield from child.pre_order() @property def prefix(self): """ The whitespace and comments preceding this node in the input. """ if not self.children: return "" return self.children[0].prefix @prefix.setter def prefix(self, prefix): if self.children: self.children[0].prefix = prefix def set_child(self, i, child): """ Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. """ child.parent = self self.children[i].parent = None self.children[i] = child self.changed() def insert_child(self, i, child): """ Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. """ child.parent = self self.children.insert(i, child) self.changed() def append_child(self, child): """ Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately. """ child.parent = self self.children.append(child) self.changed() class Leaf(Base): """Concrete implementation for leaf nodes.""" # Default values for instance variables _prefix = "" # Whitespace and comments preceding this token in the input lineno = 0 # Line where this token starts in the input column = 0 # Column where this token tarts in the input def __init__(self, type, value, context=None, prefix=None, fixers_applied=[]): """ Initializer. Takes a type constant (a token number < 256), a string value, and an optional context keyword argument. """ assert 0 <= type < 256, type if context is not None: self._prefix, (self.lineno, self.column) = context self.type = type self.value = value if prefix is not None: self._prefix = prefix self.fixers_applied = fixers_applied[:] def __repr__(self): """Return a canonical string representation.""" return "%s(%r, %r)" % (self.__class__.__name__, self.type, self.value) def __unicode__(self): """ Return a pretty string representation. This reproduces the input source exactly. """ return self.prefix + str(self.value) if sys.version_info > (3, 0): __str__ = __unicode__ def _eq(self, other): """Compare two nodes for equality.""" return (self.type, self.value) == (other.type, other.value) def clone(self): """Return a cloned (deep) copy of self.""" return Leaf(self.type, self.value, (self.prefix, (self.lineno, self.column)), fixers_applied=self.fixers_applied) def leaves(self): yield self def post_order(self): """Return a post-order iterator for the tree.""" yield self def pre_order(self): """Return a pre-order iterator for the tree.""" yield self @property def prefix(self): """ The whitespace and comments preceding this token in the input. """ return self._prefix @prefix.setter def prefix(self, prefix): self.changed() self._prefix = prefix def convert(gr, raw_node): """ Convert raw node information to a Node or Leaf instance. This is passed to the parser driver which calls it whenever a reduction of a grammar rule produces a new complete node, so that the tree is build strictly bottom-up. """ type, value, context, children = raw_node if children or type in gr.number2symbol: # If there's exactly one child, return that child instead of # creating a new node. if len(children) == 1: return children[0] return Node(type, children, context=context) else: return Leaf(type, value, context=context) class BasePattern(object): """ A pattern is a tree matching pattern. It looks for a specific node type (token or symbol), and optionally for a specific content. This is an abstract base class. There are three concrete subclasses: - LeafPattern matches a single leaf node; - NodePattern matches a single node (usually non-leaf); - WildcardPattern matches a sequence of nodes of variable length. """ # Defaults for instance variables type = None # Node type (token if < 256, symbol if >= 256) content = None # Optional content matching pattern name = None # Optional name used to store match in results dict def __new__(cls, *args, **kwds): """Constructor that prevents BasePattern from being instantiated.""" assert cls is not BasePattern, "Cannot instantiate BasePattern" return object.__new__(cls) def __repr__(self): args = [type_repr(self.type), self.content, self.name] while args and args[-1] is None: del args[-1] return "%s(%s)" % (self.__class__.__name__, ", ".join(map(repr, args))) def optimize(self): """ A subclass can define this as a hook for optimizations. Returns either self or another node with the same effect. """ return self def match(self, node, results=None): """ Does this pattern exactly match a node? Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. Default implementation for non-wildcard patterns. """ if self.type is not None and node.type != self.type: return False if self.content is not None: r = None if results is not None: r = {} if not self._submatch(node, r): return False if r: results.update(r) if results is not None and self.name: results[self.name] = node return True def match_seq(self, nodes, results=None): """ Does this pattern exactly match a sequence of nodes? Default implementation for non-wildcard patterns. """ if len(nodes) != 1: return False return self.match(nodes[0], results) def generate_matches(self, nodes): """ Generator yielding all matches for this pattern. Default implementation for non-wildcard patterns. """ r = {} if nodes and self.match(nodes[0], r): yield 1, r class LeafPattern(BasePattern): def __init__(self, type=None, content=None, name=None): """ Initializer. Takes optional type, content, and name. The type, if given must be a token type (< 256). If not given, this matches any *leaf* node; the content may still be required. The content, if given, must be a string. If a name is given, the matching node is stored in the results dict under that key. """ if type is not None: assert 0 <= type < 256, type if content is not None: assert isinstance(content, str), repr(content) self.type = type self.content = content self.name = name def match(self, node, results=None): """Override match() to insist on a leaf node.""" if not isinstance(node, Leaf): return False return BasePattern.match(self, node, results) def _submatch(self, node, results=None): """ Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. """ return self.content == node.value class NodePattern(BasePattern): wildcards = False def __init__(self, type=None, content=None, name=None): """ Initializer. Takes optional type, content, and name. The type, if given, must be a symbol type (>= 256). If the type is None this matches *any* single node (leaf or not), except if content is not None, in which it only matches non-leaf nodes that also match the content pattern. The content, if not None, must be a sequence of Patterns that must match the node's children exactly. If the content is given, the type must not be None. If a name is given, the matching node is stored in the results dict under that key. """ if type is not None: assert type >= 256, type if content is not None: assert not isinstance(content, str), repr(content) content = list(content) for i, item in enumerate(content): assert isinstance(item, BasePattern), (i, item) if isinstance(item, WildcardPattern): self.wildcards = True self.type = type self.content = content self.name = name def _submatch(self, node, results=None): """ Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. """ if self.wildcards: for c, r in generate_matches(self.content, node.children): if c == len(node.children): if results is not None: results.update(r) return True return False if len(self.content) != len(node.children): return False for subpattern, child in zip(self.content, node.children): if not subpattern.match(child, results): return False return True class WildcardPattern(BasePattern): """ A wildcard pattern can match zero or more nodes. This has all the flexibility needed to implement patterns like: .* .+ .? .{m,n} (a b c | d e | f) (...)* (...)+ (...)? (...){m,n} except it always uses non-greedy matching. """ def __init__(self, content=None, min=0, max=HUGE, name=None): """ Initializer. Args: content: optional sequence of subsequences of patterns; if absent, matches one node; if present, each subsequence is an alternative [*] min: optional minimum number of times to match, default 0 max: optional maximum number of times to match, default HUGE name: optional name assigned to this match [*] Thus, if content is [[a, b, c], [d, e], [f, g, h]] this is equivalent to (a b c | d e | f g h); if content is None, this is equivalent to '.' in regular expression terms. The min and max parameters work as follows: min=0, max=maxint: .* min=1, max=maxint: .+ min=0, max=1: .? min=1, max=1: . If content is not None, replace the dot with the parenthesized list of alternatives, e.g. (a b c | d e | f g h)* """ assert 0 <= min <= max <= HUGE, (min, max) if content is not None: content = tuple(map(tuple, content)) # Protect against alterations # Check sanity of alternatives assert len(content), repr(content) # Can't have zero alternatives for alt in content: assert len(alt), repr(alt) # Can have empty alternatives self.content = content self.min = min self.max = max self.name = name def optimize(self): """Optimize certain stacked wildcard patterns.""" subpattern = None if (self.content is not None and len(self.content) == 1 and len(self.content[0]) == 1): subpattern = self.content[0][0] if self.min == 1 and self.max == 1: if self.content is None: return NodePattern(name=self.name) if subpattern is not None and self.name == subpattern.name: return subpattern.optimize() if (self.min <= 1 and isinstance(subpattern, WildcardPattern) and subpattern.min <= 1 and self.name == subpattern.name): return WildcardPattern(subpattern.content, self.min*subpattern.min, self.max*subpattern.max, subpattern.name) return self def match(self, node, results=None): """Does this pattern exactly match a node?""" return self.match_seq([node], results) def match_seq(self, nodes, results=None): """Does this pattern exactly match a sequence of nodes?""" for c, r in self.generate_matches(nodes): if c == len(nodes): if results is not None: results.update(r) if self.name: results[self.name] = list(nodes) return True return False def generate_matches(self, nodes): """ Generator yielding matches for a sequence of nodes. Args: nodes: sequence of nodes Yields: (count, results) tuples where: count: the match comprises nodes[:count]; results: dict containing named submatches. """ if self.content is None: # Shortcut for special case (see __init__.__doc__) for count in range(self.min, 1 + min(len(nodes), self.max)): r = {} if self.name: r[self.name] = nodes[:count] yield count, r elif self.name == "bare_name": yield self._bare_name_matches(nodes) else: # The reason for this is that hitting the recursion limit usually # results in some ugly messages about how RuntimeErrors are being # ignored. We only have to do this on CPython, though, because other # implementations don't have this nasty bug in the first place. if hasattr(sys, "getrefcount"): save_stderr = sys.stderr sys.stderr = StringIO() try: for count, r in self._recursive_matches(nodes, 0): if self.name: r[self.name] = nodes[:count] yield count, r except RuntimeError: # Fall back to the iterative pattern matching scheme if the # recursive scheme hits the recursion limit (RecursionError). for count, r in self._iterative_matches(nodes): if self.name: r[self.name] = nodes[:count] yield count, r finally: if hasattr(sys, "getrefcount"): sys.stderr = save_stderr def _iterative_matches(self, nodes): """Helper to iteratively yield the matches.""" nodelen = len(nodes) if 0 >= self.min: yield 0, {} results = [] # generate matches that use just one alt from self.content for alt in self.content: for c, r in generate_matches(alt, nodes): yield c, r results.append((c, r)) # for each match, iterate down the nodes while results: new_results = [] for c0, r0 in results: # stop if the entire set of nodes has been matched if c0 < nodelen and c0 <= self.max: for alt in self.content: for c1, r1 in generate_matches(alt, nodes[c0:]): if c1 > 0: r = {} r.update(r0) r.update(r1) yield c0 + c1, r new_results.append((c0 + c1, r)) results = new_results def _bare_name_matches(self, nodes): """Special optimized matcher for bare_name.""" count = 0 r = {} done = False max = len(nodes) while not done and count < max: done = True for leaf in self.content: if leaf[0].match(nodes[count], r): count += 1 done = False break r[self.name] = nodes[:count] return count, r def _recursive_matches(self, nodes, count): """Helper to recursively yield the matches.""" assert self.content is not None if count >= self.min: yield 0, {} if count < self.max: for alt in self.content: for c0, r0 in generate_matches(alt, nodes): for c1, r1 in self._recursive_matches(nodes[c0:], count+1): r = {} r.update(r0) r.update(r1) yield c0 + c1, r class NegatedPattern(BasePattern): def __init__(self, content=None): """ Initializer. The argument is either a pattern or None. If it is None, this only matches an empty sequence (effectively '$' in regex lingo). If it is not None, this matches whenever the argument pattern doesn't have any matches. """ if content is not None: assert isinstance(content, BasePattern), repr(content) self.content = content def match(self, node): # We never match a node in its entirety return False def match_seq(self, nodes): # We only match an empty sequence of nodes in its entirety return len(nodes) == 0 def generate_matches(self, nodes): if self.content is None: # Return a match if there is an empty sequence if len(nodes) == 0: yield 0, {} else: # Return a match if the argument pattern has no matches for c, r in self.content.generate_matches(nodes): return yield 0, {} def generate_matches(patterns, nodes): """ Generator yielding matches for a sequence of patterns and nodes. Args: patterns: a sequence of patterns nodes: a sequence of nodes Yields: (count, results) tuples where: count: the entire sequence of patterns matches nodes[:count]; results: dict containing named submatches. """ if not patterns: yield 0, {} else: p, rest = patterns[0], patterns[1:] for c0, r0 in p.generate_matches(nodes): if not rest: yield c0, r0 else: for c1, r1 in generate_matches(rest, nodes[c0:]): r = {} r.update(r0) r.update(r1) yield c0 + c1, r PK1]~D>]>] refactor.pyonu[ {fc@sdZddlmZdZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZmZmZddlmZdd lmZmZdd lmZdd lmZed Zd efdYZdZdZdZ dZ!ej"ddfkrgddl#Z#e#j$Z%dZ&dZ'ne$Z%e!Z&e!Z'dZ(defdYZ)de*fdYZ+defdYZ,de+fdYZ-dS( sRefactoring framework. Used as a main program, this can refactor any number of files and/or recursively descend down directories. Imported as a module, this provides infrastructure to write your own refactoring tool. i(twith_statements#Guido van Rossum N(tchaini(tdriverttokenizettoken(t find_root(tpytreetpygram(t btm_utils(t btm_matchercCszt|ggdg}g}xUtj|jD]A\}}}|jdr1|rb|d}n|j|q1q1W|S(sEReturn a sorted list of all available fix names in the given package.t*tfix_i(t __import__tpkgutilt iter_modulest__path__t startswithtappend(t fixer_pkgt remove_prefixtpkgt fix_namestfindertnametispkg((s(/usr/lib64/python2.7/lib2to3/refactor.pytget_all_fix_names"s" t _EveryNodecBseZRS((t__name__t __module__(((s(/usr/lib64/python2.7/lib2to3/refactor.pyR.scCst|tjtjfrC|jdkr3tnt|jgSt|tjrt|j rkt |j Stnt|tj rt}x5|j D]*}x!|D]}|j t |qWqW|St d|dS(sf Accepts a pytree Pattern Node and returns a set of the pattern types which will match first. s$Oh no! I don't understand pattern %sN(t isinstanceRt NodePatternt LeafPatternttypetNoneRtsettNegatedPatterntcontentt_get_head_typestWildcardPatterntupdatet Exception(tpattrtptx((s(/usr/lib64/python2.7/lib2to3/refactor.pyR%2s      cCstjt}g}x|D]}|jryt|j}Wntk r^|j|qXxU|D]}||j|qfWq|jdk r||jj|q|j|qWx:t t j j j t j jD]}||j|qWt|S(s^ Accepts a list of fixers and returns a dictionary of head node type --> fixer list. N(t collectionst defaultdicttlisttpatternR%RRt _accept_typeR!RRtpython_grammart symbol2numbert itervaluesttokenstextendtdict(t fixer_listt head_nodesteverytfixertheadst node_type((s(/usr/lib64/python2.7/lib2to3/refactor.pyt_get_headnode_dictNs"    cCs(gt|tD]}|d|^qS(sN Return the fully qualified names for fixers in the package pkg_name. t.(RtFalse(tpkg_nametfix_name((s(/usr/lib64/python2.7/lib2to3/refactor.pytget_fixers_from_packagegscCs|S(N((tobj((s(/usr/lib64/python2.7/lib2to3/refactor.pyt _identitynsiicCs|jddS(Nu u (treplace(tinput((s(/usr/lib64/python2.7/lib2to3/refactor.pyt_from_system_newlinesuscCs*tjdkr"|jdtjS|SdS(Ns u (tostlinesepRF(RG((s(/usr/lib64/python2.7/lib2to3/refactor.pyt_to_system_newlineswscst}tjtj|jfd}ttjtjtj f}t }ykxdt r|\}}||krq]q]|tj kr|rPnt }q]|tj kr|dkr|\}}|tj ks|dkrPn|\}}|tj ks|dkrPn|\}}|tjkrY|dkrY|\}}nxa|tj kr|j||\}}|tjks|dkrPn|\}}q\Wq]Pq]WWntk rnXt|S(Ncsj}|d|dfS(Nii(tnext(ttok(tgen(s(/usr/lib64/python2.7/lib2to3/refactor.pytadvances ufromu __future__uimportu(u,(R@Rtgenerate_tokenstStringIOtreadlinet frozensetRtNEWLINEtNLtCOMMENTR"tTruetSTRINGtNAMEtOPtaddt StopIteration(tsourcethave_docstringROtignoretfeaturesttptvalue((RNs(/usr/lib64/python2.7/lib2to3/refactor.pyt_detect_future_featuressD       t FixerErrorcBseZdZRS(sA fixer could not be loaded.(RRt__doc__(((s(/usr/lib64/python2.7/lib2to3/refactor.pyRdstRefactoringToolcBs!eZied6ed6ZdZdZdddZdZdZ dZ dZ d Z eed Z eed Zd Zeed ZdZedZdZdZdeddZddZdZdZdZdZdZdZdZdZRS(tprint_functiontwrite_unchanged_filestFixR cCs||_|pg|_|jj|_|dk rI|jj|n|jdretj|_ n tj |_ |jj d|_ g|_ tjd|_g|_t|_tj|j dtjd|j|_|j\|_|_g|_tj|_g|_g|_ x}t!|j|jD]f}|j"rT|jj#|q2||jkrv|jj$|q2||jkr2|j j$|q2q2Wt%|j|_&t%|j |_'dS(sInitializer. Args: fixer_names: a list of fixers to import options: a dict with configuration. explicit: a list of fixers to run even if they are explicit. RgRhRftconverttloggerN((tfixerstexplicitt_default_optionstcopytoptionsR!R'Rt!python_grammar_no_print_statementtgrammarR2tgetRhterrorstloggingt getLoggerRkt fixer_logR@twroteRtDriverRRjt get_fixerst pre_ordert post_ordertfilestbmt BottomMatchertBMt bmi_pre_ordertbmi_post_orderRt BM_compatiblet add_fixerRR>tbmi_pre_order_headstbmi_post_order_heads(tselft fixer_namesRpRmR;((s(/usr/lib64/python2.7/lib2to3/refactor.pyt__init__s<            c Csg}g}x|jD]}t|iidg}|jddd}|j|jrr|t|j}n|jd}|jdjg|D]}|j ^q}yt ||} Wn't k rt d||fnX| |j |j} | jr?|jtk r?||jkr?|jd|qn|jd || jd krn|j| q| jd kr|j| qt d | jqWtjd } |jd| |jd| ||fS(sInspects the options to load the requested patterns and handlers. Returns: (pre_order, post_order), where pre_order is the list of fixers that want a pre-order AST traversal, and post_order is the list that want post-order traversal. R R?iit_tsCan't find %s.%ssSkipping optional fixer: %ssAdding transformation: %stpretpostsIllegal fixer order: %rt run_ordertkey(RlR trsplitRt FILE_PREFIXtlentsplitt CLASS_PREFIXtjointtitletgetattrtAttributeErrorRdRpRwRmRWt log_messaget log_debugtorderRtoperatort attrgettertsort( Rtpre_order_fixerstpost_order_fixerst fix_mod_pathtmodRBtpartsR+t class_namet fix_classR;tkey_func((s(/usr/lib64/python2.7/lib2to3/refactor.pyRzs8/ cOsdS(sCalled when an error occurs.N((Rtmsgtargstkwds((s(/usr/lib64/python2.7/lib2to3/refactor.pyt log_errorscGs'|r||}n|jj|dS(sHook to log a message.N(Rktinfo(RRR((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs cGs'|r||}n|jj|dS(N(Rktdebug(RRR((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs cCsdS(sTCalled with the old version, new version, and filename of a refactored file.N((Rtold_texttnew_texttfilenametequal((s(/usr/lib64/python2.7/lib2to3/refactor.pyt print_output!scCsPxI|D]A}tjj|r5|j|||q|j|||qWdS(s)Refactor a list of files and directories.N(RItpathtisdirt refactor_dirt refactor_file(Rtitemstwritet doctests_onlyt dir_or_file((s(/usr/lib64/python2.7/lib2to3/refactor.pytrefactor&s c Cstjd}xtj|D]\}}}|jd||j|jxe|D]]}|jd rWtjj|d|krWtjj||} |j | ||qWqWWg|D]} | jds| ^q|(qWdS(sDescends down a directory and refactor every Python file found. Python files are assumed to have a .py extension. Files and subdirectories starting with '.' are skipped. tpysDescending into %sR?iN( RItextseptwalkRRRRtsplitextRR( Rtdir_nameRRtpy_exttdirpathtdirnamest filenamesRtfullnametdn((s(/usr/lib64/python2.7/lib2to3/refactor.pyR/s    cCsyt|d}Wn'tk r<}|jd||dSXztj|jd}Wd|jXt|dd|}t |j |fSWdQXdS(sG Do our best to decode a Python source file correctly. trbsCan't open %s: %siNR*tencoding(NN( topentIOErrorRR!Rtdetect_encodingRRtcloset_open_with_encodingRHtread(RRtfterrR((s(/usr/lib64/python2.7/lib2to3/refactor.pyt_read_python_sourceCs cCs|j|\}}|dkr%dS|d7}|r|jd||j||}|jsl||kr|j|||||q|jd|nc|j||}|js|r|jr|jt|d |d|d|n|jd|dS( sRefactors a file.Nu sRefactoring doctests in %ssNo doctest changes in %siRRsNo changes in %s( RR!Rtrefactor_docstringRhtprocessed_filetrefactor_stringt was_changedtunicode(RRRRRGRtoutputttree((s(/usr/lib64/python2.7/lib2to3/refactor.pyRSs  cCst|}d|kr*tj|j_nzMy|jj|}Wn0tk ru}|jd||jj |dSXWd|j|j_X||_ |j d||j |||S(sFRefactor a given input string. Args: data: a string holding the code to be refactored. name: a human-readable name for use in error/log messages. Returns: An AST corresponding to the refactored input stream; None if there were errors during the parse. RgsCan't parse %s: %s: %sNsRefactoring %s( RcRRqRRrt parse_stringR(Rt __class__Rtfuture_featuresRt refactor_tree(RtdataRR`RR((s(/usr/lib64/python2.7/lib2to3/refactor.pyRjs     cCstjj}|ro|jd|j|d}|jsI||kr_|j|d|q|jdnS|j|d}|js|r|jr|jt |d|n |jddS(NsRefactoring doctests in stdinssNo doctest changes in stdinsNo changes in stdin( tsyststdinRRRRhRRRR(RRRGRR((s(/usr/lib64/python2.7/lib2to3/refactor.pytrefactor_stdins c Csx-t|j|jD]}|j||qW|j|j|j|j|j|j|jj|j }xt |j rcx|jj D]}||kr||r||j dtjjdt|jr||j dtjjnx[t||D]F}|||kr9||j|nyt|Wntk r]qnX|jr|||jkr|qn|j|}|r|j||}|dk rU|j|x9|jD]+}|jsg|_n|jj|qW|jj|j }x?|D]4} | |kr6g|| >> s... c Csg}d}d}d}d}x+|jtD]}|d7}|jj|jr|dk r|j|j||||n|}|g}|j|j} || }q.|dk r|j||j s|||j j dkr|j |q.|dk r/|j|j||||nd}d}|j |q.W|dk rz|j|j||||ndj |S(sRefactors a docstring, looking for doctests. This returns a modified version of the input string. It looks for doctests, which start with a ">>>" prompt, and may be continued with "..." prompts, as long as the "..." is indented the same as the ">>>". (Unfortunately we can't use the doctest module's parser, since, like most parsers, it is not geared towards preserving the original source.) iiu uN( R!t splitlinesRWtlstripRtPS1R6trefactor_doctesttfindtPS2trstripRR( RRGRtresulttblockt block_linenotindenttlinenotlineti((s(/usr/lib64/python2.7/lib2to3/refactor.pyR(s:        c CsPy|j|||}Wnutk r}|jjtjrmx*|D]}|jd|jdqGWn|jd|||j j ||SX|j ||rLt |j t}||d ||d} }|djds|dcd7>>" (possibly indented), while the remaining lines start with "..." (identically indented). s Source: %su s+Can't parse docstring in %s line %s: %s: %siii(t parse_blockR(Rkt isEnabledForRutDEBUGRRRRRRRRRWtendswithRtpopR( RRRRRRRRRtclipped((s(/usr/lib64/python2.7/lib2to3/refactor.pyRSs$   .cCs|jrd}nd}|js4|jd|n1|jd|x|jD]}|j|qNW|jr|jdx!|jD]}|j|qWn|jrt|jdkr|jdn|jdt|jx0|jD]"\}}}|j|||qWndS( Ntweres need to besNo files %s modified.sFiles that %s modified:s$Warnings/messages while refactoring:isThere was 1 error:sThere were %d errors:(RxR}RRwRtR(RRtfiletmessageRRR((s(/usr/lib64/python2.7/lib2to3/refactor.pyt summarizeps$      cCs1|jj|j|||}t|_|S(sParses a block into a tree. This is necessary to get correct line number / offset information in the parser diagnostics and embedded into the parse tree. (Rt parse_tokenst wrap_toksRSR(RRRRR((s(/usr/lib64/python2.7/lib2to3/refactor.pyR s! c cstj|j||j}xe|D]]\}}\}}\} } } ||d7}| |d7} ||||f| | f| fVq%WdS(s;Wraps a tokenize stream to systematically modify start/end.iN(RRPt gen_linesRL( RRRRR5R Rbtline0tcol0tline1tcol1t line_text((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs (ccs||j}||j}|}xi|D]a}|j|rN|t|Vn4||jdkrldVntd||f|}q'WxtrdVqWdS(sGenerates lines as expected by tokenize from a list of lines. This strips the first len(indent + self.PS1) characters off each line. u sline=%r, prefix=%rRN(RRRRRtAssertionErrorRW(RRRtprefix1tprefix2tprefixR((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs     N(RRR@RnRRR!RRzRRRRRRRRRRRRRRRRRRRR RR(((s(/usr/lib64/python2.7/lib2to3/refactor.pyRfs:  4 (         O    +   tMultiprocessingUnsupportedcBseZRS((RR(((s(/usr/lib64/python2.7/lib2to3/refactor.pyRstMultiprocessRefactoringToolcBs5eZdZeeddZdZdZRS(cOs/tt|j||d|_d|_dS(N(tsuperR RR!tqueuet output_lock(RRtkwargs((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs ic Csf|dkr(tt|j|||Syddl}Wntk rQtnX|jdk rptdn|j |_|j |_ gt |D]}|j d|j^q}z;x|D]}|jqWtt|j|||Wd|jjx$t |D]}|jjdqWx'|D]}|jr5|jq5q5Wd|_XdS(Niis already doing multiple processesttarget(R!R Rtmultiprocessingt ImportErrorRR"R!t RuntimeErrort JoinableQueuetLockR#txrangetProcesst_childtstartRtputtis_alive( RRRRt num_processesR&Rt processesR+((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs2    +     cCso|jj}xY|dk rj|\}}ztt|j||Wd|jjX|jj}qWdS(N(R"RsR!R!R Rt task_done(RttaskRR$((s(/usr/lib64/python2.7/lib2to3/refactor.pyR-s cOsE|jdk r(|jj||fntt|j||SdS(N(R"R!R/R!R R(RRR$((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs(RRRR@RR-R(((s(/usr/lib64/python2.7/lib2to3/refactor.pyR s    (.Ret __future__Rt __author__RIR RRuRR-RQt itertoolsRtpgen2RRRt fixer_utilRRRRRtbuR R~RWRR(RR%R>RCREt version_infotcodecsRRRHRKRcRdtobjectRfRR (((s(/usr/lib64/python2.7/lib2to3/refactor.pyt sH                 (PK1]̽~Th]h] refactor.pycnu[ {fc@sdZddlmZdZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZmZmZddlmZdd lmZmZdd lmZdd lmZed Zd efdYZdZdZdZ dZ!ej"ddfkrgddl#Z#e#j$Z%dZ&dZ'ne$Z%e!Z&e!Z'dZ(defdYZ)de*fdYZ+defdYZ,de+fdYZ-dS( sRefactoring framework. Used as a main program, this can refactor any number of files and/or recursively descend down directories. Imported as a module, this provides infrastructure to write your own refactoring tool. i(twith_statements#Guido van Rossum N(tchaini(tdriverttokenizettoken(t find_root(tpytreetpygram(t btm_utils(t btm_matchercCszt|ggdg}g}xUtj|jD]A\}}}|jdr1|rb|d}n|j|q1q1W|S(sEReturn a sorted list of all available fix names in the given package.t*tfix_i(t __import__tpkgutilt iter_modulest__path__t startswithtappend(t fixer_pkgt remove_prefixtpkgt fix_namestfindertnametispkg((s(/usr/lib64/python2.7/lib2to3/refactor.pytget_all_fix_names"s" t _EveryNodecBseZRS((t__name__t __module__(((s(/usr/lib64/python2.7/lib2to3/refactor.pyR.scCst|tjtjfrC|jdkr3tnt|jgSt|tjrt|j rkt |j Stnt|tj rt}x5|j D]*}x!|D]}|j t |qWqW|St d|dS(sf Accepts a pytree Pattern Node and returns a set of the pattern types which will match first. s$Oh no! I don't understand pattern %sN(t isinstanceRt NodePatternt LeafPatternttypetNoneRtsettNegatedPatterntcontentt_get_head_typestWildcardPatterntupdatet Exception(tpattrtptx((s(/usr/lib64/python2.7/lib2to3/refactor.pyR%2s      cCstjt}g}x|D]}|jryt|j}Wntk r^|j|qXxU|D]}||j|qfWq|jdk r||jj|q|j|qWx:t t j j j t j jD]}||j|qWt|S(s^ Accepts a list of fixers and returns a dictionary of head node type --> fixer list. N(t collectionst defaultdicttlisttpatternR%RRt _accept_typeR!RRtpython_grammart symbol2numbert itervaluesttokenstextendtdict(t fixer_listt head_nodesteverytfixertheadst node_type((s(/usr/lib64/python2.7/lib2to3/refactor.pyt_get_headnode_dictNs"    cCs(gt|tD]}|d|^qS(sN Return the fully qualified names for fixers in the package pkg_name. t.(RtFalse(tpkg_nametfix_name((s(/usr/lib64/python2.7/lib2to3/refactor.pytget_fixers_from_packagegscCs|S(N((tobj((s(/usr/lib64/python2.7/lib2to3/refactor.pyt _identitynsiicCs|jddS(Nu u (treplace(tinput((s(/usr/lib64/python2.7/lib2to3/refactor.pyt_from_system_newlinesuscCs*tjdkr"|jdtjS|SdS(Ns u (tostlinesepRF(RG((s(/usr/lib64/python2.7/lib2to3/refactor.pyt_to_system_newlineswscst}tjtj|jfd}ttjtjtj f}t }ykxdt r|\}}||krq]q]|tj kr|rPnt }q]|tj kr|dkr|\}}|tj ks|dkrPn|\}}|tj ks|dkrPn|\}}|tjkrY|dkrY|\}}nxa|tj kr|j||\}}|tjks|dkrPn|\}}q\Wq]Pq]WWntk rnXt|S(Ncsj}|d|dfS(Nii(tnext(ttok(tgen(s(/usr/lib64/python2.7/lib2to3/refactor.pytadvances ufromu __future__uimportu(u,(R@Rtgenerate_tokenstStringIOtreadlinet frozensetRtNEWLINEtNLtCOMMENTR"tTruetSTRINGtNAMEtOPtaddt StopIteration(tsourcethave_docstringROtignoretfeaturesttptvalue((RNs(/usr/lib64/python2.7/lib2to3/refactor.pyt_detect_future_featuressD       t FixerErrorcBseZdZRS(sA fixer could not be loaded.(RRt__doc__(((s(/usr/lib64/python2.7/lib2to3/refactor.pyRdstRefactoringToolcBs!eZied6ed6ZdZdZdddZdZdZ dZ dZ d Z eed Z eed Zd Zeed ZdZedZdZdZdeddZddZdZdZdZdZdZdZdZdZRS(tprint_functiontwrite_unchanged_filestFixR cCs||_|pg|_|jj|_|dk rI|jj|n|jdretj|_ n tj |_ |jj d|_ g|_ tjd|_g|_t|_tj|j dtjd|j|_|j\|_|_g|_tj|_g|_g|_ x}t!|j|jD]f}|j"rT|jj#|q2||jkrv|jj$|q2||jkr2|j j$|q2q2Wt%|j|_&t%|j |_'dS(sInitializer. Args: fixer_names: a list of fixers to import options: a dict with configuration. explicit: a list of fixers to run even if they are explicit. RgRhRftconverttloggerN((tfixerstexplicitt_default_optionstcopytoptionsR!R'Rt!python_grammar_no_print_statementtgrammarR2tgetRhterrorstloggingt getLoggerRkt fixer_logR@twroteRtDriverRRjt get_fixerst pre_ordert post_ordertfilestbmt BottomMatchertBMt bmi_pre_ordertbmi_post_orderRt BM_compatiblet add_fixerRR>tbmi_pre_order_headstbmi_post_order_heads(tselft fixer_namesRpRmR;((s(/usr/lib64/python2.7/lib2to3/refactor.pyt__init__s<            c Csg}g}x|jD]}t|iidg}|jddd}|j|jrr|t|j}n|jd}|jdjg|D]}|j ^q}yt ||} Wn't k rt d||fnX| |j |j} | jr?|jtk r?||jkr?|jd|qn|jd || jd krn|j| q| jd kr|j| qt d | jqWtjd } |jd| |jd| ||fS(sInspects the options to load the requested patterns and handlers. Returns: (pre_order, post_order), where pre_order is the list of fixers that want a pre-order AST traversal, and post_order is the list that want post-order traversal. R R?iit_tsCan't find %s.%ssSkipping optional fixer: %ssAdding transformation: %stpretpostsIllegal fixer order: %rt run_ordertkey(RlR trsplitRt FILE_PREFIXtlentsplitt CLASS_PREFIXtjointtitletgetattrtAttributeErrorRdRpRwRmRWt log_messaget log_debugtorderRtoperatort attrgettertsort( Rtpre_order_fixerstpost_order_fixerst fix_mod_pathtmodRBtpartsR+t class_namet fix_classR;tkey_func((s(/usr/lib64/python2.7/lib2to3/refactor.pyRzs8/ cOsdS(sCalled when an error occurs.N((Rtmsgtargstkwds((s(/usr/lib64/python2.7/lib2to3/refactor.pyt log_errorscGs'|r||}n|jj|dS(sHook to log a message.N(Rktinfo(RRR((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs cGs'|r||}n|jj|dS(N(Rktdebug(RRR((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs cCsdS(sTCalled with the old version, new version, and filename of a refactored file.N((Rtold_texttnew_texttfilenametequal((s(/usr/lib64/python2.7/lib2to3/refactor.pyt print_output!scCsPxI|D]A}tjj|r5|j|||q|j|||qWdS(s)Refactor a list of files and directories.N(RItpathtisdirt refactor_dirt refactor_file(Rtitemstwritet doctests_onlyt dir_or_file((s(/usr/lib64/python2.7/lib2to3/refactor.pytrefactor&s c Cstjd}xtj|D]\}}}|jd||j|jxe|D]]}|jd rWtjj|d|krWtjj||} |j | ||qWqWWg|D]} | jds| ^q|(qWdS(sDescends down a directory and refactor every Python file found. Python files are assumed to have a .py extension. Files and subdirectories starting with '.' are skipped. tpysDescending into %sR?iN( RItextseptwalkRRRRtsplitextRR( Rtdir_nameRRtpy_exttdirpathtdirnamest filenamesRtfullnametdn((s(/usr/lib64/python2.7/lib2to3/refactor.pyR/s    cCsyt|d}Wn'tk r<}|jd||dSXztj|jd}Wd|jXt|dd|}t |j |fSWdQXdS(sG Do our best to decode a Python source file correctly. trbsCan't open %s: %siNR*tencoding(NN( topentIOErrorRR!Rtdetect_encodingRRtcloset_open_with_encodingRHtread(RRtfterrR((s(/usr/lib64/python2.7/lib2to3/refactor.pyt_read_python_sourceCs cCs|j|\}}|dkr%dS|d7}|r|jd||j||}|jsl||kr|j|||||q|jd|nc|j||}|js|r|jr|jt|d |d|d|n|jd|dS( sRefactors a file.Nu sRefactoring doctests in %ssNo doctest changes in %siRRsNo changes in %s( RR!Rtrefactor_docstringRhtprocessed_filetrefactor_stringt was_changedtunicode(RRRRRGRtoutputttree((s(/usr/lib64/python2.7/lib2to3/refactor.pyRSs  cCst|}d|kr*tj|j_nzMy|jj|}Wn0tk ru}|jd||jj |dSXWd|j|j_X||_ |j d||j |||S(sFRefactor a given input string. Args: data: a string holding the code to be refactored. name: a human-readable name for use in error/log messages. Returns: An AST corresponding to the refactored input stream; None if there were errors during the parse. RgsCan't parse %s: %s: %sNsRefactoring %s( RcRRqRRrt parse_stringR(Rt __class__Rtfuture_featuresRt refactor_tree(RtdataRR`RR((s(/usr/lib64/python2.7/lib2to3/refactor.pyRjs     cCstjj}|ro|jd|j|d}|jsI||kr_|j|d|q|jdnS|j|d}|js|r|jr|jt |d|n |jddS(NsRefactoring doctests in stdinssNo doctest changes in stdinsNo changes in stdin( tsyststdinRRRRhRRRR(RRRGRR((s(/usr/lib64/python2.7/lib2to3/refactor.pytrefactor_stdins c Csx-t|j|jD]}|j||qW|j|j|j|j|j|j|jj|j }xt |j rcx|jj D]}||kr||r||j dtjjdt|jr||j dtjjnx[t||D]F}|||kr9||j|nyt|Wntk r]qnX|jr|||jkr|qn|j|}|r|j||}|dk rU|j|x9|jD]+}|jsg|_n|jj|qW|jj|j }x?|D]4} | |kr6g|| >> s... c Csg}d}d}d}d}x+|jtD]}|d7}|jj|jr|dk r|j|j||||n|}|g}|j|j} || }q.|dk r|j||j s|||j j dkr|j |q.|dk r/|j|j||||nd}d}|j |q.W|dk rz|j|j||||ndj |S(sRefactors a docstring, looking for doctests. This returns a modified version of the input string. It looks for doctests, which start with a ">>>" prompt, and may be continued with "..." prompts, as long as the "..." is indented the same as the ">>>". (Unfortunately we can't use the doctest module's parser, since, like most parsers, it is not geared towards preserving the original source.) iiu uN( R!t splitlinesRWtlstripRtPS1R6trefactor_doctesttfindtPS2trstripRR( RRGRtresulttblockt block_linenotindenttlinenotlineti((s(/usr/lib64/python2.7/lib2to3/refactor.pyR(s:        c Cssy|j|||}Wnutk r}|jjtjrmx*|D]}|jd|jdqGWn|jd|||j j ||SX|j ||rot |j t}||d ||d} }| dg|dkst| |djds|dcd7>>" (possibly indented), while the remaining lines start with "..." (identically indented). s Source: %su s+Can't parse docstring in %s line %s: %s: %siii(t parse_blockR(Rkt isEnabledForRutDEBUGRRRRRRRRRWtAssertionErrortendswithRtpopR( RRRRRRRRRtclipped((s(/usr/lib64/python2.7/lib2to3/refactor.pyRSs&   #.cCs|jrd}nd}|js4|jd|n1|jd|x|jD]}|j|qNW|jr|jdx!|jD]}|j|qWn|jrt|jdkr|jdn|jdt|jx0|jD]"\}}}|j|||qWndS( Ntweres need to besNo files %s modified.sFiles that %s modified:s$Warnings/messages while refactoring:isThere was 1 error:sThere were %d errors:(RxR}RRwRtR(RRtfiletmessageRRR((s(/usr/lib64/python2.7/lib2to3/refactor.pyt summarizeps$      cCs1|jj|j|||}t|_|S(sParses a block into a tree. This is necessary to get correct line number / offset information in the parser diagnostics and embedded into the parse tree. (Rt parse_tokenst wrap_toksRSR(RRRRR((s(/usr/lib64/python2.7/lib2to3/refactor.pyR s! c cstj|j||j}xe|D]]\}}\}}\} } } ||d7}| |d7} ||||f| | f| fVq%WdS(s;Wraps a tokenize stream to systematically modify start/end.iN(RRPt gen_linesRL( RRRRR5R Rbtline0tcol0tline1tcol1t line_text((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs (ccs||j}||j}|}xi|D]a}|j|rN|t|Vn4||jdkrldVntd||f|}q'WxtrdVqWdS(sGenerates lines as expected by tokenize from a list of lines. This strips the first len(indent + self.PS1) characters off each line. u sline=%r, prefix=%rRN(RRRRRR RW(RRRtprefix1tprefix2tprefixR((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs     N(RRR@RnRRR!RRzRRRRRRRRRRRRRRRRRRRR RR(((s(/usr/lib64/python2.7/lib2to3/refactor.pyRfs:  4 (         O    +   tMultiprocessingUnsupportedcBseZRS((RR(((s(/usr/lib64/python2.7/lib2to3/refactor.pyRstMultiprocessRefactoringToolcBs5eZdZeeddZdZdZRS(cOs/tt|j||d|_d|_dS(N(tsuperR RR!tqueuet output_lock(RRtkwargs((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs ic Csf|dkr(tt|j|||Syddl}Wntk rQtnX|jdk rptdn|j |_|j |_ gt |D]}|j d|j^q}z;x|D]}|jqWtt|j|||Wd|jjx$t |D]}|jjdqWx'|D]}|jr5|jq5q5Wd|_XdS(Niis already doing multiple processesttarget(R!R Rtmultiprocessingt ImportErrorRR"R!t RuntimeErrort JoinableQueuetLockR#txrangetProcesst_childtstartRtputtis_alive( RRRRt num_processesR&Rt processesR+((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs2    +     cCso|jj}xY|dk rj|\}}ztt|j||Wd|jjX|jj}qWdS(N(R"RsR!R!R Rt task_done(RttaskRR$((s(/usr/lib64/python2.7/lib2to3/refactor.pyR-s cOsE|jdk r(|jj||fntt|j||SdS(N(R"R!R/R!R R(RRR$((s(/usr/lib64/python2.7/lib2to3/refactor.pyRs(RRRR@RR-R(((s(/usr/lib64/python2.7/lib2to3/refactor.pyR s    (.Ret __future__Rt __author__RIR RRuRR-RQt itertoolsRtpgen2RRRt fixer_utilRRRRRtbuR R~RWRR(RR%R>RCREt version_infotcodecsRRRHRKRcRdtobjectRfRR (((s(/usr/lib64/python2.7/lib2to3/refactor.pyt sH                 (PK1]G&&Grammar2.7.18.final.0.picklenu[ccollections OrderedDict q]q(]q(Udfasqh]q(]q(M]q(]q(KKqKKq KKq e]q KKq aeh]q (]q(KKe]q(KKe]q(KKe]q(KKe]q(KKe]q(KKe]q(KKe]q(K Ke]q(K Ke]q(K Ke]q(K Ke]q(K Ke]q(KKe]q(KKe]q(KKe]q(KKe]q(KKe]q(KKe]q (KKe]q!(KKe]q"(KKe]q#(KKe]q$(KKe]q%(KKe]q&(KKe]q'(KKe]q((KKe]q)(KKe]q*(KKe]q+(KKe]q,(K Ke]q-(K!Ke]q.(K"Ke]q/(K#Ke]q0(K$Ke]q1(K%Ke]q2(K&Ke]q3(K'Keeq4Rq5q6e]q7(M]q8(]q9K(Kq:a]q;(K)Kq(]q?(KKe]q@(KKe]qA(KKe]qB(KKe]qC(K Ke]qD(K Ke]qE(K#Ke]qF(K$Ke]qG(K%Ke]qH(K&Ke]qI(K'KeeqJRqKqLe]qM(M]qN(]qOK*KqPa]qQ(K+KqRKKqSeeh]qT(]qU(KKe]qV(KKe]qW(KKe]qX(KKe]qY(K Ke]qZ(K Ke]q[(KKe]q\(K#Ke]q](K$Ke]q^(K%Ke]q_(K&Ke]q`(K'KeeqaRqbqce]qd(M]qe(]qfK,Kqga]qh(K-KqiKKqje]qk(K,KqlKKqmeeh]qn(]qo(KKe]qp(KKe]qq(KKe]qr(KKe]qs(KKe]qt(K Ke]qu(K Ke]qv(KKe]qw(KKe]qx(K#Ke]qy(K$Ke]qz(K%Ke]q{(K&Ke]q|(K'Ke]q}(K.Keeq~Rqqe]q(M]q(]q(K.KqK/KqK0Kqe]qK1Kqa]qKKqa]q(K2KqK3KqKKqe]qK0Kqaeh]q(]q(KKe]q(KKe]q(KKe]q(KKe]q(KKe]q(K Ke]q(K Ke]q(KKe]q(KKe]q(K#Ke]q(K$Ke]q(K%Ke]q(K&Ke]q(K'Ke]q(K.KeeqRqqe]q(M]q(]qK4Kqa]q(KKqKKqKKqeeh]q(]q(KKe]q(KKe]q(KKe]q(KKe]q(K Ke]q(K Ke]q(K#Ke]q(K$Ke]q(K%Ke]q(K&Ke]q(K'KeeqRqqe]q(M]q(]qK Kqa]qK0Kqa]q(K-KqKKqe]qK0Kqa]qKKqaeh]q]q(K KeaqRqˆqe]q(M]q(]q(KKqKKqK KqK KqK#KqK%KqK&KqK'Kqe]q(K5KqK6KqK7Kqe]qKK qa]q(K8KqK9K qe]qK:K qa]q(K;KqKKrK?KrK@KrKAKrKBKr KCKr KDKr KEKr KFKr KGKrKHKrKIKre]rKKraeh]r(]r(K=Ke]r(K>Ke]r(K?Ke]r(K@Ke]r(KAKe]r(KBKe]r(KCKe]r(KDKe]r(KEKe]r(KFKe]r(KGKe]r(KHKe]r (KIKeer!Rr"r#e]r$(M ]r%(]r&K Kr'a]r(KKr)aeh]r*]r+(K Kear,Rr-r.e]r/(M ]r0(]r1KKr2a]r3K%Kr4a]r5(KKr6KJKr7e]r8(K5Kr9KKKr:e]r;KLKr<a]r=KJKr>a]r?K5Kr@a]rAKKrBaeh]rC]rD(KKearERrFrGe]rH(M ]rI(]rJKKrKa]rLKMKrMa]rNKNKrOa]rPKOKrQa]rR(KPKrSKKrTe]rUKKrVaeh]rW]rX(KKearYRrZr[e]r\(M ]r](]r^KKr_a]r`KQKraa]rb(KPKrcKKrde]reKKrfaeh]rg]rh(KKeariRrjrke]rl(M ]rm(]rn(K3KroKRKrpe]rqKKrraeh]rs(]rt(KKe]ru(KKeervRrwrxe]ry(M]rz(]r{(KSKr|KTKr}KUKr~KSKrKVKrKWKrKXKrKNKrKYKrKKre]rKKra]r(KKrKKre]rKNKraeh]r(]r(KKe]r(KNKe]r(KSKe]r(KTKe]r(KUKe]r(KVKe]r(KWKe]r(KXKe]r(KYKeerRrre]r(M]r(]rK1Kra]r(KZKrKKreeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(M]r(]r(K[KrK\KrK]KrK^KrK_KrK`KrKaKrKbKre]rKKraeh]r(]r(K Ke]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K!KeerRrre]r(M]r(]rKKra]rKKraeh]r]r(KKearRrre]r(M]r(]rKcKra]r(K[KrK^Kre]rKKraeh]r]r(K KearRrre]r(M]r(]rK Kra]rKdKra]r(KKrKKre]r(K5KrKKKre]rKKra]rKKra]rK5Kraeh]r]r(K KearRrre]r(M]r(]rKeKra]r(KeKrKKreeh]r]r(K KearRrre]r(M]r(]rKKra]r KMKr a]r KKr aeh]r ]r(KKearRrre]r(M]r(]r(K.KrK/KrK0Kre]rK1Kra]r(K-KrK3KrKKre]r(K-KrKJKr K3Kr!KKr"e]r#(K-Kr$K3Kr%KKr&e]r'(K/K r(K0K r)KKr*e]r+KKr,a]r-K0Kr.a]r/(K.K r0K0K r1KKr2e]r3(K-Kr4KK r5e]r6K1K r7a]r8KJK r9a]r:(K-Kr;KK r<e]r=K0K r>aeh]r?(]r@(KKe]rA(KKe]rB(KKe]rC(KKe]rD(KKe]rE(K Ke]rF(K Ke]rG(KKe]rH(KKe]rI(K#Ke]rJ(K$Ke]rK(K%Ke]rL(K&Ke]rM(K'Ke]rN(K.KeerORrPrQe]rR(M]rS(]rTKdKrUa]rV(KfKrWKKrXe]rYK%KrZa]r[KKr\aeh]r]]r^(K%Kear_Rr`rae]rb(M]rc(]rdKgKrea]rf(K-KrgKKrheeh]ri]rj(K%KearkRrlrme]rn(M]ro(]rpK%Krqa]rr(KKrsKKrteeh]ru]rv(K%KearwRrxrye]rz(M]r{(]r|K%Kr}a]r~KKraeh]r]r(K%KearRrre]r(M]r(]rKhKra]r(KKrKKre]rKKraeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(KKe]r(KKe]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(M]r(]rKiKra]r(K0KrKKre]r(K-KrKfKrKKre]rK0Kra]rKKraeh]r]r(KiKearRrre]r(M]r(]rKKra]rK1Kra]r(KNKrKKre]rK0Kra]r(K-KrKKre]rK0Kra]rKKraeh]r]r(KKearRrre]r(M]r(]rKjKra]r(KkKrKKreeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(M]r(]rKlKra]r(K2KrKmKrKKre]r(KlKrK7Kre]r(KhKrK7Kre]r(K2KrKKre]rKKraeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(KKe]r(KKe]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(M ]r(]r(K1KrK/Kr e]r (K-Kr KKr e]r (K1KrK/KrKKreeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrr e]r!(M!]r"(]r#(KKr$KKr%K$Kr&KnKr'e]r(KoKr)a]r*KKr+aeh]r,(]r-(KKe]r.(KKe]r/(KKe]r0(KKe]r1(K Ke]r2(K Ke]r3(K#Ke]r4(K$Ke]r5(K%Ke]r6(K&Ke]r7(K'Keer8Rr9r:e]r;(M"]r<(]r=(KpKr>KqKr?KrKr@KsKrAKtKrBe]rCKKrDaeh]rE(]rF(K Ke]rG(KKe]rH(KKe]rI(KKe]rJ(K"KeerKRrLrMe]rN(M#]rO(]rPKKrQa]rRKMKrSa]rTKNKrUa]rVKhKrWa]rXKJKrYa]rZKLKr[a]r\(KuKr]KKr^e]r_KJKr`a]raKLK rba]rcKK rdaeh]re]rf(KKeargRrhrie]rj(M$]rk(]rlKKrma]rnK%Kroa]rpKvKrqa]rr(KwKrsKJKrte]ruK0Krva]rwKLKrxa]ryKJKrza]r{KKr|aeh]r}]r~(KKearRrre]r(M%]r(]r(KKrKKre]rK%Kra]r(K-KrKKreeh]r(]r(KKe]r(KKeerRrre]r(M&]r(]rKKra]rK0Kra]rKJKra]rKLKra]r(KxKrKuKrKKre]rKJKra]rKLKra]rKKraeh]r]r(KKearRrre]r(M']r(]rK%Kra]r(KfKrKKre]rK%Kra]rKKraeh]r]r(K%KearRrre]r(M(]r(]rKyKra]r(K-KrKKre]r(KyKrKKreeh]r]r(K%KearRrre]r(M)]r(]rKKra]r(KKrKdKre]r(KKrKKrKdKre]rKKra]r(KKrKKrKzKre]rKzKra]rKKra]rK5Kraeh]r]r(KKearRrre]r(M*]r(]rKKra]rK{Kra]rKKraeh]r]r(KKearRrre]r(M+]r(]r(K|KrK}Kre]rKKraeh]r(]r(KKe]r(KKeerRrre]r(M,]r(]rKKra]r(KJKrK~Kre]rK0Kra]r KJKr a]r KKr aeh]r ]r(KKearRrre]r(M-]r(]r(K/KrK0Kre]r(K-KrK3KrKKre]r(K/KrK0KrKKre]rKKr a]r!(K-Kr"KKr#eeh]r$(]r%(KKe]r&(KKe]r'(KKe]r((KKe]r)(KKe]r*(K Ke]r+(K Ke]r,(KKe]r-(KKe]r.(K#Ke]r/(K$Ke]r0(K%Ke]r1(K&Ke]r2(K'Keer3Rr4r5e]r6(M.]r7(]r8(KKr9KKr:e]r;K*Kr<a]r=KKr>aeh]r?(]r@(KKe]rA(KKe]rB(KKe]rC(KKe]rD(K Ke]rE(K Ke]rF(KKe]rG(K#Ke]rH(K$Ke]rI(K%Ke]rJ(K&Ke]rK(K'KeerLRrMrNe]rO(M/]rP(]rQKKrRa]rS(KJKrTK~KrUe]rVKQKrWa]rXKJKrYa]rZKKr[aeh]r\]r](KKear^Rr_r`e]ra(M0]rb(]rc(KKrdKKree]rfKKrgaeh]rh(]ri(KKe]rj(KKe]rk(KKe]rl(KKe]rm(K Ke]rn(K Ke]ro(KKe]rp(KKe]rq(K#Ke]rr(K$Ke]rs(K%Ke]rt(K&Ke]ru(K'KeervRrwrxe]ry(M1]rz(]r{KKr|a]r}(KKr~KKreeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(KKe]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(M2]r(]rKKra]r(K5KrKKre]rKKra]rK5Kraeh]r]r(KKearRrre]r(M3]r(]rKKra]rKKraeh]r]r(KKearRrre]r(M4]r(]rKKra]r(K.KrKKrKKre]rKoKra]rKKraeh]r(]r(KKe]r(KKe]r(K Ke]r(K Ke]r(K#Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(M5]r(]rKKra]r(KKrK0KrKKre]rK0Kra]r(K-KrKKre]r(K-KrKKre]r(K0KrKKre]rK0Kra]r(K-KrKKre]r(K0KrKKreeh]r]r(KKearRrre]r(M6]r(]rKKra]r(K0KrKKre]r(K-KrKKrKKre]rK0Kra]rK0Kra]r(K-KrKKre]rKKraeh]r]r(KKearRrre]r(M7]r(]rKKra]r(KhKrKKre]rKKraeh]r]r(KKearRrr e]r (M8]r (]r KKr a]r(KKrKKrKKreeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrr e]r!(M9]r"(]r#KKr$a]r%(KKr&KKr'e]r((KKr)KKr*e]r+KKr,aeh]r-(]r.(KKe]r/(KKe]r0(KKe]r1(KKe]r2(KKe]r3(K Ke]r4(K Ke]r5(K Ke]r6(K Ke]r7(KKe]r8(KKe]r9(KKe]r:(KKe]r;(KKe]r<(KKe]r=(KKe]r>(KKe]r?(KKe]r@(KKe]rA(KKe]rB(KKe]rC(KKe]rD(K"Ke]rE(K#Ke]rF(K$Ke]rG(K%Ke]rH(K&Ke]rI(K'KeerJRrKrLe]rM(M:]rN(]rO(KKrPKKrQKKrRe]rSKKrTa]rUKKrVaeh]rW(]rX(KKe]rY(KKe]rZ(KKe]r[(KKe]r\(KKe]r](KKe]r^(K Ke]r_(K Ke]r`(K Ke]ra(K Ke]rb(K Ke]rc(KKe]rd(KKe]re(KKe]rf(KKe]rg(KKe]rh(KKe]ri(KKe]rj(KKe]rk(KKe]rl(KKe]rm(KKe]rn(KKe]ro(KKe]rp(KKe]rq(KKe]rr(KKe]rs(KKe]rt(KKe]ru(K Ke]rv(K!Ke]rw(K"Ke]rx(K#Ke]ry(K$Ke]rz(K%Ke]r{(K&Ke]r|(K'Keer}Rr~re]r(M;]r(]rKJKra]r(K0KrKKre]rKKraeh]r]r(KJKearRrre]r(M<]r(]r(KKrKKrKKrKKrKKrKKrKKrKKrKKre]rKKraeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(K Ke]r(K Ke]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(K"Ke]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(M=]r(]rKKra]rK1Kra]rKKraeh]r]r(KKearRrre]r(M>]r(]r(KKrKKre]rKKraeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(K Ke]r(K Ke]r(K Ke]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K!Ke]r(K"Ke]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(M?]r(]r(KJKrK0Kre]r(KKrK0KrKKre]r(KJKrKKre]rKKra]r(KKrKKreeh]r (]r (KKe]r (KKe]r (KKe]r (KKe]r(K Ke]r(K Ke]r(KKe]r(KKe]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'Ke]r(KJKeerRrre]r(M@]r(]rKKra]r(K-Kr KKr!e]r"(KKr#KKr$eeh]r%(]r&(KKe]r'(KKe]r((KKe]r)(KKe]r*(K Ke]r+(K Ke]r,(KKe]r-(KKe]r.(K#Ke]r/(K$Ke]r0(K%Ke]r1(K&Ke]r2(K'Ke]r3(KJKeer4Rr5r6e]r7(MA]r8(]r9(KKr:KKr;e]r<KKr=a]r>KKr?a]r@KKrAa]rB(KKrCKKrDeeh]rE(]rF(KKe]rG(KKe]rH(KKe]rI(KKe]rJ(KKe]rK(KKe]rL(K Ke]rM(K Ke]rN(K Ke]rO(K Ke]rP(KKe]rQ(KKe]rR(KKe]rS(KKe]rT(KKe]rU(KKe]rV(KKe]rW(KKe]rX(KKe]rY(KKe]rZ(KKe]r[(KKe]r\(KKe]r](K"Ke]r^(K#Ke]r_(K$Ke]r`(K%Ke]ra(K&Ke]rb(K'KeercRrdree]rf(MB]rg(]rhKoKria]rj(KKrkKKrlKKrmKKrnK KroKKrpeeh]rq(]rr(KKe]rs(KKe]rt(KKe]ru(KKe]rv(K Ke]rw(K Ke]rx(K#Ke]ry(K$Ke]rz(K%Ke]r{(K&Ke]r|(K'Keer}Rr~re]r(MC]r(]r(KKrKKre]rKKra]r(KKrKKre]rKKra]rKuKra]rK0Kraeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(KKe]r(KKe]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(MD]r(]rK0Kra]r(K-KrKKre]r(K0KrKKreeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(KKe]r(KKe]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(ME]r(]rK0Kra]r(K-KrKKreeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(KKe]r(KKe]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(MF]r(]r(K/KrK0Kre]r(K-KrK3KrKKre]r(K/KrK0KrKKre]rKKra]r(K-KrKKreeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(KKe]r(KKe]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(MG]r(]rKQKra]r(K-KrKKre]rKQKra]r(K-KrKKre]r(KQKrKKreeh]r(]r(KKe]r (KKe]r (KKe]r (KKe]r (K Ke]r (K Ke]r(KKe]r(KKe]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(MH]r(]r(K/KrK0Kre]r(K-KrKKre]r (K/Kr!K0Kr"KKr#eeh]r$(]r%(KKe]r&(KKe]r'(KKe]r((KKe]r)(KKe]r*(K Ke]r+(K Ke]r,(KKe]r-(KKe]r.(K#Ke]r/(K$Ke]r0(K%Ke]r1(K&Ke]r2(K'Keer3Rr4r5e]r6(MI]r7(]r8(KKr9KKr:e]r;KKr<a]r=KKr>a]r?K5Kr@aeh]rA(]rB(KKe]rC(K%KeerDRrErFe]rG(MJ]rH(]rIKKrJa]rK(K-KrLKKrMe]rN(KKrOKKrPeeh]rQ(]rR(KKe]rS(K%KeerTRrUrVe]rW(MK]rX(]rYK%KrZa]r[(KJKr\KKr]e]r^K0Kr_a]r`KKraaeh]rb]rc(K%KeardRrerfe]rg(ML]rh(]ri(KKrjKKrkK Krle]rm(K5KrnKKKroe]rpK%Krqa]rrKKrsa]rtKKrua]rvK5Krwa]rxK8Kryaeh]rz(]r{(KKe]r|(KKe]r}(K Keer~Rrre]r(MM]r(]rKKra]rKJKra]rKLKra]r(KKrKKre]rKJKra]rKJKra]rKLKra]rKLK ra]rKKra]r(KuK rKKrKKrKK re]rKJK ra]rKLK ra]r(KKrKK reeh]r]r(KKearRrre]r(MN]r(]r(KKrK.KrKKre]r(K-KrKKrKKre]rKKra]r(K-KrK2KrKKre]r(K.KrKK re]r(K-KrKKre]rKKra]r(KKrK.KrKKrKKre]rK0K ra]r(K-KrK2K rKK re]r(K-KrKK re]rK0Kraeh]r(]r(KKe]r(KKe]r(K%Ke]r(K.KeerRrre]r(MO]r(]r(KKrK.KrKKre]r(K-KrKKrKKre]rKKra]r(K-KrK2KrKKre]r(K.KrKK re]r(K-KrKKre]rKKra]r(KKrK.KrKKrKKre]rK0K ra]r(K-KrK2K rKK re]r(K-KrKK re]rK0Kraeh]r(]r(KKe]r(KKe]r(K%Ke]r(K.KeerRrre]r(MP]r(]r (KKr KKr e]r KKr a]rKKra]rK5Kraeh]r(]r(KKe]r(K%KeerRrre]r(MQ]r(]rKKra]r(K-KrKKre]r(KKr KKr!eeh]r"(]r#(KKe]r$(K%Keer%Rr&r'e]r((MR]r)(]r*K%Kr+a]r,KKr-aeh]r.]r/(K%Kear0Rr1r2e]r3(MS]r4(]r5K Kr6a]r7K0Kr8a]r9KJKr:a]r;KLKr<a]r=(KuKr>KKr?e]r@KJKrAa]rBKLKrCa]rDKKrEaeh]rF]rG(K KearHRrIrJe]rK(MT]rL(]rMK0KrNa]rO(KfKrPKKrQe]rRK1KrSa]rTKKrUaeh]rV(]rW(KKe]rX(KKe]rY(KKe]rZ(KKe]r[(K Ke]r\(K Ke]r](KKe]r^(KKe]r_(K#Ke]r`(K$Ke]ra(K%Ke]rb(K&Ke]rc(K'KeerdRrerfe]rg(MU]rh(]riK!Krja]rkKKrla]rm(K-KrnKJKroe]rpKLKrqa]rrKKrsaeh]rt]ru(K!KearvRrwrxe]ry(MV]rz(]r{KfKr|a]r}K1Kr~a]rKKraeh]r]r(KfKearRrre]r(MW]r(]rKKra]r(KKrKKreeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(MX]r(]r(KKrKhKre]rK0Kra]rKKraeh]r(]r(KKe]r(KKe]r(KKe]r(KKe]r(K Ke]r(K Ke]r(KKe]r(KKe]r(KKe]r(K#Ke]r(K$Ke]r(K%Ke]r(K&Ke]r(K'KeerRrre]r(MY]r(]rK"Kra]r(KKrKKre]rKKraeh]r]r(K"KearRrre]r(MZ]r(]rK7Kra]rKKraeh]r]r(K"KearRrreerRre]r(Ukeywordsrh]r(]r(UandrK+e]r(UasrKfe]r(UassertrK e]r(UbreakrK e]r(UclassrKe]r(UcontinuerKe]r(UdefrKe]r(UdelrKe]r(UelifrKxe]r(UelserKue]r(UexceptrKie]r(UexecrKe]r(UfinallyrKe]r(UforrKe]r(UfromrKe]r(UglobalrKe]r(UifrKe]r(UimportrKe]r(UinrKNe]r(UisrKYe]r(UlambdarKe]r(Unonlocalr Ke]r (Unotr Ke]r (Uorr Ke]r (Upassr Ke]r (Uprintr Ke]r (Uraiser Ke]r (Ureturnr Ke]r (Utryr Ke]r (Uwhiler K e]r (Uwithr K!e]r (Uyieldr K"eer Rr e]r (Ulabelsr ]r (KUEMPTYr r KNr KNr M>Nr KNr KNr KNr! KNr" KNr# K2Nr$ K Nr% KNr& Kjr' Kjr( Kjr) Kjr* Kjr+ Kjr, Kjr- Kjr. Kjr/ Kjr0 Kjr1 Kjr2 Kjr3 Kj r4 Kj r5 Kj r6 Kj r7 Kj r8 Kj r9 Kj r: Kj r; Kj r< Kj r= KNr> K Nr? KNr@ KNrA KNrB M8NrC KNrD M.NrE KjrF MNrG K NrH K$NrI M=NrJ MCNrK MNrL KNrM M NrN MBNrO KNrP MFNrQ MYNrR K NrS M-NrT MENrU KNrV MNrW K)NrX K*NrY K/NrZ K'Nr[ K%Nr\ K&Nr] K1Nr^ K(Nr_ K-Nr` K.Nra K3Nrb K,Nrc K+Nrd K Nre MNrf MANrg M Nrh Kjri MGNrj M Nrk M0Nrl M Nrm KNrn KNro KNrp KNrq KNrr KNrs Kjrt MNru M Nrv MNrw M#Nrx M$Nry M&Nrz MMNr{ MSNr| MUNr} MNr~ MNr MNr Kjr MNr MDNr Kjr MWNr KNr MHNr MNr M4Nr M!Nr M Nr MNr M6Nr M7Nr MZNr Kjr M2Nr K7Nr Kjr M'Nr M(Nr MNr M)Nr M*Nr MONr MNr M/Nr M1Nr MNr Kj r MNNr MNr MLNr K#Nr MNr K"Nr M<Nr K Nr MNr M9Nr MNr MNr MNr MNr M"Nr M%Nr M+Nr M3Nr M5Nr M;Nr M?Nr KNr KNr KNr KNr K0Nr M,Nr MKNr MJNr MINr M@Nr Kjr MNr MPNr MRNr MQNr MTNr MNr K!Nr MXNr ee]r (U number2symbolr h]r (]r (MU file_inputr e]r (MUand_exprr e]r (MUand_testr e]r (MUarglistr e]r (MUargumentr e]r (MU arith_exprr e]r (MU assert_stmtr e]r (MUatomr e]r (MU augassignr e]r (M U break_stmtr e]r (M Uclassdefr e]r (M Ucomp_forr e]r (M Ucomp_ifr e]r (M U comp_iterr e]r (MUcomp_opr e]r (MU comparisonr e]r (MU compound_stmtr e]r (MU continue_stmtr e]r (MU decoratedr e]r (MU decoratorr e]r (MU decoratorsr e]r (MUdel_stmtr e]r (MU dictsetmakerr e]r (MUdotted_as_namer e]r (MUdotted_as_namesr e]r (MU dotted_namer e]r (MU encoding_declr e]r (MU eval_inputr e]r (MU except_clauser e]r (MU exec_stmtr e]r (MUexprr e]r (MU expr_stmtr e]r (M Uexprlistr e]r (M!Ufactorr e]r (M"U flow_stmtr e]r (M#Ufor_stmtr e]r (M$Ufuncdefr e]r (M%U global_stmtr e]r (M&Uif_stmtr e]r (M'Uimport_as_namer e]r (M(Uimport_as_namesr e]r (M)U import_fromr e]r (M*U import_namer e]r (M+U import_stmtr! e]r" (M,Ulambdefr# e]r$ (M-U listmakerr% e]r& (M.Unot_testr' e]r( (M/U old_lambdefr) e]r* (M0Uold_testr+ e]r, (M1Uor_testr- e]r. (M2U parametersr/ e]r0 (M3U pass_stmtr1 e]r2 (M4Upowerr3 e]r4 (M5U print_stmtr5 e]r6 (M6U raise_stmtr7 e]r8 (M7U return_stmtr9 e]r: (M8U shift_exprr; e]r< (M9U simple_stmtr= e]r> (M:U single_inputr? e]r@ (M;UsliceoprA e]rB (M<U small_stmtrC e]rD (M=U star_exprrE e]rF (M>UstmtrG e]rH (M?U subscriptrI e]rJ (M@U subscriptlistrK e]rL (MAUsuiterM e]rN (MBUtermrO e]rP (MCUtestrQ e]rR (MDUtestlistrS e]rT (MEU testlist1rU e]rV (MFU testlist_gexprW e]rX (MGU testlist_saferY e]rZ (MHUtestlist_star_exprr[ e]r\ (MIUtfpdefr] e]r^ (MJUtfplistr_ e]r` (MKUtnamera e]rb (MLUtrailerrc e]rd (MMUtry_stmtre e]rf (MNU typedargslistrg e]rh (MOU varargslistri e]rj (MPUvfpdefrk e]rl (MQUvfplistrm e]rn (MRUvnamero e]rp (MSU while_stmtrq e]rr (MTU with_itemrs e]rt (MUU with_stmtru e]rv (MVUwith_varrw e]rx (MWUxor_exprry e]rz (MXU yield_argr{ e]r| (MYU yield_exprr} e]r~ (MZU yield_stmtr eer Rr e]r (Ustartr Me]r (Ustatesr ]r (]r (]r (KKr KKr KKr e]r KKr ae]r (]r K(Kr a]r (K)Kr KKr ee]r (]r K*Kr a]r (K+Kr KKr ee]r (]r K,Kr a]r (K-Kr KKr e]r (K,Kr KKr ee]r (]r (K.Kr K/Kr K0Kr e]r K1Kr a]r KKr a]r (K2Kr K3Kr KKr e]r K0Kr ae]r (]r K4Kr a]r (KKr KKr KKr ee]r (]r K Kr a]r K0Kr a]r (K-Kr KKr e]r K0Kr a]r KKr ae]r (]r (KKr KKr K Kr K Kr K#Kr K%Kr K&Kr K'Kr e]r (K5Kr K6Kr K7Kr e]r KK r a]r (K8Kr K9K r e]r K:K r a]r (K;Kr KKr K?Kr K@Kr KAKr KBKr KCKr KDKr KEKr KFKr KGKr KHKr KIKr e]r KKr ae]r (]r K Kr a]r KKr ae]r (]r KKr a]r K%Kr a]r (KKr KJKr e]r (K5Kr KKKr e]r KLKr a]r KJKr a]r K5Kr a]r KKr ae]r (]r KKr a]r KMKr a]r KNKr a]r KOKr a]r (KPKr KKr e]r! KKr" ae]r# (]r$ KKr% a]r& KQKr' a]r( (KPKr) KKr* e]r+ KKr, ae]r- (]r. (K3Kr/ KRKr0 e]r1 KKr2 ae]r3 (]r4 (KSKr5 KTKr6 KUKr7 KSKr8 KVKr9 KWKr: KXKr; KNKr< KYKr= KKr> e]r? KKr@ a]rA (KKrB KKrC e]rD KNKrE ae]rF (]rG K1KrH a]rI (KZKrJ KKrK ee]rL (]rM (K[KrN K\KrO K]KrP K^KrQ K_KrR K`KrS KaKrT KbKrU e]rV KKrW ae]rX (]rY KKrZ a]r[ KKr\ ae]r] (]r^ KcKr_ a]r` (K[Kra K^Krb e]rc KKrd ae]re (]rf K Krg a]rh KdKri a]rj (KKrk KKrl e]rm (K5Krn KKKro e]rp KKrq a]rr KKrs a]rt K5Kru ae]rv (]rw KeKrx a]ry (KeKrz KKr{ ee]r| (]r} KKr~ a]r KMKr a]r KKr ae]r (]r (K.Kr K/Kr K0Kr e]r K1Kr a]r (K-Kr K3Kr KKr e]r (K-Kr KJKr K3Kr KKr e]r (K-Kr K3Kr KKr e]r (K/K r K0K r KKr e]r KKr a]r K0Kr a]r (K.K r K0K r KKr e]r (K-Kr KK r e]r K1K r a]r KJK r a]r (K-Kr KK r e]r K0K r ae]r (]r KdKr a]r (KfKr KKr e]r K%Kr a]r KKr ae]r (]r KgKr a]r (K-Kr KKr ee]r (]r K%Kr a]r (KKr KKr ee]r (]r K%Kr a]r KKr ae]r (]r KhKr a]r (KKr KKr e]r KKr ae]r (]r KiKr a]r (K0Kr KKr e]r (K-Kr KfKr KKr e]r K0Kr a]r KKr ae]r (]r KKr a]r K1Kr a]r (KNKr KKr e]r K0Kr a]r (K-Kr KKr e]r K0Kr a]r KKr ae]r (]r KjKr a]r (KkKr KKr ee]r (]r KlKr a]r (K2Kr KmKr KKr e]r (KlKr K7Kr e]r (KhKr K7Kr e]r (K2Kr KKr e]r KKr ae]r (]r (K1Kr K/Kr e]r (K-Kr KKr e]r (K1Kr K/Kr KKr ee]r (]r (KKr KKr K$Kr KnKr e]r KoKr a]r KKr ae]r (]r (KpKr KqKr! KrKr" KsKr# KtKr$ e]r% KKr& ae]r' (]r( KKr) a]r* KMKr+ a]r, KNKr- a]r. KhKr/ a]r0 KJKr1 a]r2 KLKr3 a]r4 (KuKr5 KKr6 e]r7 KJKr8 a]r9 KLK r: a]r; KK r< ae]r= (]r> KKr? a]r@ K%KrA a]rB KvKrC a]rD (KwKrE KJKrF e]rG K0KrH a]rI KLKrJ a]rK KJKrL a]rM KKrN ae]rO (]rP (KKrQ KKrR e]rS K%KrT a]rU (K-KrV KKrW ee]rX (]rY KKrZ a]r[ K0Kr\ a]r] KJKr^ a]r_ KLKr` a]ra (KxKrb KuKrc KKrd e]re KJKrf a]rg KLKrh a]ri KKrj ae]rk (]rl K%Krm a]rn (KfKro KKrp e]rq K%Krr a]rs KKrt ae]ru (]rv KyKrw a]rx (K-Kry KKrz e]r{ (KyKr| KKr} ee]r~ (]r KKr a]r (KKr KdKr e]r (KKr KKr KdKr e]r KKr a]r (KKr KKr KzKr e]r KzKr a]r KKr a]r K5Kr ae]r (]r KKr a]r K{Kr a]r KKr ae]r (]r (K|Kr K}Kr e]r KKr ae]r (]r KKr a]r (KJKr K~Kr e]r K0Kr a]r KJKr a]r KKr ae]r (]r (K/Kr K0Kr e]r (K-Kr K3Kr KKr e]r (K/Kr K0Kr KKr e]r KKr a]r (K-Kr KKr ee]r (]r (KKr KKr e]r K*Kr a]r KKr ae]r (]r KKr a]r (KJKr K~Kr e]r KQKr a]r KJKr a]r KKr ae]r (]r (KKr KKr e]r KKr ae]r (]r KKr a]r (KKr KKr ee]r (]r KKr a]r (K5Kr KKr e]r KKr a]r K5Kr ae]r (]r KKr a]r KKr ae]r (]r KKr a]r (K.Kr KKr KKr e]r KoKr a]r KKr ae]r (]r KKr a]r (KKr K0Kr KKr e]r K0Kr a]r (K-Kr KKr e]r (K-Kr KKr e]r (K0Kr KKr e]r K0Kr a]r (K-Kr KKr e]r (K0Kr KKr ee]r (]r KKr a]r (K0Kr KKr e]r (K-Kr KKr KKr e]r K0Kr a]r K0Kr a]r (K-Kr! KKr" e]r# KKr$ ae]r% (]r& KKr' a]r( (KhKr) KKr* e]r+ KKr, ae]r- (]r. KKr/ a]r0 (KKr1 KKr2 KKr3 ee]r4 (]r5 KKr6 a]r7 (KKr8 KKr9 e]r: (KKr; KKr< e]r= KKr> ae]r? (]r@ (KKrA KKrB KKrC e]rD KKrE a]rF KKrG ae]rH (]rI KJKrJ a]rK (K0KrL KKrM e]rN KKrO ae]rP (]rQ (KKrR KKrS KKrT KKrU KKrV KKrW KKrX KKrY KKrZ e]r[ KKr\ ae]r] (]r^ KKr_ a]r` K1Kra a]rb KKrc ae]rd (]re (KKrf KKrg e]rh KKri ae]rj (]rk (KJKrl K0Krm e]rn (KKro K0Krp KKrq e]rr (KJKrs KKrt e]ru KKrv a]rw (KKrx KKry ee]rz (]r{ KKr| a]r} (K-Kr~ KKr e]r (KKr KKr ee]r (]r (KKr KKr e]r KKr a]r KKr a]r KKr a]r (KKr KKr ee]r (]r KoKr a]r (KKr KKr KKr KKr K Kr KKr ee]r (]r (KKr KKr e]r KKr a]r (KKr KKr e]r KKr a]r KuKr a]r K0Kr ae]r (]r K0Kr a]r (K-Kr KKr e]r (K0Kr KKr ee]r (]r K0Kr a]r (K-Kr KKr ee]r (]r (K/Kr K0Kr e]r (K-Kr K3Kr KKr e]r (K/Kr K0Kr KKr e]r KKr a]r (K-Kr KKr ee]r (]r KQKr a]r (K-Kr KKr e]r KQKr a]r (K-Kr KKr e]r (KQKr KKr ee]r (]r (K/Kr K0Kr e]r (K-Kr KKr e]r (K/Kr K0Kr KKr ee]r (]r (KKr KKr e]r KKr a]r KKr a]r K5Kr ae]r (]r KKr a]r (K-Kr KKr e]r (KKr KKr ee]r (]r K%Kr a]r (KJKr KKr e]r K0Kr a]r KKr ae]r (]r(KKrKKrK Kre]r(K5KrKKKre]rK%Kra]r KKr a]r KKr a]r K5Kra]rK8Krae]r(]rKKra]rKJKra]rKLKra]r(KKrKKre]rKJKra]rKJKra]rKLKr a]r!KLK r"a]r#KKr$a]r%(KuK r&KKr'KKr(KK r)e]r*KJK r+a]r,KLK r-a]r.(KKr/KK r0ee]r1(]r2(KKr3K.Kr4KKr5e]r6(K-Kr7KKr8KKr9e]r:KKr;a]r<(K-Kr=K2Kr>KKr?e]r@(K.KrAKK rBe]rC(K-KrDKKrEe]rFKKrGa]rH(KKrIK.KrJKKrKKKrLe]rMK0K rNa]rO(K-KrPK2K rQKK rRe]rS(K-KrTKK rUe]rVK0KrWae]rX(]rY(KKrZK.Kr[KKr\e]r](K-Kr^KKr_KKr`e]raKKrba]rc(K-KrdK2KreKKrfe]rg(K.KrhKK rie]rj(K-KrkKKrle]rmKKrna]ro(KKrpK.KrqKKrrKKrse]rtK0K rua]rv(K-KrwK2K rxKK rye]rz(K-Kr{KK r|e]r}K0Kr~ae]r(]r(KKrKKre]rKKra]rKKra]rK5Krae]r(]rKKra]r(K-KrKKre]r(KKrKKree]r(]rK%Kra]rKKrae]r(]rK Kra]rK0Kra]rKJKra]rKLKra]r(KuKrKKre]rKJKra]rKLKra]rKKrae]r(]rK0Kra]r(KfKrKKre]rK1Kra]rKKrae]r(]rK!Kra]rKKra]r(K-KrKJKre]rKLKra]rKKrae]r(]rKfKra]rK1Kra]rKKrae]r(]rKKra]r(KKrKKree]r(]r(KKrKhKre]rK0Kra]rKKrae]r(]rK"Kra]r(KKrKKre]rKKrae]r(]rK7Kra]rKKraeee]r(U symbol2labelrh]r(]r(Uand_exprrKe]r(Uand_testrKe]r(UarglistrKKe]r(UargumentrK,e]r(U arith_exprrKe]r(U assert_stmtrKe]r(UatomrKe]r(U augassignrKme]r(U break_stmtrKpe]r(UclassdefrK[e]r(Ucomp_forrK3e]r(Ucomp_ifrKRe]r(U comp_iterrKPe]r(Ucomp_oprKZe]r(U comparisonrKe]r(U compound_stmtrKe]r(U continue_stmtrKqe]r(U decoratedrK\e]r(U decoratorr Kee]r (U decoratorsr Kce]r (Udel_stmtr Ke]r(U dictsetmakerrK(Uold_testr?KQe]r@(Uor_testrAKe]rB(U parametersrCKve]rD(U pass_stmtrEKe]rF(UpowerrGKne]rH(U print_stmtrIKe]rJ(U raise_stmtrKKre]rL(U return_stmtrMKse]rN(U shift_exprrOK(e]rP(U simple_stmtrQKe]rR(UsliceoprSKe]rT(U small_stmtrUKe]rV(U star_exprrWK/e]rX(UstmtrYKe]rZ(U subscriptr[Ke]r\(U subscriptlistr]Ke]r^(Usuiter_KLe]r`(UtermraK4e]rb(UtestrcK0e]rd(UtestlistreKhe]rf(U testlist1rgK:e]rh(U testlist_gexpriK6e]rj(U testlist_saferkKOe]rl(Utestlist_star_exprrmKle]rn(UtfpdefroKe]rp(UtfplistrqKe]rr(UtnamersKe]rt(UtrailerruKe]rv(Utry_stmtrwK`e]rx(U typedargslistryKe]rz(U varargslistr{K~e]r|(Uvfpdefr}Ke]r~(UvfplistrKe]r(UvnamerKe]r(U while_stmtrKae]r(U with_itemrKe]r(U with_stmtrKbe]r(Uxor_exprrKje]r(U yield_argrKe]r(U yield_exprrK7e]r(U yield_stmtrKteerRre]r(U symbol2numberrh]r(]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j M e]r(j M e]r(j M e]r(j M e]r(j M e]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j Me]r(j M e]r(j M!e]r(j Me]r(j M"e]r(j M#e]r(j M$e]r(j M%e]r(j M&e]r(j M'e]r(j M(e]r(j M)e]r(j M*e]r(j! M+e]r(j# M,e]r(j% M-e]r(j' M.e]r(j) M/e]r(j+ M0e]r(j- M1e]r(j/ M2e]r(j1 M3e]r(j3 M4e]r(j5 M5e]r(j7 M6e]r(j9 M7e]r(j; M8e]r(j= M9e]r(j? M:e]r(jA M;e]r(jC M<e]r(jE M=e]r(jG M>e]r(jI M?e]r(jK M@e]r(jM MAe]r(jO MBe]r(jQ MCe]r(jS MDe]r(jU MEe]r(jW MFe]r(jY MGe]r(j[ MHe]r(j] MIe]r(j_ MJe]r(ja MKe]r(jc MLe]r(je MMe]r(jg MNe]r(ji MOe]r(jk MPe]r(jm MQe]r(jo MRe]r(jq MSe]r(js MTe]r(ju MUe]r(jw MVe]r(jy MWe]r(j{ MXe]r(j} MYe]r(j MZeerRre]r(Utokensrh]r(]r(KKe]r(KK%e]r(KK&e]r(KK'e]r(KKe]r(KKe]r(KKe]r(KKe]r(KK5e]r(K K e]r(K K8e]r(K KJe]r(K K-e]r(K Ke]r(KKe]r(KKe]r(KKe]r(KKe]r(KKke]r(KK)e]r (KKTe]r (KKWe]r (KK2e]r (KKe]r (KKe]r(KK e]r(KK#e]r(KK;e]r(KKVe]r(KKSe]r(KKUe]r(KKXe]r(K K$e]r(K!Ke]r(K"Ke]r(K#Ke]r(K$K.e]r(K%KAe]r(K&KBe]r(K'K@e]r(K(KDe]r(K)K=e]r(K*K>e]r (K+KIe]r!(K,KHe]r"(K-KEe]r#(K.KFe]r$(K/K?e]r%(K0Ke]r&(K1KCe]r'(K2K e]r((K3KGe]r)(K7Kweer*Rr+eer,Rr-.PK1]"1 __init__.pycnu[ {fc@sdS(N((((s(/usr/lib64/python2.7/lib2to3/__init__.pyttPK1]\ pygram.pyonu[ {fc@sdZddlZddlmZddlmZddlmZejjejj e dZ ejjejj e dZ d e fd YZejd e ZeeZejZejd =ejd e ZeeZdS( s&Export the Python grammar and symbols.iNi(ttoken(tdriver(tpytrees Grammar.txtsPatternGrammar.txttSymbolscBseZdZRS(cCs4x-|jjD]\}}t|||qWdS(sInitializer. Creates an attribute for each grammar symbol (nonterminal), whose value is the symbol's type (an int >= 256). N(t symbol2numbert iteritemstsetattr(tselftgrammartnametsymbol((s&/usr/lib64/python2.7/lib2to3/pygram.pyt__init__s(t__name__t __module__R (((s&/usr/lib64/python2.7/lib2to3/pygram.pyRstlib2to3tprint(t__doc__tostpgen2RRtRtpathtjointdirnamet__file__t _GRAMMAR_FILEt_PATTERN_GRAMMAR_FILEtobjectRtload_packaged_grammartpython_grammartpython_symbolstcopyt!python_grammar_no_print_statementtkeywordstpattern_grammartpattern_symbols(((s&/usr/lib64/python2.7/lib2to3/pygram.pyts !     PK1]PHgfixer_base.pycnu[ {fc@srdZddlZddlmZddlmZddlmZdefdYZ d e fd YZ dS( s2Base class for fixers (optional, but recommended).iNi(tPatternCompiler(tpygram(tdoes_tree_importtBaseFixcBseZdZdZdZdZdZdZdZ e j dZ e ZdZeZdZdZeZeZejZdZdZdZdZdZd d Zd Zdd Z d Z!dZ"dZ#RS(sOptional base class for fixers. The subclass name must be FixFooBar where FooBar is the result of removing underscores and capitalizing the words of the fix name. For example, the class name for a fixer named 'has_key' should be FixHasKey. itposticCs ||_||_|jdS(sInitializer. Subclass may override. Args: options: a dict containing the options passed to RefactoringTool that could be used to customize the fixer through the command line. log: a list to append warnings and other messages to. N(toptionstlogtcompile_pattern(tselfRR((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt__init__0s  cCsC|jdk r?t}|j|jdt\|_|_ndS(sCompiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match(). t with_treeN(tPATTERNtNoneRRtTruetpatternt pattern_tree(RtPC((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyR<s cCs ||_dS(smSet the filename, and a logger derived from it. The main refactoring tool should call this. N(tfilename(RR((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt set_filenameGscCs&i|d6}|jj||o%|S(sReturns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override. tnode(Rtmatch(RRtresults((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyRNs cCs tdS(sReturns the transformation for a given parse tree node. Args: node: the root of the parse tree that matched the fixer. results: a dict mapping symbolic names to part of the match. Returns: None, or a node that is a modified copy of the argument node. The node argument may also be modified in-place to effect the same change. Subclass *must* override. N(tNotImplementedError(RRR((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt transformZsuxxx_todo_changemecCsI|}x,||jkr4|t|jj}q W|jj||S(sReturn a string suitable for use as an identifier The new name is guaranteed not to conflict with other identifiers. (t used_namestunicodetnumberstnexttadd(Rttemplatetname((s*/usr/lib64/python2.7/lib2to3/fixer_base.pytnew_namejs cCs@|jr,t|_|jjd|jn|jj|dS(Ns### In file %s ###(t first_logtFalseRtappendR(Rtmessage((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt log_messageus  cCsX|j}|j}d|_d}|j|||f|rT|j|ndS(sWarn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. usLine %d: could not convert: %sN(t get_linenotclonetprefixR$(RRtreasontlinenot for_outputtmsg((s*/usr/lib64/python2.7/lib2to3/fixer_base.pytcannot_convert{s   cCs'|j}|jd||fdS(sUsed for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. s Line %d: %sN(R%R$(RRR(R)((s*/usr/lib64/python2.7/lib2to3/fixer_base.pytwarnings cCs8|j|_|j|tjd|_t|_dS(sSome fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. iN(RRt itertoolstcountRR R (RttreeR((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt start_trees  cCsdS(sSome fixers need to maintain tree-wide state. This method is called once, at the conclusion of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. N((RR0R((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt finish_treesN($t__name__t __module__t__doc__R R RRRRtloggerR.R/RtsetRtorderR!texplicitt run_ordert _accept_typetkeep_line_ordert BM_compatibleRtpython_symbolstsymsR RRRRRR$R,R-R1R2(((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyRs6       tConditionalFixcBs&eZdZdZdZdZRS(s@ Base class for fixers which not execute if an import is found. cGs#tt|j|d|_dS(N(tsuperR@R1R t _should_skip(Rtargs((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyR1scCsa|jdk r|jS|jjd}|d}dj|d }t||||_|jS(Nt.i(RBR tskip_ontsplittjoinR(RRtpkgR((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt should_skips N(R3R4R5R RER1RI(((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyR@s ( R5R.tpatcompRtRt fixer_utilRtobjectRR@(((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyts  PK1]\ pygram.pycnu[ {fc@sdZddlZddlmZddlmZddlmZejjejj e dZ ejjejj e dZ d e fd YZejd e ZeeZejZejd =ejd e ZeeZdS( s&Export the Python grammar and symbols.iNi(ttoken(tdriver(tpytrees Grammar.txtsPatternGrammar.txttSymbolscBseZdZRS(cCs4x-|jjD]\}}t|||qWdS(sInitializer. Creates an attribute for each grammar symbol (nonterminal), whose value is the symbol's type (an int >= 256). N(t symbol2numbert iteritemstsetattr(tselftgrammartnametsymbol((s&/usr/lib64/python2.7/lib2to3/pygram.pyt__init__s(t__name__t __module__R (((s&/usr/lib64/python2.7/lib2to3/pygram.pyRstlib2to3tprint(t__doc__tostpgen2RRtRtpathtjointdirnamet__file__t _GRAMMAR_FILEt_PATTERN_GRAMMAR_FILEtobjectRtload_packaged_grammartpython_grammartpython_symbolstcopyt!python_grammar_no_print_statementtkeywordstpattern_grammartpattern_symbols(((s&/usr/lib64/python2.7/lib2to3/pygram.pyts !     PK1]azCC __main__.pynu[import sys from .main import main sys.exit(main("lib2to3.fixes")) PK1]ڠ patcomp.pycnu[ {fc@sdZdZddlZddlmZmZmZmZmZm Z ddl m Z ddl m Z de fd YZd Zd efd YZiejd 6ejd6ejd6dd6ZdZdZdZdS(sPattern compiler. The grammar is taken from PatternGrammar.txt. The compiler compiles a pattern to a pytree.*Pattern instance. s#Guido van Rossum iNi(tdrivertliteralsttokenttokenizetparsetgrammar(tpytree(tpygramtPatternSyntaxErrorcBseZRS((t__name__t __module__(((s'/usr/lib64/python2.7/lib2to3/patcomp.pyRsc cswttjtjtjf}tjtj|j}x7|D]/}|\}}}}}||kr@|Vq@q@WdS(s6Tokenizes a string suppressing significant whitespace.N( tsetRtNEWLINEtINDENTtDEDENTRtgenerate_tokenstStringIOtreadline( tinputtskipttokenst quintuplettypetvaluetstarttendt line_text((s'/usr/lib64/python2.7/lib2to3/patcomp.pyttokenize_wrappers   tPatternCompilercBsAeZddZeedZdZddZdZRS(cCs|dkr'tj|_tj|_n'tj||_tj|j|_tj |_ tj |_ tj |jdt|_dS(s^Initializer. Takes an optional alternative filename for the pattern grammar. tconvertN(tNoneRtpattern_grammarRtpattern_symbolstsymsRt load_grammartSymbolstpython_grammart pygrammartpython_symbolstpysymstDrivertpattern_convert(tselft grammar_file((s'/usr/lib64/python2.7/lib2to3/patcomp.pyt__init__(s    cCs}t|}y|jj|d|}Wn(tjk rR}tt|nX|rl|j||fS|j|SdS(s=Compiles a pattern string to a nested pytree.*Pattern object.tdebugN(RRt parse_tokensRt ParseErrorRtstrt compile_node(R*RR-t with_treeRtrootte((s'/usr/lib64/python2.7/lib2to3/patcomp.pytcompile_pattern7s cCs|j|jjkr%|jd}n|j|jjkrg|jdddD]}|j|^qQ}t|dkr|dStjg|D]}|g^qdddd}|j S|j|jj kr=g|jD]}|j|^q}t|dkr|dStj|gdddd}|j S|j|jj kr|j |jd}tj |}|j S|j|jjkstd}|j} t| dkr| djtjkr| dj}| d} nd} t| dkr5| dj|jjkr5| d} | d } n|j | | }| dk r| j|jjksnt| j} | d} | jtjkrd} tj}n| jtjkrd} tj}n| jtjkrQ| djtjkstt| d kst|j| d} }t| d kr]|j| d}q]n ts]t| dksu|dkr|j }tj|ggd| d|}qn|dk r||_n|j S( sXCompiles a node, recursively. This is one big switch on the node type. iNiitmintmaxiii(ii(RR!tMatchertchildrent AlternativesR1tlenRtWildcardPatterntoptimizet Alternativet NegatedUnitt compile_basictNegatedPatterntUnittAssertionErrorRRtEQUALRtRepeatertSTARtHUGEtPLUStLBRACEtRBRACEtget_inttFalsetname(R*tnodetchtaltstatptunitstpatternRMtnodestrepeatR9tchildR6R7((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR1Csh21 %   (  +         '  cCst|dkst|d}|jtjkrbttj|j}t j t ||S|jtj krp|j}|j r|tkrtd|n|drtdnt j t|S|dkrd}nF|jds-t|j|d}|dkr-td|q-n|drW|j|djdg}nd}t j||Sns|jdkr|j|dS|jd kr|dkst|j|d}t j|ggd dd dStst|dS( NiisInvalid token: %rsCan't have details for tokentanyt_sInvalid symbol: %rt(t[R6R7(R;RCRRtSTRINGtunicodeRt evalStringRRt LeafPatternt_type_of_literaltNAMEtisuppert TOKEN_MAPRRt startswithtgetattrR'R1R9t NodePatternR<RL(R*RURVRNRRtcontentt subpattern((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR@s<          cCs%|jtjkstt|jS(N(RRtNUMBERRCtintR(R*RN((s'/usr/lib64/python2.7/lib2to3/patcomp.pyRKsN( R R RR,RLR5R1R@RK(((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR&s   G #RaR\RitTOKENcCs9|djrtjS|tjkr1tj|SdSdS(Ni(tisalphaRRaRtopmapR(R((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR`s  cCsW|\}}}}|s'||jkr=tj||d|Stj||d|SdS(s9Converts raw node information to a Node or Leaf instance.tcontextN(t number2symbolRtNodetLeaf(Rt raw_node_infoRRRnR9((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR)scCstj|S(N(RR5(RT((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR5s(t__doc__t __author__Rtpgen2RRRRRRtRRt ExceptionRRtobjectRRaR\RiRRcR`R)R5(((s'/usr/lib64/python2.7/lib2to3/patcomp.pyt s .      PK1]  patcomp.pyonu[ {fc@sdZdZddlZddlmZmZmZmZmZm Z ddl m Z ddl m Z de fd YZd Zd efd YZiejd 6ejd6ejd6dd6ZdZdZdZdS(sPattern compiler. The grammar is taken from PatternGrammar.txt. The compiler compiles a pattern to a pytree.*Pattern instance. s#Guido van Rossum iNi(tdrivertliteralsttokenttokenizetparsetgrammar(tpytree(tpygramtPatternSyntaxErrorcBseZRS((t__name__t __module__(((s'/usr/lib64/python2.7/lib2to3/patcomp.pyRsc cswttjtjtjf}tjtj|j}x7|D]/}|\}}}}}||kr@|Vq@q@WdS(s6Tokenizes a string suppressing significant whitespace.N( tsetRtNEWLINEtINDENTtDEDENTRtgenerate_tokenstStringIOtreadline( tinputtskipttokenst quintuplettypetvaluetstarttendt line_text((s'/usr/lib64/python2.7/lib2to3/patcomp.pyttokenize_wrappers   tPatternCompilercBsAeZddZeedZdZddZdZRS(cCs|dkr'tj|_tj|_n'tj||_tj|j|_tj |_ tj |_ tj |jdt|_dS(s^Initializer. Takes an optional alternative filename for the pattern grammar. tconvertN(tNoneRtpattern_grammarRtpattern_symbolstsymsRt load_grammartSymbolstpython_grammart pygrammartpython_symbolstpysymstDrivertpattern_convert(tselft grammar_file((s'/usr/lib64/python2.7/lib2to3/patcomp.pyt__init__(s    cCs}t|}y|jj|d|}Wn(tjk rR}tt|nX|rl|j||fS|j|SdS(s=Compiles a pattern string to a nested pytree.*Pattern object.tdebugN(RRt parse_tokensRt ParseErrorRtstrt compile_node(R*RR-t with_treeRtrootte((s'/usr/lib64/python2.7/lib2to3/patcomp.pytcompile_pattern7s cCsT|j|jjkr%|jd}n|j|jjkrg|jdddD]}|j|^qQ}t|dkr|dStjg|D]}|g^qdddd}|j S|j|jj kr=g|jD]}|j|^q}t|dkr|dStj|gdddd}|j S|j|jj kr|j |jd}tj |}|j Sd}|j} t| dkr| djtjkr| dj}| d} nd} t| dkr| dj|jjkr| d} | d } n|j | | }| dk r2| j} | d} | jtjkrod} tj}nx| jtjkrd} tj}nT| jtjkr|j| d} }t| d kr|j| d}qn| dks|dkr2|j }tj|ggd| d|}q2n|dk rJ||_n|j S( sXCompiles a node, recursively. This is one big switch on the node type. iNiitmintmaxiii(RR!tMatchertchildrent AlternativesR1tlenRtWildcardPatterntoptimizet Alternativet NegatedUnitt compile_basictNegatedPatternRRtEQUALRtRepeatertSTARtHUGEtPLUStLBRACEtget_inttname(R*tnodetchtaltstatptunitstpatternRItnodestrepeatR9tchildR6R7((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR1Cs^21 %   (  +        '  cCs|d}|jtjkrJttj|j}tjt ||S|jtj krX|j}|j r|t krt d|n|drt dntjt |S|dkrd}nF|jdst|j|d}|dkrt d|qn|dr?|j|djdg}nd}tj||Sna|jdkrx|j|dS|jd kr|j|d}tj|ggd dd dSdS( NisInvalid token: %risCan't have details for tokentanyt_sInvalid symbol: %rt(t[R6R7(RRtSTRINGtunicodeRt evalStringRRt LeafPatternt_type_of_literaltNAMEtisuppert TOKEN_MAPRRt startswithtgetattrR'R1R9t NodePatternR<(R*RQRRRJRRtcontentt subpattern((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR@s8          cCs t|jS(N(tintR(R*RJ((s'/usr/lib64/python2.7/lib2to3/patcomp.pyRHsN( R R RR,tFalseR5R1R@RH(((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR&s   G #R]RXtNUMBERtTOKENcCs9|djrtjS|tjkr1tj|SdSdS(Ni(tisalphaRR]RtopmapR(R((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR\s  cCsW|\}}}}|s'||jkr=tj||d|Stj||d|SdS(s9Converts raw node information to a Node or Leaf instance.tcontextN(t number2symbolRtNodetLeaf(Rt raw_node_infoRRRkR9((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR)scCstj|S(N(RR5(RP((s'/usr/lib64/python2.7/lib2to3/patcomp.pyR5s(t__doc__t __author__Rtpgen2RRRRRRtRRt ExceptionRRtobjectRR]RXRgRR_R\R)R5(((s'/usr/lib64/python2.7/lib2to3/patcomp.pyt s .      PK1]Pц __main__.pyonu[ {fc@s3ddlZddlmZejeddS(iNi(tmains lib2to3.fixes(tsysRtexit(((s(/usr/lib64/python2.7/lib2to3/__main__.pyts PK1]R,N.N.main.pynu[""" Main program for 2to3. """ from __future__ import with_statement, print_function import sys import os import difflib import logging import shutil import optparse from . import refactor def diff_texts(a, b, filename): """Return a unified diff of two strings.""" a = a.splitlines() b = b.splitlines() return difflib.unified_diff(a, b, filename, filename, "(original)", "(refactored)", lineterm="") class StdoutRefactoringTool(refactor.MultiprocessRefactoringTool): """ A refactoring tool that can avoid overwriting its input files. Prints output to stdout. Output files can optionally be written to a different directory and or have an extra file suffix appended to their name for use in situations where you do not want to replace the input files. """ def __init__(self, fixers, options, explicit, nobackups, show_diffs, input_base_dir='', output_dir='', append_suffix=''): """ Args: fixers: A list of fixers to import. options: A dict with RefactoringTool configuration. explicit: A list of fixers to run even if they are explicit. nobackups: If true no backup '.bak' files will be created for those files that are being refactored. show_diffs: Should diffs of the refactoring be printed to stdout? input_base_dir: The base directory for all input files. This class will strip this path prefix off of filenames before substituting it with output_dir. Only meaningful if output_dir is supplied. All files processed by refactor() must start with this path. output_dir: If supplied, all converted files will be written into this directory tree instead of input_base_dir. append_suffix: If supplied, all files output by this tool will have this appended to their filename. Useful for changing .py to .py3 for example by passing append_suffix='3'. """ self.nobackups = nobackups self.show_diffs = show_diffs if input_base_dir and not input_base_dir.endswith(os.sep): input_base_dir += os.sep self._input_base_dir = input_base_dir self._output_dir = output_dir self._append_suffix = append_suffix super(StdoutRefactoringTool, self).__init__(fixers, options, explicit) def log_error(self, msg, *args, **kwargs): self.errors.append((msg, args, kwargs)) self.logger.error(msg, *args, **kwargs) def write_file(self, new_text, filename, old_text, encoding): orig_filename = filename if self._output_dir: if filename.startswith(self._input_base_dir): filename = os.path.join(self._output_dir, filename[len(self._input_base_dir):]) else: raise ValueError('filename %s does not start with the ' 'input_base_dir %s' % ( filename, self._input_base_dir)) if self._append_suffix: filename += self._append_suffix if orig_filename != filename: output_dir = os.path.dirname(filename) if not os.path.isdir(output_dir) and output_dir: os.makedirs(output_dir) self.log_message('Writing converted %s to %s.', orig_filename, filename) if not self.nobackups: # Make backup backup = filename + ".bak" if os.path.lexists(backup): try: os.remove(backup) except OSError: self.log_message("Can't remove backup %s", backup) try: os.rename(filename, backup) except OSError: self.log_message("Can't rename %s to %s", filename, backup) # Actually write the new file write = super(StdoutRefactoringTool, self).write_file write(new_text, filename, old_text, encoding) if not self.nobackups: shutil.copymode(backup, filename) if orig_filename != filename: # Preserve the file mode in the new output directory. shutil.copymode(orig_filename, filename) def print_output(self, old, new, filename, equal): if equal: self.log_message("No changes to %s", filename) else: self.log_message("Refactored %s", filename) if self.show_diffs: diff_lines = diff_texts(old, new, filename) try: if self.output_lock is not None: with self.output_lock: for line in diff_lines: print(line) sys.stdout.flush() else: for line in diff_lines: print(line) except UnicodeEncodeError: warn("couldn't encode %s's diff for your terminal" % (filename,)) return def warn(msg): print("WARNING: %s" % (msg,), file=sys.stderr) def main(fixer_pkg, args=None): """Main program. Args: fixer_pkg: the name of a package where the fixers are located. args: optional; a list of command line arguments. If omitted, sys.argv[1:] is used. Returns a suggested exit status (0, 1, 2). """ # Set up option parser parser = optparse.OptionParser(usage="2to3 [options] file|dir ...") parser.add_option("-d", "--doctests_only", action="store_true", help="Fix up doctests only") parser.add_option("-f", "--fix", action="append", default=[], help="Each FIX specifies a transformation; default: all") parser.add_option("-j", "--processes", action="store", default=1, type="int", help="Run 2to3 concurrently") parser.add_option("-x", "--nofix", action="append", default=[], help="Prevent a transformation from being run") parser.add_option("-l", "--list-fixes", action="store_true", help="List available transformations") parser.add_option("-p", "--print-function", action="store_true", help="Modify the grammar so that print() is a function") parser.add_option("-e", "--exec-function", action="store_true", help="Modify the grammar so that exec() is a function") parser.add_option("-v", "--verbose", action="store_true", help="More verbose logging") parser.add_option("--no-diffs", action="store_true", help="Don't show diffs of the refactoring") parser.add_option("-w", "--write", action="store_true", help="Write back modified files") parser.add_option("-n", "--nobackups", action="store_true", default=False, help="Don't write backups for modified files") parser.add_option("-o", "--output-dir", action="store", type="str", default="", help="Put output files in this directory " "instead of overwriting the input files. Requires -n.") parser.add_option("-W", "--write-unchanged-files", action="store_true", help="Also write files even if no changes were required" " (useful with --output-dir); implies -w.") parser.add_option("--add-suffix", action="store", type="str", default="", help="Append this string to all output filenames." " Requires -n if non-empty. " "ex: --add-suffix='3' will generate .py3 files.") # Parse command line arguments refactor_stdin = False flags = {} options, args = parser.parse_args(args) if options.write_unchanged_files: flags["write_unchanged_files"] = True if not options.write: warn("--write-unchanged-files/-W implies -w.") options.write = True # If we allowed these, the original files would be renamed to backup names # but not replaced. if options.output_dir and not options.nobackups: parser.error("Can't use --output-dir/-o without -n.") if options.add_suffix and not options.nobackups: parser.error("Can't use --add-suffix without -n.") if not options.write and options.no_diffs: warn("not writing files and not printing diffs; that's not very useful") if not options.write and options.nobackups: parser.error("Can't use -n without -w") if options.list_fixes: print("Available transformations for the -f/--fix option:") for fixname in refactor.get_all_fix_names(fixer_pkg): print(fixname) if not args: return 0 if not args: print("At least one file or directory argument required.", file=sys.stderr) print("Use --help to show usage.", file=sys.stderr) return 2 if "-" in args: refactor_stdin = True if options.write: print("Can't write to stdin.", file=sys.stderr) return 2 if options.print_function: flags["print_function"] = True if options.exec_function: flags["exec_function"] = True # Set up logging handler level = logging.DEBUG if options.verbose else logging.INFO logging.basicConfig(format='%(name)s: %(message)s', level=level) logger = logging.getLogger('lib2to3.main') # Initialize the refactoring tool avail_fixes = set(refactor.get_fixers_from_package(fixer_pkg)) unwanted_fixes = set(fixer_pkg + ".fix_" + fix for fix in options.nofix) explicit = set() if options.fix: all_present = False for fix in options.fix: if fix == "all": all_present = True else: explicit.add(fixer_pkg + ".fix_" + fix) requested = avail_fixes.union(explicit) if all_present else explicit else: requested = avail_fixes.union(explicit) fixer_names = requested.difference(unwanted_fixes) input_base_dir = os.path.commonprefix(args) if (input_base_dir and not input_base_dir.endswith(os.sep) and not os.path.isdir(input_base_dir)): # One or more similar names were passed, their directory is the base. # os.path.commonprefix() is ignorant of path elements, this corrects # for that weird API. input_base_dir = os.path.dirname(input_base_dir) if options.output_dir: input_base_dir = input_base_dir.rstrip(os.sep) logger.info('Output in %r will mirror the input directory %r layout.', options.output_dir, input_base_dir) rt = StdoutRefactoringTool( sorted(fixer_names), flags, sorted(explicit), options.nobackups, not options.no_diffs, input_base_dir=input_base_dir, output_dir=options.output_dir, append_suffix=options.add_suffix) # Refactor all files and directories passed as arguments if not rt.errors: if refactor_stdin: rt.refactor_stdin() else: try: rt.refactor(args, options.write, options.doctests_only, options.processes) except refactor.MultiprocessingUnsupported: assert options.processes > 1 print("Sorry, -j isn't supported on this platform.", file=sys.stderr) return 1 rt.summarize() # Return error status (0 if rt.errors is zero) return int(bool(rt.errors)) PK1]fP`btm_matcher.pynu["""A bottom-up tree matching algorithm implementation meant to speed up 2to3's matching process. After the tree patterns are reduced to their rarest linear path, a linear Aho-Corasick automaton is created. The linear automaton traverses the linear paths from the leaves to the root of the AST and returns a set of nodes for further matching. This reduces significantly the number of candidate nodes.""" __author__ = "George Boutsioukis " import logging import itertools from collections import defaultdict from . import pytree from .btm_utils import reduce_tree class BMNode(object): """Class for a node of the Aho-Corasick automaton used in matching""" count = itertools.count() def __init__(self): self.transition_table = {} self.fixers = [] self.id = next(BMNode.count) self.content = '' class BottomMatcher(object): """The main matcher class. After instantiating the patterns should be added using the add_fixer method""" def __init__(self): self.match = set() self.root = BMNode() self.nodes = [self.root] self.fixers = [] self.logger = logging.getLogger("RefactoringTool") def add_fixer(self, fixer): """Reduces a fixer's pattern tree to a linear path and adds it to the matcher(a common Aho-Corasick automaton). The fixer is appended on the matching states and called when they are reached""" self.fixers.append(fixer) tree = reduce_tree(fixer.pattern_tree) linear = tree.get_linear_subpattern() match_nodes = self.add(linear, start=self.root) for match_node in match_nodes: match_node.fixers.append(fixer) def add(self, pattern, start): "Recursively adds a linear pattern to the AC automaton" #print("adding pattern", pattern, "to", start) if not pattern: #print("empty pattern") return [start] if isinstance(pattern[0], tuple): #alternatives #print("alternatives") match_nodes = [] for alternative in pattern[0]: #add all alternatives, and add the rest of the pattern #to each end node end_nodes = self.add(alternative, start=start) for end in end_nodes: match_nodes.extend(self.add(pattern[1:], end)) return match_nodes else: #single token #not last if pattern[0] not in start.transition_table: #transition did not exist, create new next_node = BMNode() start.transition_table[pattern[0]] = next_node else: #transition exists already, follow next_node = start.transition_table[pattern[0]] if pattern[1:]: end_nodes = self.add(pattern[1:], start=next_node) else: end_nodes = [next_node] return end_nodes def run(self, leaves): """The main interface with the bottom matcher. The tree is traversed from the bottom using the constructed automaton. Nodes are only checked once as the tree is retraversed. When the automaton fails, we give it one more shot(in case the above tree matches as a whole with the rejected leaf), then we break for the next leaf. There is the special case of multiple arguments(see code comments) where we recheck the nodes Args: The leaves of the AST tree to be matched Returns: A dictionary of node matches with fixers as the keys """ current_ac_node = self.root results = defaultdict(list) for leaf in leaves: current_ast_node = leaf while current_ast_node: current_ast_node.was_checked = True for child in current_ast_node.children: # multiple statements, recheck if isinstance(child, pytree.Leaf) and child.value == ";": current_ast_node.was_checked = False break if current_ast_node.type == 1: #name node_token = current_ast_node.value else: node_token = current_ast_node.type if node_token in current_ac_node.transition_table: #token matches current_ac_node = current_ac_node.transition_table[node_token] for fixer in current_ac_node.fixers: results[fixer].append(current_ast_node) else: #matching failed, reset automaton current_ac_node = self.root if (current_ast_node.parent is not None and current_ast_node.parent.was_checked): #the rest of the tree upwards has been checked, next leaf break #recheck the rejected node once from the root if node_token in current_ac_node.transition_table: #token matches current_ac_node = current_ac_node.transition_table[node_token] for fixer in current_ac_node.fixers: results[fixer].append(current_ast_node) current_ast_node = current_ast_node.parent return results def print_ac(self): "Prints a graphviz diagram of the BM automaton(for debugging)" print("digraph g{") def print_node(node): for subnode_key in node.transition_table.keys(): subnode = node.transition_table[subnode_key] print("%d -> %d [label=%s] //%s" % (node.id, subnode.id, type_repr(subnode_key), str(subnode.fixers))) if subnode_key == 1: print(subnode.content) print_node(subnode) print_node(self.root) print("}") # taken from pytree.py for debugging; only used by print_ac _type_reprs = {} def type_repr(type_num): global _type_reprs if not _type_reprs: from .pygram import python_symbols # printing tokens is possible but not as useful # from .pgen2 import token // token.__dict__.items(): for name, val in python_symbols.__dict__.items(): if type(val) == int: _type_reprs[val] = name return _type_reprs.setdefault(type_num, type_num) PK1] PatternGrammar.txtnu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. # A grammar to describe tree matching patterns. # Not shown here: # - 'TOKEN' stands for any token (leaf node) # - 'any' stands for any node (leaf or interior) # With 'any' we can still specify the sub-structure. # The start symbol is 'Matcher'. Matcher: Alternatives ENDMARKER Alternatives: Alternative ('|' Alternative)* Alternative: (Unit | NegatedUnit)+ Unit: [NAME '='] ( STRING [Repeater] | NAME [Details] [Repeater] | '(' Alternatives ')' [Repeater] | '[' Alternatives ']' ) NegatedUnit: 'not' (STRING | NAME [Details] | '(' Alternatives ')') Repeater: '*' | '+' | '{' NUMBER [',' NUMBER] '}' Details: '<' Alternatives '>' PK1]"1 __init__.pyonu[ {fc@sdS(N((((s(/usr/lib64/python2.7/lib2to3/__init__.pyttPK1]B!! Grammar.txtnu[# Grammar for 2to3. This grammar supports Python 2.x and 3.x. # NOTE WELL: You should also follow all the steps listed at # https://devguide.python.org/grammar/ # Start symbols for the grammar: # file_input is a module or sequence of commands read from an input file; # single_input is a single interactive statement; # eval_input is the input for the eval() and input() functions. # NB: compound_stmt in single_input is followed by extra NEWLINE! file_input: (NEWLINE | stmt)* ENDMARKER single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE eval_input: testlist NEWLINE* ENDMARKER decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE decorators: decorator+ decorated: decorators (classdef | funcdef | async_funcdef) async_funcdef: ASYNC funcdef funcdef: 'def' NAME parameters ['->' test] ':' suite parameters: '(' [typedargslist] ')' # The following definition for typedarglist is equivalent to this set of rules: # # arguments = argument (',' argument)* # argument = tfpdef ['=' test] # kwargs = '**' tname [','] # args = '*' [tname] # kwonly_kwargs = (',' argument)* [',' [kwargs]] # args_kwonly_kwargs = args kwonly_kwargs | kwargs # poskeyword_args_kwonly_kwargs = arguments [',' [args_kwonly_kwargs]] # typedargslist_no_posonly = poskeyword_args_kwonly_kwargs | args_kwonly_kwargs # typedarglist = arguments ',' '/' [',' [typedargslist_no_posonly]])|(typedargslist_no_posonly)" # # It needs to be fully expanded to allow our LL(1) parser to work on it. typedargslist: tfpdef ['=' test] (',' tfpdef ['=' test])* ',' '/' [ ',' [((tfpdef ['=' test] ',')* ('*' [tname] (',' tname ['=' test])* [',' ['**' tname [',']]] | '**' tname [',']) | tfpdef ['=' test] (',' tfpdef ['=' test])* [','])] ] | ((tfpdef ['=' test] ',')* ('*' [tname] (',' tname ['=' test])* [',' ['**' tname [',']]] | '**' tname [',']) | tfpdef ['=' test] (',' tfpdef ['=' test])* [',']) tname: NAME [':' test] tfpdef: tname | '(' tfplist ')' tfplist: tfpdef (',' tfpdef)* [','] # The following definition for varargslist is equivalent to this set of rules: # # arguments = argument (',' argument )* # argument = vfpdef ['=' test] # kwargs = '**' vname [','] # args = '*' [vname] # kwonly_kwargs = (',' argument )* [',' [kwargs]] # args_kwonly_kwargs = args kwonly_kwargs | kwargs # poskeyword_args_kwonly_kwargs = arguments [',' [args_kwonly_kwargs]] # vararglist_no_posonly = poskeyword_args_kwonly_kwargs | args_kwonly_kwargs # varargslist = arguments ',' '/' [','[(vararglist_no_posonly)]] | (vararglist_no_posonly) # # It needs to be fully expanded to allow our LL(1) parser to work on it. varargslist: vfpdef ['=' test ](',' vfpdef ['=' test])* ',' '/' [',' [ ((vfpdef ['=' test] ',')* ('*' [vname] (',' vname ['=' test])* [',' ['**' vname [',']]] | '**' vname [',']) | vfpdef ['=' test] (',' vfpdef ['=' test])* [',']) ]] | ((vfpdef ['=' test] ',')* ('*' [vname] (',' vname ['=' test])* [',' ['**' vname [',']]]| '**' vname [',']) | vfpdef ['=' test] (',' vfpdef ['=' test])* [',']) vname: NAME vfpdef: vname | '(' vfplist ')' vfplist: vfpdef (',' vfpdef)* [','] stmt: simple_stmt | compound_stmt simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE small_stmt: (expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt | assert_stmt) expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) | ('=' (yield_expr|testlist_star_expr))*) annassign: ':' test ['=' test] testlist_star_expr: (test|star_expr) (',' (test|star_expr))* [','] augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**=' | '//=') # For normal and annotated assignments, additional restrictions enforced by the interpreter print_stmt: 'print' ( [ test (',' test)* [','] ] | '>>' test [ (',' test)+ [','] ] ) del_stmt: 'del' exprlist pass_stmt: 'pass' flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt break_stmt: 'break' continue_stmt: 'continue' return_stmt: 'return' [testlist_star_expr] yield_stmt: yield_expr raise_stmt: 'raise' [test ['from' test | ',' test [',' test]]] import_stmt: import_name | import_from import_name: 'import' dotted_as_names import_from: ('from' ('.'* dotted_name | '.'+) 'import' ('*' | '(' import_as_names ')' | import_as_names)) import_as_name: NAME ['as' NAME] dotted_as_name: dotted_name ['as' NAME] import_as_names: import_as_name (',' import_as_name)* [','] dotted_as_names: dotted_as_name (',' dotted_as_name)* dotted_name: NAME ('.' NAME)* global_stmt: ('global' | 'nonlocal') NAME (',' NAME)* exec_stmt: 'exec' expr ['in' test [',' test]] assert_stmt: 'assert' test [',' test] compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt async_stmt: ASYNC (funcdef | with_stmt | for_stmt) if_stmt: 'if' namedexpr_test ':' suite ('elif' namedexpr_test ':' suite)* ['else' ':' suite] while_stmt: 'while' namedexpr_test ':' suite ['else' ':' suite] for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite] try_stmt: ('try' ':' suite ((except_clause ':' suite)+ ['else' ':' suite] ['finally' ':' suite] | 'finally' ':' suite)) with_stmt: 'with' with_item (',' with_item)* ':' suite with_item: test ['as' expr] with_var: 'as' expr # NB compile.c makes sure that the default except clause is last except_clause: 'except' [test [(',' | 'as') test]] suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT # Backward compatibility cruft to support: # [ x for x in lambda: True, lambda: False if x() ] # even while also allowing: # lambda x: 5 if x else 2 # (But not a mix of the two) testlist_safe: old_test [(',' old_test)+ [',']] old_test: or_test | old_lambdef old_lambdef: 'lambda' [varargslist] ':' old_test namedexpr_test: test [':=' test] test: or_test ['if' or_test 'else' test] | lambdef or_test: and_test ('or' and_test)* and_test: not_test ('and' not_test)* not_test: 'not' not_test | comparison comparison: expr (comp_op expr)* comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not' star_expr: '*' expr expr: xor_expr ('|' xor_expr)* xor_expr: and_expr ('^' and_expr)* and_expr: shift_expr ('&' shift_expr)* shift_expr: arith_expr (('<<'|'>>') arith_expr)* arith_expr: term (('+'|'-') term)* term: factor (('*'|'@'|'/'|'%'|'//') factor)* factor: ('+'|'-'|'~') factor | power power: [AWAIT] atom trailer* ['**' factor] atom: ('(' [yield_expr|testlist_gexp] ')' | '[' [listmaker] ']' | '{' [dictsetmaker] '}' | '`' testlist1 '`' | NAME | NUMBER | STRING+ | '.' '.' '.') listmaker: (namedexpr_test|star_expr) ( comp_for | (',' (namedexpr_test|star_expr))* [','] ) testlist_gexp: (namedexpr_test|star_expr) ( comp_for | (',' (namedexpr_test|star_expr))* [','] ) lambdef: 'lambda' [varargslist] ':' test trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME subscriptlist: subscript (',' subscript)* [','] subscript: test | [test] ':' [test] [sliceop] sliceop: ':' [test] exprlist: (expr|star_expr) (',' (expr|star_expr))* [','] testlist: test (',' test)* [','] dictsetmaker: ( ((test ':' test | '**' expr) (comp_for | (',' (test ':' test | '**' expr))* [','])) | ((test | star_expr) (comp_for | (',' (test | star_expr))* [','])) ) classdef: 'class' NAME ['(' [arglist] ')'] ':' suite arglist: argument (',' argument)* [','] # "test '=' test" is really "keyword '=' test", but we have no such token. # These need to be in a single rule to avoid grammar that is ambiguous # to our LL(1) parser. Even though 'test' includes '*expr' in star_expr, # we explicitly match '*' here, too, to give it proper precedence. # Illegal combinations and orderings are blocked in ast.c: # multiple (test comp_for) arguments are blocked; keyword unpackings # that precede iterable unpackings are blocked; etc. argument: ( test [comp_for] | test ':=' test | test '=' test | '**' test | '*' test ) comp_iter: comp_for | comp_if comp_for: [ASYNC] 'for' exprlist 'in' testlist_safe [comp_iter] comp_if: 'if' old_test [comp_iter] testlist1: test (',' test)* # not used in grammar, but may appear in "node" passed from Parser to Compiler encoding_decl: NAME yield_expr: 'yield' [yield_arg] yield_arg: 'from' test | testlist_star_expr PK1]kkIf;f; fixer_util.pynu["""Utility functions, node construction macros, etc.""" # Author: Collin Winter # Local imports from .pgen2 import token from .pytree import Leaf, Node from .pygram import python_symbols as syms from . import patcomp ########################################################### ### Common node-construction "macros" ########################################################### def KeywordArg(keyword, value): return Node(syms.argument, [keyword, Leaf(token.EQUAL, "="), value]) def LParen(): return Leaf(token.LPAR, "(") def RParen(): return Leaf(token.RPAR, ")") def Assign(target, source): """Build an assignment statement""" if not isinstance(target, list): target = [target] if not isinstance(source, list): source.prefix = " " source = [source] return Node(syms.atom, target + [Leaf(token.EQUAL, "=", prefix=" ")] + source) def Name(name, prefix=None): """Return a NAME leaf""" return Leaf(token.NAME, name, prefix=prefix) def Attr(obj, attr): """A node tuple for obj.attr""" return [obj, Node(syms.trailer, [Dot(), attr])] def Comma(): """A comma leaf""" return Leaf(token.COMMA, ",") def Dot(): """A period (.) leaf""" return Leaf(token.DOT, ".") def ArgList(args, lparen=LParen(), rparen=RParen()): """A parenthesised argument list, used by Call()""" node = Node(syms.trailer, [lparen.clone(), rparen.clone()]) if args: node.insert_child(1, Node(syms.arglist, args)) return node def Call(func_name, args=None, prefix=None): """A function call""" node = Node(syms.power, [func_name, ArgList(args)]) if prefix is not None: node.prefix = prefix return node def Newline(): """A newline literal""" return Leaf(token.NEWLINE, "\n") def BlankLine(): """A blank line""" return Leaf(token.NEWLINE, "") def Number(n, prefix=None): return Leaf(token.NUMBER, n, prefix=prefix) def Subscript(index_node): """A numeric or string subscript""" return Node(syms.trailer, [Leaf(token.LBRACE, "["), index_node, Leaf(token.RBRACE, "]")]) def String(string, prefix=None): """A string leaf""" return Leaf(token.STRING, string, prefix=prefix) def ListComp(xp, fp, it, test=None): """A list comprehension of the form [xp for fp in it if test]. If test is None, the "if test" part is omitted. """ xp.prefix = "" fp.prefix = " " it.prefix = " " for_leaf = Leaf(token.NAME, "for") for_leaf.prefix = " " in_leaf = Leaf(token.NAME, "in") in_leaf.prefix = " " inner_args = [for_leaf, fp, in_leaf, it] if test: test.prefix = " " if_leaf = Leaf(token.NAME, "if") if_leaf.prefix = " " inner_args.append(Node(syms.comp_if, [if_leaf, test])) inner = Node(syms.listmaker, [xp, Node(syms.comp_for, inner_args)]) return Node(syms.atom, [Leaf(token.LBRACE, "["), inner, Leaf(token.RBRACE, "]")]) def FromImport(package_name, name_leafs): """ Return an import statement in the form: from package import name_leafs""" # XXX: May not handle dotted imports properly (eg, package_name='foo.bar') #assert package_name == '.' or '.' not in package_name, "FromImport has "\ # "not been tested with dotted package names -- use at your own "\ # "peril!" for leaf in name_leafs: # Pull the leaves out of their old tree leaf.remove() children = [Leaf(token.NAME, "from"), Leaf(token.NAME, package_name, prefix=" "), Leaf(token.NAME, "import", prefix=" "), Node(syms.import_as_names, name_leafs)] imp = Node(syms.import_from, children) return imp def ImportAndCall(node, results, names): """Returns an import statement and calls a method of the module: import module module.name()""" obj = results["obj"].clone() if obj.type == syms.arglist: newarglist = obj.clone() else: newarglist = Node(syms.arglist, [obj.clone()]) after = results["after"] if after: after = [n.clone() for n in after] new = Node(syms.power, Attr(Name(names[0]), Name(names[1])) + [Node(syms.trailer, [results["lpar"].clone(), newarglist, results["rpar"].clone()])] + after) new.prefix = node.prefix return new ########################################################### ### Determine whether a node represents a given literal ########################################################### def is_tuple(node): """Does the node represent a tuple literal?""" if isinstance(node, Node) and node.children == [LParen(), RParen()]: return True return (isinstance(node, Node) and len(node.children) == 3 and isinstance(node.children[0], Leaf) and isinstance(node.children[1], Node) and isinstance(node.children[2], Leaf) and node.children[0].value == "(" and node.children[2].value == ")") def is_list(node): """Does the node represent a list literal?""" return (isinstance(node, Node) and len(node.children) > 1 and isinstance(node.children[0], Leaf) and isinstance(node.children[-1], Leaf) and node.children[0].value == "[" and node.children[-1].value == "]") ########################################################### ### Misc ########################################################### def parenthesize(node): return Node(syms.atom, [LParen(), node, RParen()]) consuming_calls = {"sorted", "list", "set", "any", "all", "tuple", "sum", "min", "max", "enumerate"} def attr_chain(obj, attr): """Follow an attribute chain. If you have a chain of objects where a.foo -> b, b.foo-> c, etc, use this to iterate over all objects in the chain. Iteration is terminated by getattr(x, attr) is None. Args: obj: the starting object attr: the name of the chaining attribute Yields: Each successive object in the chain. """ next = getattr(obj, attr) while next: yield next next = getattr(next, attr) p0 = """for_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > """ p1 = """ power< ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | 'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) ) trailer< '(' node=any ')' > any* > """ p2 = """ power< ( 'sorted' | 'enumerate' ) trailer< '(' arglist ')' > any* > """ pats_built = False def in_special_context(node): """ Returns true if node is in an environment where all that is required of it is being iterable (ie, it doesn't matter if it returns a list or an iterator). See test_map_nochange in test_fixers.py for some examples and tests. """ global p0, p1, p2, pats_built if not pats_built: p0 = patcomp.compile_pattern(p0) p1 = patcomp.compile_pattern(p1) p2 = patcomp.compile_pattern(p2) pats_built = True patterns = [p0, p1, p2] for pattern, parent in zip(patterns, attr_chain(node, "parent")): results = {} if pattern.match(parent, results) and results["node"] is node: return True return False def is_probably_builtin(node): """ Check that something isn't an attribute or function name etc. """ prev = node.prev_sibling if prev is not None and prev.type == token.DOT: # Attribute lookup. return False parent = node.parent if parent.type in (syms.funcdef, syms.classdef): return False if parent.type == syms.expr_stmt and parent.children[0] is node: # Assignment. return False if parent.type == syms.parameters or \ (parent.type == syms.typedargslist and ( (prev is not None and prev.type == token.COMMA) or parent.children[0] is node )): # The name of an argument. return False return True def find_indentation(node): """Find the indentation of *node*.""" while node is not None: if node.type == syms.suite and len(node.children) > 2: indent = node.children[1] if indent.type == token.INDENT: return indent.value node = node.parent return "" ########################################################### ### The following functions are to find bindings in a suite ########################################################### def make_suite(node): if node.type == syms.suite: return node node = node.clone() parent, node.parent = node.parent, None suite = Node(syms.suite, [node]) suite.parent = parent return suite def find_root(node): """Find the top level namespace.""" # Scamper up to the top level namespace while node.type != syms.file_input: node = node.parent if not node: raise ValueError("root found before file_input node was found.") return node def does_tree_import(package, name, node): """ Returns true if name is imported from package at the top level of the tree which node belongs to. To cover the case of an import like 'import foo', use None for the package and 'foo' for the name. """ binding = find_binding(name, find_root(node), package) return bool(binding) def is_import(node): """Returns true if the node is an import statement.""" return node.type in (syms.import_name, syms.import_from) def touch_import(package, name, node): """ Works like `does_tree_import` but adds an import statement if it was not imported. """ def is_import_stmt(node): return (node.type == syms.simple_stmt and node.children and is_import(node.children[0])) root = find_root(node) if does_tree_import(package, name, root): return # figure out where to insert the new import. First try to find # the first import and then skip to the last one. insert_pos = offset = 0 for idx, node in enumerate(root.children): if not is_import_stmt(node): continue for offset, node2 in enumerate(root.children[idx:]): if not is_import_stmt(node2): break insert_pos = idx + offset break # if there are no imports where we can insert, find the docstring. # if that also fails, we stick to the beginning of the file if insert_pos == 0: for idx, node in enumerate(root.children): if (node.type == syms.simple_stmt and node.children and node.children[0].type == token.STRING): insert_pos = idx + 1 break if package is None: import_ = Node(syms.import_name, [ Leaf(token.NAME, "import"), Leaf(token.NAME, name, prefix=" ") ]) else: import_ = FromImport(package, [Leaf(token.NAME, name, prefix=" ")]) children = [import_, Newline()] root.insert_child(insert_pos, Node(syms.simple_stmt, children)) _def_syms = {syms.classdef, syms.funcdef} def find_binding(name, node, package=None): """ Returns the node which binds variable name, otherwise None. If optional argument package is supplied, only imports will be returned. See test cases for examples.""" for child in node.children: ret = None if child.type == syms.for_stmt: if _find(name, child.children[1]): return child n = find_binding(name, make_suite(child.children[-1]), package) if n: ret = n elif child.type in (syms.if_stmt, syms.while_stmt): n = find_binding(name, make_suite(child.children[-1]), package) if n: ret = n elif child.type == syms.try_stmt: n = find_binding(name, make_suite(child.children[2]), package) if n: ret = n else: for i, kid in enumerate(child.children[3:]): if kid.type == token.COLON and kid.value == ":": # i+3 is the colon, i+4 is the suite n = find_binding(name, make_suite(child.children[i+4]), package) if n: ret = n elif child.type in _def_syms and child.children[1].value == name: ret = child elif _is_import_binding(child, name, package): ret = child elif child.type == syms.simple_stmt: ret = find_binding(name, child, package) elif child.type == syms.expr_stmt: if _find(name, child.children[0]): ret = child if ret: if not package: return ret if is_import(ret): return ret return None _block_syms = {syms.funcdef, syms.classdef, syms.trailer} def _find(name, node): nodes = [node] while nodes: node = nodes.pop() if node.type > 256 and node.type not in _block_syms: nodes.extend(node.children) elif node.type == token.NAME and node.value == name: return node return None def _is_import_binding(node, name, package=None): """ Will return node if node will import name, or node will import * from package. None is returned otherwise. See test cases for examples. """ if node.type == syms.import_name and not package: imp = node.children[1] if imp.type == syms.dotted_as_names: for child in imp.children: if child.type == syms.dotted_as_name: if child.children[2].value == name: return node elif child.type == token.NAME and child.value == name: return node elif imp.type == syms.dotted_as_name: last = imp.children[-1] if last.type == token.NAME and last.value == name: return node elif imp.type == token.NAME and imp.value == name: return node elif node.type == syms.import_from: # str(...) is used to make life easier here, because # from a.b import parses to ['import', ['a', '.', 'b'], ...] if package and str(node.children[1]).strip() != package: return None n = node.children[3] if package and _find("as", n): # See test_from_import_as for explanation return None elif n.type == syms.import_as_names and _find(name, n): return node elif n.type == syms.import_as_name: child = n.children[2] if child.type == token.NAME and child.value == name: return node elif n.type == token.NAME and n.value == name: return node elif package and n.type == token.STAR: return node return None PK1]PHgfixer_base.pyonu[ {fc@srdZddlZddlmZddlmZddlmZdefdYZ d e fd YZ dS( s2Base class for fixers (optional, but recommended).iNi(tPatternCompiler(tpygram(tdoes_tree_importtBaseFixcBseZdZdZdZdZdZdZdZ e j dZ e ZdZeZdZdZeZeZejZdZdZdZdZdZd d Zd Zdd Z d Z!dZ"dZ#RS(sOptional base class for fixers. The subclass name must be FixFooBar where FooBar is the result of removing underscores and capitalizing the words of the fix name. For example, the class name for a fixer named 'has_key' should be FixHasKey. itposticCs ||_||_|jdS(sInitializer. Subclass may override. Args: options: a dict containing the options passed to RefactoringTool that could be used to customize the fixer through the command line. log: a list to append warnings and other messages to. N(toptionstlogtcompile_pattern(tselfRR((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt__init__0s  cCsC|jdk r?t}|j|jdt\|_|_ndS(sCompiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match(). t with_treeN(tPATTERNtNoneRRtTruetpatternt pattern_tree(RtPC((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyR<s cCs ||_dS(smSet the filename, and a logger derived from it. The main refactoring tool should call this. N(tfilename(RR((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt set_filenameGscCs&i|d6}|jj||o%|S(sReturns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override. tnode(Rtmatch(RRtresults((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyRNs cCs tdS(sReturns the transformation for a given parse tree node. Args: node: the root of the parse tree that matched the fixer. results: a dict mapping symbolic names to part of the match. Returns: None, or a node that is a modified copy of the argument node. The node argument may also be modified in-place to effect the same change. Subclass *must* override. N(tNotImplementedError(RRR((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt transformZsuxxx_todo_changemecCsI|}x,||jkr4|t|jj}q W|jj||S(sReturn a string suitable for use as an identifier The new name is guaranteed not to conflict with other identifiers. (t used_namestunicodetnumberstnexttadd(Rttemplatetname((s*/usr/lib64/python2.7/lib2to3/fixer_base.pytnew_namejs cCs@|jr,t|_|jjd|jn|jj|dS(Ns### In file %s ###(t first_logtFalseRtappendR(Rtmessage((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt log_messageus  cCsX|j}|j}d|_d}|j|||f|rT|j|ndS(sWarn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. usLine %d: could not convert: %sN(t get_linenotclonetprefixR$(RRtreasontlinenot for_outputtmsg((s*/usr/lib64/python2.7/lib2to3/fixer_base.pytcannot_convert{s   cCs'|j}|jd||fdS(sUsed for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. s Line %d: %sN(R%R$(RRR(R)((s*/usr/lib64/python2.7/lib2to3/fixer_base.pytwarnings cCs8|j|_|j|tjd|_t|_dS(sSome fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. iN(RRt itertoolstcountRR R (RttreeR((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt start_trees  cCsdS(sSome fixers need to maintain tree-wide state. This method is called once, at the conclusion of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. N((RR0R((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt finish_treesN($t__name__t __module__t__doc__R R RRRRtloggerR.R/RtsetRtorderR!texplicitt run_ordert _accept_typetkeep_line_ordert BM_compatibleRtpython_symbolstsymsR RRRRRR$R,R-R1R2(((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyRs6       tConditionalFixcBs&eZdZdZdZdZRS(s@ Base class for fixers which not execute if an import is found. cGs#tt|j|d|_dS(N(tsuperR@R1R t _should_skip(Rtargs((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyR1scCsa|jdk r|jS|jjd}|d}dj|d }t||||_|jS(Nt.i(RBR tskip_ontsplittjoinR(RRtpkgR((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyt should_skips N(R3R4R5R RER1RI(((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyR@s ( R5R.tpatcompRtRt fixer_utilRtobjectRR@(((s*/usr/lib64/python2.7/lib2to3/fixer_base.pyts  PK1]!߭btm_matcher.pycnu[ {fc@sdZdZddlZddlZddlmZddlmZddlm Z de fd YZ d e fd YZ ia d ZdS( sA bottom-up tree matching algorithm implementation meant to speed up 2to3's matching process. After the tree patterns are reduced to their rarest linear path, a linear Aho-Corasick automaton is created. The linear automaton traverses the linear paths from the leaves to the root of the AST and returns a set of nodes for further matching. This reduces significantly the number of candidate nodes.s+George Boutsioukis iN(t defaultdicti(tpytree(t reduce_treetBMNodecBs#eZdZejZdZRS(s?Class for a node of the Aho-Corasick automaton used in matchingcCs1i|_g|_ttj|_d|_dS(Nt(ttransition_tabletfixerstnextRtcounttidtcontent(tself((s+/usr/lib64/python2.7/lib2to3/btm_matcher.pyt__init__s  (t__name__t __module__t__doc__t itertoolsRR (((s+/usr/lib64/python2.7/lib2to3/btm_matcher.pyRs t BottomMatchercBs;eZdZdZdZdZdZdZRS(sgThe main matcher class. After instantiating the patterns should be added using the add_fixer methodcCsFt|_t|_|jg|_g|_tjd|_dS(NtRefactoringTool( tsettmatchRtroottnodesRtloggingt getLoggertlogger(R ((s+/usr/lib64/python2.7/lib2to3/btm_matcher.pyR s    cCsh|jj|t|j}|j}|j|d|j}x|D]}|jj|qJWdS(sReduces a fixer's pattern tree to a linear path and adds it to the matcher(a common Aho-Corasick automaton). The fixer is appended on the matching states and called when they are reachedtstartN(RtappendRt pattern_treetget_linear_subpatterntaddR(R tfixerttreetlineart match_nodest match_node((s+/usr/lib64/python2.7/lib2to3/btm_matcher.pyt add_fixer%s   cCs|s |gSt|dtrg}xU|dD]I}|j|d|}x+|D]#}|j|j|d|qSWq1W|S|d|jkrt}||j|d     !          cs*dGHfd|jdGHdS(s<Prints a graphviz diagram of the BM automaton(for debugging)s digraph g{csvxo|jjD]^}|j|}d|j|jt|t|jfGH|dkrd|jGHn|qWdS(Ns%d -> %d [label=%s] //%si(RR7R t type_reprtstrRR (tnodet subnode_keytsubnode(t print_node(s+/usr/lib64/python2.7/lib2to3/btm_matcher.pyREs '  t}N(R(R ((REs+/usr/lib64/python2.7/lib2to3/btm_matcher.pytprint_acs (R RRR R$RR?RG(((s+/usr/lib64/python2.7/lib2to3/btm_matcher.pyRs   " =cCshtsXddlm}x?|jjD]+\}}t|tkr&|t|s   PK1]r$_v_v pytree.pycnu[ {fc@sdZdZddlZddlZddlmZdZiadZdefdYZ d e fd YZ d e fd YZ d Z defdYZ de fdYZde fdYZde fdYZde fdYZdZdS(s Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here. s#Guido van Rossum iN(tStringIOicCshtsXddlm}x?|jjD]+\}}t|tkr&|t|tpropertyRARBRCRDRFtsyst version_infoRJ(((s&/usr/lib64/python2.7/lib2to3/pytree.pyR s6            tNodecBseZdZddddZdZdZejdkrHeZ ndZ dZ dZ d Z d Zd ZeeeZd Zd ZdZRS(s+Concrete implementation for interior nodes.cCs|dkst|||_t||_x;|jD]0}|jdksatt|||_q:W|dk r||_n|r||_n d|_dS(s Initializer. Takes a type constant (a symbol number >= 256), a sequence of child nodes, and an optional context keyword argument. As a side effect, the parent pointers of the children are updated. iN( RRR*R,R&R'treprR#tfixers_applied(RRR,tcontextR#RUR4((s&/usr/lib64/python2.7/lib2to3/pytree.pyt__init__s  !    cCs#d|jjt|j|jfS(s)Return a canonical string representation.s %s(%s, %r)(RRKR RR,(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyt__repr__ s  cCsdjtt|jS(sk Return a pretty string representation. This reproduces the input source exactly. u(tjointmapRHR,(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyt __unicode__siicCs"|j|jf|j|jfkS(sCompare two nodes for equality.(RR,(RR((s&/usr/lib64/python2.7/lib2to3/pytree.pyRscCs5t|jg|jD]}|j^qd|jS(s$Return a cloned (deep) copy of self.RU(RSRR,RRU(RR4((s&/usr/lib64/python2.7/lib2to3/pytree.pyR!s+ccs9x-|jD]"}x|jD] }|VqWq W|VdS(s*Return a post-order iterator for the tree.N(R,R(RR@R9((s&/usr/lib64/python2.7/lib2to3/pytree.pyR&s ccs9|Vx-|jD]"}x|jD] }|Vq"WqWdS(s)Return a pre-order iterator for the tree.N(R,R(RR@R9((s&/usr/lib64/python2.7/lib2to3/pytree.pyR-scCs|js dS|jdjS(sO The whitespace and comments preceding this node in the input. ti(R,R#(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyt_prefix_getter4s cCs |jr||jd_ndS(Ni(R,R#(RR#((s&/usr/lib64/python2.7/lib2to3/pytree.pyt_prefix_setter<s cCs4||_d|j|_||j|<|jdS(s Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. N(R&R'R,R0(RR=R@((s&/usr/lib64/python2.7/lib2to3/pytree.pyt set_childBs  cCs*||_|jj|||jdS(s Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. N(R&R,tinsertR0(RR=R@((s&/usr/lib64/python2.7/lib2to3/pytree.pyt insert_childLs cCs'||_|jj||jdS(s Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately. N(R&R,R/R0(RR@((s&/usr/lib64/python2.7/lib2to3/pytree.pyt append_childUs N(ii(RKRLRMR'RWRXR[RQRRRJRRRRR]R^RPR#R_RaRb(((s&/usr/lib64/python2.7/lib2to3/pytree.pyRSs$           R7cBseZdZdZdZdZddgdZdZdZ e j dkrZe Z ndZ dZd Zd Zd Zd Zd ZeeeZRS(s'Concrete implementation for leaf nodes.R\icCsd|kodkns(t||dk rR|\|_\|_|_n||_||_|dk r|||_n||_dS(s Initializer. Takes a type constant (a token number < 256), a string value, and an optional context keyword argument. iiN(RR't_prefixR8tcolumnRtvalueRU(RRReRVR#RU((s&/usr/lib64/python2.7/lib2to3/pytree.pyRWhs (     cCsd|jj|j|jfS(s)Return a canonical string representation.s %s(%r, %r)(RRKRRe(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRX{s cCs|jt|jS(sk Return a pretty string representation. This reproduces the input source exactly. (R#RHRe(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyR[sicCs"|j|jf|j|jfkS(sCompare two nodes for equality.(RRe(RR((s&/usr/lib64/python2.7/lib2to3/pytree.pyRscCs4t|j|j|j|j|jffd|jS(s$Return a cloned (deep) copy of self.RU(R7RReR#R8RdRU(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRsccs |VdS(N((R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRCsccs |VdS(s*Return a post-order iterator for the tree.N((R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRsccs |VdS(s)Return a pre-order iterator for the tree.N((R((s&/usr/lib64/python2.7/lib2to3/pytree.pyRscCs|jS(sP The whitespace and comments preceding this token in the input. (Rc(R((s&/usr/lib64/python2.7/lib2to3/pytree.pyR]scCs|j||_dS(N(R0Rc(RR#((s&/usr/lib64/python2.7/lib2to3/pytree.pyR^s N(ii(RKRLRMRcR8RdR'RWRXR[RQRRRJRRRCRRR]R^RPR#(((s&/usr/lib64/python2.7/lib2to3/pytree.pyR7_s&           cCsk|\}}}}|s'||jkrTt|dkrA|dSt||d|St||d|SdS(s Convert raw node information to a Node or Leaf instance. This is passed to the parser driver which calls it whenever a reduction of a grammar rule produces a new complete node, so that the tree is build strictly bottom-up. iiRVN(t number2symboltlenRSR7(tgrtraw_nodeRReRVR,((s&/usr/lib64/python2.7/lib2to3/pytree.pytconverts t BasePatterncBs\eZdZdZdZdZdZdZdZ ddZ ddZ dZ RS(s A pattern is a tree matching pattern. It looks for a specific node type (token or symbol), and optionally for a specific content. This is an abstract base class. There are three concrete subclasses: - LeafPattern matches a single leaf node; - NodePattern matches a single node (usually non-leaf); - WildcardPattern matches a sequence of nodes of variable length. cOs%|tk stdtj|S(s>Constructor that prevents BasePattern from being instantiated.sCannot instantiate BasePattern(RkRRR(RRR((s&/usr/lib64/python2.7/lib2to3/pytree.pyRscCsht|j|j|jg}x!|rA|ddkrA|d=q!Wd|jjdjtt |fS(Nis%s(%s)s, ( R RtcontentR R'RRKRYRZRT(RR((s&/usr/lib64/python2.7/lib2to3/pytree.pyRXs cCs|S(s A subclass can define this as a hook for optimizations. Returns either self or another node with the same effect. ((R((s&/usr/lib64/python2.7/lib2to3/pytree.pytoptimizescCs|jdk r%|j|jkr%tS|jdk r~d}|dk rOi}n|j||setS|r~|j|q~n|dk r|jr|||j= 256). If the type is None this matches *any* single node (leaf or not), except if content is not None, in which it only matches non-leaf nodes that also match the content pattern. The content, if not None, must be a sequence of Patterns that must match the node's children exactly. If the content is given, the type must not be None. If a name is given, the matching node is stored in the results dict under that key. iN(R'RR)RwRTR*R<RktWildcardPatternR.t wildcardsRRlR (RRRlR R=titem((s&/usr/lib64/python2.7/lib2to3/pytree.pyRWFs  " !  cCs|jrhxXt|j|jD]A\}}|t|jkr|dk r\|j|ntSqWtSt|jt|jkrtSx9t |j|jD]"\}}|j ||stSqWtS(s Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. N( RzRuRlR,RgR'RoR.R+tzipRr(RR9RptcRqt subpatternR@((s&/usr/lib64/python2.7/lib2to3/pytree.pyRncs " "N(RKRLR+RzR'RWRn(((s&/usr/lib64/python2.7/lib2to3/pytree.pyRxBsRycBsheZdZd ded dZdZd dZd dZdZ dZ dZ d Z RS( s A wildcard pattern can match zero or more nodes. This has all the flexibility needed to implement patterns like: .* .+ .? .{m,n} (a b c | d e | f) (...)* (...)+ (...)? (...){m,n} except it always uses non-greedy matching. icCsd|ko"|ko"tkns9t||f|dk rttt|}t|sxtt|x/|D]$}t|stt|qWn||_||_||_ ||_ dS(s Initializer. Args: content: optional sequence of subsequences of patterns; if absent, matches one node; if present, each subsequence is an alternative [*] min: optional minimum number of times to match, default 0 max: optional maximum number of times to match, default HUGE name: optional name assigned to this match [*] Thus, if content is [[a, b, c], [d, e], [f, g, h]] this is equivalent to (a b c | d e | f g h); if content is None, this is equivalent to '.' in regular expression terms. The min and max parameters work as follows: min=0, max=maxint: .* min=1, max=maxint: .+ min=0, max=1: .? min=1, max=1: . If content is not None, replace the dot with the parenthesized list of alternatives, e.g. (a b c | d e | f g h)* iN( tHUGERR'ttupleRZRgRTRltmintmaxR (RRlRRR talt((s&/usr/lib64/python2.7/lib2to3/pytree.pyRWs9  %   cCs/d}|jdk rWt|jdkrWt|jddkrW|jdd}n|jdkr|jdkr|jdkrtd|jS|dk r|j|jkr|jSn|jdkr+t|t r+|jdkr+|j|jkr+t |j|j|j|j|j|jS|S(s+Optimize certain stacked wildcard patterns.iiR N( R'RlRgRRRxR RmR)Ry(RR~((s&/usr/lib64/python2.7/lib2to3/pytree.pyRms . !    cCs|j|g|S(s'Does this pattern exactly match a node?(Rt(RR9Rp((s&/usr/lib64/python2.7/lib2to3/pytree.pyRrscCsuxn|j|D]]\}}|t|kr|dk ri|j||jrit|||j s"   pN V,=#PK1]sg&g&main.pycnu[ {fc@sdZddlmZddlZddlZddlZddlZddlZddlZddl m Z dZ de j fdYZ d Zdd ZdS( s Main program for 2to3. i(twith_statementNi(trefactorc Cs:|j}|j}tj||||ddddS(s%Return a unified diff of two strings.s (original)s (refactored)tlinetermt(t splitlinestdifflibt unified_diff(tatbtfilename((s$/usr/lib64/python2.7/lib2to3/main.pyt diff_textss    tStdoutRefactoringToolcBs;eZdZddddZdZdZdZRS(s2 A refactoring tool that can avoid overwriting its input files. Prints output to stdout. Output files can optionally be written to a different directory and or have an extra file suffix appended to their name for use in situations where you do not want to replace the input files. Rc Csv||_||_|r;|jtj r;|tj7}n||_||_||_tt |j |||dS(sF Args: fixers: A list of fixers to import. options: A dict with RefactoringTool configuration. explicit: A list of fixers to run even if they are explicit. nobackups: If true no backup '.bak' files will be created for those files that are being refactored. show_diffs: Should diffs of the refactoring be printed to stdout? input_base_dir: The base directory for all input files. This class will strip this path prefix off of filenames before substituting it with output_dir. Only meaningful if output_dir is supplied. All files processed by refactor() must start with this path. output_dir: If supplied, all converted files will be written into this directory tree instead of input_base_dir. append_suffix: If supplied, all files output by this tool will have this appended to their filename. Useful for changing .py to .py3 for example by passing append_suffix='3'. N( t nobackupst show_diffstendswithtostsept_input_base_dirt _output_dirt_append_suffixtsuperR t__init__( tselftfixerstoptionstexplicitR R tinput_base_dirt output_dirt append_suffix((s$/usr/lib64/python2.7/lib2to3/main.pyR$s     cOs3|jj|||f|jj|||dS(N(terrorstappendtloggerterror(Rtmsgtargstkwargs((s$/usr/lib64/python2.7/lib2to3/main.pyt log_errorAsc Cs|}|jre|j|jrItjj|j|t|j}qetd||jfn|jr~||j7}n||krtjj |}tjj |stj |n|j d||n|j sy|d}tjj|r6ytj|Wq6tjk r2}|j d|q6Xnytj||Wqytjk ru}|j d||qyXntt|j} | |||||j stj||n||krtj||ndS(Ns5filename %s does not start with the input_base_dir %ssWriting converted %s to %s.s.baksCan't remove backup %ssCan't rename %s to %s(Rt startswithRRtpathtjointlent ValueErrorRtdirnametisdirtmakedirst log_messageR tlexiststremoveR trenameRR t write_filetshutiltcopymode( Rtnew_textR told_texttencodingt orig_filenameRtbackupterrtwrite((s$/usr/lib64/python2.7/lib2to3/main.pyR1Es@         cCs|r|jd|n|jd||jrt|||}y_|jdk r|j(x|D] }|GHqgWtjjWdQXnx|D] }|GHqWWqtk rt d|fdSXndS(NsNo changes to %ss Refactored %ss+couldn't encode %s's diff for your terminal( R-R R t output_locktNonetsyststdouttflushtUnicodeEncodeErrortwarn(RtoldtnewR tequalt diff_linestline((s$/usr/lib64/python2.7/lib2to3/main.pyt print_outputls"        (t__name__t __module__t__doc__RR$R1RG(((s$/usr/lib64/python2.7/lib2to3/main.pyR s   'cCstjd|fIJdS(Ns WARNING: %s(R=tstderr(R!((s$/usr/lib64/python2.7/lib2to3/main.pyRAsc stjdd}|jdddddd|jd d dd d gdd |jddddd ddddd|jdddd d gdd|jdddddd|jdddddd|jdddddd |jd!dddd"|jd#d$dddd%|jd&d'ddd tdd(|jd)d*dddd+d d,dd-|jd.d/dddd0|jd1dddd+d d,dd2t}i}|j|\}}|jrt|d3<|jstd4nt|_n|j r'|j r'|j d5n|j rJ|j rJ|j d6n|j rj|j rjtd7n|j r|j r|j d8n|jrd9GHxtjD] }|GHqW|sd:Sn|stjd;IJtjd<IJd=Sd>|krt}|jrtjd?IJd=Sn|jr0t|d@stalls.fix_s7Output in %r will mirror the input directory %r layout.RRRs+Sorry, -j isn't supported on this platform.(5toptparset OptionParsert add_optiontFalset parse_argsRUtTrueR:RARR R t add_suffixtno_diffst list_fixesRtget_all_fix_namesR=RKRWtverbosetloggingtDEBUGtINFOt basicConfigt getLoggertsettget_fixers_from_packagetnofixR[taddtuniont differenceRR&t commonprefixRRR+R*trstriptinfoR tsortedRtrefactor_stdint doctests_onlyt processestMultiprocessingUnsupportedtAssertionErrort summarizeRStbool(R\R"tparserRxtflagsRtfixnameRYRt avail_fixestunwanted_fixesRt all_presentR[t requestedt fixer_namesRtrt((R\s$/usr/lib64/python2.7/lib2to3/main.pytmains                              (RJt __future__RR=RRRiR2R^RRR tMultiprocessRefactoringToolR RAR<R(((s$/usr/lib64/python2.7/lib2to3/main.pyts       h PK1]!߭btm_matcher.pyonu[ {fc@sdZdZddlZddlZddlmZddlmZddlm Z de fd YZ d e fd YZ ia d ZdS( sA bottom-up tree matching algorithm implementation meant to speed up 2to3's matching process. After the tree patterns are reduced to their rarest linear path, a linear Aho-Corasick automaton is created. The linear automaton traverses the linear paths from the leaves to the root of the AST and returns a set of nodes for further matching. This reduces significantly the number of candidate nodes.s+George Boutsioukis iN(t defaultdicti(tpytree(t reduce_treetBMNodecBs#eZdZejZdZRS(s?Class for a node of the Aho-Corasick automaton used in matchingcCs1i|_g|_ttj|_d|_dS(Nt(ttransition_tabletfixerstnextRtcounttidtcontent(tself((s+/usr/lib64/python2.7/lib2to3/btm_matcher.pyt__init__s  (t__name__t __module__t__doc__t itertoolsRR (((s+/usr/lib64/python2.7/lib2to3/btm_matcher.pyRs t BottomMatchercBs;eZdZdZdZdZdZdZRS(sgThe main matcher class. After instantiating the patterns should be added using the add_fixer methodcCsFt|_t|_|jg|_g|_tjd|_dS(NtRefactoringTool( tsettmatchRtroottnodesRtloggingt getLoggertlogger(R ((s+/usr/lib64/python2.7/lib2to3/btm_matcher.pyR s    cCsh|jj|t|j}|j}|j|d|j}x|D]}|jj|qJWdS(sReduces a fixer's pattern tree to a linear path and adds it to the matcher(a common Aho-Corasick automaton). The fixer is appended on the matching states and called when they are reachedtstartN(RtappendRt pattern_treetget_linear_subpatterntaddR(R tfixerttreetlineart match_nodest match_node((s+/usr/lib64/python2.7/lib2to3/btm_matcher.pyt add_fixer%s   cCs|s |gSt|dtrg}xU|dD]I}|j|d|}x+|D]#}|j|j|d|qSWq1W|S|d|jkrt}||j|d     !          cs*dGHfd|jdGHdS(s<Prints a graphviz diagram of the BM automaton(for debugging)s digraph g{csvxo|jjD]^}|j|}d|j|jt|t|jfGH|dkrd|jGHn|qWdS(Ns%d -> %d [label=%s] //%si(RR7R t type_reprtstrRR (tnodet subnode_keytsubnode(t print_node(s+/usr/lib64/python2.7/lib2to3/btm_matcher.pyREs '  t}N(R(R ((REs+/usr/lib64/python2.7/lib2to3/btm_matcher.pytprint_acs (R RRR R$RR?RG(((s+/usr/lib64/python2.7/lib2to3/btm_matcher.pyRs   " =cCshtsXddlm}x?|jjD]+\}}t|tkr&|t|s   PK1]S[9[9fixer_util.pycnu[ {fc @sdZddlmZddlmZddlmZmZddlm Z ddl m Z dZ d Zd Zd Zd5d Zd ZdZdZeedZd5d5dZdZdZd5dZdZd5dZd5dZdZdZdZ dZ!e"ddddd d!d"d#d$d%g Z#d&Z$d'a%d(a&d)a'e(a)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1e"e j2e j3gZ4d5d2Z5e"e j3e j2e j6gZ7d3Z8d5d4Z9d5S(6s1Utility functions, node construction macros, etc.i(tislicei(ttoken(tLeaftNode(tpython_symbols(tpatcompcCs%ttj|ttjd|gS(Nu=(RtsymstargumentRRtEQUAL(tkeywordtvalue((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt KeywordArgs cCsttjdS(Nu((RRtLPAR(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytLParenscCsttjdS(Nu)(RRtRPAR(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytRParenscCslt|ts|g}nt|ts?d|_|g}nttj|ttjdddg|S(sBuild an assignment statementu u=tprefix( t isinstancetlistRRRtatomRRR(ttargettsource((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytAssigns    cCsttj|d|S(sReturn a NAME leafR(RRtNAME(tnameR((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytName&scCs|ttjt|ggS(sA node tuple for obj.attr(RRttrailertDot(tobjtattr((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytAttr*scCsttjdS(s A comma leafu,(RRtCOMMA(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytComma.scCsttjdS(sA period (.) leafu.(RRtDOT(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyR2scCsMttj|j|jg}|rI|jdttj|n|S(s-A parenthesised argument list, used by Call()i(RRRtclonet insert_childtarglist(targstlparentrparentnode((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytArgList6s$cCs:ttj|t|g}|dk r6||_n|S(sA function callN(RRtpowerR)tNoneR(t func_nameR%RR(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytCall=s  cCsttjdS(sA newline literalu (RRtNEWLINE(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytNewlineDscCsttjdS(s A blank lineu(RRR.(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt BlankLineHscCsttj|d|S(NR(RRtNUMBER(tnR((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytNumberLscCs1ttjttjd|ttjdgS(sA numeric or string subscriptu[u](RRRRRtLBRACEtRBRACE(t index_node((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt SubscriptOscCsttj|d|S(s A string leafR(RRtSTRING(tstringR((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytStringUsc Csd|_d|_d|_ttjd}d|_ttjd}d|_||||g}|rd|_ttjd}d|_|jttj||gnttj|ttj |g}ttj ttj d|ttj dgS(suA list comprehension of the form [xp for fp in it if test]. If test is None, the "if test" part is omitted. uu uforuinuifu[u]( RRRRtappendRRtcomp_ift listmakertcomp_forRR4R5( txptfptitttesttfor_leaftin_leaft inner_argstif_leaftinner((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytListCompYs$       "$ cCsx|D]}|jqWttjdttj|ddttjdddttj|g}ttj|}|S(sO Return an import statement in the form: from package import name_leafsufromRu uimport(tremoveRRRRRtimport_as_namest import_from(t package_namet name_leafstleaftchildrentimp((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt FromImportqs cCst|tr.|jttgkr.tSt|tot|jdkot|jdtot|jdtot|jdto|jdjdko|jdjdkS(s(Does the node represent a tuple literal?iiiiu(u)( RRROR RtTruetlenRR (R(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytis_tuples*cCszt|toyt|jdkoyt|jdtoyt|jdtoy|jdjdkoy|jdjdkS(s'Does the node represent a list literal?iiiu[u](RRRSRORR (R(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytis_lists cCsttjt|tgS(N(RRRR R(R(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt parenthesizestsortedRtsettanytallttupletsumtmintmaxt enumerateccs4t||}x|r/|Vt||}qWdS(slFollow an attribute chain. If you have a chain of objects where a.foo -> b, b.foo-> c, etc, use this to iterate over all objects in the chain. Iteration is terminated by getattr(x, attr) is None. Args: obj: the starting object attr: the name of the chaining attribute Yields: Each successive object in the chain. N(tgetattr(RRtnext((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt attr_chains sefor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > s power< ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | 'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) ) trailer< '(' node=any ')' > any* > s` power< ( 'sorted' | 'enumerate' ) trailer< '(' arglist ')' > any* > cCsts<tjtatjtatjtatantttg}xRt|t|dD]8\}}i}|j ||rd|d|krdtSqdWt S(s Returns true if node is in an environment where all that is required of it is being iterable (ie, it doesn't matter if it returns a list or an iterator). See test_map_nochange in test_fixers.py for some examples and tests. tparentR(( t pats_builtRtcompile_patterntp0tp1tp2RRtzipRbtmatchtFalse(R(tpatternstpatternRctresults((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytin_special_contexts %"cCs|j}|dk r+|jtjkr+tS|j}|jtjtj fkrStS|jtj kr||j d|kr|tS|jtj ks|jtj kr|dk r|jtjks|j d|krtStS(sG Check that something isn't an attribute or function name etc. iN(t prev_siblingR+ttypeRR!RkRcRtfuncdeftclassdeft expr_stmtROt parameterst typedargslistRRR(R(tprevRc((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytis_probably_builtins  %cCspxi|dk rk|jtjkr_t|jdkr_|jd}|jtjkr_|jSn|j }qWdS(sFind the indentation of *node*.iiuN( R+RqRtsuiteRSRORtINDENTR Rc(R(tindent((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytfind_indentations'   cCsW|jtjkr|S|j}|jd}|_ttj|g}||_|S(N(RqRRyR"RcR+R(R(RcRy((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt make_suites  cCs;x4|jtjkr6|j}|stdqqW|S(sFind the top level namespace.s,root found before file_input node was found.(RqRt file_inputRct ValueError(R(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt find_roots  cCs"t|t||}t|S(s Returns true if name is imported from package at the top level of the tree which node belongs to. To cover the case of an import like 'import foo', use None for the package and 'foo' for the name. (t find_bindingRtbool(tpackageRR(tbinding((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytdoes_tree_importscCs|jtjtjfkS(s0Returns true if the node is an import statement.(RqRt import_nameRK(R(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt is_import"sc Csd}t|}t|||r+dSd}}xnt|jD]]\}}||scqEnx1t|j|D]\}}||swPqwqwW||}PqEW|dkrxbt|jD]N\}}|jtjkr|jr|jdjtjkr|d}PqqWn|dkr\t tj t tj dt tj |ddg} n$t|t tj |ddg} | tg} |j|t tj| dS(s\ Works like `does_tree_import` but adds an import statement if it was not imported. cSs,|jtjko+|jo+t|jdS(Ni(RqRt simple_stmtROR(R(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytis_import_stmt)sNiiuimportRu (RRR_RORqRRRR8R+RRRRRQR/R#( RRR(Rtroott insert_postoffsettidxtnode2timport_RO((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyt touch_import&s4            !$cCsKxD|jD]9}d}|jtjkrst||jdrB|St|t|jd|}|r |}q n|jtjtj fkrt|t|jd|}|r |}q na|jtj kr|t|t|jd|}|r|}q xt |jdD]b\}}|jt j kr|jdkrt|t|j|d|}|ru|}quqqWn|jtkr|jdj|kr|}nvt|||r|}n[|jtjkrt|||}n4|jtjkr t||jdr |}q n|r |s0|St|rC|Sq q WdS( s Returns the node which binds variable name, otherwise None. If optional argument package is supplied, only imports will be returned. See test cases for examples.iiiit:iiN(ROR+RqRtfor_stmtt_findRR}tif_stmtt while_stmtttry_stmtR_RtCOLONR t _def_symst_is_import_bindingRRtR(RR(RtchildtretR2titkid((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyRTsH    !#%     cCs||g}xl|rw|j}|jdkrO|jtkrO|j|jq |jtjkr |j|kr |Sq WdS(Ni( tpopRqt _block_symstextendRORRR R+(RR(tnodes((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyRs   !cCs'|jtjkr| r|jd}|jtjkrx|jD]Z}|jtjkrw|jdj|kr|SqB|jtjkrB|j|krB|SqBWq#|jtjkr|jd}|jtjkr|j|kr|Sq#|jtjkr#|j|kr#|Sn|jtj kr#|rMt |jdj |krMdS|jd}|rst d|rsdS|jtjkrt ||r|S|jtjkr|jd}|jtjkr |j|kr |Sq#|jtjkr|j|kr|S|r#|jtjkr#|SndS(s Will reuturn node if node will import name, or node will import * from package. None is returned otherwise. See test cases for examples. iiiiuasN(RqRRROtdotted_as_namestdotted_as_nameR RRRKtunicodetstripR+RRJtimport_as_nametSTAR(R(RRRPRtlastR2((s*/usr/lib64/python2.7/lib2to3/fixer_util.pyRs@ !  !!% ! !!N(:t__doc__t itertoolsRtpgen2RtpytreeRRtpygramRRtRR R RRR+RRR RR)R-R/R0R3R7R:RHRQRTRURVRXtconsuming_callsRbRfRgRhRkRdRoRxR|R}RRRRRsRrRRRRRR(((s*/usr/lib64/python2.7/lib2to3/fixer_util.pytsZ                       - * PK1].?&& btm_utils.pynu["Utility functions used by the btm_matcher module" from . import pytree from .pgen2 import grammar, token from .pygram import pattern_symbols, python_symbols syms = pattern_symbols pysyms = python_symbols tokens = grammar.opmap token_labels = token TYPE_ANY = -1 TYPE_ALTERNATIVES = -2 TYPE_GROUP = -3 class MinNode(object): """This class serves as an intermediate representation of the pattern tree during the conversion to sets of leaf-to-root subpatterns""" def __init__(self, type=None, name=None): self.type = type self.name = name self.children = [] self.leaf = False self.parent = None self.alternatives = [] self.group = [] def __repr__(self): return str(self.type) + ' ' + str(self.name) def leaf_to_root(self): """Internal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a single""" node = self subp = [] while node: if node.type == TYPE_ALTERNATIVES: node.alternatives.append(subp) if len(node.alternatives) == len(node.children): #last alternative subp = [tuple(node.alternatives)] node.alternatives = [] node = node.parent continue else: node = node.parent subp = None break if node.type == TYPE_GROUP: node.group.append(subp) #probably should check the number of leaves if len(node.group) == len(node.children): subp = get_characteristic_subpattern(node.group) node.group = [] node = node.parent continue else: node = node.parent subp = None break if node.type == token_labels.NAME and node.name: #in case of type=name, use the name instead subp.append(node.name) else: subp.append(node.type) node = node.parent return subp def get_linear_subpattern(self): """Drives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton's capabilities, leaf_to_root merges each group into a single choice based on 'characteristic'ity, i.e. (a|b c) -> (a|b) if b more characteristic than c Returns: The most 'characteristic'(as defined by get_characteristic_subpattern) path for the compiled pattern tree. """ for l in self.leaves(): subp = l.leaf_to_root() if subp: return subp def leaves(self): "Generator that returns the leaves of the tree" for child in self.children: yield from child.leaves() if not self.children: yield self def reduce_tree(node, parent=None): """ Internal function. Reduces a compiled pattern tree to an intermediate representation suitable for feeding the automaton. This also trims off any optional pattern elements(like [a], a*). """ new_node = None #switch on the node type if node.type == syms.Matcher: #skip node = node.children[0] if node.type == syms.Alternatives : #2 cases if len(node.children) <= 2: #just a single 'Alternative', skip this node new_node = reduce_tree(node.children[0], parent) else: #real alternatives new_node = MinNode(type=TYPE_ALTERNATIVES) #skip odd children('|' tokens) for child in node.children: if node.children.index(child)%2: continue reduced = reduce_tree(child, new_node) if reduced is not None: new_node.children.append(reduced) elif node.type == syms.Alternative: if len(node.children) > 1: new_node = MinNode(type=TYPE_GROUP) for child in node.children: reduced = reduce_tree(child, new_node) if reduced: new_node.children.append(reduced) if not new_node.children: # delete the group if all of the children were reduced to None new_node = None else: new_node = reduce_tree(node.children[0], parent) elif node.type == syms.Unit: if (isinstance(node.children[0], pytree.Leaf) and node.children[0].value == '('): #skip parentheses return reduce_tree(node.children[1], parent) if ((isinstance(node.children[0], pytree.Leaf) and node.children[0].value == '[') or (len(node.children)>1 and hasattr(node.children[1], "value") and node.children[1].value == '[')): #skip whole unit if its optional return None leaf = True details_node = None alternatives_node = None has_repeater = False repeater_node = None has_variable_name = False for child in node.children: if child.type == syms.Details: leaf = False details_node = child elif child.type == syms.Repeater: has_repeater = True repeater_node = child elif child.type == syms.Alternatives: alternatives_node = child if hasattr(child, 'value') and child.value == '=': # variable name has_variable_name = True #skip variable name if has_variable_name: #skip variable name, '=' name_leaf = node.children[2] if hasattr(name_leaf, 'value') and name_leaf.value == '(': # skip parenthesis name_leaf = node.children[3] else: name_leaf = node.children[0] #set node type if name_leaf.type == token_labels.NAME: #(python) non-name or wildcard if name_leaf.value == 'any': new_node = MinNode(type=TYPE_ANY) else: if hasattr(token_labels, name_leaf.value): new_node = MinNode(type=getattr(token_labels, name_leaf.value)) else: new_node = MinNode(type=getattr(pysyms, name_leaf.value)) elif name_leaf.type == token_labels.STRING: #(python) name or character; remove the apostrophes from #the string value name = name_leaf.value.strip("'") if name in tokens: new_node = MinNode(type=tokens[name]) else: new_node = MinNode(type=token_labels.NAME, name=name) elif name_leaf.type == syms.Alternatives: new_node = reduce_tree(alternatives_node, parent) #handle repeaters if has_repeater: if repeater_node.children[0].value == '*': #reduce to None new_node = None elif repeater_node.children[0].value == '+': #reduce to a single occurrence i.e. do nothing pass else: #TODO: handle {min, max} repeaters raise NotImplementedError #add children if details_node and new_node is not None: for child in details_node.children[1:-1]: #skip '<', '>' markers reduced = reduce_tree(child, new_node) if reduced is not None: new_node.children.append(reduced) if new_node: new_node.parent = parent return new_node def get_characteristic_subpattern(subpatterns): """Picks the most characteristic from a list of linear patterns Current order used is: names > common_names > common_chars """ if not isinstance(subpatterns, list): return subpatterns if len(subpatterns)==1: return subpatterns[0] # first pick out the ones containing variable names subpatterns_with_names = [] subpatterns_with_common_names = [] common_names = ['in', 'for', 'if' , 'not', 'None'] subpatterns_with_common_chars = [] common_chars = "[]().,:" for subpattern in subpatterns: if any(rec_test(subpattern, lambda x: type(x) is str)): if any(rec_test(subpattern, lambda x: isinstance(x, str) and x in common_chars)): subpatterns_with_common_chars.append(subpattern) elif any(rec_test(subpattern, lambda x: isinstance(x, str) and x in common_names)): subpatterns_with_common_names.append(subpattern) else: subpatterns_with_names.append(subpattern) if subpatterns_with_names: subpatterns = subpatterns_with_names elif subpatterns_with_common_names: subpatterns = subpatterns_with_common_names elif subpatterns_with_common_chars: subpatterns = subpatterns_with_common_chars # of the remaining subpatterns pick out the longest one return max(subpatterns, key=len) def rec_test(sequence, test_func): """Tests test_func on all items of sequence and items of included sub-iterables""" for x in sequence: if isinstance(x, (list, tuple)): yield from rec_test(x, test_func) else: yield test_func(x) PK1]]fixes/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"      PK1]6fixes/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.pytsPK1]e˺fixes/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.PK1]\g7''fixes/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.pytsPK1]{Wkfixes/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("open"), open_args]) read = [Node(syms.trailer, [Dot(), Name('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 = " " exec_str = String("'exec'", " ") compile_args = open_expr + [Comma(), filename_arg, Comma(), exec_str] compile_call = Call(Name("compile"), compile_args, "") # 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("exec"), args, prefix=node.prefix) PK1]Pr  fixes/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.pytsPK1]CTw fixes/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  PK1]WWfixes/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.pytsPK1]fixes/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 (PK1]p2I  fixes/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 == '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("as", prefix=" ")) if N.type != token.NAME: # Generate a new N for the except clause new_N = Name(self.new_name(), prefix=" ") target = N.clone() target.prefix = "" 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('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 == "": # No space after a comma is legal; no space after "as", # not so much. N.prefix = " " #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) PK1]_;>fixes/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.pytsPK1]d{fixes/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.pytsPK1]Z6  fixes/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 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("print"), [], prefix=bare_print.prefix)) return assert node.children[0] == Name("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, ">>"): 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 = "" 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, "sep", String(repr(sep))) if end is not None: self.add_kwarg(l_args, "end", String(repr(end))) if file is not None: self.add_kwarg(l_args, "file", file) n_stmt = Call(Name("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 = "" n_argument = pytree.Node(self.syms.argument, (Name(s_kwd), pytree.Leaf(token.EQUAL, "="), n_expr)) if l_nodes: l_nodes.append(Comma()) n_argument.prefix = " " l_nodes.append(n_argument) PK1]d{fixes/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.pytsPK1]v fixes/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 "PK1]!x PPfixes/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.pytsPK1]N2Efixes/fix_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("__iter__", prefix=no_call.prefix)) else: node.replace([x.clone() for x in results["call"]]) PK1]Jfixes/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 sPK1]!x PPfixes/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.pytsPK1]+&^^fixes/fix_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 = MAP[attr.value] attr.replace(Name(new, prefix=attr.prefix)) PK1]?kfixes/fix_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("getcwd", prefix=name.prefix)) PK1]5 fixes/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.PK1]=fixes/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)) PK1]WWfixes/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.pytsPK1]6ng fixes/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 = "." + 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(".", [imp]) new.prefix = node.prefix return new def probably_a_local_import(self, imp_name): if imp_name.startswith("."): # Relative imports are certainly not local imports. return False imp_name = imp_name.split(".", 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 PK1]ܾfixes/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.pytsPK1]1Wlfixes/fix_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.pyts4PK1] fixes/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.fixer_util import (Name, Comma, FromImport, Newline, find_indentation, Node, syms) MAPPING = {"urllib": [ ("urllib.request", ["URLopener", "FancyURLopener", "urlretrieve", "_urlopener", "urlopen", "urlcleanup", "pathname2url", "url2pathname", "getproxies"]), ("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 != ",": 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") PK1]?յ fixes/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 " PK1])xxfixes/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 fixer_base from ..fixer_util import ImportAndCall, 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.argument and obj.children[0].value in {'**', '*'}): return # Make no change. names = ('sys', 'intern') new = ImportAndCall(node, results, names) touch_import(None, 'sys', node) return new PK1]8|gfixes/fix_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.pytsFPK1]tfixes/fix_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$ PK1]cۛfixes/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"      PK1]?OOfixes/fix_nonzero.pynu["""Fixer for __nonzero__ -> __bool__ methods.""" # Author: Collin Winter # Local imports from .. import fixer_base from ..fixer_util import Name 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("__bool__", prefix=name.prefix) name.replace(new) PK1]a.eefixes/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("repr"), [expr], prefix=node.prefix) PK1]tڢfixes/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.pytsPK1]RRfixes/fix_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.pytsPK1]M1  fixes/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 ..pytree import Node from ..pygram import python_symbols as syms from ..fixer_util import Name, ArgList, in_special_context class FixZip(fixer_base.ConditionalFix): BM_compatible = True PATTERN = """ power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*] > """ skip_on = "future_builtins.zip" def transform(self, node, results): if self.should_skip(node): return if in_special_context(node): return None args = results['args'].clone() args.prefix = "" trailers = [] if 'trailers' in results: trailers = [n.clone() for n in results['trailers']] for n in trailers: n.prefix = "" new = Node(syms.power, [Name("zip"), args], prefix="") new = Node(syms.power, [Name("list"), ArgList([new])] + trailers) new.prefix = node.prefix return new PK1]0||fixes/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 PK1]2ۭfixes/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 list(MAPPING.items()): for old_attr, new_attr in list(replace.items()): LOOKUP[(module, old_attr)] = new_attr #bare.add(module) #bare.add(old_attr) #yield """ # import_name< 'import' (module=%r # | dotted_as_names< any* module=%r any* >) > # """ % (module, module) yield """ import_from< 'from' module_name=%r 'import' ( attr_name=%r | import_as_name< attr_name=%r 'as' any >) > """ % (module, old_attr, old_attr) yield """ power< module_name=%r trailer< '.' attr_name=%r > any* > """ % (module, old_attr) #yield """bare_name=%s""" % alternates(bare) class FixRenames(fixer_base.BaseFix): BM_compatible = True PATTERN = "|".join(build_pattern()) order = "pre" # Pre-order tree traversal # Don't match the node if it's within another match def match(self, node): match = super(FixRenames, self).match results = match(node) if results: if any(match(obj) for obj in attr_chain(node, "parent")): return False return results return False #def start_tree(self, tree, filename): # super(FixRenames, self).start_tree(tree, filename) # self.replace = {} def transform(self, node, results): mod_name = results.get("module_name") attr_name = results.get("attr_name") #bare_name = results.get("bare_name") #import_mod = results.get("module") if mod_name and attr_name: new_attr = LOOKUP[(mod_name.value, attr_name.value)] attr_name.replace(Name(new_attr, prefix=attr_name.prefix)) PK1]fixes/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.pytsPK1]>ӵ;&&fixes/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 ('imap', 'izip', 'ifilter'): child.value = None child.remove() elif member_name in ('ifilterfalse', 'izip_longest'): node.changed() name_node.value = ('filterfalse' if member_name[1] == 'f' else '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 PK1]fixes/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" PK1]DIu| | fixes/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 .. 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 = " " n_op = Name("in", prefix=" ") if negation: n_not = Name("not", prefix=" ") 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 PK1]6ufixes/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("input", prefix=name.prefix)) PK1])EEfixes/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('functools', 'reduce', node) PK1]ؒfixes/__init__.pycnu[ {fc@sdS(N((((s./usr/lib64/python2.7/lib2to3/fixes/__init__.pyttPK1]CTw fixes/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  PK1]\fixes/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 sPK1]_;>fixes/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.pytsPK1]_ \  fixes/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 = "" T.prefix = " " test = Call(Name("isinstance"), [x, Comma(), T]) if "n" in results: test.prefix = " " test = Node(syms.not_test, [Name("not"), test]) test.prefix = node.prefix return test def transform_while(self, node, results): one = results["while"] one.replace(Name("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("sorted", prefix=list_call.prefix)) elif simple_expr: new = simple_expr.clone() new.prefix = "" simple_expr.replace(Call(Name("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 "\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("\n")[0], next_stmt[0].prefix) next_stmt[0].prefix = "\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("\n")[0] PK1],b fixes/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 (PK1]&fixes/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 = {"unichr" : "chr", "unicode" : "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 '\'"' and '\\' in val: val = r'\\'.join([ v.replace('\\u', r'\\u').replace('\\U', r'\\U') for v in val.split(r'\\') ]) if val[0] in 'uU': val = val[1:] if val == node.value: return node new = node.clone() new.value = val return new PK1]Y  fixes/fix_metaclass.pynu["""Fixer for __metaclass__ = X -> (metaclass=X) methods. The various forms of classef (inherits nothing, inherits once, inherits 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 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 # !%@#! one-liners 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 == '__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 = '' 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, ')')) node.insert_child(2, arglist) node.insert_child(2, Leaf(token.LPAR, '(')) 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, ',')) meta_txt.prefix = ' ' else: meta_txt.prefix = '' # 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 = '' expr_stmt.children[2].prefix = '' 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, 'pass') pass_leaf.prefix = orig_meta_prefix node.append_child(pass_leaf) node.append_child(Leaf(token.NEWLINE, '\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, 'pass') suite.insert_child(-1, pass_leaf) suite.insert_child(-1, Leaf(token.NEWLINE, '\n')) PK1]Ffixes/fix_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(("__%s__" % attr.value[5:]), prefix=attr.prefix)) PK1]:C ttfixes/fix_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.pytsPK1]=n n fixes/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 = " " if "val" not in results: # One-argument raise new = pytree.Node(syms.raise_stmt, [Name("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 = "" args = [val] if "tb" in results: tb = results["tb"].clone() tb.prefix = "" 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 != "None": e = Call(exc, args) with_tb = Attr(e, Name('with_traceback')) + [ArgList([tb])] new = pytree.Node(syms.simple_stmt, [Name("raise")] + with_tb) new.prefix = node.prefix return new else: return pytree.Node(syms.raise_stmt, [Name("raise"), Call(exc, args)], prefix=node.prefix) PK1]Zfixes/fix_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.pytsPK1]~&fixes/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           PK1]uccfixes/fix_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.pytsPK1]誔* * fixes/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.argument and args.children[0].value in {'**', '*'}): 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, "*"), args] if kwds is not None: l_newargs.extend([Comma(), pytree.Leaf(token.DOUBLESTAR, "**"), kwds]) l_newargs[-2].prefix = " " # 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) PK1]5 fixes/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.PK1]HgHHfixes/fix_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: next(iterator) 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() PK1]:C ttfixes/fix_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.pytsPK1]\g7''fixes/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.pytsPK1]s<<fixes/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 sPK1]fϡfixes/fix_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, "{")] literal.extend(n.clone() for n in items.children) literal.append(pytree.Leaf(token.RBRACE, "}")) # 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 PK1]Rfixes/fix_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    PK1]cfixes/fix_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"PK1] fixes/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 . PK1]xA fixes/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@ PK1]<;;fixes/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 == "<>" def transform(self, node, results): new = pytree.Leaf(token.NOTEQUAL, "!=", prefix=node.prefix) return new PK1]tڢfixes/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.pytsPK1]Hmfixes/fix_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.pytsPK1]?յ fixes/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 " PK1]G~Zfixes/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.pytsPK1]ifixes/fix_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 .PK1]uccfixes/fix_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.pytsPK1]fixes/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" PK1]mUfixes/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.pytsPK1]Gg  fixes/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 ('ifilterfalse', '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)) PK1]Tv˒RRfixes/fix_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  PK1]fixes/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.pytsPK1]ĸ&fixes/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 PK1]tfixes/fix_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$ PK1]mUfixes/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.pytsPK1]Ҋ<<fixes/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.pytsFPK1]ʿ>1fixes/fix_paren.pynu["""Fixer that adds parentheses where they are required This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``.""" # By Taek Joo Kim and Benjamin Peterson # Local imports from .. import fixer_base from ..fixer_util import LParen, RParen # XXX This doesn't support nested for loops like [x for x in 1, 2 for x in 1, 2] class FixParen(fixer_base.BaseFix): BM_compatible = True PATTERN = """ atom< ('[' | '(') (listmaker< any comp_for< 'for' NAME 'in' target=testlist_safe< any (',' any)+ [','] > [any] > > | testlist_gexp< any comp_for< 'for' NAME 'in' target=testlist_safe< any (',' any)+ [','] > [any] > >) (']' | ')') > """ def transform(self, node, results): target = results["target"] lparen = LParen() lparen.prefix = target.prefix target.prefix = "" # Make it hug the parentheses target.insert_child(0, lparen) target.append_child(RParen()) PK1]ؒfixes/__init__.pyonu[ {fc@sdS(N((((s./usr/lib64/python2.7/lib2to3/fixes/__init__.pyttPK1]QQfixes/fix_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 .PK1]Pr  fixes/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.pytsPK1]҇ fixes/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( PK1]ĸ&fixes/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 PK1]&[  fixes/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.pytsPK1]}ׄLLfixes/fix_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.pytsPK1] ] ] fixes/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 PK1]cfixes/fix_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"PK1] 2Ϳ fixes/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 = "" register = pytree.Node(syms.power, Attr(Name("atexit"), Name("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("atexit", " ")) 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("import"), Name("atexit", " ")] ) new = pytree.Node(syms.simple_stmt, [new_import]) containing_stmt.insert_child(position + 1, Newline()) containing_stmt.insert_child(position + 2, new) PK1]G~Zfixes/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.pytsPK1]&[  fixes/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.pytsPK1],V V fixes/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( PK1]s<<fixes/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 sPK1]dsfixes/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 .. import fixer_base from ..fixer_util import Name, Call, Dot from .. import fixer_util iter_exempt = fixer_util.consuming_calls | {"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("iter") isview = method_name.startswith("view") if isiter or isview: method_name = method_name[4:] assert method_name in ("keys", "items", "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 = "" new = Call(Name("iter" if isiter else "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 PK1]IkNf f fixes/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('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("__next__", prefix=attr.prefix)) else: base = [n.clone() for n in base] base[0].prefix = "" node.replace(Call(Name("next", prefix=node.prefix), base)) elif name: n = Name("__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() == '__builtin__': self.warning(node, bind_warning) return attr.replace(Name("__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) PK1]k(Pzzfixes/fix_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  PK1]NNfixes/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("memoryview", prefix=name.prefix)) PK1]sGћfixes/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.pytsPK1]v fixes/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 "PK1]sGћfixes/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.pytsPK1]u fixes/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@ PK1]6fixes/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.pytsPK1]iGfixes/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 = "int" node.changed() PK1]ܾfixes/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.pytsPK1]ܬ'!!fixes/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 PK1]Jfixes/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 PK1]Tv˒RRfixes/fix_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  PK1]m)ĥfixes/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.pytsPK1]4 fixes/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 PK1]_}<<fixes/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.PK1]%TW688fixes/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, ArgList, Call, ListComp, in_special_context from ..pygram import python_symbols as syms from ..pytree import Node class FixMap(fixer_base.ConditionalFix): BM_compatible = True PATTERN = """ 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*] > """ skip_on = 'future_builtins.map' def transform(self, node, results): if self.should_skip(node): return trailers = [] if 'extra_trailers' in results: for t in results['extra_trailers']: trailers.append(t.clone()) if node.parent.type == syms.simple_stmt: self.warning(node, "You should use a for loop here") new = node.clone() new.prefix = "" new = Call(Name("list"), [new]) elif "map_lambda" in results: new = ListComp(results["xp"].clone(), results["fp"].clone(), results["it"].clone()) new = Node(syms.power, [new] + trailers, prefix="") else: if "map_none" in results: new = results["arg"].clone() new.prefix = "" else: if "args" in results: args = results["args"] if args.type == syms.trailer and \ args.children[1].type == syms.arglist and \ args.children[1].children[0].type == token.NAME and \ args.children[1].children[0].value == "None": self.warning(node, "cannot convert map(None, ...) " "with multiple arguments because map() " "now truncates to the shortest sequence") return new = Node(syms.power, [Name("map"), args.clone()]) new.prefix = "" if in_special_context(node): return None new = Node(syms.power, [Name("list"), ArgList([new])] + trailers) new.prefix = "" new.prefix = node.prefix return new PK1]:fixes/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 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("exec"), args, prefix=node.prefix) PK1]7h##fixes/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 PK1]k(Pzzfixes/fix_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  PK1] |44fixes/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 = 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)) PK1]C fixes/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 == "xrange": return self.transform_xrange(node, results) elif name.value == "range": return self.transform_range(node, results) else: raise ValueError(repr(name)) def transform_xrange(self, node, results): name = results["name"] name.replace(Name("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("range"), [results["args"].clone()]) # Encase the range call in list(). list_call = Call(Name("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 PK1]5Y fixes/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 .. import fixer_base from ..pytree import Node from ..pygram import python_symbols as syms from ..fixer_util import Name, ArgList, ListComp, in_special_context, parenthesize 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 > ')' > [extra_trailers=trailer*] > | power< 'filter' trailer< '(' arglist< none='None' ',' seq=any > ')' > [extra_trailers=trailer*] > | power< 'filter' args=trailer< '(' [any] ')' > [extra_trailers=trailer*] > """ skip_on = "future_builtins.filter" def transform(self, node, results): if self.should_skip(node): return trailers = [] if 'extra_trailers' in results: for t in results['extra_trailers']: trailers.append(t.clone()) if "filter_lambda" in results: xp = results.get("xp").clone() if xp.type == syms.test: xp.prefix = "" xp = parenthesize(xp) new = ListComp(results.get("fp").clone(), results.get("fp").clone(), results.get("it").clone(), xp) new = Node(syms.power, [new] + trailers, prefix="") elif "none" in results: new = ListComp(Name("_f"), Name("_f"), results["seq"].clone(), Name("_f")) new = Node(syms.power, [new] + trailers, prefix="") else: if in_special_context(node): return None args = results['args'].clone() new = Node(syms.power, [Name("filter"), args], prefix="") new = Node(syms.power, [Name("list"), ArgList([new])] + trailers) new.prefix = "" new.prefix = node.prefix return new PK1] `pwwfixes/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 sPK1]m)ĥfixes/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.pytsPK1]޽fixes/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("Exception", prefix=node.prefix) PK1]xWfixes/fix_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.pytsPK1]|b b fixes/fix_operator.pynu["""Fixer for operator functions. operator.isCallable(obj) -> callable(obj) operator.sequenceIncludes(obj) -> operator.contains(obj) operator.isSequenceType(obj) -> isinstance(obj, collections.abc.Sequence) operator.isMappingType(obj) -> isinstance(obj, collections.abc.Mapping) operator.isNumberType(obj) -> isinstance(obj, numbers.Number) operator.repeat(obj, n) -> operator.mul(obj, n) operator.irepeat(obj, n) -> operator.imul(obj, n) """ import collections.abc # 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, "contains") @invocation("callable(%s)") def _isCallable(self, node, results): obj = results["obj"] return Call(Name("callable"), [obj.clone()], prefix=node.prefix) @invocation("operator.mul(%s)") def _repeat(self, node, results): return self._handle_rename(node, results, "mul") @invocation("operator.imul(%s)") def _irepeat(self, node, results): return self._handle_rename(node, results, "imul") @invocation("isinstance(%s, collections.abc.Sequence)") def _isSequenceType(self, node, results): return self._handle_type2abc(node, results, "collections.abc", "Sequence") @invocation("isinstance(%s, collections.abc.Mapping)") def _isMappingType(self, node, results): return self._handle_type2abc(node, results, "collections.abc", "Mapping") @invocation("isinstance(%s, numbers.Number)") def _isNumberType(self, node, results): return self._handle_type2abc(node, results, "numbers", "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(", " + ".".join([module, abc]))] return Call(Name("isinstance"), args, prefix=node.prefix) def _check_method(self, node, results): method = getattr(self, "_" + results["method"][0].value) if isinstance(method, collections.abc.Callable): if "module" in results: return method else: sub = (str(results["obj"]),) invocation_str = method.invocation % sub self.warning(node, "You should use '%s' here." % invocation_str) return None PK1]JbBBfixes/fix_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, ",") COLON = pytree.Leaf(token.COLON, ":") 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 "\n" not in prefix: child.prefix = "" comma = True else: if comma: prefix = child.prefix if not prefix: child.prefix = " " comma = False return new PK1]1Wlfixes/fix_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.pyts4PK1]Jfixes/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 PK1]}ׄLLfixes/fix_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.pytsPK1]xu..fixes/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("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 = "" args = [val] throw_args = results["args"] if "tb" in results: tb = results["tb"].clone() tb.prefix = "" e = Call(exc, args) with_tb = Attr(e, Name('with_traceback')) + [ArgList([tb])] throw_args.replace(pytree.Node(syms.power, with_tb)) else: throw_args.replace(Call(exc, args)) PK1]RRfixes/fix_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.pytsPK1]I  fixes/fix_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 = ["exc_type", "exc_value", "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("exc_info"), prefix=sys_attr.prefix) attr = Attr(Name("sys"), call) attr[1].children[0].prefix = results["dot"].prefix attr.append(Subscript(index)) return Node(syms.power, attr, prefix=node.prefix) PK1]~&fixes/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           PK1]q|fixes/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 = "" return Call(Name("eval"), [new], prefix=node.prefix) PK1]fixes/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 (PK1],b fixes/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 (PK1] fixes/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 . PK1]E[//fixes/__init__.pynu[# Dummy file to make this directory a package. PK1]6zhhfixes/fix_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.pytsPK1]Sfixes/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 .. 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 = _TYPE_MAPPING.get(results["name"].value) if new_value: return Name(new_value, prefix=node.prefix) return None PK1]Rfixes/fix_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    PK1]0||fixes/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 PK1]6zhhfixes/fix_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.pytsPK1]\fixes/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 sPK1]M@@fixes/fix_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("str", prefix=node.prefix) PK1]lHfixes/fix_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("0") or node.value[-1] in "Ll") def transform(self, node, results): val = node.value if val[-1] in 'Ll': val = val[:-1] elif val.startswith('0') and val.isdigit() and len(set(val)) > 1: val = "0o" + val[1:] return Number(val, prefix=node.prefix) PK1]xWfixes/fix_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.pytsPK1]-$$fixes/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 PK1]O+fixes/fix_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 = "; " end = pytree.Leaf(token.INDENT, "") # 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 = "" stmt = Assign(arg, n.clone()) if add_prefix: n.prefix = " " 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 = " " 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 = " " 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=" ") 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(str(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 "_".join(l) PK1]V%e~ ~ fixes/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 PK1]&*pgen2/literals.pyonu[ {fc@sdZddlZi dd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6ZdZdZdZedkrendS(s<Safely evaluate Python string literals without using eval().iNstastbs tfs tns trs tts tvt't"s\cCs|jdd\}}tj|}|dk r7|S|jdr|d}t|dkrutd|nyt|d}Wqtk rtd|qXn7yt|d}Wn!tk rtd|nXt|S( Niitxis!invalid hex string escape ('\%s')iis#invalid octal string escape ('\%s')( tgrouptsimple_escapestgettNonet startswithtlent ValueErrortinttchr(tmtallttailtescthexesti((s./usr/lib64/python2.7/lib2to3/pgen2/literals.pytescapes"    cCsX|d}|d |dkr+|d}n|t|t| !}tjdt|S(Niis)\\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3})(RtretsubR(tstq((s./usr/lib64/python2.7/lib2to3/pgen2/literals.pyt evalString(s   cCs_xXtdD]J}t|}t|}t|}||kr |G|G|G|GHq q WdS(Ni(trangeRtreprR(RtcRte((s./usr/lib64/python2.7/lib2to3/pgen2/literals.pyttest2s     t__main__(t__doc__RR RRR#t__name__(((s./usr/lib64/python2.7/lib2to3/pgen2/literals.pyts      PK1]mqccpgen2/literals.pynu[# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Safely evaluate Python string literals without using eval().""" import re simple_escapes = {"a": "\a", "b": "\b", "f": "\f", "n": "\n", "r": "\r", "t": "\t", "v": "\v", "'": "'", '"': '"', "\\": "\\"} def escape(m): all, tail = m.group(0, 1) assert all.startswith("\\") esc = simple_escapes.get(tail) if esc is not None: return esc if tail.startswith("x"): hexes = tail[1:] if len(hexes) < 2: raise ValueError("invalid hex string escape ('\\%s')" % tail) try: i = int(hexes, 16) except ValueError: raise ValueError("invalid hex string escape ('\\%s')" % tail) from None else: try: i = int(tail, 8) except ValueError: raise ValueError("invalid octal string escape ('\\%s')" % tail) from None return chr(i) def evalString(s): assert s.startswith("'") or s.startswith('"'), repr(s[:1]) q = s[0] if s[:3] == q*3: q = q*3 assert s.endswith(q), repr(s[-len(q):]) assert len(s) >= 2*len(q) s = s[len(q):-len(q)] return re.sub(r"\\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3})", escape, s) def test(): for i in range(256): c = chr(i) s = repr(c) e = evalString(s) if e != c: print(i, c, s, e) if __name__ == "__main__": test() PK1]qC//pgen2/pgen.pycnu[ {fc@sddlmZmZmZdejfdYZdefdYZdefdYZdefd YZ d d Z d S( i(tgrammarttokenttokenizet PgenGrammarcBseZRS((t__name__t __module__(((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRstParserGeneratorcBseZddZdZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZddZdZdZRS(cCsd}|dkr*t|}|j}n||_||_tj|j|_|j |j \|_ |_ |dk r|ni|_ |jdS(N(tNonetopentclosetfilenametstreamRtgenerate_tokenstreadlinet generatortgettokentparsetdfast startsymboltfirstt addfirstsets(tselfR R t close_stream((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyt__init__ s         c Cst}|jj}|j|j|j|jd|jx;|D]3}dt|j}||j|<||j | %ds %s -> %d(t enumerateR R$RR"R( RR+R(RdttodoR,R.R/R0tj((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pytdump_nfas       cCsdG|GHxtt|D]f\}}dG|G|jr9dp<dGHx;t|jjD]$\}}d||j|fGHqTWqWdS(NsDump of DFA fors States(final)Rgs %s -> %d(RhR%RR R!R$(RR+R-R,R.R/R0((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pytdump_dfas  "cCst}x|rt}xt|D]x\}}xit|dt|D]N}||}||krH||=x|D]}|j||qrWt}PqHqHWq"Wq WdS(Ni(tTruetFalseRhtrangeRt unifystate(RR-tchangesR,tstate_iRjtstate_jR.((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRWs     cCs|j\}}|jdkr+||fSt}t}|j||j|xI|jdkr|j|j\}}|j||j|qZW||fSdS(Nt|(t parse_altRER_RcR(RRXRYtaatzz((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRUs       cCsr|j\}}xS|jdks?|jtjtjfkrg|j\}}|j||}qW||fS(Nt(t[(RxRy(t parse_itemRERPRRBtSTRINGRc(RRXtbR)td((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRu s  cCs|jdkrU|j|j\}}|jtjd|j|||fS|j\}}|j}|dkr||fS|j|j||dkr||fS||fSdS(NRyt]t+t*(RR(RERRURSRRTRct parse_atom(RRXRYRE((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRzs          cCs|jdkrH|j|j\}}|jtjd||fS|jtjtjfkrt }t }|j ||j|j||fS|j d|j|jdS(NRxt)s+expected (...) or NAME or STRING, got %s/%s( RERRURSRRTRPRBR{R_Rct raise_error(RRXRY((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyR(s       cCsc|j|ks*|dk rL|j|krL|jd|||j|jn|j}|j|S(Nsexpected %s/%s, got %s/%s(RPRRERR(RRPRE((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRS9s *   cCsi|jj}x/|dtjtjfkr@|jj}qW|\|_|_|_|_|_ dS(Ni( RR0RtCOMMENTtNLRPREtbegintendtline(Rttup((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRAscGss|r@y||}Wq@dj|gtt|}q@Xnt||j|jd|jd|jfdS(Nt ii(tjointmaptstrt SyntaxErrorR RR(Rtmsgtargs((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRHs&N(RRRRR1R'R#RRFRRVRkRlRWRURuRzRRSRR(((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyR s$   .    $        R_cBseZdZddZRS(cCs g|_dS(N(R (R((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRSscCsP|dks!t|ts!tt|ts6t|jj||fdS(N(RR:RR=R_R R"(RR0R/((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRcVs!N(RRRRRc(((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyR_Qs R`cBs2eZdZdZdZdZdZRS(cCspt|tsttt|jts6tt|tsKt||_||k|_i|_dS(N( R:tdictR=titerR0R_RaR%R (RRatfinal((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyR]s ! cCsPt|tst||jks*tt|ts?t||j|s H %PK1]Ci-i-pgen2/pgen.pyonu[ {fc@sddlmZmZmZdejfdYZdefdYZdefdYZdefd YZ d d Z d S( i(tgrammarttokenttokenizet PgenGrammarcBseZRS((t__name__t __module__(((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRstParserGeneratorcBseZddZdZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZddZdZdZRS(cCsd}|dkr*t|}|j}n||_||_tj|j|_|j |j \|_ |_ |dk r|ni|_ |jdS(N(tNonetopentclosetfilenametstreamRtgenerate_tokenstreadlinet generatortgettokentparsetdfast startsymboltfirstt addfirstsets(tselfR R t close_stream((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyt__init__ s         c Cst}|jj}|j|j|j|jd|jx;|D]3}dt|j}||j|<||j | %ds %s -> %d(t enumerateR R$RR"R( RR+R(R\ttodoR,R.R/R0tj((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pytdump_nfas       cCsdG|GHxtt|D]f\}}dG|G|jr9dp<dGHx;t|jjD]$\}}d||j|fGHqTWqWdS(NsDump of DFA fors States(final)R_s %s -> %d(R`R%RR R!R$(RR+R-R,R.R/R0((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pytdump_dfas  "cCst}x|rt}xt|D]x\}}xit|dt|D]N}||}||krH||=x|D]}|j||qrWt}PqHqHWq"Wq WdS(Ni(tTruetFalseR`trangeRt unifystate(RR-tchangesR,tstate_iRbtstate_jR.((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRPs     cCs|j\}}|jdkr+||fSt}t}|j||j|xI|jdkr|j|j\}}|j||j|qZW||fSdS(Nt|(t parse_altR>tNFAStateR[R(RRQRRtaatzz((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRNs       cCsr|j\}}xS|jdks?|jtjtjfkrg|j\}}|j||}qW||fS(Nt(t[(RqRr(t parse_itemR>RIRR;tSTRINGR[(RRQtbR)td((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRm s  cCs|jdkrU|j|j\}}|jtjd|j|||fS|j\}}|j}|dkr||fS|j|j||dkr||fS||fSdS(NRrt]t+t*(RxRy(R>RRNRLRRMR[t parse_atom(RRQRRR>((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRss          cCs|jdkrH|j|j\}}|jtjd||fS|jtjtjfkrt }t }|j ||j|j||fS|j d|j|jdS(NRqt)s+expected (...) or NAME or STRING, got %s/%s( R>RRNRLRRMRIR;RtRnR[t raise_error(RRQRR((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRz(s       cCsc|j|ks*|dk rL|j|krL|jd|||j|jn|j}|j|S(Nsexpected %s/%s, got %s/%s(RIRR>R|R(RRIR>((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRL9s *   cCsi|jj}x/|dtjtjfkr@|jj}qW|\|_|_|_|_|_ dS(Ni( RR0RtCOMMENTtNLRIR>tbegintendtline(Rttup((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRAscGss|r@y||}Wq@dj|gtt|}q@Xnt||j|jd|jd|jfdS(Nt ii(tjointmaptstrt SyntaxErrorR RR(Rtmsgtargs((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyR|Hs&N(RRRRR1R'R#RR?RRORcRdRPRNRmRsRzRLRR|(((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyR s$   .    $        RncBseZdZddZRS(cCs g|_dS(N(R (R((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRSscCs|jj||fdS(N(R R"(RR0R/((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyR[VsN(RRRRR[(((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyRnQs RXcBs2eZdZdZdZdZdZRS(cCs%||_||k|_i|_dS(N(RYR%R (RRYtfinal((s*/usr/lib64/python2.7/lib2to3/pgen2/pgen.pyR]s cCs||j|s H %PK1]??pgen2/driver.pycnu[ {fc@sdZdZddgZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z m Z mZdefdYZd Zd deedd Zd Zd ZdZedkrejee ndS(sZParser driver. This provides a high-level interface to parse a file into a syntax tree. s#Guido van Rossum tDrivert load_grammariNi(tgrammartparsettokenttokenizetpgencBsVeZdddZedZedZedZdedZedZ RS(cCs:||_|dkr$tj}n||_||_dS(N(RtNonetloggingt getLoggertloggertconvert(tselfRR R ((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt__init__ s    cCs=tj|j|j}|jd}d}d }}}} } d} x|D]} | \}}}} } |||fkr ||f|kst||f|f|\} }|| kr| d| |7} | }d}n||kr | | ||!7} |}q n|tjtj fkr`| |7} | \}}|j drQ|d7}d}qQqQn|t j krtj |}n|r|jjdt j||| n|j||| |fr|r|jjdnPnd} | \}}|j drQ|d7}d}qQqQWtjd||| |f|jS( s4Parse a series of tokens and return the syntax tree.iius s%s %r (prefix=%r)sStop.tsincomplete inputN(RtParserRR tsetupRtAssertionErrorRtCOMMENTtNLtendswithRtOPtopmapR tdebugttok_nametaddtokent ParseErrortrootnode(R ttokensRtptlinenotcolumnttypetvaluetstarttendt line_texttprefixt quintuplets_linenots_column((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt parse_tokens'sT  *              cCs"tj|j}|j||S(s*Parse a stream and return the syntax tree.(Rtgenerate_tokenstreadlineR)(R tstreamRR((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pytparse_stream_rawWscCs|j||S(s*Parse a stream and return the syntax tree.(R-(R R,R((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt parse_stream\scCs;tj|d|}z|j||SWd|jXdS(s(Parse a file and return the syntax tree.trN(tcodecstopenR.tclose(R tfilenametencodingRR,((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt parse_file`scCs+tjtj|j}|j||S(s*Parse a string and return the syntax tree.(RR*tStringIOR+R)(R ttextRR((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt parse_stringhsN( t__name__t __module__RR tFalseR)R-R.R5R8(((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyRs  0  cCsRtjj|\}}|dkr-d}n||djtttjdS(Ns.txtRt.s.pickle(tostpathtsplitexttjointmaptstrtsyst version_info(tgttheadttail((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt_generate_pickle_namens  s Grammar.txtcCs|dkrtj}n|dkr3t|n|}|sOt|| r|jd|tj|}|r|jd|y|j|Wqt k r}|jd|qXqnt j }|j ||S(s'Load the grammar (maybe from a pickle).s!Generating grammar tables from %ssWriting grammar tables to %ssWriting failed: %sN( RRR RHt_newertinfoRtgenerate_grammartdumptIOErrorRtGrammartload(REtgptsavetforceR tgte((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyRus   cCsNtjj|stStjj|s,tStjj|tjj|kS(s0Inquire whether file a was written since file b.(R=R>texistsR;tTruetgetmtime(tatb((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyRIs cCsctjj|rt|Sttjj|}tj||}tj }|j ||S(sNormally, loads a pickled grammar by doing pkgutil.get_data(package, pickled_grammar) where *pickled_grammar* is computed from *grammar_source* by adding the Python version and using a ``.pickle`` extension. However, if *grammar_source* is an extant file, load_grammar(grammar_source) is called instead. This facilitates using a packaged grammar file when needed but preserves load_grammar's automatic regeneration behavior when possible. ( R=R>tisfileRRHtbasenametpkgutiltget_dataRRNtloads(tpackagetgrammar_sourcet pickled_nametdataRS((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pytload_packaged_grammars    cGsc|stjd}ntjdtjdtjddx$|D]}t|dtdtq?WtS(sMain program, when run as a script: produce grammar pickle files. Calls load_grammar for each argument, a path to a grammar text file. itlevelR,tformats %(message)sRQRR(RCtargvRt basicConfigtINFOtstdoutRRV(targsRE((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pytmains t__main__(t__doc__t __author__t__all__R0R=RR\R6RCRRRRRRtobjectRRHRRVR;RRIRcRkR9texittint(((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt s$       (P   PK1](pgen2/token.pyonu[ {fc@sdZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;iZ<xBe=j>D]1\Z?Z@eAe@eAdkr~e?e<e@ZDd?S(@s!Token constants (from "token.h").iiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9icCs |tkS(N(t NT_OFFSET(tx((s+/usr/lib64/python2.7/lib2to3/pgen2/token.pyt ISTERMINALLscCs |tkS(N(R(R((s+/usr/lib64/python2.7/lib2to3/pgen2/token.pyt ISNONTERMINALOscCs |tkS(N(t ENDMARKER(R((s+/usr/lib64/python2.7/lib2to3/pgen2/token.pytISEOFRsN(Et__doc__RtNAMEtNUMBERtSTRINGtNEWLINEtINDENTtDEDENTtLPARtRPARtLSQBtRSQBtCOLONtCOMMAtSEMItPLUStMINUStSTARtSLASHtVBARtAMPERtLESStGREATERtEQUALtDOTtPERCENTt BACKQUOTEtLBRACEtRBRACEtEQEQUALtNOTEQUALt LESSEQUALt GREATEREQUALtTILDEt CIRCUMFLEXt LEFTSHIFTt RIGHTSHIFTt DOUBLESTARt PLUSEQUALtMINEQUALt STAREQUALt SLASHEQUALt PERCENTEQUALt AMPEREQUALt VBAREQUALtCIRCUMFLEXEQUALtLEFTSHIFTEQUALtRIGHTSHIFTEQUALtDOUBLESTAREQUALt DOUBLESLASHtDOUBLESLASHEQUALtATtATEQUALtOPtCOMMENTtNLtRARROWt ERRORTOKENtN_TOKENSRttok_nametglobalstitemst_namet_valuettypeRRR(((s+/usr/lib64/python2.7/lib2to3/pgen2/token.pyts  PK1]ʼnpgen2/conv.pycnu[ {fc@sEdZddlZddlmZmZdejfdYZdS(sConvert graminit.[ch] spit out by pgen to Python code. Pgen is the Python parser generator. It is useful to quickly create a parser from a grammar file in Python's grammar notation. But I don't want my parsers to be written in C (yet), so I'm translating the parsing tables to Python data structures and writing a Python parse engine. Note that the token numbers are constants determined by the standard Python tokenizer. The standard token module defines these numbers and their names (the names are not used much). The token numbers are hardcoded into the Python tokenizer and into pgen. A Python implementation of the Python tokenizer is also available, in the standard tokenize module. On the other hand, symbol numbers (representing the grammar's non-terminals) are assigned by pgen based on the actual grammar input. Note: this module is pretty much obsolete; the pgen module generates equivalent grammar tables directly from the Grammar.txt input file without having to invoke the Python pgen C program. iN(tgrammarttokent ConvertercBs2eZdZdZdZdZdZRS(s2Grammar subclass that reads classic pgen output files. The run() method reads the tables as produced by the pgen parser generator, typically contained in two C files, graminit.h and graminit.c. The other methods are for internal use only. See the base class for more documentation. cCs(|j||j||jdS(s<Load the grammar tables from the text files written by pgen.N(tparse_graminit_htparse_graminit_ct finish_off(tselft graminit_ht graminit_c((s*/usr/lib64/python2.7/lib2to3/pgen2/conv.pytrun/s  c Csyt|}Wn#tk r5}d||fGHtSXi|_i|_d}x|D]}|d7}tjd|}| r|jrd|||jfGHqU|j\}}t |}||jkst ||jkst ||j|<||j|@rd||d|_[] = { {, }, ... }; - followed by a state array, of the form: static state states_[] = { {, arcs__}, ... }; sCan't open %s: %siis#include "pgenheaders.h" s#include "grammar.h" s static arc s)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$s\s+{(\d+), (\d+)},$s}; s'static state states_(\d+)\[(\d+)\] = {$s\s+{(\d+), arcs_(\d+)_(\d+)},$sstatic dfa dfas\[(\d+)\] = {$s0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$iiiis\s+("(?:\\\d\d\d)*")},$is!static label labels\[(\d+)\] = {$s\s+{(\d+), (0|"\w+")},$t0sgrammar _PyParser_Grammar = { s \s+(\d+),$s dfas, s\s+{(\d+), labels},$s \s+(\d+)$N(R R R tnextRt startswithRRtmapRRtrangetappendtlentstatestgroupR Rtevalt enumeratetordtdfastNonetlabelststartt StopIteration(!RRRRRRtallarcsR%Rtntmtktarcst_titjtstttstateR*tndfasRRtxtytztfirstt rawbitsettctbyteR,tnlabelsR-((s*/usr/lib64/python2.7/lib2to3/pgen2/conv.pyRTs  $$    -%% $       '!  cCsi|_i|_xjt|jD]Y\}\}}|tjkr_|dk r_||j|s PK1]K%pgen2/__init__.pycnu[ {fc@s dZdS(sThe pgen2 package.N(t__doc__(((s./usr/lib64/python2.7/lib2to3/pgen2/__init__.pyttPK1]U pgen2/grammar.pycnu[ {fc@sdZddlZddlZddlmZmZdefdYZdZdZ iZ xBe j D]4Z e rle j \ZZeeee et|d)}t|j}tj||dWdQXdS(sDump the grammar tables to a pickle file. dump() recursively changes all dict to OrderedDict, so the pickled file is not exactly the same as what was passed in to dump(). load() uses the pickled file to create the tables, but only changes OrderedDict to dict at the top level; it does not recursively change OrderedDict to dict. So, the loaded tables are different from the original tables that were passed to load() in that some of the OrderedDict (from the pickled file) are not changed back to dict. For parsing, this has no effect on performance because OrderedDict uses dict's __getitem__ with nothing in between. twbiN(topent_make_deterministict__dict__tpickletdump(R tfilenametftd((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyRXs cCs<t|d}tj|}|j|jj|dS(s+Load the grammar tables from a pickle file.trbN(RRtloadtcloseRtupdate(R RRR((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyRis cCs|jjtj|dS(s3Load the grammar tables from a pickle bytes object.N(RRRtloads(R tpkl((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyRpscCsf|j}x-dD]%}t||t||jqW|j|_|j|_|j|_|S(s# Copy the grammar. RRRR R R (RRRR R R (t __class__tsetattrtgetattrtcopyRRR (R tnewt dict_attr((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyR!ts  #   cCszddlm}dGH||jdGH||jdGH||jdGH||jdGH||jdG|jGHd S( s:Dump the grammar tables to standard output, for debugging.i(tpprintts2ntn2sRRRR N(R$RRRRRR (R R$((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pytreports     ( t__name__t __module__t__doc__RRRRR!R'(((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyRs4    cCst|tr2tjtd|jDSt|tr^g|D]}t|^qHSt|trtd|DS|S(Ncss'|]\}}|t|fVqdS(N(R(t.0tktv((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pys scss|]}t|VqdS(N(R(R+te((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pys s( t isinstancetdictt collectionst OrderedDicttsortedt iteritemstlistRttuple(ttopR.((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyRss ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW (R*R1RtRRtobjectRRt opmap_rawtopmapt splitlinestlinetsplittoptnameR (((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyt s  z =PK1]A'Hepgen2/parse.pyonu[ {fc@sFdZddlmZdefdYZdefdYZdS(sParser engine for the grammar tables generated by pgen. The grammar table must be loaded first. See Parser/parser.c in the Python distribution for additional info on how this parsing engine works. i(ttokent ParseErrorcBseZdZdZRS(s(Exception to signal the parser is stuck.cCsHtj|d||||f||_||_||_||_dS(Ns!%s: type=%r, value=%r, context=%r(t Exceptiont__init__tmsgttypetvaluetcontext(tselfRRRR((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pyRs     (t__name__t __module__t__doc__R(((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pyRstParsercBsSeZdZddZddZdZdZdZdZ dZ RS( s5Parser engine. The proper usage sequence is: p = Parser(grammar, [converter]) # create instance p.setup([start]) # prepare for parsing : if p.addtoken(...): # parse a token; may raise ParseError break root = p.rootnode # root of abstract syntax tree A Parser instance may be reused by calling setup() repeatedly. A Parser instance contains state pertaining to the current token sequence, and should not be used concurrently by different threads to parse separate token sequences. See driver.py for how to get input tokens by tokenizing a file or string. Parsing is complete when addtoken() returns True; the root of the abstract syntax tree can then be retrieved from the rootnode instance variable. When a syntax error occurs, addtoken() raises the ParseError exception. There is no error recovery; the parser cannot be used after a syntax error was reported (but it can be reinitialized by calling setup()). cCs||_|pd|_dS(sConstructor. The grammar argument is a grammar.Grammar instance; see the grammar module for more information. The parser is not ready yet for parsing; you must call the setup() method to get it started. The optional convert argument is a function mapping concrete syntax tree nodes to abstract syntax tree nodes. If not given, no conversion is done and the syntax tree produced is the concrete syntax tree. If given, it must be a function of two arguments, the first being the grammar (a grammar.Grammar instance), and the second being the concrete syntax tree node to be converted. The syntax tree is converted from the bottom up. A concrete syntax tree node is a (type, value, context, nodes) tuple, where type is the node type (a token or symbol number), value is None for symbols and a string for tokens, context is None or an opaque value used for error reporting (typically a (lineno, offset) pair), and nodes is a list of children for symbols, and None for tokens. An abstract syntax tree node may be anything; this is entirely up to the converter function. cSs|S(N((tgrammartnode((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pytWtN(R tconvert(RR R((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pyR9s cCsk|dkr|jj}n|ddgf}|jj|d|f}|g|_d|_t|_dS(sPrepare for parsing. This *must* be called before starting to parse. The optional argument is an alternative start symbol; it defaults to the grammar's start symbol. You can use a Parser instance to parse any number of programs; each time you call setup() the parser is reset to an initial state determined by the (implicit or explicit) start symbol. iN(tNoneR tstarttdfaststacktrootnodetsett used_names(RRtnewnodet stackentry((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pytsetupYs   cCs|j|||}xtr|jd\}}}|\}} ||} x_| D]\} } |jj| \} }|| kr|j||| || }xV||d|fgkr|j|jstS|jd\}}}|\}} qWtS| dkrQ|jj| }|\}}||krS|j | |jj| | |PqSqQqQWd|f| kr|j|jst d|||qqt d|||qWdS(s<Add a token; return True iff this is the end of the program.iiistoo much inputs bad inputN( tclassifytTrueRR tlabelstshifttpoptFalseRtpushR(RRRRtilabeltdfatstateRtstatestfirsttarcstitnewstatetttvtitsdfat itsstatestitsfirst((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pytaddtokenqs:             cCs|tjkrG|jj||jjj|}|dk rG|Sn|jjj|}|dkrt d|||n|S(s&Turn a token into a label. (Internal)s bad tokenN( RtNAMERtaddR tkeywordstgetRttokensR(RRRRR#((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pyRs  c Csw|jd\}}}|||df}|j|j|}|dk r]|dj|n|||f|jd s PK1]2pgen2/parse.pynu[# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Parser engine for the grammar tables generated by pgen. The grammar table must be loaded first. See Parser/parser.c in the Python distribution for additional info on how this parsing engine works. """ # Local imports from . import token class ParseError(Exception): """Exception to signal the parser is stuck.""" def __init__(self, msg, type, value, context): Exception.__init__(self, "%s: type=%r, value=%r, context=%r" % (msg, type, value, context)) self.msg = msg self.type = type self.value = value self.context = context def __reduce__(self): return type(self), (self.msg, self.type, self.value, self.context) class Parser(object): """Parser engine. The proper usage sequence is: p = Parser(grammar, [converter]) # create instance p.setup([start]) # prepare for parsing : if p.addtoken(...): # parse a token; may raise ParseError break root = p.rootnode # root of abstract syntax tree A Parser instance may be reused by calling setup() repeatedly. A Parser instance contains state pertaining to the current token sequence, and should not be used concurrently by different threads to parse separate token sequences. See driver.py for how to get input tokens by tokenizing a file or string. Parsing is complete when addtoken() returns True; the root of the abstract syntax tree can then be retrieved from the rootnode instance variable. When a syntax error occurs, addtoken() raises the ParseError exception. There is no error recovery; the parser cannot be used after a syntax error was reported (but it can be reinitialized by calling setup()). """ def __init__(self, grammar, convert=None): """Constructor. The grammar argument is a grammar.Grammar instance; see the grammar module for more information. The parser is not ready yet for parsing; you must call the setup() method to get it started. The optional convert argument is a function mapping concrete syntax tree nodes to abstract syntax tree nodes. If not given, no conversion is done and the syntax tree produced is the concrete syntax tree. If given, it must be a function of two arguments, the first being the grammar (a grammar.Grammar instance), and the second being the concrete syntax tree node to be converted. The syntax tree is converted from the bottom up. A concrete syntax tree node is a (type, value, context, nodes) tuple, where type is the node type (a token or symbol number), value is None for symbols and a string for tokens, context is None or an opaque value used for error reporting (typically a (lineno, offset) pair), and nodes is a list of children for symbols, and None for tokens. An abstract syntax tree node may be anything; this is entirely up to the converter function. """ self.grammar = grammar self.convert = convert or (lambda grammar, node: node) def setup(self, start=None): """Prepare for parsing. This *must* be called before starting to parse. The optional argument is an alternative start symbol; it defaults to the grammar's start symbol. You can use a Parser instance to parse any number of programs; each time you call setup() the parser is reset to an initial state determined by the (implicit or explicit) start symbol. """ if start is None: start = self.grammar.start # Each stack entry is a tuple: (dfa, state, node). # A node is a tuple: (type, value, context, children), # where children is a list of nodes or None, and context may be None. newnode = (start, None, None, []) stackentry = (self.grammar.dfas[start], 0, newnode) self.stack = [stackentry] self.rootnode = None self.used_names = set() # Aliased to self.rootnode.used_names in pop() def addtoken(self, type, value, context): """Add a token; return True iff this is the end of the program.""" # Map from token to label ilabel = self.classify(type, value, context) # Loop until the token is shifted; may raise exceptions while True: dfa, state, node = self.stack[-1] states, first = dfa arcs = states[state] # Look for a state with this label for i, newstate in arcs: t, v = self.grammar.labels[i] if ilabel == i: # Look it up in the list of labels assert t < 256 # Shift a token; we're done with it self.shift(type, value, newstate, context) # Pop while we are in an accept-only state state = newstate while states[state] == [(0, state)]: self.pop() if not self.stack: # Done parsing! return True dfa, state, node = self.stack[-1] states, first = dfa # Done with this token return False elif t >= 256: # See if it's a symbol and if we're in its first set itsdfa = self.grammar.dfas[t] itsstates, itsfirst = itsdfa if ilabel in itsfirst: # Push a symbol self.push(t, self.grammar.dfas[t], newstate, context) break # To continue the outer while loop else: if (0, state) in arcs: # An accepting state, pop it and try something else self.pop() if not self.stack: # Done parsing, but another token is input raise ParseError("too much input", type, value, context) else: # No success finding a transition raise ParseError("bad input", type, value, context) def classify(self, type, value, context): """Turn a token into a label. (Internal)""" if type == token.NAME: # Keep a listing of all used names self.used_names.add(value) # Check for reserved words ilabel = self.grammar.keywords.get(value) if ilabel is not None: return ilabel ilabel = self.grammar.tokens.get(type) if ilabel is None: raise ParseError("bad token", type, value, context) return ilabel def shift(self, type, value, newstate, context): """Shift a token. (Internal)""" dfa, state, node = self.stack[-1] newnode = (type, value, context, None) newnode = self.convert(self.grammar, newnode) if newnode is not None: node[-1].append(newnode) self.stack[-1] = (dfa, newstate, node) def push(self, type, newdfa, newstate, context): """Push a nonterminal. (Internal)""" dfa, state, node = self.stack[-1] newnode = (type, None, context, []) self.stack[-1] = (dfa, newstate, node) self.stack.append((newdfa, 0, newnode)) def pop(self): """Pop a nonterminal. (Internal)""" popdfa, popstate, popnode = self.stack.pop() newnode = self.convert(self.grammar, popnode) if newnode is not None: if self.stack: dfa, state, node = self.stack[-1] node[-1].append(newnode) else: self.rootnode = newnode self.rootnode.used_names = self.used_names PK1]6pDDpgen2/parse.pycnu[ {fc@sFdZddlmZdefdYZdefdYZdS(sParser engine for the grammar tables generated by pgen. The grammar table must be loaded first. See Parser/parser.c in the Python distribution for additional info on how this parsing engine works. i(ttokent ParseErrorcBseZdZdZRS(s(Exception to signal the parser is stuck.cCsHtj|d||||f||_||_||_||_dS(Ns!%s: type=%r, value=%r, context=%r(t Exceptiont__init__tmsgttypetvaluetcontext(tselfRRRR((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pyRs     (t__name__t __module__t__doc__R(((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pyRstParsercBsSeZdZddZddZdZdZdZdZ dZ RS( s5Parser engine. The proper usage sequence is: p = Parser(grammar, [converter]) # create instance p.setup([start]) # prepare for parsing : if p.addtoken(...): # parse a token; may raise ParseError break root = p.rootnode # root of abstract syntax tree A Parser instance may be reused by calling setup() repeatedly. A Parser instance contains state pertaining to the current token sequence, and should not be used concurrently by different threads to parse separate token sequences. See driver.py for how to get input tokens by tokenizing a file or string. Parsing is complete when addtoken() returns True; the root of the abstract syntax tree can then be retrieved from the rootnode instance variable. When a syntax error occurs, addtoken() raises the ParseError exception. There is no error recovery; the parser cannot be used after a syntax error was reported (but it can be reinitialized by calling setup()). cCs||_|pd|_dS(sConstructor. The grammar argument is a grammar.Grammar instance; see the grammar module for more information. The parser is not ready yet for parsing; you must call the setup() method to get it started. The optional convert argument is a function mapping concrete syntax tree nodes to abstract syntax tree nodes. If not given, no conversion is done and the syntax tree produced is the concrete syntax tree. If given, it must be a function of two arguments, the first being the grammar (a grammar.Grammar instance), and the second being the concrete syntax tree node to be converted. The syntax tree is converted from the bottom up. A concrete syntax tree node is a (type, value, context, nodes) tuple, where type is the node type (a token or symbol number), value is None for symbols and a string for tokens, context is None or an opaque value used for error reporting (typically a (lineno, offset) pair), and nodes is a list of children for symbols, and None for tokens. An abstract syntax tree node may be anything; this is entirely up to the converter function. cSs|S(N((tgrammartnode((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pytWtN(R tconvert(RR R((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pyR9s cCsk|dkr|jj}n|ddgf}|jj|d|f}|g|_d|_t|_dS(sPrepare for parsing. This *must* be called before starting to parse. The optional argument is an alternative start symbol; it defaults to the grammar's start symbol. You can use a Parser instance to parse any number of programs; each time you call setup() the parser is reset to an initial state determined by the (implicit or explicit) start symbol. iN(tNoneR tstarttdfaststacktrootnodetsett used_names(RRtnewnodet stackentry((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pytsetupYs   cCs|j|||}xtr|jd\}}}|\}} ||} xq| D]\} } |jj| \} }|| kr | dkst|j||| || }xV||d|fgkr|j|jstS|jd\}}}|\}} qWtS| dkrQ|jj | }|\}}||kre|j | |jj | | |PqeqQqQWd|f| kr|j|jst d|||qqt d|||qWdS(s<Add a token; return True iff this is the end of the program.iiistoo much inputs bad inputN( tclassifytTrueRR tlabelstAssertionErrortshifttpoptFalseRtpushR(RRRRtilabeltdfatstateRtstatestfirsttarcstitnewstatetttvtitsdfat itsstatestitsfirst((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pytaddtokenqs<             cCs|tjkrG|jj||jjj|}|dk rG|Sn|jjj|}|dkrt d|||n|S(s&Turn a token into a label. (Internal)s bad tokenN( RtNAMERtaddR tkeywordstgetRttokensR(RRRRR$((s+/usr/lib64/python2.7/lib2to3/pgen2/parse.pyRs  c Csw|jd\}}}|||df}|j|j|}|dk r]|dj|n|||f|jd s PK1]K%pgen2/__init__.pyonu[ {fc@s dZdS(sThe pgen2 package.N(t__doc__(((s./usr/lib64/python2.7/lib2to3/pgen2/__init__.pyttPK1](pgen2/token.pycnu[ {fc@sdZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;iZ<xBe=j>D]1\Z?Z@eAe@eAdkr~e?e<e@ZDd?S(@s!Token constants (from "token.h").iiiiiiiiii i i i i iiiiiiiiiiiiiiiiiii i!i"i#i$i%i&i'i(i)i*i+i,i-i.i/i0i1i2i3i4i5i6i7i8i9icCs |tkS(N(t NT_OFFSET(tx((s+/usr/lib64/python2.7/lib2to3/pgen2/token.pyt ISTERMINALLscCs |tkS(N(R(R((s+/usr/lib64/python2.7/lib2to3/pgen2/token.pyt ISNONTERMINALOscCs |tkS(N(t ENDMARKER(R((s+/usr/lib64/python2.7/lib2to3/pgen2/token.pytISEOFRsN(Et__doc__RtNAMEtNUMBERtSTRINGtNEWLINEtINDENTtDEDENTtLPARtRPARtLSQBtRSQBtCOLONtCOMMAtSEMItPLUStMINUStSTARtSLASHtVBARtAMPERtLESStGREATERtEQUALtDOTtPERCENTt BACKQUOTEtLBRACEtRBRACEtEQEQUALtNOTEQUALt LESSEQUALt GREATEREQUALtTILDEt CIRCUMFLEXt LEFTSHIFTt RIGHTSHIFTt DOUBLESTARt PLUSEQUALtMINEQUALt STAREQUALt SLASHEQUALt PERCENTEQUALt AMPEREQUALt VBAREQUALtCIRCUMFLEXEQUALtLEFTSHIFTEQUALtRIGHTSHIFTEQUALtDOUBLESTAREQUALt DOUBLESLASHtDOUBLESLASHEQUALtATtATEQUALtOPtCOMMENTtNLtRARROWt ERRORTOKENtN_TOKENSRttok_nametglobalstitemst_namet_valuettypeRRR(((s+/usr/lib64/python2.7/lib2to3/pgen2/token.pyts  PK1]U pgen2/grammar.pyonu[ {fc@sdZddlZddlZddlmZmZdefdYZdZdZ iZ xBe j D]4Z e rle j \ZZeeee et|d)}t|j}tj||dWdQXdS(sDump the grammar tables to a pickle file. dump() recursively changes all dict to OrderedDict, so the pickled file is not exactly the same as what was passed in to dump(). load() uses the pickled file to create the tables, but only changes OrderedDict to dict at the top level; it does not recursively change OrderedDict to dict. So, the loaded tables are different from the original tables that were passed to load() in that some of the OrderedDict (from the pickled file) are not changed back to dict. For parsing, this has no effect on performance because OrderedDict uses dict's __getitem__ with nothing in between. twbiN(topent_make_deterministict__dict__tpickletdump(R tfilenametftd((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyRXs cCs<t|d}tj|}|j|jj|dS(s+Load the grammar tables from a pickle file.trbN(RRtloadtcloseRtupdate(R RRR((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyRis cCs|jjtj|dS(s3Load the grammar tables from a pickle bytes object.N(RRRtloads(R tpkl((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyRpscCsf|j}x-dD]%}t||t||jqW|j|_|j|_|j|_|S(s# Copy the grammar. RRRR R R (RRRR R R (t __class__tsetattrtgetattrtcopyRRR (R tnewt dict_attr((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyR!ts  #   cCszddlm}dGH||jdGH||jdGH||jdGH||jdGH||jdG|jGHd S( s:Dump the grammar tables to standard output, for debugging.i(tpprintts2ntn2sRRRR N(R$RRRRRR (R R$((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pytreports     ( t__name__t __module__t__doc__RRRRR!R'(((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyRs4    cCst|tr2tjtd|jDSt|tr^g|D]}t|^qHSt|trtd|DS|S(Ncss'|]\}}|t|fVqdS(N(R(t.0tktv((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pys scss|]}t|VqdS(N(R(R+te((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pys s( t isinstancetdictt collectionst OrderedDicttsortedt iteritemstlistRttuple(ttopR.((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyRss ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW (R*R1RtRRtobjectRRt opmap_rawtopmapt splitlinestlinetsplittoptnameR (((s-/usr/lib64/python2.7/lib2to3/pgen2/grammar.pyt s  z =PK1]k3pgen2/grammar.pynu[# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """This module defines the data structures used to represent a grammar. These are a bit arcane because they are derived from the data structures used by Python's 'pgen' parser generator. There's also a table here mapping operators to their names in the token module; the Python tokenize module reports all operators as the fallback token code OP, but the parser needs the actual token code. """ # Python imports import pickle # Local imports from . import token class Grammar(object): """Pgen parsing tables conversion class. Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine accesses the instance variables directly. The class here does not provide initialization of the tables; several subclasses exist to do this (see the conv and pgen modules). The load() method reads the tables from a pickle file, which is much faster than the other ways offered by subclasses. The pickle file is written by calling dump() (after loading the grammar tables using a subclass). The report() method prints a readable representation of the tables to stdout, for debugging. The instance variables are as follows: symbol2number -- a dict mapping symbol names to numbers. Symbol numbers are always 256 or higher, to distinguish them from token numbers, which are between 0 and 255 (inclusive). number2symbol -- a dict mapping numbers to symbol names; these two are each other's inverse. states -- a list of DFAs, where each DFA is a list of states, each state is a list of arcs, and each arc is a (i, j) pair where i is a label and j is a state number. The DFA number is the index into this list. (This name is slightly confusing.) Final states are represented by a special arc of the form (0, j) where j is its own state number. dfas -- a dict mapping symbol numbers to (DFA, first) pairs, where DFA is an item from the states list above, and first is a set of tokens that can begin this grammar rule (represented by a dict whose values are always 1). labels -- a list of (x, y) pairs where x is either a token number or a symbol number, and y is either None or a string; the strings are keywords. The label number is the index in this list; label numbers are used to mark state transitions (arcs) in the DFAs. start -- the number of the grammar's start symbol. keywords -- a dict mapping keyword strings to arc labels. tokens -- a dict mapping token numbers to arc labels. """ def __init__(self): self.symbol2number = {} self.number2symbol = {} self.states = [] self.dfas = {} self.labels = [(0, "EMPTY")] self.keywords = {} self.tokens = {} self.symbol2label = {} self.start = 256 def dump(self, filename): """Dump the grammar tables to a pickle file.""" with open(filename, "wb") as f: pickle.dump(self.__dict__, f, pickle.HIGHEST_PROTOCOL) def load(self, filename): """Load the grammar tables from a pickle file.""" with open(filename, "rb") as f: d = pickle.load(f) self.__dict__.update(d) def loads(self, pkl): """Load the grammar tables from a pickle bytes object.""" self.__dict__.update(pickle.loads(pkl)) def copy(self): """ Copy the grammar. """ new = self.__class__() for dict_attr in ("symbol2number", "number2symbol", "dfas", "keywords", "tokens", "symbol2label"): setattr(new, dict_attr, getattr(self, dict_attr).copy()) new.labels = self.labels[:] new.states = self.states[:] new.start = self.start return new def report(self): """Dump the grammar tables to standard output, for debugging.""" from pprint import pprint print("s2n") pprint(self.symbol2number) print("n2s") pprint(self.number2symbol) print("states") pprint(self.states) print("dfas") pprint(self.dfas) print("labels") pprint(self.labels) print("start", self.start) # Map from operator to number (since tokenize doesn't do this) opmap_raw = """ ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW := COLONEQUAL """ opmap = {} for line in opmap_raw.splitlines(): if line: op, name = line.split() opmap[op] = getattr(token, name) del line, op, name PK1]fwc}}pgen2/conv.pyonu[ {fc@sEdZddlZddlmZmZdejfdYZdS(sConvert graminit.[ch] spit out by pgen to Python code. Pgen is the Python parser generator. It is useful to quickly create a parser from a grammar file in Python's grammar notation. But I don't want my parsers to be written in C (yet), so I'm translating the parsing tables to Python data structures and writing a Python parse engine. Note that the token numbers are constants determined by the standard Python tokenizer. The standard token module defines these numbers and their names (the names are not used much). The token numbers are hardcoded into the Python tokenizer and into pgen. A Python implementation of the Python tokenizer is also available, in the standard tokenize module. On the other hand, symbol numbers (representing the grammar's non-terminals) are assigned by pgen based on the actual grammar input. Note: this module is pretty much obsolete; the pgen module generates equivalent grammar tables directly from the Grammar.txt input file without having to invoke the Python pgen C program. iN(tgrammarttokent ConvertercBs2eZdZdZdZdZdZRS(s2Grammar subclass that reads classic pgen output files. The run() method reads the tables as produced by the pgen parser generator, typically contained in two C files, graminit.h and graminit.c. The other methods are for internal use only. See the base class for more documentation. cCs(|j||j||jdS(s<Load the grammar tables from the text files written by pgen.N(tparse_graminit_htparse_graminit_ct finish_off(tselft graminit_ht graminit_c((s*/usr/lib64/python2.7/lib2to3/pgen2/conv.pytrun/s  c Csyt|}Wn#tk r5}d||fGHtSXi|_i|_d}x|D]}|d7}tjd|}| r|jrd|||jfGHqU|j\}}t |}||j|<||j|@rd||d|_[] = { {, }, ... }; - followed by a state array, of the form: static state states_[] = { {, arcs__}, ... }; sCan't open %s: %siis static arc s)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$s\s+{(\d+), (\d+)},$s'static state states_(\d+)\[(\d+)\] = {$s\s+{(\d+), arcs_(\d+)_(\d+)},$sstatic dfa dfas\[(\d+)\] = {$s0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$iiiis\s+("(?:\\\d\d\d)*")},$is!static label labels\[(\d+)\] = {$s\s+{(\d+), (0|"\w+")},$t0s \s+(\d+),$s\s+{(\d+), labels},$s \s+(\d+)$N(R R R tnextt startswithRRtmapRRtrangetappendtstatestgrouptevalt enumeratetordtdfastNonetlabelststartt StopIteration(!RRRRRRtallarcsR#Rtntmtktarcst_titjtstttstateR(tndfasRRtxtytztfirstt rawbitsettctbyteR*tnlabelsR+((s*/usr/lib64/python2.7/lib2to3/pgen2/conv.pyRTs      -          cCsi|_i|_xjt|jD]Y\}\}}|tjkr_|dk r_||j|s PK1]%% pgen2/conv.pynu[# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Convert graminit.[ch] spit out by pgen to Python code. Pgen is the Python parser generator. It is useful to quickly create a parser from a grammar file in Python's grammar notation. But I don't want my parsers to be written in C (yet), so I'm translating the parsing tables to Python data structures and writing a Python parse engine. Note that the token numbers are constants determined by the standard Python tokenizer. The standard token module defines these numbers and their names (the names are not used much). The token numbers are hardcoded into the Python tokenizer and into pgen. A Python implementation of the Python tokenizer is also available, in the standard tokenize module. On the other hand, symbol numbers (representing the grammar's non-terminals) are assigned by pgen based on the actual grammar input. Note: this module is pretty much obsolete; the pgen module generates equivalent grammar tables directly from the Grammar.txt input file without having to invoke the Python pgen C program. """ # Python imports import re # Local imports from pgen2 import grammar, token class Converter(grammar.Grammar): """Grammar subclass that reads classic pgen output files. The run() method reads the tables as produced by the pgen parser generator, typically contained in two C files, graminit.h and graminit.c. The other methods are for internal use only. See the base class for more documentation. """ def run(self, graminit_h, graminit_c): """Load the grammar tables from the text files written by pgen.""" self.parse_graminit_h(graminit_h) self.parse_graminit_c(graminit_c) self.finish_off() def parse_graminit_h(self, filename): """Parse the .h file written by pgen. (Internal) This file is a sequence of #define statements defining the nonterminals of the grammar as numbers. We build two tables mapping the numbers to names and back. """ try: f = open(filename) except OSError as err: print("Can't open %s: %s" % (filename, err)) return False self.symbol2number = {} self.number2symbol = {} lineno = 0 for line in f: lineno += 1 mo = re.match(r"^#define\s+(\w+)\s+(\d+)$", line) if not mo and line.strip(): print("%s(%s): can't parse %s" % (filename, lineno, line.strip())) else: symbol, number = mo.groups() number = int(number) assert symbol not in self.symbol2number assert number not in self.number2symbol self.symbol2number[symbol] = number self.number2symbol[number] = symbol return True def parse_graminit_c(self, filename): """Parse the .c file written by pgen. (Internal) The file looks as follows. The first two lines are always this: #include "pgenheaders.h" #include "grammar.h" After that come four blocks: 1) one or more state definitions 2) a table defining dfas 3) a table defining labels 4) a struct defining the grammar A state definition has the following form: - one or more arc arrays, each of the form: static arc arcs__[] = { {, }, ... }; - followed by a state array, of the form: static state states_[] = { {, arcs__}, ... }; """ try: f = open(filename) except OSError as err: print("Can't open %s: %s" % (filename, err)) return False # The code below essentially uses f's iterator-ness! lineno = 0 # Expect the two #include lines lineno, line = lineno+1, next(f) assert line == '#include "pgenheaders.h"\n', (lineno, line) lineno, line = lineno+1, next(f) assert line == '#include "grammar.h"\n', (lineno, line) # Parse the state definitions lineno, line = lineno+1, next(f) allarcs = {} states = [] while line.startswith("static arc "): while line.startswith("static arc "): mo = re.match(r"static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$", line) assert mo, (lineno, line) n, m, k = list(map(int, mo.groups())) arcs = [] for _ in range(k): lineno, line = lineno+1, next(f) mo = re.match(r"\s+{(\d+), (\d+)},$", line) assert mo, (lineno, line) i, j = list(map(int, mo.groups())) arcs.append((i, j)) lineno, line = lineno+1, next(f) assert line == "};\n", (lineno, line) allarcs[(n, m)] = arcs lineno, line = lineno+1, next(f) mo = re.match(r"static state states_(\d+)\[(\d+)\] = {$", line) assert mo, (lineno, line) s, t = list(map(int, mo.groups())) assert s == len(states), (lineno, line) state = [] for _ in range(t): lineno, line = lineno+1, next(f) mo = re.match(r"\s+{(\d+), arcs_(\d+)_(\d+)},$", line) assert mo, (lineno, line) k, n, m = list(map(int, mo.groups())) arcs = allarcs[n, m] assert k == len(arcs), (lineno, line) state.append(arcs) states.append(state) lineno, line = lineno+1, next(f) assert line == "};\n", (lineno, line) lineno, line = lineno+1, next(f) self.states = states # Parse the dfas dfas = {} mo = re.match(r"static dfa dfas\[(\d+)\] = {$", line) assert mo, (lineno, line) ndfas = int(mo.group(1)) for i in range(ndfas): lineno, line = lineno+1, next(f) mo = re.match(r'\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$', line) assert mo, (lineno, line) symbol = mo.group(2) number, x, y, z = list(map(int, mo.group(1, 3, 4, 5))) assert self.symbol2number[symbol] == number, (lineno, line) assert self.number2symbol[number] == symbol, (lineno, line) assert x == 0, (lineno, line) state = states[z] assert y == len(state), (lineno, line) lineno, line = lineno+1, next(f) mo = re.match(r'\s+("(?:\\\d\d\d)*")},$', line) assert mo, (lineno, line) first = {} rawbitset = eval(mo.group(1)) for i, c in enumerate(rawbitset): byte = ord(c) for j in range(8): if byte & (1<s      PK1]rRRpgen2/tokenize.pynu[# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation. # All rights reserved. """Tokenization help for Python programs. generate_tokens(readline) is a generator that breaks a stream of text into Python tokens. It accepts a readline-like method which is called repeatedly to get the next line of input (or "" for EOF). It generates 5-tuples with these members: the token type (see token.py) the token (a string) the starting (row, column) indices of the token (a 2-tuple of ints) the ending (row, column) indices of the token (a 2-tuple of ints) the original line (string) It is designed to match the working of the Python tokenizer exactly, except that it produces COMMENT tokens for comments and gives type OP for all operators Older entry points tokenize_loop(readline, tokeneater) tokenize(readline, tokeneater=printtoken) are the same, except instead of generating tokens, tokeneater is a callback function to which the 5 fields described above are passed as 5 arguments, each time a new token is found.""" __author__ = 'Ka-Ping Yee ' __credits__ = \ 'GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro' import string, re from codecs import BOM_UTF8, lookup from lib2to3.pgen2.token import * from . import token __all__ = [x for x in dir(token) if x[0] != '_'] + ["tokenize", "generate_tokens", "untokenize"] del token try: bytes except NameError: # Support bytes type in Python <= 2.5, so 2to3 turns itself into # valid Python 3 code. bytes = str def group(*choices): return '(' + '|'.join(choices) + ')' def any(*choices): return group(*choices) + '*' def maybe(*choices): return group(*choices) + '?' def _combinations(*l): return set( x + y for x in l for y in l + ("",) if x.casefold() != y.casefold() ) Whitespace = r'[ \f\t]*' Comment = r'#[^\r\n]*' Ignore = Whitespace + any(r'\\\r?\n' + Whitespace) + maybe(Comment) Name = r'\w+' Binnumber = r'0[bB]_?[01]+(?:_[01]+)*' Hexnumber = r'0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?' Octnumber = r'0[oO]?_?[0-7]+(?:_[0-7]+)*[lL]?' Decnumber = group(r'[1-9]\d*(?:_\d+)*[lL]?', '0[lL]?') Intnumber = group(Binnumber, Hexnumber, Octnumber, Decnumber) Exponent = r'[eE][-+]?\d+(?:_\d+)*' Pointfloat = group(r'\d+(?:_\d+)*\.(?:\d+(?:_\d+)*)?', r'\.\d+(?:_\d+)*') + maybe(Exponent) Expfloat = r'\d+(?:_\d+)*' + Exponent Floatnumber = group(Pointfloat, Expfloat) Imagnumber = group(r'\d+(?:_\d+)*[jJ]', Floatnumber + r'[jJ]') Number = group(Imagnumber, Floatnumber, Intnumber) # Tail end of ' string. Single = r"[^'\\]*(?:\\.[^'\\]*)*'" # Tail end of " string. Double = r'[^"\\]*(?:\\.[^"\\]*)*"' # Tail end of ''' string. Single3 = r"[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''" # Tail end of """ string. Double3 = r'[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""' _litprefix = r"(?:[uUrRbBfF]|[rR][fFbB]|[fFbBuU][rR])?" Triple = group(_litprefix + "'''", _litprefix + '"""') # Single-line ' or " string. String = group(_litprefix + r"'[^\n'\\]*(?:\\.[^\n'\\]*)*'", _litprefix + r'"[^\n"\\]*(?:\\.[^\n"\\]*)*"') # Because of leftmost-then-longest match semantics, be sure to put the # longest operators first (e.g., if = came before ==, == would get # recognized as two instances of =). Operator = group(r"\*\*=?", r">>=?", r"<<=?", r"<>", r"!=", r"//=?", r"->", r"[+\-*/%&@|^=<>]=?", r"~") Bracket = '[][(){}]' Special = group(r'\r?\n', r':=', r'[:;.,`@]') Funny = group(Operator, Bracket, Special) PlainToken = group(Number, Funny, String, Name) Token = Ignore + PlainToken # First (or only) line of ' or " string. ContStr = group(_litprefix + r"'[^\n'\\]*(?:\\.[^\n'\\]*)*" + group("'", r'\\\r?\n'), _litprefix + r'"[^\n"\\]*(?:\\.[^\n"\\]*)*' + group('"', r'\\\r?\n')) PseudoExtras = group(r'\\\r?\n', Comment, Triple) PseudoToken = Whitespace + group(PseudoExtras, Number, Funny, ContStr, Name) tokenprog, pseudoprog, single3prog, double3prog = map( re.compile, (Token, PseudoToken, Single3, Double3)) _strprefixes = ( _combinations('r', 'R', 'f', 'F') | _combinations('r', 'R', 'b', 'B') | {'u', 'U', 'ur', 'uR', 'Ur', 'UR'} ) endprogs = {"'": re.compile(Single), '"': re.compile(Double), "'''": single3prog, '"""': double3prog, **{f"{prefix}'''": single3prog for prefix in _strprefixes}, **{f'{prefix}"""': double3prog for prefix in _strprefixes}, **{prefix: None for prefix in _strprefixes}} triple_quoted = ( {"'''", '"""'} | {f"{prefix}'''" for prefix in _strprefixes} | {f'{prefix}"""' for prefix in _strprefixes} ) single_quoted = ( {"'", '"'} | {f"{prefix}'" for prefix in _strprefixes} | {f'{prefix}"' for prefix in _strprefixes} ) tabsize = 8 class TokenError(Exception): pass class StopTokenizing(Exception): pass def printtoken(type, token, xxx_todo_changeme, xxx_todo_changeme1, line): # for testing (srow, scol) = xxx_todo_changeme (erow, ecol) = xxx_todo_changeme1 print("%d,%d-%d,%d:\t%s\t%s" % \ (srow, scol, erow, ecol, tok_name[type], repr(token))) def tokenize(readline, tokeneater=printtoken): """ The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. The second parameter, tokeneater, must also be a callable object. It is called once for each token, with five arguments, corresponding to the tuples generated by generate_tokens(). """ try: tokenize_loop(readline, tokeneater) except StopTokenizing: pass # backwards compatible interface def tokenize_loop(readline, tokeneater): for token_info in generate_tokens(readline): tokeneater(*token_info) class Untokenizer: def __init__(self): self.tokens = [] self.prev_row = 1 self.prev_col = 0 def add_whitespace(self, start): row, col = start assert row <= self.prev_row col_offset = col - self.prev_col if col_offset: self.tokens.append(" " * col_offset) def untokenize(self, iterable): for t in iterable: if len(t) == 2: self.compat(t, iterable) break tok_type, token, start, end, line = t self.add_whitespace(start) self.tokens.append(token) self.prev_row, self.prev_col = end if tok_type in (NEWLINE, NL): self.prev_row += 1 self.prev_col = 0 return "".join(self.tokens) def compat(self, token, iterable): startline = False indents = [] toks_append = self.tokens.append toknum, tokval = token if toknum in (NAME, NUMBER): tokval += ' ' if toknum in (NEWLINE, NL): startline = True for tok in iterable: toknum, tokval = tok[:2] if toknum in (NAME, NUMBER, ASYNC, AWAIT): tokval += ' ' if toknum == INDENT: indents.append(tokval) continue elif toknum == DEDENT: indents.pop() continue elif toknum in (NEWLINE, NL): startline = True elif startline and indents: toks_append(indents[-1]) startline = False toks_append(tokval) cookie_re = re.compile(r'^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)', re.ASCII) blank_re = re.compile(br'^[ \t\f]*(?:[#\r\n]|$)', re.ASCII) def _get_normal_name(orig_enc): """Imitates get_normal_name in tokenizer.c.""" # Only care about the first 12 characters. enc = orig_enc[:12].lower().replace("_", "-") if enc == "utf-8" or enc.startswith("utf-8-"): return "utf-8" if enc in ("latin-1", "iso-8859-1", "iso-latin-1") or \ enc.startswith(("latin-1-", "iso-8859-1-", "iso-latin-1-")): return "iso-8859-1" return orig_enc def detect_encoding(readline): """ The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. """ bom_found = False encoding = None default = 'utf-8' def read_or_stop(): try: return readline() except StopIteration: return bytes() def find_cookie(line): try: line_string = line.decode('ascii') except UnicodeDecodeError: return None match = cookie_re.match(line_string) if not match: return None encoding = _get_normal_name(match.group(1)) try: codec = lookup(encoding) except LookupError: # This behaviour mimics the Python interpreter raise SyntaxError("unknown encoding: " + encoding) if bom_found: if codec.name != 'utf-8': # This behaviour mimics the Python interpreter raise SyntaxError('encoding problem: utf-8') encoding += '-sig' return encoding first = read_or_stop() if first.startswith(BOM_UTF8): bom_found = True first = first[3:] default = 'utf-8-sig' if not first: return default, [] encoding = find_cookie(first) if encoding: return encoding, [first] if not blank_re.match(first): return default, [first] second = read_or_stop() if not second: return default, [first] encoding = find_cookie(second) if encoding: return encoding, [first, second] return default, [first, second] def untokenize(iterable): """Transform tokens back into Python source code. Each element returned by the iterable must be a token sequence with at least two elements, a token number and token value. If only two tokens are passed, the resulting output is poor. Round-trip invariant for full input: Untokenized source will match input source exactly Round-trip invariant for limited input: # Output text will tokenize the back to the input t1 = [tok[:2] for tok in generate_tokens(f.readline)] newcode = untokenize(t1) readline = iter(newcode.splitlines(1)).next t2 = [tok[:2] for tokin generate_tokens(readline)] assert t1 == t2 """ ut = Untokenizer() return ut.untokenize(iterable) def generate_tokens(readline): """ The generate_tokens() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. Alternately, readline can be a callable function terminating with StopIteration: readline = open(myfile).next # Example of alternate readline The generator produces 5-tuples with these members: the token type; the token string; a 2-tuple (srow, scol) of ints specifying the row and column where the token begins in the source; a 2-tuple (erow, ecol) of ints specifying the row and column where the token ends in the source; and the line on which the token was found. The line passed is the physical line. """ lnum = parenlev = continued = 0 contstr, needcont = '', 0 contline = None indents = [0] # 'stashed' and 'async_*' are used for async/await parsing stashed = None async_def = False async_def_indent = 0 async_def_nl = False while 1: # loop over lines in stream try: line = readline() except StopIteration: line = '' lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError("EOF in multi-line string", strstart) endmatch = endprog.match(line) if endmatch: pos = end = endmatch.end(0) yield (STRING, contstr + line[:end], strstart, (lnum, end), contline + line) contstr, needcont = '', 0 contline = None elif needcont and line[-2:] != '\\\n' and line[-3:] != '\\\r\n': yield (ERRORTOKEN, contstr + line, strstart, (lnum, len(line)), contline) contstr = '' contline = None continue else: contstr = contstr + line contline = contline + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column//tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if stashed: yield stashed stashed = None if line[pos] in '#\r\n': # skip comments or blank lines if line[pos] == '#': comment_token = line[pos:].rstrip('\r\n') nl_pos = pos + len(comment_token) yield (COMMENT, comment_token, (lnum, pos), (lnum, pos + len(comment_token)), line) yield (NL, line[nl_pos:], (lnum, nl_pos), (lnum, len(line)), line) else: yield ((NL, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) yield (INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: if column not in indents: raise IndentationError( "unindent does not match any outer indentation level", ("", lnum, pos, line)) indents = indents[:-1] if async_def and async_def_indent >= indents[-1]: async_def = False async_def_nl = False async_def_indent = 0 yield (DEDENT, '', (lnum, pos), (lnum, pos), line) if async_def and async_def_nl and async_def_indent >= indents[-1]: async_def = False async_def_nl = False async_def_indent = 0 else: # continued statement if not line: raise TokenError("EOF in multi-line statement", (lnum, 0)) continued = 0 while pos < max: pseudomatch = pseudoprog.match(line, pos) if pseudomatch: # scan for tokens start, end = pseudomatch.span(1) spos, epos, pos = (lnum, start), (lnum, end), end token, initial = line[start:end], line[start] if initial in string.digits or \ (initial == '.' and token != '.'): # ordinary number yield (NUMBER, token, spos, epos, line) elif initial in '\r\n': newline = NEWLINE if parenlev > 0: newline = NL elif async_def: async_def_nl = True if stashed: yield stashed stashed = None yield (newline, token, spos, epos, line) elif initial == '#': assert not token.endswith("\n") if stashed: yield stashed stashed = None yield (COMMENT, token, spos, epos, line) elif token in triple_quoted: endprog = endprogs[token] endmatch = endprog.match(line, pos) if endmatch: # all on one line pos = endmatch.end(0) token = line[start:pos] if stashed: yield stashed stashed = None yield (STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] contline = line break elif initial in single_quoted or \ token[:2] in single_quoted or \ token[:3] in single_quoted: if token[-1] == '\n': # continued string strstart = (lnum, start) endprog = (endprogs[initial] or endprogs[token[1]] or endprogs[token[2]]) contstr, needcont = line[start:], 1 contline = line break else: # ordinary string if stashed: yield stashed stashed = None yield (STRING, token, spos, epos, line) elif initial.isidentifier(): # ordinary name if token in ('async', 'await'): if async_def: yield (ASYNC if token == 'async' else AWAIT, token, spos, epos, line) continue tok = (NAME, token, spos, epos, line) if token == 'async' and not stashed: stashed = tok continue if token in ('def', 'for'): if (stashed and stashed[0] == NAME and stashed[1] == 'async'): if token == 'def': async_def = True async_def_indent = indents[-1] yield (ASYNC, stashed[1], stashed[2], stashed[3], stashed[4]) stashed = None if stashed: yield stashed stashed = None yield tok elif initial == '\\': # continued stmt # This yield is new; needed for better idempotency: if stashed: yield stashed stashed = None yield (NL, token, spos, (lnum, pos), line) continued = 1 else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 if stashed: yield stashed stashed = None yield (OP, token, spos, epos, line) else: yield (ERRORTOKEN, line[pos], (lnum, pos), (lnum, pos+1), line) pos = pos + 1 if stashed: yield stashed stashed = None for indent in indents[1:]: # pop remaining indent levels yield (DEDENT, '', (lnum, 0), (lnum, 0), '') yield (ENDMARKER, '', (lnum, 0), (lnum, 0), '') if __name__ == '__main__': # testing import sys if len(sys.argv) > 1: tokenize(open(sys.argv[1]).readline) else: tokenize(sys.stdin.readline) PK1]фpgen2/driver.pyonu[ {fc@sdZdZddgZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z m Z mZdefdYZd Zd deedd Zd Zd ZdZedkrejee ndS(sZParser driver. This provides a high-level interface to parse a file into a syntax tree. s#Guido van Rossum tDrivert load_grammariNi(tgrammartparsettokenttokenizetpgencBsVeZdddZedZedZedZdedZedZ RS(cCs:||_|dkr$tj}n||_||_dS(N(RtNonetloggingt getLoggertloggertconvert(tselfRR R ((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt__init__ s    cCstj|j|j}|jd}d}d }}}} } d} x|D]} | \}}}} } |||fkr|\} }|| kr| d| |7} | }d}n||kr| | ||!7} |}qn|tjtjfkr6| |7} | \}}|j drQ|d7}d}qQqQn|t j krUtj |}n|r~|j jdt j||| n|j||| |fr|r|j jdnPnd} | \}}|j drQ|d7}d}qQqQWtjd||| |f|jS( s4Parse a series of tokens and return the syntax tree.iius s%s %r (prefix=%r)sStop.tsincomplete inputN(RtParserRR tsetupRRtCOMMENTtNLtendswithRtOPtopmapR tdebugttok_nametaddtokent ParseErrortrootnode(R ttokensRtptlinenotcolumnttypetvaluetstarttendt line_texttprefixt quintuplets_linenots_column((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt parse_tokens'sR                cCs"tj|j}|j||S(s*Parse a stream and return the syntax tree.(Rtgenerate_tokenstreadlineR((R tstreamRR((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pytparse_stream_rawWscCs|j||S(s*Parse a stream and return the syntax tree.(R,(R R+R((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt parse_stream\scCs;tj|d|}z|j||SWd|jXdS(s(Parse a file and return the syntax tree.trN(tcodecstopenR-tclose(R tfilenametencodingRR+((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt parse_file`scCs+tjtj|j}|j||S(s*Parse a string and return the syntax tree.(RR)tStringIOR*R((R ttextRR((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt parse_stringhsN( t__name__t __module__RR tFalseR(R,R-R4R7(((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyRs  0  cCsRtjj|\}}|dkr-d}n||djtttjdS(Ns.txtRt.s.pickle(tostpathtsplitexttjointmaptstrtsyst version_info(tgttheadttail((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt_generate_pickle_namens  s Grammar.txtcCs|dkrtj}n|dkr3t|n|}|sOt|| r|jd|tj|}|r|jd|y|j|Wqt k r}|jd|qXqnt j }|j ||S(s'Load the grammar (maybe from a pickle).s!Generating grammar tables from %ssWriting grammar tables to %ssWriting failed: %sN( RRR RGt_newertinfoRtgenerate_grammartdumptIOErrorRtGrammartload(RDtgptsavetforceR tgte((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyRus   cCsNtjj|stStjj|s,tStjj|tjj|kS(s0Inquire whether file a was written since file b.(R<R=texistsR:tTruetgetmtime(tatb((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyRHs cCsctjj|rt|Sttjj|}tj||}tj }|j ||S(sNormally, loads a pickled grammar by doing pkgutil.get_data(package, pickled_grammar) where *pickled_grammar* is computed from *grammar_source* by adding the Python version and using a ``.pickle`` extension. However, if *grammar_source* is an extant file, load_grammar(grammar_source) is called instead. This facilitates using a packaged grammar file when needed but preserves load_grammar's automatic regeneration behavior when possible. ( R<R=tisfileRRGtbasenametpkgutiltget_dataRRMtloads(tpackagetgrammar_sourcet pickled_nametdataRR((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pytload_packaged_grammars    cGsc|stjd}ntjdtjdtjddx$|D]}t|dtdtq?WtS(sMain program, when run as a script: produce grammar pickle files. Calls load_grammar for each argument, a path to a grammar text file. itlevelR+tformats %(message)sRPRQ(RBtargvRt basicConfigtINFOtstdoutRRU(targsRD((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pytmains t__main__(t__doc__t __author__t__all__R/R<RR[R5RBRRRRRRtobjectRRGRRUR:RRHRbRjR8texittint(((s,/usr/lib64/python2.7/lib2to3/pgen2/driver.pyt s$       (P   PK1]lp66 pgen2/pgen.pynu[# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. # Pgen imports from . import grammar, token, tokenize class PgenGrammar(grammar.Grammar): pass class ParserGenerator(object): def __init__(self, filename, stream=None): close_stream = None if stream is None: stream = open(filename, encoding="utf-8") close_stream = stream.close self.filename = filename self.stream = stream self.generator = tokenize.generate_tokens(stream.readline) self.gettoken() # Initialize lookahead self.dfas, self.startsymbol = self.parse() if close_stream is not None: close_stream() self.first = {} # map from symbol name to set of tokens self.addfirstsets() def make_grammar(self): c = PgenGrammar() names = list(self.dfas.keys()) names.sort() names.remove(self.startsymbol) names.insert(0, self.startsymbol) for name in names: i = 256 + len(c.symbol2number) c.symbol2number[name] = i c.number2symbol[i] = name for name in names: dfa = self.dfas[name] states = [] for state in dfa: arcs = [] for label, next in sorted(state.arcs.items()): arcs.append((self.make_label(c, label), dfa.index(next))) if state.isfinal: arcs.append((0, dfa.index(state))) states.append(arcs) c.states.append(states) c.dfas[c.symbol2number[name]] = (states, self.make_first(c, name)) c.start = c.symbol2number[self.startsymbol] return c def make_first(self, c, name): rawfirst = self.first[name] first = {} for label in sorted(rawfirst): ilabel = self.make_label(c, label) ##assert ilabel not in first # XXX failed on <> ... != first[ilabel] = 1 return first def make_label(self, c, label): # XXX Maybe this should be a method on a subclass of converter? ilabel = len(c.labels) if label[0].isalpha(): # Either a symbol name or a named token if label in c.symbol2number: # A symbol name (a non-terminal) if label in c.symbol2label: return c.symbol2label[label] else: c.labels.append((c.symbol2number[label], None)) c.symbol2label[label] = ilabel return ilabel else: # A named token (NAME, NUMBER, STRING) itoken = getattr(token, label, None) assert isinstance(itoken, int), label assert itoken in token.tok_name, label if itoken in c.tokens: return c.tokens[itoken] else: c.labels.append((itoken, None)) c.tokens[itoken] = ilabel return ilabel else: # Either a keyword or an operator assert label[0] in ('"', "'"), label value = eval(label) if value[0].isalpha(): # A keyword if value in c.keywords: return c.keywords[value] else: c.labels.append((token.NAME, value)) c.keywords[value] = ilabel return ilabel else: # An operator (any non-numeric token) itoken = grammar.opmap[value] # Fails if unknown token if itoken in c.tokens: return c.tokens[itoken] else: c.labels.append((itoken, None)) c.tokens[itoken] = ilabel return ilabel def addfirstsets(self): names = list(self.dfas.keys()) names.sort() for name in names: if name not in self.first: self.calcfirst(name) #print name, self.first[name].keys() def calcfirst(self, name): dfa = self.dfas[name] self.first[name] = None # dummy to detect left recursion state = dfa[0] totalset = {} overlapcheck = {} for label, next in state.arcs.items(): if label in self.dfas: if label in self.first: fset = self.first[label] if fset is None: raise ValueError("recursion for rule %r" % name) else: self.calcfirst(label) fset = self.first[label] totalset.update(fset) overlapcheck[label] = fset else: totalset[label] = 1 overlapcheck[label] = {label: 1} inverse = {} for label, itsfirst in overlapcheck.items(): for symbol in itsfirst: if symbol in inverse: raise ValueError("rule %s is ambiguous; %s is in the" " first sets of %s as well as %s" % (name, symbol, label, inverse[symbol])) inverse[symbol] = label self.first[name] = totalset def parse(self): dfas = {} startsymbol = None # MSTART: (NEWLINE | RULE)* ENDMARKER while self.type != token.ENDMARKER: while self.type == token.NEWLINE: self.gettoken() # RULE: NAME ':' RHS NEWLINE name = self.expect(token.NAME) self.expect(token.OP, ":") a, z = self.parse_rhs() self.expect(token.NEWLINE) #self.dump_nfa(name, a, z) dfa = self.make_dfa(a, z) #self.dump_dfa(name, dfa) oldlen = len(dfa) self.simplify_dfa(dfa) newlen = len(dfa) dfas[name] = dfa #print name, oldlen, newlen if startsymbol is None: startsymbol = name return dfas, startsymbol def make_dfa(self, start, finish): # To turn an NFA into a DFA, we define the states of the DFA # to correspond to *sets* of states of the NFA. Then do some # state reduction. Let's represent sets as dicts with 1 for # values. assert isinstance(start, NFAState) assert isinstance(finish, NFAState) def closure(state): base = {} addclosure(state, base) return base def addclosure(state, base): assert isinstance(state, NFAState) if state in base: return base[state] = 1 for label, next in state.arcs: if label is None: addclosure(next, base) states = [DFAState(closure(start), finish)] for state in states: # NB states grows while we're iterating arcs = {} for nfastate in state.nfaset: for label, next in nfastate.arcs: if label is not None: addclosure(next, arcs.setdefault(label, {})) for label, nfaset in sorted(arcs.items()): for st in states: if st.nfaset == nfaset: break else: st = DFAState(nfaset, finish) states.append(st) state.addarc(st, label) return states # List of DFAState instances; first one is start def dump_nfa(self, name, start, finish): print("Dump of NFA for", name) todo = [start] for i, state in enumerate(todo): print(" State", i, state is finish and "(final)" or "") for label, next in state.arcs: if next in todo: j = todo.index(next) else: j = len(todo) todo.append(next) if label is None: print(" -> %d" % j) else: print(" %s -> %d" % (label, j)) def dump_dfa(self, name, dfa): print("Dump of DFA for", name) for i, state in enumerate(dfa): print(" State", i, state.isfinal and "(final)" or "") for label, next in sorted(state.arcs.items()): print(" %s -> %d" % (label, dfa.index(next))) def simplify_dfa(self, dfa): # This is not theoretically optimal, but works well enough. # Algorithm: repeatedly look for two states that have the same # set of arcs (same labels pointing to the same nodes) and # unify them, until things stop changing. # dfa is a list of DFAState instances changes = True while changes: changes = False for i, state_i in enumerate(dfa): for j in range(i+1, len(dfa)): state_j = dfa[j] if state_i == state_j: #print " unify", i, j del dfa[j] for state in dfa: state.unifystate(state_j, state_i) changes = True break def parse_rhs(self): # RHS: ALT ('|' ALT)* a, z = self.parse_alt() if self.value != "|": return a, z else: aa = NFAState() zz = NFAState() aa.addarc(a) z.addarc(zz) while self.value == "|": self.gettoken() a, z = self.parse_alt() aa.addarc(a) z.addarc(zz) return aa, zz def parse_alt(self): # ALT: ITEM+ a, b = self.parse_item() while (self.value in ("(", "[") or self.type in (token.NAME, token.STRING)): c, d = self.parse_item() b.addarc(c) b = d return a, b def parse_item(self): # ITEM: '[' RHS ']' | ATOM ['+' | '*'] if self.value == "[": self.gettoken() a, z = self.parse_rhs() self.expect(token.OP, "]") a.addarc(z) return a, z else: a, z = self.parse_atom() value = self.value if value not in ("+", "*"): return a, z self.gettoken() z.addarc(a) if value == "+": return a, z else: return a, a def parse_atom(self): # ATOM: '(' RHS ')' | NAME | STRING if self.value == "(": self.gettoken() a, z = self.parse_rhs() self.expect(token.OP, ")") return a, z elif self.type in (token.NAME, token.STRING): a = NFAState() z = NFAState() a.addarc(z, self.value) self.gettoken() return a, z else: self.raise_error("expected (...) or NAME or STRING, got %s/%s", self.type, self.value) def expect(self, type, value=None): if self.type != type or (value is not None and self.value != value): self.raise_error("expected %s/%s, got %s/%s", type, value, self.type, self.value) value = self.value self.gettoken() return value def gettoken(self): tup = next(self.generator) while tup[0] in (tokenize.COMMENT, tokenize.NL): tup = next(self.generator) self.type, self.value, self.begin, self.end, self.line = tup #print token.tok_name[self.type], repr(self.value) def raise_error(self, msg, *args): if args: try: msg = msg % args except: msg = " ".join([msg] + list(map(str, args))) raise SyntaxError(msg, (self.filename, self.end[0], self.end[1], self.line)) class NFAState(object): def __init__(self): self.arcs = [] # list of (label, NFAState) pairs def addarc(self, next, label=None): assert label is None or isinstance(label, str) assert isinstance(next, NFAState) self.arcs.append((label, next)) class DFAState(object): def __init__(self, nfaset, final): assert isinstance(nfaset, dict) assert isinstance(next(iter(nfaset)), NFAState) assert isinstance(final, NFAState) self.nfaset = nfaset self.isfinal = final in nfaset self.arcs = {} # map from label to DFAState def addarc(self, next, label): assert isinstance(label, str) assert label not in self.arcs assert isinstance(next, DFAState) self.arcs[label] = next def unifystate(self, old, new): for label, next in self.arcs.items(): if next is old: self.arcs[label] = new def __eq__(self, other): # Equality test -- ignore the nfaset instance variable assert isinstance(other, DFAState) if self.isfinal != other.isfinal: return False # Can't just return self.arcs == other.arcs, because that # would invoke this method recursively, with cycles... if len(self.arcs) != len(other.arcs): return False for label, next in self.arcs.items(): if next is not other.arcs.get(label): return False return True __hash__ = None # For Py3 compatibility. def generate_grammar(filename="Grammar.txt"): p = ParserGenerator(filename) return p.make_grammar() PK1]rpgen2/__init__.pynu[# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """The pgen2 package.""" PK1]%oQQpgen2/driver.pynu[# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. # Modifications: # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Parser driver. This provides a high-level interface to parse a file into a syntax tree. """ __author__ = "Guido van Rossum " __all__ = ["Driver", "load_grammar"] # Python imports import io import os import logging import pkgutil import sys # Pgen imports from . import grammar, parse, token, tokenize, pgen class Driver(object): def __init__(self, grammar, convert=None, logger=None): self.grammar = grammar if logger is None: logger = logging.getLogger() self.logger = logger self.convert = convert def parse_tokens(self, tokens, debug=False): """Parse a series of tokens and return the syntax tree.""" # XXX Move the prefix computation into a wrapper around tokenize. p = parse.Parser(self.grammar, self.convert) p.setup() lineno = 1 column = 0 type = value = start = end = line_text = None prefix = "" for quintuple in tokens: type, value, start, end, line_text = quintuple if start != (lineno, column): assert (lineno, column) <= start, ((lineno, column), start) s_lineno, s_column = start if lineno < s_lineno: prefix += "\n" * (s_lineno - lineno) lineno = s_lineno column = 0 if column < s_column: prefix += line_text[column:s_column] column = s_column if type in (tokenize.COMMENT, tokenize.NL): prefix += value lineno, column = end if value.endswith("\n"): lineno += 1 column = 0 continue if type == token.OP: type = grammar.opmap[value] if debug: self.logger.debug("%s %r (prefix=%r)", token.tok_name[type], value, prefix) if p.addtoken(type, value, (prefix, start)): if debug: self.logger.debug("Stop.") break prefix = "" lineno, column = end if value.endswith("\n"): lineno += 1 column = 0 else: # We never broke out -- EOF is too soon (how can this happen???) raise parse.ParseError("incomplete input", type, value, (prefix, start)) return p.rootnode def parse_stream_raw(self, stream, debug=False): """Parse a stream and return the syntax tree.""" tokens = tokenize.generate_tokens(stream.readline) return self.parse_tokens(tokens, debug) def parse_stream(self, stream, debug=False): """Parse a stream and return the syntax tree.""" return self.parse_stream_raw(stream, debug) def parse_file(self, filename, encoding=None, debug=False): """Parse a file and return the syntax tree.""" with io.open(filename, "r", encoding=encoding) as stream: return self.parse_stream(stream, debug) def parse_string(self, text, debug=False): """Parse a string and return the syntax tree.""" tokens = tokenize.generate_tokens(io.StringIO(text).readline) return self.parse_tokens(tokens, debug) def _generate_pickle_name(gt): head, tail = os.path.splitext(gt) if tail == ".txt": tail = "" return head + tail + ".".join(map(str, sys.version_info)) + ".pickle" def load_grammar(gt="Grammar.txt", gp=None, save=True, force=False, logger=None): """Load the grammar (maybe from a pickle).""" if logger is None: logger = logging.getLogger() gp = _generate_pickle_name(gt) if gp is None else gp if force or not _newer(gp, gt): logger.info("Generating grammar tables from %s", gt) g = pgen.generate_grammar(gt) if save: logger.info("Writing grammar tables to %s", gp) try: g.dump(gp) except OSError as e: logger.info("Writing failed: %s", e) else: g = grammar.Grammar() g.load(gp) return g def _newer(a, b): """Inquire whether file a was written since file b.""" if not os.path.exists(a): return False if not os.path.exists(b): return True return os.path.getmtime(a) >= os.path.getmtime(b) def load_packaged_grammar(package, grammar_source): """Normally, loads a pickled grammar by doing pkgutil.get_data(package, pickled_grammar) where *pickled_grammar* is computed from *grammar_source* by adding the Python version and using a ``.pickle`` extension. However, if *grammar_source* is an extant file, load_grammar(grammar_source) is called instead. This facilitates using a packaged grammar file when needed but preserves load_grammar's automatic regeneration behavior when possible. """ if os.path.isfile(grammar_source): return load_grammar(grammar_source) pickled_name = _generate_pickle_name(os.path.basename(grammar_source)) data = pkgutil.get_data(package, pickled_name) g = grammar.Grammar() g.loads(data) return g def main(*args): """Main program, when run as a script: produce grammar pickle files. Calls load_grammar for each argument, a path to a grammar text file. """ if not args: args = sys.argv[1:] logging.basicConfig(level=logging.INFO, stream=sys.stdout, format='%(message)s') for gt in args: load_grammar(gt, save=True, force=True) return True if __name__ == "__main__": sys.exit(int(not main())) PK1]>FAApgen2/tokenize.pyonu[ {fc@sdZdZdZddlZddlZddlmZmZddlTddl m Z ge e D]Z e d d krge ^qgd d d gZ [ yeWnek reZnXdZdZdZdZdZeedeeeZdZdZdZdZdZeeeeeZdZeddeeZdeZeeeZ ede dZ!ee!e eZ"dZ#d Z$d!Z%d"Z&ed#d$Z'ed%d&Z(ed'd(d)d*d+d,d-d.d/ Z)d0Z*ed1d2Z+ee)e*e+Z,ee"e,e(eZ-ee-Z.ed3ed4dd5ed6dZ/edee'Z0eee0e"e,e/eZ1e2ej3e.e1e%e&f\Z4Z5Z6Z7i&ej3e#d46ej3e$d66e6d76e7d86e6d96e7d:6e6d;6e7d<6e6d=6e7d>6e6d?6e7d@6e6dA6e7dB6e6dC6e7dD6e6dE6e7dF6e6dG6e7dH6e6dI6e7dJ6e6dK6e7dL6e6dM6e7dN6e6dO6e7dP6e6dQ6e7dR6e6dS6e7dT6ddU6ddV6ddW6ddX6ddY6ddZ6Z9iZ:xdD]Z;e;e:e;fdyYZ?dze>fd{YZ@d|ZAeAd}ZBd~ZCdddYZDej3dZEej3dZFdZGdZHdZIdZJeKdkrddlLZLeMeLjNdkreBeOeLjNdjPqeBeLjQjPndS(sTokenization help for Python programs. generate_tokens(readline) is a generator that breaks a stream of text into Python tokens. It accepts a readline-like method which is called repeatedly to get the next line of input (or "" for EOF). It generates 5-tuples with these members: the token type (see token.py) the token (a string) the starting (row, column) indices of the token (a 2-tuple of ints) the ending (row, column) indices of the token (a 2-tuple of ints) the original line (string) It is designed to match the working of the Python tokenizer exactly, except that it produces COMMENT tokens for comments and gives type OP for all operators Older entry points tokenize_loop(readline, tokeneater) tokenize(readline, tokeneater=printtoken) are the same, except instead of generating tokens, tokeneater is a callback function to which the 5 fields described above are passed as 5 arguments, each time a new token is found.sKa-Ping Yee s@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip MontanaroiN(tBOM_UTF8tlookup(t*i(ttokenit_ttokenizetgenerate_tokenst untokenizecGsddj|dS(Nt(t|t)(tjoin(tchoices((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pytgroup0tcGst|dS(NR(R (R ((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pytany1RcGst|dS(Nt?(R (R ((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pytmaybe2Rs[ \f\t]*s #[^\r\n]*s\\\r?\ns [a-zA-Z_]\w*s 0[bB][01]*s0[xX][\da-fA-F]*[lL]?s0[oO]?[0-7]*[lL]?s [1-9]\d*[lL]?s [eE][-+]?\d+s\d+\.\d*s\.\d+s\d+s\d+[jJ]s[jJ]s[^'\\]*(?:\\.[^'\\]*)*'s[^"\\]*(?:\\.[^"\\]*)*"s%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''s%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""s[ubUB]?[rR]?'''s[ubUB]?[rR]?"""s&[uU]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*'s&[uU]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*"s\*\*=?s>>=?s<<=?s<>s!=s//=?s->s[+\-*/%&@|^=<>]=?t~s[][(){}]s\r?\ns[:;.,`@]s'[uUbB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*t's'[uUbB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*t"s'''s"""sr'''sr"""su'''su"""sb'''sb"""sur'''sur"""sbr'''sbr"""sR'''sR"""sU'''sU"""sB'''sB"""suR'''suR"""sUr'''sUr"""sUR'''sUR"""sbR'''sbR"""sBr'''sBr"""sBR'''sBR"""trtRtutUtbtBsr'sr"sR'sR"su'su"sU'sU"sb'sb"sB'sB"sur'sur"sUr'sUr"suR'suR"sUR'sUR"sbr'sbr"sBr'sBr"sbR'sbR"sBR'sBR"it TokenErrorcBseZRS((t__name__t __module__(((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyRstStopTokenizingcBseZRS((RR(((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyRsc CsA|\}}|\}}d||||t|t|fGHdS(Ns%d,%d-%d,%d: %s %s(ttok_nametrepr( ttypeRtstarttendtlinetsrowtscolterowtecol((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyt printtokens  cCs)yt||Wntk r$nXdS(s: The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. The second parameter, tokeneater, must also be a callable object. It is called once for each token, with five arguments, corresponding to the tuples generated by generate_tokens(). N(t tokenize_loopR(treadlinet tokeneater((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyRs  cCs%xt|D]}||q WdS(N(R(R+R,t token_info((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyR*st UntokenizercBs,eZdZdZdZdZRS(cCsg|_d|_d|_dS(Nii(ttokenstprev_rowtprev_col(tself((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyt__init__s  cCs:|\}}||j}|r6|jjd|ndS(Nt (R1R/tappend(R2R"trowtcolt col_offset((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pytadd_whitespaces  cCsx|D]}t|dkr3|j||Pn|\}}}}}|j||jj||\|_|_|ttfkr|jd7_d|_qqWdj |jS(NiiiR( tlentcompatR9R/R5R0R1tNEWLINEtNLR (R2titerablettttok_typeRR"R#R$((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyRs  c Cs%t}g}|jj}|\}}|ttfkrC|d7}n|ttfkr^t}nx|D]}|d \}}|ttfkr|d7}n|tkr|j|qenZ|t kr|j qen>|ttfkrt}n#|r|r||dt}n||qeWdS(NR4ii( tFalseR/R5tNAMEtNUMBERR<R=tTruetINDENTtDEDENTtpop( R2RR>t startlinetindentst toks_appendttoknumttokvalttok((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyR;s0             (RRR3R9RR;(((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyR.s   s&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)cCs^|d jjdd}|dks7|jdr;dS|d ksV|jd rZdS|S(s(Imitates get_normal_name in tokenizer.c.i Rt-sutf-8sutf-8-slatin-1s iso-8859-1s iso-latin-1slatin-1-s iso-8859-1-s iso-latin-1-(slatin-1s iso-8859-1s iso-latin-1(slatin-1-s iso-8859-1-s iso-latin-1-(tlowertreplacet startswith(torig_enctenc((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyt_get_normal_names cstd}d}fd}fd}|}|jtrat|d}d}n|sq|gfS||}|r||gfStj|s||gfS|}|s||gfS||}|r|||gfS|||gfS(s The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. sutf-8cs'y SWntk r"tSXdS(N(t StopIterationtbytes((R+(s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyt read_or_stops  csy|jd}Wntk r'dSXtj|}|sAdSt|jd}yt|}Wn!tk rt d|nXr|j dkrt dn|d7}n|S(Ntasciiisunknown encoding: sutf-8sencoding problem: utf-8s-sig( tdecodetUnicodeDecodeErrortNonet cookie_retmatchRTR Rt LookupErrort SyntaxErrortname(R$t line_stringR]tencodingtcodec(t bom_found(s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyt find_cookies"   is utf-8-sigN(RAR[RQRRDtblank_reR](R+RbtdefaultRWRetfirsttsecond((RdR+s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pytdetect_encodings0          cCst}|j|S(sTransform tokens back into Python source code. Each element returned by the iterable must be a token sequence with at least two elements, a token number and token value. If only two tokens are passed, the resulting output is poor. Round-trip invariant for full input: Untokenized source will match input source exactly Round-trip invariant for limited intput: # Output text will tokenize the back to the input t1 = [tok[:2] for tok in generate_tokens(f.readline)] newcode = untokenize(t1) readline = iter(newcode.splitlines(1)).next t2 = [tok[:2] for tokin generate_tokens(readline)] assert t1 == t2 (R.R(R>tut((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyRFs ccs@d}}}tjdd}}d\}}d}dg} xy |} Wntk rfd} nX|d}dt| } } |r{| std| fn|j| }|r|jd} }t|| | | ||f|| fVd\}}d}q|ra| ddkra| d d krat || | |t| f|fVd}d}q@q|| }|| }q@n`|dkr| r| sPnd}xv| | kr| | d kr|d}n?| | d kr|t dt }n| | d krd}nP| d} qW| | kr'Pn| | dkr| | dkr| | j d}| t|}t ||| f|| t|f| fVt | |||f|t| f| fVq@t t f| | dk| | || f|t| f| fVq@n|| dkrI| j|t| | |df|| f| fVnx|| dkr|| krtdd|| | fn| d } td|| f|| f| fVqLWn$| std|dffnd}x| | krtj| | }|r|jd\}}||f||f|}}} | ||!| |}}||kss|dkr|dkrt|||| fVq|dkrt}|dkrt }n||||| fVq|dkrt |||| fVq|tkrrt|}|j| | }|rR|jd} | || !}t|||| f| fVq||f} | |}| }Pq|tks|d tks|d tkr|ddkr||f} t|pt|dpt|d}| |d}}| }Pqt|||| fVq||kr5t|||| fVq|dkrdt |||| f| fVd}q|dkr}|d}n|dkr|d}nt|||| fVqt | | || f|| df| fV| d} qWq@Wx2| dD]&}td|df|dfdfVqWtd|df|dfdfVdS(sT The generate_tokens() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. Alternately, readline can be a callable function terminating with StopIteration: readline = open(myfile).next # Example of alternate readline The generator produces 5-tuples with these members: the token type; the token string; a 2-tuple (srow, scol) of ints specifying the row and column where the token begins in the source; a 2-tuple (erow, ecol) of ints specifying the row and column where the token ends in the source; and the line on which the token was found. The line passed is the logical line; continuation lines are included. iRt 0123456789RisEOF in multi-line stringis\ is\ R4s s s# t#s is3unindent does not match any outer indentation levels sEOF in multi-line statementt.iis s\s([{s)]}N(Ri(Ri(tstringt ascii_lettersR[RUR:RR]R#tSTRINGt ERRORTOKENttabsizetrstriptCOMMENTR=R5REtIndentationErrorRFt pseudoprogtspanRCR<t triple_quotedtendprogst single_quotedRBtOPt ENDMARKER(R+tlnumtparenlevt continuedt namecharstnumcharstcontstrtneedconttcontlineRIR$tpostmaxtstrstarttendprogtendmatchR#tcolumnt comment_tokentnl_post pseudomatchR"tsposteposRtinitialtnewlinetindent((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyR[s        &      $ #  '  '                   $t__main__(s'''s"""sr'''sr"""sR'''sR"""su'''su"""sU'''sU"""sb'''sb"""sB'''sB"""sur'''sur"""sUr'''sUr"""suR'''suR"""sUR'''sUR"""sbr'''sbr"""sBr'''sBr"""sbR'''sbR"""sBR'''sBR"""(RRsr'sr"sR'sR"su'su"sU'sU"sb'sb"sB'sB"sur'sur"sUr'sUr"suR'suR"sUR'sUR"sbr'sbr"sBr'sBr"sbR'sbR"sBR'sBR"((Rt__doc__t __author__t __credits__RotretcodecsRRtlib2to3.pgen2.tokenRRtdirtxt__all__RVt NameErrortstrR RRt WhitespacetCommenttIgnoretNamet Binnumbert Hexnumbert Octnumbert Decnumbert IntnumbertExponentt PointfloattExpfloatt Floatnumbert ImagnumbertNumbertSingletDoubletSingle3tDouble3tTripletStringtOperatortBrackettSpecialtFunnyt PlainTokentTokentContStrt PseudoExtrast PseudoTokentmaptcompilet tokenprogRwt single3progt double3progR[RzRyR?R{Rst ExceptionRRR)RR*R.R\RfRTRjRRRtsysR:targvtopenR+tstdin(((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyts /           '#     8 I   PK1]yW ))pgen2/token.pynuȯ#! /opt/alt/python-internal/bin/python3.11 """Token constants (from "token.h").""" # Taken from Python (r53757) and modified to include some tokens # originally monkeypatched in by pgen2.tokenize #--start constants-- ENDMARKER = 0 NAME = 1 NUMBER = 2 STRING = 3 NEWLINE = 4 INDENT = 5 DEDENT = 6 LPAR = 7 RPAR = 8 LSQB = 9 RSQB = 10 COLON = 11 COMMA = 12 SEMI = 13 PLUS = 14 MINUS = 15 STAR = 16 SLASH = 17 VBAR = 18 AMPER = 19 LESS = 20 GREATER = 21 EQUAL = 22 DOT = 23 PERCENT = 24 BACKQUOTE = 25 LBRACE = 26 RBRACE = 27 EQEQUAL = 28 NOTEQUAL = 29 LESSEQUAL = 30 GREATEREQUAL = 31 TILDE = 32 CIRCUMFLEX = 33 LEFTSHIFT = 34 RIGHTSHIFT = 35 DOUBLESTAR = 36 PLUSEQUAL = 37 MINEQUAL = 38 STAREQUAL = 39 SLASHEQUAL = 40 PERCENTEQUAL = 41 AMPEREQUAL = 42 VBAREQUAL = 43 CIRCUMFLEXEQUAL = 44 LEFTSHIFTEQUAL = 45 RIGHTSHIFTEQUAL = 46 DOUBLESTAREQUAL = 47 DOUBLESLASH = 48 DOUBLESLASHEQUAL = 49 AT = 50 ATEQUAL = 51 OP = 52 COMMENT = 53 NL = 54 RARROW = 55 AWAIT = 56 ASYNC = 57 ERRORTOKEN = 58 COLONEQUAL = 59 N_TOKENS = 60 NT_OFFSET = 256 #--end constants-- tok_name = {} for _name, _value in list(globals().items()): if type(_value) is type(0): tok_name[_value] = _name def ISTERMINAL(x): return x < NT_OFFSET def ISNONTERMINAL(x): return x >= NT_OFFSET def ISEOF(x): return x == ENDMARKER PK1]fuKBKBpgen2/tokenize.pycnu[ {fc@sdZdZdZddlZddlZddlmZmZddlTddl m Z ge e D]Z e d d krge ^qgd d d gZ [ yeWnek reZnXdZdZdZdZdZeedeeeZdZdZdZdZdZeeeeeZdZeddeeZdeZeeeZ ede dZ!ee!e eZ"dZ#d Z$d!Z%d"Z&ed#d$Z'ed%d&Z(ed'd(d)d*d+d,d-d.d/ Z)d0Z*ed1d2Z+ee)e*e+Z,ee"e,e(eZ-ee-Z.ed3ed4dd5ed6dZ/edee'Z0eee0e"e,e/eZ1e2ej3e.e1e%e&f\Z4Z5Z6Z7i&ej3e#d46ej3e$d66e6d76e7d86e6d96e7d:6e6d;6e7d<6e6d=6e7d>6e6d?6e7d@6e6dA6e7dB6e6dC6e7dD6e6dE6e7dF6e6dG6e7dH6e6dI6e7dJ6e6dK6e7dL6e6dM6e7dN6e6dO6e7dP6e6dQ6e7dR6e6dS6e7dT6ddU6ddV6ddW6ddX6ddY6ddZ6Z9iZ:xdD]Z;e;e:e;fdyYZ?dze>fd{YZ@d|ZAeAd}ZBd~ZCdddYZDej3dZEej3dZFdZGdZHdZIdZJeKdkrddlLZLeMeLjNdkreBeOeLjNdjPqeBeLjQjPndS(sTokenization help for Python programs. generate_tokens(readline) is a generator that breaks a stream of text into Python tokens. It accepts a readline-like method which is called repeatedly to get the next line of input (or "" for EOF). It generates 5-tuples with these members: the token type (see token.py) the token (a string) the starting (row, column) indices of the token (a 2-tuple of ints) the ending (row, column) indices of the token (a 2-tuple of ints) the original line (string) It is designed to match the working of the Python tokenizer exactly, except that it produces COMMENT tokens for comments and gives type OP for all operators Older entry points tokenize_loop(readline, tokeneater) tokenize(readline, tokeneater=printtoken) are the same, except instead of generating tokens, tokeneater is a callback function to which the 5 fields described above are passed as 5 arguments, each time a new token is found.sKa-Ping Yee s@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip MontanaroiN(tBOM_UTF8tlookup(t*i(ttokenit_ttokenizetgenerate_tokenst untokenizecGsddj|dS(Nt(t|t)(tjoin(tchoices((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pytgroup0tcGst|dS(NR(R (R ((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pytany1RcGst|dS(Nt?(R (R ((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pytmaybe2Rs[ \f\t]*s #[^\r\n]*s\\\r?\ns [a-zA-Z_]\w*s 0[bB][01]*s0[xX][\da-fA-F]*[lL]?s0[oO]?[0-7]*[lL]?s [1-9]\d*[lL]?s [eE][-+]?\d+s\d+\.\d*s\.\d+s\d+s\d+[jJ]s[jJ]s[^'\\]*(?:\\.[^'\\]*)*'s[^"\\]*(?:\\.[^"\\]*)*"s%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''s%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""s[ubUB]?[rR]?'''s[ubUB]?[rR]?"""s&[uU]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*'s&[uU]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*"s\*\*=?s>>=?s<<=?s<>s!=s//=?s->s[+\-*/%&@|^=<>]=?t~s[][(){}]s\r?\ns[:;.,`@]s'[uUbB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*t's'[uUbB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*t"s'''s"""sr'''sr"""su'''su"""sb'''sb"""sur'''sur"""sbr'''sbr"""sR'''sR"""sU'''sU"""sB'''sB"""suR'''suR"""sUr'''sUr"""sUR'''sUR"""sbR'''sbR"""sBr'''sBr"""sBR'''sBR"""trtRtutUtbtBsr'sr"sR'sR"su'su"sU'sU"sb'sb"sB'sB"sur'sur"sUr'sUr"suR'suR"sUR'sUR"sbr'sbr"sBr'sBr"sbR'sbR"sBR'sBR"it TokenErrorcBseZRS((t__name__t __module__(((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyRstStopTokenizingcBseZRS((RR(((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyRsc CsA|\}}|\}}d||||t|t|fGHdS(Ns%d,%d-%d,%d: %s %s(ttok_nametrepr( ttypeRtstarttendtlinetsrowtscolterowtecol((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyt printtokens  cCs)yt||Wntk r$nXdS(s: The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. The second parameter, tokeneater, must also be a callable object. It is called once for each token, with five arguments, corresponding to the tuples generated by generate_tokens(). N(t tokenize_loopR(treadlinet tokeneater((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyRs  cCs%xt|D]}||q WdS(N(R(R+R,t token_info((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyR*st UntokenizercBs,eZdZdZdZdZRS(cCsg|_d|_d|_dS(Nii(ttokenstprev_rowtprev_col(tself((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyt__init__s  cCsO|\}}||jks!t||j}|rK|jjd|ndS(Nt (R0tAssertionErrorR1R/tappend(R2R"trowtcolt col_offset((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pytadd_whitespaces   cCsx|D]}t|dkr3|j||Pn|\}}}}}|j||jj||\|_|_|ttfkr|jd7_d|_qqWdj |jS(NiiiR( tlentcompatR:R/R6R0R1tNEWLINEtNLR (R2titerablettttok_typeRR"R#R$((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyRs  c Cs%t}g}|jj}|\}}|ttfkrC|d7}n|ttfkr^t}nx|D]}|d \}}|ttfkr|d7}n|tkr|j|qenZ|t kr|j qen>|ttfkrt}n#|r|r||dt}n||qeWdS(NR4ii( tFalseR/R6tNAMEtNUMBERR=R>tTruetINDENTtDEDENTtpop( R2RR?t startlinetindentst toks_appendttoknumttokvalttok((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyR<s0             (RRR3R:RR<(((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyR.s   s&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)cCs^|d jjdd}|dks7|jdr;dS|d ksV|jd rZdS|S(s(Imitates get_normal_name in tokenizer.c.i Rt-sutf-8sutf-8-slatin-1s iso-8859-1s iso-latin-1slatin-1-s iso-8859-1-s iso-latin-1-(slatin-1s iso-8859-1s iso-latin-1(slatin-1-s iso-8859-1-s iso-latin-1-(tlowertreplacet startswith(torig_enctenc((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyt_get_normal_names cstd}d}fd}fd}|}|jtrat|d}d}n|sq|gfS||}|r||gfStj|s||gfS|}|s||gfS||}|r|||gfS|||gfS(s The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. sutf-8cs'y SWntk r"tSXdS(N(t StopIterationtbytes((R+(s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyt read_or_stops  csy|jd}Wntk r'dSXtj|}|sAdSt|jd}yt|}Wn!tk rt d|nXr|j dkrt dn|d7}n|S(Ntasciiisunknown encoding: sutf-8sencoding problem: utf-8s-sig( tdecodetUnicodeDecodeErrortNonet cookie_retmatchRUR Rt LookupErrort SyntaxErrortname(R$t line_stringR^tencodingtcodec(t bom_found(s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyt find_cookies"   is utf-8-sigN(RBR\RRRREtblank_reR^(R+RctdefaultRXRftfirsttsecond((ReR+s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pytdetect_encodings0          cCst}|j|S(sTransform tokens back into Python source code. Each element returned by the iterable must be a token sequence with at least two elements, a token number and token value. If only two tokens are passed, the resulting output is poor. Round-trip invariant for full input: Untokenized source will match input source exactly Round-trip invariant for limited intput: # Output text will tokenize the back to the input t1 = [tok[:2] for tok in generate_tokens(f.readline)] newcode = untokenize(t1) readline = iter(newcode.splitlines(1)).next t2 = [tok[:2] for tokin generate_tokens(readline)] assert t1 == t2 (R.R(R?tut((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyRFs ccsVd}}}tjdd}}d\}}d}dg} xy |} Wntk rfd} nX|d}dt| } } |r{| std| fn|j| }|r|jd} }t|| | | ||f|| fVd\}}d}q|ra| ddkra| d d krat || | |t| f|fVd}d}q@q|| }|| }q@n`|dkr| r| sPnd}xv| | kr| | d kr|d}n?| | d kr|t dt }n| | d krd}nP| d} qW| | kr'Pn| | dkr| | dkr| | j d}| t|}t ||| f|| t|f| fVt | |||f|t| f| fVq@t t f| | dk| | || f|t| f| fVq@n|| dkrI| j|t| | |df|| f| fVnx|| dkr|| krtdd|| | fn| d } td|| f|| f| fVqLWn$| std|dffnd}x| | krtj| | }|r|jd\}}||f||f|}}} | ||!| |}}||kss|dkr|dkrt|||| fVq|dkrt}|dkrt }n||||| fVq|dkr|jd stt |||| fVq|tkrt|}|j| | }|rh|jd} | || !}t|||| f| fVq||f} | |}| }Pq|tks|d tks|d tkr(|ddkr||f} t|pt|dpt|d}| |d}}| }Pqt|||| fVq||krKt|||| fVq|dkrzt |||| f| fVd}q|dkr|d}n|dkr|d}nt|||| fVqt | | || f|| df| fV| d} qWq@Wx2| dD]&}td|df|dfdfVqWtd|df|dfdfVdS(sT The generate_tokens() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. Alternately, readline can be a callable function terminating with StopIteration: readline = open(myfile).next # Example of alternate readline The generator produces 5-tuples with these members: the token type; the token string; a 2-tuple (srow, scol) of ints specifying the row and column where the token begins in the source; a 2-tuple (erow, ecol) of ints specifying the row and column where the token ends in the source; and the line on which the token was found. The line passed is the logical line; continuation lines are included. iRt 0123456789RisEOF in multi-line stringis\ is\ R4s s s# t#s is3unindent does not match any outer indentation levels sEOF in multi-line statementt.s iis\s([{s)]}N(Ri(Ri(tstringt ascii_lettersR\RVR;RR^R#tSTRINGt ERRORTOKENttabsizetrstriptCOMMENTR>R6RFtIndentationErrorRGt pseudoprogtspanRDR=tendswithR5t triple_quotedtendprogst single_quotedRCtOPt ENDMARKER(R+tlnumtparenlevt continuedt namecharstnumcharstcontstrtneedconttcontlineRJR$tpostmaxtstrstarttendprogtendmatchR#tcolumnt comment_tokentnl_post pseudomatchR"tsposteposRtinitialtnewlinetindent((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyR[s        &      $ #  '  '                   $t__main__(s'''s"""sr'''sr"""sR'''sR"""su'''su"""sU'''sU"""sb'''sb"""sB'''sB"""sur'''sur"""sUr'''sUr"""suR'''suR"""sUR'''sUR"""sbr'''sbr"""sBr'''sBr"""sbR'''sbR"""sBR'''sBR"""(RRsr'sr"sR'sR"su'su"sU'sU"sb'sb"sB'sB"sur'sur"sUr'sUr"suR'suR"sUR'sUR"sbr'sbr"sBr'sBr"sbR'sbR"sBR'sBR"((Rt__doc__t __author__t __credits__RptretcodecsRRtlib2to3.pgen2.tokenRRtdirtxt__all__RWt NameErrortstrR RRt WhitespacetCommenttIgnoretNamet Binnumbert Hexnumbert Octnumbert Decnumbert IntnumbertExponentt PointfloattExpfloatt Floatnumbert ImagnumbertNumbertSingletDoubletSingle3tDouble3tTripletStringtOperatortBrackettSpecialtFunnyt PlainTokentTokentContStrt PseudoExtrast PseudoTokentmaptcompilet tokenprogRxt single3progt double3progR\R|R{R@R}Rtt ExceptionRRR)RR*R.R]RgRURkRRRtsysR;targvtopenR+tstdin(((s./usr/lib64/python2.7/lib2to3/pgen2/tokenize.pyts /           '#     8 I   PK1] #PatternGrammar2.7.18.final.0.picklenu[ccollections OrderedDict q]q(]q(Udfasqh]q(]q(M]q(]qKKqa]q KKq a]q KKq aeh]q (]q(KKe]q(KKe]q(KKe]q(KKe]q(KKeeqRqqe]q(M]q(]q(KKqK Kqe]q(KKqK KqKKqeeh]q(]q (KKe]q!(KKe]q"(KKe]q#(KKe]q$(KKeeq%Rq&q'e]q((M]q)(]q*K Kq+a]q,(K Kq-KKq.eeh]q/(]q0(KKe]q1(KKe]q2(KKe]q3(KKe]q4(KKeeq5Rq6q7e]q8(M]q9(]q:K Kq;a]qK Kq?a]q@KKqAaeh]qB]qC(K KeaqDRqEqFe]qG(M]qH(]qIKKqJa]qK(KKqLKKqMKKqNe]qOKKqPa]qQ(KKqRKKqSe]qTKKqUa]qVKKqWaeh]qX]qY(KKeaqZRq[q\e]q](M]q^(]q_(KKq`KKqaKKqbe]qcKKqda]qeKKqfa]qg(KKqhKKqie]qjKKqka]qlKKqmaeh]qn(]qo(KKe]qp(KKe]qq(KKeeqrRqsqte]qu(M]qv(]qw(KKqxKKqyKKqzKKq{e]q|KKq}a]q~KKqa]q(KKqKKqKKqKKqe]q(KKqKKqe]qKKqa]qKKqa]q(KKqKKqKK qKKqe]qKKqa]q(KKqKKqKK qeeh]q(]q(KKe]q(KKe]q(KKe]q(KKeeqRqqeeqRqe]q(Ukeywordsqh]q]q(UnotqKeaqRqe]q(Ulabelsq]q(KUEMPTYqqMNqKNqKNqK NqKhqKNqKNqMNqMNqMNqKNqKNqKNqMNqKNqKNqKNqKNqKNqK NqKNqKNqMNqK Nqee]q(U number2symbolqh]q(]q(MUMatcherqe]q(MU Alternativeqe]q(MU Alternativesqe]q(MUDetailsqe]q(MU NegatedUnitqe]q(MURepeaterqe]q(MUUnitqeeqRqe]q(UstartqMe]q(Ustatesq]q(]q(]qKKqa]qKKqa]qKKqae]q(]q(KKqK Kqe]q(KKqK KqKKqee]q(]qK Kqa]q(K KqKKqee]q(]qK Kqa]qKKqa]qK Kqa]qKKqae]q(]qKKqa]q(KKqKKrKKre]rKKra]r(KKrKKre]rKKra]r KKr ae]r (]r (KKr KKrKKre]rKKra]rKKra]r(KKrKKre]rKKra]rKKrae]r(]r(KKrKKrKKrKKr e]r!KKr"a]r#KKr$a]r%(KKr&KKr'KKr(KKr)e]r*(KKr+KKr,e]r-KKr.a]r/KKr0a]r1(KKr2KKr3KK r4KKr5e]r6KKr7a]r8(KKr9KKr:KK r;eeee]r<(U symbol2labelr=h]r>(]r?(U Alternativer@K e]rA(U AlternativesrBKe]rC(UDetailsrDKe]rE(U NegatedUnitrFKe]rG(URepeaterrHKe]rI(UUnitrJK eerKRrLe]rM(U symbol2numberrNh]rO(]rP(hMe]rQ(hMe]rR(hMe]rS(hMe]rT(hMe]rU(hMe]rV(hMeerWRrXe]rY(UtokensrZh]r[(]r\(KKe]r](KKe]r^(KKe]r_(KKe]r`(KKe]ra(KKe]rb(K Ke]rc(K Ke]rd(K Ke]re(KKe]rf(KKe]rg(KK e]rh(KK e]ri(KK e]rj(KKe]rk(KKe]rl(KKeermRrneeroRrp.PK1]y patcomp.pynu[# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Pattern compiler. The grammar is taken from PatternGrammar.txt. The compiler compiles a pattern to a pytree.*Pattern instance. """ __author__ = "Guido van Rossum " # Python imports import io # Fairly local imports from .pgen2 import driver, literals, token, tokenize, parse, grammar # Really local imports from . import pytree from . import pygram class PatternSyntaxError(Exception): pass def tokenize_wrapper(input): """Tokenizes a string suppressing significant whitespace.""" skip = {token.NEWLINE, token.INDENT, token.DEDENT} tokens = tokenize.generate_tokens(io.StringIO(input).readline) for quintuple in tokens: type, value, start, end, line_text = quintuple if type not in skip: yield quintuple class PatternCompiler(object): def __init__(self, grammar_file=None): """Initializer. Takes an optional alternative filename for the pattern grammar. """ if grammar_file is None: self.grammar = pygram.pattern_grammar self.syms = pygram.pattern_symbols else: self.grammar = driver.load_grammar(grammar_file) self.syms = pygram.Symbols(self.grammar) self.pygrammar = pygram.python_grammar self.pysyms = pygram.python_symbols self.driver = driver.Driver(self.grammar, convert=pattern_convert) def compile_pattern(self, input, debug=False, with_tree=False): """Compiles a pattern string to a nested pytree.*Pattern object.""" tokens = tokenize_wrapper(input) try: root = self.driver.parse_tokens(tokens, debug=debug) except parse.ParseError as e: raise PatternSyntaxError(str(e)) from None if with_tree: return self.compile_node(root), root else: return self.compile_node(root) def compile_node(self, node): """Compiles a node, recursively. This is one big switch on the node type. """ # XXX Optimize certain Wildcard-containing-Wildcard patterns # that can be merged if node.type == self.syms.Matcher: node = node.children[0] # Avoid unneeded recursion if node.type == self.syms.Alternatives: # Skip the odd children since they are just '|' tokens alts = [self.compile_node(ch) for ch in node.children[::2]] if len(alts) == 1: return alts[0] p = pytree.WildcardPattern([[a] for a in alts], min=1, max=1) return p.optimize() if node.type == self.syms.Alternative: units = [self.compile_node(ch) for ch in node.children] if len(units) == 1: return units[0] p = pytree.WildcardPattern([units], min=1, max=1) return p.optimize() if node.type == self.syms.NegatedUnit: pattern = self.compile_basic(node.children[1:]) p = pytree.NegatedPattern(pattern) return p.optimize() assert node.type == self.syms.Unit name = None nodes = node.children if len(nodes) >= 3 and nodes[1].type == token.EQUAL: name = nodes[0].value nodes = nodes[2:] repeat = None if len(nodes) >= 2 and nodes[-1].type == self.syms.Repeater: repeat = nodes[-1] nodes = nodes[:-1] # Now we've reduced it to: STRING | NAME [Details] | (...) | [...] pattern = self.compile_basic(nodes, repeat) if repeat is not None: assert repeat.type == self.syms.Repeater children = repeat.children child = children[0] if child.type == token.STAR: min = 0 max = pytree.HUGE elif child.type == token.PLUS: min = 1 max = pytree.HUGE elif child.type == token.LBRACE: assert children[-1].type == token.RBRACE assert len(children) in (3, 5) min = max = self.get_int(children[1]) if len(children) == 5: max = self.get_int(children[3]) else: assert False if min != 1 or max != 1: pattern = pattern.optimize() pattern = pytree.WildcardPattern([[pattern]], min=min, max=max) if name is not None: pattern.name = name return pattern.optimize() def compile_basic(self, nodes, repeat=None): # Compile STRING | NAME [Details] | (...) | [...] assert len(nodes) >= 1 node = nodes[0] if node.type == token.STRING: value = str(literals.evalString(node.value)) return pytree.LeafPattern(_type_of_literal(value), value) elif node.type == token.NAME: value = node.value if value.isupper(): if value not in TOKEN_MAP: raise PatternSyntaxError("Invalid token: %r" % value) if nodes[1:]: raise PatternSyntaxError("Can't have details for token") return pytree.LeafPattern(TOKEN_MAP[value]) else: if value == "any": type = None elif not value.startswith("_"): type = getattr(self.pysyms, value, None) if type is None: raise PatternSyntaxError("Invalid symbol: %r" % value) if nodes[1:]: # Details present content = [self.compile_node(nodes[1].children[1])] else: content = None return pytree.NodePattern(type, content) elif node.value == "(": return self.compile_node(nodes[1]) elif node.value == "[": assert repeat is None subpattern = self.compile_node(nodes[1]) return pytree.WildcardPattern([[subpattern]], min=0, max=1) assert False, node def get_int(self, node): assert node.type == token.NUMBER return int(node.value) # Map named tokens to the type value for a LeafPattern TOKEN_MAP = {"NAME": token.NAME, "STRING": token.STRING, "NUMBER": token.NUMBER, "TOKEN": None} def _type_of_literal(value): if value[0].isalpha(): return token.NAME elif value in grammar.opmap: return grammar.opmap[value] else: return None def pattern_convert(grammar, raw_node_info): """Converts raw node information to a Node or Leaf instance.""" type, value, context, children = raw_node_info if children or type in grammar.number2symbol: return pytree.Node(type, children, context=context) else: return pytree.Leaf(type, value, context=context) def compile_pattern(pattern): return PatternCompiler().compile_pattern(pattern) PK1] __init__.pynu[import warnings warnings.warn( "lib2to3 package is deprecated and may not be able to parse Python 3.10+", DeprecationWarning, stacklevel=2, ) PK1]ι ! btm_utils.pycnu[ {fc@sdZddlmZddlmZmZddlmZmZeZ eZ ej Z eZ dZdZdZdefd YZd d Zd Zd Zd S(s0Utility functions used by the btm_matcher modulei(tpytree(tgrammarttoken(tpattern_symbolstpython_symbolsiiitMinNodecBsAeZdZdddZdZdZdZdZRS(sThis class serves as an intermediate representation of the pattern tree during the conversion to sets of leaf-to-root subpatternscCsC||_||_g|_t|_d|_g|_g|_dS(N( ttypetnametchildrentFalsetleaftNonetparentt alternativestgroup(tselfRR((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyt__init__s      cCst|jdt|jS(Nt (tstrRR(R((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyt__repr__scCsU|}g}xB|rP|jtkr|jj|t|jt|jkr|t|jg}g|_|j}qq|j}d}Pn|jt kr|j j|t|j t|jkrt |j }g|_ |j}qq|j}d}Pn|jt j kr4|jr4|j|jn|j|j|j}qW|S(sInternal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a singleN(RtTYPE_ALTERNATIVESR tappendtlenRttupleR R t TYPE_GROUPRtget_characteristic_subpatternt token_labelstNAMER(Rtnodetsubp((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyt leaf_to_root!s8        cCs1x*|jD]}|j}|r |Sq WdS(sDrives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton's capabilities, leaf_to_root merges each group into a single choice based on 'characteristic'ity, i.e. (a|b c) -> (a|b) if b more characteristic than c Returns: The most 'characteristic'(as defined by get_characteristic_subpattern) path for the compiled pattern tree. N(tleavesR(RtlR((s)/usr/lib64/python2.7/lib2to3/btm_utils.pytget_linear_subpatternKs ccsEx-|jD]"}x|jD] }|VqWq W|jsA|VndS(s-Generator that returns the leaves of the treeN(RR(Rtchildtx((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyR`s   N( t__name__t __module__t__doc__R RRRR!R(((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyRs   * c Csd}|jtjkr(|jd}n|jtjkrt|jdkrht|jd|}qtdt }x|jD]P}|jj |drqnt||}|dk r|jj |qqWn$|jtj krxt|jdkr_tdt }x9|jD].}t||}|r|jj |qqW|jsud}quqt|jd|}n|jtjkrt|jdtjr|jdjdkrt|jd|St|jdtjr|jdjdks=t|jdkrAt|jddrA|jdjdkrAdSt}d}d}t}d} t} x|jD]}|jtjkrt}|}n<|jtjkrt}|} n|jtjkr|}nt|dro|jdkrot} qoqoW| rA|jd} t| drN| jdkrN|jd } qNn |jd} | jtjkr| jd krtdt}qTtt| jrtdtt| j}qTtdtt| j}n| jtjkr0| jjd } | tkrtdt| }qTtdtjd | }n$| jtjkrTt||}n|r| jdjd kryd}q| jdjdkrqt n|r|dk rxI|jdd!D]4}t||}|dk r|jj |qqWqn|r||_!n|S(s Internal function. Reduces a compiled pattern tree to an intermediate representation suitable for feeding the automaton. This also trims off any optional pattern elements(like [a], a*). iiRit(t[tvaluet=itanyt'Rt*t+iN("R RtsymstMatcherRt AlternativesRt reduce_treeRRtindexRt AlternativeRtUnitt isinstanceRtLeafR)thasattrtTrueR tDetailstRepeaterRRtTYPE_ANYtgetattrtpysymstSTRINGtstripttokenstNotImplementedErrorR ( RR tnew_nodeR"treducedR t details_nodetalternatives_nodet has_repeatert repeater_nodethas_variable_namet name_leafR((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyR2hs             cs,t|ts|St|dkr-|dSg}g}dddddgg}dx|D]}tt|d ratt|fd r|j|qtt|fd r|j|q|j|qaqaW|r|}n|r |}n|r|}nt|d tS( sPicks the most characteristic from a list of linear patterns Current order used is: names > common_names > common_chars iitintfortiftnotR s[]().,:cSst|tkS(N(RR(R#((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyttcst|to|kS(N(R6R(R#(t common_chars(s)/usr/lib64/python2.7/lib2to3/btm_utils.pyRORPcst|to|kS(N(R6R(R#(t common_names(s)/usr/lib64/python2.7/lib2to3/btm_utils.pyRORPtkey(R6tlistRR+trec_testRtmax(t subpatternstsubpatterns_with_namestsubpatterns_with_common_namestsubpatterns_with_common_charst subpattern((RQRRs)/usr/lib64/python2.7/lib2to3/btm_utils.pyRs2      ccsWxP|D]H}t|ttfrDx*t||D] }|Vq2Wq||VqWdS(sPTests test_func on all items of sequence and items of included sub-iterablesN(R6RTRRU(tsequencet test_funcR#ty((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyRUs   N(R&RPRtpgen2RRtpygramRRR/R>topmapRARR<RRtobjectRR R2RRU(((s)/usr/lib64/python2.7/lib2to3/btm_utils.pyts X %PK1]?0=&=&main.pyonu[ {fc@sdZddlmZddlZddlZddlZddlZddlZddlZddl m Z dZ de j fdYZ d Zdd ZdS( s Main program for 2to3. i(twith_statementNi(trefactorc Cs:|j}|j}tj||||ddddS(s%Return a unified diff of two strings.s (original)s (refactored)tlinetermt(t splitlinestdifflibt unified_diff(tatbtfilename((s$/usr/lib64/python2.7/lib2to3/main.pyt diff_textss    tStdoutRefactoringToolcBs;eZdZddddZdZdZdZRS(s2 A refactoring tool that can avoid overwriting its input files. Prints output to stdout. Output files can optionally be written to a different directory and or have an extra file suffix appended to their name for use in situations where you do not want to replace the input files. Rc Csv||_||_|r;|jtj r;|tj7}n||_||_||_tt |j |||dS(sF Args: fixers: A list of fixers to import. options: A dict with RefactoringTool configuration. explicit: A list of fixers to run even if they are explicit. nobackups: If true no backup '.bak' files will be created for those files that are being refactored. show_diffs: Should diffs of the refactoring be printed to stdout? input_base_dir: The base directory for all input files. This class will strip this path prefix off of filenames before substituting it with output_dir. Only meaningful if output_dir is supplied. All files processed by refactor() must start with this path. output_dir: If supplied, all converted files will be written into this directory tree instead of input_base_dir. append_suffix: If supplied, all files output by this tool will have this appended to their filename. Useful for changing .py to .py3 for example by passing append_suffix='3'. N( t nobackupst show_diffstendswithtostsept_input_base_dirt _output_dirt_append_suffixtsuperR t__init__( tselftfixerstoptionstexplicitR R tinput_base_dirt output_dirt append_suffix((s$/usr/lib64/python2.7/lib2to3/main.pyR$s     cOs3|jj|||f|jj|||dS(N(terrorstappendtloggerterror(Rtmsgtargstkwargs((s$/usr/lib64/python2.7/lib2to3/main.pyt log_errorAsc Cs|}|jre|j|jrItjj|j|t|j}qetd||jfn|jr~||j7}n||krtjj |}tjj |stj |n|j d||n|j sy|d}tjj|r6ytj|Wq6tjk r2}|j d|q6Xnytj||Wqytjk ru}|j d||qyXntt|j} | |||||j stj||n||krtj||ndS(Ns5filename %s does not start with the input_base_dir %ssWriting converted %s to %s.s.baksCan't remove backup %ssCan't rename %s to %s(Rt startswithRRtpathtjointlent ValueErrorRtdirnametisdirtmakedirst log_messageR tlexiststremoveR trenameRR t write_filetshutiltcopymode( Rtnew_textR told_texttencodingt orig_filenameRtbackupterrtwrite((s$/usr/lib64/python2.7/lib2to3/main.pyR1Es@         cCs|r|jd|n|jd||jrt|||}y_|jdk r|j(x|D] }|GHqgWtjjWdQXnx|D] }|GHqWWqtk rt d|fdSXndS(NsNo changes to %ss Refactored %ss+couldn't encode %s's diff for your terminal( R-R R t output_locktNonetsyststdouttflushtUnicodeEncodeErrortwarn(RtoldtnewR tequalt diff_linestline((s$/usr/lib64/python2.7/lib2to3/main.pyt print_outputls"        (t__name__t __module__t__doc__RR$R1RG(((s$/usr/lib64/python2.7/lib2to3/main.pyR s   'cCstjd|fIJdS(Ns WARNING: %s(R=tstderr(R!((s$/usr/lib64/python2.7/lib2to3/main.pyRAsc stjdd}|jdddddd|jd d dd d gdd |jddddd ddddd|jdddd d gdd|jdddddd|jdddddd|jdddddd |jd!dddd"|jd#d$dddd%|jd&d'ddd tdd(|jd)d*dddd+d d,dd-|jd.d/dddd0|jd1dddd+d d,dd2t}i}|j|\}}|jrt|d3<|jstd4nt|_n|j r'|j r'|j d5n|j rJ|j rJ|j d6n|j rj|j rjtd7n|j r|j r|j d8n|jrd9GHxtjD] }|GHqW|sd:Sn|stjd;IJtjd<IJd=Sd>|krt}|jrtjd?IJd=Sn|jr0t|d@stalls.fix_s7Output in %r will mirror the input directory %r layout.RRRs+Sorry, -j isn't supported on this platform.(4toptparset OptionParsert add_optiontFalset parse_argsRUtTrueR:RARR R t add_suffixtno_diffst list_fixesRtget_all_fix_namesR=RKRWtverbosetloggingtDEBUGtINFOt basicConfigt getLoggertsettget_fixers_from_packagetnofixR[taddtuniont differenceRR&t commonprefixRRR+R*trstriptinfoR tsortedRtrefactor_stdint doctests_onlyt processestMultiprocessingUnsupportedt summarizeRStbool(R\R"tparserRxtflagsRtfixnameRYRt avail_fixestunwanted_fixesRt all_presentR[t requestedt fixer_namesRtrt((R\s$/usr/lib64/python2.7/lib2to3/main.pytmains                              (RJt __future__RR=RRRiR2R^RRR tMultiprocessRefactoringToolR RAR<R(((s$/usr/lib64/python2.7/lib2to3/main.pyts       h PKm;1]--"PatternGrammar3.6.8.final.0.picklenu[ccollections OrderedDict q)Rq(Xdfasqh)Rq(M]q(]qKKqa]qKKqa]q KKq aeh)Rq (KKKKKKKKKKuq M]q (]q(KKqK Kqe]q(KKqK KqKKqeeh)Rq(KKKKKKKKKKuqM]q(]qK Kqa]q(K KqKKqeeh)Rq(KKKKKKKKKKuqM]q(]q K Kq!a]q"KKq#a]q$K Kq%a]q&KKq'aeh)Rq(K Ksq)M]q*(]q+KKq,a]q-(KKq.KKq/KKq0e]q1KKq2a]q3(KKq4KKq5e]q6KKq7a]q8KKq9aeh)Rq:KKsq;M]q<(]q=(KKq>KKq?KKq@e]qAKKqBa]qCKKqDa]qE(KKqFKKqGe]qHKKqIa]qJKKqKaeh)RqL(KKKKKKuqMM]qN(]qO(KKqPKKqQKKqRKKqSe]qTKKqUa]qVKKqWa]qX(KKqYKKqZKKq[KKq\e]q](KKq^KKq_e]q`KKqaa]qbKKqca]qd(KKqeKKqfKK qgKKqhe]qiKKqja]qk(KKqlKKqmKK qneeh)Rqo(KKKKKKKKuqpuXkeywordsqqh)RqrXnotqsKsXlabelsqt]qu(KXEMPTYqvqwMNqxKNqyKNqzK Nq{Khsq|KNq}KNq~MNqMNqMNqKNqKNqKNqMNqKNqKNqKNqKNqKNqK NqKNqKNqMNqK NqeX number2symbolqh)Rq(MXMatcherqMX AlternativeqMX AlternativesqMXDetailsqMX NegatedUnitqMXRepeaterqMXUnitquXstartqMXstatesq]q(]q(]qKKqa]qKKqa]qKKqae]q(]q(KKqK Kqe]q(KKqK KqKKqee]q(]qK Kqa]q(K KqKKqee]q(]qK Kqa]qKKqa]qK Kqa]qKKqae]q(]qKKqa]q(KKqKKqKKqe]qKKqa]q(KKqKKqe]qKKqa]qKKqae]q(]q(KKqKKqKKqe]qKKqa]qKKqa]q(KKqKKqe]qKKqa]qKKqae]q(]q(KKqKKqKKqKKqe]qKKqa]qKKqa]q(KKqKKqKKqKKqe]q(KKqKKqe]qKKqa]qKKqa]q(KKqKKqKK qKKqe]qKKqa]q(KKqKKqKK qeeeX symbol2labelqh)Rq(X AlternativeqK X AlternativesqKXDetailsqKX NegatedUnitrKXRepeaterrKXUnitrK uX symbol2numberrh)Rr(hMhMhMhMhMhMhMuXtokensrh)Rr(KKKKKKKKKKKKK KK KK KKKKKKK KK KK KKKKKKuu.PKm;1]S/ }}Grammar3.6.8.final.0.picklenu[ccollections OrderedDict q)Rq(Xdfasqh)Rq(M]q(]q(KKqKKqKKqe]q KKq aeh)Rq (KKKKKKKKKKKKKKK KK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK KK!KK"KK#KK$KK%KK&KK'KK(KK)Kuq M]q (]qK*Kqa]q(K+KqKKqeeh)Rq(KKKKKKKKK KK KK#KK$KK&KK'KK(KK)KuqM]q(]qK,Kqa]q(K-KqKKqeeh)Rq(KKKKKKKKK KK KKKK#KK$KK&KK'KK(KK)KuqM]q(]qK.Kqa]q K/Kq!a]q"(K0Kq#KKq$e]q%K/Kq&a]q'KKq(aeh)Rq)K.Ksq*M]q+(]q,K1Kq-a]q.(K2Kq/KKq0e]q1(K1Kq2KKq3eeh)Rq4(KKKKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KK3Kuq5M]q6(]q7(K3Kq8K4Kq9K/Kq:e]q;K5Kqa]q?(K0Kq@K6KqAKKqBe]qCK/KqDaeh)RqE(KKKKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KK3KuqFM]qG(]qHK7KqIa]qJ(KKqKKKqLKKqMeeh)RqN(KKKKKKKKK KK KK#KK$KK&KK'KK(KK)KuqOM]qP(]qQK KqRa]qSK/KqTa]qU(K2KqVKKqWe]qXK/KqYa]qZKKq[aeh)Rq\K Ksq]M]q^(]q_K%Kq`a]qaK8Kqba]qcKKqdaeh)RqeK%KsqfM ]qg(]qhK%Kqia]qj(K9KqkK8KqlK:Kqme]qnKKqoaeh)RqpK%KsqqM ]qr(]qs(KKqtKKquK KqvK KqwK#KqxK'KqyK(KqzK)Kq{e]q|(K;Kq}KKqK?K qe]qK@K qa]q(KAKqKBK qe]qKKqa]q(K)KqKKqe]qK;Kqa]qKKqa]qK>Kqa]qK Kqa]qKAKqaeh)Rq(KKKKK KK KK#KK'KK(KK)KuqM ]q(]q(KCKqKDKqKEKqKFKqKGKqKHKqKIKqKJKqKKKqKLKqKMKqKNKqKOKqe]qKKqaeh)Rq(KCKKDKKEKKFKKGKKHKKIKKJKKKKKLKKMKKNKKOKuqM ]q(]qK Kqa]qKKqaeh)RqK KsqM ]q(]qKKqa]qK'Kqa]q(KKqK.Kqe]q(K;KqKPKqe]qKQKqa]qK.Kqa]qK;Kqa]qKKqaeh)RqKKsqM]q(]q(KKqK%Kqe]qKRKqa]qKKqa]qKSKqa]qKTKqa]q(KUKqKKqe]qKKqaeh)Rq(KKK%KuqM]q(]qKKqa]qKVKqa]q(KUKqKKqe]qKKqaeh)RqKKsqM]q(]q(K6KqKWKqe]qKKqaeh)Rq(KKKKK%KuqM]q(]q(KXKqKYKqKZKqKXKqK[KqK\KqK]KqKSKqK^KqKKqe]qKKqa]q(KKrKKre]rKSKraeh)Rr(KKKSKKXKKYKKZKK[KK\KK]KK^KurM]r(]rK5Kra]r (K_Kr KKr eeh)Rr (KKKKKKKKK KK KK#KK$KK&KK'KK(KK)Kur M]r(]r(K`KrKaKrKbKrK9KrK8KrKcKrKdKrKeKrK:Kre]rKKraeh)Rr(K KKKKKKKKKKKK KK!KK%KurM]r(]rKKra]r KKr!aeh)Rr"KKsr#M]r$(]r%KfKr&a]r'(KgKr(KaKr)K8Kr*e]r+KKr,aeh)Rr-K Ksr.M]r/(]r0K Kr1a]r2KhKr3a]r4(KKr5KKr6e]r7(K;Kr8KPKr9e]r:KKr;a]r<KKr=a]r>K;Kr?aeh)Rr@K KsrAM]rB(]rCKiKrDa]rE(KiKrFKKrGeeh)RrHK KsrIM]rJ(]rKKKrLa]rMKRKrNa]rOKKrPaeh)RrQKKsrRM]rS(]rT(K3KrUK4KrVK/KrWe]rXK5KrYa]rZ(K2Kr[K6Kr\KKr]e]r^(K2Kr_K.Kr`K6KraKKrbe]rc(K2KrdK6KreKKrfe]rg(K4K rhK/K riKKrje]rkKKrla]rmK/Krna]ro(K3K rpK/K rqKKrre]rs(K2KrtKK rue]rvK5K rwa]rxK.K rya]rz(K2Kr{KK r|e]r}K/K r~aeh)Rr(KKKKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KK3KurM]r(]rKhKra]r(KjKrKKre]rK'Kra]rKKraeh)RrK'KsrM]r(]rKkKra]r(K2KrKKreeh)RrK'KsrM]r(]rK'Kra]r(KKrKKreeh)RrK'KsrM]r(]rK'Kra]rKKraeh)RrK'KsrM]r(]rKlKra]r(KKrKKre]rKKraeh)Rr(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KurM]r(]rKmKra]r(K/KrKKre]r(K2KrKjKrKKre]rK/Kra]rKKraeh)RrKmKsrM ]r(]rKKra]rK5Kra]r(KSKrKKre]rK/Kra]r(K2KrKKre]rK/Kra]rKKraeh)RrKKsrM!]r(]rKnKra]r(KoKrKKreeh)Rr(KKKKKKKKK KK KK#KK$KK&KK'KK(KK)KurM"]r(]rKpKra]r(K0KrKqKrKrKrKKre]r(KpKrK=Kre]rKKra]r(KlKrK=Kre]r(K0KrKKreeh)Rr(KKKKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KurM#]r(]r(K5KrK4Kre]r(K2KrKKre]r(K5KrK4KrKKreeh)Rr(KKKKKKKKKKK KK KK#KK$KK&KK'KK(KK)KurM$]r(]r(KKrKKrK$KrKsKre]rKtKra]rKKraeh)Rr(KKKKKKKKK KK KK#KK$KK&KK'KK(KK)KurM%]r(]r(KuKr KvKr KwKr KxKr KyKr e]rKKraeh)Rr(K KKKKKKKK"KurM&]r(]rKKra]rKRKra]rKSKra]rKlKra]rK.Kra]rKQKra]r(KzKr KKr!e]r"K.Kr#a]r$KQK r%a]r&KK r'aeh)Rr(KKsr)M']r*(]r+KKr,a]r-K'Kr.a]r/K{Kr0a]r1(K|Kr2K.Kr3e]r4K/Kr5a]r6KQKr7a]r8K.Kr9a]r:KKr;aeh)Rr<KKsr=M(]r>(]r?(KKr@KKrAe]rBK'KrCa]rD(K2KrEKKrFeeh)RrG(KKKKurHM)]rI(]rJKKrKa]rLK/KrMa]rNK.KrOa]rPKQKrQa]rR(K}KrSKzKrTKKrUe]rVK.KrWa]rXKQKrYa]rZKKr[aeh)Rr\KKsr]M*]r^(]r_K'Kr`a]ra(KjKrbKKrce]rdK'Krea]rfKKrgaeh)RrhK'KsriM+]rj(]rkK~Krla]rm(K2KrnKKroe]rp(K~KrqKKrreeh)RrsK'KsrtM,]ru(]rvKKrwa]rx(KKryKhKrze]r{(KKr|KKr}KhKr~e]rKKra]r(KKrKKrKKre]rKKra]rKKra]rK;Kraeh)RrKKsrM-]r(]rKKra]rKKra]rKKraeh)RrKKsrM.]r(]r(KKrKKre]rKKraeh)Rr(KKKKurM/]r(]rKKra]r(K.KrKKre]rK/Kra]rK.Kra]rKKraeh)RrKKsrM0]r(]r(K4KrK/Kre]r(K2KrK6KrKKre]r(K4KrK/KrKKre]rKKra]r(K2KrKKreeh)Rr(KKKKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KurM1]r(]r(KKrKKre]rK,Kra]rKKraeh)Rr(KKKKKKKKK KK KKKK#KK$KK&KK'KK(KK)KurM2]r(]rKKra]r(K.KrKKre]rKVKra]rK.Kra]rKKraeh)RrKKsrM3]r(]r(KKrKKre]rKKraeh)Rr(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KurM4]r(]rKKra]r(KKrKKreeh)Rr(KKKKKKKKK KK KKKK#KK$KK&KK'KK(KK)KurM5]r(]rKKra]r(K;KrKKre]rKKra]rK;Kraeh)RrKKsrM6]r(]rKKra]rKKraeh)RrKKsrM7]r(]r(K&KrKKre]rKKra]r(K3KrKKrKKre]rKtKra]rKKraeh)Rr(KKKKK KK KK#KK&KK'KK(KK)Kur M8]r (]r KKr a]r (KKrK/KrKKre]rK/Kra]r(K2KrKKre]r(K2KrKKre]r(K/KrKKre]rK/Kra]r(K2KrKKr e]r!(K/Kr"KKr#eeh)Rr$KKsr%M9]r&(]r'KKr(a]r)(K/Kr*KKr+e]r,(K2Kr-KKr.KKr/e]r0K/Kr1a]r2K/Kr3a]r4(K2Kr5KKr6e]r7KKr8aeh)Rr9KKsr:M:]r;(]r<KKr=a]r>(KlKr?KKr@e]rAKKrBaeh)RrCKKsrDM;]rE(]rFKKrGa]rH(KKrIKKrJKKrKeeh)RrL(KKKKKKKKK KK KK#KK$KK&KK'KK(KK)KurMM<]rN(]rOKKrPa]rQ(KKrRKKrSe]rT(KKrUKKrVe]rWKKrXaeh)RrY(KKKKKKKKKKK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKK"KK#KK$KK&KK'KK(KK)KurZM=]r[(]r\(KKr]KKr^KKr_e]r`KKraa]rbKKrcaeh)Rrd(KKKKKKKKKKKKK KK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK KK!KK"KK#KK$KK%KK&KK'KK(KK)KureM>]rf(]rgK.Krha]ri(K/KrjKKrke]rlKKrmaeh)RrnK.KsroM?]rp(]rq(KKrrKKrsKKrtKKruKKrvKKrwKKrxKKryKKrze]r{KKr|aeh)Rr}(KKKKKKKKKKK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKK"KK#KK$KK&KK'KK(KK)Kur~M@]r(]rKKra]rK5Kra]rKKraeh)RrKKsrMA]r(]r(KKrKKre]rKKraeh)Rr(KKKKKKKKKKK KK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK KK!KK"KK#KK$KK%KK&KK'KK(KK)KurMB]r(]r(K.KrK/Kre]r(KKrK/KrKKre]r(K.KrKKre]rKKra]r(KKrKKreeh)Rr(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KK.KurMC]r(]rKKra]r(K2KrKKre]r(KKrKKreeh)Rr(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KK.KurMD]r(]r(KKrKKre]rKKra]rKKra]rKKra]r(KKrKKreeh)Rr(KKKKKKKKKKKKK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKK"KK#KK$KK&KK'KK(KK)KurME]r(]rKtKra]r(KKrKKrKKrKKrK KrKKreeh)Rr(KKKKKKKKK KK KK#KK$KK&KK'KK(KK)KurMF]r(]r(KKrKKre]rKKra]r(KKrKKre]rKKra]rKzKra]rK/Kraeh)Rr(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KurMG]r(]rK/Kra]r(K2KrKKre]r(K/KrKKreeh)Rr(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KurMH]r(]rK/Kra]r(K2KrKKreeh)Rr(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KurMI]r(]r(K4KrK/Kre]r(K2KrK6KrKKre]r(K4KrK/KrKKre]rKKra]r(K2KrKKreeh)Rr(KKKKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KurMJ]r(]rKVKra]r(K2KrKKre]rKVKra]r(K2KrKKr e]r (KVKr KKr eeh)Rr (KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KurMK]r(]r(K4KrK/Kre]r(K2KrKKre]r(K4KrK/KrKKreeh)Rr(KKKKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KurML]r(]r(KKrKKre]r KKr!a]r"KKr#a]r$K;Kr%aeh)Rr&(KKK'Kur'MM]r((]r)KKr*a]r+(K2Kr,KKr-e]r.(KKr/KKr0eeh)Rr1(KKK'Kur2MN]r3(]r4K'Kr5a]r6(K.Kr7KKr8e]r9K/Kr:a]r;KKr<aeh)Rr=K'Ksr>MO]r?(]r@(KKrAKKrBK KrCe]rD(K;KrEKPKrFe]rGK'KrHa]rIKKrJa]rKKKrLa]rMK;KrNa]rOK>KrPaeh)RrQ(KKKKK KurRMP]rS(]rTKKrUa]rVK.KrWa]rXKQKrYa]rZ(KKr[KKr\e]r]K.Kr^a]r_K.Kr`a]raKQKrba]rcKQK rda]reKKrfa]rg(KzK rhKKriKKrjKK rke]rlK.K rma]rnKQK roa]rp(KKrqKK rreeh)RrsKKsrtMQ]ru(]rv(KKrwK3KrxKKrye]rz(K2Kr{KKr|KKr}e]r~KKra]r(K2KrK0KrKKre]r(K3KrKK rKKre]r(K2KrKKre]r(K2K rKKre]r(KKrK3KrKKrKKre]rK/K ra]r(K2KrK0K rKK re]rKK ra]r(K2KrKK re]rK/Kraeh)Rr(KKKKK'KK3KurMR]r(]r(KKrK3KrKKre]r(K2KrKKrKKre]rKKra]r(K2KrK0KrKKre]r(K3KrKK rKKre]r(K2KrKKre]r(K2K rKKre]r(KKrK3KrKKrKKre]rK/K ra]r(K2KrK0K rKK re]rKK ra]r(K2KrKK re]rK/Kraeh)Rr(KKKKK'KK3KurMS]r(]r(KKrKKre]rKKra]rKKra]rK;Kraeh)Rr(KKK'KurMT]r(]rKKra]r(K2KrKKre]r(KKrKKreeh)Rr(KKK'KurMU]r(]rK'Kra]rKKraeh)RrK'KsrMV]r(]rK Kra]rK/Kra]rK.Kra]rKQKra]r(KzKrKKre]rK.Kra]rKQKra]rKKraeh)RrK KsrMW]r(]rK/Kra]r(KjKrKKre]rK5Kra]r KKr aeh)Rr (KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)Kur MX]r (]rK!Kra]rKKra]r(K2KrK.Kre]rKQKra]rKKraeh)RrK!KsrMY]r(]rKjKra]rK5Kra]r KKr!aeh)Rr"KjKsr#MZ]r$(]r%KKr&a]r'(KKr(KKr)eeh)Rr*(KKKKKKKKK KK KK#KK$KK&KK'KK(KK)Kur+M[]r,(]r-(KKr.KlKr/e]r0K/Kr1a]r2KKr3aeh)Rr4(KKKKKKKKK KK KKKKKKKK#KK$KK&KK'KK(KK)Kur5M\]r6(]r7K"Kr8a]r9(KKr:KKr;e]r<KKr=aeh)Rr>K"Ksr?M]]r@(]rAK=KrBa]rCKKrDaeh)RrEK"KsrFuXkeywordsrGh)RrH(XandrIK-XasrJKjXassertrKK XbreakrLK XclassrMKXcontinuerNKXdefrOKXdelrPKXelifrQK}XelserRKzXexceptrSKmXexecrTKXfinallyrUKXforrVKXfromrWKXglobalrXKXifrYKXimportrZKXinr[KSXisr\K^Xlambdar]KXnonlocalr^KXnotr_KXorr`KXpassraKXprintrbKXraisercKXreturnrdKXtryreKXwhilerfK XwithrgK!XyieldrhK"uXlabelsri]rj(KXEMPTYrkrlKNrmKNrnMANroKNrpKNrqKNrrKNrsKNrtK2NruK NrvKNrwKjKrxKjLryKjMrzKjNr{KjOr|KjPr}KjTr~KjVrKjWrKjXrKjYrKjZrKj]rKj^rKj_rKjarKjbrKjcrKjdrKjerKjfrKjgrKjhrKNrK NrK9NrK8NrKNrKNrKNrM;NrKNrM1NrKjIrK NrMFNrKNrMNrK NrK$NrM@NrM!NrMNrMENrM'NrM&NrMXNrKNrMINrM\NrK NrM0NrMHNrKNrMNrK)NrK*NrK/NrK'NrK%NrK&NrK1NrK(NrK-NrK.NrK3NrK,NrK+NrMNrMDNrM#NrKj[rMJNrMNrM3NrMNrKNrKNrKNrKNrKNrKNrKj\rMNrM NrM NrMNrM)NrMPNrMVNrMNrMNrMNrMNrKjJrMNrMGNrKjSrMZNrKNrMKNrMNrM NrM7NrM$NrM NrMNrM9NrM:NrM]NrKjRrM5NrK7NrKjQrM*NrM+NrMNrM,NrM-NrMRNrMNrM2NrM4NrMNrKj`rMQNrM NrMONrK#NrMNrK"NrM?NrK NrMNrM<NrMNrMNrM NrM"NrM%NrM(NrM.NrM6NrM8NrM>NrMBNr KNr KNr KNr KNr K0NrM/NrMNNrMMNrMLNrMCNrKjUrMNrMSNrMUNrMTNrMWNrMNrK!NrM[NreX number2symbolrh)Rr(MX file_inputrMXand_exprr MXand_testr!MX annassignr"MXarglistr#MXargumentr$MX arith_exprr%MX assert_stmtr&MX async_funcdefr'M X async_stmtr(M Xatomr)M X augassignr*M X break_stmtr+M Xclassdefr,MXcomp_forr-MXcomp_ifr.MX comp_iterr/MXcomp_opr0MX comparisonr1MX compound_stmtr2MX continue_stmtr3MX decoratedr4MX decoratorr5MX decoratorsr6MXdel_stmtr7MX dictsetmakerr8MXdotted_as_namer9MXdotted_as_namesr:MX dotted_namer;MX encoding_declr<MX eval_inputr=MX except_clauser>M X exec_stmtr?M!Xexprr@M"X expr_stmtrAM#XexprlistrBM$XfactorrCM%X flow_stmtrDM&Xfor_stmtrEM'XfuncdefrFM(X global_stmtrGM)Xif_stmtrHM*Ximport_as_namerIM+Ximport_as_namesrJM,X import_fromrKM-X import_namerLM.X import_stmtrMM/XlambdefrNM0X listmakerrOM1Xnot_testrPM2X old_lambdefrQM3Xold_testrRM4Xor_testrSM5X parametersrTM6X pass_stmtrUM7XpowerrVM8X print_stmtrWM9X raise_stmtrXM:X return_stmtrYM;X shift_exprrZM<X simple_stmtr[M=X single_inputr\M>Xsliceopr]M?X small_stmtr^M@X star_exprr_MAXstmtr`MBX subscriptraMCX subscriptlistrbMDXsuitercMEXtermrdMFXtestreMGXtestlistrfMHX testlist1rgMIX testlist_gexprhMJX testlist_saferiMKXtestlist_star_exprrjMLXtfpdefrkMMXtfplistrlMNXtnamermMOXtrailerrnMPXtry_stmtroMQX typedargslistrpMRX varargslistrqMSXvfpdefrrMTXvfplistrsMUXvnamertMVX while_stmtruMWX with_itemrvMXX with_stmtrwMYXwith_varrxMZXxor_exprryM[X yield_argrzM\X yield_exprr{M]X yield_stmtr|uXstartr}MXstatesr~]r(]r(]r(KKrKKrKKre]rKKrae]r(]rK*Kra]r(K+KrKKree]r(]rK,Kra]r(K-KrKKree]r(]rK.Kra]rK/Kra]r(K0KrKKre]rK/Kra]rKKrae]r(]rK1Kra]r(K2KrKKre]r(K1KrKKree]r(]r(K3KrK4KrK/Kre]rK5Kra]rKKra]r(K0KrK6KrKKre]rK/Krae]r(]rK7Kra]r(KKrKKrKKree]r(]rK Kra]rK/Kra]r(K2KrKKre]rK/Kra]rKKrae]r(]rK%Kra]rK8Kra]rKKrae]r(]rK%Kra]r(K9KrK8KrK:Kre]rKKrae]r(]r(KKrKKrK KrK KrK#KrK'KrK(KrK)Kre]r(K;KrKKrK?K re]rK@K ra]r(KAKrKBK re]rKKra]r(K)KrKKre]rK;Kra]rKKra]rK>Kra]rK Kra]rKAKrae]r(]r(KCKrKDKrKEKrKFKrKGKrKHKrKIKr KJKr KKKr KLKr KMKr KNKrKOKre]rKKrae]r(]rK Kra]rKKrae]r(]rKKra]rK'Kra]r(KKrK.Kre]r(K;Kr KPKr!e]r"KQKr#a]r$K.Kr%a]r&K;Kr'a]r(KKr)ae]r*(]r+(KKr,K%Kr-e]r.KRKr/a]r0KKr1a]r2KSKr3a]r4KTKr5a]r6(KUKr7KKr8e]r9KKr:ae]r;(]r<KKr=a]r>KVKr?a]r@(KUKrAKKrBe]rCKKrDae]rE(]rF(K6KrGKWKrHe]rIKKrJae]rK(]rL(KXKrMKYKrNKZKrOKXKrPK[KrQK\KrRK]KrSKSKrTK^KrUKKrVe]rWKKrXa]rY(KKrZKKr[e]r\KSKr]ae]r^(]r_K5Kr`a]ra(K_KrbKKrcee]rd(]re(K`KrfKaKrgKbKrhK9KriK8KrjKcKrkKdKrlKeKrmK:Krne]roKKrpae]rq(]rrKKrsa]rtKKruae]rv(]rwKfKrxa]ry(KgKrzKaKr{K8Kr|e]r}KKr~ae]r(]rK Kra]rKhKra]r(KKrKKre]r(K;KrKPKre]rKKra]rKKra]rK;Krae]r(]rKiKra]r(KiKrKKree]r(]rKKra]rKRKra]rKKrae]r(]r(K3KrK4KrK/Kre]rK5Kra]r(K2KrK6KrKKre]r(K2KrK.KrK6KrKKre]r(K2KrK6KrKKre]r(K4K rK/K rKKre]rKKra]rK/Kra]r(K3K rK/K rKKre]r(K2KrKK re]rK5K ra]rK.K ra]r(K2KrKK re]rK/K rae]r(]rKhKra]r(KjKrKKre]rK'Kra]rKKrae]r(]rKkKra]r(K2KrKKree]r(]rK'Kra]r(KKrKKree]r(]rK'Kra]rKKrae]r(]rKlKra]r(KKrKKre]rKKrae]r(]rKmKra]r(K/KrKKre]r(K2KrKjKrKKre]rK/Kra]rKKrae]r(]rKKra]rK5Kra]r(KSKrKKre]rK/Kra]r(K2KrKKre]rK/Kra]r KKr ae]r (]r KnKr a]r(KoKrKKree]r(]rKpKra]r(K0KrKqKrKrKrKKre]r(KpKrK=Kre]rKKra]r(KlKrK=Kr e]r!(K0Kr"KKr#ee]r$(]r%(K5Kr&K4Kr'e]r((K2Kr)KKr*e]r+(K5Kr,K4Kr-KKr.ee]r/(]r0(KKr1KKr2K$Kr3KsKr4e]r5KtKr6a]r7KKr8ae]r9(]r:(KuKr;KvKr<KwKr=KxKr>KyKr?e]r@KKrAae]rB(]rCKKrDa]rEKRKrFa]rGKSKrHa]rIKlKrJa]rKK.KrLa]rMKQKrNa]rO(KzKrPKKrQe]rRK.KrSa]rTKQK rUa]rVKK rWae]rX(]rYKKrZa]r[K'Kr\a]r]K{Kr^a]r_(K|Kr`K.Krae]rbK/Krca]rdKQKrea]rfK.Krga]rhKKriae]rj(]rk(KKrlKKrme]rnK'Kroa]rp(K2KrqKKrree]rs(]rtKKrua]rvK/Krwa]rxK.Krya]rzKQKr{a]r|(K}Kr}KzKr~KKre]rK.Kra]rKQKra]rKKrae]r(]rK'Kra]r(KjKrKKre]rK'Kra]rKKrae]r(]rK~Kra]r(K2KrKKre]r(K~KrKKree]r(]rKKra]r(KKrKhKre]r(KKrKKrKhKre]rKKra]r(KKrKKrKKre]rKKra]rKKra]rK;Krae]r(]rKKra]rKKra]rKKrae]r(]r(KKrKKre]rKKrae]r(]rKKra]r(K.KrKKre]rK/Kra]rK.Kra]rKKrae]r(]r(K4KrK/Kre]r(K2KrK6KrKKre]r(K4KrK/KrKKre]rKKra]r(K2KrKKree]r(]r(KKrKKre]rK,Kra]rKKrae]r(]rKKra]r(K.KrKKre]rKVKra]rK.Kra]rKKrae]r(]r(KKrKKre]rKKrae]r(]rKKra]r(KKrKKree]r(]rKKra]r(K;KrKKre]rKKr a]r K;Kr ae]r (]r KKr a]r KKr ae]r (]r (K&Kr KKr e]r KKr a]r (K3Kr KKr KKr e]r KtKr a]r KKr ae]r (]r KKr a]r (KKr K/Kr KKr e]r K/Kr a]r (K2Kr KKr! e]r" (K2Kr# KKr$ e]r% (K/Kr& KKr' e]r( K/Kr) a]r* (K2Kr+ KKr, e]r- (K/Kr. KKr/ ee]r0 (]r1 KKr2 a]r3 (K/Kr4 KKr5 e]r6 (K2Kr7 KKr8 KKr9 e]r: K/Kr; a]r< K/Kr= a]r> (K2Kr? KKr@ e]rA KKrB ae]rC (]rD KKrE a]rF (KlKrG KKrH e]rI KKrJ ae]rK (]rL KKrM a]rN (KKrO KKrP KKrQ ee]rR (]rS KKrT a]rU (KKrV KKrW e]rX (KKrY KKrZ e]r[ KKr\ ae]r] (]r^ (KKr_ KKr` KKra e]rb KKrc a]rd KKre ae]rf (]rg K.Krh a]ri (K/Krj KKrk e]rl KKrm ae]rn (]ro (KKrp KKrq KKrr KKrs KKrt KKru KKrv KKrw KKrx e]ry KKrz ae]r{ (]r| KKr} a]r~ K5Kr a]r KKr ae]r (]r (KKr KKr e]r KKr ae]r (]r (K.Kr K/Kr e]r (KKr K/Kr KKr e]r (K.Kr KKr e]r KKr a]r (KKr KKr ee]r (]r KKr a]r (K2Kr KKr e]r (KKr KKr ee]r (]r (KKr KKr e]r KKr a]r KKr a]r KKr a]r (KKr KKr ee]r (]r KtKr a]r (KKr KKr KKr KKr K Kr KKr ee]r (]r (KKr KKr e]r KKr a]r (KKr KKr e]r KKr a]r KzKr a]r K/Kr ae]r (]r K/Kr a]r (K2Kr KKr e]r (K/Kr KKr ee]r (]r K/Kr a]r (K2Kr KKr ee]r (]r (K4Kr K/Kr e]r (K2Kr K6Kr KKr e]r (K4Kr K/Kr KKr e]r KKr a]r (K2Kr KKr ee]r (]r KVKr a]r (K2Kr KKr e]r KVKr a]r (K2Kr KKr e]r (KVKr KKr ee]r (]r (K4Kr K/Kr e]r (K2Kr KKr e]r (K4Kr K/Kr KKr ee]r (]r (KKr KKr e]r KKr a]r KKr a]r K;Kr ae]r (]r KKr a]r (K2Kr KKr e]r (KKr KKr ee]r (]r K'Kr a]r (K.Kr KKr e]r K/Kr a]r KKr ae]r (]r (KKr KKr K Kr! e]r" (K;Kr# KPKr$ e]r% K'Kr& a]r' KKr( a]r) KKr* a]r+ K;Kr, a]r- K>Kr. ae]r/ (]r0 KKr1 a]r2 K.Kr3 a]r4 KQKr5 a]r6 (KKr7 KKr8 e]r9 K.Kr: a]r; K.Kr< a]r= KQKr> a]r? KQK r@ a]rA KKrB a]rC (KzK rD KKrE KKrF KK rG e]rH K.K rI a]rJ KQK rK a]rL (KKrM KK rN ee]rO (]rP (KKrQ K3KrR KKrS e]rT (K2KrU KKrV KKrW e]rX KKrY a]rZ (K2Kr[ K0Kr\ KKr] e]r^ (K3Kr_ KK r` KKra e]rb (K2Krc KKrd e]re (K2K rf KKrg e]rh (KKri K3Krj KKrk KKrl e]rm K/K rn a]ro (K2Krp K0K rq KK rr e]rs KK rt a]ru (K2Krv KK rw e]rx K/Kry ae]rz (]r{ (KKr| K3Kr} KKr~ e]r (K2Kr KKr KKr e]r KKr a]r (K2Kr K0Kr KKr e]r (K3Kr KK r KKr e]r (K2Kr KKr e]r (K2K r KKr e]r (KKr K3Kr KKr KKr e]r K/K r a]r (K2Kr K0K r KK r e]r KK r a]r (K2Kr KK r e]r K/Kr ae]r (]r (KKr KKr e]r KKr a]r KKr a]r K;Kr ae]r (]r KKr a]r (K2Kr KKr e]r (KKr KKr ee]r (]r K'Kr a]r KKr ae]r (]r K Kr a]r K/Kr a]r K.Kr a]r KQKr a]r (KzKr KKr e]r K.Kr a]r KQKr a]r KKr ae]r (]r K/Kr a]r (KjKr KKr e]r K5Kr a]r KKr ae]r (]r K!Kr a]r KKr a]r (K2Kr K.Kr e]r KQKr a]r KKr ae]r (]r KjKr a]r K5Kr a]r KKr ae]r (]r KKr a]r (KKr KKr ee]r (]r (KKr KlKr e]r K/Kr a]r KKr ae]r (]r K"Kr a]r (KKr KKr e]r KKr ae]r (]r K=Kr a]r KKr aeeX symbol2labelr h)Rr (Xand_exprr KXand_testr KX annassignr KqXarglistr KPXargumentr K1X arith_exprr KX assert_stmtr KX async_funcdefr KgX async_stmtr K`Xatomr KX augassignr KrX break_stmtr KuXclassdefr KaXcomp_forr K6Xcomp_ifr KWX comp_iterr KUXcomp_opr K_X comparisonr KX compound_stmtr KX continue_stmtr KvX decoratedr KbX decoratorr KiX decoratorsr KfXdel_stmtr KX dictsetmakerr! KBXdotted_as_namer" KkXdotted_as_namesr# KX dotted_namer$ KhX except_clauser% KX exec_stmtr& KXexprr' K5X expr_stmtr( KXexprlistr) KRXfactorr* KtX flow_stmtr+ KXfor_stmtr, K9Xfuncdefr- K8X global_stmtr. KXif_stmtr/ KcXimport_as_namer0 K~Ximport_as_namesr1 KX import_fromr2 KX import_namer3 KX import_stmtr4 KXlambdefr5 KX listmakerr6 K?Xnot_testr7 K,X old_lambdefr8 KXold_testr9 KVXor_testr: KX parametersr; K{X pass_stmtr< KXpowerr= KsX print_stmtr> KX raise_stmtr? KwX return_stmtr@ KxX shift_exprrA K*X simple_stmtrB KXsliceoprC KX small_stmtrD KX star_exprrE K4XstmtrF KX subscriptrG KX subscriptlistrH KXsuiterI KQXtermrJ K7XtestrK K/XtestlistrL KlX testlist1rM K@X testlist_gexprN KMj?M j@M!jAM"jBM#jCM$jMjDM%jEM&jFM'jGM(jHM)jIM*jJM+jKM,jLM-jMM.jNM/jOM0jPM1jQM2jRM3jSM4jTM5jUM6jVM7jWM8jXM9jYM:jZM;j[M<j\M=j]M>j^M?j_M@j`MAjaMBjbMCjcMDjdMEjeMFjfMGjgMHjhMIjiMJjjMKjkMLjlMMjmMNjnMOjoMPjpMQjqMRjrMSjsMTjtMUjuMVjvMWjwMXjxMYjyMZjzM[j{M\j|M]uXtokensrd h)Rre (KKKK'KK(KK)KKKKKKKKKK;K K K K>K K.K K2K KKKKKKKKKKKoKK+KKYKK\KK0KKKKKK KK#KKAKK[KKXKKZKK]K K$K!KK"KK#KK$K3K%KGK&KHK'KFK(KJK)KCK*KDK+KOK,KNK-KKK.KLK/KEK0KK1KIK2K K3KMK7K|K8K&K9K%uu.PKm;1]WWW%__pycache__/main.cpython-36.opt-2.pycnu[3 \-@s|ddlmZmZddlZddlZddlZddlZddlZddlZddl m Z ddZ Gddde j Z d d Zd d d ZdS))with_statementprint_functionN)refactorc Cs(|j}|j}tj||||ddddS)Nz (original)z (refactored))Zlineterm) splitlinesdifflibZ unified_diff)abfilenamer $/usr/lib64/python3.6/lib2to3/main.py diff_textss  rcs:eZdZd fdd ZddZfddZdd ZZS) StdoutRefactoringToolrc sR||_||_|r(|jtj r(|tj7}||_||_||_tt |j |||dS)N) nobackups show_diffsendswithossep_input_base_dir _output_dir_append_suffixsuperr__init__) selfZfixersoptionsexplicitrrinput_base_dir output_dir append_suffix) __class__r r r$s zStdoutRefactoringTool.__init__cOs*|jj|||f|jj|f||dS)N)errorsappendloggererror)rmsgargskwargsr r r log_errorAszStdoutRefactoringTool.log_errorc !s||}|jrH|j|jr6tjj|j|t|jd}ntd||jf|jrX||j7}||krtjj |}tjj | r|rtj ||j d|||j s4|d}tjj|rytj|Wn.tk r}z|j d|WYdd}~XnXytj||Wn2tk r2}z|j d||WYdd}~XnXtt|j} | |||||j sbtj||||krxtj||dS)Nz5filename %s does not start with the input_base_dir %szWriting converted %s to %s.z.bakzCan't remove backup %szCan't rename %s to %s)r startswithrrpathjoinlen ValueErrorrdirnameisdirmakedirs log_messagerlexistsremoveOSErrorrenamerr write_fileshutilZcopymode) rZnew_textr Zold_textencodingZ orig_filenamerZbackuperrwrite)r r r r6Es@          z StdoutRefactoringTool.write_filecCs|r|jd|n|jd||jrt|||}yX|jdk rp|j&x|D] }t|qJWtjjWdQRXnx|D] }t|qvWWn"tk rt d|fdSXdS)NzNo changes to %sz Refactored %sz+couldn't encode %s's diff for your terminal) r1rrZ output_lockprintsysstdoutflushUnicodeEncodeErrorwarn)roldnewr ZequalZ diff_linesliner r r print_outputls"       z"StdoutRefactoringTool.print_output)rrr)__name__ __module__ __qualname__rr(r6rD __classcell__r r )r r rs  'rcCstd|ftjddS)Nz WARNING: %s)file)r;r<stderr)r%r r r r@sr@c stjdd}|jddddd|jdd d gd d |jd dddddd|jddd gdd |jddddd|jddddd|jddddd|jd dd!d|jd"d#dd$d|jd%d&dd'd(d |jd)d*dd+d,d-d.|jd/d0dd1d|jd2dd+d,d3d.d'}i}|j|\}}|jr@d4|d5<|js:td6d4|_|jr\|j r\|j d7|j rx|j rx|j d8|j r|j rtd9|j r|jr|j d:|j rt d;xtjD]}t |qW|sdt d?tjd>d@SdA|kr4d4}|jr4t dBtjd>d@S|jrDd4|dC<|jrRtjntj}tjdD|dEtjdF}ttj} tfdGdH|jD} t} |jrd'} x2|jD](} | dIkrd4} n| jdJ| qW| r| j| n| }n | j| }|j| }t j!j"|}|rD|j#t j$ rDt j!j%| rDt j!j&|}|jrh|j't j$}|j(dK|j|t)t*||t*| |j|j ||j|j dL}|j+s|r|j,nBy|j||j|j-|j.Wn&tj/k rt dMtjd>dSX|j0t1t2|j+S)NNz2to3 [options] file|dir ...)Zusagez-dz--doctests_only store_truezFix up doctests only)actionhelpz-fz--fixr"z1Each FIX specifies a transformation; default: all)rLdefaultrMz-jz --processesZstorerintzRun 2to3 concurrently)rLrNtyperMz-xz--nofixz'Prevent a transformation from being runz-lz --list-fixeszList available transformationsz-pz--print-functionz0Modify the grammar so that print() is a functionz-vz --verbosezMore verbose loggingz --no-diffsz#Don't show diffs of the refactoringz-wz--writezWrite back modified filesz-nz --nobackupsFz&Don't write backups for modified filesz-oz --output-dirstrrzXPut output files in this directory instead of overwriting the input files. Requires -n.)rLrPrNrMz-Wz--write-unchanged-fileszYAlso write files even if no changes were required (useful with --output-dir); implies -w.z --add-suffixzuAppend this string to all output filenames. Requires -n if non-empty. ex: --add-suffix='3' will generate .py3 files.Twrite_unchanged_filesz&--write-unchanged-files/-W implies -w.z%Can't use --output-dir/-o without -n.z"Can't use --add-suffix without -n.z@not writing files and not printing diffs; that's not very usefulzCan't use -n without -wz2Available transformations for the -f/--fix option:rz1At least one file or directory argument required.)rIzUse --help to show usage.-zCan't write to stdin.rz%(name)s: %(message)s)formatlevelz lib2to3.mainc3s|]}d|VqdS)z.fix_Nr ).0fix) fixer_pkgr r szmain..allz.fix_z7Output in %r will mirror the input directory %r layout.)rrrz+Sorry, -j isn't supported on this platform.)3optparseZ OptionParserZ add_option parse_argsrRr:r@rrr$Z add_suffixZno_diffsZ list_fixesr;rZget_all_fix_namesr<rJrverboseloggingDEBUGINFOZ basicConfigZ getLoggersetZget_fixers_from_packageZnofixrXaddunion differencerr* commonprefixrrr/r.rstripinforsortedr!refactor_stdinZ doctests_onlyZ processesZMultiprocessingUnsupportedZ summarizerObool)rYr&parserrjflagsrZfixnamerVr#Z avail_fixesZunwanted_fixesrZ all_presentrXZ requestedZ fixer_namesrZrtr )rYr mains                                 rn)N)Z __future__rrr<rrr_r7r\rrrZMultiprocessRefactoringToolrr@rnr r r r s  gPKm;1]váFAFA)__pycache__/refactor.cpython-36.opt-2.pycnu[3 \=m@s8dZddlZddlZddlZddlZddlZddlZddlmZddl m Z m Z m Z ddl mZddlmZmZddlmZd%d d ZGd d d eZddZddZddZddZejd&krddlZejZddZddZ n eZeZeZ ddZ!GdddeZ"Gdd d e#Z$Gd!d"d"eZ%Gd#d$d$e$Z&dS)'z#Guido van Rossum N)chain)drivertokenizetoken) find_root)pytreepygram) btm_matcherTcCstt|ggdg}tjj|j}g}xLttj|D]:}|jdr2|jdr2|rZ|dd}|j |ddq2W|S)N*fix_z.py) __import__ospathdirname__file__sortedlistdir startswithendswithappend)Z fixer_pkgZ remove_prefixZpkgZ fixer_dirZ fix_namesnamer(/usr/lib64/python3.6/lib2to3/refactor.pyget_all_fix_namess rc@s eZdZdS) _EveryNodeN)__name__ __module__ __qualname__rrrrr+srcCst|tjtjfr(|jdkr t|jhSt|tjrH|jrDt|jStt|tj rt }x*|jD] }x|D]}|j t|qlWqbW|St d|dS)Nz$Oh no! I don't understand pattern %s) isinstancerZ NodePatternZ LeafPatterntyperZNegatedPatternZcontent_get_head_typesZWildcardPatternsetupdate Exception)Zpatrpxrrrr$/s      r$c Cstjt}g}x|D]|}|jrjyt|j}Wntk rJ|j|YqXxB|D]}||j|qRWq|jdk r||jj|q|j|qWx,tt j j j t j j D]}||j|qWt|S)N) collections defaultdictlistpatternr$rrZ _accept_typerr python_grammarZ symbol2numbervaluestokensextenddict)Z fixer_listZ head_nodesZeveryfixerZheadsZ node_typerrr_get_headnode_dictKs"    r5csfddtdDS)Ncsg|]}d|qS).r).0fix_name)pkg_namerr hsz+get_fixers_from_package..F)r)r9r)r9rget_fixers_from_packageds r;cCs|S)Nr)objrrr _identityksr=rcCs |jddS)Nz  )replace)inputrrr_from_system_newlinesrsrAcCs tjdkr|jdtjS|SdS)Nr>)rlinesepr?)r@rrr_to_system_newlinests rCc sTd}tjtj|jfdd}ttjtjtj h}t }yx|\}}||krVq@q@|tj krl|rfPd}q@|tj ko||dkr,|\}}|tj ks|dkrP|\}}|tj ks|dkrP|\}}|tj kr|dkr|\}}xJ|tj kr(|j||\}}|tj ks|d krP|\}}qWq@Pq@WWntk rJYnXt|S) NFcst}|d|dfS)Nrr)next)tok)genrradvancesz(_detect_future_features..advanceTfromZ __future__import(,)rgenerate_tokensioStringIOreadline frozensetrNEWLINENLCOMMENTr%STRINGNAMEOPadd StopIteration)sourceZhave_docstringrGignorefeaturestpvaluer)rFr_detect_future_featuressD          r^c@s eZdZdS) FixerErrorN)rr r!rrrrr_sr_c@seZdZdddZdZdZd4ddZdd Zd d Zd d Z ddZ ddZ d5ddZ d6ddZ ddZd7ddZddZd8ddZddZd d!Zd9d"d#Zd:d$d%Zd&Zd'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3ZdS);RefactoringToolF)print_functionwrite_unchanged_filesZFixr NcCs2||_|p g|_|jj|_|dk r0|jj||jdrDtj|_ntj |_|jj d|_ g|_ t jd|_g|_d|_tj|jtj|jd|_|j\|_|_g|_tj|_g|_g|_xXt|j|jD]F}|j r|jj!|q||jkr|jj"|q||jkr|jj"|qWt#|j|_$t#|j|_%dS)Nrarbr`F)convertlogger)&fixersexplicit_default_optionscopyoptionsr&r !python_grammar_no_print_statementgrammarr/getrberrorsloggingZ getLoggerrd fixer_logwroterZDriverrrc get_fixers pre_order post_orderfilesbmZ BottomMatcherBMZ bmi_pre_orderZbmi_post_orderrZ BM_compatibleZ add_fixerrr5bmi_pre_order_headsbmi_post_order_heads)selfZ fixer_namesrirfr4rrr__init__s<           zRefactoringTool.__init__c Cs\g}g}x&|jD]}t|iidg}|jddd}|j|jrV|t|jd}|jd}|jdjdd|D}yt ||}Wn$t k rt d||fYnX||j |j } | jr|jd k r||jkr|jd |q|jd || jd kr|j| q| jd kr |j| qt d| jqWtjd} |j| d|j| d||fS)Nr r6r_cSsg|] }|jqSr)title)r7r)rrrr:sz.RefactoringTool.get_fixers..zCan't find %s.%sTzSkipping optional fixer: %szAdding transformation: %sZpreZpostzIllegal fixer order: %rZ run_order)key)rerrsplitr FILE_PREFIXlensplit CLASS_PREFIXjoingetattrAttributeErrorr_rirorf log_message log_debugorderroperator attrgettersort) ryZpre_order_fixersZpost_order_fixersZ fix_mod_pathmodr8parts class_nameZ fix_classr4Zkey_funcrrrrqs8            zRefactoringTool.get_fixerscOsdS)Nr)rymsgargskwdsrrr log_errorszRefactoringTool.log_errorcGs|r ||}|jj|dS)N)rdinfo)ryrrrrrrszRefactoringTool.log_messagecGs|r ||}|jj|dS)N)rddebug)ryrrrrrrszRefactoringTool.log_debugcCsdS)Nr)ryold_textnew_textfilenameequalrrr print_outputszRefactoringTool.print_outputcCs<x6|D].}tjj|r&|j|||q|j|||qWdS)N)rrisdir refactor_dir refactor_file)ryitemswrite doctests_onlyZ dir_or_filerrrrefactor#s  zRefactoringTool.refactorc Cstjd}xtj|D]\}}}|jd||j|jxH|D]@}|jd rBtjj|d|krBtjj||} |j | ||qBWdd|D|dd<qWdS)NpyzDescending into %sr6rcSsg|]}|jds|qS)r6)r)r7Zdnrrrr:>sz0RefactoringTool.refactor_dir..) rextsepwalkrrrrsplitextrr) ryZdir_namerrZpy_extdirpathZdirnames filenamesrfullnamerrrr,s    zRefactoringTool.refactor_dircCsyt|d}Wn.tk r<}z|jd||dSd}~XnXztj|jd}Wd|jXt|d|d}t|j |fSQRXdS)NrbzCan't open %s: %srr()encoding)NN) openOSErrorrrdetect_encodingrOclose_open_with_encodingrAread)ryrferrrrrr_read_python_source@s z#RefactoringTool._read_python_sourcecCs|j|\}}|dkrdS|d7}|rn|jd||j||}|jsL||kr`|j|||||q|jd|nH|j||}|js|r|jr|jt|dd|||dn |jd|dS)Nr>zRefactoring doctests in %szNo doctest changes in %sr)rrzNo changes in %sr)rrrefactor_docstringrbprocessed_filerefactor_string was_changedstr)ryrrrr@routputtreerrrrPs    zRefactoringTool.refactor_filecCst|}d|krtj|j_zJy|jj|}Wn4tk r`}z|jd||jj |dSd}~XnXWd|j|j_X||_ |j d||j |||S)NrazCan't parse %s: %s: %szRefactoring %s) r^r rjrrkZ parse_stringr'r __class__rfuture_featuresr refactor_tree)rydatarr[rrrrrrgs     zRefactoringTool.refactor_stringcCstjj}|rN|jd|j|d}|js2||krB|j|d|q|jdn:|j|d}|jsj|r~|jr~|jt |d|n |jddS)NzRefactoring doctests in stdinzzNo doctest changes in stdinzNo changes in stdin) sysstdinrrrrbrrrr)ryrr@rrrrrrefactor_stdins     zRefactoringTool.refactor_stdinc Csx"t|j|jD]}|j||qW|j|j|j|j|j|j|jj|j }xvt |j rАx`|jj D]R}||ko||rv||j tjjdd|jr||j tjjdx t||D]}|||kr||j|y t|Wntk rwYnX|jr(||jkr(q|j|}|r|j||}|dk r|j|x,|jD] }|jspg|_|jj|q^W|jj|j }x2|D]*} | |krg|| <|| j|| qWqWqvWq\Wx$t|j|jD]}|j||qW|jS)NT)r~reverse)r~)rrrrsZ start_tree traverse_byrwrxrvZrunZleavesanyr0rerrZBaseZdepthZkeep_line_orderZ get_linenor-remover ValueErrorZfixers_appliedmatch transformr?rr2Z finish_treer) ryrrr4Z match_setnoderesultsnewZ new_matchesZfxrrrrrsJ       $zRefactoringTool.refactor_treecCs^|sdSxP|D]H}xB||jD]4}|j|}|r|j||}|dk r|j||}qWqWdS)N)r#rrr?)ryreZ traversalrr4rrrrrrs     zRefactoringTool.traverse_bycCs|jj||dkr.|j|d}|dkr.dS||k}|j|||||r`|jd||js`dS|rv|j||||n |jd|dS)NrzNo changes to %szNot writing changes to %s)rtrrrrrb write_file)ryrrrrrrrrrrs  zRefactoringTool.processed_filec%Csyt|d|d}Wn.tk r@}z|jd||dSd}~XnXzHy|jt|Wn0tk r}z|jd||WYdd}~XnXWd|jX|jd|d|_dS)Nw)rzCan't create %s: %szCan't write %s: %szWrote changes to %sT)rrrrrCrrrp)ryrrrrrrrrrr s$  zRefactoringTool.write_filez>>> z... c Csg}d}d}d}d}x|jddD]}|d7}|jj|jr|dk r\|j|j|||||}|g}|j|j} |d| }q"|dk r|j||js|||jjdkr|j |q"|dk r|j|j||||d}d}|j |q"W|dk r|j|j||||dj |S)NrT)keependsrr>r|) splitlineslstriprPS1r2refactor_doctestfindPS2rstriprr) ryr@rresultblockZ block_linenoindentlinenolineirrrr%s:          z"RefactoringTool.refactor_docstringc syj||}Wndtk rv}zHjjtjrRx|D]}jd|jdq8Wjd|||j j ||Sd}~XnXj ||r t |j dd}|d|d||dd} }|d jds|d d7<j|jdg}|r |fdd |D7}|S) Nz Source: %sr>z+Can't parse docstring in %s line %s: %s: %sT)rrrcsg|]}j|qSr)r)r7r)rryrrr:jsz4RefactoringTool.refactor_doctest..rr) parse_blockr'rdZ isEnabledForrnDEBUGrrrrrrrrrrpop) ryrrrrrrrrZclippedr)rryrrPs$ "z RefactoringTool.refactor_doctestcCs|jr d}nd}|js$|jd|n&|jd|x|jD]}|j|q8W|jrt|jdx|jD]}|j|qbW|jrt|jdkr|jdn|jdt|jx&|jD]\}}}|j|f||qWdS) Nwerez need to bezNo files %s modified.zFiles that %s modified:z$Warnings/messages while refactoring:rzThere was 1 error:zThere were %d errors:)rprtrrormr)ryrfilemessagerrrrrr summarizems$     zRefactoringTool.summarizecCs"|jj|j|||}t|_|S)N)rZ parse_tokens wrap_toksrPr)ryrrrrrrrrszRefactoringTool.parse_blockc cshtj|j||j}xN|D]F\}}\}}\} } } ||d7}| |d7} ||||f| | f| fVqWdS)Nr)rrL gen_lines__next__) ryrrrr1r#r]Zline0Zcol0Zline1Zcol1Z line_textrrrrs   zRefactoringTool.wrap_toksccs||j}||j}|}xV|D]N}|j|r@|t|dVn(||jdkrXdVntd||f|}qWx dVqrWdS)Nr>zline=%r, prefix=%rr|)rrrrrAssertionError)ryrrprefix1Zprefix2prefixrrrrrs    zRefactoringTool.gen_lines)NN)FF)FF)FF)F)NFN)N)rr r!rgrrrzrqrrrrrrrrrrrrrrrrrrrrrrrrrrr`s: 4(   O  + r`c@s eZdZdS)MultiprocessingUnsupportedN)rr r!rrrrrsrcsBeZdZfddZd fdd ZfddZfd d ZZS) MultiprocessRefactoringToolcs"tt|j||d|_d|_dS)N)superrrzqueue output_lock)ryrkwargs)rrrrzsz$MultiprocessRefactoringTool.__init__Frcs|dkrttj|||Sy ddlWntk r@tYnXjdk rTtdj_j _ fddt |D}z.x|D] }|j qWttj|||Wdjj xt |D]}jjdqWx|D]}|jr|j qWd_XdS)Nrrz already doing multiple processescsg|]}jjdqS))target)ZProcess_child)r7r)multiprocessingryrrr:sz8MultiprocessRefactoringTool.refactor..)rrrr ImportErrorrr RuntimeErrorZ JoinableQueueZLockrrangestartrputZis_alive)ryrrrZ num_processesZ processesr)r)r)rryrrs2               z$MultiprocessRefactoringTool.refactorc sR|jj}xB|dk rL|\}}ztt|j||Wd|jjX|jj}q WdS)N)rrlrrrZ task_done)ryZtaskrr)rrrrs     z"MultiprocessRefactoringTool._childcs2|jdk r|jj||fntt|j||SdS)N)rrrrr)ryrr)rrrrs  z)MultiprocessRefactoringTool.refactor_file)FFr)rr r!rzrrr __classcell__rr)rrrs   r)T)rr)' __author__rrrnrr+rM itertoolsrZpgen2rrrZ fixer_utilrr|rr r rurr'rr$r5r;r= version_infocodecsrrrArCr^r_objectr`rrrrrr sD      ( PKm;1]Q__'__pycache__/pytree.cpython-36.opt-1.pycnu[3 \m@sdZdZddlZddlZddlmZdZiaddZGdd d e Z Gd d d e Z Gd d d e Z ddZ Gddde ZGdddeZGdddeZGdddeZGdddeZddZdS)z Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here. z#Guido van Rossum N)StringIOicCsHtst|jjD].\}}||kr|jj|jj|=d|_|SqWdS)z Remove the node from the tree. Returns the position of the node in its parent's children before it was removed. N)r" enumerater#r&)rir.r r rremoves  z Base.removec CsZ|jdkrdSxFt|jjD]6\}}||kry|jj|dStk rPdSXqWdS)z The node immediately following the invocant in their parent's children list. If the invocant does not have a next sibling, it is None Nr)r"r1r# IndexError)rr2childr r r next_siblings zBase.next_siblingcCsP|jdkrdSx= 256), a sequence of child nodes, and an optional context keyword argument. As a side effect, the parent pointers of the children are updated. N)rr!r#r"r;fixers_applied)rrr#contextr;rKr)r r r__init__s    z Node.__init__cCsd|jjt|j|jfS)z)Return a canonical string representation.z %s(%s, %r))rrBrrr#)rr r r__repr__sz Node.__repr__cCsdjtt|jS)zk Return a pretty string representation. This reproduces the input source exactly. r:)joinmapr?r#)rr r r __unicode__szNode.__unicode__r=rcCs|j|jf|j|jfkS)zCompare two nodes for equality.)rr#)rrr r rrszNode._eqcCst|jdd|jD|jdS)z$Return a cloned (deep) copy of self.cSsg|] }|jqSr )r).0r)r r r szNode.clone..)rK)rJrr#rK)rr r rrsz Node.cloneccs(x|jD]}|jEdHqW|VdS)z*Return a post-order iterator for the tree.N)r#r)rr5r r rrs zNode.post_orderccs(|Vx|jD]}|jEdHqWdS)z)Return a pre-order iterator for the tree.N)r#r)rr5r r rr s zNode.pre_ordercCs|js dS|jdjS)zO The whitespace and comments preceding this node in the input. r:r)r#r;)rr r r_prefix_getterszNode._prefix_gettercCs|jr||jd_dS)Nr)r#r;)rr;r r r_prefix_setterszNode._prefix_settercCs(||_d|j|_||j|<|jdS)z Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. N)r"r#r&)rr2r5r r r set_child!s  zNode.set_childcCs ||_|jj|||jdS)z Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. N)r"r#insertr&)rr2r5r r r insert_child+szNode.insert_childcCs||_|jj||jdS)z Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately. N)r"r#r%r&)rr5r r r append_child4s zNode.append_child)NNN)r=r)rBrCrDrErMrNrQrHrIrArrrrrTrUrGr;rVrXrYr r r rrJs$     rJc@seZdZdZdZdZdZddgfddZddZd d Z e j dkrFe Z d d Z ddZddZddZddZddZddZeeeZdS)r,z'Concrete implementation for leaf nodes.r:rNcCsF|dk r|\|_\|_|_||_||_|dk r4||_|dd|_dS)z Initializer. Takes a type constant (a token number < 256), a string value, and an optional context keyword argument. N)_prefixr-columnrvaluerK)rrr\rLr;rKr r rrMGs z Leaf.__init__cCsd|jj|j|jfS)z)Return a canonical string representation.z %s(%r, %r))rrBrr\)rr r rrNZsz Leaf.__repr__cCs|jt|jS)zk Return a pretty string representation. This reproduces the input source exactly. )r;r?r\)rr r rrQ`szLeaf.__unicode__r=cCs|j|jf|j|jfkS)zCompare two nodes for equality.)rr\)rrr r rrkszLeaf._eqcCs$t|j|j|j|j|jff|jdS)z$Return a cloned (deep) copy of self.)rK)r,rr\r;r-r[rK)rr r rros z Leaf.cloneccs |VdS)Nr )rr r rr8usz Leaf.leavesccs |VdS)z*Return a post-order iterator for the tree.Nr )rr r rrxszLeaf.post_orderccs |VdS)z)Return a pre-order iterator for the tree.Nr )rr r rr|szLeaf.pre_ordercCs|jS)zP The whitespace and comments preceding this token in the input. )rZ)rr r rrTszLeaf._prefix_gettercCs|j||_dS)N)r&rZ)rr;r r rrUszLeaf._prefix_setter)r=r)rBrCrDrErZr-r[rMrNrQrHrIrArrr8rrrTrUrGr;r r r rr,>s&  r,cCsN|\}}}}|s||jkrConstructor that prevents BasePattern from being instantiated.)rr)rrrr r rrszBasePattern.__new__cCsLt|j|j|jg}x|r.|ddkr.|d=qWd|jjdjtt|fS)Nrz%s(%s)z, r`) rrcontentr rrBrOrPrepr)rrr r rrNs zBasePattern.__repr__cCs|S)z A subclass can define this as a hook for optimizations. Returns either self or another node with the same effect. r )rr r roptimizeszBasePattern.optimizecCsn|jdk r|j|jkrdS|jdk rRd}|dk r4i}|j||sDdS|rR|j||dk rj|jrj|||j<dS)a# Does this pattern exactly match a node? Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. Default implementation for non-wildcard patterns. NFT)rra _submatchupdater )rr.resultsrr r rmatchs     zBasePattern.matchcCs t|dkrdS|j|d|S)z Does this pattern exactly match a sequence of nodes? Default implementation for non-wildcard patterns. rFr)r]rh)rnodesrfr r r match_seqs zBasePattern.match_seqccs&i}|r"|j|d|r"d|fVdS)z} Generator yielding all matches for this pattern. Default implementation for non-wildcard patterns. rrN)rh)rrirgr r rgenerate_matchesszBasePattern.generate_matches)N)N) rBrCrDrErrar rrNrcrhrjrkr r r rr_s  r_c@s*eZdZdddZd ddZd ddZdS) LeafPatternNcCs&|dk r|dk r||_||_||_dS)ap Initializer. Takes optional type, content, and name. The type, if given must be a token type (< 256). If not given, this matches any *leaf* node; the content may still be required. The content, if given, must be a string. If a name is given, the matching node is stored in the results dict under that key. N)rrar )rrrar r r rrMs zLeafPattern.__init__cCst|tsdStj|||S)z*Override match() to insist on a leaf node.F)r r,r_rh)rr.rfr r rrh s zLeafPattern.matchcCs |j|jkS)a Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. )rar\)rr.rfr r rrds zLeafPattern._submatch)NNN)N)N)rBrCrDrMrhrdr r r rrls  rlc@s$eZdZdZdddZdddZdS) NodePatternFNcCsT|dk r|dk r>t|}x$t|D]\}}t|tr"d|_q"W||_||_||_dS)ad Initializer. Takes optional type, content, and name. The type, if given, must be a symbol type (>= 256). If the type is None this matches *any* single node (leaf or not), except if content is not None, in which it only matches non-leaf nodes that also match the content pattern. The content, if not None, must be a sequence of Patterns that must match the node's children exactly. If the content is given, the type must not be None. If a name is given, the matching node is stored in the results dict under that key. NT)r!r1r WildcardPattern wildcardsrrar )rrrar r2itemr r rrM%s  zNodePattern.__init__cCs|jrJx>t|j|jD],\}}|t|jkr|dk r>|j|dSqWdSt|jt|jkrbdSx*t|j|jD]\}}|j||srdSqrWdS)a Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. NTF)rorkrar#r]reziprh)rr.rfcrg subpatternr5r r rrdBs   zNodePattern._submatch)NNN)N)rBrCrDrorMrdr r r rrm!s rmc@s^eZdZdZddedfddZddZddd Zdd d Zd d Z ddZ ddZ ddZ dS)rna A wildcard pattern can match zero or more nodes. This has all the flexibility needed to implement patterns like: .* .+ .? .{m,n} (a b c | d e | f) (...)* (...)+ (...)? (...){m,n} except it always uses non-greedy matching. NrcCs@|dk r$ttt|}x |D]}qW||_||_||_||_dS)a Initializer. Args: content: optional sequence of subsequences of patterns; if absent, matches one node; if present, each subsequence is an alternative [*] min: optional minimum number of times to match, default 0 max: optional maximum number of times to match, default HUGE name: optional name assigned to this match [*] Thus, if content is [[a, b, c], [d, e], [f, g, h]] this is equivalent to (a b c | d e | f g h); if content is None, this is equivalent to '.' in regular expression terms. The min and max parameters work as follows: min=0, max=maxint: .* min=1, max=maxint: .+ min=0, max=1: .? min=1, max=1: . If content is not None, replace the dot with the parenthesized list of alternatives, e.g. (a b c | d e | f g h)* N)tuplerPraminmaxr )rrarurvr altr r rrMls zWildcardPattern.__init__cCsd}|jdk r\}}|t|kr |dk rF|j||jrFt|||j<dSq WdS)z4Does this pattern exactly match a sequence of nodes?NTF)rkr]rer r!)rrirfrrrgr r rrjs  zWildcardPattern.match_seqccs:|jdkrXxJt|jdtt||jD]*}i}|jrH|d|||j<||fVq(Wn|jdkrp|j|Vnttdrtj }t t_ zy@x:|j |dD]*\}}|jr|d|||j<||fVqWWnRt k rx:|j |D],\}}|jr |d|||j<||fVqWYnXWdttdr4|t_ XdS)a" Generator yielding matches for a sequence of nodes. Args: nodes: sequence of nodes Yields: (count, results) tuples where: count: the match comprises nodes[:count]; results: dict containing named submatches. NrZ bare_name getrefcountr)rarangerur]rvr _bare_name_matcheshasattrrHstderrr_recursive_matches RuntimeError_iterative_matches)rricountrgZ save_stderrr r rrks. "   z WildcardPattern.generate_matchesc cs t|}d|jkrdifVg}x>|jD]4}x.t||D] \}}||fV|j||fq8Wq(Wx|rg}x|D]\}} ||krr||jkrrxn|jD]d}x^t|||dD]H\} } | dkri}|j| |j| || |fV|j|| |fqWqWqrW|}qbWdS)z(Helper to iteratively yield the matches.rN)r]rurarkr%rvre) rriZnodelenrfrwrrrgZ new_resultsc0r0c1r1r r rrs*       z"WildcardPattern._iterative_matchescCsxd}i}d}t|}xH| r\||kr\d}x0|jD]&}|dj|||r0|d7}d}Pq0WqW|d|||j<||fS)z(Special optimized matcher for bare_name.rFTrN)r]rarhr )rrirrgdonervZleafr r rrzs  z"WildcardPattern._bare_name_matchesc cs||jkrdifV||jkrxr|jD]h}xbt||D]T\}}xJ|j||d|dD].\}}i}|j||j||||fVqXWq6Wq&WdS)z(Helper to recursively yield the matches.rNr)rurvrarkr}re) rrirrwrrrrrgr r rr} s    "  z"WildcardPattern._recursive_matches)N)N) rBrCrDrEHUGErMrcrhrjrkrrzr}r r r rrn^s #  -rnc@s.eZdZd ddZddZddZdd ZdS) NegatedPatternNcCs|dk r||_dS)a Initializer. The argument is either a pattern or None. If it is None, this only matches an empty sequence (effectively '$' in regex lingo). If it is not None, this matches whenever the argument pattern doesn't have any matches. N)ra)rrar r rrMs zNegatedPattern.__init__cCsdS)NFr )rr.r r rrh)szNegatedPattern.matchcCs t|dkS)Nr)r])rrir r rrj-szNegatedPattern.match_seqccsL|jdkr"t|dkrHdifVn&x|jj|D] \}}dSWdifVdS)Nr)rar]rk)rrirrrgr r rrk1s    zNegatedPattern.generate_matches)N)rBrCrDrMrhrjrkr r r rrs rc cs|sdifVn|d|dd}}xl|j|D]^\}}|sJ||fVq2xDt|||dD].\}}i}|j||j||||fVq^Wq2WdS)aR Generator yielding matches for a sequence of patterns and nodes. Args: patterns: a sequence of patterns nodes: a sequence of nodes Yields: (count, results) tuples where: count: the entire sequence of patterns matches nodes[:count]; results: dict containing named submatches. rrN)rkre) Zpatternsriprestrrrrrgr r rrk=s     rk)rE __author__rHwarningsiorrrrrrrJr,r^r_rlrmrnrrkr r r r s&  1nNV,==#PKm;1]euf"__pycache__/patcomp.cpython-36.pycnu[3 \@sdZdZddlZddlmZmZmZmZmZm Z ddl m Z ddl m Z Gdd d e Zd d ZGd d d eZejejejddZddZddZddZdS)zPattern compiler. The grammar is taken from PatternGrammar.txt. The compiler compiles a pattern to a pytree.*Pattern instance. z#Guido van Rossum N)driverliteralstokentokenizeparsegrammar)pytree)pygramc@s eZdZdS)PatternSyntaxErrorN)__name__ __module__ __qualname__rr'/usr/lib64/python3.6/lib2to3/patcomp.pyr sr c csPtjtjtjh}tjtj|j}x(|D] }|\}}}}}||kr(|Vq(WdS)z6Tokenizes a string suppressing significant whitespace.N) rNEWLINEINDENTDEDENTrgenerate_tokensioStringIOreadline) inputskiptokensZ quintupletypevaluestartendZ line_textrrrtokenize_wrappers  rc@s:eZdZd ddZdddZddZdd d Zd d ZdS)PatternCompilerNcCsZ|dkrtj|_tj|_ntj||_tj|j|_tj|_ tj |_ tj |jt d|_dS)z^Initializer. Takes an optional alternative filename for the pattern grammar. N)Zconvert)r Zpattern_grammarrZpattern_symbolssymsrZ load_grammarZSymbolsZpython_grammarZ pygrammarZpython_symbolspysymsZDriverpattern_convert)selfZ grammar_filerrr__init__(s  zPatternCompiler.__init__FcCsnt|}y|jj||d}Wn0tjk rL}ztt|WYdd}~XnX|r`|j||fS|j|SdS)z=Compiles a pattern string to a nested pytree.*Pattern object.)debugN)rrZ parse_tokensrZ ParseErrorr str compile_node)r$rr&Z with_treerrooterrrcompile_pattern7szPatternCompiler.compile_patternc s|jjjkr|jd}|jjjkrzfdd|jdddD}t|dkrX|dStjdd|Dddd}|jS|jjj krʇfd d|jD}t|dkr|dStj|gddd}|jS|jjj krj |jdd}tj |}|jS|jjj kstd}|j}t|d krR|djtjkrR|dj}|dd}d}t|dkr|d jjjkr|d}|dd}j ||}|dk r|jjjkst|j} | d} | jtjkrd} tj} n| jtjkrd} tj} np| jtjkr^| djtjkstt| dks.tj| d} } t| d krhj| d } n d sht| dks|| dkr|j}tj|gg| | d}|dk r||_|jS)zXCompiles a node, recursively. This is one big switch on the node type. rcsg|]}j|qSr)r().0ch)r$rr Osz0PatternCompiler.compile_node..NrcSsg|] }|gqSrr)r,arrrr.Rs)minmaxcsg|]}j|qSr)r()r,r-)r$rrr.VsFr5r5r5)r3r4)rr!ZMatcherchildrenZ Alternativeslenr WildcardPatternoptimizeZ AlternativeZ NegatedUnit compile_basicZNegatedPatternZUnitAssertionErrorrEQUALrZRepeaterSTARZHUGEPLUSLBRACERBRACEget_intname) r$nodeZaltspZunitspatternrBnodesrepeatr6Zchildr1r2r)r$rr(Csh       "     zPatternCompiler.compile_nodecCsnt|dkst|d}|jtjkrDttj|j}t j t ||S|jtj kr|j}|j r|tkrttd||ddrtdt j t|S|dkrd}n,|jdst|j|d}|dkrtd||ddr|j|djdg}nd}t j||SnV|jdkr |j|dS|jd kr\|dks:t|j|d}t j|ggddd Sd sjt|dS) NrrzInvalid token: %rzCan't have details for tokenany_zInvalid symbol: %r([)r1r2F)r7r;rrSTRINGr'rZ evalStringrr Z LeafPattern_type_of_literalNAMEisupper TOKEN_MAPr startswithgetattrr"r(r6Z NodePatternr8)r$rFrGrCrrZcontent subpatternrrrr:s<        zPatternCompiler.compile_basiccCs|jtjkstt|jS)N)rrNUMBERr;intr)r$rCrrrrAszPatternCompiler.get_int)N)FF)N)r r rr%r+r(r:rArrrrr &s   G #r )rNrLrTZTOKENcCs.|djrtjS|tjkr&tj|SdSdS)Nr)isalpharrNrZopmap)rrrrrMs    rMcCs>|\}}}}|s||jkr*tj|||dStj|||dSdS)z9Converts raw node information to a Node or Leaf instance.)contextN)Z number2symbolr ZNodeZLeaf)rZ raw_node_inforrrWr6rrrr#s r#cCs tj|S)N)r r+)rErrrr+sr+)__doc__ __author__rZpgen2rrrrrrr r Exceptionr robjectr rNrLrTrPrMr#r+rrrr s       PKm;1]))]QQ%__pycache__/fixer_base.cpython-36.pycnu[3 \"@sTdZddlZddlmZddlmZddlmZGdddeZ Gd d d e Z dS) z2Base class for fixers (optional, but recommended).N)PatternCompiler)pygram)does_tree_importc@seZdZdZdZdZdZdZdZe j dZ e Z dZdZdZdZdZdZejZddZd d Zd d Zd dZddZdddZddZdddZddZddZ ddZ!dS) BaseFixaOptional base class for fixers. The subclass name must be FixFooBar where FooBar is the result of removing underscores and capitalizing the words of the fix name. For example, the class name for a fixer named 'has_key' should be FixHasKey. NrZpostFcCs||_||_|jdS)aInitializer. Subclass may override. Args: options: a dict containing the options passed to RefactoringTool that could be used to customize the fixer through the command line. log: a list to append warnings and other messages to. N)optionslogcompile_pattern)selfrr r */usr/lib64/python3.6/lib2to3/fixer_base.py__init__/szBaseFix.__init__cCs,|jdk r(t}|j|jdd\|_|_dS)zCompiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match(). NT)Z with_tree)PATTERNrr pattern pattern_tree)r PCr r r r ;s zBaseFix.compile_patterncCs ||_dS)zOSet the filename. The main refactoring tool should call this. N)filename)r rr r r set_filenameFszBaseFix.set_filenamecCsd|i}|jj||o|S)aReturns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override. node)rmatch)r rresultsr r r rMs z BaseFix.matchcCs tdS)aReturns the transformation for a given parse tree node. Args: node: the root of the parse tree that matched the fixer. results: a dict mapping symbolic names to part of the match. Returns: None, or a node that is a modified copy of the argument node. The node argument may also be modified in-place to effect the same change. Subclass *must* override. N)NotImplementedError)r rrr r r transformYszBaseFix.transformxxx_todo_changemecCs6|}x ||jkr$|tt|j}qW|jj||S)zReturn a string suitable for use as an identifier The new name is guaranteed not to conflict with other identifiers. ) used_namesstrnextnumbersadd)r templatenamer r r new_nameis   zBaseFix.new_namecCs.|jrd|_|jjd|j|jj|dS)NFz### In file %s ###) first_logr appendr)r messager r r log_messagetszBaseFix.log_messagecCs>|j}|j}d|_d}|j|||f|r:|j|dS)aWarn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. zLine %d: could not convert: %sN) get_linenoZcloneprefixr&)r rreasonlinenoZ for_outputmsgr r r cannot_convertzszBaseFix.cannot_convertcCs|j}|jd||fdS)zUsed for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. z Line %d: %sN)r(r&)r rr*r+r r r warningszBaseFix.warningcCs(|j|_|j|tjd|_d|_dS)zSome fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. rTN)rr itertoolscountrr#)r treerr r r start_trees  zBaseFix.start_treecCsdS)zSome fixers need to maintain tree-wide state. This method is called once, at the conclusion of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. Nr )r r1rr r r finish_treeszBaseFix.finish_tree)r)N)"__name__ __module__ __qualname____doc__rrrrrr/r0rsetrorderZexplicitZ run_orderZ _accept_typeZkeep_line_orderZ BM_compatiblerZpython_symbolsZsymsrr rrrr"r&r-r.r2r3r r r r rs4        rcs,eZdZdZdZfddZddZZS)ConditionalFixz@ Base class for fixers which not execute if an import is found. Ncstt|j|d|_dS)N)superr:r2 _should_skip)r args) __class__r r r2szConditionalFix.start_treecCsJ|jdk r|jS|jjd}|d}dj|dd}t||||_|jS)N.rr@)r<skip_onsplitjoinr)r rZpkgr!r r r should_skips  zConditionalFix.should_skip)r4r5r6r7rAr2rD __classcell__r r )r>r r:s r:) r7r/Zpatcomprr'rZ fixer_utilrobjectrr:r r r r s   PKm;1]0'?QQ)__pycache__/refactor.cpython-36.opt-1.pycnu[3 \=m@s<dZdZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZdd lmZd&d d ZGd ddeZddZddZddZddZejd'krddlZejZddZ ddZ!n eZeZ eZ!ddZ"GdddeZ#Gd d!d!e$Z%Gd"d#d#eZ&Gd$d%d%e%Z'dS)(zRefactoring framework. Used as a main program, this can refactor any number of files and/or recursively descend down directories. Imported as a module, this provides infrastructure to write your own refactoring tool. z#Guido van Rossum N)chain)drivertokenizetoken) find_root)pytreepygram) btm_matcherTcCstt|ggdg}tjj|j}g}xLttj|D]:}|jdr2|jdr2|rZ|dd}|j |ddq2W|S)zEReturn a sorted list of all available fix names in the given package.*fix_z.pyN) __import__ospathdirname__file__sortedlistdir startswithendswithappend)Z fixer_pkgZ remove_prefixZpkgZ fixer_dirZ fix_namesnamer(/usr/lib64/python3.6/lib2to3/refactor.pyget_all_fix_namess rc@s eZdZdS) _EveryNodeN)__name__ __module__ __qualname__rrrrr+srcCst|tjtjfr(|jdkr t|jhSt|tjrH|jrDt|jStt|tj rt }x*|jD] }x|D]}|j t|qlWqbW|St d|dS)zf Accepts a pytree Pattern Node and returns a set of the pattern types which will match first. Nz$Oh no! I don't understand pattern %s) isinstancerZ NodePatternZ LeafPatterntyperZNegatedPatternZcontent_get_head_typesZWildcardPatternsetupdate Exception)Zpatrpxrrrr$/s      r$c Cstjt}g}x|D]|}|jrjyt|j}Wntk rJ|j|YqXxB|D]}||j|qRWq|jdk r||jj|q|j|qWx,tt j j j t j j D]}||j|qWt|S)z^ Accepts a list of fixers and returns a dictionary of head node type --> fixer list. N) collections defaultdictlistpatternr$rrZ _accept_typerr python_grammarZ symbol2numbervaluestokensextenddict)Z fixer_listZ head_nodesZeveryfixerZheadsZ node_typerrr_get_headnode_dictKs"    r5csfddtdDS)zN Return the fully qualified names for fixers in the package pkg_name. csg|]}d|qS).r).0fix_name)pkg_namerr hsz+get_fixers_from_package..F)r)r9r)r9rget_fixers_from_packageds r;cCs|S)Nr)objrrr _identityksr=rcCs |jddS)Nz  )replace)inputrrr_from_system_newlinesrsrAcCs tjdkr|jdtjS|SdS)Nr>)rlinesepr?)r@rrr_to_system_newlinests rCc sTd}tjtj|jfdd}ttjtjtj h}t }yx|\}}||krVq@q@|tj krl|rfPd}q@|tj ko||dkr,|\}}|tj ks|dkrP|\}}|tj ks|dkrP|\}}|tj kr|dkr|\}}xJ|tj kr(|j||\}}|tj ks|d krP|\}}qWq@Pq@WWntk rJYnXt|S) NFcst}|d|dfS)Nrr)next)tok)genrradvancesz(_detect_future_features..advanceTfromZ __future__import(,)rgenerate_tokensioStringIOreadline frozensetrNEWLINENLCOMMENTr%STRINGNAMEOPadd StopIteration)sourceZhave_docstringrGignorefeaturestpvaluer)rFr_detect_future_featuressD          r^c@seZdZdZdS) FixerErrorzA fixer could not be loaded.N)rr r!__doc__rrrrr_sr_c@seZdZdddZdZdZd4ddZdd Zd d Zd d Z ddZ ddZ d5ddZ d6ddZ ddZd7ddZddZd8ddZddZd d!Zd9d"d#Zd:d$d%Zd&Zd'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3ZdS);RefactoringToolF)print_functionwrite_unchanged_filesZFixr NcCs2||_|p g|_|jj|_|dk r0|jj||jdrDtj|_ntj |_|jj d|_ g|_ t jd|_g|_d|_tj|jtj|jd|_|j\|_|_g|_tj|_g|_g|_xXt|j|jD]F}|j r|jj!|q||jkr|jj"|q||jkr|jj"|qWt#|j|_$t#|j|_%dS)zInitializer. Args: fixer_names: a list of fixers to import options: a dict with configuration. explicit: a list of fixers to run even if they are explicit. NrbrcraF)convertlogger)&fixersexplicit_default_optionscopyoptionsr&r !python_grammar_no_print_statementgrammarr/getrcerrorsloggingZ getLoggerre fixer_logwroterZDriverrrd get_fixers pre_order post_orderfilesbmZ BottomMatcherBMZ bmi_pre_orderZbmi_post_orderrZ BM_compatibleZ add_fixerrr5bmi_pre_order_headsbmi_post_order_heads)selfZ fixer_namesrjrgr4rrr__init__s<           zRefactoringTool.__init__c Cs\g}g}x&|jD]}t|iidg}|jddd}|j|jrV|t|jd}|jd}|jdjdd|D}yt ||}Wn$t k rt d ||fYnX||j |j } | jr|jd k r||jkr|jd |q|jd || jd kr|j| q| jdkr |j| qt d| jqWtjd} |j| d|j| d||fS)aInspects the options to load the requested patterns and handlers. Returns: (pre_order, post_order), where pre_order is the list of fixers that want a pre-order AST traversal, and post_order is the list that want post-order traversal. r r6rN_cSsg|] }|jqSr)title)r7r)rrrr:sz.RefactoringTool.get_fixers..zCan't find %s.%sTzSkipping optional fixer: %szAdding transformation: %sZpreZpostzIllegal fixer order: %rZ run_order)key)rfrrsplitr FILE_PREFIXlensplit CLASS_PREFIXjoingetattrAttributeErrorr_rjrprg log_message log_debugorderroperator attrgettersort) rzZpre_order_fixersZpost_order_fixersZ fix_mod_pathmodr8parts class_nameZ fix_classr4Zkey_funcrrrrrs8            zRefactoringTool.get_fixerscOsdS)zCalled when an error occurs.Nr)rzmsgargskwdsrrr log_errorszRefactoringTool.log_errorcGs|r ||}|jj|dS)zHook to log a message.N)reinfo)rzrrrrrrszRefactoringTool.log_messagecGs|r ||}|jj|dS)N)redebug)rzrrrrrrszRefactoringTool.log_debugcCsdS)zTCalled with the old version, new version, and filename of a refactored file.Nr)rzold_textnew_textfilenameequalrrr print_outputszRefactoringTool.print_outputcCs<x6|D].}tjj|r&|j|||q|j|||qWdS)z)Refactor a list of files and directories.N)rrisdir refactor_dir refactor_file)rzitemswrite doctests_onlyZ dir_or_filerrrrefactor#s  zRefactoringTool.refactorc Cstjd}xtj|D]\}}}|jd||j|jxH|D]@}|jd rBtjj|d|krBtjj||} |j | ||qBWdd|D|dd<qWdS)zDescends down a directory and refactor every Python file found. Python files are assumed to have a .py extension. Files and subdirectories starting with '.' are skipped. pyzDescending into %sr6rcSsg|]}|jds|qS)r6)r)r7Zdnrrrr:>sz0RefactoringTool.refactor_dir..N) rextsepwalkrrrrsplitextrr) rzZdir_namerrZpy_extdirpathZdirnames filenamesrfullnamerrrr,s    zRefactoringTool.refactor_dircCsyt|d}Wn.tk r<}z|jd||dSd}~XnXztj|jd}Wd|jXt|d|d}t|j |fSQRXdS)zG Do our best to decode a Python source file correctly. rbzCan't open %s: %sNrr()encoding)NN) openOSErrorrrdetect_encodingrOclose_open_with_encodingrAread)rzrferrrrrr_read_python_source@s z#RefactoringTool._read_python_sourcecCs|j|\}}|dkrdS|d7}|rn|jd||j||}|jsL||kr`|j|||||q|jd|nH|j||}|js|r|jr|jt|dd|||dn |jd|dS) zRefactors a file.Nr>zRefactoring doctests in %szNo doctest changes in %sr)rrzNo changes in %sr)rrrefactor_docstringrcprocessed_filerefactor_string was_changedstr)rzrrrr@routputtreerrrrPs    zRefactoringTool.refactor_filecCst|}d|krtj|j_zJy|jj|}Wn4tk r`}z|jd||jj |dSd}~XnXWd|j|j_X||_ |j d||j |||S)aFRefactor a given input string. Args: data: a string holding the code to be refactored. name: a human-readable name for use in error/log messages. Returns: An AST corresponding to the refactored input stream; None if there were errors during the parse. rbzCan't parse %s: %s: %sNzRefactoring %s) r^r rkrrlZ parse_stringr'r __class__rfuture_featuresr refactor_tree)rzdatarr[rrrrrrgs     zRefactoringTool.refactor_stringcCstjj}|rN|jd|j|d}|js2||krB|j|d|q|jdn:|j|d}|jsj|r~|jr~|jt |d|n |jddS)NzRefactoring doctests in stdinzzNo doctest changes in stdinzNo changes in stdin) sysstdinrrrrcrrrr)rzrr@rrrrrrefactor_stdins     zRefactoringTool.refactor_stdinc Csx"t|j|jD]}|j||qW|j|j|j|j|j|j|jj|j }xvt |j rАx`|jj D]R}||ko||rv||j tjjdd|jr||j tjjdx t||D]}|||kr||j|y t|Wntk rwYnX|jr(||jkr(q|j|}|r|j||}|dk r|j|x,|jD] }|jspg|_|jj|q^W|jj|j }x2|D]*} | |krg|| <|| j|| qWqWqvWq\Wx$t|j|jD]}|j||qW|jS)aRefactors a parse tree (modifying the tree in place). For compatible patterns the bottom matcher module is used. Otherwise the tree is traversed node-to-node for matches. Args: tree: a pytree.Node instance representing the root of the tree to be refactored. name: a human-readable name for this tree. Returns: True if the tree was modified, False otherwise. T)rreverse)rN)rrsrtZ start_tree traverse_byrxryrwZrunZleavesanyr0rfrrZBaseZdepthZkeep_line_orderZ get_linenor-remover ValueErrorZfixers_appliedmatch transformr?rr2Z finish_treer) rzrrr4Z match_setnoderesultsnewZ new_matchesZfxrrrrrsJ       $zRefactoringTool.refactor_treecCs^|sdSxP|D]H}xB||jD]4}|j|}|r|j||}|dk r|j||}qWqWdS)aTraverse an AST, applying a set of fixers to each node. This is a helper method for refactor_tree(). Args: fixers: a list of fixer instances. traversal: a generator that yields AST nodes. Returns: None N)r#rrr?)rzrfZ traversalrr4rrrrrrs     zRefactoringTool.traverse_bycCs|jj||dkr.|j|d}|dkr.dS||k}|j|||||r`|jd||js`dS|rv|j||||n |jd|dS)zR Called when a file has been refactored and there may be changes. NrzNo changes to %szNot writing changes to %s)rurrrrrc write_file)rzrrrrrrrrrrs  zRefactoringTool.processed_filec%Csyt|d|d}Wn.tk r@}z|jd||dSd}~XnXzHy|jt|Wn0tk r}z|jd||WYdd}~XnXWd|jX|jd|d|_dS)zWrites a string to a file. It first shows a unified diff between the old text and the new text, and then rewrites the file; the latter is only done if the write option is set. w)rzCan't create %s: %sNzCan't write %s: %szWrote changes to %sT)rrrrrCrrrq)rzrrrrrrrrrr s$  zRefactoringTool.write_filez>>> z... c Csg}d}d}d}d}x|jddD]}|d7}|jj|jr|dk r\|j|j|||||}|g}|j|j} |d| }q"|dk r|j||js|||jjdkr|j |q"|dk r|j|j||||d}d}|j |q"W|dk r|j|j||||dj |S)aRefactors a docstring, looking for doctests. This returns a modified version of the input string. It looks for doctests, which start with a ">>>" prompt, and may be continued with "..." prompts, as long as the "..." is indented the same as the ">>>". (Unfortunately we can't use the doctest module's parser, since, like most parsers, it is not geared towards preserving the original source.) NrT)keependsrr>r}) splitlineslstriprPS1r2refactor_doctestfindPS2rstriprr) rzr@rresultblockZ block_linenoindentlinenolineirrrr%s:          z"RefactoringTool.refactor_docstringc syj||}Wndtk rv}zHjjtjrRx|D]}jd|jdq8Wjd|||j j ||Sd}~XnXj ||r t |j dd}|d|d||dd} }|d jds|d d7<j|jdg}|r |fd d |D7}|S) zRefactors one doctest. A doctest is given as a block of lines, the first of which starts with ">>>" (possibly indented), while the remaining lines start with "..." (identically indented). z Source: %sr>z+Can't parse docstring in %s line %s: %s: %sNT)rrrcsg|]}j|qSr)r)r7r)rrzrrr:jsz4RefactoringTool.refactor_doctest..rr) parse_blockr'reZ isEnabledForroDEBUGrrrrrrrrrrpop) rzrrrrrrrrZclippedr)rrzrrPs$ "z RefactoringTool.refactor_doctestcCs|jr d}nd}|js$|jd|n&|jd|x|jD]}|j|q8W|jrt|jdx|jD]}|j|qbW|jrt|jdkr|jdn|jdt|jx&|jD]\}}}|j|f||qWdS) Nwerez need to bezNo files %s modified.zFiles that %s modified:z$Warnings/messages while refactoring:rzThere was 1 error:zThere were %d errors:)rqrurrprnr)rzrfilemessagerrrrrr summarizems$     zRefactoringTool.summarizecCs"|jj|j|||}t|_|S)zParses a block into a tree. This is necessary to get correct line number / offset information in the parser diagnostics and embedded into the parse tree. )rZ parse_tokens wrap_toksrPr)rzrrrrrrrrszRefactoringTool.parse_blockc cshtj|j||j}xN|D]F\}}\}}\} } } ||d7}| |d7} ||||f| | f| fVqWdS)z;Wraps a tokenize stream to systematically modify start/end.rN)rrL gen_lines__next__) rzrrrr1r#r]Zline0Zcol0Zline1Zcol1Z line_textrrrrs   zRefactoringTool.wrap_toksccs||j}||j}|}xV|D]N}|j|r@|t|dVn(||jdkrXdVntd||f|}qWx dVqrWdS)zGenerates lines as expected by tokenize from a list of lines. This strips the first len(indent + self.PS1) characters off each line. Nr>zline=%r, prefix=%rr})rrrrrAssertionError)rzrrprefix1Zprefix2prefixrrrrrs    zRefactoringTool.gen_lines)NN)FF)FF)FF)F)NFN)N)rr r!rhrrr{rrrrrrrrrrrrrrrrrrrrrrrrrrrrras: 4(   O  + rac@s eZdZdS)MultiprocessingUnsupportedN)rr r!rrrrrsrcsBeZdZfddZd fdd ZfddZfd d ZZS) MultiprocessRefactoringToolcs"tt|j||d|_d|_dS)N)superrr{queue output_lock)rzrkwargs)rrrr{sz$MultiprocessRefactoringTool.__init__Frcs|dkrttj|||Sy ddlWntk r@tYnXjdk rTtdj_j _ fddt |D}z.x|D] }|j qWttj|||Wdjj xt |D]}jjdqWx|D]}|jr|j qWd_XdS)Nrrz already doing multiple processescsg|]}jjdqS))target)ZProcess_child)r7r)multiprocessingrzrrr:sz8MultiprocessRefactoringTool.refactor..)rrrr ImportErrorrr RuntimeErrorZ JoinableQueueZLockrrangestartrputZis_alive)rzrrrZ num_processesZ processesr)r)r)rrzrrs2               z$MultiprocessRefactoringTool.refactorc sR|jj}xB|dk rL|\}}ztt|j||Wd|jjX|jj}q WdS)N)rrmrrrZ task_done)rzZtaskrr)rrrrs     z"MultiprocessRefactoringTool._childcs2|jdk r|jj||fntt|j||SdS)N)rrrrr)rzrr)rrrrs  z)MultiprocessRefactoringTool.refactor_file)FFr)rr r!r{rrr __classcell__rr)rrrs   r)T)rr)(r` __author__rrrorr+rM itertoolsrZpgen2rrrZ fixer_utilrr}rr r rvrr'rr$r5r;r= version_infocodecsrrrArCr^r_objectrarrrrrr sF      ( PKm;1]Zr~#__pycache__/__main__.cpython-36.pycnu[3 \C@s&ddlZddlmZejeddS)N)mainz lib2to3.fixes)sysrexitrr(/usr/lib64/python3.6/lib2to3/__main__.pys PKm;1]4PT!T!__pycache__/main.cpython-36.pycnu[3 \-@sdZddlmZmZddlZddlZddlZddlZddlZddl Z ddl m Z ddZ Gdd d e j Zd d Zdd d ZdS)z Main program for 2to3. )with_statementprint_functionN)refactorc Cs(|j}|j}tj||||ddddS)z%Return a unified diff of two strings.z (original)z (refactored))Zlineterm) splitlinesdifflibZ unified_diff)abfilenamer $/usr/lib64/python3.6/lib2to3/main.py diff_textss  rcs>eZdZdZd fdd ZddZfddZd d ZZS) StdoutRefactoringToola2 A refactoring tool that can avoid overwriting its input files. Prints output to stdout. Output files can optionally be written to a different directory and or have an extra file suffix appended to their name for use in situations where you do not want to replace the input files. rc sR||_||_|r(|jtj r(|tj7}||_||_||_tt |j |||dS)aF Args: fixers: A list of fixers to import. options: A dict with RefactoringTool configuration. explicit: A list of fixers to run even if they are explicit. nobackups: If true no backup '.bak' files will be created for those files that are being refactored. show_diffs: Should diffs of the refactoring be printed to stdout? input_base_dir: The base directory for all input files. This class will strip this path prefix off of filenames before substituting it with output_dir. Only meaningful if output_dir is supplied. All files processed by refactor() must start with this path. output_dir: If supplied, all converted files will be written into this directory tree instead of input_base_dir. append_suffix: If supplied, all files output by this tool will have this appended to their filename. Useful for changing .py to .py3 for example by passing append_suffix='3'. N) nobackups show_diffsendswithossep_input_base_dir _output_dir_append_suffixsuperr__init__) selfZfixersoptionsexplicitrrinput_base_dir output_dir append_suffix) __class__r r r$s zStdoutRefactoringTool.__init__cOs*|jj|||f|jj|f||dS)N)errorsappendloggererror)rmsgargskwargsr r r log_errorAszStdoutRefactoringTool.log_errorc !s||}|jrH|j|jr6tjj|j|t|jd}ntd||jf|jrX||j7}||krtjj |}tjj | r|rtj ||j d|||j s4|d}tjj|rytj|Wn.tk r}z|j d|WYdd}~XnXytj||Wn2tk r2}z|j d||WYdd}~XnXtt|j} | |||||j sbtj||||krxtj||dS)Nz5filename %s does not start with the input_base_dir %szWriting converted %s to %s.z.bakzCan't remove backup %szCan't rename %s to %s)r startswithrrpathjoinlen ValueErrorrdirnameisdirmakedirs log_messagerlexistsremoveOSErrorrenamerr write_fileshutilZcopymode) rZnew_textr Zold_textencodingZ orig_filenamerZbackuperrwrite)r r r r6Es@          z StdoutRefactoringTool.write_filecCs|r|jd|n|jd||jrt|||}yX|jdk rp|j&x|D] }t|qJWtjjWdQRXnx|D] }t|qvWWn"tk rt d|fdSXdS)NzNo changes to %sz Refactored %sz+couldn't encode %s's diff for your terminal) r1rrZ output_lockprintsysstdoutflushUnicodeEncodeErrorwarn)roldnewr ZequalZ diff_linesliner r r print_outputls"       z"StdoutRefactoringTool.print_output)rrr) __name__ __module__ __qualname____doc__rr(r6rD __classcell__r r )r r rs  'rcCstd|ftjddS)Nz WARNING: %s)file)r;r<stderr)r%r r r r@sr@c stjdd}|jddddd|jdd d gd d |jd dddddd|jddd gdd |jddddd|jddddd|jddddd|jd dd!d|jd"d#dd$d|jd%d&dd'd(d |jd)d*dd+d,d-d.|jd/d0dd1d|jd2dd+d,d3d.d'}i}|j|\}}|jr@d4|d5<|js:td6d4|_|jr\|j r\|j d7|j rx|j rx|j d8|j r|j rtd9|j r|jr|j d:|j rt d;xtjD]}t |qW|sdt d?tjd>d@SdA|kr4d4}|jr4t dBtjd>d@S|jrDd4|dC<|jrRtjntj}tjdD|dEtjdF}ttj} tfdGdH|jD} t} |jrd'} x2|jD](} | dIkrd4} n| jdJ| qW| r| j| n| }n | j| }|j| }t j!j"|}|rD|j#t j$ rDt j!j%| rDt j!j&|}|jrh|j't j$}|j(dK|j|t)t*||t*| |j|j ||j|j dL}|j+s|r|j,nRy|j||j|j-|j.Wn6tj/k r|j.dkst0t dMtjd>dSX|j1t2t3|j+S)NzMain program. Args: fixer_pkg: the name of a package where the fixers are located. args: optional; a list of command line arguments. If omitted, sys.argv[1:] is used. Returns a suggested exit status (0, 1, 2). z2to3 [options] file|dir ...)Zusagez-dz--doctests_only store_truezFix up doctests only)actionhelpz-fz--fixr"z1Each FIX specifies a transformation; default: all)rMdefaultrNz-jz --processesZstorerintzRun 2to3 concurrently)rMrOtyperNz-xz--nofixz'Prevent a transformation from being runz-lz --list-fixeszList available transformationsz-pz--print-functionz0Modify the grammar so that print() is a functionz-vz --verbosezMore verbose loggingz --no-diffsz#Don't show diffs of the refactoringz-wz--writezWrite back modified filesz-nz --nobackupsFz&Don't write backups for modified filesz-oz --output-dirstrrzXPut output files in this directory instead of overwriting the input files. Requires -n.)rMrQrOrNz-Wz--write-unchanged-fileszYAlso write files even if no changes were required (useful with --output-dir); implies -w.z --add-suffixzuAppend this string to all output filenames. Requires -n if non-empty. ex: --add-suffix='3' will generate .py3 files.Twrite_unchanged_filesz&--write-unchanged-files/-W implies -w.z%Can't use --output-dir/-o without -n.z"Can't use --add-suffix without -n.z@not writing files and not printing diffs; that's not very usefulzCan't use -n without -wz2Available transformations for the -f/--fix option:rz1At least one file or directory argument required.)rJzUse --help to show usage.-zCan't write to stdin.rz%(name)s: %(message)s)formatlevelz lib2to3.mainc3s|]}d|VqdS)z.fix_Nr ).0fix) fixer_pkgr r szmain..allz.fix_z7Output in %r will mirror the input directory %r layout.)rrrz+Sorry, -j isn't supported on this platform.)4optparseZ OptionParserZ add_option parse_argsrSr:r@rrr$Z add_suffixZno_diffsZ list_fixesr;rZget_all_fix_namesr<rKrverboseloggingDEBUGINFOZ basicConfigZ getLoggersetZget_fixers_from_packageZnofixrYaddunion differencerr* commonprefixrrr/r.rstripinforsortedr!refactor_stdinZ doctests_onlyZ processesZMultiprocessingUnsupportedAssertionErrorZ summarizerPbool)rZr&parserrkflagsrZfixnamerWr#Z avail_fixesZunwanted_fixesrZ all_presentrYZ requestedZ fixer_namesrZrtr )rZr mains                                 rp)N)rHZ __future__rrr<rrr`r7r]rrrZMultiprocessRefactoringToolrr@rpr r r r s  gPKm;1]{K{{)__pycache__/__init__.cpython-36.opt-1.pycnu[3 \@sdS)Nrrr(/usr/lib64/python3.6/lib2to3/__init__.pysPKm;1]\!Y(__pycache__/patcomp.cpython-36.opt-1.pycnu[3 \@sdZdZddlZddlmZmZmZmZmZm Z ddl m Z ddl m Z Gdd d e Zd d ZGd d d eZejejejddZddZddZddZdS)zPattern compiler. The grammar is taken from PatternGrammar.txt. The compiler compiles a pattern to a pytree.*Pattern instance. z#Guido van Rossum N)driverliteralstokentokenizeparsegrammar)pytree)pygramc@s eZdZdS)PatternSyntaxErrorN)__name__ __module__ __qualname__rr'/usr/lib64/python3.6/lib2to3/patcomp.pyr sr c csPtjtjtjh}tjtj|j}x(|D] }|\}}}}}||kr(|Vq(WdS)z6Tokenizes a string suppressing significant whitespace.N) rNEWLINEINDENTDEDENTrgenerate_tokensioStringIOreadline) inputskiptokensZ quintupletypevaluestartendZ line_textrrrtokenize_wrappers  rc@s:eZdZd ddZdddZddZdd d Zd d ZdS)PatternCompilerNcCsZ|dkrtj|_tj|_ntj||_tj|j|_tj|_ tj |_ tj |jt d|_dS)z^Initializer. Takes an optional alternative filename for the pattern grammar. N)Zconvert)r Zpattern_grammarrZpattern_symbolssymsrZ load_grammarZSymbolsZpython_grammarZ pygrammarZpython_symbolspysymsZDriverpattern_convert)selfZ grammar_filerrr__init__(s  zPatternCompiler.__init__FcCsnt|}y|jj||d}Wn0tjk rL}ztt|WYdd}~XnX|r`|j||fS|j|SdS)z=Compiles a pattern string to a nested pytree.*Pattern object.)debugN)rrZ parse_tokensrZ ParseErrorr str compile_node)r$rr&Z with_treerrooterrrcompile_pattern7szPatternCompiler.compile_patternc sV|jjjkr|jd}|jjjkrzfdd|jdddD}t|dkrX|dStjdd|Dddd}|jS|jjj krʇfd d|jD}t|dkr|dStj|gddd}|jS|jjj krj |jdd}tj |}|jSd}|j}t|d kr>|djt jkr>|dj}|dd}d}t|dkrx|d jjjkrx|d }|dd}j ||}|dk r>|j} | d} | jt jkrd} tj} nX| jt jkrd} tj} n>| jt jkrj| d} } t| d krj| d } n| dks"| dkr>|j}tj|gg| | d}|dk rN||_|jS)zXCompiles a node, recursively. This is one big switch on the node type. rcsg|]}j|qSr)r().0ch)r$rr Osz0PatternCompiler.compile_node..NrcSsg|] }|gqSrr)r,arrrr.Rs)minmaxcsg|]}j|qSr)r()r,r-)r$rrr.Vsr5r5)rr!ZMatcherchildrenZ Alternativeslenr WildcardPatternoptimizeZ AlternativeZ NegatedUnit compile_basicZNegatedPatternrEQUALrZRepeaterSTARZHUGEPLUSLBRACEget_intname) r$nodeZaltspZunitspatternr@nodesrepeatr6Zchildr1r2r)r$rr(Cs^       "    zPatternCompiler.compile_nodecCs@|d}|jtjkr4ttj|j}tjt ||S|jtj kr|j}|j r|t krbt d||ddrvt dtjt |S|dkrd}n,|jdst|j|d}|dkrt d||ddr|j|djdg}nd}tj||SnH|jdkr|j|dS|jd kr<|j|d}tj|ggddd SdS) NrzInvalid token: %rrzCan't have details for tokenany_zInvalid symbol: %r([)r1r2)rrSTRINGr'rZ evalStringrr Z LeafPattern_type_of_literalNAMEisupper TOKEN_MAPr startswithgetattrr"r(r6Z NodePatternr8)r$rDrErArrZcontent subpatternrrrr:s8         zPatternCompiler.compile_basiccCs t|jS)N)intr)r$rArrrr?szPatternCompiler.get_int)N)FF)N)r r rr%r+r(r:r?rrrrr &s   G #r )rLrJNUMBERZTOKENcCs.|djrtjS|tjkr&tj|SdSdS)Nr)isalpharrLrZopmap)rrrrrKs    rKcCs>|\}}}}|s||jkr*tj|||dStj|||dSdS)z9Converts raw node information to a Node or Leaf instance.)contextN)Z number2symbolr ZNodeZLeaf)rZ raw_node_inforrrUr6rrrr#s r#cCs tj|S)N)r r+)rCrrrr+sr+)__doc__ __author__rZpgen2rrrrrrr r Exceptionr robjectr rLrJrSrNrKr#r+rrrr s       PKm;1]O'__pycache__/pygram.cpython-36.opt-2.pycnu[3 \@sddlZddlmZddlmZddlmZejjejje dZ ejjejje dZ Gdd d e Z ejd e Ze eZejZejd =ejd e Ze eZdS) N)token)driver)pytreez Grammar.txtzPatternGrammar.txtc@seZdZddZdS)SymbolscCs(x"|jjD]\}}t|||q WdS)N)Z symbol2numberitemssetattr)selfZgrammarnameZsymbolr &/usr/lib64/python3.6/lib2to3/pygram.py__init__szSymbols.__init__N)__name__ __module__ __qualname__r r r r r rsrZlib2to3print)osZpgen2rrrpathjoindirname__file__Z _GRAMMAR_FILEZ_PATTERN_GRAMMAR_FILEobjectrZload_packaged_grammarZpython_grammarZpython_symbolscopyZ!python_grammar_no_print_statementkeywordsZpattern_grammarZpattern_symbolsr r r r s     PKm;1]7`4$__pycache__/btm_utils.cpython-36.pycnu[3 \&@s|dZddlmZddlmZmZddlmZmZeZ eZ ej Z eZ dZdZdZGdddeZdd d Zd d ZddZd S)z0Utility functions used by the btm_matcher module)pytree)grammartoken)pattern_symbolspython_symbolsc@s:eZdZdZd ddZddZddZd d Zd d ZdS)MinNodezThis class serves as an intermediate representation of the pattern tree during the conversion to sets of leaf-to-root subpatternsNcCs.||_||_g|_d|_d|_g|_g|_dS)NF)typenamechildrenleafparent alternativesgroup)selfr r r)/usr/lib64/python3.6/lib2to3/btm_utils.py__init__szMinNode.__init__cCst|jdt|jS)N )strr r )rrrr__repr__szMinNode.__repr__cCs|}g}x|r|jtkr`|jj|t|jt|jkrTt|jg}g|_|j}q n |j}d}P|jtkr|j j|t|j t|jkrt |j }g|_ |j}q n |j}d}P|jt j kr|j r|j|j n |j|j|j}q W|S)zInternal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a singleN)r TYPE_ALTERNATIVESrappendlenr tupler TYPE_GROUPrget_characteristic_subpattern token_labelsNAMEr )rnodesubprrr leaf_to_root!s8        zMinNode.leaf_to_rootcCs&x |jD]}|j}|r |Sq WdS)aDrives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton's capabilities, leaf_to_root merges each group into a single choice based on 'characteristic'ity, i.e. (a|b c) -> (a|b) if b more characteristic than c Returns: The most 'characteristic'(as defined by get_characteristic_subpattern) path for the compiled pattern tree. N)leavesr")rlr!rrrget_linear_subpatternKszMinNode.get_linear_subpatternccs.x|jD]}|jEdHqW|js*|VdS)z-Generator that returns the leaves of the treeN)r r#)rchildrrrr#`s zMinNode.leaves)NN) __name__ __module__ __qualname____doc__rrr"r%r#rrrrr s  *r Nc Csd}|jtjkr|jd}|jtjkrt|jdkrFt|jd|}nJttd}x>|jD]4}|jj |drnqXt||}|dk rX|jj |qXWn|jtj krt|jdkrtt d}x(|jD]}t||}|r|jj |qW|jsd}nt|jd|}n|jtj krt|jdtjrH|jdjdkrHt|jd|St|jdtjrn|jdjdkst|jdkrt|jddr|jdjdkrdSd }d}d}d }d} d } xn|jD]d}|jtjkrd }|}n*|jtjkrd }|} n|jtjkr |}t|dr|jd krd } qW| rb|jd} t| drl| jdkrl|jd } n |jd} | jtjkr| jd krttd}n4tt| jrttt| jd}nttt| jd}n\| jtjkr | jjd} | tkrtt| d}nttj| d}n| jtjkr$t||}|rZ| jdjdkrBd}n| jdjdkrVnt|r|dk rx8|jddD]&}t||}|dk rz|jj |qzW|r||_|S)z Internal function. Reduces a compiled pattern tree to an intermediate representation suitable for feeding the automaton. This also trims off any optional pattern elements(like [a], a*). Nr)r r([valueTF=rany')r r *+)r symsZMatcherr Z Alternativesr reduce_treer rindexrZ AlternativerZUnit isinstancerZLeafr.hasattrZDetailsZRepeaterrrTYPE_ANYgetattrpysymsSTRINGstriptokensNotImplementedErrorr) r rZnew_noder&Zreducedr Z details_nodeZalternatives_nodeZ has_repeaterZ repeater_nodeZhas_variable_nameZ name_leafr rrrr6gs                     r6cst|ts|St|dkr"|dSg}g}dddddgg}dxl|D]d}tt|d d rFtt|fd d r~|j|qFtt|fd d r|j|qF|j|qFW|r|}n|r|}n|r|}t|td S)zPicks the most characteristic from a list of linear patterns Current order used is: names > common_names > common_chars rr+inforifnotNonez[]().,:cSs t|tkS)N)r r)xrrrsz/get_characteristic_subpattern..cst|to|kS)N)r8r)rF) common_charsrrrGscst|to|kS)N)r8r)rF) common_namesrrrGs)key)r8listrr0rec_testrmax)Z subpatternsZsubpatterns_with_namesZsubpatterns_with_common_namesZsubpatterns_with_common_chars subpatternr)rHrIrrs2     rccs<x6|D].}t|ttfr*t||EdHq||VqWdS)zPTests test_func on all items of sequence and items of included sub-iterablesN)r8rKrrL)ZsequenceZ test_funcrFrrrrLs rLr4)N)r*rZpgen2rrZpygramrrr5r<Zopmapr?rr:rrobjectr r6rrLrrrrs W %PKm;1]" &&+__pycache__/fixer_util.cpython-36.opt-2.pycnu[3 \g; @sddlmZddlmZmZddlmZddlm Z ddZ ddZ d d Z d d Z dVddZddZddZddZe e fddZdWddZddZddZdXddZd d!ZdYd"d#ZdZd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1d2d3d4d5d6d7d8d9h Zd:d;Z da#d?a$d@dAZ%dBdCZ&dDdEZ'dFdGZ(dHdIZ)dJdKZ*dLdMZ+dNdOZ,ej-ej.hZ/d[dPdQZ0ej.ej-ej1hZ2dRdSZ3d\dTdUZ4d S)])token)LeafNode)python_symbols)patcompcCsttj|ttjd|gS)N=)rsymsZargumentrrEQUAL)keywordvaluer */usr/lib64/python3.6/lib2to3/fixer_util.py KeywordArgsrcCs ttjdS)N()rrLPARr r r r LParensrcCs ttjdS)N))rrRPARr r r r RParensrcCsHt|ts|g}t|ts&d|_|g}ttj|ttjdddg|S)N r)prefix) isinstancelistrrratomrrr )targetsourcer r r Assigns  rNcCsttj||dS)N)r)rrNAME)namerr r r Name$srcCs|ttjt|ggS)N)rrtrailerDot)objattrr r r Attr(sr$cCs ttjdS)N,)rrCOMMAr r r r Comma,sr'cCs ttjdS)N.)rrDOTr r r r r!0sr!cCs4ttj|j|jg}|r0|jdttj||S)Nr)rrr clone insert_childarglist)argsZlparenZrparennoder r r ArgList4sr/cCs&ttj|t|g}|dk r"||_|S)N)rrpowerr/r)Z func_namer-rr.r r r Call;sr1cCs ttjdS)N )rrNEWLINEr r r r NewlineBsr4cCs ttjdS)N)rrr3r r r r BlankLineFsr6cCsttj||dS)N)r)rrNUMBER)nrr r r NumberJsr9cCs"ttjttjd|ttjdgS)N[])rrr rrLBRACERBRACE)Z index_noder r r SubscriptMsr>cCsttj||dS)N)r)rrSTRING)stringrr r r StringSsrAc Csd|_d|_d|_ttjd}d|_ttjd}d|_||||g}|rtd|_ttjd}d|_|jttj||gttj|ttj |g}ttj ttj d|ttj dgS)Nr5rforinifr:r;) rrrrappendrrZcomp_ifZ listmakerZcomp_forrr<r=) ZxpfpitZtestZfor_leafZin_leafZ inner_argsZif_leafinnerr r r ListCompWs$     rIcCsZx|D] }|jqWttjdttj|ddttjdddttj|g}ttj|}|S)Nfromr)rimport)removerrrrrimport_as_names import_from)Z package_nameZ name_leafsZleafchildrenimpr r r FromImportos    rQc Cs|dj}|jtjkr"|j}nttj|jg}|d}|rNdd|D}ttjtt|dt|dttj|dj||djgg|}|j |_ |S) Nr"aftercSsg|] }|jqSr )r*).0r8r r r sz!ImportAndCall..rZlparZrpar) r*typerr,rr0r$rr r)r.resultsnamesr"Z newarglistrRnewr r r ImportAndCalls   DrZcCst|tr |jttgkr dSt|tot|jdkot|jdtot|jdtot|jdto|jdjdko|jdjdkS)NTrUrrr)rrrOrrlenrr )r.r r r is_tuples r^cCsXt|toVt|jdkoVt|jdtoVt|jdtoV|jdjdkoV|jdjdkS)NrrUr:r;r_)rrr]rOrr )r.r r r is_lists  r`cCsttjt|tgS)N)rrrrr)r.r r r parenthesizesrasortedrsetanyalltuplesumminmax enumerateccs(t||}x|r"|Vt||}q WdS)N)getattr)r"r#nextr r r attr_chains rmzefor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > z power< ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | 'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) ) trailer< '(' node=any ')' > any* > z` power< ( 'sorted' | 'enumerate' ) trailer< '(' arglist ')' > any* > FcCsrts&tjtatjtatjtadatttg}x|jtjkr|S|j}|jd}|_ttj|g}||_|S)N)rVrr|r*rnr)r.rnr|r r r make_suites rcCs(x"|jtjkr"|j}|stdqW|S)Nz,root found before file_input node was found.)rVrZ file_inputrn ValueError)r.r r r find_root&s  rcCst|t||}t|S)N) find_bindingrbool)packagerr.Zbindingr r r does_tree_import/srcCs|jtjtjfkS)N)rVr import_namerN)r.r r r is_import7src Cs4dd}t|}t|||r dSd}}xTt|jD]F\}}||sFq4x(t|j|dD]\}}||sZPqZW||}Pq4W|dkrxDt|jD]6\}}|jtjkr|jr|jdjtjkr|d}PqW|dkrt tj t tj dt tj |ddg} nt |t tj |ddg} | tg} |j|t tj| dS)NcSs |jtjko|jot|jdS)NrU)rVr simple_stmtrOr)r.r r r is_import_stmt>sz$touch_import..is_import_stmtrUrrKr)r)rrrjrOrVrrrr?rrrrrQr4r+) rrr.rrootZ insert_posoffsetidxZnode2import_rOr r r touch_import;s4   rcCsx|jD]}d}|jtjkrVt||jdr4|St|t|jd|}|rR|}n4|jtjtjfkrt|t|jd|}|r|}n|jtj krt|t|jd|}|r|}nXxt |jddD]@\}}|jt j ko|j dkrt|t|j|d|}|r|}qWnx|jtkr6|jdj |kr6|}nTt|||rJ|}n@|jtjkrft|||}n$|jtjkrt||jdr|}|r |s|St|r |Sq WdS) Nrr\r[:rUr_r_)rOrVrZfor_stmt_findrrZif_stmtZ while_stmtZtry_stmtrjrCOLONr _def_syms_is_import_bindingrryr)rr.rchildZretr8iZkidr r r risH  rcCsX|g}xL|rR|j}|jdkr6|jtkr6|j|jq|jtjkr|j|kr|SqWdS)N)poprV _block_symsextendrOrrr )rr.Znodesr r r rsrcCs|jtjkr| r|jd}|jtjkrvx|jD]@}|jtjkrV|jdj|krp|Sq0|jtjkr0|j|kr0|Sq0WnL|jtjkr|jd}|jtjkr|j|kr|Sn|jtjkr|j|kr|Sn|jtj kr|rt |jdj |krdS|jd}|rt d|rdS|jtj kr.t ||r.|S|jtjkrf|jd}|jtjkr|j|kr|Sn6|jtjkr|j|kr|S|r|jtjkr|SdS)Nrr\r[asr_)rVrrrOZdotted_as_namesZdotted_as_namer rrrNstrstriprrMZimport_as_nameSTAR)r.rrrPrZlastr8r r r rs@         r)N)NN)N)N)N)N)N)5Zpgen2rZpytreerrZpygramrrr5rrrrrrr$r'r!r/r1r4r6r9r>rArIrQrZr^r`raZconsuming_callsrmrprqrrrorvr{rrrrrrrxrwrrr rrrr r r r sX            -  * PKm;1]2!2!%__pycache__/main.cpython-36.opt-1.pycnu[3 \-@sdZddlmZmZddlZddlZddlZddlZddlZddl Z ddl m Z ddZ Gdd d e j Zd d Zdd d ZdS)z Main program for 2to3. )with_statementprint_functionN)refactorc Cs(|j}|j}tj||||ddddS)z%Return a unified diff of two strings.z (original)z (refactored))Zlineterm) splitlinesdifflibZ unified_diff)abfilenamer $/usr/lib64/python3.6/lib2to3/main.py diff_textss  rcs>eZdZdZd fdd ZddZfddZd d ZZS) StdoutRefactoringToola2 A refactoring tool that can avoid overwriting its input files. Prints output to stdout. Output files can optionally be written to a different directory and or have an extra file suffix appended to their name for use in situations where you do not want to replace the input files. rc sR||_||_|r(|jtj r(|tj7}||_||_||_tt |j |||dS)aF Args: fixers: A list of fixers to import. options: A dict with RefactoringTool configuration. explicit: A list of fixers to run even if they are explicit. nobackups: If true no backup '.bak' files will be created for those files that are being refactored. show_diffs: Should diffs of the refactoring be printed to stdout? input_base_dir: The base directory for all input files. This class will strip this path prefix off of filenames before substituting it with output_dir. Only meaningful if output_dir is supplied. All files processed by refactor() must start with this path. output_dir: If supplied, all converted files will be written into this directory tree instead of input_base_dir. append_suffix: If supplied, all files output by this tool will have this appended to their filename. Useful for changing .py to .py3 for example by passing append_suffix='3'. N) nobackups show_diffsendswithossep_input_base_dir _output_dir_append_suffixsuperr__init__) selfZfixersoptionsexplicitrrinput_base_dir output_dir append_suffix) __class__r r r$s zStdoutRefactoringTool.__init__cOs*|jj|||f|jj|f||dS)N)errorsappendloggererror)rmsgargskwargsr r r log_errorAszStdoutRefactoringTool.log_errorc !s||}|jrH|j|jr6tjj|j|t|jd}ntd||jf|jrX||j7}||krtjj |}tjj | r|rtj ||j d|||j s4|d}tjj|rytj|Wn.tk r}z|j d|WYdd}~XnXytj||Wn2tk r2}z|j d||WYdd}~XnXtt|j} | |||||j sbtj||||krxtj||dS)Nz5filename %s does not start with the input_base_dir %szWriting converted %s to %s.z.bakzCan't remove backup %szCan't rename %s to %s)r startswithrrpathjoinlen ValueErrorrdirnameisdirmakedirs log_messagerlexistsremoveOSErrorrenamerr write_fileshutilZcopymode) rZnew_textr Zold_textencodingZ orig_filenamerZbackuperrwrite)r r r r6Es@          z StdoutRefactoringTool.write_filecCs|r|jd|n|jd||jrt|||}yX|jdk rp|j&x|D] }t|qJWtjjWdQRXnx|D] }t|qvWWn"tk rt d|fdSXdS)NzNo changes to %sz Refactored %sz+couldn't encode %s's diff for your terminal) r1rrZ output_lockprintsysstdoutflushUnicodeEncodeErrorwarn)roldnewr ZequalZ diff_linesliner r r print_outputls"       z"StdoutRefactoringTool.print_output)rrr) __name__ __module__ __qualname____doc__rr(r6rD __classcell__r r )r r rs  'rcCstd|ftjddS)Nz WARNING: %s)file)r;r<stderr)r%r r r r@sr@c stjdd}|jddddd|jdd d gd d |jd dddddd|jddd gdd |jddddd|jddddd|jddddd|jd dd!d|jd"d#dd$d|jd%d&dd'd(d |jd)d*dd+d,d-d.|jd/d0dd1d|jd2dd+d,d3d.d'}i}|j|\}}|jr@d4|d5<|js:td6d4|_|jr\|j r\|j d7|j rx|j rx|j d8|j r|j rtd9|j r|jr|j d:|j rt d;xtjD]}t |qW|sdt d?tjd>d@SdA|kr4d4}|jr4t dBtjd>d@S|jrDd4|dC<|jrRtjntj}tjdD|dEtjdF}ttj} tfdGdH|jD} t} |jrd'} x2|jD](} | dIkrd4} n| jdJ| qW| r| j| n| }n | j| }|j| }t j!j"|}|rD|j#t j$ rDt j!j%| rDt j!j&|}|jrh|j't j$}|j(dK|j|t)t*||t*| |j|j ||j|j dL}|j+s|r|j,nBy|j||j|j-|j.Wn&tj/k rt dMtjd>dSX|j0t1t2|j+S)NzMain program. Args: fixer_pkg: the name of a package where the fixers are located. args: optional; a list of command line arguments. If omitted, sys.argv[1:] is used. Returns a suggested exit status (0, 1, 2). z2to3 [options] file|dir ...)Zusagez-dz--doctests_only store_truezFix up doctests only)actionhelpz-fz--fixr"z1Each FIX specifies a transformation; default: all)rMdefaultrNz-jz --processesZstorerintzRun 2to3 concurrently)rMrOtyperNz-xz--nofixz'Prevent a transformation from being runz-lz --list-fixeszList available transformationsz-pz--print-functionz0Modify the grammar so that print() is a functionz-vz --verbosezMore verbose loggingz --no-diffsz#Don't show diffs of the refactoringz-wz--writezWrite back modified filesz-nz --nobackupsFz&Don't write backups for modified filesz-oz --output-dirstrrzXPut output files in this directory instead of overwriting the input files. Requires -n.)rMrQrOrNz-Wz--write-unchanged-fileszYAlso write files even if no changes were required (useful with --output-dir); implies -w.z --add-suffixzuAppend this string to all output filenames. Requires -n if non-empty. ex: --add-suffix='3' will generate .py3 files.Twrite_unchanged_filesz&--write-unchanged-files/-W implies -w.z%Can't use --output-dir/-o without -n.z"Can't use --add-suffix without -n.z@not writing files and not printing diffs; that's not very usefulzCan't use -n without -wz2Available transformations for the -f/--fix option:rz1At least one file or directory argument required.)rJzUse --help to show usage.-zCan't write to stdin.rz%(name)s: %(message)s)formatlevelz lib2to3.mainc3s|]}d|VqdS)z.fix_Nr ).0fix) fixer_pkgr r szmain..allz.fix_z7Output in %r will mirror the input directory %r layout.)rrrz+Sorry, -j isn't supported on this platform.)3optparseZ OptionParserZ add_option parse_argsrSr:r@rrr$Z add_suffixZno_diffsZ list_fixesr;rZget_all_fix_namesr<rKrverboseloggingDEBUGINFOZ basicConfigZ getLoggersetZget_fixers_from_packageZnofixrYaddunion differencerr* commonprefixrrr/r.rstripinforsortedr!refactor_stdinZ doctests_onlyZ processesZMultiprocessingUnsupportedZ summarizerPbool)rZr&parserrkflagsrZfixnamerWr#Z avail_fixesZunwanted_fixesrZ all_presentrYZ requestedZ fixer_namesrZrtr )rZr mains                                 ro)N)rHZ __future__rrr<rrr`r7r]rrrZMultiprocessRefactoringToolrr@ror r r r s  gPKm;1]`l::'__pycache__/pytree.cpython-36.opt-2.pycnu[3 \m@sdZddlZddlZddlmZdZiaddZGdddeZ Gd d d e Z Gd d d e Z d dZ GdddeZ Gddde ZGddde ZGddde ZGddde ZddZdS)z#Guido van Rossum N)StringIOicCsHtst|jjD].\}}||kr|jj|jj|=d|_|SqWdS)N)r" enumerater#r&)rir.r r rremoves  z Base.removec CsZ|jdkrdSxFt|jjD]6\}}||kry|jj|dStk rPdSXqWdS)Nr)r"r1r# IndexError)rr2childr r r next_siblings zBase.next_siblingcCsP|jdkrdSxszNode.clone..)rJ)rIrr#rJ)rr r rrsz Node.cloneccs(x|jD]}|jEdHqW|VdS)N)r#r)rr5r r rrs zNode.post_orderccs(|Vx|jD]}|jEdHqWdS)N)r#r)rr5r r rr s zNode.pre_ordercCs|js dS|jdjS)Nr:r)r#r;)rr r r_prefix_getterszNode._prefix_gettercCs|jr||jd_dS)Nr)r#r;)rr;r r r_prefix_setterszNode._prefix_settercCs(||_d|j|_||j|<|jdS)N)r"r#r&)rr2r5r r r set_child!s  zNode.set_childcCs ||_|jj|||jdS)N)r"r#insertr&)rr2r5r r r insert_child+szNode.insert_childcCs||_|jj||jdS)N)r"r#r%r&)rr5r r r append_child4s zNode.append_child)NNN)r=r)rBrCrDrLrMrPrGrHrArrrrrSrTrFr;rUrWrXr r r rrIs"     rIc@seZdZdZdZdZddgfddZddZdd Ze j dkrBeZ d d Z d dZ ddZddZddZddZddZeeeZdS)r,r:rNcCsF|dk r|\|_\|_|_||_||_|dk r4||_|dd|_dS)N)_prefixr-columnrvaluerJ)rrr[rKr;rJr r rrLGs z Leaf.__init__cCsd|jj|j|jfS)Nz %s(%r, %r))rrBrr[)rr r rrMZsz Leaf.__repr__cCs|jt|jS)N)r;r?r[)rr r rrP`szLeaf.__unicode__r=cCs|j|jf|j|jfkS)N)rr[)rrr r rrkszLeaf._eqcCs$t|j|j|j|j|jff|jdS)N)rJ)r,rr[r;r-rZrJ)rr r rros z Leaf.cloneccs |VdS)Nr )rr r rr8usz Leaf.leavesccs |VdS)Nr )rr r rrxszLeaf.post_orderccs |VdS)Nr )rr r rr|szLeaf.pre_ordercCs|jS)N)rY)rr r rrSszLeaf._prefix_gettercCs|j||_dS)N)r&rY)rr;r r rrTszLeaf._prefix_setter)r=r)rBrCrDrYr-rZrLrMrPrGrHrArrr8rrrSrTrFr;r r r rr,>s$  r,cCsN|\}}}}|s||jkrt|}x$t|D]\}}t|tr"d|_q"W||_||_||_dS)NT)r!r1r WildcardPattern wildcardsrr`r )rrr`r r2itemr r rrL%s  zNodePattern.__init__cCs|jrJx>t|j|jD],\}}|t|jkr|dk r>|j|dSqWdSt|jt|jkrbdSx*t|j|jD]\}}|j||srdSqrWdS)NTF)rnrjr`r#r\rdziprg)rr.recrf subpatternr5r r rrcBs   zNodePattern._submatch)NNN)N)rBrCrDrnrLrcr r r rrl!s rlc@sZeZdZddedfddZddZdddZdd d Zd d Zd dZ ddZ ddZ dS)rmNrcCs@|dk r$ttt|}x |D]}qW||_||_||_||_dS)N)tuplerOr`minmaxr )rr`rtrur altr r rrLls zWildcardPattern.__init__cCsd}|jdk r\}}|t|kr |dk rF|j||jrFt|||j<dSq WdS)NTF)rjr\rdr r!)rrhrerqrfr r rris  zWildcardPattern.match_seqccs:|jdkrXxJt|jdtt||jD]*}i}|jrH|d|||j<||fVq(Wn|jdkrp|j|Vnttdrtj }t t_ zy@x:|j |dD]*\}}|jr|d|||j<||fVqWWnRt k rx:|j |D],\}}|jr |d|||j<||fVqWYnXWdttdr4|t_ XdS)NrZ bare_name getrefcountr)r`rangertr\rur _bare_name_matcheshasattrrGstderrr_recursive_matches RuntimeError_iterative_matches)rrhcountrfZ save_stderrr r rrjs. "   z WildcardPattern.generate_matchesc cs t|}d|jkrdifVg}x>|jD]4}x.t||D] \}}||fV|j||fq8Wq(Wx|rg}x|D]\}} ||krr||jkrrxn|jD]d}x^t|||dD]H\} } | dkri}|j| |j| || |fV|j|| |fqWqWqrW|}qbWdS)Nr)r\rtr`rjr%rurd) rrhZnodelenrervrqrfZ new_resultsc0r0c1r1r r rr~s*       z"WildcardPattern._iterative_matchescCsxd}i}d}t|}xH| r\||kr\d}x0|jD]&}|dj|||r0|d7}d}Pq0WqW|d|||j<||fS)NrFTr)r\r`rgr )rrhrrfdoneruZleafr r rrys  z"WildcardPattern._bare_name_matchesc cs||jkrdifV||jkrxr|jD]h}xbt||D]T\}}xJ|j||d|dD].\}}i}|j||j||||fVqXWq6Wq&WdS)Nrr)rtrur`rjr|rd) rrhrrvrrrrrfr r rr| s    "  z"WildcardPattern._recursive_matches)N)N) rBrCrDHUGErLrbrgrirjr~ryr|r r r rrm^s#  -rmc@s.eZdZd ddZddZddZdd ZdS) NegatedPatternNcCs|dk r||_dS)N)r`)rr`r r rrLs zNegatedPattern.__init__cCsdS)NFr )rr.r r rrg)szNegatedPattern.matchcCs t|dkS)Nr)r\)rrhr r rri-szNegatedPattern.match_seqccsL|jdkr"t|dkrHdifVn&x|jj|D] \}}dSWdifVdS)Nr)r`r\rj)rrhrqrfr r rrj1s    zNegatedPattern.generate_matches)N)rBrCrDrLrgrirjr r r rrs rc cs|sdifVn|d|dd}}xl|j|D]^\}}|sJ||fVq2xDt|||dD].\}}i}|j||j||||fVq^Wq2WdS)Nrr)rjrd) Zpatternsrhprestrrrrrfr r rrj=s     rj) __author__rGwarningsiorrrrrrrIr,r]r^rkrlrmrrjr r r r s$  1nNV,==#PKm;1]/?d//%__pycache__/fixer_util.cpython-36.pycnu[3 \g; @sdZddlmZddlmZmZddlmZddl m Z ddZ dd Z d d Z d d ZdWddZddZddZddZe e fddZdXddZddZddZdYdd Zd!d"ZdZd#d$Zd[d%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2d3d4d5d6d7d8d9d:h Z d;d<Z!d=a"d>a#d?a$d@a%dAdBZ&dCdDZ'dEdFZ(dGdHZ)dIdJZ*dKdLZ+dMdNZ,dOdPZ-ej.ej/hZ0d\dQdRZ1ej/ej.ej2hZ3dSdTZ4d]dUdVZ5dS)^z1Utility functions, node construction macros, etc.)token)LeafNode)python_symbols)patcompcCsttj|ttjd|gS)N=)rsymsZargumentrrEQUAL)keywordvaluer */usr/lib64/python3.6/lib2to3/fixer_util.py KeywordArgsrcCs ttjdS)N()rrLPARr r r r LParensrcCs ttjdS)N))rrRPARr r r r RParensrcCsHt|ts|g}t|ts&d|_|g}ttj|ttjdddg|S)zBuild an assignment statement r)prefix) isinstancelistrrratomrrr )targetsourcer r r Assigns  rNcCsttj||dS)zReturn a NAME leaf)r)rrNAME)namerr r r Name$srcCs|ttjt|ggS)zA node tuple for obj.attr)rrtrailerDot)objattrr r r Attr(sr$cCs ttjdS)z A comma leaf,)rrCOMMAr r r r Comma,sr'cCs ttjdS)zA period (.) leaf.)rrDOTr r r r r!0sr!cCs4ttj|j|jg}|r0|jdttj||S)z-A parenthesised argument list, used by Call()r)rrr clone insert_childarglist)argsZlparenZrparennoder r r ArgList4sr/cCs&ttj|t|g}|dk r"||_|S)zA function callN)rrpowerr/r)Z func_namer-rr.r r r Call;sr1cCs ttjdS)zA newline literal )rrNEWLINEr r r r NewlineBsr4cCs ttjdS)z A blank line)rrr3r r r r BlankLineFsr6cCsttj||dS)N)r)rrNUMBER)nrr r r NumberJsr9cCs"ttjttjd|ttjdgS)zA numeric or string subscript[])rrr rrLBRACERBRACE)Z index_noder r r SubscriptMsr>cCsttj||dS)z A string leaf)r)rrSTRING)stringrr r r StringSsrAc Csd|_d|_d|_ttjd}d|_ttjd}d|_||||g}|rtd|_ttjd}d|_|jttj||gttj|ttj |g}ttj ttj d|ttj dgS)zuA list comprehension of the form [xp for fp in it if test]. If test is None, the "if test" part is omitted. r5rforinifr:r;) rrrrappendrrZcomp_ifZ listmakerZcomp_forrr<r=) ZxpfpitZtestZfor_leafZin_leafZ inner_argsZif_leafinnerr r r ListCompWs$     rIcCsZx|D] }|jqWttjdttj|ddttjdddttj|g}ttj|}|S)zO Return an import statement in the form: from package import name_leafsfromr)rimport)removerrrrrimport_as_names import_from)Z package_nameZ name_leafsZleafchildrenimpr r r FromImportos    rQc Cs|dj}|jtjkr"|j}nttj|jg}|d}|rNdd|D}ttjtt|dt|dttj|dj||djgg|}|j |_ |S) zfReturns an import statement and calls a method of the module: import module module.name()r"aftercSsg|] }|jqSr )r*).0r8r r r sz!ImportAndCall..rZlparZrpar) r*typerr,rr0r$rr r)r.resultsnamesr"Z newarglistrRnewr r r ImportAndCalls   DrZcCst|tr |jttgkr dSt|tot|jdkot|jdtot|jdtot|jdto|jdjdko|jdjdkS)z(Does the node represent a tuple literal?TrUrrr)rrrOrrlenrr )r.r r r is_tuples r^cCsXt|toVt|jdkoVt|jdtoVt|jdtoV|jdjdkoV|jdjdkS)z'Does the node represent a list literal?rrUr:r;r_)rrr]rOrr )r.r r r is_lists  r`cCsttjt|tgS)N)rrrrr)r.r r r parenthesizesrasortedrsetanyalltuplesumminmax enumerateccs(t||}x|r"|Vt||}q WdS)alFollow an attribute chain. If you have a chain of objects where a.foo -> b, b.foo-> c, etc, use this to iterate over all objects in the chain. Iteration is terminated by getattr(x, attr) is None. Args: obj: the starting object attr: the name of the chaining attribute Yields: Each successive object in the chain. N)getattr)r"r#nextr r r attr_chains rmzefor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > z power< ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | 'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) ) trailer< '(' node=any ')' > any* > z` power< ( 'sorted' | 'enumerate' ) trailer< '(' arglist ')' > any* > FcCsrts&tjtatjtatjtadatttg}x|jtjkr|S|j}|jd}|_ttj|g}||_|S)N)rVrr|r*rnr)r.rnr|r r r make_suites rcCs(x"|jtjkr"|j}|stdqW|S)zFind the top level namespace.z,root found before file_input node was found.)rVrZ file_inputrn ValueError)r.r r r find_root&s  rcCst|t||}t|S)z Returns true if name is imported from package at the top level of the tree which node belongs to. To cover the case of an import like 'import foo', use None for the package and 'foo' for the name. ) find_bindingrbool)packagerr.Zbindingr r r does_tree_import/srcCs|jtjtjfkS)z0Returns true if the node is an import statement.)rVr import_namerN)r.r r r is_import7src Cs4dd}t|}t|||r dSd}}xTt|jD]F\}}||sFq4x(t|j|dD]\}}||sZPqZW||}Pq4W|dkrxDt|jD]6\}}|jtjkr|jr|jdjtjkr|d}PqW|dkrt tj t tj dt tj |ddg} nt |t tj |ddg} | tg} |j|t tj| dS) z\ Works like `does_tree_import` but adds an import statement if it was not imported. cSs |jtjko|jot|jdS)NrU)rVr simple_stmtrOr)r.r r r is_import_stmt>sz$touch_import..is_import_stmtNrUrrKr)r)rrrjrOrVrrrr?rrrrrQr4r+) rrr.rrootZ insert_posoffsetidxZnode2import_rOr r r touch_import;s4   rcCsx|jD]}d}|jtjkrVt||jdr4|St|t|jd|}|rR|}n4|jtjtjfkrt|t|jd |}|r|}n|jtj krt|t|jd|}|r|}nXxt |jddD]@\}}|jt j ko|j dkrt|t|j|d|}|r|}qWnx|jtkr6|jdj |kr6|}nTt|||rJ|}n@|jtjkrft|||}n$|jtjkrt||jdr|}|r |s|St|r |Sq WdS) z Returns the node which binds variable name, otherwise None. If optional argument package is supplied, only imports will be returned. See test cases for examples.Nrr\r[:rUr_r_)rOrVrZfor_stmt_findrrZif_stmtZ while_stmtZtry_stmtrjrCOLONr _def_syms_is_import_bindingrryr)rr.rchildZretr8iZkidr r r risH  rcCsX|g}xL|rR|j}|jdkr6|jtkr6|j|jq|jtjkr|j|kr|SqWdS)N)poprV _block_symsextendrOrrr )rr.Znodesr r r rsrcCs|jtjkr| r|jd}|jtjkrvx|jD]@}|jtjkrV|jdj|krp|Sq0|jtjkr0|j|kr0|Sq0WnL|jtjkr|jd}|jtjkr|j|kr|Sn|jtjkr|j|kr|Sn|jtj kr|rt |jdj |krdS|jd}|rt d|rdS|jtj kr.t ||r.|S|jtjkrf|jd}|jtjkr|j|kr|Sn6|jtjkr|j|kr|S|r|jtjkr|SdS)z Will reuturn node if node will import name, or node will import * from package. None is returned otherwise. See test cases for examples. rr\Nr[asr_)rVrrrOZdotted_as_namesZdotted_as_namer rrrNstrstriprrMZimport_as_nameSTAR)r.rrrPrZlastr8r r r rs@         r)N)NN)N)N)N)N)N)6__doc__Zpgen2rZpytreerrZpygramrrr5rrrrrrr$r'r!r/r1r4r6r9r>rArIrQrZr^r`raZconsuming_callsrmrprqrrrorvr{rrrrrrrxrwrrr rrrr r r r sZ            -  * PKm;1]ѝ*__pycache__/btm_utils.cpython-36.opt-2.pycnu[3 \&@sxddlmZddlmZmZddlmZmZeZeZ ej Z eZ dZ dZdZGdddeZdd d Zd d Zd dZdS))pytree)grammartoken)pattern_symbolspython_symbolsc@s6eZdZd ddZddZddZdd Zd d ZdS) MinNodeNcCs.||_||_g|_d|_d|_g|_g|_dS)NF)typenamechildrenleafparent alternativesgroup)selfr r r)/usr/lib64/python3.6/lib2to3/btm_utils.py__init__szMinNode.__init__cCst|jdt|jS)N )strr r )rrrr__repr__szMinNode.__repr__cCs|}g}x|r|jtkr`|jj|t|jt|jkrTt|jg}g|_|j}q n |j}d}P|jtkr|j j|t|j t|jkrt |j }g|_ |j}q n |j}d}P|jt j kr|j r|j|j n |j|j|j}q W|S)N)r TYPE_ALTERNATIVESrappendlenr tupler TYPE_GROUPrget_characteristic_subpattern token_labelsNAMEr )rnodesubprrr leaf_to_root!s8        zMinNode.leaf_to_rootcCs&x |jD]}|j}|r |Sq WdS)N)leavesr")rlr!rrrget_linear_subpatternKszMinNode.get_linear_subpatternccs.x|jD]}|jEdHqW|js*|VdS)N)r r#)rchildrrrr#`s zMinNode.leaves)NN)__name__ __module__ __qualname__rrr"r%r#rrrrr s  *r Nc Csd}|jtjkr|jd}|jtjkrt|jdkrFt|jd|}nJttd}x>|jD]4}|jj |drnqXt||}|dk rX|jj |qXWn|jtj krt|jdkrtt d}x(|jD]}t||}|r|jj |qW|jsd}nt|jd|}n|jtj krt|jdtjrH|jdjdkrHt|jd|St|jdtjrn|jdjdkst|jdkrt|jddr|jdjdkrdSd}d}d}d }d} d } xn|jD]d}|jtjkrd }|}n*|jtjkrd}|} n|jtjkr |}t|dr|jd krd} qW| rb|jd} t| drl| jdkrl|jd } n |jd} | jtjkr| jd krttd}n4tt| jrttt| jd}nttt| jd}n\| jtjkr | jjd } | tkrtt| d}nttj| d}n| jtjkr$t||}|rZ| jdjdkrBd}n| jdjdkrVnt|r|dk rx8|jddD]&}t||}|dk rz|jj |qzW|r||_|S)Nr)r r([valueTF=rany')r r *+)r symsZMatcherr Z Alternativesr reduce_treer rindexrZ AlternativerZUnit isinstancerZLeafr-hasattrZDetailsZRepeaterrrTYPE_ANYgetattrpysymsSTRINGstriptokensNotImplementedErrorr) r rZnew_noder&Zreducedr Z details_nodeZalternatives_nodeZ has_repeaterZ repeater_nodeZhas_variable_nameZ name_leafr rrrr5gs                     r5cst|ts|St|dkr"|dSg}g}dddddgg}dxl|D]d}tt|d d rFtt|fd d r~|j|qFtt|fd d r|j|qF|j|qFW|r|}n|r|}n|r|}t|td S)Nrr*inforifnotNonez[]().,:cSs t|tkS)N)r r)xrrrsz/get_characteristic_subpattern..cst|to|kS)N)r7r)rE) common_charsrrrFscst|to|kS)N)r7r)rE) common_namesrrrFs)key)r7listrr/rec_testrmax)Z subpatternsZsubpatterns_with_namesZsubpatterns_with_common_namesZsubpatterns_with_common_chars subpatternr)rGrHrrs2     rccs<x6|D].}t|ttfr*t||EdHq||VqWdS)N)r7rJrrK)ZsequenceZ test_funcrErrrrKs rKr3)N)rZpgen2rrZpygramrrr4r;Zopmapr>rr9rrobjectr r5rrKrrrrs W %PKm;1] EFF&__pycache__/btm_matcher.cpython-36.pycnu[3 \@sldZdZddlZddlZddlmZddlmZddlm Z Gdd d e Z Gd d d e Z ia d d ZdS)aA bottom-up tree matching algorithm implementation meant to speed up 2to3's matching process. After the tree patterns are reduced to their rarest linear path, a linear Aho-Corasick automaton is created. The linear automaton traverses the linear paths from the leaves to the root of the AST and returns a set of nodes for further matching. This reduces significantly the number of candidate nodes.z+George Boutsioukis N) defaultdict)pytree) reduce_treec@s eZdZdZejZddZdS)BMNodez?Class for a node of the Aho-Corasick automaton used in matchingcCs"i|_g|_ttj|_d|_dS)N)transition_tablefixersnextrcountidcontent)selfr+/usr/lib64/python3.6/lib2to3/btm_matcher.py__init__s zBMNode.__init__N)__name__ __module__ __qualname____doc__ itertoolsr rrrrrrsrc@s8eZdZdZddZddZddZdd Zd d Zd S) BottomMatcherzgThe main matcher class. After instantiating the patterns should be added using the add_fixer methodcCs0t|_t|_|jg|_g|_tjd|_dS)NZRefactoringTool) setmatchrrootZnodesr loggingZ getLoggerZlogger)rrrrrs  zBottomMatcher.__init__cCsL|jj|t|j}|j}|j||jd}x|D]}|jj|q4WdS)zReduces a fixer's pattern tree to a linear path and adds it to the matcher(a common Aho-Corasick automaton). The fixer is appended on the matching states and called when they are reached)startN)r appendrZ pattern_treeZget_linear_subpatternaddr)rfixerZtreeZlinear match_nodesZ match_noderrr add_fixer%s    zBottomMatcher.add_fixercCs|s |gSt|dtrhg}xF|dD]:}|j||d}x&|D]}|j|j|dd|q>Wq&W|S|d|jkrt}||j|d<n|j|d}|ddr|j|dd|d}n|g}|SdS)z5Recursively adds a linear pattern to the AC automatonr)rrN) isinstancetuplerextendrr)rpatternrr alternativeZ end_nodesendZ next_noderrrr1s" " zBottomMatcher.addc Cs0|j}tt}x|D]}|}x|r&d|_x,|jD]"}t|tjr8|jdkr8d|_Pq8W|j dkrp|j}n|j }||j kr|j |}x|j D]"}||krg||<||j |qWnd|j}|j dk r|j jrP||j kr|j |}x2|j D](}||jkr g||<||j |qW|j }q$WqW|S)auThe main interface with the bottom matcher. The tree is traversed from the bottom using the constructed automaton. Nodes are only checked once as the tree is retraversed. When the automaton fails, we give it one more shot(in case the above tree matches as a whole with the rejected leaf), then we break for the next leaf. There is the special case of multiple arguments(see code comments) where we recheck the nodes Args: The leaves of the AST tree to be matched Returns: A dictionary of node matches with fixers as the keys T;FrN)rrlistZ was_checkedZchildrenr"rZLeafvaluetyperr rparentkeys) rZleavesZcurrent_ac_nodeZresultsZleafZcurrent_ast_nodeZchildZ node_tokenrrrrrunSs>          zBottomMatcher.runcs*tdfdd|jtddS)z %d [label=%s] //%sr)rr-printr type_reprstrr r )ZnodeZ subnode_keyZsubnode) print_noderrr2s  z*BottomMatcher.print_ac..print_node}N)r/r)rr)r2rprint_acs  zBottomMatcher.print_acN) rrrrrr!rr.r4rrrrrs  "=rcCsHtss    PKm;1]f= 256). N)Z symbol2numberitemssetattr)selfZgrammarnameZsymbolr &/usr/lib64/python3.6/lib2to3/pygram.py__init__szSymbols.__init__N)__name__ __module__ __qualname__r r r r r rsrZlib2to3print)__doc__osZpgen2rrrpathjoindirname__file__Z _GRAMMAR_FILEZ_PATTERN_GRAMMAR_FILEobjectrZload_packaged_grammarZpython_grammarZpython_symbolscopyZ!python_grammar_no_print_statementkeywordsZpattern_grammarZpattern_symbolsr r r r s     PKm;1]sdr0b0b!__pycache__/pytree.cpython-36.pycnu[3 \m@sdZdZddlZddlZddlmZdZiaddZGdd d e Z Gd d d e Z Gd d d e Z ddZ Gddde ZGdddeZGdddeZGdddeZGdddeZddZdS)z Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here. z#Guido van Rossum N)StringIOicCsHtst|jjD].\}}||kr|jj|jj|=d|_|SqWdS)z Remove the node from the tree. Returns the position of the node in its parent's children before it was removed. N)r! enumerater%r()rir0r r rremoves  z Base.removec CsZ|jdkrdSxFt|jjD]6\}}||kry|jj|dStk rPdSXqWdS)z The node immediately following the invocant in their parent's children list. If the invocant does not have a next sibling, it is None Nr)r!r3r% IndexError)rr4childr r r next_siblings zBase.next_siblingcCsP|jdkrdSxsys version_inforBr r r rr s0       rc@seZdZdZdddZddZddZejdkr4eZ d d Z d dZ ddZ ddZ ddZddZeeeZddZddZddZdS)Nodez+Concrete implementation for interior nodes.NcCsx|dkst|||_t||_x*|jD] }|jdksBtt|||_q(W|dk rZ||_|rn|dd|_nd|_dS)z Initializer. Takes a type constant (a symbol number >= 256), a sequence of child nodes, and an optional context keyword argument. As a side effect, the parent pointers of the children are updated. N)rrr$r%r!reprr=fixers_applied)rrr%contextr=rNr+r r r__init__s    z Node.__init__cCsd|jjt|j|jfS)z)Return a canonical string representation.z %s(%s, %r))rrCrrr%)rr r r__repr__sz Node.__repr__cCsdjtt|jS)zk Return a pretty string representation. This reproduces the input source exactly. r<)joinmapr"r%)rr r r __unicode__szNode.__unicode__r?rcCs|j|jf|j|jfkS)zCompare two nodes for equality.)rr%)rrr r rrszNode._eqcCst|jdd|jD|jdS)z$Return a cloned (deep) copy of self.cSsg|] }|jqSr )r).0r+r r r szNode.clone..)rN)rKrr%rN)rr r rrsz Node.cloneccs(x|jD]}|jEdHqW|VdS)z*Return a post-order iterator for the tree.N)r%r)rr7r r rrs zNode.post_orderccs(|Vx|jD]}|jEdHqWdS)z)Return a pre-order iterator for the tree.N)r%r )rr7r r rr s zNode.pre_ordercCs|js dS|jdjS)zO The whitespace and comments preceding this node in the input. r<r)r%r=)rr r r_prefix_getterszNode._prefix_gettercCs|jr||jd_dS)Nr)r%r=)rr=r r r_prefix_setterszNode._prefix_settercCs(||_d|j|_||j|<|jdS)z Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. N)r!r%r()rr4r7r r r set_child!s  zNode.set_childcCs ||_|jj|||jdS)z Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. N)r!r%insertr()rr4r7r r r insert_child+szNode.insert_childcCs||_|jj||jdS)z Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately. N)r!r%r'r()rr7r r r append_child4s zNode.append_child)NNN)r?r)rCrDrErFrPrQrTrIrJrBrrrr rWrXrHr=rYr[r\r r r rrKs$     rKc@seZdZdZdZdZdZddgfddZddZd d Z e j dkrFe Z d d Z ddZddZddZddZddZddZeeeZdS)r.z'Concrete implementation for leaf nodes.r<rNcCsfd|kodkns t||dk r:|\|_\|_|_||_||_|dk rT||_|dd|_dS)z Initializer. Takes a type constant (a token number < 256), a string value, and an optional context keyword argument. rrLN)r_prefixr/columnrvaluerN)rrr_rOr=rNr r rrPGs z Leaf.__init__cCsd|jj|j|jfS)z)Return a canonical string representation.z %s(%r, %r))rrCrr_)rr r rrQZsz Leaf.__repr__cCs|jt|jS)zk Return a pretty string representation. This reproduces the input source exactly. )r=r"r_)rr r rrT`szLeaf.__unicode__r?cCs|j|jf|j|jfkS)zCompare two nodes for equality.)rr_)rrr r rrkszLeaf._eqcCs$t|j|j|j|j|jff|jdS)z$Return a cloned (deep) copy of self.)rN)r.rr_r=r/r^rN)rr r rros z Leaf.cloneccs |VdS)Nr )rr r rr:usz Leaf.leavesccs |VdS)z*Return a post-order iterator for the tree.Nr )rr r rrxszLeaf.post_orderccs |VdS)z)Return a pre-order iterator for the tree.Nr )rr r rr |szLeaf.pre_ordercCs|jS)zP The whitespace and comments preceding this token in the input. )r])rr r rrWszLeaf._prefix_gettercCs|j||_dS)N)r(r])rr=r r rrXszLeaf._prefix_setter)r?r)rCrDrErFr]r/r^rPrQrTrIrJrBrrr:rr rWrXrHr=r r r rr.>s&  r.cCsN|\}}}}|s||jkrConstructor that prevents BasePattern from being instantiated.zCannot instantiate BasePattern)rbrrr)rrrr r rrszBasePattern.__new__cCsLt|j|j|jg}x|r.|ddkr.|d=qWd|jjdjtt|fS)Nrz%s(%s)z, rc) rrcontentr rrCrRrSrM)rrr r rrQs zBasePattern.__repr__cCs|S)z A subclass can define this as a hook for optimizations. Returns either self or another node with the same effect. r )rr r roptimizeszBasePattern.optimizecCsn|jdk r|j|jkrdS|jdk rRd}|dk r4i}|j||sDdS|rR|j||dk rj|jrj|||j<dS)a# Does this pattern exactly match a node? Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. Default implementation for non-wildcard patterns. NFT)rrd _submatchupdater )rr0resultsrr r rmatchs     zBasePattern.matchcCs t|dkrdS|j|d|S)z Does this pattern exactly match a sequence of nodes? Default implementation for non-wildcard patterns. rFr)r`rj)rnodesrhr r r match_seqs zBasePattern.match_seqccs&i}|r"|j|d|r"d|fVdS)z} Generator yielding all matches for this pattern. Default implementation for non-wildcard patterns. rrN)rj)rrkrir r rgenerate_matchesszBasePattern.generate_matches)N)N) rCrDrErFrrdr rrQrerjrlrmr r r rrbs  rbc@s*eZdZdddZd ddZd ddZdS) LeafPatternNcCs\|dk r(d|kodkns(t||dk rFt|tsFtt|||_||_||_dS)ap Initializer. Takes optional type, content, and name. The type, if given must be a token type (< 256). If not given, this matches any *leaf* node; the content may still be required. The content, if given, must be a string. If a name is given, the matching node is stored in the results dict under that key. NrrL)rr#r"rMrrdr )rrrdr r r rrPs  zLeafPattern.__init__cCst|tsdStj|||S)z*Override match() to insist on a leaf node.F)r#r.rbrj)rr0rhr r rrj s zLeafPattern.matchcCs |j|jkS)a Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. )rdr_)rr0rhr r rrfs zLeafPattern._submatch)NNN)N)N)rCrDrErPrjrfr r r rrns  rnc@s$eZdZdZdddZdddZdS) NodePatternFNcCs|dk r|dkst||dk r|t|t s8tt|t|}x:t|D].\}}t|tsht||ft|trJd|_qJW||_ ||_ ||_ dS)ad Initializer. Takes optional type, content, and name. The type, if given, must be a symbol type (>= 256). If the type is None this matches *any* single node (leaf or not), except if content is not None, in which it only matches non-leaf nodes that also match the content pattern. The content, if not None, must be a sequence of Patterns that must match the node's children exactly. If the content is given, the type must not be None. If a name is given, the matching node is stored in the results dict under that key. NrLT) rr#r"rMr$r3rbWildcardPattern wildcardsrrdr )rrrdr r4itemr r rrP%s  zNodePattern.__init__cCs|jrJx>t|j|jD],\}}|t|jkr|dk r>|j|dSqWdSt|jt|jkrbdSx*t|j|jD]\}}|j||srdSqrWdS)a Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. NTF)rqrmrdr%r`rgziprj)rr0rhcri subpatternr7r r rrfBs   zNodePattern._submatch)NNN)N)rCrDrErqrPrfr r r rro!s roc@s^eZdZdZddedfddZddZddd Zdd d Zd d Z ddZ ddZ ddZ dS)rpa A wildcard pattern can match zero or more nodes. This has all the flexibility needed to implement patterns like: .* .+ .? .{m,n} (a b c | d e | f) (...)* (...)+ (...)? (...){m,n} except it always uses non-greedy matching. NrcCsd|ko|kotkns.t||f|dk rzttt|}t|sXtt|x |D]}t|s^tt|q^W||_||_||_||_ dS)a Initializer. Args: content: optional sequence of subsequences of patterns; if absent, matches one node; if present, each subsequence is an alternative [*] min: optional minimum number of times to match, default 0 max: optional maximum number of times to match, default HUGE name: optional name assigned to this match [*] Thus, if content is [[a, b, c], [d, e], [f, g, h]] this is equivalent to (a b c | d e | f g h); if content is None, this is equivalent to '.' in regular expression terms. The min and max parameters work as follows: min=0, max=maxint: .* min=1, max=maxint: .+ min=0, max=1: .? min=1, max=1: . If content is not None, replace the dot with the parenthesized list of alternatives, e.g. (a b c | d e | f g h)* rN) HUGErtuplerSr`rMrdminmaxr )rrdrxryr altr r rrPls. zWildcardPattern.__init__cCsd}|jdk r\}}|t|kr |dk rF|j||jrFt|||j<dSq WdS)z4Does this pattern exactly match a sequence of nodes?NTF)rmr`rgr r$)rrkrhrtrir r rrls  zWildcardPattern.match_seqccs:|jdkrXxJt|jdtt||jD]*}i}|jrH|d|||j<||fVq(Wn|jdkrp|j|Vnttdrtj }t t_ zy@x:|j |dD]*\}}|jr|d|||j<||fVqWWnRt k rx:|j |D],\}}|jr |d|||j<||fVqWYnXWdttdr4|t_ XdS)a" Generator yielding matches for a sequence of nodes. Args: nodes: sequence of nodes Yields: (count, results) tuples where: count: the match comprises nodes[:count]; results: dict containing named submatches. NrZ bare_name getrefcountr)rdrangerxr`ryr _bare_name_matcheshasattrrIstderrr_recursive_matches RuntimeError_iterative_matches)rrkcountriZ save_stderrr r rrms. "   z WildcardPattern.generate_matchesc cs t|}d|jkrdifVg}x>|jD]4}x.t||D] \}}||fV|j||fq8Wq(Wx|rg}x|D]\}} ||krr||jkrrxn|jD]d}x^t|||dD]H\} } | dkri}|j| |j| || |fV|j|| |fqWqWqrW|}qbWdS)z(Helper to iteratively yield the matches.rN)r`rxrdrmr'ryrg) rrkZnodelenrhrzrtriZ new_resultsc0r0c1r1r r rrs*       z"WildcardPattern._iterative_matchescCsxd}i}d}t|}xH| r\||kr\d}x0|jD]&}|dj|||r0|d7}d}Pq0WqW|d|||j<||fS)z(Special optimized matcher for bare_name.rFTrN)r`rdrjr )rrkrridoneryZleafr r rr}s  z"WildcardPattern._bare_name_matchesc cs|jdk st||jkr"difV||jkrxr|jD]h}xbt||D]T\}}xJ|j||d|dD].\}}i}|j||j||||fVqfWqDWq4WdS)z(Helper to recursively yield the matches.Nrr)rdrrxryrmrrg) rrkrrzrrrrrir r rr s    "  z"WildcardPattern._recursive_matches)N)N) rCrDrErFrvrPrerjrlrmrr}rr r r rrp^s #  -rpc@s.eZdZd ddZddZddZdd ZdS) NegatedPatternNcCs(|dk rt|tstt|||_dS)a Initializer. The argument is either a pattern or None. If it is None, this only matches an empty sequence (effectively '$' in regex lingo). If it is not None, this matches whenever the argument pattern doesn't have any matches. N)r#rbrrMrd)rrdr r rrPs zNegatedPattern.__init__cCsdS)NFr )rr0r r rrj)szNegatedPattern.matchcCs t|dkS)Nr)r`)rrkr r rrl-szNegatedPattern.match_seqccsL|jdkr"t|dkrHdifVn&x|jj|D] \}}dSWdifVdS)Nr)rdr`rm)rrkrtrir r rrm1s    zNegatedPattern.generate_matches)N)rCrDrErPrjrlrmr r r rrs rc cs|sdifVn|d|dd}}xl|j|D]^\}}|sJ||fVq2xDt|||dD].\}}i}|j||j||||fVq^Wq2WdS)aR Generator yielding matches for a sequence of patterns and nodes. Args: patterns: a sequence of patterns nodes: a sequence of nodes Yields: (count, results) tuples where: count: the entire sequence of patterns matches nodes[:count]; results: dict containing named submatches. rrN)rmrg) Zpatternsrkprestrrrrrir r rrm=s     rm)rF __author__rIwarningsiorrvrrrrrKr.rarbrnrorprrmr r r r s&  1nNV,==#PKm;1]f= 256). N)Z symbol2numberitemssetattr)selfZgrammarnameZsymbolr &/usr/lib64/python3.6/lib2to3/pygram.py__init__szSymbols.__init__N)__name__ __module__ __qualname__r r r r r rsrZlib2to3print)__doc__osZpgen2rrrpathjoindirname__file__Z _GRAMMAR_FILEZ_PATTERN_GRAMMAR_FILEobjectrZload_packaged_grammarZpython_grammarZpython_symbolscopyZ!python_grammar_no_print_statementkeywordsZpattern_grammarZpattern_symbolsr r r r s     PKm;1]))]QQ+__pycache__/fixer_base.cpython-36.opt-1.pycnu[3 \"@sTdZddlZddlmZddlmZddlmZGdddeZ Gd d d e Z dS) z2Base class for fixers (optional, but recommended).N)PatternCompiler)pygram)does_tree_importc@seZdZdZdZdZdZdZdZe j dZ e Z dZdZdZdZdZdZejZddZd d Zd d Zd dZddZdddZddZdddZddZddZ ddZ!dS) BaseFixaOptional base class for fixers. The subclass name must be FixFooBar where FooBar is the result of removing underscores and capitalizing the words of the fix name. For example, the class name for a fixer named 'has_key' should be FixHasKey. NrZpostFcCs||_||_|jdS)aInitializer. Subclass may override. Args: options: a dict containing the options passed to RefactoringTool that could be used to customize the fixer through the command line. log: a list to append warnings and other messages to. N)optionslogcompile_pattern)selfrr r */usr/lib64/python3.6/lib2to3/fixer_base.py__init__/szBaseFix.__init__cCs,|jdk r(t}|j|jdd\|_|_dS)zCompiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match(). NT)Z with_tree)PATTERNrr pattern pattern_tree)r PCr r r r ;s zBaseFix.compile_patterncCs ||_dS)zOSet the filename. The main refactoring tool should call this. N)filename)r rr r r set_filenameFszBaseFix.set_filenamecCsd|i}|jj||o|S)aReturns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override. node)rmatch)r rresultsr r r rMs z BaseFix.matchcCs tdS)aReturns the transformation for a given parse tree node. Args: node: the root of the parse tree that matched the fixer. results: a dict mapping symbolic names to part of the match. Returns: None, or a node that is a modified copy of the argument node. The node argument may also be modified in-place to effect the same change. Subclass *must* override. N)NotImplementedError)r rrr r r transformYszBaseFix.transformxxx_todo_changemecCs6|}x ||jkr$|tt|j}qW|jj||S)zReturn a string suitable for use as an identifier The new name is guaranteed not to conflict with other identifiers. ) used_namesstrnextnumbersadd)r templatenamer r r new_nameis   zBaseFix.new_namecCs.|jrd|_|jjd|j|jj|dS)NFz### In file %s ###) first_logr appendr)r messager r r log_messagetszBaseFix.log_messagecCs>|j}|j}d|_d}|j|||f|r:|j|dS)aWarn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. zLine %d: could not convert: %sN) get_linenoZcloneprefixr&)r rreasonlinenoZ for_outputmsgr r r cannot_convertzszBaseFix.cannot_convertcCs|j}|jd||fdS)zUsed for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. z Line %d: %sN)r(r&)r rr*r+r r r warningszBaseFix.warningcCs(|j|_|j|tjd|_d|_dS)zSome fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. rTN)rr itertoolscountrr#)r treerr r r start_trees  zBaseFix.start_treecCsdS)zSome fixers need to maintain tree-wide state. This method is called once, at the conclusion of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. Nr )r r1rr r r finish_treeszBaseFix.finish_tree)r)N)"__name__ __module__ __qualname____doc__rrrrrr/r0rsetrorderZexplicitZ run_orderZ _accept_typeZkeep_line_orderZ BM_compatiblerZpython_symbolsZsymsrr rrrr"r&r-r.r2r3r r r r rs4        rcs,eZdZdZdZfddZddZZS)ConditionalFixz@ Base class for fixers which not execute if an import is found. Ncstt|j|d|_dS)N)superr:r2 _should_skip)r args) __class__r r r2szConditionalFix.start_treecCsJ|jdk r|jS|jjd}|d}dj|dd}t||||_|jS)N.rr@)r<skip_onsplitjoinr)r rZpkgr!r r r should_skips  zConditionalFix.should_skip)r4r5r6r7rAr2rD __classcell__r r )r>r r:s r:) r7r/Zpatcomprr'rZ fixer_utilrobjectrr:r r r r s   PKm;1]H4I7Q7Q#__pycache__/refactor.cpython-36.pycnu[3 \=m@s<dZdZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZdd lmZd&d d ZGd ddeZddZddZddZddZejd'krddlZejZddZ ddZ!n eZeZ eZ!ddZ"GdddeZ#Gd d!d!e$Z%Gd"d#d#eZ&Gd$d%d%e%Z'dS)(zRefactoring framework. Used as a main program, this can refactor any number of files and/or recursively descend down directories. Imported as a module, this provides infrastructure to write your own refactoring tool. z#Guido van Rossum N)chain)drivertokenizetoken) find_root)pytreepygram) btm_matcherTcCstt|ggdg}tjj|j}g}xLttj|D]:}|jdr2|jdr2|rZ|dd}|j |ddq2W|S)zEReturn a sorted list of all available fix names in the given package.*fix_z.pyN) __import__ospathdirname__file__sortedlistdir startswithendswithappend)Z fixer_pkgZ remove_prefixZpkgZ fixer_dirZ fix_namesnamer(/usr/lib64/python3.6/lib2to3/refactor.pyget_all_fix_namess rc@s eZdZdS) _EveryNodeN)__name__ __module__ __qualname__rrrrr+srcCst|tjtjfr(|jdkr t|jhSt|tjrH|jrDt|jStt|tj rt }x*|jD] }x|D]}|j t|qlWqbW|St d|dS)zf Accepts a pytree Pattern Node and returns a set of the pattern types which will match first. Nz$Oh no! I don't understand pattern %s) isinstancerZ NodePatternZ LeafPatterntyperZNegatedPatternZcontent_get_head_typesZWildcardPatternsetupdate Exception)Zpatrpxrrrr$/s      r$c Cstjt}g}x|D]|}|jrjyt|j}Wntk rJ|j|YqXxB|D]}||j|qRWq|jdk r||jj|q|j|qWx,tt j j j t j j D]}||j|qWt|S)z^ Accepts a list of fixers and returns a dictionary of head node type --> fixer list. N) collections defaultdictlistpatternr$rrZ _accept_typerr python_grammarZ symbol2numbervaluestokensextenddict)Z fixer_listZ head_nodesZeveryfixerZheadsZ node_typerrr_get_headnode_dictKs"    r5csfddtdDS)zN Return the fully qualified names for fixers in the package pkg_name. csg|]}d|qS).r).0fix_name)pkg_namerr hsz+get_fixers_from_package..F)r)r9r)r9rget_fixers_from_packageds r;cCs|S)Nr)objrrr _identityksr=rcCs |jddS)Nz  )replace)inputrrr_from_system_newlinesrsrAcCs tjdkr|jdtjS|SdS)Nr>)rlinesepr?)r@rrr_to_system_newlinests rCc sTd}tjtj|jfdd}ttjtjtj h}t }yx|\}}||krVq@q@|tj krl|rfPd}q@|tj ko||dkr,|\}}|tj ks|dkrP|\}}|tj ks|dkrP|\}}|tj kr|dkr|\}}xJ|tj kr(|j||\}}|tj ks|d krP|\}}qWq@Pq@WWntk rJYnXt|S) NFcst}|d|dfS)Nrr)next)tok)genrradvancesz(_detect_future_features..advanceTfromZ __future__import(,)rgenerate_tokensioStringIOreadline frozensetrNEWLINENLCOMMENTr%STRINGNAMEOPadd StopIteration)sourceZhave_docstringrGignorefeaturestpvaluer)rFr_detect_future_featuressD          r^c@seZdZdZdS) FixerErrorzA fixer could not be loaded.N)rr r!__doc__rrrrr_sr_c@seZdZdddZdZdZd4ddZdd Zd d Zd d Z ddZ ddZ d5ddZ d6ddZ ddZd7ddZddZd8ddZddZd d!Zd9d"d#Zd:d$d%Zd&Zd'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3ZdS);RefactoringToolF)print_functionwrite_unchanged_filesZFixr NcCs2||_|p g|_|jj|_|dk r0|jj||jdrDtj|_ntj |_|jj d|_ g|_ t jd|_g|_d|_tj|jtj|jd|_|j\|_|_g|_tj|_g|_g|_xXt|j|jD]F}|j r|jj!|q||jkr|jj"|q||jkr|jj"|qWt#|j|_$t#|j|_%dS)zInitializer. Args: fixer_names: a list of fixers to import options: a dict with configuration. explicit: a list of fixers to run even if they are explicit. NrbrcraF)convertlogger)&fixersexplicit_default_optionscopyoptionsr&r !python_grammar_no_print_statementgrammarr/getrcerrorsloggingZ getLoggerre fixer_logwroterZDriverrrd get_fixers pre_order post_orderfilesbmZ BottomMatcherBMZ bmi_pre_orderZbmi_post_orderrZ BM_compatibleZ add_fixerrr5bmi_pre_order_headsbmi_post_order_heads)selfZ fixer_namesrjrgr4rrr__init__s<           zRefactoringTool.__init__c Cs\g}g}x&|jD]}t|iidg}|jddd}|j|jrV|t|jd}|jd}|jdjdd|D}yt ||}Wn$t k rt d ||fYnX||j |j } | jr|jd k r||jkr|jd |q|jd || jd kr|j| q| jdkr |j| qt d| jqWtjd} |j| d|j| d||fS)aInspects the options to load the requested patterns and handlers. Returns: (pre_order, post_order), where pre_order is the list of fixers that want a pre-order AST traversal, and post_order is the list that want post-order traversal. r r6rN_cSsg|] }|jqSr)title)r7r)rrrr:sz.RefactoringTool.get_fixers..zCan't find %s.%sTzSkipping optional fixer: %szAdding transformation: %sZpreZpostzIllegal fixer order: %rZ run_order)key)rfrrsplitr FILE_PREFIXlensplit CLASS_PREFIXjoingetattrAttributeErrorr_rjrprg log_message log_debugorderroperator attrgettersort) rzZpre_order_fixersZpost_order_fixersZ fix_mod_pathmodr8parts class_nameZ fix_classr4Zkey_funcrrrrrs8            zRefactoringTool.get_fixerscOsdS)zCalled when an error occurs.Nr)rzmsgargskwdsrrr log_errorszRefactoringTool.log_errorcGs|r ||}|jj|dS)zHook to log a message.N)reinfo)rzrrrrrrszRefactoringTool.log_messagecGs|r ||}|jj|dS)N)redebug)rzrrrrrrszRefactoringTool.log_debugcCsdS)zTCalled with the old version, new version, and filename of a refactored file.Nr)rzold_textnew_textfilenameequalrrr print_outputszRefactoringTool.print_outputcCs<x6|D].}tjj|r&|j|||q|j|||qWdS)z)Refactor a list of files and directories.N)rrisdir refactor_dir refactor_file)rzitemswrite doctests_onlyZ dir_or_filerrrrefactor#s  zRefactoringTool.refactorc Cstjd}xtj|D]\}}}|jd||j|jxH|D]@}|jd rBtjj|d|krBtjj||} |j | ||qBWdd|D|dd<qWdS)zDescends down a directory and refactor every Python file found. Python files are assumed to have a .py extension. Files and subdirectories starting with '.' are skipped. pyzDescending into %sr6rcSsg|]}|jds|qS)r6)r)r7Zdnrrrr:>sz0RefactoringTool.refactor_dir..N) rextsepwalkrrrrsplitextrr) rzZdir_namerrZpy_extdirpathZdirnames filenamesrfullnamerrrr,s    zRefactoringTool.refactor_dircCsyt|d}Wn.tk r<}z|jd||dSd}~XnXztj|jd}Wd|jXt|d|d}t|j |fSQRXdS)zG Do our best to decode a Python source file correctly. rbzCan't open %s: %sNrr()encoding)NN) openOSErrorrrdetect_encodingrOclose_open_with_encodingrAread)rzrferrrrrr_read_python_source@s z#RefactoringTool._read_python_sourcecCs|j|\}}|dkrdS|d7}|rn|jd||j||}|jsL||kr`|j|||||q|jd|nH|j||}|js|r|jr|jt|dd|||dn |jd|dS) zRefactors a file.Nr>zRefactoring doctests in %szNo doctest changes in %sr)rrzNo changes in %sr)rrrefactor_docstringrcprocessed_filerefactor_string was_changedstr)rzrrrr@routputtreerrrrPs    zRefactoringTool.refactor_filecCst|}d|krtj|j_zJy|jj|}Wn4tk r`}z|jd||jj |dSd}~XnXWd|j|j_X||_ |j d||j |||S)aFRefactor a given input string. Args: data: a string holding the code to be refactored. name: a human-readable name for use in error/log messages. Returns: An AST corresponding to the refactored input stream; None if there were errors during the parse. rbzCan't parse %s: %s: %sNzRefactoring %s) r^r rkrrlZ parse_stringr'r __class__rfuture_featuresr refactor_tree)rzdatarr[rrrrrrgs     zRefactoringTool.refactor_stringcCstjj}|rN|jd|j|d}|js2||krB|j|d|q|jdn:|j|d}|jsj|r~|jr~|jt |d|n |jddS)NzRefactoring doctests in stdinzzNo doctest changes in stdinzNo changes in stdin) sysstdinrrrrcrrrr)rzrr@rrrrrrefactor_stdins     zRefactoringTool.refactor_stdinc Csx"t|j|jD]}|j||qW|j|j|j|j|j|j|jj|j }xvt |j rАx`|jj D]R}||ko||rv||j tjjdd|jr||j tjjdx t||D]}|||kr||j|y t|Wntk rwYnX|jr(||jkr(q|j|}|r|j||}|dk r|j|x,|jD] }|jspg|_|jj|q^W|jj|j }x2|D]*} | |krg|| <|| j|| qWqWqvWq\Wx$t|j|jD]}|j||qW|jS)aRefactors a parse tree (modifying the tree in place). For compatible patterns the bottom matcher module is used. Otherwise the tree is traversed node-to-node for matches. Args: tree: a pytree.Node instance representing the root of the tree to be refactored. name: a human-readable name for this tree. Returns: True if the tree was modified, False otherwise. T)rreverse)rN)rrsrtZ start_tree traverse_byrxryrwZrunZleavesanyr0rfrrZBaseZdepthZkeep_line_orderZ get_linenor-remover ValueErrorZfixers_appliedmatch transformr?rr2Z finish_treer) rzrrr4Z match_setnoderesultsnewZ new_matchesZfxrrrrrsJ       $zRefactoringTool.refactor_treecCs^|sdSxP|D]H}xB||jD]4}|j|}|r|j||}|dk r|j||}qWqWdS)aTraverse an AST, applying a set of fixers to each node. This is a helper method for refactor_tree(). Args: fixers: a list of fixer instances. traversal: a generator that yields AST nodes. Returns: None N)r#rrr?)rzrfZ traversalrr4rrrrrrs     zRefactoringTool.traverse_bycCs|jj||dkr.|j|d}|dkr.dS||k}|j|||||r`|jd||js`dS|rv|j||||n |jd|dS)zR Called when a file has been refactored and there may be changes. NrzNo changes to %szNot writing changes to %s)rurrrrrc write_file)rzrrrrrrrrrrs  zRefactoringTool.processed_filec%Csyt|d|d}Wn.tk r@}z|jd||dSd}~XnXzHy|jt|Wn0tk r}z|jd||WYdd}~XnXWd|jX|jd|d|_dS)zWrites a string to a file. It first shows a unified diff between the old text and the new text, and then rewrites the file; the latter is only done if the write option is set. w)rzCan't create %s: %sNzCan't write %s: %szWrote changes to %sT)rrrrrCrrrq)rzrrrrrrrrrr s$  zRefactoringTool.write_filez>>> z... c Csg}d}d}d}d}x|jddD]}|d7}|jj|jr|dk r\|j|j|||||}|g}|j|j} |d| }q"|dk r|j||js|||jjdkr|j |q"|dk r|j|j||||d}d}|j |q"W|dk r|j|j||||dj |S)aRefactors a docstring, looking for doctests. This returns a modified version of the input string. It looks for doctests, which start with a ">>>" prompt, and may be continued with "..." prompts, as long as the "..." is indented the same as the ">>>". (Unfortunately we can't use the doctest module's parser, since, like most parsers, it is not geared towards preserving the original source.) NrT)keependsrr>r}) splitlineslstriprPS1r2refactor_doctestfindPS2rstriprr) rzr@rresultblockZ block_linenoindentlinenolineirrrr%s:          z"RefactoringTool.refactor_docstringc s(yj||}Wndtk rv}zHjjtjrRx|D]}jd|jdq8Wjd|||j j ||Sd}~XnXj ||r$t |j dd}|d|d||dd} }| dg|dkst| |d jds|d d7<j|jdg}|r$|fd d |D7}|S) zRefactors one doctest. A doctest is given as a block of lines, the first of which starts with ">>>" (possibly indented), while the remaining lines start with "..." (identically indented). z Source: %sr>z+Can't parse docstring in %s line %s: %s: %sNT)rrrcsg|]}j|qSr)r)r7r)rrzrrr:jsz4RefactoringTool.refactor_doctest..rr) parse_blockr'reZ isEnabledForroDEBUGrrrrrrrrAssertionErrorrrpop) rzrrrrrrrrZclippedr)rrzrrPs& "z RefactoringTool.refactor_doctestcCs|jr d}nd}|js$|jd|n&|jd|x|jD]}|j|q8W|jrt|jdx|jD]}|j|qbW|jrt|jdkr|jdn|jdt|jx&|jD]\}}}|j|f||qWdS) Nwerez need to bezNo files %s modified.zFiles that %s modified:z$Warnings/messages while refactoring:rzThere was 1 error:zThere were %d errors:)rqrurrprnr)rzrfilemessagerrrrrr summarizems$     zRefactoringTool.summarizecCs"|jj|j|||}t|_|S)zParses a block into a tree. This is necessary to get correct line number / offset information in the parser diagnostics and embedded into the parse tree. )rZ parse_tokens wrap_toksrPr)rzrrrrrrrrszRefactoringTool.parse_blockc cshtj|j||j}xN|D]F\}}\}}\} } } ||d7}| |d7} ||||f| | f| fVqWdS)z;Wraps a tokenize stream to systematically modify start/end.rN)rrL gen_lines__next__) rzrrrr1r#r]Zline0Zcol0Zline1Zcol1Z line_textrrrrs   zRefactoringTool.wrap_toksccs||j}||j}|}xV|D]N}|j|r@|t|dVn(||jdkrXdVntd||f|}qWx dVqrWdS)zGenerates lines as expected by tokenize from a list of lines. This strips the first len(indent + self.PS1) characters off each line. Nr>zline=%r, prefix=%rr})rrrrrr)rzrrprefix1Zprefix2prefixrrrrrs    zRefactoringTool.gen_lines)NN)FF)FF)FF)F)NFN)N)rr r!rhrrr{rrrrrrrrrrrrrrrrrrrrrrrrrrrrras: 4(   O  + rac@s eZdZdS)MultiprocessingUnsupportedN)rr r!rrrrrsrcsBeZdZfddZd fdd ZfddZfd d ZZS) MultiprocessRefactoringToolcs"tt|j||d|_d|_dS)N)superrr{queue output_lock)rzrkwargs)rrrr{sz$MultiprocessRefactoringTool.__init__Frcs|dkrttj|||Sy ddlWntk r@tYnXjdk rTtdj_j _ fddt |D}z.x|D] }|j qWttj|||Wdjj xt |D]}jjdqWx|D]}|jr|j qWd_XdS)Nrrz already doing multiple processescsg|]}jjdqS))target)ZProcess_child)r7r)multiprocessingrzrrr:sz8MultiprocessRefactoringTool.refactor..)rrrr ImportErrorrr RuntimeErrorZ JoinableQueueZLockrrangestartrputZis_alive)rzrrrZ num_processesZ processesr)r)r)rrzrrs2               z$MultiprocessRefactoringTool.refactorc sR|jj}xB|dk rL|\}}ztt|j||Wd|jjX|jj}q WdS)N)rrmrrrZ task_done)rzZtaskrr)rrrrs     z"MultiprocessRefactoringTool._childcs2|jdk r|jj||fntt|j||SdS)N)rrrrr)rzrr)rrrrs  z)MultiprocessRefactoringTool.refactor_file)FFr)rr r!r{rrr __classcell__rr)rrrs   r)T)rr)(r` __author__rrrorr+rM itertoolsrZpgen2rrrZ fixer_utilrr}rr r rvrr'rr$r5r;r= version_infocodecsrrrArCr^r_objectrarrrrrr sF      ( PKm;1] EFF,__pycache__/btm_matcher.cpython-36.opt-1.pycnu[3 \@sldZdZddlZddlZddlmZddlmZddlm Z Gdd d e Z Gd d d e Z ia d d ZdS)aA bottom-up tree matching algorithm implementation meant to speed up 2to3's matching process. After the tree patterns are reduced to their rarest linear path, a linear Aho-Corasick automaton is created. The linear automaton traverses the linear paths from the leaves to the root of the AST and returns a set of nodes for further matching. This reduces significantly the number of candidate nodes.z+George Boutsioukis N) defaultdict)pytree) reduce_treec@s eZdZdZejZddZdS)BMNodez?Class for a node of the Aho-Corasick automaton used in matchingcCs"i|_g|_ttj|_d|_dS)N)transition_tablefixersnextrcountidcontent)selfr+/usr/lib64/python3.6/lib2to3/btm_matcher.py__init__s zBMNode.__init__N)__name__ __module__ __qualname____doc__ itertoolsr rrrrrrsrc@s8eZdZdZddZddZddZdd Zd d Zd S) BottomMatcherzgThe main matcher class. After instantiating the patterns should be added using the add_fixer methodcCs0t|_t|_|jg|_g|_tjd|_dS)NZRefactoringTool) setmatchrrootZnodesr loggingZ getLoggerZlogger)rrrrrs  zBottomMatcher.__init__cCsL|jj|t|j}|j}|j||jd}x|D]}|jj|q4WdS)zReduces a fixer's pattern tree to a linear path and adds it to the matcher(a common Aho-Corasick automaton). The fixer is appended on the matching states and called when they are reached)startN)r appendrZ pattern_treeZget_linear_subpatternaddr)rfixerZtreeZlinear match_nodesZ match_noderrr add_fixer%s    zBottomMatcher.add_fixercCs|s |gSt|dtrhg}xF|dD]:}|j||d}x&|D]}|j|j|dd|q>Wq&W|S|d|jkrt}||j|d<n|j|d}|ddr|j|dd|d}n|g}|SdS)z5Recursively adds a linear pattern to the AC automatonr)rrN) isinstancetuplerextendrr)rpatternrr alternativeZ end_nodesendZ next_noderrrr1s" " zBottomMatcher.addc Cs0|j}tt}x|D]}|}x|r&d|_x,|jD]"}t|tjr8|jdkr8d|_Pq8W|j dkrp|j}n|j }||j kr|j |}x|j D]"}||krg||<||j |qWnd|j}|j dk r|j jrP||j kr|j |}x2|j D](}||jkr g||<||j |qW|j }q$WqW|S)auThe main interface with the bottom matcher. The tree is traversed from the bottom using the constructed automaton. Nodes are only checked once as the tree is retraversed. When the automaton fails, we give it one more shot(in case the above tree matches as a whole with the rejected leaf), then we break for the next leaf. There is the special case of multiple arguments(see code comments) where we recheck the nodes Args: The leaves of the AST tree to be matched Returns: A dictionary of node matches with fixers as the keys T;FrN)rrlistZ was_checkedZchildrenr"rZLeafvaluetyperr rparentkeys) rZleavesZcurrent_ac_nodeZresultsZleafZcurrent_ast_nodeZchildZ node_tokenrrrrrunSs>          zBottomMatcher.runcs*tdfdd|jtddS)z %d [label=%s] //%sr)rr-printr type_reprstrr r )ZnodeZ subnode_keyZsubnode) print_noderrr2s  z*BottomMatcher.print_ac..print_node}N)r/r)rr)r2rprint_acs  zBottomMatcher.print_acN) rrrrrr!rr.r4rrrrrs  "=rcCsHtss    PKm;1]7`4*__pycache__/btm_utils.cpython-36.opt-1.pycnu[3 \&@s|dZddlmZddlmZmZddlmZmZeZ eZ ej Z eZ dZdZdZGdddeZdd d Zd d ZddZd S)z0Utility functions used by the btm_matcher module)pytree)grammartoken)pattern_symbolspython_symbolsc@s:eZdZdZd ddZddZddZd d Zd d ZdS)MinNodezThis class serves as an intermediate representation of the pattern tree during the conversion to sets of leaf-to-root subpatternsNcCs.||_||_g|_d|_d|_g|_g|_dS)NF)typenamechildrenleafparent alternativesgroup)selfr r r)/usr/lib64/python3.6/lib2to3/btm_utils.py__init__szMinNode.__init__cCst|jdt|jS)N )strr r )rrrr__repr__szMinNode.__repr__cCs|}g}x|r|jtkr`|jj|t|jt|jkrTt|jg}g|_|j}q n |j}d}P|jtkr|j j|t|j t|jkrt |j }g|_ |j}q n |j}d}P|jt j kr|j r|j|j n |j|j|j}q W|S)zInternal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a singleN)r TYPE_ALTERNATIVESrappendlenr tupler TYPE_GROUPrget_characteristic_subpattern token_labelsNAMEr )rnodesubprrr leaf_to_root!s8        zMinNode.leaf_to_rootcCs&x |jD]}|j}|r |Sq WdS)aDrives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton's capabilities, leaf_to_root merges each group into a single choice based on 'characteristic'ity, i.e. (a|b c) -> (a|b) if b more characteristic than c Returns: The most 'characteristic'(as defined by get_characteristic_subpattern) path for the compiled pattern tree. N)leavesr")rlr!rrrget_linear_subpatternKszMinNode.get_linear_subpatternccs.x|jD]}|jEdHqW|js*|VdS)z-Generator that returns the leaves of the treeN)r r#)rchildrrrr#`s zMinNode.leaves)NN) __name__ __module__ __qualname____doc__rrr"r%r#rrrrr s  *r Nc Csd}|jtjkr|jd}|jtjkrt|jdkrFt|jd|}nJttd}x>|jD]4}|jj |drnqXt||}|dk rX|jj |qXWn|jtj krt|jdkrtt d}x(|jD]}t||}|r|jj |qW|jsd}nt|jd|}n|jtj krt|jdtjrH|jdjdkrHt|jd|St|jdtjrn|jdjdkst|jdkrt|jddr|jdjdkrdSd }d}d}d }d} d } xn|jD]d}|jtjkrd }|}n*|jtjkrd }|} n|jtjkr |}t|dr|jd krd } qW| rb|jd} t| drl| jdkrl|jd } n |jd} | jtjkr| jd krttd}n4tt| jrttt| jd}nttt| jd}n\| jtjkr | jjd} | tkrtt| d}nttj| d}n| jtjkr$t||}|rZ| jdjdkrBd}n| jdjdkrVnt|r|dk rx8|jddD]&}t||}|dk rz|jj |qzW|r||_|S)z Internal function. Reduces a compiled pattern tree to an intermediate representation suitable for feeding the automaton. This also trims off any optional pattern elements(like [a], a*). Nr)r r([valueTF=rany')r r *+)r symsZMatcherr Z Alternativesr reduce_treer rindexrZ AlternativerZUnit isinstancerZLeafr.hasattrZDetailsZRepeaterrrTYPE_ANYgetattrpysymsSTRINGstriptokensNotImplementedErrorr) r rZnew_noder&Zreducedr Z details_nodeZalternatives_nodeZ has_repeaterZ repeater_nodeZhas_variable_nameZ name_leafr rrrr6gs                     r6cst|ts|St|dkr"|dSg}g}dddddgg}dxl|D]d}tt|d d rFtt|fd d r~|j|qFtt|fd d r|j|qF|j|qFW|r|}n|r|}n|r|}t|td S)zPicks the most characteristic from a list of linear patterns Current order used is: names > common_names > common_chars rr+inforifnotNonez[]().,:cSs t|tkS)N)r r)xrrrsz/get_characteristic_subpattern..cst|to|kS)N)r8r)rF) common_charsrrrGscst|to|kS)N)r8r)rF) common_namesrrrGs)key)r8listrr0rec_testrmax)Z subpatternsZsubpatterns_with_namesZsubpatterns_with_common_namesZsubpatterns_with_common_chars subpatternr)rHrIrrs2     rccs<x6|D].}t|ttfr*t||EdHq||VqWdS)zPTests test_func on all items of sequence and items of included sub-iterablesN)r8rKrrL)ZsequenceZ test_funcrFrrrrLs rLr4)N)r*rZpgen2rrZpygramrrr5r<Zopmapr?rr:rrobjectr r6rrLrrrrs W %PKm;1]/?d//+__pycache__/fixer_util.cpython-36.opt-1.pycnu[3 \g; @sdZddlmZddlmZmZddlmZddl m Z ddZ dd Z d d Z d d ZdWddZddZddZddZe e fddZdXddZddZddZdYdd Zd!d"ZdZd#d$Zd[d%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2d3d4d5d6d7d8d9d:h Z d;d<Z!d=a"d>a#d?a$d@a%dAdBZ&dCdDZ'dEdFZ(dGdHZ)dIdJZ*dKdLZ+dMdNZ,dOdPZ-ej.ej/hZ0d\dQdRZ1ej/ej.ej2hZ3dSdTZ4d]dUdVZ5dS)^z1Utility functions, node construction macros, etc.)token)LeafNode)python_symbols)patcompcCsttj|ttjd|gS)N=)rsymsZargumentrrEQUAL)keywordvaluer */usr/lib64/python3.6/lib2to3/fixer_util.py KeywordArgsrcCs ttjdS)N()rrLPARr r r r LParensrcCs ttjdS)N))rrRPARr r r r RParensrcCsHt|ts|g}t|ts&d|_|g}ttj|ttjdddg|S)zBuild an assignment statement r)prefix) isinstancelistrrratomrrr )targetsourcer r r Assigns  rNcCsttj||dS)zReturn a NAME leaf)r)rrNAME)namerr r r Name$srcCs|ttjt|ggS)zA node tuple for obj.attr)rrtrailerDot)objattrr r r Attr(sr$cCs ttjdS)z A comma leaf,)rrCOMMAr r r r Comma,sr'cCs ttjdS)zA period (.) leaf.)rrDOTr r r r r!0sr!cCs4ttj|j|jg}|r0|jdttj||S)z-A parenthesised argument list, used by Call()r)rrr clone insert_childarglist)argsZlparenZrparennoder r r ArgList4sr/cCs&ttj|t|g}|dk r"||_|S)zA function callN)rrpowerr/r)Z func_namer-rr.r r r Call;sr1cCs ttjdS)zA newline literal )rrNEWLINEr r r r NewlineBsr4cCs ttjdS)z A blank line)rrr3r r r r BlankLineFsr6cCsttj||dS)N)r)rrNUMBER)nrr r r NumberJsr9cCs"ttjttjd|ttjdgS)zA numeric or string subscript[])rrr rrLBRACERBRACE)Z index_noder r r SubscriptMsr>cCsttj||dS)z A string leaf)r)rrSTRING)stringrr r r StringSsrAc Csd|_d|_d|_ttjd}d|_ttjd}d|_||||g}|rtd|_ttjd}d|_|jttj||gttj|ttj |g}ttj ttj d|ttj dgS)zuA list comprehension of the form [xp for fp in it if test]. If test is None, the "if test" part is omitted. r5rforinifr:r;) rrrrappendrrZcomp_ifZ listmakerZcomp_forrr<r=) ZxpfpitZtestZfor_leafZin_leafZ inner_argsZif_leafinnerr r r ListCompWs$     rIcCsZx|D] }|jqWttjdttj|ddttjdddttj|g}ttj|}|S)zO Return an import statement in the form: from package import name_leafsfromr)rimport)removerrrrrimport_as_names import_from)Z package_nameZ name_leafsZleafchildrenimpr r r FromImportos    rQc Cs|dj}|jtjkr"|j}nttj|jg}|d}|rNdd|D}ttjtt|dt|dttj|dj||djgg|}|j |_ |S) zfReturns an import statement and calls a method of the module: import module module.name()r"aftercSsg|] }|jqSr )r*).0r8r r r sz!ImportAndCall..rZlparZrpar) r*typerr,rr0r$rr r)r.resultsnamesr"Z newarglistrRnewr r r ImportAndCalls   DrZcCst|tr |jttgkr dSt|tot|jdkot|jdtot|jdtot|jdto|jdjdko|jdjdkS)z(Does the node represent a tuple literal?TrUrrr)rrrOrrlenrr )r.r r r is_tuples r^cCsXt|toVt|jdkoVt|jdtoVt|jdtoV|jdjdkoV|jdjdkS)z'Does the node represent a list literal?rrUr:r;r_)rrr]rOrr )r.r r r is_lists  r`cCsttjt|tgS)N)rrrrr)r.r r r parenthesizesrasortedrsetanyalltuplesumminmax enumerateccs(t||}x|r"|Vt||}q WdS)alFollow an attribute chain. If you have a chain of objects where a.foo -> b, b.foo-> c, etc, use this to iterate over all objects in the chain. Iteration is terminated by getattr(x, attr) is None. Args: obj: the starting object attr: the name of the chaining attribute Yields: Each successive object in the chain. N)getattr)r"r#nextr r r attr_chains rmzefor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > z power< ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | 'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) ) trailer< '(' node=any ')' > any* > z` power< ( 'sorted' | 'enumerate' ) trailer< '(' arglist ')' > any* > FcCsrts&tjtatjtatjtadatttg}x|jtjkr|S|j}|jd}|_ttj|g}||_|S)N)rVrr|r*rnr)r.rnr|r r r make_suites rcCs(x"|jtjkr"|j}|stdqW|S)zFind the top level namespace.z,root found before file_input node was found.)rVrZ file_inputrn ValueError)r.r r r find_root&s  rcCst|t||}t|S)z Returns true if name is imported from package at the top level of the tree which node belongs to. To cover the case of an import like 'import foo', use None for the package and 'foo' for the name. ) find_bindingrbool)packagerr.Zbindingr r r does_tree_import/srcCs|jtjtjfkS)z0Returns true if the node is an import statement.)rVr import_namerN)r.r r r is_import7src Cs4dd}t|}t|||r dSd}}xTt|jD]F\}}||sFq4x(t|j|dD]\}}||sZPqZW||}Pq4W|dkrxDt|jD]6\}}|jtjkr|jr|jdjtjkr|d}PqW|dkrt tj t tj dt tj |ddg} nt |t tj |ddg} | tg} |j|t tj| dS) z\ Works like `does_tree_import` but adds an import statement if it was not imported. cSs |jtjko|jot|jdS)NrU)rVr simple_stmtrOr)r.r r r is_import_stmt>sz$touch_import..is_import_stmtNrUrrKr)r)rrrjrOrVrrrr?rrrrrQr4r+) rrr.rrootZ insert_posoffsetidxZnode2import_rOr r r touch_import;s4   rcCsx|jD]}d}|jtjkrVt||jdr4|St|t|jd|}|rR|}n4|jtjtjfkrt|t|jd |}|r|}n|jtj krt|t|jd|}|r|}nXxt |jddD]@\}}|jt j ko|j dkrt|t|j|d|}|r|}qWnx|jtkr6|jdj |kr6|}nTt|||rJ|}n@|jtjkrft|||}n$|jtjkrt||jdr|}|r |s|St|r |Sq WdS) z Returns the node which binds variable name, otherwise None. If optional argument package is supplied, only imports will be returned. See test cases for examples.Nrr\r[:rUr_r_)rOrVrZfor_stmt_findrrZif_stmtZ while_stmtZtry_stmtrjrCOLONr _def_syms_is_import_bindingrryr)rr.rchildZretr8iZkidr r r risH  rcCsX|g}xL|rR|j}|jdkr6|jtkr6|j|jq|jtjkr|j|kr|SqWdS)N)poprV _block_symsextendrOrrr )rr.Znodesr r r rsrcCs|jtjkr| r|jd}|jtjkrvx|jD]@}|jtjkrV|jdj|krp|Sq0|jtjkr0|j|kr0|Sq0WnL|jtjkr|jd}|jtjkr|j|kr|Sn|jtjkr|j|kr|Sn|jtj kr|rt |jdj |krdS|jd}|rt d|rdS|jtj kr.t ||r.|S|jtjkrf|jd}|jtjkr|j|kr|Sn6|jtjkr|j|kr|S|r|jtjkr|SdS)z Will reuturn node if node will import name, or node will import * from package. None is returned otherwise. See test cases for examples. rr\Nr[asr_)rVrrrOZdotted_as_namesZdotted_as_namer rrrNstrstriprrMZimport_as_nameSTAR)r.rrrPrZlastr8r r r rs@         r)N)NN)N)N)N)N)N)6__doc__Zpgen2rZpytreerrZpygramrrr5rrrrrrr$r'r!r/r1r4r6r9r>rArIrQrZr^r`raZconsuming_callsrmrprqrrrorvr{rrrrrrrxrwrrr rrrr r r r sZ            -  * PKm;1]Zr~)__pycache__/__main__.cpython-36.opt-2.pycnu[3 \C@s&ddlZddlmZejeddS)N)mainz lib2to3.fixes)sysrexitrr(/usr/lib64/python3.6/lib2to3/__main__.pys PKm;1]{K{{)__pycache__/__init__.cpython-36.opt-2.pycnu[3 \@sdS)Nrrr(/usr/lib64/python3.6/lib2to3/__init__.pysPKm;1](__pycache__/patcomp.cpython-36.opt-2.pycnu[3 \@sdZddlZddlmZmZmZmZmZmZddl m Z ddl m Z Gddde Z d d ZGd d d eZejejejdd ZddZddZddZdS)z#Guido van Rossum N)driverliteralstokentokenizeparsegrammar)pytree)pygramc@s eZdZdS)PatternSyntaxErrorN)__name__ __module__ __qualname__rr'/usr/lib64/python3.6/lib2to3/patcomp.pyr sr c csPtjtjtjh}tjtj|j}x(|D] }|\}}}}}||kr(|Vq(WdS)N) rNEWLINEINDENTDEDENTrgenerate_tokensioStringIOreadline) inputskiptokensZ quintupletypevaluestartendZ line_textrrrtokenize_wrappers  rc@s:eZdZd ddZdddZddZdd d Zd d ZdS)PatternCompilerNcCsZ|dkrtj|_tj|_ntj||_tj|j|_tj|_ tj |_ tj |jt d|_dS)N)Zconvert)r Zpattern_grammarrZpattern_symbolssymsrZ load_grammarZSymbolsZpython_grammarZ pygrammarZpython_symbolspysymsZDriverpattern_convert)selfZ grammar_filerrr__init__(s  zPatternCompiler.__init__FcCsnt|}y|jj||d}Wn0tjk rL}ztt|WYdd}~XnX|r`|j||fS|j|SdS)N)debug)rrZ parse_tokensrZ ParseErrorr str compile_node)r$rr&Z with_treerrooterrrcompile_pattern7szPatternCompiler.compile_patternc sV|jjjkr|jd}|jjjkrzfdd|jdddD}t|dkrX|dStjdd|Dddd}|jS|jjj krʇfdd|jD}t|dkr|dStj|gddd}|jS|jjj krj |jdd}tj |}|jSd}|j}t|d kr>|djt jkr>|dj}|dd}d}t|dkrx|d jjjkrx|d }|dd }j ||}|dk r>|j} | d} | jt jkrd} tj} nX| jt jkrd} tj} n>| jt jkrj| d} } t| d krj| d } n| dks"| dkr>|j}tj|gg| | d}|dk rN||_|jS)Nrcsg|]}j|qSr)r().0ch)r$rr Osz0PatternCompiler.compile_node..rcSsg|] }|gqSrr)r,arrrr.Rs)minmaxcsg|]}j|qSr)r()r,r-)r$rrr.Vsr5r5)rr!ZMatcherchildrenZ Alternativeslenr WildcardPatternoptimizeZ AlternativeZ NegatedUnit compile_basicZNegatedPatternrEQUALrZRepeaterSTARZHUGEPLUSLBRACEget_intname) r$nodeZaltspZunitspatternr@nodesrepeatr6Zchildr1r2r)r$rr(Cs^       "    zPatternCompiler.compile_nodecCs@|d}|jtjkr4ttj|j}tjt ||S|jtj kr|j}|j r|t krbt d||ddrvt dtjt |S|dkrd}n,|jdst|j|d}|dkrt d||ddr|j|djdg}nd}tj||SnH|jdkr|j|dS|jd kr<|j|d}tj|ggddd SdS) NrzInvalid token: %rrzCan't have details for tokenany_zInvalid symbol: %r([)r1r2)rrSTRINGr'rZ evalStringrr Z LeafPattern_type_of_literalNAMEisupper TOKEN_MAPr startswithgetattrr"r(r6Z NodePatternr8)r$rDrErArrZcontent subpatternrrrr:s8         zPatternCompiler.compile_basiccCs t|jS)N)intr)r$rArrrr?szPatternCompiler.get_int)N)FF)N)r r rr%r+r(r:r?rrrrr &s   G #r )rLrJNUMBERZTOKENcCs.|djrtjS|tjkr&tj|SdSdS)Nr)isalpharrLrZopmap)rrrrrKs    rKcCs>|\}}}}|s||jkr*tj|||dStj|||dSdS)N)context)Z number2symbolr ZNodeZLeaf)rZ raw_node_inforrrUr6rrrr#s r#cCs tj|S)N)r r+)rCrrrr+sr+) __author__rZpgen2rrrrrrr r Exceptionr robjectr rLrJrSrNrKr#r+rrrr s      PKm;1]7M: +__pycache__/fixer_base.cpython-36.opt-2.pycnu[3 \"@sPddlZddlmZddlmZddlmZGdddeZGdd d eZ dS) N)PatternCompiler)pygram)does_tree_importc@seZdZdZdZdZdZdZej dZ e Z dZ dZdZdZdZdZejZddZdd Zd d Zd d ZddZdddZddZdddZddZddZddZ dS)BaseFixNrZpostFcCs||_||_|jdS)N)optionslogcompile_pattern)selfrr r */usr/lib64/python3.6/lib2to3/fixer_base.py__init__/szBaseFix.__init__cCs,|jdk r(t}|j|jdd\|_|_dS)NT)Z with_tree)PATTERNrr pattern pattern_tree)r PCr r r r ;s zBaseFix.compile_patterncCs ||_dS)N)filename)r rr r r set_filenameFszBaseFix.set_filenamecCsd|i}|jj||o|S)Nnode)rmatch)r rresultsr r r rMs z BaseFix.matchcCs tdS)N)NotImplementedError)r rrr r r transformYszBaseFix.transformxxx_todo_changemecCs6|}x ||jkr$|tt|j}qW|jj||S)N) used_namesstrnextnumbersadd)r templatenamer r r new_nameis   zBaseFix.new_namecCs.|jrd|_|jjd|j|jj|dS)NFz### In file %s ###) first_logr appendr)r messager r r log_messagetszBaseFix.log_messagecCs>|j}|j}d|_d}|j|||f|r:|j|dS)NzLine %d: could not convert: %s) get_linenoZcloneprefixr&)r rreasonlinenoZ for_outputmsgr r r cannot_convertzszBaseFix.cannot_convertcCs|j}|jd||fdS)Nz Line %d: %s)r(r&)r rr*r+r r r warningszBaseFix.warningcCs(|j|_|j|tjd|_d|_dS)NrT)rr itertoolscountrr#)r treerr r r start_trees  zBaseFix.start_treecCsdS)Nr )r r1rr r r finish_treeszBaseFix.finish_tree)r)N)!__name__ __module__ __qualname__rrrrrr/r0rsetrorderZexplicitZ run_orderZ _accept_typeZkeep_line_orderZ BM_compatiblerZpython_symbolsZsymsrr rrrr"r&r-r.r2r3r r r r rs2         rcs(eZdZdZfddZddZZS)ConditionalFixNcstt|j|d|_dS)N)superr9r2 _should_skip)r args) __class__r r r2szConditionalFix.start_treecCsJ|jdk r|jS|jjd}|d}dj|dd}t||||_|jS)N.rr?)r;skip_onsplitjoinr)r rZpkgr!r r r should_skips  zConditionalFix.should_skip)r4r5r6r@r2rC __classcell__r r )r=r r9s r9) r/Zpatcomprr'rZ fixer_utilrobjectrr9r r r r s    PKm;1]Zr~)__pycache__/__main__.cpython-36.opt-1.pycnu[3 \C@s&ddlZddlmZejeddS)N)mainz lib2to3.fixes)sysrexitrr(/usr/lib64/python3.6/lib2to3/__main__.pys PKm;1]{K{{#__pycache__/__init__.cpython-36.pycnu[3 \@sdS)Nrrr(/usr/lib64/python3.6/lib2to3/__init__.pysPKm;1]K,# # ,__pycache__/btm_matcher.cpython-36.opt-2.pycnu[3 \@shdZddlZddlZddlmZddlmZddlmZGddde Z Gd d d e Z ia d d Z dS) z+George Boutsioukis N) defaultdict)pytree) reduce_treec@seZdZejZddZdS)BMNodecCs"i|_g|_ttj|_d|_dS)N)transition_tablefixersnextrcountidcontent)selfr+/usr/lib64/python3.6/lib2to3/btm_matcher.py__init__s zBMNode.__init__N)__name__ __module__ __qualname__ itertoolsr rrrrrrsrc@s4eZdZddZddZddZddZd d Zd S) BottomMatchercCs0t|_t|_|jg|_g|_tjd|_dS)NZRefactoringTool) setmatchrrootZnodesr loggingZ getLoggerZlogger)rrrrrs  zBottomMatcher.__init__cCsL|jj|t|j}|j}|j||jd}x|D]}|jj|q4WdS)N)start)r appendrZ pattern_treeZget_linear_subpatternaddr)rfixerZtreeZlinear match_nodesZ match_noderrr add_fixer%s    zBottomMatcher.add_fixercCs|s |gSt|dtrhg}xF|dD]:}|j||d}x&|D]}|j|j|dd|q>Wq&W|S|d|jkrt}||j|d<n|j|d}|ddr|j|dd|d}n|g}|SdS)Nr)rr) isinstancetuplerextendrr)rpatternrr alternativeZ end_nodesendZ next_noderrrr1s" " zBottomMatcher.addc Cs0|j}tt}x|D]}|}x|r&d|_x,|jD]"}t|tjr8|jdkr8d|_Pq8W|j dkrp|j}n|j }||j kr|j |}x|j D]"}||krg||<||j |qWnd|j}|j dk r|j jrP||j kr|j |}x2|j D](}||jkr g||<||j |qW|j }q$WqW|S)NT;Fr)rrlistZ was_checkedZchildrenr!rZLeafvaluetyperr rparentkeys) rZleavesZcurrent_ac_nodeZresultsZleafZcurrent_ast_nodeZchildZ node_tokenrrrrrunSs>          zBottomMatcher.runcs*tdfdd|jtddS)Nz digraph g{cs^xX|jjD]J}|j|}td|j|jt|t|jf|dkrNt|j|q WdS)Nz%d -> %d [label=%s] //%sr)rr,printr type_reprstrr r )ZnodeZ subnode_keyZsubnode) print_noderrr1s  z*BottomMatcher.print_ac..print_node})r.r)rr)r1rprint_acs  zBottomMatcher.print_acN)rrrrr rr-r3rrrrrs  "=rcCsHtss    PKm;1]'q5fixes/__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  PKm;1]0fixes/__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   PKm;1]8ڒ-fixes/__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   PKm;1]YY0fixes/__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 PKm;1]#6fixes/__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   PKm;1]نuu+fixes/__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 PKm;1]{42fixes/__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  PKm;1]Bp  /fixes/__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     PKm;1]1fixes/__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  PKm;1]>fhh)fixes/__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 PKm;1]6H776fixes/__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 rsPKm;1] OO+fixes/__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@$ PKm;1] UU+fixes/__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  PKm;1]tu551fixes/__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 PKm;1] 'O!.fixes/__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  PKm;1]Ndd2fixes/__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 $PKm;1]]fEE0fixes/__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   PKm;1] ~aNN3fixes/__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   PKm;1]D.?446fixes/__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 PKm;1]Ѐ2fixes/__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  PKm;1] ~aNN-fixes/__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   PKm;1]sLUU5fixes/__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  PKm;1]؈]]4fixes/__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  PKm;1]&"<fixes/__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 PKm;1]Yٜxx-fixes/__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  PKm;1]7-fixes/__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   PKm;1]j,fixes/__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   PKm;1]Xz..fixes/__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    PKm;1]Cpb*fixes/__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    PKm;1]^.fixes/__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  PKm;1]Qv /fixes/__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   @ PKm;1]O 1fixes/__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  PKm;1]Ѐ8fixes/__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  PKm;1]:\NN/fixes/__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 PKm;1]Zļ0fixes/__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   PKm;1]̻*fixes/__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    PKm;1]폏/fixes/__pycache__/__init__.cpython-36.opt-1.pycnu[3 \/@sdS)Nrrr./usr/lib64/python3.6/lib2to3/fixes/__init__.pysPKm;1].fixes/__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  PKm;1]?dd2fixes/__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  PKm;1]!i 1fixes/__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  PKm;1]U3fixes/__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 PKm;1]Ⱥ,fixes/__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$  PKm;1]"^%*fixes/__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    PKm;1]K.fixes/__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  PKm;1]o>1fixes/__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   PKm;1]ȽHH5fixes/__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  PKm;1]+8nL 1fixes/__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 PKm;1]6#3ll/fixes/__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  PKm;1]نuu1fixes/__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 PKm;1]ȽHH/fixes/__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  PKm;1]qXF,fixes/__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  PKm;1]/Za/fixes/__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 PKm;1]9ss0fixes/__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    PKm;1]l5 5 2fixes/__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  PKm;1]^\4fixes/__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  PKm;1]rD0fixes/__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   PKm;1]> +fixes/__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  PKm;1]&Fam2fixes/__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  PKm;1]Ȍ +fixes/__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  PKm;1]>GG6fixes/__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  PKm;1]5ڍ_ (fixes/__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     PKm;1]T|7fixes/__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  PKm;1]#0fixes/__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   PKm;1]qXF2fixes/__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  PKm;1]T|1fixes/__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  PKm;1]*wGV0fixes/__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    PKm;1] W@-fixes/__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 PKm;1]g24fixes/__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  PKn;1]k/0fixes/__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  PKn;1]8ڒ'fixes/__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   PKn;1]/fixes/__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  PKn;1]C2fixes/__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 $PKn;1]8`6fixes/__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 rsPKn;1]w(fixes/__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    PKn;1]8fixes/__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  PKn;1]{4,fixes/__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  PKn;1]4PXX1fixes/__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   PKn;1]Yٜxx3fixes/__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  PKn;1] 'O!4fixes/__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  PKn;1]8`0fixes/__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 rsPKn;1]ZO#/KK2fixes/__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  PKn;1]3\\0fixes/__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   PKn;1]&Fam,fixes/__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  PKn;1]A uu+fixes/__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 PKn;1] OO1fixes/__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@$ PKn;1]Ⱥ2fixes/__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$  PKn;1].]551fixes/__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 PKn;1]Zq /fixes/__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     PKn;1] W@3fixes/__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 PKn;1]tҵ02fixes/__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"  PKn;1]5fixes/__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  PKn;1]a;888)fixes/__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 PKn;1]y )fixes/__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   @ PKn;1]O +fixes/__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  PKn;1]A uu1fixes/__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 PKn;1]R2P91fixes/__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  PKn;1]j2fixes/__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   PKn;1]9z*fixes/__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    PKn;1]rD6fixes/__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   PKn;1]Ndd,fixes/__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 $PKn;1]4fixes/__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  PKn;1]w2l4fixes/__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  PKn;1]G$ $ 1fixes/__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    PKn;1]\<ֶ0fixes/__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    PKn;1]dL2fixes/__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  PKn;1]C 1fixes/__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  PKn;1]"*)fixes/__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  PKn;1]YY*fixes/__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 PKn;1]9xx3fixes/__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 0PKn;1]w.fixes/__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    PKn;1]a;888/fixes/__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 PKn;1] UU1fixes/__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  PKn;1] `1fixes/__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  PKn;1]:~.fixes/__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   PKn;1] /fixes/__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   @ PKn;1]ݛuu4fixes/__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  PKn;1]a5fixes/__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  PKn;1].]  *fixes/__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    PKn;1]7N5fixes/__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  PKn;1]/Ii2fixes/__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  PKn;1]^D:<fixes/__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 PKn;1]3fixes/__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 PKn;1]G**+fixes/__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   PKn;1]"^%0fixes/__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    PKn;1]폏/fixes/__pycache__/__init__.cpython-36.opt-2.pycnu[3 \/@sdS)Nrrr./usr/lib64/python3.6/lib2to3/fixes/__init__.pysPKn;1]CyF0fixes/__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 PKn;1]7fixes/__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  PKn;1]I4-fixes/__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 PKn;1]a/fixes/__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  PKn;1]G$ $ +fixes/__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    PKn;1]E3-fixes/__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 0PKn;1]a3fixes/__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   PKn;1]> 1fixes/__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  PKn;1]Cpb0fixes/__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    PKn;1]hRN/fixes/__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 PKn;1]+??2fixes/__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   PKn;1]~660fixes/__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  PKn;1]k/*fixes/__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  PKn;1]Ȍ 1fixes/__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  PKn;1]N )fixes/__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     PKn;1]I43fixes/__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 PKn;1]k-O +fixes/__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     PKn;1]K4fixes/__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  PKn;1]5ڍ_ .fixes/__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     PKn;1]m23fixes/__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 0PKn;1]9z0fixes/__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    PKn;1]"*/fixes/__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  PKn;1]T6fixes/__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   PKn;1]Kt!!1fixes/__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>$ PKn;1]k-O 1fixes/__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     PKn;1]911fixes/__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  PKn;1]%ځ,fixes/__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  PKn;1]%ځ2fixes/__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  PKn;1]2fixes/__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  PKn;1]!ZH/ / 1fixes/__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    PKn;1]oH+Q Q ,fixes/__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  PKn;1]+fixes/__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  PKn;1]폏)fixes/__pycache__/__init__.cpython-36.pycnu[3 \/@sdS)Nrrr./usr/lib64/python3.6/lib2to3/fixes/__init__.pysPKn;1]aI䖪3fixes/__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 PKn;1]r399fixes/fix_reload.pynu["""Fixer for reload(). reload(s) -> importlib.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.argument and obj.children[0].value in {'**', '*'}): return # Make no change. names = ('importlib', 'reload') new = ImportAndCall(node, results, names) touch_import(None, 'importlib', node) return new PKn;1]8BB/pgen2/__pycache__/literals.cpython-36.opt-1.pycnu[3 \O @sPdZddlZddddddd d d d d ZddZddZddZedkrLedS)ztdD]2}t|}t|}t|}||kr t||||q WdS)N)rangerreprr-print)r$cr+er%r%r&test2s r4__main__)__doc__r)rr'r-r4__name__r%r%r%r&s   PKn;1]E&pgen2/__pycache__/parse.cpython-36.pycnu[3 \u@s4dZddlmZGdddeZGdddeZdS)zParser engine for the grammar tables generated by pgen. The grammar table must be loaded first. See Parser/parser.c in the Python distribution for additional info on how this parsing engine works. )tokenc@seZdZdZddZdS) ParseErrorz(Exception to signal the parser is stuck.cCs4tj|d||||f||_||_||_||_dS)Nz!%s: type=%r, value=%r, context=%r) Exception__init__msgtypevaluecontext)selfrrrr r +/usr/lib64/python3.6/lib2to3/pgen2/parse.pyrs zParseError.__init__N)__name__ __module__ __qualname____doc__rr r r r rsrc@sLeZdZdZdddZdddZddZd d Zd d Zd dZ ddZ dS)Parsera5Parser engine. The proper usage sequence is: p = Parser(grammar, [converter]) # create instance p.setup([start]) # prepare for parsing : if p.addtoken(...): # parse a token; may raise ParseError break root = p.rootnode # root of abstract syntax tree A Parser instance may be reused by calling setup() repeatedly. A Parser instance contains state pertaining to the current token sequence, and should not be used concurrently by different threads to parse separate token sequences. See driver.py for how to get input tokens by tokenizing a file or string. Parsing is complete when addtoken() returns True; the root of the abstract syntax tree can then be retrieved from the rootnode instance variable. When a syntax error occurs, addtoken() raises the ParseError exception. There is no error recovery; the parser cannot be used after a syntax error was reported (but it can be reinitialized by calling setup()). NcCs||_|pdd|_dS)aConstructor. The grammar argument is a grammar.Grammar instance; see the grammar module for more information. The parser is not ready yet for parsing; you must call the setup() method to get it started. The optional convert argument is a function mapping concrete syntax tree nodes to abstract syntax tree nodes. If not given, no conversion is done and the syntax tree produced is the concrete syntax tree. If given, it must be a function of two arguments, the first being the grammar (a grammar.Grammar instance), and the second being the concrete syntax tree node to be converted. The syntax tree is converted from the bottom up. A concrete syntax tree node is a (type, value, context, nodes) tuple, where type is the node type (a token or symbol number), value is None for symbols and a string for tokens, context is None or an opaque value used for error reporting (typically a (lineno, offset) pair), and nodes is a list of children for symbols, and None for tokens. An abstract syntax tree node may be anything; this is entirely up to the converter function. cSs|S)Nr )grammarnoder r r Wsz!Parser.__init__..N)rconvert)r rrr r r r9szParser.__init__cCsH|dkr|jj}|ddgf}|jj|d|f}|g|_d|_t|_dS)aPrepare for parsing. This *must* be called before starting to parse. The optional argument is an alternative start symbol; it defaults to the grammar's start symbol. You can use a Parser instance to parse any number of programs; each time you call setup() the parser is reset to an initial state determined by the (implicit or explicit) start symbol. N)rstartdfasstackrootnodeset used_names)r rnewnodeZ stackentryr r r setupYs  z Parser.setupcCsF|j|||}x0|jd \}}}|\}} ||} x| D]\} } |jj| \} }|| kr| dksft|j||| || }x@||d|fgkr|j|jsdS|jd \}}}|\}} q|WdS| dkr:|jj| }|\}}||kr:|j| |jj| | |Pq:Wd|f| kr0|j|js>t d|||qt d|||qWdS) z s  PKn;1].pgen2/__pycache__/grammar.cpython-36.opt-1.pycnu[3 \@sxdZddlZddlZddlmZmZGdddeZddZd Z iZ x.e j D]"Z e rNe j \ZZeeee e<qNWdS) aThis module defines the data structures used to represent a grammar. These are a bit arcane because they are derived from the data structures used by Python's 'pgen' parser generator. There's also a table here mapping operators to their names in the token module; the Python tokenize module reports all operators as the fallback token code OP, but the parser needs the actual token code. N)tokentokenizec@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)Grammara Pgen parsing tables conversion class. Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine accesses the instance variables directly. The class here does not provide initialization of the tables; several subclasses exist to do this (see the conv and pgen modules). The load() method reads the tables from a pickle file, which is much faster than the other ways offered by subclasses. The pickle file is written by calling dump() (after loading the grammar tables using a subclass). The report() method prints a readable representation of the tables to stdout, for debugging. The instance variables are as follows: symbol2number -- a dict mapping symbol names to numbers. Symbol numbers are always 256 or higher, to distinguish them from token numbers, which are between 0 and 255 (inclusive). number2symbol -- a dict mapping numbers to symbol names; these two are each other's inverse. states -- a list of DFAs, where each DFA is a list of states, each state is a list of arcs, and each arc is a (i, j) pair where i is a label and j is a state number. The DFA number is the index into this list. (This name is slightly confusing.) Final states are represented by a special arc of the form (0, j) where j is its own state number. dfas -- a dict mapping symbol numbers to (DFA, first) pairs, where DFA is an item from the states list above, and first is a set of tokens that can begin this grammar rule (represented by a dict whose values are always 1). labels -- a list of (x, y) pairs where x is either a token number or a symbol number, and y is either None or a string; the strings are keywords. The label number is the index in this list; label numbers are used to mark state transitions (arcs) in the DFAs. start -- the number of the grammar's start symbol. keywords -- a dict mapping keyword strings to arc labels. tokens -- a dict mapping token numbers to arc labels. cCs<i|_i|_g|_i|_dg|_i|_i|_i|_d|_dS)NrEMPTY)rr) symbol2number number2symbolstatesdfaslabelskeywordstokens symbol2labelstart)selfr-/usr/lib64/python3.6/lib2to3/pgen2/grammar.py__init__MszGrammar.__init__c Cs2t|d}t|j}tj||dWdQRXdS)aDump the grammar tables to a pickle file. dump() recursively changes all dict to OrderedDict, so the pickled file is not exactly the same as what was passed in to dump(). load() uses the pickled file to create the tables, but only changes OrderedDict to dict at the top level; it does not recursively change OrderedDict to dict. So, the loaded tables are different from the original tables that were passed to load() in that some of the OrderedDict (from the pickled file) are not changed back to dict. For parsing, this has no effect on performance because OrderedDict uses dict's __getitem__ with nothing in between. wbN)open_make_deterministic__dict__pickledump)rfilenamefdrrrrXs  z Grammar.dumpc Cs0t|d}tj|}WdQRX|jj|dS)z+Load the grammar tables from a pickle file.rbN)rrloadrupdate)rrrrrrrr is z Grammar.loadcCs|jjtj|dS)z3Load the grammar tables from a pickle bytes object.N)rr!rloads)rZpklrrrr"osz Grammar.loadscCsX|j}x"dD]}t||t||jqW|jdd|_|jdd|_|j|_|S) z# Copy the grammar. rr r r rrN)rr r r rr) __class__setattrgetattrcopyr r r)rnewZ dict_attrrrrr&ssz Grammar.copycCsvddlm}td||jtd||jtd||jtd||jtd||jtd|jd S) z:Dump the grammar tables to standard output, for debugging.r)pprintZs2nZn2sr r r rN)r(printrr r r r r)rr(rrrreports      zGrammar.reportN) __name__ __module__ __qualname____doc__rrr r"r&r*rrrrrs4  rcCs^t|tr&tjtdd|jDSt|tr>dd|DSt|trZtdd|DS|S)Ncss|]\}}|t|fVqdS)N)r).0kvrrr sz&_make_deterministic..cSsg|] }t|qSr)r)r/errr sz'_make_deterministic..css|]}t|VqdS)N)r)r/r3rrrr2s) isinstancedict collections OrderedDictsorteditemslisttuple)toprrrrs   ra ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW )r.r7rrrobjectrrZ opmap_rawZopmap splitlineslinesplitopnamer%rrrr sy= PKn;1]!>-pgen2/__pycache__/driver.cpython-36.opt-1.pycnu[3 \@sdZdZddgZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z m Z mZGdddeZd d ZdddZddZddZddZedkrejee dS)zZParser driver. This provides a high-level interface to parse a file into a syntax tree. z#Guido van Rossum Driver load_grammarN)grammarparsetokentokenizepgenc@sHeZdZdddZdddZdddZdd d Zdd d Zdd dZdS)rNcCs&||_|dkrtj}||_||_dS)N)rlogging getLoggerloggerconvert)selfrr r r,/usr/lib64/python3.6/lib2to3/pgen2/driver.py__init__ s zDriver.__init__FcCsvtj|j|j}|jd}d}d}}}} } d} x4|D]} | \}}}} } |||fkr|\} }|| kr| d| |7} | }d}||kr| | ||7} |}|tjtjfkr| |7} | \}}|jdr@|d7}d}q@|t j krtj |}|r|j j dt j||| |j||| |fr6|r4|j j dPd} | \}}|jdr@|d7}d}q@Wtjd||| |f|jS) z4Parse a series of tokens and return the syntax tree.rrN z%s %r (prefix=%r)zStop.zincomplete input)rZParserrr ZsetuprCOMMENTNLendswithrOPZopmapr debugtok_nameZaddtokenZ ParseErrorZrootnode)rtokensrplinenocolumntypevaluestartendZ line_textprefixZ quintupleZs_linenoZs_columnrrr parse_tokens'sR      zDriver.parse_tokenscCstj|j}|j||S)z*Parse a stream and return the syntax tree.)rgenerate_tokensreadliner#)rstreamrrrrrparse_stream_rawWs zDriver.parse_stream_rawcCs |j||S)z*Parse a stream and return the syntax tree.)r')rr&rrrr parse_stream\szDriver.parse_streamc Cs*tj|d|}z |j||S|jXdS)z(Parse a file and return the syntax tree.rN)codecsopenr(close)rfilenameencodingrr&rrr parse_file`s zDriver.parse_filecCstjtj|j}|j||S)z*Parse a string and return the syntax tree.)rr$ioStringIOr%r#)rtextrrrrr parse_stringhszDriver.parse_string)NN)F)F)F)NF)F) __name__ __module__ __qualname__rr#r'r(r/r3rrrrrs   0   cCs:tjj|\}}|dkrd}||djtttjdS)Nz.txtr.z.pickle)ospathsplitextjoinmapstrsys version_info)gtheadtailrrr_generate_pickle_namensrC Grammar.txtTFcCs|dkrtj}|dkr t|n|}|s4t|| r|jd|tj|}|r|jd|y|j|Wqtk r}z|jd|WYdd}~XqXnt j }|j ||S)z'Load the grammar (maybe from a pickle).Nz!Generating grammar tables from %szWriting grammar tables to %szWriting failed: %s) r r rC_newerinfor Zgenerate_grammardumpOSErrorrGrammarload)r@Zgpsaveforcer gerrrrus     cCs8tjj|sdStjj|s dStjj|tjj|kS)z0Inquire whether file a was written since file b.FT)r8r9existsgetmtime)abrrrrEs   rEcCsFtjj|rt|Sttjj|}tj||}tj }|j ||S)aNormally, loads a pickled grammar by doing pkgutil.get_data(package, pickled_grammar) where *pickled_grammar* is computed from *grammar_source* by adding the Python version and using a ``.pickle`` extension. However, if *grammar_source* is an extant file, load_grammar(grammar_source) is called instead. This facilitates using a packaged grammar file when needed but preserves load_grammar's automatic regeneration behavior when possible. ) r8r9isfilerrCbasenamepkgutilget_datarrIloads)packageZgrammar_sourceZ pickled_namedatarMrrrload_packaged_grammars   rZcGsF|stjdd}tjtjtjddx|D]}t|dddq,WdS)zMain program, when run as a script: produce grammar pickle files. Calls load_grammar for each argument, a path to a grammar text file. rNz %(message)s)levelr&formatT)rKrL)r>argvr Z basicConfigINFOstdoutr)argsr@rrrmains  ra__main__)rDNTFN)__doc__ __author____all__r*r0r8r rUr>rrrrrr objectrrCrrErZrar4exitintrrrr s$P   PKn;1](/pgen2/__pycache__/__init__.cpython-36.opt-1.pycnu[3 \@sdZdS)zThe pgen2 package.N)__doc__rr./usr/lib64/python3.6/lib2to3/pgen2/__init__.pysPKn;1]S<<,pgen2/__pycache__/token.cpython-36.opt-1.pycnu[3 \@sPdZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;dx6e?e@jAD]$\ZBZCeDeCeDdkr eBe>eC<q Wd>d?ZEd@dAZFdBdCZGdDS)Ez!Token constants (from "token.h").  !"#$%&'()*+,-./0123456789:;cCs|tkS)N) NT_OFFSET)xr@+/usr/lib64/python3.6/lib2to3/pgen2/token.py ISTERMINALNsrBcCs|tkS)N)r>)r?r@r@rA ISNONTERMINALQsrCcCs|tkS)N) ENDMARKER)r?r@r@rAISEOFTsrEN)H__doc__rDNAMENUMBERSTRINGNEWLINEINDENTDEDENTLPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENTZ BACKQUOTELBRACERBRACEEQEQUALNOTEQUAL LESSEQUAL GREATEREQUALTILDE CIRCUMFLEX LEFTSHIFT RIGHTSHIFT DOUBLESTAR PLUSEQUALMINEQUAL STAREQUAL SLASHEQUAL PERCENTEQUAL AMPEREQUAL VBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUAL DOUBLESLASHDOUBLESLASHEQUALATATEQUALOPCOMMENTNLRARROWAWAITASYNC ERRORTOKENN_TOKENSr>tok_namelistglobalsitems_nameZ_valuetyperBrCrEr@r@r@rAsPKn;1]*u$u$+pgen2/__pycache__/pgen.cpython-36.opt-1.pycnu[3 \5@sdddlmZmZmZGdddejZGdddeZGdddeZGdd d eZ dd d Z d S))grammartokentokenizec@s eZdZdS) PgenGrammarN)__name__ __module__ __qualname__r r */usr/lib64/python3.6/lib2to3/pgen2/pgen.pyrsrc@seZdZd&ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd'd d!Zd"d#Zd$d%ZdS)(ParserGeneratorNcCsld}|dkrt|}|j}||_||_tj|j|_|j|j \|_ |_ |dk rZ|i|_ |j dS)N)openclosefilenamestreamrgenerate_tokensreadline generatorgettokenparsedfas startsymbolfirst addfirstsets)selfrrZ close_streamr r r __init__ szParserGenerator.__init__c Cs*t}t|jj}|j|j|j|jd|jx.|D]&}dt|j }||j |<||j |<qtt|d}||jkrz|j|S|jj|df||j|<|Snt |}|djr||j kr|j |S|jjtj |f||j |<|Sn>t j |}||jkr|j|S|jj|df||j|<|SdS)Nr)r"Zlabelsisalphar#Z symbol2labelr'getattrrtokensevalkeywordsNAMErZopmap)rr.r4r7Zitokenvaluer r r r(=s6                  zParserGenerator.make_labelcCs<t|jj}|jx |D]}||jkr|j|qWdS)N)rrrrr calcfirst)rr/r0r r r rks   zParserGenerator.addfirstsetsc Cs |j|}d|j|<|d}i}i}x|jjD]x\}}||jkr||jkrl|j|}|dkrtd|n|j||j|}|j||||<q0d||<|di||<q0Wi} xJ|jD]>\}} x4| D],} | | krtd|| || | f|| | <qWqW||j|<dS)Nrzrecursion for rule %rrzArule %s is ambiguous; %s is in the first sets of %s as well as %s)rrr%r& ValueErrorr?update) rr0r2r3ZtotalsetZ overlapcheckr4r5fsetZinverseZitsfirstZsymbolr r r r?ss2          zParserGenerator.calcfirstc Csi}d}x|jtjkrx|jtjkr.|jqW|jtj}|jtjd|j\}}|jtj|j ||}t |}|j |t |}|||<|dkr |}q W||fS)N:) typer ENDMARKERNEWLINErexpectr=OP parse_rhsmake_dfar" simplify_dfa) rrrr0azr2ZoldlenZnewlenr r r rs"      zParserGenerator.parsec sfdd}fddt|||g}x|D]}i}x<|jD]2}x,|jD]"\}} |dk rJ| |j|iqJWq>WxRt|jD]B\}} x,|D]} | j| krPqWt| |} |j| |j| |qWq.W|S)Ncsi}|||S)Nr )r3base) addclosurer r closures z)ParserGenerator.make_dfa..closurecs>||kr dSd||<x$|jD]\}}|dkr||qWdS)Nr)r%)r3rNr4r5)rOr r rOs z,ParserGenerator.make_dfa..addclosure)DFAStatenfasetr% setdefaultr$r&r'addarc) rr-finishrPr+r3r%Znfastater4r5rRstr )rOr rJs"        zParserGenerator.make_dfac Cstd||g}xt|D]\}}td|||kr4dp6dx^|jD]T\}}||kr^|j|} nt|} |j||dkrtd| qBtd|| fqBWqWdS)NzDump of NFA forz Statez(final)z -> %dz %s -> %d)print enumerater%r)r"r') rr0r-rUZtodor1r3r4r5jr r r dump_nfas   zParserGenerator.dump_nfacCsltd|x\t|D]P\}}td||jr,dp.dx0t|jjD]\}}td||j|fqBWqWdS)NzDump of DFA forz Statez(final)rWz %s -> %d)rXrYr*r$r%r&r))rr0r2r1r3r4r5r r r dump_dfas  zParserGenerator.dump_dfacCs~d}xt|rxd}xft|D]Z\}}xPt|dt|D]:}||}||kr4||=x|D]}|j||qTWd}Pq4WqWqWdS)NTFr)rYranger" unifystate)rr2Zchangesr1Zstate_irZZstate_jr3r r r rKs zParserGenerator.simplify_dfacCs|j\}}|jdkr||fSt}t}|j||j|x6|jdkrt|j|j\}}|j||j|q@W||fSdS)N|) parse_altr>NFAStaterTr)rrLrMZaaZzzr r r rIs       zParserGenerator.parse_rhscCsP|j\}}x:|jdks*|jtjtjfkrF|j\}}|j||}qW||fS)N([)rbrc) parse_itemr>rDrr=STRINGrT)rrLbr.dr r r r` s    zParserGenerator.parse_altcCs|jdkr>|j|j\}}|jtjd|j|||fS|j\}}|j}|dkr`||fS|j|j||dkr||fS||fSdS)Nrc]+*)rirj)r>rrIrGrrHrT parse_atom)rrLrMr>r r r rds     zParserGenerator.parse_itemcCs|jdkr4|j|j\}}|jtjd||fS|jtjtjfkrpt }t }|j ||j|j||fS|j d|j|jdS)Nrb)z+expected (...) or NAME or STRING, got %s/%s) r>rrIrGrrHrDr=rerarT raise_error)rrLrMr r r rk(s  zParserGenerator.parse_atomcCsD|j|ks|dk r2|j|kr2|jd|||j|j|j}|j|S)Nzexpected %s/%s, got %s/%s)rDr>rmr)rrDr>r r r rG9s zParserGenerator.expectcCsJt|j}x"|dtjtjfkr,t|j}q W|\|_|_|_|_|_ dS)Nr) r5rrCOMMENTNLrDr>Zbeginendline)rtupr r r rAs zParserGenerator.gettokenc Gs^|r8y ||}Wn&dj|gttt|}YnXt||j|jd|jd|jfdS)N rr)joinrmapstr SyntaxErrorrrprq)rmsgargsr r r rmHs  zParserGenerator.raise_error)N)N)rrrrr6r,r(rr?rrJr[r\rKrIr`rdrkrGrrmr r r r r s$  .$  r c@seZdZddZdddZdS)racCs g|_dS)N)r%)rr r r rSszNFAState.__init__NcCs|jj||fdS)N)r%r')rr5r4r r r rTVszNFAState.addarc)N)rrrrrTr r r r raQsrac@s0eZdZddZddZddZddZd Zd S) rQcCs||_||k|_i|_dS)N)rRr*r%)rrRfinalr r r r]s zDFAState.__init__cCs||j|<dS)N)r%)rr5r4r r r rTeszDFAState.addarccCs.x(|jjD]\}}||kr ||j|<q WdS)N)r%r&)roldnewr4r5r r r r^kszDFAState.unifystatecCsX|j|jkrdSt|jt|jkr(dSx*|jjD]\}}||jj|k r4dSq4WdS)NFT)r*r"r%r&get)rotherr4r5r r r __eq__ps zDFAState.__eq__N)rrrrrTr^r__hash__r r r r rQ[s rQ Grammar.txtcCst|}|jS)N)r r6)rpr r r generate_grammarsrN)r) rWrrrZGrammarrobjectr rarQrr r r r sI %PKn;1].9&9&%pgen2/__pycache__/pgen.cpython-36.pycnu[3 \5@sdddlmZmZmZGdddejZGdddeZGdddeZGdd d eZ dd d Z d S))grammartokentokenizec@s eZdZdS) PgenGrammarN)__name__ __module__ __qualname__r r */usr/lib64/python3.6/lib2to3/pgen2/pgen.pyrsrc@seZdZd&ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd'd d!Zd"d#Zd$d%ZdS)(ParserGeneratorNcCsld}|dkrt|}|j}||_||_tj|j|_|j|j \|_ |_ |dk rZ|i|_ |j dS)N)openclosefilenamestreamrgenerate_tokensreadline generatorgettokenparsedfas startsymbolfirst addfirstsets)selfrrZ close_streamr r r __init__ szParserGenerator.__init__c Cs*t}t|jj}|j|j|j|jd|jx.|D]&}dt|j }||j |<||j |<qtj|}||j kr@|j |S|jj|df||j |<|SdS)Nr"')r8r9)r"Zlabelsisalphar#Z symbol2labelr'getattrr isinstanceintAssertionErrortok_nametokensevalkeywordsNAMErZopmap)rr.r4r7Zitokenvaluer r r r(=s<                 zParserGenerator.make_labelcCs<t|jj}|jx |D]}||jkr|j|qWdS)N)rrrrr calcfirst)rr/r0r r r rks   zParserGenerator.addfirstsetsc Cs |j|}d|j|<|d}i}i}x|jjD]x\}}||jkr||jkrl|j|}|dkrtd|n|j||j|}|j||||<q0d||<|di||<q0Wi} xJ|jD]>\}} x4| D],} | | krtd|| || | f|| | <qWqW||j|<dS)Nrzrecursion for rule %rrzArule %s is ambiguous; %s is in the first sets of %s as well as %s)rrr%r& ValueErrorrEupdate) rr0r2r3ZtotalsetZ overlapcheckr4r5fsetZinverseZitsfirstZsymbolr r r rEss2          zParserGenerator.calcfirstc Csi}d}x|jtjkrx|jtjkr.|jqW|jtj}|jtjd|j\}}|jtj|j ||}t |}|j |t |}|||<|dkr |}q W||fS)N:) typer ENDMARKERNEWLINErexpectrCOP parse_rhsmake_dfar" simplify_dfa) rrrr0azr2ZoldlenZnewlenr r r rs"      zParserGenerator.parsec st|tstt|tstfdd}fddt|||g}x|D]}i}x<|jD]2}x,|jD]"\}} |dk rf| |j|iqfWqZWxRt|jD]B\}} x,|D]} | j| krPqWt| |} |j | |j | |qWqJW|S)Ncsi}|||S)Nr )r3base) addclosurer r closures z)ParserGenerator.make_dfa..closurecsLt|tst||krdSd||<x$|jD]\}}|dkr*||q*WdS)Nr)r<NFAStater>r%)r3rTr4r5)rUr r rUsz,ParserGenerator.make_dfa..addclosure) r<rWr>DFAStatenfasetr% setdefaultr$r&r'addarc) rr-finishrVr+r3r%Znfastater4r5rYstr )rUr rPs&        zParserGenerator.make_dfac Cstd||g}xt|D]\}}td|||kr4dp6dx^|jD]T\}}||kr^|j|} nt|} |j||dkrtd| qBtd|| fqBWqWdS)NzDump of NFA forz Statez(final)z -> %dz %s -> %d)print enumerater%r)r"r') rr0r-r\Ztodor1r3r4r5jr r r dump_nfas   zParserGenerator.dump_nfacCsltd|x\t|D]P\}}td||jr,dp.dx0t|jjD]\}}td||j|fqBWqWdS)NzDump of DFA forz Statez(final)r^z %s -> %d)r_r`r*r$r%r&r))rr0r2r1r3r4r5r r r dump_dfas  zParserGenerator.dump_dfacCs~d}xt|rxd}xft|D]Z\}}xPt|dt|D]:}||}||kr4||=x|D]}|j||qTWd}Pq4WqWqWdS)NTFr)r`ranger" unifystate)rr2Zchangesr1Zstate_iraZstate_jr3r r r rQs zParserGenerator.simplify_dfacCs|j\}}|jdkr||fSt}t}|j||j|x6|jdkrt|j|j\}}|j||j|q@W||fSdS)N|) parse_altrDrWr[r)rrRrSZaaZzzr r r rOs       zParserGenerator.parse_rhscCsP|j\}}x:|jdks*|jtjtjfkrF|j\}}|j||}qW||fS)N([)rhri) parse_itemrDrJrrCSTRINGr[)rrRbr.dr r r rg s    zParserGenerator.parse_altcCs|jdkr>|j|j\}}|jtjd|j|||fS|j\}}|j}|dkr`||fS|j|j||dkr||fS||fSdS)Nri]+*)rorp)rDrrOrMrrNr[ parse_atom)rrRrSrDr r r rjs     zParserGenerator.parse_itemcCs|jdkr4|j|j\}}|jtjd||fS|jtjtjfkrpt }t }|j ||j|j||fS|j d|j|jdS)Nrh)z+expected (...) or NAME or STRING, got %s/%s) rDrrOrMrrNrJrCrkrWr[ raise_error)rrRrSr r r rq(s  zParserGenerator.parse_atomcCsD|j|ks|dk r2|j|kr2|jd|||j|j|j}|j|S)Nzexpected %s/%s, got %s/%s)rJrDrsr)rrJrDr r r rM9s zParserGenerator.expectcCsJt|j}x"|dtjtjfkr,t|j}q W|\|_|_|_|_|_ dS)Nr) r5rrCOMMENTNLrJrDZbeginendline)rtupr r r rAs zParserGenerator.gettokenc Gs^|r8y ||}Wn&dj|gttt|}YnXt||j|jd|jd|jfdS)N rr)joinrmapstr SyntaxErrorrrvrw)rmsgargsr r r rsHs  zParserGenerator.raise_error)N)N)rrrrr6r,r(rrErrPrbrcrQrOrgrjrqrMrrsr r r r r s$  .$  r c@seZdZddZdddZdS)rWcCs g|_dS)N)r%)rr r r rSszNFAState.__init__NcCs8|dkst|tstt|ts$t|jj||fdS)N)r<r|r>rWr%r')rr5r4r r r r[VszNFAState.addarc)N)rrrrr[r r r r rWQsrWc@s0eZdZddZddZddZddZd Zd S) rXcCsLt|tstttt|ts$tt|ts2t||_||k|_i|_dS)N) r<dictr>r5iterrWrYr*r%)rrYfinalr r r r]s  zDFAState.__init__cCs8t|tst||jkstt|ts*t||j|<dS)N)r<r|r>r%rX)rr5r4r r r r[eszDFAState.addarccCs.x(|jjD]\}}||kr ||j|<q WdS)N)r%r&)roldnewr4r5r r r rekszDFAState.unifystatecCsft|tst|j|jkrdSt|jt|jkr6dSx*|jjD]\}}||jj|k rBdSqBWdS)NFT)r<rXr>r*r"r%r&get)rotherr4r5r r r __eq__ps zDFAState.__eq__N)rrrrr[rer__hash__r r r r rX[s rX Grammar.txtcCst|}|jS)N)r r6)rpr r r generate_grammarsrN)r) r^rrrZGrammarrobjectr rWrXrr r r r sI %PKn;1]mS-pgen2/__pycache__/driver.cpython-36.opt-2.pycnu[3 \@sdZddgZddlZddlZddlZddlZddlZddlZddlm Z m Z m Z m Z m Z GdddeZdd Zdd dZddZddZddZedkrejee dS)z#Guido van Rossum Driver load_grammarN)grammarparsetokentokenizepgenc@sHeZdZdddZdddZdddZdd d Zdd d Zdd dZdS)rNcCs&||_|dkrtj}||_||_dS)N)rlogging getLoggerloggerconvert)selfrr r r,/usr/lib64/python3.6/lib2to3/pgen2/driver.py__init__ s zDriver.__init__FcCsvtj|j|j}|jd}d}d}}}} } d} x4|D]} | \}}}} } |||fkr|\} }|| kr| d| |7} | }d}||kr| | ||7} |}|tjtjfkr| |7} | \}}|jdr@|d7}d}q@|t j krtj |}|r|j j dt j||| |j||| |fr6|r4|j j dPd} | \}}|jdr@|d7}d}q@Wtjd||| |f|jS)Nrr z%s %r (prefix=%r)zStop.zincomplete input)rZParserrr ZsetuprCOMMENTNLendswithrOPZopmapr debugtok_nameZaddtokenZ ParseErrorZrootnode)rtokensrplinenocolumntypevaluestartendZ line_textprefixZ quintupleZs_linenoZs_columnrrr parse_tokens'sR      zDriver.parse_tokenscCstj|j}|j||S)N)rgenerate_tokensreadliner#)rstreamrrrrrparse_stream_rawWs zDriver.parse_stream_rawcCs |j||S)N)r')rr&rrrr parse_stream\szDriver.parse_streamc Cs*tj|d|}z |j||S|jXdS)Nr)codecsopenr(close)rfilenameencodingrr&rrr parse_file`s zDriver.parse_filecCstjtj|j}|j||S)N)rr$ioStringIOr%r#)rtextrrrrr parse_stringhszDriver.parse_string)NN)F)F)F)NF)F) __name__ __module__ __qualname__rr#r'r(r/r3rrrrrs   0   cCs:tjj|\}}|dkrd}||djtttjdS)Nz.txtr.z.pickle)ospathsplitextjoinmapstrsys version_info)gtheadtailrrr_generate_pickle_namensrC Grammar.txtTFcCs|dkrtj}|dkr t|n|}|s4t|| r|jd|tj|}|r|jd|y|j|Wqtk r}z|jd|WYdd}~XqXnt j }|j ||S)Nz!Generating grammar tables from %szWriting grammar tables to %szWriting failed: %s) r r rC_newerinfor Zgenerate_grammardumpOSErrorrGrammarload)r@Zgpsaveforcer gerrrrus     cCs8tjj|sdStjj|s dStjj|tjj|kS)NFT)r8r9existsgetmtime)abrrrrEs   rEcCsFtjj|rt|Sttjj|}tj||}tj }|j ||S)N) r8r9isfilerrCbasenamepkgutilget_datarrIloads)packageZgrammar_sourceZ pickled_namedatarMrrrload_packaged_grammars   rZcGsF|stjdd}tjtjtjddx|D]}t|dddq,WdS)Nrz %(message)s)levelr&formatT)rKrL)r>argvr Z basicConfigINFOstdoutr)argsr@rrrmains  ra__main__)rDNTFN) __author____all__r*r0r8r rUr>rrrrrr objectrrCrrErZrar4exitintrrrrs"P   PKn;1]qM .pgen2/__pycache__/grammar.cpython-36.opt-2.pycnu[3 \@stddlZddlZddlmZmZGdddeZddZdZiZ x.ej D]"Z e rJe j \Z Zeeee e <qJWdS) N)tokentokenizec@s<eZdZddZddZddZddZd d Zd d Zd S)GrammarcCs<i|_i|_g|_i|_dg|_i|_i|_i|_d|_dS)NrEMPTY)rr) symbol2number number2symbolstatesdfaslabelskeywordstokens symbol2labelstart)selfr-/usr/lib64/python3.6/lib2to3/pgen2/grammar.py__init__MszGrammar.__init__c Cs2t|d}t|j}tj||dWdQRXdS)Nwb)open_make_deterministic__dict__pickledump)rfilenamefdrrrrXs  z Grammar.dumpc Cs0t|d}tj|}WdQRX|jj|dS)Nrb)rrloadrupdate)rrrrrrrr is z Grammar.loadcCs|jjtj|dS)N)rr!rloads)rZpklrrrr"osz Grammar.loadscCsX|j}x"dD]}t||t||jqW|jdd|_|jdd|_|j|_|S)Nrr r r rr)rr r r rr) __class__setattrgetattrcopyr r r)rnewZ dict_attrrrrr&ssz Grammar.copycCsvddlm}td||jtd||jtd||jtd||jtd||jtd|jdS) Nr)pprintZs2nZn2sr r r r)r(printrr r r r r)rr(rrrreports      zGrammar.reportN) __name__ __module__ __qualname__rrr r"r&r*rrrrrs 6  rcCs^t|tr&tjtdd|jDSt|tr>dd|DSt|trZtdd|DS|S)Ncss|]\}}|t|fVqdS)N)r).0kvrrr sz&_make_deterministic..cSsg|] }t|qSr)r)r.errr sz'_make_deterministic..css|]}t|VqdS)N)r)r.r2rrrr1s) isinstancedict collections OrderedDictsorteditemslisttuple)toprrrrs   ra ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW )r6rrrobjectrrZ opmap_rawZopmap splitlineslinesplitopnamer%rrrrsy= PKn;1] PP+pgen2/__pycache__/conv.cpython-36.opt-2.pycnu[3 \%@s.ddlZddlmZmZGdddejZdS)N)grammartokenc@s,eZdZddZddZddZddZd S) ConvertercCs |j||j||jdS)N)parse_graminit_hparse_graminit_c finish_off)selfZ graminit_hZ graminit_cr */usr/lib64/python3.6/lib2to3/pgen2/conv.pyrun/s  z Converter.runc Csy t|}Wn0tk r<}ztd||fdSd}~XnXi|_i|_d}xn|D]f}|d7}tjd|}| r|jrtd|||jfqT|j\}}t |}||j|<||j|<qTWdS)NzCan't open %s: %sFrz^#define\s+(\w+)\s+(\d+)$z%s(%s): can't parse %sT) openOSErrorprintZ symbol2numberZ number2symbolrematchstripgroupsint) rfilenameferrlinenolinemosymbolnumberr r r r5s&     zConverter.parse_graminit_hc!Csy t|}Wn0tk r<}ztd||fdSd}~XnXd}|dt|}}|dt|}}|dt|}}i}g}x|jdrx|jdrLtjd|}ttt |j \} } } g} xRt | D]F} |dt|}}tjd|}ttt |j \}}| j ||fqW|dt|}}| || | f<|dt|}}qWtjd|}ttt |j \}}g}x^t |D]R} |dt|}}tjd |}ttt |j \} } } || | f} |j | q~W|j ||dt|}}|dt|}}qW||_ i}tjd |}t |jd}xt |D]}|dt|}}tjd |}|jd }ttt |jdd dd\}}}}||}|dt|}}tjd|}i}t|jd}xPt|D]D\}}t|}x0t dD]$}|d|>@rd||d|<qWqW||f||<q4W|dt|}}||_g}|dt|}}tjd|}t |jd}xjt |D]^}|dt|}}tjd|}|j \}}t |}|dkrd}nt|}|j ||fqpW|dt|}}||_|dt|}}|dt|}}tjd|}t |jd}|dt|}}|dt|}}tjd|}t |jd}|dt|}}tjd|}t |jd} | |_|dt|}}y|dt|}}Wntk rYnXdS)NzCan't open %s: %sFrr z static arc z)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$z\s+{(\d+), (\d+)},$z'static state states_(\d+)\[(\d+)\] = {$z\s+{(\d+), arcs_(\d+)_(\d+)},$zstatic dfa dfas\[(\d+)\] = {$z0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$z\s+("(?:\\\d\d\d)*")},$z!static label labels\[(\d+)\] = {$z\s+{(\d+), (0|"\w+")},$0z \s+(\d+),$z\s+{(\d+), labels},$z \s+(\d+)$)r rrnext startswithrrlistmaprrrangeappendstatesgroupeval enumerateorddfaslabelsstart StopIteration)!rrrrrrZallarcsr)rnmkZarcs_ijststater.ZndfasrrxyzfirstZ rawbitsetcZbyter/Znlabelsr0r r r rTs         "        zConverter.parse_graminit_ccCs\i|_i|_xJt|jD]<\}\}}|tjkrB|dk rB||j|<q|dkr||j|<qWdS)N)keywordstokensr,r/rNAME)rZilabeltypevaluer r r rs zConverter.finish_offN)__name__ __module__ __qualname__r rrrr r r r r$s  &r)rZpgen2rrZGrammarrr r r r sPKn;1]   ,pgen2/__pycache__/parse.cpython-36.opt-2.pycnu[3 \u@s0ddlmZGdddeZGdddeZdS))tokenc@seZdZddZdS) ParseErrorcCs4tj|d||||f||_||_||_||_dS)Nz!%s: type=%r, value=%r, context=%r) Exception__init__msgtypevaluecontext)selfrrrr r +/usr/lib64/python3.6/lib2to3/pgen2/parse.pyrs zParseError.__init__N)__name__ __module__ __qualname__rr r r r rsrc@sHeZdZdddZdddZddZdd Zd d Zd d ZddZ dS)ParserNcCs||_|pdd|_dS)NcSs|S)Nr )grammarnoder r r Wsz!Parser.__init__..)rconvert)r rrr r r r9szParser.__init__cCsH|dkr|jj}|ddgf}|jj|d|f}|g|_d|_t|_dS)N)rstartdfasstackrootnodeset used_names)r rnewnodeZ stackentryr r r setupYs  z Parser.setupcCs:|j|||}x$|jd\}}}|\}} ||} x| D]\} } |jj| \} }|| kr|j||| || }x@||d|fgkr|j|jsdS|jd \}}}|\}} qpWdS| dkr:|jj| }|\}}||kr:|j| |jj| | |Pq:Wd|f| kr$|j|js2td|||qtd|||qWdS) NrrTFztoo much inputz bad inputr) classifyrrZlabelsshiftpoprpushr)r rrr ilabeldfastaterZstatesfirstZarcsinewstatetvZitsdfaZ itsstatesZitsfirstr r r addtokenqs:   zParser.addtokencCsX|tjkr0|jj||jjj|}|dk r0|S|jjj|}|dkrTtd||||S)Nz bad token) rNAMEraddrkeywordsgettokensr)r rrr r$r r r r s  zParser.classifyc CsT|jd\}}}|||df}|j|j|}|dk r@|dj||||f|jd<dS)Nrrrr)rrrappend) r rrr)r r%r&rrr r r r!s  z Parser.shiftc CsB|jd\}}}|d|gf}|||f|jd<|jj|d|fdS)Nrrrr)rr2) r rZnewdfar)r r%r&rrr r r r#s z Parser.pushcCs`|jj\}}}|j|j|}|dk r\|jrL|jd\}}}|dj|n||_|j|j_dS)Nrrr)rr"rrr2rr)r ZpopdfaZpopstateZpopnoderr%r&rr r r r"sz Parser.pop)N)N) r rrrrr,r r!r#r"r r r r rs 0 rN)rrrobjectrr r r r s  PKn;1]&w,w,/pgen2/__pycache__/tokenize.cpython-36.opt-2.pycnu[3 \NX=@sdZdZddlZddlZddlmZmZddlTddlm Z dd e e Dd d d gZ [ ye Wne k rzeZ YnXd dZddZddZdZdZeedeeeZdZdZdZdZeddZeeeeeZdZeddeeZdeZeeeZed ed!ZeeeeZ d"Z!d#Z"d$Z#d%Z$d&Z%ee%d'e%d(Z&ee%d)e%d*Z'ed+d,d-d.d/d0d1d2d3 Z(d4Z)ed5d6Z*ee(e)e*Z+ee e+e'eZ,ee,Z-ee%d7ed8de%d9ed:dZ.edee&Z/eee/e e+e.eZ0e1e2ej3e-e0e#e$f\Z4Z5Z6Z7ej3e!ej3e"e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7e6e7ddddddddd;4Z8iZ9xdD]Z:e:e9e:<qWiZ;xdD]Z:e:e;e:<qWdZGddde=Z?ddZ@e@fdd ZAddZBGdddZCej3dejDZEej3dejDZFddZGddZHdd ZIdd ZJeKdkrddlLZLeMeLjNdkrxeAeOeLjNdjPn eAeLjQjPdS)zKa-Ping Yee z@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip MontanaroN)BOM_UTF8lookup)*)tokencCsg|]}|ddkr|qS)r_).0xrr./usr/lib64/python3.6/lib2to3/pgen2/tokenize.py %sr tokenizegenerate_tokens untokenizecGsddj|dS)N(|))join)choicesrrr group0srcGs t|dS)Nr)r)rrrr any1srcGs t|dS)N?)r)rrrr maybe2srz[ \f\t]*z #[^\r\n]*z\\\r?\nz [a-zA-Z_]\w*z0[bB]_?[01]+(?:_[01]+)*z(0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?z0[oO]?_?[0-7]+(?:_[0-7]+)*[lL]?z[1-9]\d*(?:_\d+)*[lL]?z0[lL]?z[eE][-+]?\d+(?:_\d+)*z\d+(?:_\d+)*\.(?:\d+(?:_\d+)*)?z\.\d+(?:_\d+)*z \d+(?:_\d+)*z\d+(?:_\d+)*[jJ]z[jJ]z[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z#(?:[uUrRbBfF]|[rR][bB]|[bBuU][rR])?'''"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z<>z!=z//=?z->z[+\-*/%&@|^=<>]=?~z[][(){}]z\r?\nz[:;.,`@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*")4rrz'''z"""zr'''zr"""zu'''zu"""zb'''zb"""zf'''zf"""zur'''zur"""zbr'''zbr"""zrb'''zrb"""zR'''zR"""zU'''zU"""zB'''zB"""zF'''zF"""zuR'''zuR"""zUr'''zUr"""zUR'''zUR"""zbR'''zbR"""zBr'''zBr"""zBR'''zBR"""zrB'''zrB"""zRb'''zRb"""zRB'''zRB"""rRuUfFbBr'''r"""R'''R"""u'''u"""U'''U"""b'''b"""B'''B"""f'''f"""F'''F"""ur'''ur"""Ur'''Ur"""uR'''uR"""UR'''UR"""br'''br"""Br'''Br"""bR'''bR"""BR'''BR"""rb'''rb"""Rb'''Rb"""rB'''rB"""RB'''RB"""r'r"R'R"u'u"U'U"b'b"B'B"f'f"F'F"ur'ur"Ur'Ur"uR'uR"UR'UR"br'br"Br'Br"bR'bR"BR'BR"rb'rb"Rb'Rb"rB'rB"RB'RB"c@s eZdZdS) TokenErrorN)__name__ __module__ __qualname__rrrr rwsrwc@s eZdZdS)StopTokenizingN)rxryrzrrrr r{sr{c Cs4|\}}|\}}td||||t|t|fdS)Nz%d,%d-%d,%d: %s %s)printtok_namerepr) typerZxxx_todo_changemeZxxx_todo_changeme1lineZsrowZscolZerowZecolrrr printtokensrc Cs(yt||Wntk r"YnXdS)N) tokenize_loopr{)readline tokeneaterrrr r s cCsxt|D] }||q WdS)N)r)rrZ token_inforrr rsrc@s,eZdZddZddZddZddZd S) UntokenizercCsg|_d|_d|_dS)Nrr)tokensprev_rowprev_col)selfrrr __init__szUntokenizer.__init__cCs*|\}}||j}|r&|jjd|dS)N )rrappend)rstartrowcol col_offsetrrr add_whitespaces zUntokenizer.add_whitespacecCsxv|D]n}t|dkr$|j||P|\}}}}}|j||jj||\|_|_|ttfkr|jd7_d|_qWdj |jS)Nrr) lencompatrrrrrNEWLINENLr)riterablettok_typerrendrrrr rs        zUntokenizer.untokenizec Csd}g}|jj}|\}}|ttfkr,|d7}|ttfkr|t kr|j qBn*|ttfkrd}n|r|r||dd}||qBWdS)NFrTrr) rrNAMENUMBERrrASYNCAWAITINDENTDEDENTpop) rrr startlineindents toks_appendtoknumtokvaltokrrr rs0      zUntokenizer.compatN)rxryrzrrrrrrrr rsrz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)cCsH|ddjjdd}|dks*|jdr.dS|d ks@|jd rDdS|S)N r-zutf-8zutf-8-latin-1 iso-8859-1 iso-latin-1latin-1- iso-8859-1- iso-latin-1-)rrr)rrr)lowerreplace startswith)orig_encencrrr _get_normal_names rcsdd}d}fdd}fdd}|}|jtrHd|dd}d }|sT|gfS||}|rj||gfStj|s~||gfS|}|s||gfS||}|r|||gfS|||gfS) NFzutf-8c s"yStk rtSXdS)N) StopIterationbytesr)rrr read_or_stop sz%detect_encoding..read_or_stopcsy|jd}Wntk r"dSXtj|}|s6dSt|jd}y t|}Wn tk rptd|YnXr|j dkrtd|d7}|S)Nasciirzunknown encoding: zutf-8zencoding problem: utf-8z-sig) decodeUnicodeDecodeError cookie_rematchrrr LookupError SyntaxErrorname)r line_stringrencodingcodec) bom_foundrr find_cookie&s"   z$detect_encoding..find_cookieTz utf-8-sig)rrblank_rer)rrdefaultrrfirstsecondr)rrr detect_encoding s0         rcCst}|j|S)N)rr)rutrrr rTsc!csd}}}tjdd}}d\}}d}dg} d} d} d} d} xy |}Wntk rdd}YnX|d}dt|}}|rF|std||j|}|r|jd}}t||d||||f||fVd \}}d}nd|r0|d!dd kr0|d"dd kr0t||||t|f|fVd}d}qBn||}||}qBnF|dkrt| rt|s`Pd}xf||kr||d kr|d}n6||d kr|t dt }n||dkrd}nP|d}qfW||krP| r| Vd} ||dkr||dkrh||dj d}|t|}t |||f||t|f|fVt ||d||f|t|f|fVqBt t f||dk||d||f|t|f|fVqB|| d#kr| j |t|d||df||f|fVxt|| d$krJ|| krtdd|||f| dd%} | r.| | d&kr.d} d} d} td||f||f|fVqW| r| r| | d'krd} d} d} n|std|dfd}x||kr8tj||}|r |jd\}}||f||f|}}}|||||}}||ks|dkr|dkrt||||fVq4|dkrft}|dkr8t }n | rBd} | rR| Vd} |||||fVq4|dkr| r| Vd} t ||||fVq4|tkrt|}|j||}|r|jd}|||}| r| Vd} t||||f|fVn||f}||d}|}Pq4|tks@|ddtks@|dd tkr|d(dkr||f}t|pxt|dpxt|d}||dd}}|}Pn | r| Vd} t||||fVq4||kr|d)kr| r|dkrtnt||||fVqt||||f}|dkr| r|} q|dkrx| rx| dtkrx| ddkrxd} | d*} t| d| d| d | dfVd} | r| Vd} |Vnz|dkr| r| Vd} t ||||f|fVd}nF|dkr|d}n|dkr|d}| r| Vd} t||||fVn(t||||f||df|fV|d}qWqBW| rN| Vd} x.| ddD]} td|df|dfdfVq\Wtd|df|dfdfVdS)+Nrr 0123456789rFrzEOF in multi-line stringrz\ rz\ r  z# #z z3unindent does not match any outer indentation levelz zEOF in multi-line statement.T asyncawaitdef\z([{z)]})rr)rrrrrrrr)rrr)stringZ ascii_lettersrrrwrrSTRING ERRORTOKENtabsizerstripCOMMENTrrrIndentationErrorr pseudoprogspanrr triple_quotedendprogs single_quotedrrrOP ENDMARKER)!rlnumparenlev continuedZ namecharsnumcharscontstrneedcontcontlinerstashed async_defasync_def_indent async_def_nlrposmaxstrstartendprogendmatchrcolumn comment_tokennl_pos pseudomatchrsposeposrinitialnewlinerindentrrr risp     *                             __main__)*rrr&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrM)*rrrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtru)R __author__ __credits__rrecodecsrrZlib2to3.pgen2.tokenrrdir__all__r NameErrorstrrrr WhitespaceCommentIgnoreName Binnumber Hexnumber Octnumber Decnumber IntnumberExponent PointfloatExpfloat Floatnumber ImagnumberNumberSingleDoubleSingle3Double3Z _litprefixTripleStringOperatorBracketSpecialFunny PlainTokenTokenContStr PseudoExtras PseudoTokenlistmapcompileZ tokenprogrZ single3progZ double3progrrrrr Exceptionrwr{rr rrASCIIrrrrrrrxsysrargvopenrstdinrrrr s              8 Ic PKn;1]v];;/pgen2/__pycache__/tokenize.cpython-36.opt-1.pycnu[3 \NX=@sdZdZdZddlZddlZddlmZmZddlTddl m Z d d e e Dd d d gZ [ ye Wnek r~eZ YnXddZddZddZdZdZeedeeeZdZdZdZdZeddZeeeeeZdZeddeeZd eZeeeZed!ed"Z ee eeZ!d#Z"d$Z#d%Z$d&Z%d'Z&ee&d(e&d)Z'ee&d*e&d+Z(ed,d-d.d/d0d1d2d3d4 Z)d5Z*ed6d7Z+ee)e*e+Z,ee!e,e(eZ-ee-Z.ee&d8ed9de&d:ed;dZ/edee'Z0eee0e!e,e/eZ1e2e3ej4e.e1e$e%f\Z5Z6Z7Z8ej4e"ej4e#e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8ddddddddd<4Z9iZ:xdD]Z;e;e:e;<qWiZZ?Gddde>Z@ddZAeAfdd ZBddZCGdddZDej4dejEZFej4dejEZGddZHddZIdd ZJdd ZKeLdkrddlMZMeNeMjOdkr|eBePeMjOdjQn eBeMjRjQdS)aTokenization help for Python programs. generate_tokens(readline) is a generator that breaks a stream of text into Python tokens. It accepts a readline-like method which is called repeatedly to get the next line of input (or "" for EOF). It generates 5-tuples with these members: the token type (see token.py) the token (a string) the starting (row, column) indices of the token (a 2-tuple of ints) the ending (row, column) indices of the token (a 2-tuple of ints) the original line (string) It is designed to match the working of the Python tokenizer exactly, except that it produces COMMENT tokens for comments and gives type OP for all operators Older entry points tokenize_loop(readline, tokeneater) tokenize(readline, tokeneater=printtoken) are the same, except instead of generating tokens, tokeneater is a callback function to which the 5 fields described above are passed as 5 arguments, each time a new token is found.zKa-Ping Yee z@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip MontanaroN)BOM_UTF8lookup)*)tokencCsg|]}|ddkr|qS)r_).0xrr./usr/lib64/python3.6/lib2to3/pgen2/tokenize.py %sr tokenizegenerate_tokens untokenizecGsddj|dS)N(|))join)choicesrrr group0srcGs t|dS)Nr)r)rrrr any1srcGs t|dS)N?)r)rrrr maybe2srz[ \f\t]*z #[^\r\n]*z\\\r?\nz [a-zA-Z_]\w*z0[bB]_?[01]+(?:_[01]+)*z(0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?z0[oO]?_?[0-7]+(?:_[0-7]+)*[lL]?z[1-9]\d*(?:_\d+)*[lL]?z0[lL]?z[eE][-+]?\d+(?:_\d+)*z\d+(?:_\d+)*\.(?:\d+(?:_\d+)*)?z\.\d+(?:_\d+)*z \d+(?:_\d+)*z\d+(?:_\d+)*[jJ]z[jJ]z[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z#(?:[uUrRbBfF]|[rR][bB]|[bBuU][rR])?'''"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z<>z!=z//=?z->z[+\-*/%&@|^=<>]=?~z[][(){}]z\r?\nz[:;.,`@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*")4rrz'''z"""zr'''zr"""zu'''zu"""zb'''zb"""zf'''zf"""zur'''zur"""zbr'''zbr"""zrb'''zrb"""zR'''zR"""zU'''zU"""zB'''zB"""zF'''zF"""zuR'''zuR"""zUr'''zUr"""zUR'''zUR"""zbR'''zbR"""zBr'''zBr"""zBR'''zBR"""zrB'''zrB"""zRb'''zRb"""zRB'''zRB"""rRuUfFbBr'''r"""R'''R"""u'''u"""U'''U"""b'''b"""B'''B"""f'''f"""F'''F"""ur'''ur"""Ur'''Ur"""uR'''uR"""UR'''UR"""br'''br"""Br'''Br"""bR'''bR"""BR'''BR"""rb'''rb"""Rb'''Rb"""rB'''rB"""RB'''RB"""r'r"R'R"u'u"U'U"b'b"B'B"f'f"F'F"ur'ur"Ur'Ur"uR'uR"UR'UR"br'br"Br'Br"bR'bR"BR'BR"rb'rb"Rb'Rb"rB'rB"RB'RB"c@s eZdZdS) TokenErrorN)__name__ __module__ __qualname__rrrr rwsrwc@s eZdZdS)StopTokenizingN)rxryrzrrrr r{sr{c Cs4|\}}|\}}td||||t|t|fdS)Nz%d,%d-%d,%d: %s %s)printtok_namerepr) typerZxxx_todo_changemeZxxx_todo_changeme1lineZsrowZscolZerowZecolrrr printtokensrc Cs(yt||Wntk r"YnXdS)a: The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. The second parameter, tokeneater, must also be a callable object. It is called once for each token, with five arguments, corresponding to the tuples generated by generate_tokens(). N) tokenize_loopr{)readline tokeneaterrrr r s cCsxt|D] }||q WdS)N)r)rrZ token_inforrr rsrc@s,eZdZddZddZddZddZd S) UntokenizercCsg|_d|_d|_dS)Nrr)tokensprev_rowprev_col)selfrrr __init__szUntokenizer.__init__cCs*|\}}||j}|r&|jjd|dS)N )rrappend)rstartrowcol col_offsetrrr add_whitespaces zUntokenizer.add_whitespacecCsxv|D]n}t|dkr$|j||P|\}}}}}|j||jj||\|_|_|ttfkr|jd7_d|_qWdj |jS)Nrr) lencompatrrrrrNEWLINENLr)riterablettok_typerrendrrrr rs        zUntokenizer.untokenizec Csd}g}|jj}|\}}|ttfkr,|d7}|ttfkr|t kr|j qBn*|ttfkrd}n|r|r||dd}||qBWdS)NFrTrr) rrNAMENUMBERrrASYNCAWAITINDENTDEDENTpop) rrr startlineindents toks_appendtoknumtokvaltokrrr rs0      zUntokenizer.compatN)rxryrzrrrrrrrr rsrz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)cCsH|ddjjdd}|dks*|jdr.dS|d ks@|jdrDdS|S)z(Imitates get_normal_name in tokenizer.c.N r-zutf-8zutf-8-latin-1 iso-8859-1 iso-latin-1latin-1- iso-8859-1- iso-latin-1-)rrr)rrr)lowerreplace startswith)orig_encencrrr _get_normal_names rcsdd}d}fdd}fdd}|}|jtrHd|d d}d }|sT|gfS||}|rj||gfStj|s~||gfS|}|s||gfS||}|r|||gfS|||gfS) a The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. FNzutf-8c s"yStk rtSXdS)N) StopIterationbytesr)rrr read_or_stop sz%detect_encoding..read_or_stopcsy|jd}Wntk r"dSXtj|}|s6dSt|jd}y t|}Wn tk rptd|YnXr|j dkrtd|d7}|S)Nasciirzunknown encoding: zutf-8zencoding problem: utf-8z-sig) decodeUnicodeDecodeError cookie_rematchrrr LookupError SyntaxErrorname)r line_stringrencodingcodec) bom_foundrr find_cookie&s"   z$detect_encoding..find_cookieTz utf-8-sig)rrblank_rer)rrdefaultrrfirstsecondr)rrr detect_encoding s0         rcCst}|j|S)aTransform tokens back into Python source code. Each element returned by the iterable must be a token sequence with at least two elements, a token number and token value. If only two tokens are passed, the resulting output is poor. Round-trip invariant for full input: Untokenized source will match input source exactly Round-trip invariant for limited intput: # Output text will tokenize the back to the input t1 = [tok[:2] for tok in generate_tokens(f.readline)] newcode = untokenize(t1) readline = iter(newcode.splitlines(1)).next t2 = [tok[:2] for tokin generate_tokens(readline)] assert t1 == t2 )rr)rutrrr rTsc!csd}}}tjdd}}d \}}d}dg} d} d} d} d} xy |}Wntk rdd}YnX|d}dt|}}|rF|std||j|}|r|jd}}t||d||||f||fVd!\}}d}nd|r0|d"dd kr0|d#dd kr0t||||t|f|fVd}d}qBn||}||}qBnF|dkrt| rt|s`Pd}xf||kr||d kr|d}n6||dkr|t dt }n||dkrd}nP|d}qfW||krP| r| Vd} ||dkr||dkrh||dj d}|t|}t |||f||t|f|fVt ||d||f|t|f|fVqBt t f||dk||d||f|t|f|fVqB|| d$kr| j |t|d||df||f|fVxt|| d%krJ|| krtdd|||f| dd&} | r.| | d'kr.d} d} d} td||f||f|fVqW| r| r| | d(krd} d} d} n|std|dfd}x||kr8tj||}|r |jd\}}||f||f|}}}|||||}}||ks|dkr|dkrt||||fVq4|dkrft}|dkr8t }n | rBd} | rR| Vd} |||||fVq4|dkr| r| Vd} t ||||fVq4|tkrt|}|j||}|r|jd}|||}| r| Vd} t||||f|fVn||f}||d}|}Pq4|tks@|dd tks@|dd tkr|d)dkr||f}t|pxt|dpxt|d }||dd}}|}Pn | r| Vd} t||||fVq4||kr|d*kr| r|dkrtnt||||fVqt||||f}|dkr| r|} q|dkrx| rx| dtkrx| ddkrxd} | d+} t| d| d | d | dfVd} | r| Vd} |Vnz|dkr| r| Vd} t ||||f|fVd}nF|dkr|d}n|dkr|d}| r| Vd} t||||fVn(t||||f||df|fV|d}qWqBW| rN| Vd} x.| ddD]} td|df|dfdfVq\Wtd|df|dfdfVdS),aT The generate_tokens() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. Alternately, readline can be a callable function terminating with StopIteration: readline = open(myfile).next # Example of alternate readline The generator produces 5-tuples with these members: the token type; the token string; a 2-tuple (srow, scol) of ints specifying the row and column where the token begins in the source; a 2-tuple (erow, ecol) of ints specifying the row and column where the token ends in the source; and the line on which the token was found. The line passed is the logical line; continuation lines are included. rr 0123456789rNFrzEOF in multi-line stringrz\ rz\ r  z# #z z3unindent does not match any outer indentation levelz zEOF in multi-line statement.T asyncawaitdef\z([{z)]})rr)rrrrrrrr)rrr)stringZ ascii_lettersrrrwrrSTRING ERRORTOKENtabsizerstripCOMMENTrrrIndentationErrorr pseudoprogspanrr triple_quotedendprogs single_quotedrrrOP ENDMARKER)!rlnumparenlev continuedZ namecharsnumcharscontstrneedcontcontlinerstashed async_defasync_def_indent async_def_nlrposmaxstrstartendprogendmatchrcolumn comment_tokennl_pos pseudomatchrsposeposrinitialnewlinerindentrrr risp     *                             __main__)*rrr&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrM)*rrrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtru)S__doc__ __author__ __credits__rrecodecsrrZlib2to3.pgen2.tokenrrdir__all__r NameErrorstrrrr WhitespaceCommentIgnoreName Binnumber Hexnumber Octnumber Decnumber IntnumberExponent PointfloatExpfloat Floatnumber ImagnumberNumberSingleDoubleSingle3Double3Z _litprefixTripleStringOperatorBracketSpecialFunny PlainTokenTokenContStr PseudoExtras PseudoTokenlistmapcompileZ tokenprogrZ single3progZ double3progrrrrr Exceptionrwr{rr rrASCIIrrrrrrrxsysrargvopenrstdinrrrr s              8 Ic PKn;1]_Ϩ  ,pgen2/__pycache__/token.cpython-36.opt-2.pycnu[3 \@sLdZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;de?j@D]$\ZAZBeCeBeCdkreAe=eB<qWd=d>ZDd?d@ZEdAdBZFdCS)D  !"#$%&'()*+,-./0123456789:;cCs|tkS)N) NT_OFFSET)xr@+/usr/lib64/python3.6/lib2to3/pgen2/token.py ISTERMINALNsrBcCs|tkS)N)r>)r?r@r@rA ISNONTERMINALQsrCcCs|tkS)N) ENDMARKER)r?r@r@rAISEOFTsrEN)GrDNAMENUMBERSTRINGNEWLINEINDENTDEDENTLPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENTZ BACKQUOTELBRACERBRACEEQEQUALNOTEQUAL LESSEQUAL GREATEREQUALTILDE CIRCUMFLEX LEFTSHIFT RIGHTSHIFT DOUBLESTAR PLUSEQUALMINEQUAL STAREQUAL SLASHEQUAL PERCENTEQUAL AMPEREQUAL VBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUAL DOUBLESLASHDOUBLESLASHEQUALATATEQUALOPCOMMENTNLRARROWAWAITASYNC ERRORTOKENN_TOKENSr>tok_namelistglobalsitems_nameZ_valuetyperBrCrEr@r@r@rA sPKn;1]S<<&pgen2/__pycache__/token.cpython-36.pycnu[3 \@sPdZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;dx6e?e@jAD]$\ZBZCeDeCeDdkr eBe>eC<q Wd>d?ZEd@dAZFdBdCZGdDS)Ez!Token constants (from "token.h").  !"#$%&'()*+,-./0123456789:;cCs|tkS)N) NT_OFFSET)xr@+/usr/lib64/python3.6/lib2to3/pgen2/token.py ISTERMINALNsrBcCs|tkS)N)r>)r?r@r@rA ISNONTERMINALQsrCcCs|tkS)N) ENDMARKER)r?r@r@rAISEOFTsrEN)H__doc__rDNAMENUMBERSTRINGNEWLINEINDENTDEDENTLPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENTZ BACKQUOTELBRACERBRACEEQEQUALNOTEQUAL LESSEQUAL GREATEREQUALTILDE CIRCUMFLEX LEFTSHIFT RIGHTSHIFT DOUBLESTAR PLUSEQUALMINEQUAL STAREQUAL SLASHEQUAL PERCENTEQUAL AMPEREQUAL VBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUAL DOUBLESLASHDOUBLESLASHEQUALATATEQUALOPCOMMENTNLRARROWAWAITASYNC ERRORTOKENN_TOKENSr>tok_namelistglobalsitems_nameZ_valuetyperBrCrEr@r@r@rAsPKn;1]5f,pgen2/__pycache__/parse.cpython-36.opt-1.pycnu[3 \u@s4dZddlmZGdddeZGdddeZdS)zParser engine for the grammar tables generated by pgen. The grammar table must be loaded first. See Parser/parser.c in the Python distribution for additional info on how this parsing engine works. )tokenc@seZdZdZddZdS) ParseErrorz(Exception to signal the parser is stuck.cCs4tj|d||||f||_||_||_||_dS)Nz!%s: type=%r, value=%r, context=%r) Exception__init__msgtypevaluecontext)selfrrrr r +/usr/lib64/python3.6/lib2to3/pgen2/parse.pyrs zParseError.__init__N)__name__ __module__ __qualname____doc__rr r r r rsrc@sLeZdZdZdddZdddZddZd d Zd d Zd dZ ddZ dS)Parsera5Parser engine. The proper usage sequence is: p = Parser(grammar, [converter]) # create instance p.setup([start]) # prepare for parsing : if p.addtoken(...): # parse a token; may raise ParseError break root = p.rootnode # root of abstract syntax tree A Parser instance may be reused by calling setup() repeatedly. A Parser instance contains state pertaining to the current token sequence, and should not be used concurrently by different threads to parse separate token sequences. See driver.py for how to get input tokens by tokenizing a file or string. Parsing is complete when addtoken() returns True; the root of the abstract syntax tree can then be retrieved from the rootnode instance variable. When a syntax error occurs, addtoken() raises the ParseError exception. There is no error recovery; the parser cannot be used after a syntax error was reported (but it can be reinitialized by calling setup()). NcCs||_|pdd|_dS)aConstructor. The grammar argument is a grammar.Grammar instance; see the grammar module for more information. The parser is not ready yet for parsing; you must call the setup() method to get it started. The optional convert argument is a function mapping concrete syntax tree nodes to abstract syntax tree nodes. If not given, no conversion is done and the syntax tree produced is the concrete syntax tree. If given, it must be a function of two arguments, the first being the grammar (a grammar.Grammar instance), and the second being the concrete syntax tree node to be converted. The syntax tree is converted from the bottom up. A concrete syntax tree node is a (type, value, context, nodes) tuple, where type is the node type (a token or symbol number), value is None for symbols and a string for tokens, context is None or an opaque value used for error reporting (typically a (lineno, offset) pair), and nodes is a list of children for symbols, and None for tokens. An abstract syntax tree node may be anything; this is entirely up to the converter function. cSs|S)Nr )grammarnoder r r Wsz!Parser.__init__..N)rconvert)r rrr r r r9szParser.__init__cCsH|dkr|jj}|ddgf}|jj|d|f}|g|_d|_t|_dS)aPrepare for parsing. This *must* be called before starting to parse. The optional argument is an alternative start symbol; it defaults to the grammar's start symbol. You can use a Parser instance to parse any number of programs; each time you call setup() the parser is reset to an initial state determined by the (implicit or explicit) start symbol. N)rstartdfasstackrootnodeset used_names)r rnewnodeZ stackentryr r r setupYs  z Parser.setupcCs:|j|||}x$|jd \}}}|\}} ||} x| D]\} } |jj| \} }|| kr|j||| || }x@||d|fgkr|j|jsdS|jd \}}}|\}} qpWdS| dkr:|jj| }|\}}||kr:|j| |jj| | |Pq:Wd|f| kr$|j|js2td|||qtd|||qWdS) z s  PKn;1]z/pgen2/__pycache__/__init__.cpython-36.opt-2.pycnu[3 \@sdS)Nrrr./usr/lib64/python3.6/lib2to3/pgen2/__init__.pysPKn;1]1)pgen2/__pycache__/literals.cpython-36.pycnu[3 \O @sPdZddlZddddddd d d d d ZddZddZddZedkrLedS)ztdD]2}t|}t|}t|}||kr t||||q WdS)N)ranger r*r0print)r%cr.er&r&r'test2s r6__main__)__doc__r,rr(r0r6__name__r&r&r&r's   PKn;1]*u$u$+pgen2/__pycache__/pgen.cpython-36.opt-2.pycnu[3 \5@sdddlmZmZmZGdddejZGdddeZGdddeZGdd d eZ dd d Z d S))grammartokentokenizec@s eZdZdS) PgenGrammarN)__name__ __module__ __qualname__r r */usr/lib64/python3.6/lib2to3/pgen2/pgen.pyrsrc@seZdZd&ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd'd d!Zd"d#Zd$d%ZdS)(ParserGeneratorNcCsld}|dkrt|}|j}||_||_tj|j|_|j|j \|_ |_ |dk rZ|i|_ |j dS)N)openclosefilenamestreamrgenerate_tokensreadline generatorgettokenparsedfas startsymbolfirst addfirstsets)selfrrZ close_streamr r r __init__ szParserGenerator.__init__c Cs*t}t|jj}|j|j|j|jd|jx.|D]&}dt|j }||j |<||j |<qtt|d}||jkrz|j|S|jj|df||j|<|Snt |}|djr||j kr|j |S|jjtj |f||j |<|Sn>t j |}||jkr|j|S|jj|df||j|<|SdS)Nr)r"Zlabelsisalphar#Z symbol2labelr'getattrrtokensevalkeywordsNAMErZopmap)rr.r4r7Zitokenvaluer r r r(=s6                  zParserGenerator.make_labelcCs<t|jj}|jx |D]}||jkr|j|qWdS)N)rrrrr calcfirst)rr/r0r r r rks   zParserGenerator.addfirstsetsc Cs |j|}d|j|<|d}i}i}x|jjD]x\}}||jkr||jkrl|j|}|dkrtd|n|j||j|}|j||||<q0d||<|di||<q0Wi} xJ|jD]>\}} x4| D],} | | krtd|| || | f|| | <qWqW||j|<dS)Nrzrecursion for rule %rrzArule %s is ambiguous; %s is in the first sets of %s as well as %s)rrr%r& ValueErrorr?update) rr0r2r3ZtotalsetZ overlapcheckr4r5fsetZinverseZitsfirstZsymbolr r r r?ss2          zParserGenerator.calcfirstc Csi}d}x|jtjkrx|jtjkr.|jqW|jtj}|jtjd|j\}}|jtj|j ||}t |}|j |t |}|||<|dkr |}q W||fS)N:) typer ENDMARKERNEWLINErexpectr=OP parse_rhsmake_dfar" simplify_dfa) rrrr0azr2ZoldlenZnewlenr r r rs"      zParserGenerator.parsec sfdd}fddt|||g}x|D]}i}x<|jD]2}x,|jD]"\}} |dk rJ| |j|iqJWq>WxRt|jD]B\}} x,|D]} | j| krPqWt| |} |j| |j| |qWq.W|S)Ncsi}|||S)Nr )r3base) addclosurer r closures z)ParserGenerator.make_dfa..closurecs>||kr dSd||<x$|jD]\}}|dkr||qWdS)Nr)r%)r3rNr4r5)rOr r rOs z,ParserGenerator.make_dfa..addclosure)DFAStatenfasetr% setdefaultr$r&r'addarc) rr-finishrPr+r3r%Znfastater4r5rRstr )rOr rJs"        zParserGenerator.make_dfac Cstd||g}xt|D]\}}td|||kr4dp6dx^|jD]T\}}||kr^|j|} nt|} |j||dkrtd| qBtd|| fqBWqWdS)NzDump of NFA forz Statez(final)z -> %dz %s -> %d)print enumerater%r)r"r') rr0r-rUZtodor1r3r4r5jr r r dump_nfas   zParserGenerator.dump_nfacCsltd|x\t|D]P\}}td||jr,dp.dx0t|jjD]\}}td||j|fqBWqWdS)NzDump of DFA forz Statez(final)rWz %s -> %d)rXrYr*r$r%r&r))rr0r2r1r3r4r5r r r dump_dfas  zParserGenerator.dump_dfacCs~d}xt|rxd}xft|D]Z\}}xPt|dt|D]:}||}||kr4||=x|D]}|j||qTWd}Pq4WqWqWdS)NTFr)rYranger" unifystate)rr2Zchangesr1Zstate_irZZstate_jr3r r r rKs zParserGenerator.simplify_dfacCs|j\}}|jdkr||fSt}t}|j||j|x6|jdkrt|j|j\}}|j||j|q@W||fSdS)N|) parse_altr>NFAStaterTr)rrLrMZaaZzzr r r rIs       zParserGenerator.parse_rhscCsP|j\}}x:|jdks*|jtjtjfkrF|j\}}|j||}qW||fS)N([)rbrc) parse_itemr>rDrr=STRINGrT)rrLbr.dr r r r` s    zParserGenerator.parse_altcCs|jdkr>|j|j\}}|jtjd|j|||fS|j\}}|j}|dkr`||fS|j|j||dkr||fS||fSdS)Nrc]+*)rirj)r>rrIrGrrHrT parse_atom)rrLrMr>r r r rds     zParserGenerator.parse_itemcCs|jdkr4|j|j\}}|jtjd||fS|jtjtjfkrpt }t }|j ||j|j||fS|j d|j|jdS)Nrb)z+expected (...) or NAME or STRING, got %s/%s) r>rrIrGrrHrDr=rerarT raise_error)rrLrMr r r rk(s  zParserGenerator.parse_atomcCsD|j|ks|dk r2|j|kr2|jd|||j|j|j}|j|S)Nzexpected %s/%s, got %s/%s)rDr>rmr)rrDr>r r r rG9s zParserGenerator.expectcCsJt|j}x"|dtjtjfkr,t|j}q W|\|_|_|_|_|_ dS)Nr) r5rrCOMMENTNLrDr>Zbeginendline)rtupr r r rAs zParserGenerator.gettokenc Gs^|r8y ||}Wn&dj|gttt|}YnXt||j|jd|jd|jfdS)N rr)joinrmapstr SyntaxErrorrrprq)rmsgargsr r r rmHs  zParserGenerator.raise_error)N)N)rrrrr6r,r(rr?rrJr[r\rKrIr`rdrkrGrrmr r r r r s$  .$  r c@seZdZddZdddZdS)racCs g|_dS)N)r%)rr r r rSszNFAState.__init__NcCs|jj||fdS)N)r%r')rr5r4r r r rTVszNFAState.addarc)N)rrrrrTr r r r raQsrac@s0eZdZddZddZddZddZd Zd S) rQcCs||_||k|_i|_dS)N)rRr*r%)rrRfinalr r r r]s zDFAState.__init__cCs||j|<dS)N)r%)rr5r4r r r rTeszDFAState.addarccCs.x(|jjD]\}}||kr ||j|<q WdS)N)r%r&)roldnewr4r5r r r r^kszDFAState.unifystatecCsX|j|jkrdSt|jt|jkr(dSx*|jjD]\}}||jj|k r4dSq4WdS)NFT)r*r"r%r&get)rotherr4r5r r r __eq__ps zDFAState.__eq__N)rrrrrTr^r__hash__r r r r rQ[s rQ Grammar.txtcCst|}|jS)N)r r6)rpr r r generate_grammarsrN)r) rWrrrZGrammarrobjectr rarQrr r r r sI %PKn;1]6!+pgen2/__pycache__/conv.cpython-36.opt-1.pycnu[3 \%@s2dZddlZddlmZmZGdddejZdS)aConvert graminit.[ch] spit out by pgen to Python code. Pgen is the Python parser generator. It is useful to quickly create a parser from a grammar file in Python's grammar notation. But I don't want my parsers to be written in C (yet), so I'm translating the parsing tables to Python data structures and writing a Python parse engine. Note that the token numbers are constants determined by the standard Python tokenizer. The standard token module defines these numbers and their names (the names are not used much). The token numbers are hardcoded into the Python tokenizer and into pgen. A Python implementation of the Python tokenizer is also available, in the standard tokenize module. On the other hand, symbol numbers (representing the grammar's non-terminals) are assigned by pgen based on the actual grammar input. Note: this module is pretty much obsolete; the pgen module generates equivalent grammar tables directly from the Grammar.txt input file without having to invoke the Python pgen C program. N)grammartokenc@s0eZdZdZddZddZddZdd Zd S) Convertera2Grammar subclass that reads classic pgen output files. The run() method reads the tables as produced by the pgen parser generator, typically contained in two C files, graminit.h and graminit.c. The other methods are for internal use only. See the base class for more documentation. cCs |j||j||jdS)z@rd||d|<qWqW||f||<q4W|dt|}}||_g}|dt|}}tjd|}t |jd}xjt |D]^}|dt|}}tjd|}|j \}}t |}|dkrd}nt|}|j ||fqpW|dt|}}||_|dt|}}|dt|}}tjd|}t |jd}|dt|}}|dt|}}tjd|}t |jd}|dt|}}tjd|}t |jd} | |_|dt|}}y|dt|}}Wntk rYnXdS)aParse the .c file written by pgen. (Internal) The file looks as follows. The first two lines are always this: #include "pgenheaders.h" #include "grammar.h" After that come four blocks: 1) one or more state definitions 2) a table defining dfas 3) a table defining labels 4) a struct defining the grammar A state definition has the following form: - one or more arc arrays, each of the form: static arc arcs__[] = { {, }, ... }; - followed by a state array, of the form: static state states_[] = { {, arcs__}, ... }; zCan't open %s: %sFNrr z static arc z)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$z\s+{(\d+), (\d+)},$z'static state states_(\d+)\[(\d+)\] = {$z\s+{(\d+), arcs_(\d+)_(\d+)},$zstatic dfa dfas\[(\d+)\] = {$z0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$z\s+("(?:\\\d\d\d)*")},$z!static label labels\[(\d+)\] = {$z\s+{(\d+), (0|"\w+")},$0z \s+(\d+),$z\s+{(\d+), labels},$z \s+(\d+)$)r rrnext startswithrrlistmaprrrangeappendstatesgroupeval enumerateorddfaslabelsstart StopIteration)!rrrrrrZallarcsr)rnmkZarcs_ijststater.ZndfasrrxyzfirstZ rawbitsetcZbyter/Znlabelsr0r r r rTs         "        zConverter.parse_graminit_ccCs\i|_i|_xJt|jD]<\}\}}|tjkrB|dk rB||j|<q|dkr||j|<qWdS)z1Create additional useful structures. (Internal).N)keywordstokensr,r/rNAME)rZilabeltypevaluer r r rs zConverter.finish_offN)__name__ __module__ __qualname____doc__r rrrr r r r r$s  &r)rHrZpgen2rrZGrammarrr r r r sPKn;1]&{/pgen2/__pycache__/literals.cpython-36.opt-2.pycnu[3 \O @sLddlZdddddddd d d d Zd dZddZddZedkrHedS)N     '"\) abfnrtvr r r c Cs|jdd\}}tj|}|dk r&|S|jdr|dd}t|dkrTtd|yt|d}Wqtk rtd|YqXn0yt|d}Wn tk rtd|YnXt|S) Nrxz!invalid hex string escape ('\%s')z#invalid octal string escape ('\%s'))groupsimple_escapesget startswithlen ValueErrorintchr)malltailescZhexesir%./usr/lib64/python3.6/lib2to3/pgen2/literals.pyescapes"     r'cCsH|d}|dd|dkr$|d}|t|t| }tjdt|S)Nrz)\\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3}))rresubr')sqr%r%r& evalString(s r-cCsDx>tdD]2}t|}t|}t|}||kr t||||q WdS)N)rangerreprr-print)r$cr+er%r%r&test2s r4__main__)r)rr'r-r4__name__r%r%r%r&s  PKn;1]Fxx%pgen2/__pycache__/conv.cpython-36.pycnu[3 \%@s2dZddlZddlmZmZGdddejZdS)aConvert graminit.[ch] spit out by pgen to Python code. Pgen is the Python parser generator. It is useful to quickly create a parser from a grammar file in Python's grammar notation. But I don't want my parsers to be written in C (yet), so I'm translating the parsing tables to Python data structures and writing a Python parse engine. Note that the token numbers are constants determined by the standard Python tokenizer. The standard token module defines these numbers and their names (the names are not used much). The token numbers are hardcoded into the Python tokenizer and into pgen. A Python implementation of the Python tokenizer is also available, in the standard tokenize module. On the other hand, symbol numbers (representing the grammar's non-terminals) are assigned by pgen based on the actual grammar input. Note: this module is pretty much obsolete; the pgen module generates equivalent grammar tables directly from the Grammar.txt input file without having to invoke the Python pgen C program. N)grammartokenc@s0eZdZdZddZddZddZdd Zd S) Convertera2Grammar subclass that reads classic pgen output files. The run() method reads the tables as produced by the pgen parser generator, typically contained in two C files, graminit.h and graminit.c. The other methods are for internal use only. See the base class for more documentation. cCs |j||j||jdS)z@rPd||d|<qPWq6W||f||<qW|dt|}}|d kst||f||_g}|dt|}}tjd|}|st||ft |jd}x|t |D]p}|dt|}}tjd|}|s>t||f|j \}}t |}|dkrbd}nt|}|j ||fq W|dt|}}|d kst||f||_|dt|}}|dkst||f|dt|}}tjd|}|st||ft |jd}|t|jks&t|dt|}}|dksNt||f|dt|}}tjd|}|s~t||ft |jd}|t|jkst||f|dt|}}tjd|}|st||ft |jd} | |jkst||f| |_|dt|}}|d ks,t||fy|dt|}}Wntk rXYnXdslt||fdS)aParse the .c file written by pgen. (Internal) The file looks as follows. The first two lines are always this: #include "pgenheaders.h" #include "grammar.h" After that come four blocks: 1) one or more state definitions 2) a table defining dfas 3) a table defining labels 4) a struct defining the grammar A state definition has the following form: - one or more arc arrays, each of the form: static arc arcs__[] = { {, }, ... }; - followed by a state array, of the form: static state states_[] = { {, arcs__}, ... }; zCan't open %s: %sFNrr z#include "pgenheaders.h" z#include "grammar.h" z static arc z)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$z\s+{(\d+), (\d+)},$z}; z'static state states_(\d+)\[(\d+)\] = {$z\s+{(\d+), arcs_(\d+)_(\d+)},$zstatic dfa dfas\[(\d+)\] = {$z0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$z\s+("(?:\\\d\d\d)*")},$z!static label labels\[(\d+)\] = {$z\s+{(\d+), (0|"\w+")},$0zgrammar _PyParser_Grammar = { z \s+(\d+),$z dfas, z\s+{(\d+), labels},$z \s+(\d+)$)r rrnextr startswithrrlistmaprrrangeappendlenstatesgrouprreval enumerateorddfaslabelsstart StopIteration)!rrrrrrZallarcsr-rnmkZarcs_ijststater2ZndfasrrxyzfirstZ rawbitsetcZbyter3Znlabelsr4r r r rTs         "        zConverter.parse_graminit_ccCs\i|_i|_xJt|jD]<\}\}}|tjkrB|dk rB||j|<q|dkr||j|<qWdS)z1Create additional useful structures. (Internal).N)keywordstokensr0r3rNAME)rZilabeltypevaluer r r rs zConverter.finish_offN)__name__ __module__ __qualname____doc__r rrrr r r r r$s  &r)rLrZpgen2rrZGrammarrr r r r sPKn;1](pgen2/__pycache__/grammar.cpython-36.pycnu[3 \@sxdZddlZddlZddlmZmZGdddeZddZd Z iZ x.e j D]"Z e rNe j \ZZeeee e<qNWdS) aThis module defines the data structures used to represent a grammar. These are a bit arcane because they are derived from the data structures used by Python's 'pgen' parser generator. There's also a table here mapping operators to their names in the token module; the Python tokenize module reports all operators as the fallback token code OP, but the parser needs the actual token code. N)tokentokenizec@s@eZdZdZddZddZddZdd Zd d Zd d Z dS)Grammara Pgen parsing tables conversion class. Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine accesses the instance variables directly. The class here does not provide initialization of the tables; several subclasses exist to do this (see the conv and pgen modules). The load() method reads the tables from a pickle file, which is much faster than the other ways offered by subclasses. The pickle file is written by calling dump() (after loading the grammar tables using a subclass). The report() method prints a readable representation of the tables to stdout, for debugging. The instance variables are as follows: symbol2number -- a dict mapping symbol names to numbers. Symbol numbers are always 256 or higher, to distinguish them from token numbers, which are between 0 and 255 (inclusive). number2symbol -- a dict mapping numbers to symbol names; these two are each other's inverse. states -- a list of DFAs, where each DFA is a list of states, each state is a list of arcs, and each arc is a (i, j) pair where i is a label and j is a state number. The DFA number is the index into this list. (This name is slightly confusing.) Final states are represented by a special arc of the form (0, j) where j is its own state number. dfas -- a dict mapping symbol numbers to (DFA, first) pairs, where DFA is an item from the states list above, and first is a set of tokens that can begin this grammar rule (represented by a dict whose values are always 1). labels -- a list of (x, y) pairs where x is either a token number or a symbol number, and y is either None or a string; the strings are keywords. The label number is the index in this list; label numbers are used to mark state transitions (arcs) in the DFAs. start -- the number of the grammar's start symbol. keywords -- a dict mapping keyword strings to arc labels. tokens -- a dict mapping token numbers to arc labels. cCs<i|_i|_g|_i|_dg|_i|_i|_i|_d|_dS)NrEMPTY)rr) symbol2number number2symbolstatesdfaslabelskeywordstokens symbol2labelstart)selfr-/usr/lib64/python3.6/lib2to3/pgen2/grammar.py__init__MszGrammar.__init__c Cs2t|d}t|j}tj||dWdQRXdS)aDump the grammar tables to a pickle file. dump() recursively changes all dict to OrderedDict, so the pickled file is not exactly the same as what was passed in to dump(). load() uses the pickled file to create the tables, but only changes OrderedDict to dict at the top level; it does not recursively change OrderedDict to dict. So, the loaded tables are different from the original tables that were passed to load() in that some of the OrderedDict (from the pickled file) are not changed back to dict. For parsing, this has no effect on performance because OrderedDict uses dict's __getitem__ with nothing in between. wbN)open_make_deterministic__dict__pickledump)rfilenamefdrrrrXs  z Grammar.dumpc Cs0t|d}tj|}WdQRX|jj|dS)z+Load the grammar tables from a pickle file.rbN)rrloadrupdate)rrrrrrrr is z Grammar.loadcCs|jjtj|dS)z3Load the grammar tables from a pickle bytes object.N)rr!rloads)rZpklrrrr"osz Grammar.loadscCsX|j}x"dD]}t||t||jqW|jdd|_|jdd|_|j|_|S) z# Copy the grammar. rr r r rrN)rr r r rr) __class__setattrgetattrcopyr r r)rnewZ dict_attrrrrr&ssz Grammar.copycCsvddlm}td||jtd||jtd||jtd||jtd||jtd|jd S) z:Dump the grammar tables to standard output, for debugging.r)pprintZs2nZn2sr r r rN)r(printrr r r r r)rr(rrrreports      zGrammar.reportN) __name__ __module__ __qualname____doc__rrr r"r&r*rrrrrs4  rcCs^t|tr&tjtdd|jDSt|tr>dd|DSt|trZtdd|DS|S)Ncss|]\}}|t|fVqdS)N)r).0kvrrr sz&_make_deterministic..cSsg|] }t|qSr)r)r/errr sz'_make_deterministic..css|]}t|VqdS)N)r)r/r3rrrr2s) isinstancedict collections OrderedDictsorteditemslisttuple)toprrrrs   ra ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW )r.r7rrrobjectrrZ opmap_rawZopmap splitlineslinesplitopnamer%rrrr sy= PKn;1]()pgen2/__pycache__/__init__.cpython-36.pycnu[3 \@sdZdS)zThe pgen2 package.N)__doc__rr./usr/lib64/python3.6/lib2to3/pgen2/__init__.pysPKn;1][-'pgen2/__pycache__/driver.cpython-36.pycnu[3 \@sdZdZddgZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z m Z mZGdddeZd d ZdddZddZddZddZedkrejee dS)zZParser driver. This provides a high-level interface to parse a file into a syntax tree. z#Guido van Rossum Driver load_grammarN)grammarparsetokentokenizepgenc@sHeZdZdddZdddZdddZdd d Zdd d Zdd dZdS)rNcCs&||_|dkrtj}||_||_dS)N)rlogging getLoggerloggerconvert)selfrr r r,/usr/lib64/python3.6/lib2to3/pgen2/driver.py__init__ s zDriver.__init__FcCstj|j|j}|jd}d}d}}}} } d} xR|D]4} | \}}}} } |||fkr||f|ks|t||f|f|\} }|| kr| d| |7} | }d}||kr| | ||7} |}|tjtjfkr| |7} | \}}|j dr@|d7}d}q@|t j krtj |}|r,|j jdt j||| |j||| |frT|rR|j jdPd} | \}}|j dr@|d7}d}q@Wtjd||| |f|jS) z4Parse a series of tokens and return the syntax tree.rrN z%s %r (prefix=%r)zStop.zincomplete input)rZParserrr ZsetupAssertionErrorrCOMMENTNLendswithrOPZopmapr debugtok_nameZaddtokenZ ParseErrorZrootnode)rtokensrplinenocolumntypevaluestartendZ line_textprefixZ quintupleZs_linenoZs_columnrrr parse_tokens'sT      zDriver.parse_tokenscCstj|j}|j||S)z*Parse a stream and return the syntax tree.)rgenerate_tokensreadliner$)rstreamrrrrrparse_stream_rawWs zDriver.parse_stream_rawcCs |j||S)z*Parse a stream and return the syntax tree.)r()rr'rrrr parse_stream\szDriver.parse_streamc Cs*tj|d|}z |j||S|jXdS)z(Parse a file and return the syntax tree.rN)codecsopenr)close)rfilenameencodingrr'rrr parse_file`s zDriver.parse_filecCstjtj|j}|j||S)z*Parse a string and return the syntax tree.)rr%ioStringIOr&r$)rtextrrrrr parse_stringhszDriver.parse_string)NN)F)F)F)NF)F) __name__ __module__ __qualname__rr$r(r)r0r4rrrrrs   0   cCs:tjj|\}}|dkrd}||djtttjdS)Nz.txtr.z.pickle)ospathsplitextjoinmapstrsys version_info)gtheadtailrrr_generate_pickle_namensrD Grammar.txtTFcCs|dkrtj}|dkr t|n|}|s4t|| r|jd|tj|}|r|jd|y|j|Wqtk r}z|jd|WYdd}~XqXnt j }|j ||S)z'Load the grammar (maybe from a pickle).Nz!Generating grammar tables from %szWriting grammar tables to %szWriting failed: %s) r r rD_newerinfor Zgenerate_grammardumpOSErrorrGrammarload)rAZgpsaveforcer gerrrrus     cCs8tjj|sdStjj|s dStjj|tjj|kS)z0Inquire whether file a was written since file b.FT)r9r:existsgetmtime)abrrrrFs   rFcCsFtjj|rt|Sttjj|}tj||}tj }|j ||S)aNormally, loads a pickled grammar by doing pkgutil.get_data(package, pickled_grammar) where *pickled_grammar* is computed from *grammar_source* by adding the Python version and using a ``.pickle`` extension. However, if *grammar_source* is an extant file, load_grammar(grammar_source) is called instead. This facilitates using a packaged grammar file when needed but preserves load_grammar's automatic regeneration behavior when possible. ) r9r:isfilerrDbasenamepkgutilget_datarrJloads)packageZgrammar_sourceZ pickled_namedatarNrrrload_packaged_grammars   r[cGsF|stjdd}tjtjtjddx|D]}t|dddq,WdS)zMain program, when run as a script: produce grammar pickle files. Calls load_grammar for each argument, a path to a grammar text file. rNz %(message)s)levelr'formatT)rLrM)r?argvr Z basicConfigINFOstdoutr)argsrArrrmains  rb__main__)rENTFN)__doc__ __author____all__r+r1r9r rVr?rrrrrr objectrrDrrFr[rbr5exitintrrrr s$P   PKn;1]Սp<<)pgen2/__pycache__/tokenize.cpython-36.pycnu[3 \NX=@sdZdZdZddlZddlZddlmZmZddlTddl m Z d d e e Dd d d gZ [ ye Wnek r~eZ YnXddZddZddZdZdZeedeeeZdZdZdZdZeddZeeeeeZdZeddeeZd eZeeeZed!ed"Z ee eeZ!d#Z"d$Z#d%Z$d&Z%d'Z&ee&d(e&d)Z'ee&d*e&d+Z(ed,d-d.d/d0d1d2d3d4 Z)d5Z*ed6d7Z+ee)e*e+Z,ee!e,e(eZ-ee-Z.ee&d8ed9de&d:ed;dZ/edee'Z0eee0e!e,e/eZ1e2e3ej4e.e1e$e%f\Z5Z6Z7Z8ej4e"ej4e#e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8ddddddddd<4Z9iZ:xdD]Z;e;e:e;<qWiZZ?Gddde>Z@ddZAeAfdd ZBddZCGdddZDej4dejEZFej4dejEZGddZHddZIdd ZJdd ZKeLdkrddlMZMeNeMjOdkr|eBePeMjOdjQn eBeMjRjQdS)aTokenization help for Python programs. generate_tokens(readline) is a generator that breaks a stream of text into Python tokens. It accepts a readline-like method which is called repeatedly to get the next line of input (or "" for EOF). It generates 5-tuples with these members: the token type (see token.py) the token (a string) the starting (row, column) indices of the token (a 2-tuple of ints) the ending (row, column) indices of the token (a 2-tuple of ints) the original line (string) It is designed to match the working of the Python tokenizer exactly, except that it produces COMMENT tokens for comments and gives type OP for all operators Older entry points tokenize_loop(readline, tokeneater) tokenize(readline, tokeneater=printtoken) are the same, except instead of generating tokens, tokeneater is a callback function to which the 5 fields described above are passed as 5 arguments, each time a new token is found.zKa-Ping Yee z@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip MontanaroN)BOM_UTF8lookup)*)tokencCsg|]}|ddkr|qS)r_).0xrr./usr/lib64/python3.6/lib2to3/pgen2/tokenize.py %sr tokenizegenerate_tokens untokenizecGsddj|dS)N(|))join)choicesrrr group0srcGs t|dS)Nr)r)rrrr any1srcGs t|dS)N?)r)rrrr maybe2srz[ \f\t]*z #[^\r\n]*z\\\r?\nz [a-zA-Z_]\w*z0[bB]_?[01]+(?:_[01]+)*z(0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?z0[oO]?_?[0-7]+(?:_[0-7]+)*[lL]?z[1-9]\d*(?:_\d+)*[lL]?z0[lL]?z[eE][-+]?\d+(?:_\d+)*z\d+(?:_\d+)*\.(?:\d+(?:_\d+)*)?z\.\d+(?:_\d+)*z \d+(?:_\d+)*z\d+(?:_\d+)*[jJ]z[jJ]z[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z#(?:[uUrRbBfF]|[rR][bB]|[bBuU][rR])?'''"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z<>z!=z//=?z->z[+\-*/%&@|^=<>]=?~z[][(){}]z\r?\nz[:;.,`@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*")4rrz'''z"""zr'''zr"""zu'''zu"""zb'''zb"""zf'''zf"""zur'''zur"""zbr'''zbr"""zrb'''zrb"""zR'''zR"""zU'''zU"""zB'''zB"""zF'''zF"""zuR'''zuR"""zUr'''zUr"""zUR'''zUR"""zbR'''zbR"""zBr'''zBr"""zBR'''zBR"""zrB'''zrB"""zRb'''zRb"""zRB'''zRB"""rRuUfFbBr'''r"""R'''R"""u'''u"""U'''U"""b'''b"""B'''B"""f'''f"""F'''F"""ur'''ur"""Ur'''Ur"""uR'''uR"""UR'''UR"""br'''br"""Br'''Br"""bR'''bR"""BR'''BR"""rb'''rb"""Rb'''Rb"""rB'''rB"""RB'''RB"""r'r"R'R"u'u"U'U"b'b"B'B"f'f"F'F"ur'ur"Ur'Ur"uR'uR"UR'UR"br'br"Br'Br"bR'bR"BR'BR"rb'rb"Rb'Rb"rB'rB"RB'RB"c@s eZdZdS) TokenErrorN)__name__ __module__ __qualname__rrrr rwsrwc@s eZdZdS)StopTokenizingN)rxryrzrrrr r{sr{c Cs4|\}}|\}}td||||t|t|fdS)Nz%d,%d-%d,%d: %s %s)printtok_namerepr) typerZxxx_todo_changemeZxxx_todo_changeme1lineZsrowZscolZerowZecolrrr printtokensrc Cs(yt||Wntk r"YnXdS)a: The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. The second parameter, tokeneater, must also be a callable object. It is called once for each token, with five arguments, corresponding to the tuples generated by generate_tokens(). N) tokenize_loopr{)readline tokeneaterrrr r s cCsxt|D] }||q WdS)N)r)rrZ token_inforrr rsrc@s,eZdZddZddZddZddZd S) UntokenizercCsg|_d|_d|_dS)Nrr)tokensprev_rowprev_col)selfrrr __init__szUntokenizer.__init__cCs8|\}}||jkst||j}|r4|jjd|dS)N )rAssertionErrorrrappend)rstartrowcol col_offsetrrr add_whitespaces  zUntokenizer.add_whitespacecCsxv|D]n}t|dkr$|j||P|\}}}}}|j||jj||\|_|_|ttfkr|jd7_d|_qWdj |jS)Nrr) lencompatrrrrrNEWLINENLr)riterablettok_typerrendrrrr rs        zUntokenizer.untokenizec Csd}g}|jj}|\}}|ttfkr,|d7}|ttfkr|t kr|j qBn*|ttfkrd}n|r|r||dd}||qBWdS)NFrTrr) rrNAMENUMBERrrASYNCAWAITINDENTDEDENTpop) rrr startlineindents toks_appendtoknumtokvaltokrrr rs0      zUntokenizer.compatN)rxryrzrrrrrrrr rsrz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)cCsH|ddjjdd}|dks*|jdr.dS|d ks@|jdrDdS|S)z(Imitates get_normal_name in tokenizer.c.N r-zutf-8zutf-8-latin-1 iso-8859-1 iso-latin-1latin-1- iso-8859-1- iso-latin-1-)rrr)rrr)lowerreplace startswith)orig_encencrrr _get_normal_names rcsdd}d}fdd}fdd}|}|jtrHd|d d}d }|sT|gfS||}|rj||gfStj|s~||gfS|}|s||gfS||}|r|||gfS|||gfS) a The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. FNzutf-8c s"yStk rtSXdS)N) StopIterationbytesr)rrr read_or_stop sz%detect_encoding..read_or_stopcsy|jd}Wntk r"dSXtj|}|s6dSt|jd}y t|}Wn tk rptd|YnXr|j dkrtd|d7}|S)Nasciirzunknown encoding: zutf-8zencoding problem: utf-8z-sig) decodeUnicodeDecodeError cookie_rematchrrr LookupError SyntaxErrorname)r line_stringrencodingcodec) bom_foundrr find_cookie&s"   z$detect_encoding..find_cookieTz utf-8-sig)rrblank_rer)rrdefaultrrfirstsecondr)rrr detect_encoding s0         rcCst}|j|S)aTransform tokens back into Python source code. Each element returned by the iterable must be a token sequence with at least two elements, a token number and token value. If only two tokens are passed, the resulting output is poor. Round-trip invariant for full input: Untokenized source will match input source exactly Round-trip invariant for limited intput: # Output text will tokenize the back to the input t1 = [tok[:2] for tok in generate_tokens(f.readline)] newcode = untokenize(t1) readline = iter(newcode.splitlines(1)).next t2 = [tok[:2] for tokin generate_tokens(readline)] assert t1 == t2 )rr)rutrrr rTsc!csd}}}tjdd}}d \}}d}dg} d} d} d} d} xy |}Wntk rdd}YnX|d}dt|}}|rF|std||j|}|r|jd}}t||d||||f||fVd!\}}d}nd|r0|d"dd kr0|d#dd kr0t||||t|f|fVd}d}qBn||}||}qBnF|dkrt| rt|s`Pd}xf||kr||d kr|d}n6||dkr|t dt }n||dkrd}nP|d}qfW||krP| r| Vd} ||dkr||dkrh||dj d}|t|}t |||f||t|f|fVt ||d||f|t|f|fVqBt t f||dk||d||f|t|f|fVqB|| d$kr| j |t|d||df||f|fVxt|| d%krJ|| krtdd|||f| dd&} | r.| | d'kr.d} d} d} td||f||f|fVqW| r| r| | d(krd} d} d} n|std|dfd}x||krJtj||}|r|jd\}}||f||f|}}}|||||}}||ks|dkr|dkrt||||fVqF|dkrft}|dkr8t }n | rBd} | rR| Vd} |||||fVqF|dkr|jd st| r| Vd} t ||||fVqF|tkr$t|}|j||}|r|jd}|||}| r| Vd} t||||f|fVn||f}||d}|}PqF|tksR|dd tksR|dd tkr|d)dkr||f}t|pt|dpt|d }||dd}}|}Pn | r| Vd} t||||fVqF||kr|d*kr| r|dkrtnt||||fVqt||||f}|dkr.| r.|} q|dkr| r| dtkr| ddkrd} | d+} t| d| d | d | dfVd} | r| Vd} |Vnz|dkr| r| Vd} t ||||f|fVd}nF|dkr|d}n|dkr|d}| r | Vd} t||||fVn(t||||f||df|fV|d}qWqBW| r`| Vd} x.| ddD]} td|df|dfdfVqnWtd|df|dfdfVdS),aT The generate_tokens() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. Alternately, readline can be a callable function terminating with StopIteration: readline = open(myfile).next # Example of alternate readline The generator produces 5-tuples with these members: the token type; the token string; a 2-tuple (srow, scol) of ints specifying the row and column where the token begins in the source; a 2-tuple (erow, ecol) of ints specifying the row and column where the token ends in the source; and the line on which the token was found. The line passed is the logical line; continuation lines are included. rr 0123456789rNFrzEOF in multi-line stringrz\ rz\ r  z# #z z3unindent does not match any outer indentation levelz zEOF in multi-line statement.T asyncawaitdef\z([{z)]})rr)rrrrrrrr)rrr)stringZ ascii_lettersrrrwrrSTRING ERRORTOKENtabsizerstripCOMMENTrrrIndentationErrorr pseudoprogspanrrendswithr triple_quotedendprogs single_quotedrrrOP ENDMARKER)!rlnumparenlev continuedZ namecharsnumcharscontstrneedcontcontlinerstashed async_defasync_def_indent async_def_nlrposmaxstrstartendprogendmatchrcolumn comment_tokennl_pos pseudomatchrsposeposrinitialnewlinerindentrrr risr     *                             __main__)*rrr&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrM)*rrrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtru)S__doc__ __author__ __credits__rrecodecsrrZlib2to3.pgen2.tokenrrdir__all__r NameErrorstrrrr WhitespaceCommentIgnoreName Binnumber Hexnumber Octnumber Decnumber IntnumberExponent PointfloatExpfloat Floatnumber ImagnumberNumberSingleDoubleSingle3Double3Z _litprefixTripleStringOperatorBracketSpecialFunny PlainTokenTokenContStr PseudoExtras PseudoTokenlistmapcompileZ tokenprogrZ single3progZ double3progrrrrr Exceptionrwr{rr rrASCIIrrrrrrrxsysrargvopenrstdinrrrr s              8 Ic PKz1]I*__pycache__/__main__.cpython-312.opt-2.pycnu[ {|jCHddlZddlmZejedy)N)mainz lib2to3.fixes)sysrexit)/usr/lib64/python3.12/lib2to3/__main__.pyr s o rPKz1]f U U&__pycache__/fixer_util.cpython-312.pycnu[ {|jf;dZddlmZddlmZmZddlmZddl m Z dZ dZ dZ d Zd-d Zd Zd ZdZe e fdZd.dZdZdZd-dZdZd-dZd-dZdZdZdZdZdZhdZ dZ!da"da#d a$d!a%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,d)Z-ej\ej^hZ0d-d*Z1ej^ej\ejdhZ3d+Z4d-d,Z5y )/z1Utility functions, node construction macros, etc.)token)LeafNode)python_symbols)patcompclttj|ttj d|gS)N=)rsymsargumentrrEQUAL)keywordvalues +/usr/lib64/python3.12/lib2to3/fixer_util.py KeywordArgrs*  $u{{C0%8 ::c6ttjdS)N()rrLPARrrLParenr  C  rc6ttjdS)N))rrRPARrrrRParenrrrc t|ts|g}t|ts d|_|g}ttj |t tjddgz|zS)zBuild an assignment statement r prefix) isinstancelistrrr atomrrr )targetsources rAssignr%s] fd # fd #   $u{{C<==F HHrNc:ttj||S)zReturn a NAME leafr)rrNAME)namers rNamer)$s  D 00rcN|ttjt|ggS)zA node tuple for obj.attr)rr trailerDot)objattrs rAttrr/(s dllSUDM2 33rc6ttjdS)z A comma leaf,)rrCOMMArrrCommar3,s  S !!rc6ttjdS)zA period (.) leaf.)rrDOTrrrr,r,0s  3 rcttj|j|jg}|r*|j dttj ||S)z-A parenthesised argument list, used by Call()r)rr r+clone insert_childarglist)argslparenrparennodes rArgListr?4sF  v||~v||~> ?D  !T$,,56 Krcbttj|t|g}|||_|S)zA function call)rr powerr?r) func_namer;rr>s rCallrC;s-  Y 6 7D  Krc6ttjdS)zA newline literal rrNEWLINErrrNewlinerHBs  t $$rc6ttjdS)z A blank linerFrrr BlankLinerKFs  r ""rc:ttj||S)Nr)rrNUMBER)nrs rNumberrOJs  a //rc ttjttj d|ttj dgS)zA numeric or string subscript[])rr r+rrLBRACERBRACE) index_nodes r SubscriptrVMs8  tELL#6)#ELL#68 99rc:ttj||S)z A string leafr)rrSTRING)stringrs rStringrZSs  fV 44rc hd|_d|_d|_ttjd}d|_ttjd}d|_||||g}|rSd|_ttjd}d|_|j t t j||gt t j|t t j|g}t t jttjd|ttjdgS)zuA list comprehension of the form [xp for fp in it if test]. If test is None, the "if test" part is omitted. rJrforinifrQrR) rrrr'appendrr comp_if listmakercomp_forr"rSrT) xpfpittestfor_leafin_leaf inner_argsif_leafinners rListComprlWs BIBIBIEJJ&HHO5::t$GGNB,J  uzz4($t||gt_=> "d4==*&E!F GE  U\\3/U\\3/1 22rc<|D]}|jttjdttj|dttjddt t j |g}t t j|}|S)zO Return an import statement in the form: from package import name_leafsfromrrimport)removerrr'rr import_as_names import_from) package_name name_leafsleafchildrenimps r FromImportrxosw UZZ(UZZc:UZZ#6T)):68H t *C Jrc N|dj}|jtjk(r|j}n)t tj|jg}|d}|r|Dcgc]}|j}}t tj t t|dt|dt tj|dj||djggz|z}|j|_ |Scc}w)zfReturns an import statement and calls a method of the module: import module module.name()r-afterrlparrpar) r8typer r:rrAr/r)r+r)r>resultsnamesr- newarglistrzrNnews r ImportAndCallrs %.   C xx4<<YY[ $,, 6 G E $)*EqE* tzzDqNDqN3T\\fo++- fo++-/01149 9 :C CJ J+s6D"ct|tr"|jtt gk(ryt|txrt |jdk(xrt|jdt xrxt|jdtxrYt|jdt xr:|jdjdk(xr|jdjdk(S)z(Does the node represent a tuple literal?Tr{rrr)r rrvrrlenrrr>s ris_tuplers$$--FHfh3G"G tT " .DMM"a' .4==+T2 .4==+T2 .4==+T2  .  a &&#-  .  a &&#- /rcJt|txrt|jdkDxrxt|jdtxrYt|jdtxr:|jdj dk(xr|jdj dk(S)z'Does the node represent a list literal?rr{rQrR)r rrrvrrrs ris_listrs tT " /DMM"Q& /4==+T2 /4==,d3 / a &&#-  /  b!''3. 0rc\ttjt|t gSN)rr r"rrrs r parenthesizers  FHdFH5 66r> allanymaxminsetsumr!tuplesorted enumeratec#PKt||}|r|t||}|ryyw)alFollow an attribute chain. If you have a chain of objects where a.foo -> b, b.foo-> c, etc, use this to iterate over all objects in the chain. Iteration is terminated by getattr(x, attr) is None. Args: obj: the starting object attr: the name of the chaining attribute Yields: Each successive object in the chain. N)getattr)r-r.nexts r attr_chainrs- 3 D  tT" s!&&zefor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > z power< ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | 'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) ) trailer< '(' node=any ')' > any* > z` power< ( 'sorted' | 'enumerate' ) trailer< '(' arglist ')' > any* > FcDtsMtjtatjtatjt adattt g}t |t|dD]#\}}i}|j||s|d|us#yy)a Returns true if node is in an environment where all that is required of it is being iterable (ie, it doesn't matter if it returns a list or an iterator). See test_map_nochange in test_fixers.py for some examples and tests. Tparentr>F) pats_builtrcompile_patternp0p1p2ziprmatch)r>patternspatternrrs rin_special_contextrs   $ $R (  $ $R (  $ $R ( B|HxD()CD == )gfo.EE rc|j}||jtjk(ry|j}|jt j t jfvry|jt jk(r|jd|ury|jt jk(sM|jt jk(r1||jtjk(s|jd|uryy)zG Check that something isn't an attribute or function name etc. Fr{T) prev_siblingr~rr6rr funcdefclassdef expr_stmtrv parameters typedargslistr2)r>prevrs ris_probably_builtinrs   D DII2 [[F {{t||T]]33 {{dnn$);t)C {{doo% [[D.. .  $))u{{": OOA $ & rc|||jtjk(rPt|jdkDr8|jd}|jt j k(r |jS|j}||y)zFind the indentation of *node*.rrrJ) r~r suiterrvrINDENTrr)r>indents rfind_indentationrsf   99 "s4=='9A'=]]1%F{{ell*||#{{   rc|jtjk(r|S|j}|jdc}|_t tj|g}||_|Sr)r~r rr8rr)r>rrs r make_suitersR yyDJJ ::bindings rdoes_tree_importr/s 44':G =rcZ|jtjtjfvS)z0Returns true if the node is an import statement.)r~r import_namerrrs r is_importr7s" 99))4+;+;< <\}}||st|j|dD]\}}||rn||z}n|dk(ryt|jD]a\}}|jt j k(s$|js1|jdjtjk(s\|dz}n|Ott jttjdttj|dg} n't|ttj|dg} | tg} |j|tt j | y)z\ Works like `does_tree_import` but adds an import statement if it was not imported. c|jtjk(xr&|jxrt |jdS)Nr{)r~r simple_stmtrvrrs ris_import_stmtz$touch_import..is_import_stmt>s: T---,$--,$--*+ -rNr{rrorr)rrrrvr~r rrrXrrrr'rxrHr9) rr(r>rroot insert_posoffsetidxnode2import_rvs r touch_importr;sh- T?Dt,Jt}}- Td# &t}}ST':;MFE!%(<6\  .Q"4==1IC T---$--}}Q$$ 4 1W  2 t'' X & T# .*   WtEJJS'I&JK#Hj$t'7'7"BCrc |jD]<}d}|jtjk(rGt ||jdr|cSt |t |jd|}|r|}n|jtjtjfvr*t |t |jd|}|rh|}nd|jtjk(rt |t |jd|}|r|}nt|jddD]^\}}|jtjk(s$|jdk(s4t |t |j|dz|}|s]|}`n|jtvr|jdj|k(r|}nst|||r|}nc|jtj k(rt |||}n8|jtj"k(rt ||jdr|}|s(|s|cSt%|s;|cSy) z Returns the node which binds variable name, otherwise None. If optional argument package is supplied, only imports will be returned. See test cases for examples.Nrrrr:r{)rvr~r for_stmt_findrrif_stmt while_stmttry_stmtrrCOLONr _def_syms_is_import_bindingrrr)r(r>rchildretrNikids rrris  :: &T5>>!,- T:ennR.@#A7KA# ZZDLL$//: :T:ennR.@#A7KA# ZZ4== (T:ennQ.?#@'JA'qr(:;FAsxx5;;.3993C(z%..1:M/NPWXAc < ZZ9 $):)@)@D)HC tW 5C ZZ4++ +tUG4C ZZ4>> )T5>>!,-  ~ EF rc |g}|r~|j}|jdkDr.|jtvr|j|jn.|jt j k(r|j|k(r|S|r~y)N)popr~ _block_symsextendrvrr'r)r(r>nodess rrrsg FE yy{ 99s?tyy ; LL ' YY%** $t);K  rc,|jtjk(r9|s6|jd}|jtjk(r|jD]q}|jtj k(r!|jdj |k(s=|cS|jtjk(s_|j |k(so|cSy|jtj k(r=|jd}|jtjk(r?|j |k(r0|S|jtjk(r|j |k(r|Sy|jtjk(r|r*t|jdj|k7ry|jd}|r td|ry|jtjk(rt||r|S|jtjk(r>|jd}|jtjk(r|j |k(r|Sy|jtjk(r|j |k(r|S|r|jtjk(r|Sy)z Will return node if node will import name, or node will import * from package. None is returned otherwise. See test cases for examples. rrrNras)r~r rrvdotted_as_namesdotted_as_namerrr'rrstrstriprrqimport_as_nameSTAR)r>r(rrwrlastrNs rrrs  yyD$$$WmmA 88t++ +::!4!44~~a(..$6# ZZ5::-%++2EK &> 3XX,, ,<<#DyyEJJ&4::+= XX # T(9K( ' d&& & s4==+,224? MM!  uT1~ VVt++ +dAK VVt** *JJqMEzzUZZ'EKK4,?  VVuzz !aggoK 5::-K rr)NN)6__doc__pgen2rpytreerrpygramrr rJrrrrr%r)r/r3r,r?rCrHrKrOrVrZrlrxrrrrconsuming_callsrrrrrrrrrrrrrrrrrr+rrrrrrrs7*:!! H14"  &(%#09 520&8 /07.#&  &.=*DZ]]DLL ) (T||T]]DLL9 'rPKz1]G!ff"__pycache__/pygram.cpython-312.pycnu[ {|jdZddlZddlmZddlmZddlmZejjejje dZ ejjejje dZ Gd d e Zejd e ZeeZej%Zej(d =ej%Zej(d =ejd e ZeeZy)z&Export the Python grammar and symbols.N)token)driver)pytreez Grammar.txtzPatternGrammar.txtceZdZdZy)Symbolscb|jjD]\}}t|||y)zInitializer. Creates an attribute for each grammar symbol (nonterminal), whose value is the symbol's type (an int >= 256). N) symbol2numberitemssetattr)selfgrammarnamesymbols '/usr/lib64/python3.12/lib2to3/pygram.py__init__zSymbols.__init__s- $11779LD& D$ ':N)__name__ __module__ __qualname__rrrrrs(rrlib2to3printexec)__doc__ospgen2rrrpathjoindirname__file__ _GRAMMAR_FILE_PATTERN_GRAMMAR_FILEobjectrload_packaged_grammarpython_grammarpython_symbolscopy!python_grammar_no_print_statementkeywords*python_grammar_no_print_and_exec_statementpattern_grammarpattern_symbolsrrrr/s-  RWW__X6 F  RWW__X%>%9; (f (.--iG($2$7$7$9!%..w7-N-S-S-U*.77?.&..y:OP/*rPKz1]qlSS,__pycache__/fixer_base.cpython-312.opt-2.pycnu[ {|j"^ ddlZddlmZddlmZddlmZGddeZGdd eZ y) N)PatternCompiler)pygram)does_tree_importceZdZ dZdZdZdZdZejdZ e Z dZ dZdZdZdZdZej(ZdZdZdZd Zd Zdd Zd Zdd ZdZdZdZ y)BaseFixNrpostFcB ||_||_|jyN)optionslogcompile_pattern)selfr rs +/usr/lib64/python3.12/lib2to3/fixer_base.py__init__zBaseFix.__init__/s#   c |j5t}|j|jd\|_|_yy)NT) with_tree)PATTERNrrpattern pattern_tree)rPCs rrzBaseFix.compile_pattern;sJ << # "B.0.@.@KO/A/Q +DL$+ $rc ||_yr )filename)rrs r set_filenamezBaseFix.set_filenameFs ! rcL d|i}|jj||xr|S)Nnode)rmatchrrresultss rrz BaseFix.matchMs. 4.||!!$0>"DN HHOO04==@ A  rc |j}|j}d|_d}|j|||fz|r|j|yy)NzLine %d: could not convert: %s) get_linenocloneprefixr2)rrreasonlineno for_outputmsgs rcannot_convertzBaseFix.cannot_convertzs[ "ZZ\  .  334    V $ rcR |j}|jd||fzy)Nz Line %d: %s)r5r2)rrr8r9s rwarningzBaseFix.warnings- " &&)99:rc |j|_|j|tjd|_d|_y)NrT)r&r itertoolscountr)r/rtreers r start_treezBaseFix.start_trees9 // (# q) rc yr rBs r finish_treezBaseFix.finish_trees  r)xxx_todo_changemer )!__name__ __module__ __qualname__rrrr rr@rAr)setr&orderexplicit run_order _accept_typekeep_line_order BM_compatiblerpython_symbolssymsrrrrr$r-r2r<r>rDrGrFrrrrsGGLGHiooa GJ EHILOM  D  Q! =$ ! %;  rrc*eZdZ dZfdZdZxZS)ConditionalFixNc4tt| |d|_yr )superrVrD _should_skip)rargs __class__s rrDzConditionalFix.start_trees nd.5 rc|j |jS|jjd}|d}dj|dd}t ||||_|jS)N.)rYskip_onsplitjoinr)rrpkgr,s r should_skipzConditionalFix.should_skipsh    ($$ $ll  %2whhs3Bx ,S$=   r)rIrJrKr_rDrc __classcell__)r[s@rrVrVsJG!!rrV) r@patcomprr4r fixer_utilrobjectrrVrFrrrhs59%(X fX v!W!rPKz1]fZZ$__pycache__/__init__.cpython-312.pycnu[ {|j6ddlZejdedy)NzGlib2to3 package is deprecated and may not be able to parse Python 3.10+) stacklevel)warningswarnDeprecationWarning)/usr/lib64/python3.12/lib2to3/__init__.pyr s! Mr PKz1]z&__pycache__/fixer_base.cpython-312.pycnu[ {|j"`dZddlZddlmZddlmZddlmZGddeZ Gd d e Z y) z2Base class for fixers (optional, but recommended).N)PatternCompiler)pygram)does_tree_importceZdZdZdZdZdZdZdZe jdZ e Z dZdZdZdZdZdZej*ZdZdZd Zd Zd Zdd Zd ZddZdZdZ dZ!y)BaseFixaOptional base class for fixers. The subclass name must be FixFooBar where FooBar is the result of removing underscores and capitalizing the words of the fix name. For example, the class name for a fixer named 'has_key' should be FixHasKey. NrpostFc@||_||_|jy)aInitializer. Subclass may override. Args: options: a dict containing the options passed to RefactoringTool that could be used to customize the fixer through the command line. log: a list to append warnings and other messages to. N)optionslogcompile_pattern)selfr r s +/usr/lib64/python3.12/lib2to3/fixer_base.py__init__zBaseFix.__init__/s  c|j5t}|j|jd\|_|_yy)zCompiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match(). NT) with_tree)PATTERNrrpattern pattern_tree)rPCs rrzBaseFix.compile_pattern;sE << # "B.0.@.@KO/A/Q +DL$+ $rc||_y)zOSet the filename. The main refactoring tool should call this. N)filename)rrs r set_filenamezBaseFix.set_filenameFs ! rcJd|i}|jj||xr|S)aReturns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override. node)rmatchrrresultss rrz BaseFix.matchMs)4.||!!$0>"DN HHOO04==@ A  rc|j}|j}d|_d}|j|||fz|r|j|yy)aWarn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. zLine %d: could not convert: %sN) get_linenocloneprefixr1)rrreasonlineno for_outputmsgs rcannot_convertzBaseFix.cannot_convertzsV"ZZ\  .  334    V $ rcP|j}|jd||fzy)zUsed for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. z Line %d: %sN)r4r1)rrr7r8s rwarningzBaseFix.warnings(" &&)99:rc|j|_|j|tjd|_d|_y)zSome fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. rTN)r%r itertoolscountr(r.rtreers r start_treezBaseFix.start_trees4// (# q) rcy)zSome fixers need to maintain tree-wide state. This method is called once, at the conclusion of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. NrAs r finish_treezBaseFix.finish_trees r)xxx_todo_changemeN)"__name__ __module__ __qualname____doc__rrrr rr?r@r(setr%orderexplicit run_order _accept_typekeep_line_order BM_compatiblerpython_symbolssymsrrrrr#r,r1r;r=rCrFrErrrrsGGLGHiooa GJ EHILOM  D  Q! =$ ! %;  rrc,eZdZdZdZfdZdZxZS)ConditionalFixz@ Base class for fixers which not execute if an import is found. Nc4tt| |d|_yrH)superrWrC _should_skip)rargs __class__s rrCzConditionalFix.start_trees nd.5 rc|j |jS|jjd}|d}dj|dd}t ||||_|jS)N.)rZskip_onsplitjoinr)rrpkgr+s r should_skipzConditionalFix.should_skipsh    ($$ $ll  %2whhs3Bx ,S$=   r)rIrJrKrLr`rCrd __classcell__)r\s@rrWrWsJG!!rrW) rLr?patcomprr3r fixer_utilrobjectrrWrErrris59%(X fX v!W!rPKz1] N+N++__pycache__/btm_utils.cpython-312.opt-1.pycnu[ {|j&dZddlmZddlmZmZddlmZmZeZ eZ ejZ eZ dZdZdZGdd eZdd Zd Zd Zy )z0Utility functions used by the btm_matcher module)pytree)grammartoken)pattern_symbolspython_symbolsc0eZdZdZddZdZdZdZdZy) MinNodezThis class serves as an intermediate representation of the pattern tree during the conversion to sets of leaf-to-root subpatternsNcf||_||_g|_d|_d|_g|_g|_y)NF)typenamechildrenleafparent alternativesgroup)selfrrs */usr/lib64/python3.12/lib2to3/btm_utils.py__init__zMinNode.__init__s4      c^t|jdzt|jzS)N )strrr)rs r__repr__zMinNode.__repr__s"499~#c$))n44rcD|}g}|r|jtk(r|jj|t |jt |j k(r*t |jg}g|_|j}|j}d} |S|jtk(r|jj|t |jt |j k(r*t|j}g|_ |j}|j}d} |S|jtjk(r(|jr|j|jn|j|j|j}|r|S)zInternal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a singleN)rTYPE_ALTERNATIVESrappendlenrtupler TYPE_GROUPrget_characteristic_subpattern token_labelsNAMEr)rnodesubps r leaf_to_rootzMinNode.leaf_to_root!sPyy--!!((.t(()S-??!$"3"345D(*D%;;D;;DD, )yyJ& !!$'tzz?c$--&888DD!#DJ;;D;;DD yyL---$)) DII& DII&;;DCD rcZ|jD]}|j}|s|cSy)aDrives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton's capabilities, leaf_to_root merges each group into a single choice based on 'characteristic'ity, i.e. (a|b c) -> (a|b) if b more characteristic than c Returns: The most 'characteristic'(as defined by get_characteristic_subpattern) path for the compiled pattern tree. N)leavesr()rlr's rget_linear_subpatternzMinNode.get_linear_subpatternKs( A>>#D rc#K|jD]}|jEd{|js|yy7w)z-Generator that returns the leaves of the treeN)rr*)rchilds rr*zMinNode.leaves`s9]]E||~ % %#}}J &s#A>A)NN) __name__ __module__ __qualname____doc__rrr(r,r*rrr r s!5(T*rr Nc d}|jtjk(r|jd}|jtjk(rt |jdkrt |jd|}ntt}|jD]K}|jj|dzr"t ||}|1|jj|Mna|jtjk(rt |jdkDr\tt}|jD],}t ||}|s|jj|.|jsd}nt |jd|}n|jtjk(rt|jdtj r5|jdj"dk(rt |jd|St|jdtj r|jdj"dk(sMt |jdkDr6t%|jddr|jdj"dk(ryd }d}d}d }d} d } |jD]}|jtj&k(rd }|}nA|jtj(k(rd }|} n|jtjk(r|}t%|dss|j"d k(sd } | r:|jd} t%| dr.| j"dk(r|jd } n|jd} | jt*j,k(r| j"d k(rtt.}nt%t*| j"r%tt1t*| j"}ntt1t2| j"}n| jt*j4k(rS| j"j7d} | t8vrtt8| }nEtt*j,| }n)| jtjk(r t ||}|rB| jdj"dk(rd}n#| jdj"dk(rnt:|r@|>|jddD],}t ||}||jj|.|r||_|S)z Internal function. Reduces a compiled pattern tree to an intermediate representation suitable for feeding the automaton. This also trims off any optional pattern elements(like [a], a*). N)rr([valueTF=any')rr*+r)rsymsMatcherr Alternativesr reduce_treer rindexr Alternativer"Unit isinstancerLeafr9hasattrDetailsRepeaterr$r%TYPE_ANYgetattrpysymsSTRINGstriptokensNotImplementedErrorr) r&rnew_noder.reducedr details_nodealternatives_node has_repeater repeater_nodehas_variable_name name_leafrs rrCrCgsIH yyDLL }}Q yyD%%% t}}  ""4==#3V>\.. .%'"1<9&GL)//,RSH&GFIOO,LMH ^^|22 2??((-Dv~"t 5" (9(9E ^^t00 0"#4f=H %%a(..#5''*00C7*) H0%..q4%eX6&%%,,W5 5   Orct|ts|St|dk(r|dSg}g}gdg}d|D]~}tt |dstt |fdr|j |Dtt |fdr|j |n|j ||r|}n |r|}n|r|}t |tS) zPicks the most characteristic from a list of linear patterns Current order used is: names > common_names > common_chars rr5)inforifnotNonez[]().,:c$t|tuSN)rr)xs rz/get_characteristic_subpattern..s d1gnrc0t|txr|vSrbrGr)rc common_charss rrdz/get_characteristic_subpattern..sjC&8&NQ,=N&Nrc0t|txr|vSrbrf)rc common_namess rrdz/get_characteristic_subpattern..s 1c(:(PqL?P(Pr)key)rGlistr r<rec_testrmax) subpatternssubpatterns_with_namessubpatterns_with_common_namessubpatterns_with_common_chars subpatternrgris @@rr#r#s k4 ( ;1~ $&!6L$&!L! x $<= >8JNPQ-44Z@XjPRS-44Z@'--j9", &3 &3 { $$rc#K|D]7}t|ttfrt||Ed{.||9y7w)zPTests test_func on all items of sequence and items of included sub-iterablesN)rGrkr!rl)sequence test_funcrcs rrlrls= a$ '9- - -A,   -s+AAArb)r2rpgen2rrpygramrrr@rNopmaprQr$rLrr"objectr rCr#rlr3rrr{sZ2!3     UfUnBJ#%JrPKz1]2چԈ"__pycache__/pytree.cpython-312.pycnu[ {|jFmdZdZddlZddlmZdZiadZGddeZ Gd d e Z Gd d e Z d Z GddeZ Gdde ZGdde ZGdde ZGdde ZdZy)z Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here. z#Guido van Rossum N)StringIOictsDddlm}|jj D]!\}}t |t k(s|t|<#tj||S)N)python_symbols) _type_reprspygramr__dict__itemstypeint setdefault)type_numrnamevals '/usr/lib64/python3.12/lib2to3/pytree.py type_reprrsO *(00668ID#CyCDS!19  ! !(H 55ceZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZedZedZdZdZdZej6dkrdZyy)Basez Abstract base class for Node and Leaf. This provides some default functionality and boilerplate using the template pattern. A node may be a subnode of at most one parent. NFcJ|tusJdtj|S)z7Constructor that prevents Base from being instantiated.zCannot instantiate Base)robject__new__clsargskwdss rrz Base.__new__1s#$9 99~~c""rc`|j|jurtS|j|S)zW Compare two nodes for equality. This calls the method _eq(). ) __class__NotImplemented_eqselfothers r__eq__z Base.__eq__6s( >> 0! !xxrct)a_ Compare two nodes for equality. This is called by __eq__ and __ne__. It is only called if the two nodes have the same type. This must be implemented by the concrete subclass. Nodes should be considered equal if they have the same structure, ignoring the prefix string and other context information. NotImplementedErrorr"s rr!zBase._eqBs "!rct)zr Return a cloned (deep) copy of self. This must be implemented by the concrete subclass. r'r#s rclonez Base.cloneM "!rct)zx Return a post-order iterator for the tree. This must be implemented by the concrete subclass. r'r*s r post_orderzBase.post_orderUr,rct)zw Return a pre-order iterator for the tree. This must be implemented by the concrete subclass. r'r*s r pre_orderzBase.pre_order]r,rc|jJt||Jt|ts|g}g}d}|jjD]M}||ur6|rJ|jj||f||j |d}=|j |O|sJ|j||f|jj||j_|D]}|j|_d|_y)z/Replace this node with a new one in the parent.NFT)parentstr isinstancelistchildrenextendappendchanged)r#new l_childrenfoundchxs rreplacez Base.replacees{{&1D 1&#t$%C ++&&BTz C4;;#7#7s"CCy?%%c*!!"%'0t}}dC00u ) A{{AH rc|}t|ts-|jsy|jd}t|ts-|jS)z9Return the line number which generated the invocant node.Nr)r4Leafr6linenor#nodes r get_linenozBase.get_lineno|sAT4(====#DT4({{rc^|jr|jjd|_y)NT)r2r9 was_changedr*s rr9z Base.changeds! ;; KK   !rc|jrht|jjD]E\}}||us |jj|jj|=d|_|cSyy)z Remove the node from the tree. Returns the position of the node in its parent's children before it was removed. N)r2 enumerater6r9)r#irDs rremovez Base.removesb ;;$T[[%9%9:44<KK'') ,,Q/"&DKH ; rc|jyt|jjD](\}}||us |jj|dzcSy#t$rYywxYw)z The node immediately following the invocant in their parent's children list. If the invocant does not have a next sibling, it is None Nr)r2rIr6 IndexErrorr#rJchilds r next_siblingzBase.next_siblingsi ;; "$++"6"67HAu} ;;//!448"  sA A&%A&c|jyt|jjD].\}}||us |dk(ry|jj|dz cSy)z The node immediately preceding the invocant in their parent's children list. If the invocant does not have a previous sibling, it is None. Nrr)r2rIr6rNs r prev_siblingzBase.prev_siblingsZ ;; "$++"6"67HAu}6{{++AaC00 8rc#bK|jD]}|jEd{y7wN)r6leavesr#rOs rrUz Base.leavess&]]E||~ % %# %s #/-/cV|jyd|jjzS)Nrr)r2depthr*s rrXz Base.depths' ;; 4;;$$&&&rc8|j}|y|jS)z Return the string immediately following the invocant node. This is effectively equivalent to node.next_sibling.prefix )rPprefix)r#next_sibs r get_suffixzBase.get_suffixs" $$  rrc6t|jdS)Nascii)r3encoder*s r__str__z Base.__str__st9##G, ,r)__name__ __module__ __qualname____doc__r r2r6rG was_checkedrr%__hash__r!r+r.r0r?rEr9rKpropertyrPrRrUrXr]sys version_inforcrrrrrs D FHKK# H """".    1 1&'  &  -!rrceZdZdZ ddZdZdZejdkDreZ dZ dZ d Z d Z ed Zej d Zd ZdZdZy)Nodez+Concrete implementation for interior nodes.Nc|dk\sJ|||_t||_|jD]%}|jJt |||_'|||_|r |dd|_yd|_y)z Initializer. Takes a type constant (a symbol number >= 256), a sequence of child nodes, and an optional context keyword argument. As a side effect, the parent pointers of the children are updated. N)r r5r6r2reprr[fixers_applied)r#r r6contextr[rrr=s r__init__z Node.__init__s|s{ D { X --B99$ .d2h .$BI    DK "0"3D "&D rcz|jjdt|jd|jdSz)Return a canonical string representation.(, ))rrdrr r6r*s r__repr__z Node.__repr__s,#~~66(3#}}. .rcTdjtt|jS)k Return a pretty string representation. This reproduces the input source exactly. rZ)joinmapr3r6r*s r __unicode__zNode.__unicode__s wws3 .//rr^cd|j|jf|j|jfk(SzCompare two nodes for equality.)r r6r"s rr!zNode._eqs' 4==)ejj%..-IIIrct|j|jDcgc]}|jc}|jScc}wz$Return a cloned (deep) copy of self.)rr)rnr r6r+rr)r#r=s rr+z Node.clones<DIIT]]C]r ]C#'#6#68 8CsA c#jK|jD]}|jEd{|y7 wz*Return a post-order iterator for the tree.N)r6r.rVs rr.zNode.post_orders0]]E'') ) )#  *s #31 3c#jK||jD]}|jEd{y7wz)Return a pre-order iterator for the tree.N)r6r0rVs rr0zNode.pre_order s, ]]E( ( (# (s '313cN|jsy|jdjS)zO The whitespace and comments preceding this node in the input. rZrr6r[r*s rr[z Node.prefixs# }}}}Q&&&rcF|jr||jd_yyNrrr#r[s rr[z Node.prefixs ==&,DMM!  # rcx||_d|j|_||j|<|jy)z Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. N)r2r6r9rNs r set_childzNode.set_child s3  "& a  a rcj||_|jj|||jy)z Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. N)r2r6insertr9rNs r insert_childzNode.insert_child*s(   Q& rch||_|jj||jy)z Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately. N)r2r6r8r9rVs r append_childzNode.append_child3s&   U# rNNN)rdrerfrgrtrzrrkrlrcr!r+r.r0rjr[setterrrrrrrrnrns5 $'2. 0 & J8  ) '' ]]--rrnceZdZdZdZdZdZddgfdZdZdZ e jdkDre Z d Z d Zd Zd Zd ZedZej(dZy)rAz'Concrete implementation for leaf nodes.rZrNcd|cxkr dksJ|J|||\|_\|_|_||_||_|||_|dd|_y)z Initializer. Takes a type constant (a token number < 256), a string value, and an optional context keyword argument. rrpN)_prefixrBcolumnr valuerr)r#r rrsr[rrs rrtz Leaf.__init__FsfD3$$$$  7> 4DL44;    !DL,Q/rch|jjd|jd|jdSrv)rrdr rr*s rrzz Leaf.__repr__Ys'#~~66#yy#zz+ +rcF|jt|jzS)r|)r[r3rr*s rrzLeaf.__unicode___s {{S_,,rr^cd|j|jf|j|jfk(Sr)r rr"s rr!zLeaf._eqjs' 4::&5::u{{*CCCrct|j|j|j|j|j ff|j Sr)rAr rr[rBrrrr*s rr+z Leaf.clonens=DIItzz[[4;; "<=#'#6#68 8rc#K|ywrTrr*s rrUz Leaf.leavests  c#K|ywrrr*s rr.zLeaf.post_orderw  rc#K|ywrrr*s rr0zLeaf.pre_order{rrc|jS)zP The whitespace and comments preceding this token in the input. )rr*s rr[z Leaf.prefixs ||rc2|j||_yrT)r9rrs rr[z Leaf.prefixs  r)rdrerfrgrrBrrtrzrrkrlrcr!r+rUr.r0rjr[rrrrrArA=s1G F F "0&+ - & D8   ]]rrAc|\}}}}|s||jvr!t|dk(r|dSt|||St|||S)z Convert raw node information to a Node or Leaf instance. This is passed to the parser driver which calls it whenever a reduction of a grammar rule produces a new complete node, so that the tree is build strictly bottom-up. rr)rs) number2symbollenrnrA)grraw_noder rrsr6s rconvertrsX&."D%(42+++ x=A A; D(G44D%11rcDeZdZdZdZdZdZdZdZdZ d dZ d dZ dZ y) BasePatterna A pattern is a tree matching pattern. It looks for a specific node type (token or symbol), and optionally for a specific content. This is an abstract base class. There are three concrete subclasses: - LeafPattern matches a single leaf node; - NodePattern matches a single node (usually non-leaf); - WildcardPattern matches a sequence of nodes of variable length. NcJ|tusJdtj|S)z>Constructor that prevents BasePattern from being instantiated.zCannot instantiate BasePattern)rrrrs rrzBasePattern.__new__s%+%G'GG%~~c""rct|j|j|jg}|r|d |d=|r|d |jj ddj tt|dS)Nrwrxry) rr contentrrrdr}r~rq)r#rs rrzzBasePattern.__repr__sd$))$dllDII>tBx'RtBx'>>22DIIc$o4NOOrc|S)z A subclass can define this as a hook for optimizations. Returns either self or another node with the same effect. rr*s roptimizezBasePattern.optimizes  rc|j|j|jk7ry|j,d}|i}|j||sy|r|j|||jr|||j<y)a# Does this pattern exactly match a node? Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. Default implementation for non-wildcard patterns. NFT)r r _submatchupdater)r#rDresultsrs rmatchzBasePattern.matchsw 99 TYY$))%; << #A">>$*q!  499!%GDII rcJt|dk7ry|j|d|S)z Does this pattern exactly match a sequence of nodes? Default implementation for non-wildcard patterns. rFr)rr)r#nodesrs r match_seqzBasePattern.match_seqs' u:?zz%(G,,rc#NKi}|r|j|d|rd|fyyyw)z} Generator yielding all matches for this pattern. Default implementation for non-wildcard patterns. rrN)r)r#rrs rgenerate_matcheszBasePattern.generate_matchess1  TZZa!,Q$J-5s#%rT) rdrerfrgr rrrrzrrrrrrrrrs7  DG D# P 2-rrc$eZdZddZddZddZy) LeafPatternNc|d|cxkr dksJ|J|| t|tsJt|||_||_||_y)ap Initializer. Takes optional type, content, and name. The type, if given must be a token type (< 256). If not given, this matches any *leaf* node; the content may still be required. The content, if given, must be a string. If a name is given, the matching node is stored in the results dict under that key. Nrrp)r4r3rqr rr)r#r rrs rrtzLeafPattern.__init__s]  ?s? (D (? (D (?  gs+ :T'] :+   rcRt|tsytj|||S)z*Override match() to insist on a leaf node.F)r4rArrr#rDrs rrzLeafPattern.match s$$%  tW55rc4|j|jk(S) Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. )rrrs rrzLeafPattern._submatchs||tzz))rrrT)rdrerfrtrrrrrrrs(6 *rrc eZdZdZddZddZy) NodePatternFNc,| |dk\sJ||ot|trJt|t|}t |D]6\}}t|t s J||ft|t s0d|_8||_||_ ||_ y)ad Initializer. Takes optional type, content, and name. The type, if given, must be a symbol type (>= 256). If the type is None this matches *any* single node (leaf or not), except if content is not None, in which it only matches non-leaf nodes that also match the content pattern. The content, if not None, must be a sequence of Patterns that must match the node's children exactly. If the content is given, the type must not be None. If a name is given, the matching node is stored in the results dict under that key. NrpT) r4r3rqr5rIrWildcardPattern wildcardsr rr)r#r rrrJitems rrtzNodePattern.__init__$s  3; $ $;  !'3/ >g >/7mG$W-4!$ 4?q$i?4dO4%)DN.   rc|jrVt|j|jD]2\}}|t |jk(s||j |yyt |jt |jk7ryt |j|jD]\}}|j||ryy)rTF)rrrr6rrzipr)r#rDrcr subpatternrOs rrzNodePattern._submatchAs >>(t}}E1DMM***q) F  t|| DMM 2 2!$T\\4==!A J##E73"BrrrT)rdrerfrrtrrrrrr sI:rrcNeZdZdZddedfdZdZd dZd dZdZ d Z d Z d Z y) ra A wildcard pattern can match zero or more nodes. This has all the flexibility needed to implement patterns like: .* .+ .? .{m,n} (a b c | d e | f) (...)* (...)+ (...)? (...){m,n} except it always uses non-greedy matching. Nrc,d|cxkr|cxkr tks nJ||f|Vttt|}t|sJt ||D]}t|rJt |||_||_||_||_y)a Initializer. Args: content: optional sequence of subsequences of patterns; if absent, matches one node; if present, each subsequence is an alternative [*] min: optional minimum number of times to match, default 0 max: optional maximum number of times to match, default HUGE name: optional name assigned to this match [*] Thus, if content is [[a, b, c], [d, e], [f, g, h]] this is equivalent to (a b c | d e | f g h); if content is None, this is equivalent to '.' in regular expression terms. The min and max parameters work as follows: min=0, max=maxint: .* min=1, max=maxint: .+ min=0, max=1: .? min=1, max=1: . If content is not None, replace the dot with the parenthesized list of alternatives, e.g. (a b c | d e | f g h)* rN) HUGEtupler~rrqrminmaxr)r#rrrralts rrtzWildcardPattern.__init__ks.C&3&$&2c 2&  Cw/0Gw< .g .<3x*c*x  rcd}|jEt|jdk(r-t|jddk(r|jdd}|jdk(r\|jdk(rM|jt |j S|)|j |j k(r|j S|jdkrt|trx|jdkri|j |j k(rPt|j|j|jz|j|jz|j S|S)z+Optimize certain stacked wildcard patterns.Nrr)r) rrrrrrrr4r)r#rs rrzWildcardPattern.optimizes  LL $   "s4<<?';q'@a+J 88q=TXX]||#" 22%499 +G!**,, HHMj_E NNa DII$@":#5#5#'88JNN#:#'88JNN#:#-??4 4 rc(|j|g|S)z'Does this pattern exactly match a node?)rrs rrzWildcardPattern.matchs~~tfg..rc|j|D]L\}}|t|k(s|5|j||jrt |||j<yy)z4Does this pattern exactly match a sequence of nodes?TF)rrrrr5)r#rrrrs rrzWildcardPattern.match_seqsY))%0DAqCJ&NN1%yy-1%[ * 1rc #&K|jbt|jdtt||jzD](}i}|j r|d|||j <||f*y|j dk(r|j |yttdr#tj}tt_ |j|dD])\}}|j r|d|||j <||f+ ttdr t_ yy#t$r@|j|D])\}}|j r|d|||j <||f+YewxYw#ttdr t_ wwxYww)a" Generator yielding matches for a sequence of nodes. Args: nodes: sequence of nodes Yields: (count, results) tuples where: count: the match comprises nodes[:count]; results: dict containing named submatches. Nr bare_name getrefcountr)rrangerrrr_bare_name_matcheshasattrrkstderrr_recursive_matches RuntimeError_iterative_matches)r#rcountr save_stderrs rrz WildcardPattern.generate_matchessd << txxSUTXX-F)FG99#(%=AdiiLQh H YY+ %))%0 0 sM*!jj %Z  - $ 7 7q AHE1yy',Ve}$)) (N!B3 .!,CJ/  #!% 7 7 >HE1yy',Ve}$)) (N!? #3 .!,CJ/s=CF>D$E0F$AE-*E0,E--E00FFc#Kt|}d|jk\rdifg}|jD]/}t||D]\}}||f|j ||f 1|rg}|D]\}} ||ks ||j ks|jD]b}t|||dD]N\} } | dkDs i}|j | |j | || z|f|j || z|fPd|}|ryyw)z(Helper to iteratively yield the matches.rN)rrrrr8rr) r#rnodelenrrrr new_resultsc0r0c1r1s rrz"WildcardPattern._iterative_matchess e* =R%K<rs3  6n-6n-`k4k\L4L\2&S&Sl)*+)*X:+:zy)ky)x [ F%rPKz1]I*__pycache__/__main__.cpython-312.opt-1.pycnu[ {|jCHddlZddlmZejedy)N)mainz lib2to3.fixes)sysrexit)/usr/lib64/python3.12/lib2to3/__main__.pyr s o rPKz1]V "")__pycache__/patcomp.cpython-312.opt-2.pycnu[ {|j dZddlZddlmZmZmZmZmZmZddl m Z ddl m Z Gdde Z d ZGd d eZej"ej$ej&dd Zd ZdZdZy)z#Guido van Rossum N)driverliteralstokentokenizeparsegrammar)pytree)pygramc eZdZy)PatternSyntaxErrorN)__name__ __module__ __qualname__(/usr/lib64/python3.12/lib2to3/patcomp.pyr r srr c#K tjtjtjh}t j t j|j}|D]}|\}}}}}||vs|ywN) rNEWLINEINDENTDEDENTrgenerate_tokensioStringIOreadline) inputskiptokens quintupletypevaluestartend line_texts rtokenize_wrapperr&sg@ MM5<< 6D  % %bkk%&8&A&A BF -6*eUC t Os A4A>7A>c0eZdZddZddZdZddZdZy) PatternCompilerNc |+tj|_tj|_n>t j ||_tj|j|_tj|_ tj|_ t j|jt|_y)N)convert)r pattern_grammarr pattern_symbolssymsr load_grammarSymbolspython_grammar pygrammarpython_symbolspysymsDriverpattern_convert)self grammar_files r__init__zPatternCompiler.__init__(s   !11DL..DI!..|$A99A>c |j|jjk(r|jd}|j|jjk(rx|jdddDcgc]}|j |}}t |dk(r|dStj|Dcgc]}|gc}dd}|jS|j|jjk(rd|jDcgc]}|j |}}t |dk(r|dStj|gdd}|jS|j|jjk(rC|j|jdd}tj|}|jSd}|j} t | dk\r4| djtjk(r| dj }| dd} d} t | dk\r0| dj|jj"k(r | d} | dd} |j| | }| | j} | d} | jtj$k(rd} tj&}n| jtj(k(rd} tj&}nV| jtj*k(r9|j-| dx} }t | dk(r|j-| d}  dk7sdk7r*|j}tj|gg| }|||_|jScc}wcc}wcc}w)Nrrminmax)r!r-Matcherchildren Alternativesr>lenr WildcardPatternoptimize Alternative NegatedUnit compile_basicNegatedPatternrEQUALr"RepeaterSTARHUGEPLUSLBRACEget_intname)r6nodechaltsapunitspatternr\nodesrepeatrLchildrFrGs rr>zPatternCompiler.compile_nodeCs 99 )) )==#D 99 .. .48MM#A#4FG4FbD%%b)4FDG4yA~Aw&&T':TT':qIA::<  99 -- -59]]C]rT&&r*]EC5zQQx&&wA1=A::<  99 -- -((qr):;G%%g.A::<   u:?uQx}} ;8>>D!"IE u:?uRy~~1C1CC2YF#2JE$$UF3  HQKEzzUZZ'kkuzz)kku||+!LL!55cx=A%,,x{3Cax3!8!**, 007)#3O  GL!!sH(;Ds+M4+ M9M>c|d}|jtjk(rGtt j |j }tjt||S|jtjk(r|j }|jrB|tvrtd|z|ddr tdtjt|S|dk(rd}n8|jds't|j |d}|td|z|ddr#|j#|dj$dg}nd}tj&|S|j dk(r|j#|dS|j d k(r.|j#|d}tj(|ggdd Sy) NrzInvalid token: %rrzCan't have details for tokenany_zInvalid symbol: %r([rE)r!rSTRINGr=r evalStringr"r LeafPattern_type_of_literalNAMEisupper TOKEN_MAPr startswithgetattrr3r>rL NodePatternrO)r6rdrer]r"r!content subpatterns rrSzPatternCompiler.compile_basicsQx 99 $++DJJ78E%%&6u&=uE E YY%** $JJE}} ),-@5-HII9,-KLL)))E*:;;E>D))#."4;;trSr[rrrr(r(&s K +E"N!Frr()rprlNUMBERTOKENc|djrtjS|tjvrtj|Sy)Nr)isalpharrpr opmap)r"s rroros: Qxzz '-- }}U##rc |\}}}}|s||jvrtj|||Stj|||S)N)context) number2symbolr NodeLeaf)r raw_node_infor!r"rrLs rr5r5sIC%2"D%(47000{{47;;{{488rc4tj|Sr)r(rB)rcs rrBrBs   , ,W 55r) __author__rpgen2rrrrrr r r Exceptionr r&objectr(rprlrzrrror5rBrrrrsw3  ED  IfIZZZ||||  96rPKz1]1c[$__pycache__/refactor.cpython-312.pycnu[ {|jsk dZdZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZddlmZddlmZmZdd lmZdd ZGd d eZd ZdZdZdZdZGddeZGddeZ GddeZ!Gdde Z"y)zRefactoring framework. Used as a main program, this can refactor any number of files and/or recursively descend down directories. Imported as a module, this provides infrastructure to write your own refactoring tool. z#Guido van Rossum N)chain)drivertokenizetoken) find_root)pytreepygram) btm_matcherct|ggdg}g}tj|jD]0\}}}|j ds|r|dd}|j |2|S)zEReturn a sorted list of all available fix names in the given package.*fix_N) __import__pkgutil iter_modules__path__ startswithappend) fixer_pkg remove_prefixpkg fix_namesfindernameispkgs )/usr/lib64/python3.12/lib2to3/refactor.pyget_all_fix_namesrsj YB .CI&33CLLAe ??6 "ABx   T " B c eZdZy) _EveryNodeN__name__ __module__ __qualname__rrr!r!+rr!ct|tjtjfr|jt |jhSt|tj r'|jrt|jSt t|tjr>t}|jD]#}|D]}|jt|%|Std|z)zf Accepts a pytree Pattern Node and returns a set of the pattern types which will match first. z$Oh no! I don't understand pattern %s) isinstancer NodePattern LeafPatterntyper!NegatedPatterncontent_get_head_typesWildcardPatternsetupdate Exception)patrpxs rr/r//s#**F,>,>?@ 88  z#v,,- ;;"3;;/ /#v--. EA+, :SA BBrcXtjt}g}|D]|}|jr2 t |j}|D]}||j |A|j||jj |l|j |~ttjjjtjjD]}||j|t|S#t $r|j |Y wxYw)z^ Accepts a list of fixers and returns a dictionary of head node type --> fixer list. ) collections defaultdictlistpatternr/rr! _accept_typerr python_grammar symbol2numbervaluestokensextenddict) fixer_list head_nodeseveryfixerheads node_types r_get_headnode_dictrJKs((.J E == 8' 6"'Iy)007"'!!-5--.55e< U#600>>EEG!00779 9$$U+9   $ U# $sD  D)(D)cLt|dDcgc] }|dz|z c}Scc}w)zN Return the fully qualified names for fixers in the package pkg_name. F.)r)pkg_namefix_names rget_fixers_from_packagerOds= .h> @> sNX %> @@ @s!c|SNr&)objs r _identityrSks Jrc|d}tjtj|jfd}t t jtjt jh}t} |\}}||vr|t jk(r|rnd}n|t jk(r|dk(r|\}}|t jk7s|dk7rn|\}}|t jk7s|dk7rn|\}}|t jk(r|dk(r |\}}|t jk(rT|j||\}}|t jk7s|dk7rn |\}}|t jk(rRnnt |S#t$r Yt |SwxYw) NFc.t}|d|dfS)Nrr)next)tokgens radvancez(_detect_future_features..advancers3i1vs1v~rTfrom __future__import(,)rgenerate_tokensioStringIOreadline frozensetrNEWLINENLCOMMENTr1STRINGNAMEOPadd StopIteration)sourcehave_docstringrYignorefeaturestpvaluerXs @r_detect_future_featuresrrosN  " "2;;v#6#?#? @C x{{EMMB CFuH  IBV|u||#!!%uzz!evo#I E#u '<#I E#u'8#I E>esl ' IBEJJ&LL' ' IBUXX~# ' IB EJJ&38 X    X  s>DF%F%% F;:F;ceZdZdZy) FixerErrorzA fixer could not be loaded.N)r#r$r%__doc__r&rrrtrts&rrtceZdZddddZdZdZddZdZdZd Z d Z d Z dd Z dd Z dZddZdZd dZdZdZ d!dZd"dZdZdZdZdZdZdZdZdZy)#RefactoringToolF)print_function exec_functionwrite_unchanged_filesFixrNc||_|xsg|_|jj|_||jj |t jj|_|jdr|jjd=n&|jdr|jjd=|jjd|_ g|_ tjd|_g|_d|_t%j&|jt(j*|j |_|j-\|_|_g|_t5j6|_g|_g|_t?|j0|j.D]~}|j@r|j8jC|+||j.vr|j:jE|U||j0vsd|j<jE|tG|j:|_$tG|j<|_%y) zInitializer. Args: fixer_names: a list of fixers to import options: a dict with configuration. explicit: a list of fixers to run even if they are explicit. NrxprintryexecrzrwF)convertlogger)&fixersexplicit_default_optionscopyoptionsr2r r>grammarkeywordsgetrzerrorslogging getLoggerr fixer_logwroterDriverr r get_fixers pre_order post_orderfilesbm BottomMatcherBM bmi_pre_orderbmi_post_orderr BM_compatible add_fixerrrJbmi_pre_order_headsbmi_post_order_heads)self fixer_namesrrrGs r__init__zRefactoringTool.__init__s"  B ,,113   LL   (,,113 <<( ) %%g. \\/ * %%f- &*\\%5%56M%N" ''(9:  mmDLL,2NN+/;;8 +///*;' ""$ 4??DNN;E""!!%($..(""))%0$//)##**51<$6d6H6H#I $6t7J7J$K!rc g}g}|jD]w}t|iidg}|jddd}|j|jr|t |jd}|j d}|jdj|Dcgc]}|jc}z} t||} | |j|j} | jr0|jd ur"||jvr|j!d | |j#d || j$d k(r|j'| @| j$d k(r|j'| btd| j$zt)j*d} |j-| |j-| ||fScc}w#t$rtd|d|dwxYw)aInspects the options to load the requested patterns and handlers. Returns: (pre_order, post_order), where pre_order is the list of fixers that want a pre-order AST traversal, and post_order is the list that want post-order traversal. r rLrN_z Can't find TzSkipping optional fixer: %szAdding transformation: %sprepostzIllegal fixer order: %r run_orderkey)rrrsplitr FILE_PREFIXlensplit CLASS_PREFIXjointitlegetattrAttributeErrorrtrrr log_message log_debugorderroperator attrgettersort) rpre_order_fixerspost_order_fixers fix_mod_pathmodrNpartsr6 class_name fix_classrGkey_funcs rrzRefactoringTool.get_fixerss KKL\2rC59C#**3226H""4#3#34#C(8(8$9$:;NN3'E**RWW5OAaggi5O-PPJ X#C4 dllDNN;E~~$--t";  5  !>I NN6 A{{e# ''.&!((/ !:U[[!HII/(2&&{3(+8, "344-6P" X x!LMSWW XsG 8 GG*c)zCalled when an error occurs.r&)rmsgargskwdss r log_errorzRefactoringTool.log_errors rcH|r||z}|jj|y)zHook to log a message.N)rinforrrs rrzRefactoringTool.log_messages *C rcH|r||z}|jj|yrQ)rdebugrs rrzRefactoringTool.log_debug s *C #rcy)zTCalled with the old version, new version, and filename of a refactored file.Nr&)rold_textnew_textfilenameequals r print_outputzRefactoringTool.print_outputs rc|D]H}tjj|r|j|||6|j |||Jy)z)Refactor a list of files and directories.N)ospathisdir refactor_dir refactor_file)ritemswrite doctests_only dir_or_files rrefactorzRefactoringTool.refactorsB!Kww}}[)!!+umD"";}E !rctjdz}tj|D]\}}}|jd||j |j |D]m}|j drtj j|d|k(s;tj j||} |j| ||o|D cgc]} | j dr| c} |ddycc} w)zDescends down a directory and refactor every Python file found. Python files are assumed to have a .py extension. Files and subdirectories starting with '.' are skipped. pyzDescending into %srLrN) rextsepwalkrrrrsplitextrr) rdir_namerrpy_extdirpathdirnames filenamesrfullnamedns rrzRefactoringTool.refactor_dir sT!,.GGH,= (GXy NN/ 9 MMO NN !,GG$$T*1-7!ww||GT:H&&x F " )1K" c8J2KHQK->Ls C</C<c t|d} tj|j d}|j tj|d|d5}|j|fcdddS#t$r}|jd||Yd}~yd}~wwxYw#|j wxYw#1swYyxYw) zG Do our best to decode a Python source file correctly. rbzCan't open %s: %sNNNrr5rencodingnewline) openOSErrorrrdetect_encodingrbcloser`read)rrferrrs r_read_python_sourcez#RefactoringTool._read_python_source4s Xt$A // ;A>H GGI WWXsXr Ba668X%C B  NN.# >  GGI B Bs. A6"BB46 B?BBB14B=c|j|\}}|y|dz }|r^|jd||j||}|js||k7r|j |||||y|jd|y|j ||}|js|r.|j r"|j t|dd|||y|jd|y)zRefactors a file.N zRefactoring doctests in %szNo doctest changes in %sr)rrzNo changes in %s)rrrefactor_docstringrzprocessed_filerefactor_string was_changedstr)rrrrinputroutputtrees rrzRefactoringTool.refactor_fileDs228<x =     NN7 B,,UH=F))Vu_##FHeUHM98D''x8D))dt7G7G##CIcrNH*/($D18 "&,,DKK    #',,DKK s)B C*(C%C-%C**C--D ctjj}|rZ|jd|j |d}|j s||k7r|j |d|y|jdy|j|d}|j s|r)|jr|j t|d|y|jdy)NzRefactoring doctests in stdinzzNo doctest changes in stdinzNo changes in stdin) sysstdinrrrrzrrrr)rrrrrs rrefactor_stdinzRefactoringTool.refactor_stdinvs    NN: ;,,UI>F))Vu_##FIu=<=''y9D))dt7G7G##CIy%@45rct|j|jD]}|j|||j |j |j|j |j |j|jj|j}t|jr|jjD]}||vs ||s||jtjj d|j"r-||jtjj$t'||D]}|||vr||j)| t+||j.r||j.vrF|j1|}|sZ|j3||}|o|j5||jD]0}|j.sg|_|j.j7|2|jj|j}|D]"} | |vrg|| <|| j9|| $t|jrt|j|jD]}|j;|||j<S#t,$rYwxYw)aRefactors a parse tree (modifying the tree in place). For compatible patterns the bottom matcher module is used. Otherwise the tree is traversed node-to-node for matches. Args: tree: a pytree.Node instance representing the root of the tree to be refactored. name: a human-readable name for this tree. Returns: True if the tree was modified, False otherwise. T)rreverser)rrr start_tree traverse_byrrrrunleavesanyr@rrr Basedepthkeep_line_order get_linenor;remover ValueErrorfixers_appliedmatch transformreplacerrB finish_treer) rrrrG match_setnoderesultsnew new_matchesfxrs rrzRefactoringTool.refactor_treesv 4>>4??;E   T4 (< 114>>3CD 22DOO4EFGGKK . )""$%I%)E*:e$))fkk.?.?)N,,"%(--&++2H2H-I $Yu%5 69U#33%e,33D9%%dO  ..5D+>>@(;$($7$7$>$>u$E -=/3ggkk#**,.G +6C+.)+;79 #$-cN$9$9+c:J$K ,7A!7()""$%b4>>4??;E   dD )<E *%%%s K  K-,K-c|sy|D]R}||jD]>}|j|}|s|j||}|,|j||}@Ty)aTraverse an AST, applying a set of fixers to each node. This is a helper method for refactor_tree(). Args: fixers: a list of fixer instances. traversal: a generator that yields AST nodes. Returns: None N)r,rrr)rr traversalrrGrrs rr zRefactoringTool.traverse_bys^ D *++d+//$8C S)" +rc2|jj|||j|d}|y||k(}|j|||||r|j d||j sy|r|j ||||y|j d|y)zR Called when a file has been refactored and there may be changes. NrzNo changes to %szNot writing changes to %s)rrrrrrz write_file)rrrrrrrs rrzRefactoringTool.processed_files (#  //9!  NN-x 8--  OOHh( C NN6 Arc` tj|d|d}|5 |j |ddd|j d|d|_y#t$r}|jd||Yd}~yd}~wwxYw#t$r}|jd||Yd}~ld}~wwxYw#1swYuxYw) zWrites a string to a file. It first shows a unified diff between the old text and the new text, and then rewrites the file; the latter is only done if the write option is set. wrrzCan't create %s: %sNzCan't write %s: %szWrote changes to %sT)r`rrrrrr)rrrrrfprs rr$zRefactoringTool.write_files 32FB  D" ,h7   NN0(C @   D3XsCC DRsEAB$A; A8A33A8; B!BB$B!!B$$B-z>>> z... c g}d}d}d}d}|jdD] }|dz }|jj|jrK|#|j |j |||||}|g}|j |j} |d| }}|S|j||jzs#|||jjzdzk(r|j||#|j |j ||||d}d}|j||#|j |j ||||dj|S)aRefactors a docstring, looking for doctests. This returns a modified version of the input string. It looks for doctests, which start with a ">>>" prompt, and may be continued with "..." prompts, as long as the "..." is indented the same as the ">>>". (Unfortunately we can't use the doctest module's parser, since, like most parsers, it is not geared towards preserving the original source.) NrTkeependsrrr) splitlineslstriprPS1rBrefactor_doctestfindPS2rstriprr) rrrresultblock block_linenoindentlinenolineis rrz"RefactoringTool.refactor_docstringsg $$d$3D aKF{{}''1$MM$"7"7|8>#JK% IIdhh'bq$??6DHH#456DHHOO$55<< T"$MM$"7"7|8>#JK d#)4*   MM$//|06B Cwwvrc |j|||}|j||rt|jd}|d|dz ||dz d}} | dg|dz zk(sJ| |djds |dxxdz cc<||jz|j!d zg}|r#||Dcgc]}||j"z|zc}z }|S#t$r}|jjtj r(|D]#}|j d|jd%|jd|||jj||cYd}~Sd}~wwxYwcc}w) zRefactors one doctest. A doctest is given as a block of lines, the first of which starts with ">>>" (possibly indented), while the remaining lines start with "..." (identically indented). z Source: %srz+Can't parse docstring in %s line %s: %s: %sNTr)rrr) parse_blockr3r isEnabledForrDEBUGrr1rrr#rrr+endswithr-popr0) rr3r6r5rrrr7rclippeds rr.z RefactoringTool.refactor_doctestDsa ##E66:D   dH -d)&&&5Cyq>3vaxy>SGtfq11 :7 :1r7##D)B4dhh&34EsCst&488+d2sCC # {{'' 6!DNN<T1BC" NNH#VS]]-C-CS JL   Ds$C/E! EA;EEEcX|jrd}nd}|js|jd|n4|jd||jD]}|j||jr3|jd|jD]}|j||jr{t |jdk(r|jdn%|jdt |j|jD]\}}}|j|g|i|yy) Nwerez need to bezNo files %s modified.zFiles that %s modified:z$Warnings/messages while refactoring:rzThere was 1 error:zThere were %d errors:)rrrrrr)rrAfilemessagerrrs r summarizezRefactoringTool.summarizeas ::DDzz   4d ;   6 =   &# >>   C D>>  )* ;;4;;1$  !56  !8#dkk:JK#';;T4   4t4t4$/ rc||jj|j|||}t|_|S)zParses a block into a tree. This is necessary to get correct line number / offset information in the parser diagnostics and embedded into the parse tree. )r parse_tokens wrap_toksrcr)rr3r6r5rs rr:zRefactoringTool.parse_blockxs4 {{''uff(MN({ rc#Ktj|j||j}|D]+\}}\}}\} } } ||dz z }| |dz z } ||||f| | f| f-yw)z;Wraps a tokenize stream to systematically modify start/end.rN)rr_ gen_lines__next__) rr3r6r5rAr,rqline0col0line1col1 line_texts rrGzRefactoringTool.wrap_tokss}))$..*G*P*PQDJ @D%% y VaZ E VaZ E t}udmYF FEKsA!A#c#K||jz}||jz}|}|D]R}|j|r|t|dn,||j dzk(rdnt d|d||}T dw)zGenerates lines as expected by tokenize from a list of lines. This strips the first len(indent + self.PS1) characters off each line. Nrzline=z , prefix=r)r-r0rrr1AssertionError)rr3r5prefix1prefix2prefixr7s rrIzRefactoringTool.gen_liness 488#488#Dv&3v;<((4// $T6%JKKFHsA>Br)FF)F)NFNrQ)r#r$r%rrrrrrrrrrrrrrrrr rr$r-r0rr.rDr:rGrIr&rrrwrws+0).279LK3Ln&5P   FL(& =.66 M ^#.GL $B** C C)V:5. Grrwc eZdZy)MultiprocessingUnsupportedNr"r&rrrVrVr'rrVcBeZdZfdZ dfd ZfdZfdZxZS)MultiprocessRefactoringToolcHtt| |i|d|_d|_yrQ)superrXrqueue output_lockrrkwargsrs rrz$MultiprocessRefactoringTool.__init__s' )494J6J rc|dk(rtt| |||S ddl}|j td|j|_|j|_ t|Dcgc]}|j|j }} |D]}|jtt| ||||j jt|D]}|j j!d|D]#}|j#s|j%d|_y#t$rt wxYwcc}w#|j jt|D]}|j j!d|D]#}|j#s|j%d|_wxYw)Nrrz already doing multiple processes)target)rZrXrmultiprocessing ImportErrorrVr[ RuntimeError JoinableQueueLockr\rangeProcess_childstartrputis_alive) rrrr num_processesrar8 processesr6rs rrz$MultiprocessRefactoringTool.refactors A 4dDum- - - " :: !AB B$224 *//1#M242%,,DKK,@2 4   -t =eU>K M JJOO =) t$*::<FFHDJ) -, , - 4 JJOO =) t$*::<FFHDJs$D6/#E ,E6EAG*Gc|jj}|Q|\}} tt||i||jj |jj}|Pyy#|jj wxYwrQ)r[rrZrXr task_done)rtaskrr^rs rrhz"MultiprocessRefactoringTool._childszz~~LD& '14F%#% $$&::>>#D  $$&s A00B c~|j|jj||fytt||i|SrQ)r[rjrZrXrr]s rrz)MultiprocessRefactoringTool.refactor_filesA :: ! JJNND&> *4dI!! !r)FFr)r#r$r%rrrhr __classcell__)rs@rrXrXs$ :? : $!!rrX)T)#ru __author__r`rrrrrr9 itertoolsrpgen2rrr fixer_utilrrr r r rrr3r!r/rJrOrSrrrtobjectrwrVrXr&rrrxs3   +*!   C82@%P''FfFR  4!/4!rPKz1]))%%+__pycache__/btm_utils.cpython-312.opt-2.pycnu[ {|j& ddlmZddlmZmZddlmZmZeZeZ ejZ eZ dZ dZdZGddeZd d Zd Zd Zy ))pytree)grammartoken)pattern_symbolspython_symbolsc.eZdZ ddZdZdZdZdZy)MinNodeNcf||_||_g|_d|_d|_g|_g|_y)NF)typenamechildrenleafparent alternativesgroup)selfrrs */usr/lib64/python3.12/lib2to3/btm_utils.py__init__zMinNode.__init__s4      c^t|jdzt|jzS)N )strrr)rs r__repr__zMinNode.__repr__s"499~#c$))n44rcF |}g}|r|jtk(r|jj|t |jt |j k(r*t |jg}g|_|j}|j}d} |S|jtk(r|jj|t |jt |j k(r*t|j}g|_ |j}|j}d} |S|jtjk(r(|jr|j|jn|j|j|j}|r|SN)rTYPE_ALTERNATIVESrappendlenrtupler TYPE_GROUPrget_characteristic_subpattern token_labelsNAMEr)rnodesubps r leaf_to_rootzMinNode.leaf_to_root!sU 7yy--!!((.t(()S-??!$"3"345D(*D%;;D;;DD, )yyJ& !!$'tzz?c$--&888DD!#DJ;;D;;DD yyL---$)) DII& DII&;;DCD rc\ |jD]}|j}|s|cSyr)leavesr))rlr(s rget_linear_subpatternzMinNode.get_linear_subpatternKs- A>>#D rc#K |jD]}|jEd{|js|yy7wr)rr+)rchilds rr+zMinNode.leaves`s<7]]E||~ % %#}}J &s$A?A)NN)__name__ __module__ __qualname__rrr)r-r+rrr r s!5(T*rr Nc d}|jtjk(r|jd}|jtjk(rt |jdkrt |jd|}ntt}|jD]K}|jj|dzr"t ||}|1|jj|Mna|jtjk(rt |jdkDr\tt}|jD],}t ||}|s|jj|.|jsd}nt |jd|}n|jtjk(rt|jdtj r5|jdj"dk(rt |jd|St|jdtj r|jdj"dk(sMt |jdkDr6t%|jddr|jdj"dk(ryd}d}d}d }d} d } |jD]}|jtj&k(rd }|}nA|jtj(k(rd}|} n|jtjk(r|}t%|dss|j"d k(sd} | r:|jd} t%| dr.| j"dk(r|jd } n|jd} | jt*j,k(r| j"d k(rtt.}nt%t*| j"r%tt1t*| j"}ntt1t2| j"}n| jt*j4k(rS| j"j7d } | t8vrtt8| }nEtt*j,| }n)| jtjk(r t ||}|rB| jdj"dk(rd}n#| jdj"dk(rnt:|r@|>|jddD],}t ||}||jj|.|r||_|S)N)rr([valueTF=any')rr*+r)rsymsMatcherr Alternativesr! reduce_treer rindexr Alternativer#Unit isinstancerLeafr9hasattrDetailsRepeaterr%r&TYPE_ANYgetattrpysymsSTRINGstriptokensNotImplementedErrorr) r'rnew_noder/reducedr details_nodealternatives_node has_repeater repeater_nodehas_variable_name name_leafrs rrCrCgsNH yyDLL }}Q yyD%%% t}}  ""4==#3V>\.. .%'"1<9&GL)//,RSH&GFIOO,LMH ^^|22 2??((-Dv~"t 5" (9(9E ^^t00 0"#4f=H %%a(..#5''*00C7*) H0%..q4%eX6&%%,,W5 5   Orc t|ts|St|dk(r|dSg}g}gdg}d|D]~}tt |dstt |fdr|j |Dtt |fdr|j |n|j ||r|}n |r|}n|r|}t |tS) Nrr5)inforifnotNonez[]().,:c$t|tuSr)rr)xs rz/get_characteristic_subpattern..s d1gnrc0t|txr|vSrrGr)rb common_charss rrcz/get_characteristic_subpattern..sjC&8&NQ,=N&Nrc0t|txr|vSrre)rb common_namess rrcz/get_characteristic_subpattern..s 1c(:(PqL?P(Pr)key)rGlistr!r<rec_testr max) subpatternssubpatterns_with_namessubpatterns_with_common_namessubpatterns_with_common_chars subpatternrfrhs @@rr$r$s k4 ( ;1~ $&!6L$&!L! x $<= >8JNPQ-44Z@XjPRS-44Z@'--j9", &3 &3 { $$rc#K |D]7}t|ttfrt||Ed{.||9y7wr)rGrjr"rk)sequence test_funcrbs rrkrks@  a$ '9- - -A,   -s,AAAr)rpgen2rrpygramrrr@rNopmaprQr%rLrr#objectr rCr$rkr3rrrzsZ2!3     UfUnBJ#%JrPKz1]5+HMHM,__pycache__/fixer_util.cpython-312.opt-2.pycnu[ {|jf; ddlmZddlmZmZddlmZddlm Z dZ dZ dZ dZ d,d Zd Zd Zd Ze e fdZd-dZdZdZd,dZdZd,dZd,dZdZdZdZdZdZhdZdZ da!da"da#d a$d!Z%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,ejZej\hZ/d,d)Z0ej\ejZejbhZ2d*Z3d,d+Z4y ).)token)LeafNode)python_symbols)patcompclttj|ttj d|gS)N=)rsymsargumentrrEQUAL)keywordvalues +/usr/lib64/python3.12/lib2to3/fixer_util.py KeywordArgrs*  $u{{C0%8 ::c6ttjdS)N()rrLPARrrLParenr  C  rc6ttjdS)N))rrRPARrrrRParenrrrc  t|ts|g}t|ts d|_|g}ttj |t tjddgz|zS)N r prefix) isinstancelistrrr atomrrr )targetsources rAssignr%s`' fd # fd #   $u{{C<==F HHrNc< ttj||SNr)rrNAME)namers rNamer*$s  D 00rcP |ttjt|ggSN)rr trailerDot)objattrs rAttrr1(s!# dllSUDM2 33rc8 ttjdS)N,)rrCOMMArrrCommar5,s  S !!rc8 ttjdS)N.)rrDOTrrrr.r.0s  3 rc ttj|j|jg}|r*|j dttj ||S)Nr)rr r-clone insert_childarglist)argslparenrparennodes rArgListrA4sI7  v||~v||~> ?D  !T$,,56 Krcd ttj|t|g}|||_|Sr,)rr powerrAr) func_namer=rr@s rCallrE;s0  Y 6 7D  Krc8 ttjdS)N rrNEWLINErrrNewlinerJBs  t $$rc8 ttjdS)NrHrrr BlankLinerMFs  r ""rc:ttj||Sr')rrNUMBER)nrs rNumberrQJs  a //rc  ttjttj d|ttj dgS)N[])rr r-rrLBRACERBRACE) index_nodes r SubscriptrXMs;'  tELL#6)#ELL#68 99rc< ttj||Sr')rrSTRING)stringrs rStringr\Ss  fV 44rc j d|_d|_d|_ttjd}d|_ttjd}d|_||||g}|rSd|_ttjd}d|_|j t t j||gt t j|t t j|g}t t jttjd|ttjdgS)NrLrforinifrSrT) rrrr(appendrr comp_if listmakercomp_forr"rUrV) xpfpittestfor_leafin_leaf inner_argsif_leafinners rListComprnWsBIBIBIEJJ&HHO5::t$GGNB,J  uzz4($t||gt_=> "d4==*&E!F GE  U\\3/U\\3/1 22rc> |D]}|jttjdttj|dttjddt t j |g}t t j|}|S)Nfromrrimport)removerrr(rr import_as_names import_from) package_name name_leafsleafchildrenimps r FromImportrzos|* UZZ(UZZc:UZZ#6T)):68H t *C Jrc P |dj}|jtjk(r|j}n)t tj|jg}|d}|r|Dcgc]}|j}}t tj t t|dt|dt tj|dj||djggz|z}|j|_ |Scc}w)Nr/afterrlparrpar) r:typer r<rrCr1r*r-r)r@resultsnamesr/ newarglistr|rPnews r ImportAndCallrs %.   C xx4<<YY[ $,, 6 G E $)*EqE* tzzDqNDqN3T\\fo++- fo++-/01149 9 :C CJ J+s7D#c t|tr"|jtt gk(ryt|txrt |jdk(xrt|jdt xrxt|jdtxrYt|jdt xr:|jdjdk(xr|jdjdk(S)NTr}rrr)r rrxrrlenrrr@s ris_tuplers2$$--FHfh3G"G tT " .DMM"a' .4==+T2 .4==+T2 .4==+T2  .  a &&#-  .  a &&#- /rcL t|txrt|jdkDxrxt|jdtxrYt|jdtxr:|jdj dk(xr|jdj dk(S)Nrr}rSrT)r rrrxrrrs ris_listrs1 tT " /DMM"Q& /4==+T2 /4==,d3 / a &&#-  /  b!''3. 0rc\ttjt|t gSr,)rr r"rrrs r parenthesizers  FHdFH5 66r> allanymaxminsetsumr!tuplesorted enumeratec#RK t||}|r|t||}|ryywr,)getattr)r/r0nexts r attr_chainrs2  3 D  tT" s"''zefor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > z power< ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | 'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) ) trailer< '(' node=any ')' > any* > z` power< ( 'sorted' | 'enumerate' ) trailer< '(' arglist ')' > any* > FcF tsMtjtatjtatjt adattt g}t |t|dD]#\}}i}|j||s|d|us#yy)NTparentr@F) pats_builtrcompile_patternp0p1p2ziprmatch)r@patternspatternrrs rin_special_contextrs   $ $R (  $ $R (  $ $R ( B|HxD()CD == )gfo.EE rc |j}||jtjk(ry|j}|jt j t jfvry|jt jk(r|jd|ury|jt jk(sM|jt jk(r1||jtjk(s|jd|uryy)NFr}T) prev_siblingrrr8rr funcdefclassdef expr_stmtrx parameters typedargslistr4)r@prevrs ris_probably_builtinrs   D DII2 [[F {{t||T]]33 {{dnn$);t)C {{doo% [[D.. .  $))u{{": OOA $ & rc |||jtjk(rPt|jdkDr8|jd}|jt j k(r |jS|j}||y)NrrrL) rr suiterrxrINDENTrr)r@indents rfind_indentationrsi)   99 "s4=='9A'=]]1%F{{ell*||#{{   rc|jtjk(r|S|j}|jdc}|_t tj|g}||_|Sr,)rr rr:rr)r@rrs r make_suitersR yyDJJ ::\}}||st|j|dD]\}}||rn||z}n|dk(ryt|jD]a\}}|jt j k(s$|js1|jdjtjk(s\|dz}n|Ott jttjdttj|dg} n't|ttj|dg} | tg} |j|tt j | y)Nc|jtjk(xr&|jxrt |jdS)Nr})rr simple_stmtrxrrs ris_import_stmtz$touch_import..is_import_stmt>s: T---,$--,$--*+ -rr}rrqrr)rrrrxrr rrrZrrrr(rzrJr;) rr)r@rroot insert_posoffsetidxnode2import_rxs r touch_importr;sm$- T?Dt,Jt}}- Td# &t}}ST':;MFE!%(<6\  .Q"4==1IC T---$--}}Q$$ 4 1W  2 t'' X & T# .*   WtEJJS'I&JK#Hj$t'7'7"BCrc  |jD]<}d}|jtjk(rGt ||jdr|cSt |t |jd|}|r|}n|jtjtjfvr*t |t |jd|}|rh|}nd|jtjk(rt |t |jd|}|r|}nt|jddD]^\}}|jtjk(s$|jdk(s4t |t |j|dz|}|s]|}`n|jtvr|jdj|k(r|}nst|||r|}nc|jtj k(rt |||}n8|jtj"k(rt ||jdr|}|s(|s|cSt%|s;|cSy)Nrrrr:r})rxrr for_stmt_findrrif_stmt while_stmttry_stmtrrCOLONr _def_syms_is_import_bindingrrr)r)r@rchildretrPikids rrris( :: &T5>>!,- T:ennR.@#A7KA# ZZDLL$//: :T:ennR.@#A7KA# ZZ4== (T:ennQ.?#@'JA'qr(:;FAsxx5;;.3993C(z%..1:M/NPWXAc < ZZ9 $):)@)@D)HC tW 5C ZZ4++ +tUG4C ZZ4>> )T5>>!,-  ~ EF rc |g}|r~|j}|jdkDr.|jtvr|j|jn.|jt j k(r|j|k(r|S|r~y)N)popr _block_symsextendrxrr(r)r)r@nodess rrrsg FE yy{ 99s?tyy ; LL ' YY%** $t);K  rc. |jtjk(r9|s6|jd}|jtjk(r|jD]q}|jtj k(r!|jdj |k(s=|cS|jtjk(s_|j |k(so|cSy|jtj k(r=|jd}|jtjk(r?|j |k(r0|S|jtjk(r|j |k(r|Sy|jtjk(r|r*t|jdj|k7ry|jd}|r td|ry|jtjk(rt||r|S|jtjk(r>|jd}|jtjk(r|j |k(r|Sy|jtjk(r|j |k(r|S|r|jtjk(r|Sy)Nrrrras)rr rrxdotted_as_namesdotted_as_namerrr(rtstrstriprrsimport_as_nameSTAR)r@r)rryrlastrPs rrrs) yyD$$$WmmA 88t++ +::!4!44~~a(..$6# ZZ5::-%++2EK &> 3XX,, ,<<#DyyEJJ&4::+= XX # T(9K( ' d&& & s4==+,224? MM!  uT1~ VVt++ +dAK VVt** *JJqMEzzUZZ'EKK4,?  VVuzz !aggoK 5::-K rr,)NN)5pgen2rpytreerrpygramrr rLrrrrr%r*r1r5r.rArErJrMrQrXr\rnrzrrrrconsuming_callsrrrrrrrrrrrrrrrrrr-rrrrrrrs7*:!! H14"  &(%#09 520&8 /07.#&  &.=*DZ]]DLL ) (T||T]]DLL9 'rPKz1]p;&&#__pycache__/patcomp.cpython-312.pycnu[ {|jdZdZddlZddlmZmZmZmZmZm Z ddl m Z ddl m Z Gdd e Zd ZGd d eZej$ej&ej(dd ZdZdZdZy)zPattern compiler. The grammar is taken from PatternGrammar.txt. The compiler compiles a pattern to a pytree.*Pattern instance. z#Guido van Rossum N)driverliteralstokentokenizeparsegrammar)pytree)pygramc eZdZy)PatternSyntaxErrorN)__name__ __module__ __qualname__(/usr/lib64/python3.12/lib2to3/patcomp.pyr r srr c#Ktjtjtjh}t j t j|j}|D]}|\}}}}}||vs|yw)z6Tokenizes a string suppressing significant whitespace.N) rNEWLINEINDENTDEDENTrgenerate_tokensioStringIOreadline) inputskiptokens quintupletypevaluestartend line_texts rtokenize_wrapperr%sd MM5<< 6D  % %bkk%&8&A&A BF -6*eUC t Os A3A=6A=c0eZdZddZddZdZddZdZy) PatternCompilerNc|+tj|_tj|_n>t j ||_tj|j|_tj|_ tj|_ t j|jt|_y)z^Initializer. Takes an optional alternative filename for the pattern grammar. N)convert)r pattern_grammarr pattern_symbolssymsr load_grammarSymbolspython_grammar pygrammarpython_symbolspysymsDriverpattern_convert)self grammar_files r__init__zPatternCompiler.__init__(sz  !11DL..DI!..|>D!"IE u:?uRy~~1C1CC2YF#2JE$$UF3  ;;$))"4"44 44HQKEzzUZZ'kkuzz)kku||+|((ELL888H /// LL!55cx=A%,,x{3Cuax3!8!**, 007)#3O  GL!!sH(;Ds*O1* O6?O;ct|dk\sJ|d}|jtjk(rGt t j |j}tjt||S|jtjk(r|j}|jrB|tvrtd|z|ddr tdtjt|S|dk(rd}n8|jds't!|j"|d}|td|z|ddr#|j%|dj&dg}nd}tj(|S|jdk(r|j%|dS|jd k(r2|J|j%|d}tj*|ggdd SJ|) NrrzInvalid token: %rzCan't have details for tokenany_zInvalid symbol: %r([rD)rMr rSTRINGr<r evalStringr!r LeafPattern_type_of_literalNAMEisupper TOKEN_MAPr startswithgetattrr2r=rK NodePatternrN)r5rerfr^r!r content subpatterns rrRzPatternCompiler.compile_basics5zQQx 99 $++DJJ78E%%&6u&=uE E YY%** $JJE}} ),-@5-HII9,-KLL)))E*:;;E>D))#."4;;t !>**584J))J<.aQG Gdurcj|jtjk(sJt|jSN)r rNUMBERintr!)r5r^s rr\zPatternCompiler.get_ints&yyELL(((4::rrz)FF)rrrr7rAr=rRr\rrrr'r'&s K +E"N!Frr')rqrmr{TOKENc|djrtjS|tjvrtj|Sy)Nr)isalpharrqr opmap)r!s rrprps: Qxzz '-- }}U##rc|\}}}}|s||jvrtj|||Stj|||S)z9Converts raw node information to a Node or Leaf instance.)context) number2symbolr NodeLeaf)r raw_node_infor r!rrKs rr4r4sF%2"D%(47000{{47;;{{488rc4tj|Srz)r'rA)rds rrArAs   , ,W 55r)__doc__ __author__rpgen2rrrrrr r r Exceptionr r%objectr'rqrmr{rsrpr4rArrrrsw3  ED  IfIZZZ||||  96rPKz1]2'66&__pycache__/main.cpython-312.opt-1.pycnu[ {|jN.dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl m Z dZ Gdde jZd Zd d Zy) z Main program for 2to3. )with_statementprint_functionN)refactorc z|j}|j}tj||||dddS)z%Return a unified diff of two strings.z (original)z (refactored))lineterm) splitlinesdifflib unified_diff)abfilenames %/usr/lib64/python3.12/lib2to3/main.py diff_textsrs; A A   1h ,n)+ --c<eZdZdZ dfd ZdZfdZdZxZS)StdoutRefactoringToola2 A refactoring tool that can avoid overwriting its input files. Prints output to stdout. Output files can optionally be written to a different directory and or have an extra file suffix appended to their name for use in situations where you do not want to replace the input files. c ||_||_|r2|jtjs|tjz }||_||_||_tt|+|||y)aF Args: fixers: A list of fixers to import. options: A dict with RefactoringTool configuration. explicit: A list of fixers to run even if they are explicit. nobackups: If true no backup '.bak' files will be created for those files that are being refactored. show_diffs: Should diffs of the refactoring be printed to stdout? input_base_dir: The base directory for all input files. This class will strip this path prefix off of filenames before substituting it with output_dir. Only meaningful if output_dir is supplied. All files processed by refactor() must start with this path. output_dir: If supplied, all converted files will be written into this directory tree instead of input_base_dir. append_suffix: If supplied, all files output by this tool will have this appended to their filename. Useful for changing .py to .py3 for example by passing append_suffix='3'. N) nobackups show_diffsendswithossep_input_base_dir _output_dir_append_suffixsuperr__init__) selffixersoptionsexplicitrrinput_base_dir output_dir append_suffix __class__s rrzStdoutRefactoringTool.__init__$sa(#$ ."9"9"&&"A bff $N-%+ #T3FGXNrc|jj|||f|jj|g|i|yN)errorsappendloggererror)r msgargskwargss r log_errorzStdoutRefactoringTool.log_errorAs9 Cv./ #///rc|}|jrw|j|jrAtjj |j|t |jd}ntd|d|j|jr||jz }||k7rhtjj|}tjj|s|rtj||jd|||jsQ|dz}tjj|r tj| tj"||t$t&|R}||||||jst+j,|||k7rt+j,||yy#t $r|jd|YwxYw#t $r|jd||YwxYw)Nz filename z( does not start with the input_base_dir zWriting converted %s to %s.z.bakzCan't remove backup %szCan't rename %s to %s)r startswithrrpathjoinlen ValueErrorrdirnameisdirmakedirs log_messagerlexistsremoveOSErrorrenamerr write_fileshutilcopymode) r new_textrold_textencoding orig_filenamer%backupwriter's rr@z StdoutRefactoringTool.write_fileEs   ""4#7#7877<<(8(8(0T5I5I1J1K(LN!)143G3G"IJJ    ++ +H H $2J77==, J'   :M% '~~&Fwwv&GIIf% L (F++T= h(H5~~ OOFH - H $ OOM8 4 %G$$%=vFG L  !8(FK Ls$GG%G"!G"%HHc|r|jd|y|jd||jrst|||} |jF|j5|D] }t |t j jdddy|D] }t |yy#1swYyxYw#t$rtd|dYywxYw)NzNo changes to %sz Refactored %szcouldn't encode z's diff for your terminal) r;rr output_lockprintsysstdoutflushUnicodeEncodeErrorwarn)r oldnewrequal diff_lineslines r print_outputz"StdoutRefactoringTool.print_outputls    / :   _h 7'S(;  ''3!--(2 %d )3JJ,,..- %/D!$K%/.-*"%&s6B41B( B4B4(B1-B41B44CC)rrr) __name__ __module__ __qualname____doc__rr1r@rV __classcell__)r's@rrrs%BDO:0%5Nrrc@td|tjy)Nz WARNING: file)rKrLstderr)r.s rrPrPs 3 szz2rc  tjd}|jdddd|jdd d gd |jd ddddd|jddd gd |jdddd|jdddd|jdddd|jd d!dd"|jd#dd$|jd%d&dd'|jd(d)dd*d+ |jd,d-dd.d/d01|jd2d3dd4|jd5dd.d/d61d*}i}|j|\}}|jr#d7|d8<|j s t d9d7|_|jr|js|jd:|jr|js|jd;|j s|jr t d<|j s|jr|jd=|jr3td>tjD] }t||sy?|s7td@t j"AtdBt j"AyCdD|vr*d7}|j rtdEt j"AyC|j$rd7|dF<|j&rd7|dG<|j(rt*j,nt*j.}t+j0dH|It+j2dJ}t5tj6} t5fdK|j8D} t5} |j:rHd*} |j:D]!} | dLk(rd7} | j=dMz| z#| r| j?| n| }n| j?| }|jA| }tBjDjG|}|r]|jItBjJs>tBjDjM|stBjDjO|}|jr<|jQtBjJ}|jSdN|j|tUtW||tW| |j|j ||j|jO}|jXsV|r|j[n3 |j||j |j\|j^|jctetg|jXS#tj`$rtdPt j"AYywxYw)QzMain program. Args: fixer_pkg: the name of a package where the fixers are located. args: optional; a list of command line arguments. If omitted, sys.argv[1:] is used. Returns a suggested exit status (0, 1, 2). z2to3 [options] file|dir ...)usagez-dz--doctests_only store_truezFix up doctests only)actionhelpz-fz--fixr+z1Each FIX specifies a transformation; default: all)rcdefaultrdz-jz --processesstorerintzRun 2to3 concurrently)rcretyperdz-xz--nofixz'Prevent a transformation from being runz-lz --list-fixeszList available transformationsz-pz--print-functionz0Modify the grammar so that print() is a functionz-ez--exec-functionz/Modify the grammar so that exec() is a functionz-vz --verbosezMore verbose loggingz --no-diffsz#Don't show diffs of the refactoringz-wz--writezWrite back modified filesz-nz --nobackupsFz&Don't write backups for modified filesz-oz --output-dirstrrzXPut output files in this directory instead of overwriting the input files. Requires -n.)rcrhrerdz-Wz--write-unchanged-fileszYAlso write files even if no changes were required (useful with --output-dir); implies -w.z --add-suffixzuAppend this string to all output filenames. Requires -n if non-empty. ex: --add-suffix='3' will generate .py3 files.Twrite_unchanged_filesz&--write-unchanged-files/-W implies -w.z%Can't use --output-dir/-o without -n.z"Can't use --add-suffix without -n.z@not writing files and not printing diffs; that's not very usefulzCan't use -n without -wz2Available transformations for the -f/--fix option:rz1At least one file or directory argument required.r]zUse --help to show usage.-zCan't write to stdin.r exec_functionz%(name)s: %(message)s)formatlevelz lib2to3.mainc3.K|] }dz|zyw).fix_N).0fix fixer_pkgs r zmain..sLmsW,s2msallrqz7Output in %r will mirror the input directory %r layout.)r$r%r&z+Sorry, -j isn't supported on this platform.)4optparse OptionParser add_option parse_argsrjrHrPr%rr- add_suffixno_diffs list_fixesrKrget_all_fix_namesrLr_rrmverboseloggingDEBUGINFO basicConfig getLoggersetget_fixers_from_packagenofixrtaddunion differencerr4 commonprefixrrr9r8rstripinforsortedr*refactor_stdin doctests_only processesMultiprocessingUnsupported summarizergbool)rur/parserrflagsr"fixnameror, avail_fixesunwanted_fixesr# all_presentrt requested fixer_namesr$rts` rmainrs[ " ")F GF d-l13 dGHbNP dM'1 '>@ dIhDF dN<;= d.|MO d-lLN dK 13 l<@B dIl68 dM,CE dN7 (NO d5lAB nW5"GH N E%%d+MGT$$)-%&}} 9 : '"3"3 <='"3"3 9: ==W-- OP ==W.. ./ BC11) n-8'..rvv6 M&& 8  ; x(8   7#3#33)))!,,  .B 99       D'--1F1F#--/  tBII 66 C::'  s:2V.W  W r))rZ __future__rrrLrr rrArxrrrMultiprocessRefactoringToolrrPrrrrrrsI6  -eH@@eN3L rPKz1]'__pycache__/btm_matcher.cpython-312.pycnu[ {|jvdZdZddlZddlZddlmZddlmZddlm Z Gdd e Z Gd d e Z ia d Zy) aA bottom-up tree matching algorithm implementation meant to speed up 2to3's matching process. After the tree patterns are reduced to their rarest linear path, a linear Aho-Corasick automaton is created. The linear automaton traverses the linear paths from the leaves to the root of the AST and returns a set of nodes for further matching. This reduces significantly the number of candidate nodes.z+George Boutsioukis N) defaultdict)pytree) reduce_treec8eZdZdZej ZdZy)BMNodez?Class for a node of the Aho-Corasick automaton used in matchingcji|_g|_ttj|_d|_y)N)transition_tablefixersnextrcountidcontentselfs ,/usr/lib64/python3.12/lib2to3/btm_matcher.py__init__zBMNode.__init__s( " v||$ N)__name__ __module__ __qualname____doc__ itertoolsrrrrrrsI IOO Errc.eZdZdZdZdZdZdZdZy) BottomMatcherzgThe main matcher class. After instantiating the patterns should be added using the add_fixer methodct|_t|_|jg|_g|_t jd|_y)NRefactoringTool) setmatchrrootnodesr logging getLoggerloggerrs rrzBottomMatcher.__init__s;U H ii[  ''(9: rc|jj|t|j}|j }|j ||j }|D]}|jj|y)zReduces a fixer's pattern tree to a linear path and adds it to the matcher(a common Aho-Corasick automaton). The fixer is appended on the matching states and called when they are reachedstartN)r appendr pattern_treeget_linear_subpatternaddr")rfixertreelinear match_nodes match_nodes r add_fixerzBottomMatcher.add_fixer%sh 5!5--.++-hhvTYYh7 %J    $ $U +&rc |s|gSt|dtrLg}|dD]@}|j||}|D]&}|j|j|dd|(B|S|d|jvrt }||j|d<n|j|d}|ddr|j|dd|}|S|g}|S)z5Recursively adds a linear pattern to the AC automatonrr(rN) isinstancetupler-extendr r)rpatternr)r1 alternative end_nodesend next_nodes rr-zBottomMatcher.add1s7N gaj% (K&qz !HH[H> $C&&txx S'AB% *  qz!7!77"H 5>&&wqz2"2271:> qr{ HHWQR[ HB  'K  rc|j}tt}|D]?}|}|s d|_|jD]5}t |t js|jdk(s.d|_n|jdk(r |j}n |j}||jvr5|j|}|jD]}||j|nq|j}|j|jjr||jvr4|j|}|jD]}||j||j}|r7B|S)auThe main interface with the bottom matcher. The tree is traversed from the bottom using the constructed automaton. Nodes are only checked once as the tree is retraversed. When the automaton fails, we give it one more shot(in case the above tree matches as a whole with the rejected leaf), then we break for the next leaf. There is the special case of multiple arguments(see code comments) where we recheck the nodes Args: The leaves of the AST tree to be matched Returns: A dictionary of node matches with fixers as the keys T;Fr)r"rlist was_checkedchildrenr5rLeafvaluetyper r r*parent) rleavescurrent_ac_noderesultsleafcurrent_ast_nodechild node_tokenr.s rrunzBottomMatcher.runSsW ))d#D# "/3 ,-66E!%5%++:L7<(4 7 $((A-!1!7!7J!1!6!6J!A!AA&5&F&Fz&RO!0!7!7--.>?"8'+iiO(//;,33??"_%E%EE*9*J*J:*V%4%;%;E#EN112BC&<$4#:#: C#Hrc`tdfd|jtdy)z %d [label=%s] //%sr)r keysprintr type_reprstrr r)node subnode_keysubnode print_nodes rrWz*BottomMatcher.print_ac..print_nodes|#4499; // <0ww Ik,BCDWXYZ!#'//*7# risHG; #"V}F}@ 6rPKz1]RUυυ*__pycache__/refactor.cpython-312.opt-1.pycnu[ {|jsk dZdZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZddlmZddlmZmZdd lmZdd ZGd d eZd ZdZdZdZdZGddeZGddeZ GddeZ!Gdde Z"y)zRefactoring framework. Used as a main program, this can refactor any number of files and/or recursively descend down directories. Imported as a module, this provides infrastructure to write your own refactoring tool. z#Guido van Rossum N)chain)drivertokenizetoken) find_root)pytreepygram) btm_matcherct|ggdg}g}tj|jD]0\}}}|j ds|r|dd}|j |2|S)zEReturn a sorted list of all available fix names in the given package.*fix_N) __import__pkgutil iter_modules__path__ startswithappend) fixer_pkg remove_prefixpkg fix_namesfindernameispkgs )/usr/lib64/python3.12/lib2to3/refactor.pyget_all_fix_namesrsj YB .CI&33CLLAe ??6 "ABx   T " B c eZdZy) _EveryNodeN__name__ __module__ __qualname__rrr!r!+rr!ct|tjtjfr|jt |jhSt|tj r'|jrt|jSt t|tjr>t}|jD]#}|D]}|jt|%|Std|z)zf Accepts a pytree Pattern Node and returns a set of the pattern types which will match first. z$Oh no! I don't understand pattern %s) isinstancer NodePattern LeafPatterntyper!NegatedPatterncontent_get_head_typesWildcardPatternsetupdate Exception)patrpxs rr/r//s#**F,>,>?@ 88  z#v,,- ;;"3;;/ /#v--. EA+, :SA BBrcXtjt}g}|D]|}|jr2 t |j}|D]}||j |A|j||jj |l|j |~ttjjjtjjD]}||j|t|S#t $r|j |Y wxYw)z^ Accepts a list of fixers and returns a dictionary of head node type --> fixer list. ) collections defaultdictlistpatternr/rr! _accept_typerr python_grammar symbol2numbervaluestokensextenddict) fixer_list head_nodeseveryfixerheads node_types r_get_headnode_dictrJKs((.J E == 8' 6"'Iy)007"'!!-5--.55e< U#600>>EEG!00779 9$$U+9   $ U# $sD  D)(D)cLt|dDcgc] }|dz|z c}Scc}w)zN Return the fully qualified names for fixers in the package pkg_name. F.)r)pkg_namefix_names rget_fixers_from_packagerOds= .h> @> sNX %> @@ @s!c|SNr&)objs r _identityrSks Jrc|d}tjtj|jfd}t t jtjt jh}t} |\}}||vr|t jk(r|rnd}n|t jk(r|dk(r|\}}|t jk7s|dk7rn|\}}|t jk7s|dk7rn|\}}|t jk(r|dk(r |\}}|t jk(rT|j||\}}|t jk7s|dk7rn |\}}|t jk(rRnnt |S#t$r Yt |SwxYw) NFc.t}|d|dfS)Nrr)next)tokgens radvancez(_detect_future_features..advancers3i1vs1v~rTfrom __future__import(,)rgenerate_tokensioStringIOreadline frozensetrNEWLINENLCOMMENTr1STRINGNAMEOPadd StopIteration)sourcehave_docstringrYignorefeaturestpvaluerXs @r_detect_future_featuresrrosN  " "2;;v#6#?#? @C x{{EMMB CFuH  IBV|u||#!!%uzz!evo#I E#u '<#I E#u'8#I E>esl ' IBEJJ&LL' ' IBUXX~# ' IB EJJ&38 X    X  s>DF%F%% F;:F;ceZdZdZy) FixerErrorzA fixer could not be loaded.N)r#r$r%__doc__r&rrrtrts&rrtceZdZddddZdZdZddZdZdZd Z d Z d Z dd Z dd Z dZddZdZd dZdZdZ d!dZd"dZdZdZdZdZdZdZdZdZy)#RefactoringToolF)print_function exec_functionwrite_unchanged_filesFixrNc||_|xsg|_|jj|_||jj |t jj|_|jdr|jjd=n&|jdr|jjd=|jjd|_ g|_ tjd|_g|_d|_t%j&|jt(j*|j |_|j-\|_|_g|_t5j6|_g|_g|_t?|j0|j.D]~}|j@r|j8jC|+||j.vr|j:jE|U||j0vsd|j<jE|tG|j:|_$tG|j<|_%y) zInitializer. Args: fixer_names: a list of fixers to import options: a dict with configuration. explicit: a list of fixers to run even if they are explicit. NrxprintryexecrzrwF)convertlogger)&fixersexplicit_default_optionscopyoptionsr2r r>grammarkeywordsgetrzerrorslogging getLoggerr fixer_logwroterDriverr r get_fixers pre_order post_orderfilesbm BottomMatcherBM bmi_pre_orderbmi_post_orderr BM_compatible add_fixerrrJbmi_pre_order_headsbmi_post_order_heads)self fixer_namesrrrGs r__init__zRefactoringTool.__init__s"  B ,,113   LL   (,,113 <<( ) %%g. \\/ * %%f- &*\\%5%56M%N" ''(9:  mmDLL,2NN+/;;8 +///*;' ""$ 4??DNN;E""!!%($..(""))%0$//)##**51<$6d6H6H#I $6t7J7J$K!rc g}g}|jD]w}t|iidg}|jddd}|j|jr|t |jd}|j d}|jdj|Dcgc]}|jc}z} t||} | |j|j} | jr0|jd ur"||jvr|j!d | |j#d || j$d k(r|j'| @| j$d k(r|j'| btd| j$zt)j*d} |j-| |j-| ||fScc}w#t$rtd|d|dwxYw)aInspects the options to load the requested patterns and handlers. Returns: (pre_order, post_order), where pre_order is the list of fixers that want a pre-order AST traversal, and post_order is the list that want post-order traversal. r rLrN_z Can't find TzSkipping optional fixer: %szAdding transformation: %sprepostzIllegal fixer order: %r run_orderkey)rrrsplitr FILE_PREFIXlensplit CLASS_PREFIXjointitlegetattrAttributeErrorrtrrr log_message log_debugorderroperator attrgettersort) rpre_order_fixerspost_order_fixers fix_mod_pathmodrNpartsr6 class_name fix_classrGkey_funcs rrzRefactoringTool.get_fixerss KKL\2rC59C#**3226H""4#3#34#C(8(8$9$:;NN3'E**RWW5OAaggi5O-PPJ X#C4 dllDNN;E~~$--t";  5  !>I NN6 A{{e# ''.&!((/ !:U[[!HII/(2&&{3(+8, "344-6P" X x!LMSWW XsG 8 GG*c)zCalled when an error occurs.r&)rmsgargskwdss r log_errorzRefactoringTool.log_errors rcH|r||z}|jj|y)zHook to log a message.N)rinforrrs rrzRefactoringTool.log_messages *C rcH|r||z}|jj|yrQ)rdebugrs rrzRefactoringTool.log_debug s *C #rcy)zTCalled with the old version, new version, and filename of a refactored file.Nr&)rold_textnew_textfilenameequals r print_outputzRefactoringTool.print_outputs rc|D]H}tjj|r|j|||6|j |||Jy)z)Refactor a list of files and directories.N)ospathisdir refactor_dir refactor_file)ritemswrite doctests_only dir_or_files rrefactorzRefactoringTool.refactorsB!Kww}}[)!!+umD"";}E !rctjdz}tj|D]\}}}|jd||j |j |D]m}|j drtj j|d|k(s;tj j||} |j| ||o|D cgc]} | j dr| c} |ddycc} w)zDescends down a directory and refactor every Python file found. Python files are assumed to have a .py extension. Files and subdirectories starting with '.' are skipped. pyzDescending into %srLrN) rextsepwalkrrrrsplitextrr) rdir_namerrpy_extdirpathdirnames filenamesrfullnamedns rrzRefactoringTool.refactor_dir sT!,.GGH,= (GXy NN/ 9 MMO NN !,GG$$T*1-7!ww||GT:H&&x F " )1K" c8J2KHQK->Ls C</C<c t|d} tj|j d}|j tj|d|d5}|j|fcdddS#t$r}|jd||Yd}~yd}~wwxYw#|j wxYw#1swYyxYw) zG Do our best to decode a Python source file correctly. rbzCan't open %s: %sNNNrr5rencodingnewline) openOSErrorrrdetect_encodingrbcloser`read)rrferrrs r_read_python_sourcez#RefactoringTool._read_python_source4s Xt$A // ;A>H GGI WWXsXr Ba668X%C B  NN.# >  GGI B Bs. A6"BB46 B?BBB14B=c|j|\}}|y|dz }|r^|jd||j||}|js||k7r|j |||||y|jd|y|j ||}|js|r.|j r"|j t|dd|||y|jd|y)zRefactors a file.N zRefactoring doctests in %szNo doctest changes in %sr)rrzNo changes in %s)rrrefactor_docstringrzprocessed_filerefactor_string was_changedstr)rrrrinputroutputtrees rrzRefactoringTool.refactor_fileDs228<x =     NN7 B,,UH=F))Vu_##FHeUHM98D''x8D))dt7G7G##CIcrNH*/($D18 "&,,DKK    #',,DKK s)B C*(C%C-%C**C--D ctjj}|rZ|jd|j |d}|j s||k7r|j |d|y|jdy|j|d}|j s|r)|jr|j t|d|y|jdy)NzRefactoring doctests in stdinzzNo doctest changes in stdinzNo changes in stdin) sysstdinrrrrzrrrr)rrrrrs rrefactor_stdinzRefactoringTool.refactor_stdinvs    NN: ;,,UI>F))Vu_##FIu=<=''y9D))dt7G7G##CIy%@45rct|j|jD]}|j|||j |j |j|j |j |j|jj|j}t|jr|jjD]}||vs ||s||jtjj d|j"r-||jtjj$t'||D]}|||vr||j)| t+||j.r||j.vrF|j1|}|sZ|j3||}|o|j5||jD]0}|j.sg|_|j.j7|2|jj|j}|D]"} | |vrg|| <|| j9|| $t|jrt|j|jD]}|j;|||j<S#t,$rYwxYw)aRefactors a parse tree (modifying the tree in place). For compatible patterns the bottom matcher module is used. Otherwise the tree is traversed node-to-node for matches. Args: tree: a pytree.Node instance representing the root of the tree to be refactored. name: a human-readable name for this tree. Returns: True if the tree was modified, False otherwise. T)rreverser)rrr start_tree traverse_byrrrrunleavesanyr@rrr Basedepthkeep_line_order get_linenor;remover ValueErrorfixers_appliedmatch transformreplacerrB finish_treer) rrrrG match_setnoderesultsnew new_matchesfxrs rrzRefactoringTool.refactor_treesv 4>>4??;E   T4 (< 114>>3CD 22DOO4EFGGKK . )""$%I%)E*:e$))fkk.?.?)N,,"%(--&++2H2H-I $Yu%5 69U#33%e,33D9%%dO  ..5D+>>@(;$($7$7$>$>u$E -=/3ggkk#**,.G +6C+.)+;79 #$-cN$9$9+c:J$K ,7A!7()""$%b4>>4??;E   dD )<E *%%%s K  K-,K-c|sy|D]R}||jD]>}|j|}|s|j||}|,|j||}@Ty)aTraverse an AST, applying a set of fixers to each node. This is a helper method for refactor_tree(). Args: fixers: a list of fixer instances. traversal: a generator that yields AST nodes. Returns: None N)r,rrr)rr traversalrrGrrs rr zRefactoringTool.traverse_bys^ D *++d+//$8C S)" +rc2|jj|||j|d}|y||k(}|j|||||r|j d||j sy|r|j ||||y|j d|y)zR Called when a file has been refactored and there may be changes. NrzNo changes to %szNot writing changes to %s)rrrrrrz write_file)rrrrrrrs rrzRefactoringTool.processed_files (#  //9!  NN-x 8--  OOHh( C NN6 Arc` tj|d|d}|5 |j |ddd|j d|d|_y#t$r}|jd||Yd}~yd}~wwxYw#t$r}|jd||Yd}~ld}~wwxYw#1swYuxYw) zWrites a string to a file. It first shows a unified diff between the old text and the new text, and then rewrites the file; the latter is only done if the write option is set. wrrzCan't create %s: %sNzCan't write %s: %szWrote changes to %sT)r`rrrrrr)rrrrrfprs rr$zRefactoringTool.write_files 32FB  D" ,h7   NN0(C @   D3XsCC DRsEAB$A; A8A33A8; B!BB$B!!B$$B-z>>> z... c g}d}d}d}d}|jdD] }|dz }|jj|jrK|#|j |j |||||}|g}|j |j} |d| }}|S|j||jzs#|||jjzdzk(r|j||#|j |j ||||d}d}|j||#|j |j ||||dj|S)aRefactors a docstring, looking for doctests. This returns a modified version of the input string. It looks for doctests, which start with a ">>>" prompt, and may be continued with "..." prompts, as long as the "..." is indented the same as the ">>>". (Unfortunately we can't use the doctest module's parser, since, like most parsers, it is not geared towards preserving the original source.) NrTkeependsrrr) splitlineslstriprPS1rBrefactor_doctestfindPS2rstriprr) rrrresultblock block_linenoindentlinenolineis rrz"RefactoringTool.refactor_docstringsg $$d$3D aKF{{}''1$MM$"7"7|8>#JK% IIdhh'bq$??6DHH#456DHHOO$55<< T"$MM$"7"7|8>#JK d#)4*   MM$//|06B Cwwvrc |j|||}|j||rt|jd}|d|dz ||dz d}} |djds |dxxdz cc<||jz|j!d zg}|r#||Dcgc]}||j"z|zc}z }|S#t$r}|jjtj r(|D]#}|j d|jd%|jd|||jj||cYd}~Sd}~wwxYwcc}w) zRefactors one doctest. A doctest is given as a block of lines, the first of which starts with ">>>" (possibly indented), while the remaining lines start with "..." (identically indented). z Source: %srz+Can't parse docstring in %s line %s: %s: %sNTr)rrr) parse_blockr3r isEnabledForrDEBUGrr1rrr#rrr+endswithr-popr0) rr3r6r5rrrr7rclippeds rr.z RefactoringTool.refactor_doctestDsC ##E66:D   dH -d)&&&5Cyq>3vaxy>SGr7##D)B4dhh&34EsCst&488+d2sCC # {{'' 6!DNN<T1BC" NNH#VS]]-C-CS JL   Ds$B<E< E A;EE E cX|jrd}nd}|js|jd|n4|jd||jD]}|j||jr3|jd|jD]}|j||jr{t |jdk(r|jdn%|jdt |j|jD]\}}}|j|g|i|yy) Nwerez need to bezNo files %s modified.zFiles that %s modified:z$Warnings/messages while refactoring:rzThere was 1 error:zThere were %d errors:)rrrrrr)rrAfilemessagerrrs r summarizezRefactoringTool.summarizeas ::DDzz   4d ;   6 =   &# >>   C D>>  )* ;;4;;1$  !56  !8#dkk:JK#';;T4   4t4t4$/ rc||jj|j|||}t|_|S)zParses a block into a tree. This is necessary to get correct line number / offset information in the parser diagnostics and embedded into the parse tree. )r parse_tokens wrap_toksrcr)rr3r6r5rs rr:zRefactoringTool.parse_blockxs4 {{''uff(MN({ rc#Ktj|j||j}|D]+\}}\}}\} } } ||dz z }| |dz z } ||||f| | f| f-yw)z;Wraps a tokenize stream to systematically modify start/end.rN)rr_ gen_lines__next__) rr3r6r5rAr,rqline0col0line1col1 line_texts rrGzRefactoringTool.wrap_tokss}))$..*G*P*PQDJ @D%% y VaZ E VaZ E t}udmYF FEKsA!A#c#K||jz}||jz}|}|D]R}|j|r|t|dn,||j dzk(rdnt d|d||}T dw)zGenerates lines as expected by tokenize from a list of lines. This strips the first len(indent + self.PS1) characters off each line. Nrzline=z , prefix=r)r-r0rrr1AssertionError)rr3r5prefix1prefix2prefixr7s rrIzRefactoringTool.gen_liness 488#488#Dv&3v;<((4// $T6%JKKFHsA>Br)FF)F)NFNrQ)r#r$r%rrrrrrrrrrrrrrrrr rr$r-r0rr.rDr:rGrIr&rrrwrws+0).279LK3Ln&5P   FL(& =.66 M ^#.GL $B** C C)V:5. Grrwc eZdZy)MultiprocessingUnsupportedNr"r&rrrVrVr'rrVcBeZdZfdZ dfd ZfdZfdZxZS)MultiprocessRefactoringToolcHtt| |i|d|_d|_yrQ)superrXrqueue output_lockrrkwargsrs rrz$MultiprocessRefactoringTool.__init__s' )494J6J rc|dk(rtt| |||S ddl}|j td|j|_|j|_ t|Dcgc]}|j|j }} |D]}|jtt| ||||j jt|D]}|j j!d|D]#}|j#s|j%d|_y#t$rt wxYwcc}w#|j jt|D]}|j j!d|D]#}|j#s|j%d|_wxYw)Nrrz already doing multiple processes)target)rZrXrmultiprocessing ImportErrorrVr[ RuntimeError JoinableQueueLockr\rangeProcess_childstartrputis_alive) rrrr num_processesrar8 processesr6rs rrz$MultiprocessRefactoringTool.refactors A 4dDum- - - " :: !AB B$224 *//1#M242%,,DKK,@2 4   -t =eU>K M JJOO =) t$*::<FFHDJ) -, , - 4 JJOO =) t$*::<FFHDJs$D6/#E ,E6EAG*Gc|jj}|Q|\}} tt||i||jj |jj}|Pyy#|jj wxYwrQ)r[rrZrXr task_done)rtaskrr^rs rrhz"MultiprocessRefactoringTool._childszz~~LD& '14F%#% $$&::>>#D  $$&s A00B c~|j|jj||fytt||i|SrQ)r[rjrZrXrr]s rrz)MultiprocessRefactoringTool.refactor_filesA :: ! JJNND&> *4dI!! !r)FFr)r#r$r%rrrhr __classcell__)rs@rrXrXs$ :? : $!!rrX)T)#ru __author__r`rrrrrr9 itertoolsrpgen2rrr fixer_utilrrr r r rrr3r!r/rJrOrSrrrtobjectrwrVrXr&rrrxs3   +*!   C82@%P''FfFR  4!/4!rPKz1]-__pycache__/btm_matcher.cpython-312.opt-1.pycnu[ {|jvdZdZddlZddlZddlmZddlmZddlm Z Gdd e Z Gd d e Z ia d Zy) aA bottom-up tree matching algorithm implementation meant to speed up 2to3's matching process. After the tree patterns are reduced to their rarest linear path, a linear Aho-Corasick automaton is created. The linear automaton traverses the linear paths from the leaves to the root of the AST and returns a set of nodes for further matching. This reduces significantly the number of candidate nodes.z+George Boutsioukis N) defaultdict)pytree) reduce_treec8eZdZdZej ZdZy)BMNodez?Class for a node of the Aho-Corasick automaton used in matchingcji|_g|_ttj|_d|_y)N)transition_tablefixersnextrcountidcontentselfs ,/usr/lib64/python3.12/lib2to3/btm_matcher.py__init__zBMNode.__init__s( " v||$ N)__name__ __module__ __qualname____doc__ itertoolsrrrrrrsI IOO Errc.eZdZdZdZdZdZdZdZy) BottomMatcherzgThe main matcher class. After instantiating the patterns should be added using the add_fixer methodct|_t|_|jg|_g|_t jd|_y)NRefactoringTool) setmatchrrootnodesr logging getLoggerloggerrs rrzBottomMatcher.__init__s;U H ii[  ''(9: rc|jj|t|j}|j }|j ||j }|D]}|jj|y)zReduces a fixer's pattern tree to a linear path and adds it to the matcher(a common Aho-Corasick automaton). The fixer is appended on the matching states and called when they are reachedstartN)r appendr pattern_treeget_linear_subpatternaddr")rfixertreelinear match_nodes match_nodes r add_fixerzBottomMatcher.add_fixer%sh 5!5--.++-hhvTYYh7 %J    $ $U +&rc |s|gSt|dtrLg}|dD]@}|j||}|D]&}|j|j|dd|(B|S|d|jvrt }||j|d<n|j|d}|ddr|j|dd|}|S|g}|S)z5Recursively adds a linear pattern to the AC automatonrr(rN) isinstancetupler-extendr r)rpatternr)r1 alternative end_nodesend next_nodes rr-zBottomMatcher.add1s7N gaj% (K&qz !HH[H> $C&&txx S'AB% *  qz!7!77"H 5>&&wqz2"2271:> qr{ HHWQR[ HB  'K  rc|j}tt}|D]?}|}|s d|_|jD]5}t |t js|jdk(s.d|_n|jdk(r |j}n |j}||jvr5|j|}|jD]}||j|nq|j}|j|jjr||jvr4|j|}|jD]}||j||j}|r7B|S)auThe main interface with the bottom matcher. The tree is traversed from the bottom using the constructed automaton. Nodes are only checked once as the tree is retraversed. When the automaton fails, we give it one more shot(in case the above tree matches as a whole with the rejected leaf), then we break for the next leaf. There is the special case of multiple arguments(see code comments) where we recheck the nodes Args: The leaves of the AST tree to be matched Returns: A dictionary of node matches with fixers as the keys T;Fr)r"rlist was_checkedchildrenr5rLeafvaluetyper r r*parent) rleavescurrent_ac_noderesultsleafcurrent_ast_nodechild node_tokenr.s rrunzBottomMatcher.runSsW ))d#D# "/3 ,-66E!%5%++:L7<(4 7 $((A-!1!7!7J!1!6!6J!A!AA&5&F&Fz&RO!0!7!7--.>?"8'+iiO(//;,33??"_%E%EE*9*J*J:*V%4%;%;E#EN112BC&<$4#:#: C#Hrc`tdfd|jtdy)z %d [label=%s] //%sr)r keysprintr type_reprstrr r)node subnode_keysubnode print_nodes rrWz*BottomMatcher.print_ac..print_nodes|#4499; // <0ww Ik,BCDWXYZ!#'//*7# risHG; #"V}F}@ 6rPKz1]f U U,__pycache__/fixer_util.cpython-312.opt-1.pycnu[ {|jf;dZddlmZddlmZmZddlmZddl m Z dZ dZ dZ d Zd-d Zd Zd ZdZe e fdZd.dZdZdZd-dZdZd-dZd-dZdZdZdZdZdZhdZ dZ!da"da#d a$d!a%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,d)Z-ej\ej^hZ0d-d*Z1ej^ej\ejdhZ3d+Z4d-d,Z5y )/z1Utility functions, node construction macros, etc.)token)LeafNode)python_symbols)patcompclttj|ttj d|gS)N=)rsymsargumentrrEQUAL)keywordvalues +/usr/lib64/python3.12/lib2to3/fixer_util.py KeywordArgrs*  $u{{C0%8 ::c6ttjdS)N()rrLPARrrLParenr  C  rc6ttjdS)N))rrRPARrrrRParenrrrc t|ts|g}t|ts d|_|g}ttj |t tjddgz|zS)zBuild an assignment statement r prefix) isinstancelistrrr atomrrr )targetsources rAssignr%s] fd # fd #   $u{{C<==F HHrNc:ttj||S)zReturn a NAME leafr)rrNAME)namers rNamer)$s  D 00rcN|ttjt|ggS)zA node tuple for obj.attr)rr trailerDot)objattrs rAttrr/(s dllSUDM2 33rc6ttjdS)z A comma leaf,)rrCOMMArrrCommar3,s  S !!rc6ttjdS)zA period (.) leaf.)rrDOTrrrr,r,0s  3 rcttj|j|jg}|r*|j dttj ||S)z-A parenthesised argument list, used by Call()r)rr r+clone insert_childarglist)argslparenrparennodes rArgListr?4sF  v||~v||~> ?D  !T$,,56 Krcbttj|t|g}|||_|S)zA function call)rr powerr?r) func_namer;rr>s rCallrC;s-  Y 6 7D  Krc6ttjdS)zA newline literal rrNEWLINErrrNewlinerHBs  t $$rc6ttjdS)z A blank linerFrrr BlankLinerKFs  r ""rc:ttj||S)Nr)rrNUMBER)nrs rNumberrOJs  a //rc ttjttj d|ttj dgS)zA numeric or string subscript[])rr r+rrLBRACERBRACE) index_nodes r SubscriptrVMs8  tELL#6)#ELL#68 99rc:ttj||S)z A string leafr)rrSTRING)stringrs rStringrZSs  fV 44rc hd|_d|_d|_ttjd}d|_ttjd}d|_||||g}|rSd|_ttjd}d|_|j t t j||gt t j|t t j|g}t t jttjd|ttjdgS)zuA list comprehension of the form [xp for fp in it if test]. If test is None, the "if test" part is omitted. rJrforinifrQrR) rrrr'appendrr comp_if listmakercomp_forr"rSrT) xpfpittestfor_leafin_leaf inner_argsif_leafinners rListComprlWs BIBIBIEJJ&HHO5::t$GGNB,J  uzz4($t||gt_=> "d4==*&E!F GE  U\\3/U\\3/1 22rc<|D]}|jttjdttj|dttjddt t j |g}t t j|}|S)zO Return an import statement in the form: from package import name_leafsfromrrimport)removerrr'rr import_as_names import_from) package_name name_leafsleafchildrenimps r FromImportrxosw UZZ(UZZc:UZZ#6T)):68H t *C Jrc N|dj}|jtjk(r|j}n)t tj|jg}|d}|r|Dcgc]}|j}}t tj t t|dt|dt tj|dj||djggz|z}|j|_ |Scc}w)zfReturns an import statement and calls a method of the module: import module module.name()r-afterrlparrpar) r8typer r:rrAr/r)r+r)r>resultsnamesr- newarglistrzrNnews r ImportAndCallrs %.   C xx4<<YY[ $,, 6 G E $)*EqE* tzzDqNDqN3T\\fo++- fo++-/01149 9 :C CJ J+s6D"ct|tr"|jtt gk(ryt|txrt |jdk(xrt|jdt xrxt|jdtxrYt|jdt xr:|jdjdk(xr|jdjdk(S)z(Does the node represent a tuple literal?Tr{rrr)r rrvrrlenrrr>s ris_tuplers$$--FHfh3G"G tT " .DMM"a' .4==+T2 .4==+T2 .4==+T2  .  a &&#-  .  a &&#- /rcJt|txrt|jdkDxrxt|jdtxrYt|jdtxr:|jdj dk(xr|jdj dk(S)z'Does the node represent a list literal?rr{rQrR)r rrrvrrrs ris_listrs tT " /DMM"Q& /4==+T2 /4==,d3 / a &&#-  /  b!''3. 0rc\ttjt|t gSN)rr r"rrrs r parenthesizers  FHdFH5 66r> allanymaxminsetsumr!tuplesorted enumeratec#PKt||}|r|t||}|ryyw)alFollow an attribute chain. If you have a chain of objects where a.foo -> b, b.foo-> c, etc, use this to iterate over all objects in the chain. Iteration is terminated by getattr(x, attr) is None. Args: obj: the starting object attr: the name of the chaining attribute Yields: Each successive object in the chain. N)getattr)r-r.nexts r attr_chainrs- 3 D  tT" s!&&zefor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > z power< ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | 'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) ) trailer< '(' node=any ')' > any* > z` power< ( 'sorted' | 'enumerate' ) trailer< '(' arglist ')' > any* > FcDtsMtjtatjtatjt adattt g}t |t|dD]#\}}i}|j||s|d|us#yy)a Returns true if node is in an environment where all that is required of it is being iterable (ie, it doesn't matter if it returns a list or an iterator). See test_map_nochange in test_fixers.py for some examples and tests. Tparentr>F) pats_builtrcompile_patternp0p1p2ziprmatch)r>patternspatternrrs rin_special_contextrs   $ $R (  $ $R (  $ $R ( B|HxD()CD == )gfo.EE rc|j}||jtjk(ry|j}|jt j t jfvry|jt jk(r|jd|ury|jt jk(sM|jt jk(r1||jtjk(s|jd|uryy)zG Check that something isn't an attribute or function name etc. Fr{T) prev_siblingr~rr6rr funcdefclassdef expr_stmtrv parameters typedargslistr2)r>prevrs ris_probably_builtinrs   D DII2 [[F {{t||T]]33 {{dnn$);t)C {{doo% [[D.. .  $))u{{": OOA $ & rc|||jtjk(rPt|jdkDr8|jd}|jt j k(r |jS|j}||y)zFind the indentation of *node*.rrrJ) r~r suiterrvrINDENTrr)r>indents rfind_indentationrsf   99 "s4=='9A'=]]1%F{{ell*||#{{   rc|jtjk(r|S|j}|jdc}|_t tj|g}||_|Sr)r~r rr8rr)r>rrs r make_suitersR yyDJJ ::bindings rdoes_tree_importr/s 44':G =rcZ|jtjtjfvS)z0Returns true if the node is an import statement.)r~r import_namerrrs r is_importr7s" 99))4+;+;< <\}}||st|j|dD]\}}||rn||z}n|dk(ryt|jD]a\}}|jt j k(s$|js1|jdjtjk(s\|dz}n|Ott jttjdttj|dg} n't|ttj|dg} | tg} |j|tt j | y)z\ Works like `does_tree_import` but adds an import statement if it was not imported. c|jtjk(xr&|jxrt |jdS)Nr{)r~r simple_stmtrvrrs ris_import_stmtz$touch_import..is_import_stmt>s: T---,$--,$--*+ -rNr{rrorr)rrrrvr~r rrrXrrrr'rxrHr9) rr(r>rroot insert_posoffsetidxnode2import_rvs r touch_importr;sh- T?Dt,Jt}}- Td# &t}}ST':;MFE!%(<6\  .Q"4==1IC T---$--}}Q$$ 4 1W  2 t'' X & T# .*   WtEJJS'I&JK#Hj$t'7'7"BCrc |jD]<}d}|jtjk(rGt ||jdr|cSt |t |jd|}|r|}n|jtjtjfvr*t |t |jd|}|rh|}nd|jtjk(rt |t |jd|}|r|}nt|jddD]^\}}|jtjk(s$|jdk(s4t |t |j|dz|}|s]|}`n|jtvr|jdj|k(r|}nst|||r|}nc|jtj k(rt |||}n8|jtj"k(rt ||jdr|}|s(|s|cSt%|s;|cSy) z Returns the node which binds variable name, otherwise None. If optional argument package is supplied, only imports will be returned. See test cases for examples.Nrrrr:r{)rvr~r for_stmt_findrrif_stmt while_stmttry_stmtrrCOLONr _def_syms_is_import_bindingrrr)r(r>rchildretrNikids rrris  :: &T5>>!,- T:ennR.@#A7KA# ZZDLL$//: :T:ennR.@#A7KA# ZZ4== (T:ennQ.?#@'JA'qr(:;FAsxx5;;.3993C(z%..1:M/NPWXAc < ZZ9 $):)@)@D)HC tW 5C ZZ4++ +tUG4C ZZ4>> )T5>>!,-  ~ EF rc |g}|r~|j}|jdkDr.|jtvr|j|jn.|jt j k(r|j|k(r|S|r~y)N)popr~ _block_symsextendrvrr'r)r(r>nodess rrrsg FE yy{ 99s?tyy ; LL ' YY%** $t);K  rc,|jtjk(r9|s6|jd}|jtjk(r|jD]q}|jtj k(r!|jdj |k(s=|cS|jtjk(s_|j |k(so|cSy|jtj k(r=|jd}|jtjk(r?|j |k(r0|S|jtjk(r|j |k(r|Sy|jtjk(r|r*t|jdj|k7ry|jd}|r td|ry|jtjk(rt||r|S|jtjk(r>|jd}|jtjk(r|j |k(r|Sy|jtjk(r|j |k(r|S|r|jtjk(r|Sy)z Will return node if node will import name, or node will import * from package. None is returned otherwise. See test cases for examples. rrrNras)r~r rrvdotted_as_namesdotted_as_namerrr'rrstrstriprrqimport_as_nameSTAR)r>r(rrwrlastrNs rrrs  yyD$$$WmmA 88t++ +::!4!44~~a(..$6# ZZ5::-%++2EK &> 3XX,, ,<<#DyyEJJ&4::+= XX # T(9K( ' d&& & s4==+,224? MM!  uT1~ VVt++ +dAK VVt** *JJqMEzzUZZ'EKK4,?  VVuzz !aggoK 5::-K rr)NN)6__doc__pgen2rpytreerrpygramrr rJrrrrr%r)r/r3r,r?rCrHrKrOrVrZrlrxrrrrconsuming_callsrrrrrrrrrrrrrrrrrr+rrrrrrrs7*:!! H14"  &(%#09 520&8 /07.#&  &.=*DZ]]DLL ) (T||T]]DLL9 'rPKz1] -__pycache__/btm_matcher.cpython-312.opt-2.pycnu[ {|jt dZddlZddlZddlmZddlmZddlmZGdde Z Gd d e Z ia d Z y) z+George Boutsioukis N) defaultdict)pytree) reduce_treec6eZdZ ejZdZy)BMNodecji|_g|_ttj|_d|_y)N)transition_tablefixersnextrcountidcontentselfs ,/usr/lib64/python3.12/lib2to3/btm_matcher.py__init__zBMNode.__init__s( " v||$ N)__name__ __module__ __qualname__ itertoolsrrrrrrsI IOO Errc,eZdZ dZdZdZdZdZy) BottomMatcherct|_t|_|jg|_g|_t jd|_y)NRefactoringTool) setmatchrrootnodesr logging getLoggerloggerrs rrzBottomMatcher.__init__s;U H ii[  ''(9: rc |jj|t|j}|j }|j ||j }|D]}|jj|y)Nstart)r appendr pattern_treeget_linear_subpatternaddr!)rfixertreelinear match_nodes match_nodes r add_fixerzBottomMatcher.add_fixer%sm  5!5--.++-hhvTYYh7 %J    $ $U +&rc  |s|gSt|dtrLg}|dD]@}|j||}|D]&}|j|j|dd|(B|S|d|jvrt }||j|d<n|j|d}|ddr|j|dd|}|S|g}|S)Nrr'r) isinstancetupler,extendr r)rpatternr(r0 alternative end_nodesend next_nodes rr,zBottomMatcher.add1s?7N gaj% (K&qz !HH[H> $C&&txx S'AB% *  qz!7!77"H 5>&&wqz2"2271:> qr{ HHWQR[ HB  'K  rc |j}tt}|D]?}|}|s d|_|jD]5}t |t js|jdk(s.d|_n|jdk(r |j}n |j}||jvr5|j|}|jD]}||j|nq|j}|j|jjr||jvr4|j|}|jD]}||j||j}|r7B|S)NT;Fr)r!rlist was_checkedchildrenr4rLeafvaluetyper r r)parent) rleavescurrent_ac_noderesultsleafcurrent_ast_nodechild node_tokenr-s rrunzBottomMatcher.runSs\ ))d#D# "/3 ,-66E!%5%++:L7<(4 7 $((A-!1!7!7J!1!6!6J!A!AA&5&F&Fz&RO!0!7!7--.>?"8'+iiO(//;,33??"_%E%EE*9*J*J:*V%4%;%;E#EN112BC&<$4#:#: C#Hrcb tdfd|jtdy)Nz digraph g{c *|jjD]u}|j|}td|j|jt |t |j fz|dk(rt|j|wy)Nz%d -> %d [label=%s] //%sr)r keysprintr type_reprstrr r)node subnode_keysubnode print_nodes rrVz*BottomMatcher.print_ac..print_nodes|#4499; // <0ww Ik,BCDWXYZ!#'//*7# rhsHG; #"V}F}@ 6rPKz1]$$)__pycache__/patcomp.cpython-312.opt-1.pycnu[ {|jdZdZddlZddlmZmZmZmZmZm Z ddl m Z ddl m Z Gdd e Zd ZGd d eZej$ej&ej(dd ZdZdZdZy)zPattern compiler. The grammar is taken from PatternGrammar.txt. The compiler compiles a pattern to a pytree.*Pattern instance. z#Guido van Rossum N)driverliteralstokentokenizeparsegrammar)pytree)pygramc eZdZy)PatternSyntaxErrorN)__name__ __module__ __qualname__(/usr/lib64/python3.12/lib2to3/patcomp.pyr r srr c#Ktjtjtjh}t j t j|j}|D]}|\}}}}}||vs|yw)z6Tokenizes a string suppressing significant whitespace.N) rNEWLINEINDENTDEDENTrgenerate_tokensioStringIOreadline) inputskiptokens quintupletypevaluestartend line_texts rtokenize_wrapperr%sd MM5<< 6D  % %bkk%&8&A&A BF -6*eUC t Os A3A=6A=c0eZdZddZddZdZddZdZy) PatternCompilerNc|+tj|_tj|_n>t j ||_tj|j|_tj|_ tj|_ t j|jt|_y)z^Initializer. Takes an optional alternative filename for the pattern grammar. N)convert)r pattern_grammarr pattern_symbolssymsr load_grammarSymbolspython_grammar pygrammarpython_symbolspysymsDriverpattern_convert)self grammar_files r__init__zPatternCompiler.__init__(sz  !11DL..DI!..|>D!"IE u:?uRy~~1C1CC2YF#2JE$$UF3  HQKEzzUZZ'kkuzz)kku||+!LL!55cx=A%,,x{3Cax3!8!**, 007)#3O  GL!!sH(;Ds*M3* M8?M=c|d}|jtjk(rGtt j |j }tjt||S|jtjk(r|j }|jrB|tvrtd|z|ddr tdtjt|S|dk(rd}n8|jds't|j |d}|td|z|ddr#|j#|dj$dg}nd}tj&|S|j dk(r|j#|dS|j d k(r.|j#|d}tj(|ggdd Sy) NrzInvalid token: %rrzCan't have details for tokenany_zInvalid symbol: %r([rD)r rSTRINGr<r evalStringr!r LeafPattern_type_of_literalNAMEisupper TOKEN_MAPr startswithgetattrr2r=rK NodePatternrN)r5rcrdr\r!r content subpatterns rrRzPatternCompiler.compile_basicsQx 99 $++DJJ78E%%&6u&=uE E YY%** $JJE}} ),-@5-HII9,-KLL)))E*:;;E>D))#."4;;trsw3  ED  IfIZZZ||||  96rPKz1]fZZ*__pycache__/__init__.cpython-312.opt-1.pycnu[ {|j6ddlZejdedy)NzGlib2to3 package is deprecated and may not be able to parse Python 3.10+) stacklevel)warningswarnDeprecationWarning)/usr/lib64/python3.12/lib2to3/__init__.pyr s! Mr PKz1]fZZ*__pycache__/__init__.cpython-312.opt-2.pycnu[ {|j6ddlZejdedy)NzGlib2to3 package is deprecated and may not be able to parse Python 3.10+) stacklevel)warningswarnDeprecationWarning)/usr/lib64/python3.12/lib2to3/__init__.pyr s! Mr PKz1]޶:vv*__pycache__/refactor.cpython-312.opt-2.pycnu[ {|jsk dZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZddlmZdd ZGd d eZd Zd ZdZdZdZGddeZGddeZGddeZ GddeZ!y)z#Guido van Rossum N)chain)drivertokenizetoken) find_root)pytreepygram) btm_matcherc t|ggdg}g}tj|jD]0\}}}|j ds|r|dd}|j |2|S)N*fix_) __import__pkgutil iter_modules__path__ startswithappend) fixer_pkg remove_prefixpkg fix_namesfindernameispkgs )/usr/lib64/python3.12/lib2to3/refactor.pyget_all_fix_namesrsmO YB .CI&33CLLAe ??6 "ABx   T " B c eZdZy) _EveryNodeN__name__ __module__ __qualname__rrr!r!+rr!c t|tjtjfr|jt |jhSt|tj r'|jrt|jSt t|tjr>t}|jD]#}|D]}|jt|%|Std|z)Nz$Oh no! I don't understand pattern %s) isinstancer NodePattern LeafPatterntyper!NegatedPatterncontent_get_head_typesWildcardPatternsetupdate Exception)patrpxs rr/r//s9#**F,>,>?@ 88  z#v,,- ;;"3;;/ /#v--. EA+, :SA BBrcZ tjt}g}|D]|}|jr2 t |j}|D]}||j |A|j||jj |l|j |~ttjjjtjjD]}||j|t|S#t $r|j |Y wxYwN) collections defaultdictlistpatternr/rr! _accept_typerr python_grammar symbol2numbervaluestokensextenddict) fixer_list head_nodeseveryfixerheads node_types r_get_headnode_dictrKKs/((.J E == 8' 6"'Iy)007"'!!-5--.55e< U#600>>EEG!00779 9$$U+9   $ U# $sD  D*)D*cN t|dDcgc] }|dz|z c}Scc}w)NF.)r)pkg_namefix_names rget_fixers_from_packagerPdsB.h> @> sNX %> @@ @s"c|Sr9r&)objs r _identityrSks Jrc|d}tjtj|jfd}t t jtjt jh}t} |\}}||vr|t jk(r|rnd}n|t jk(r|dk(r|\}}|t jk7s|dk7rn|\}}|t jk7s|dk7rn|\}}|t jk(r|dk(r |\}}|t jk(rT|j||\}}|t jk7s|dk7rn |\}}|t jk(rRnnt |S#t$r Yt |SwxYw) NFc.t}|d|dfS)Nrr)next)tokgens radvancez(_detect_future_features..advancers3i1vs1v~rTfrom __future__import(,)rgenerate_tokensioStringIOreadline frozensetrNEWLINENLCOMMENTr1STRINGNAMEOPadd StopIteration)sourcehave_docstringrYignorefeaturestpvaluerXs @r_detect_future_featuresrrosN  " "2;;v#6#?#? @C x{{EMMB CFuH  IBV|u||#!!%uzz!evo#I E#u '<#I E#u'8#I E>esl ' IBEJJ&LL' ' IBUXX~# ' IB EJJ&38 X    X  s>DF%F%% F;:F;c eZdZy) FixerErrorNr"r&rrrtrts&rrtceZdZddddZdZdZddZdZdZd Z d Z d Z dd Z dd Z dZddZdZd dZdZdZ d!dZd"dZdZdZdZdZdZdZdZdZy)#RefactoringToolF)print_function exec_functionwrite_unchanged_filesFixrNc ||_|xsg|_|jj|_||jj |t jj|_|jdr|jjd=n&|jdr|jjd=|jjd|_ g|_ tjd|_g|_d|_t%j&|jt(j*|j|_|j-\|_|_g|_t5j6|_g|_g|_t?|j0|j.D]~}|j@r|j8jC|+||j.vr|j:jE|U||j0vsd|j<jE|tG|j:|_$tG|j<|_%y) NrwprintrxexecryrvF)convertlogger)&fixersexplicit_default_optionscopyoptionsr2r r?grammarkeywordsgetryerrorslogging getLoggerr fixer_logwroterDriverr r~ get_fixers pre_order post_orderfilesbm BottomMatcherBM bmi_pre_orderbmi_post_orderr BM_compatible add_fixerrrKbmi_pre_order_headsbmi_post_order_heads)self fixer_namesrrrHs r__init__zRefactoringTool.__init__s "  B ,,113   LL   (,,113 <<( ) %%g. \\/ * %%f- &*\\%5%56M%N" ''(9:  mmDLL,2NN+/;;8 +///*;' ""$ 4??DNN;E""!!%($..(""))%0$//)##**51<$6d6H6H#I $6t7J7J$K!rc  g}g}|jD]w}t|iidg}|jddd}|j|jr|t |jd}|j d}|jdj|Dcgc]}|jc}z} t||} | |j|j} | jr0|jdur"||jvr|j!d | |j#d || j$d k(r|j'| @| j$d k(r|j'| btd | j$zt)j*d} |j-| |j-| ||fScc}w#t$rtd|d|dwxYw)Nr rMr_z Can't find TzSkipping optional fixer: %szAdding transformation: %sprepostzIllegal fixer order: %r run_orderkey)rrrsplitr FILE_PREFIXlensplit CLASS_PREFIXjointitlegetattrAttributeErrorrtrrr log_message log_debugorderroperator attrgettersort) rpre_order_fixerspost_order_fixers fix_mod_pathmodrOpartsr6 class_name fix_classrHkey_funcs rrzRefactoringTool.get_fixerss  KKL\2rC59C#**3226H""4#3#34#C(8(8$9$:;NN3'E**RWW5OAaggi5O-PPJ X#C4 dllDNN;E~~$--t";  5  !>I NN6 A{{e# ''.&!((/ !:U[[!HII/(2&&{3(+8, "344-6P" X x!LMSWW XsG 9 GG+c r9r&)rmsgargskwdss r log_errorzRefactoringTool.log_errors* rcJ |r||z}|jj|yr9)rinforrrs rrzRefactoringTool.log_messages#$ *C rcH|r||z}|jj|yr9)rdebugrs rrzRefactoringTool.log_debug s *C #rc yr9r&)rold_textnew_textfilenameequals r print_outputzRefactoringTool.print_outputs   rc |D]H}tjj|r|j|||6|j |||Jyr9)ospathisdir refactor_dir refactor_file)ritemswrite doctests_only dir_or_files rrefactorzRefactoringTool.refactorsC7 Kww}}[)!!+umD"";}E !rc tjdz}tj|D]\}}}|jd||j |j |D]m}|j drtj j|d|k(s;tj j||} |j| ||o|D cgc]} | j dr| c} |ddycc} w)NpyzDescending into %srMr) rextsepwalkrrrrsplitextrr) rdir_namerrpy_extdirpathdirnames filenamesrfullnamedns rrzRefactoringTool.refactor_dir s T!,.GGH,= (GXy NN/ 9 MMO NN !,GG$$T*1-7!ww||GT:H&&x F " )1K" c8J2KHQK->Ls C=0C=c t|d} tj|j d}|j tj|d|d5}|j|fcdddS#t$r}|jd||Yd}~yd}~wwxYw#|j wxYw#1swYyxYw)NrbzCan't open %s: %sNNrr5rencodingnewline) openOSErrorrrdetect_encodingrbcloser`read)rrferrrs r_read_python_sourcez#RefactoringTool._read_python_source4s  Xt$A // ;A>H GGI WWXsXr Ba668X%C B  NN.# >  GGI B Bs. A7"B B57 BBB B25B>c |j|\}}|y|dz }|r^|jd||j||}|js||k7r|j |||||y|jd|y|j ||}|js|r.|j r"|j t|dd|||y|jd|y)N zRefactoring doctests in %szNo doctest changes in %sr)rrzNo changes in %s)rrrefactor_docstringryprocessed_filerefactor_string was_changedstr)rrrrinputroutputtrees rrzRefactoringTool.refactor_fileDs228<x =     NN7 B,,UH=F))Vu_##FHeUHM98D''x8D))dt7G7G##CIcrNH*/($D18 "&,,DKK    #',,DKK s)B C+(C&C.&C++C..D ctjj}|rZ|jd|j |d}|j s||k7r|j |d|y|jdy|j|d}|j s|r)|jr|j t|d|y|jdy)NzRefactoring doctests in stdinzzNo doctest changes in stdinzNo changes in stdin) sysstdinrrrryrrrr)rrrrrs rrefactor_stdinzRefactoringTool.refactor_stdinvs    NN: ;,,UI>F))Vu_##FIu=<=''y9D))dt7G7G##CIy%@45rc t|j|jD]}|j|||j |j |j|j |j |j|jj|j}t|jr|jjD]}||vs ||s||jtjj d|j"r-||jtjj$t'||D]}|||vr||j)| t+||j.r||j.vrF|j1|}|sZ|j3||}|o|j5||jD]0}|j.sg|_|j.j7|2|jj|j}|D]"} | |vrg|| <|| j9|| $t|jrt|j|jD]}|j;|||j<S#t,$rYwxYw)NT)rreverser)rrr start_tree traverse_byrrrrunleavesanyrArrr Basedepthkeep_line_order get_linenor<remover ValueErrorfixers_appliedmatch transformreplacerrC finish_treer) rrrrH match_setnoderesultsnew new_matchesfxrs rrzRefactoringTool.refactor_trees{ 4>>4??;E   T4 (< 114>>3CD 22DOO4EFGGKK . )""$%I%)E*:e$))fkk.?.?)N,,"%(--&++2H2H-I $Yu%5 69U#33%e,33D9%%dO  ..5D+>>@(;$($7$7$>$>u$E -=/3ggkk#**,.G +6C+.)+;79 #$-cN$9$9+c:J$K ,7A!7()""$%b4>>4??;E   dD )<E *%%%s K!! K.-K.c |sy|D]R}||jD]>}|j|}|s|j||}|,|j||}@Tyr9)r,rrr)rr traversalrrHrrs rr zRefactoringTool.traverse_bysc  D *++d+//$8C S)" +rc4 |jj|||j|d}|y||k(}|j|||||r|j d||j sy|r|j ||||y|j d|y)NrzNo changes to %szNot writing changes to %s)rrrrrry write_file)rrrrrrrs rrzRefactoringTool.processed_files  (#  //9!  NN-x 8--  OOHh( C NN6 Arcb tj|d|d}|5 |j |ddd|j d|d|_y#t$r}|jd||Yd}~yd}~wwxYw#t$r}|jd||Yd}~ld}~wwxYw#1swYuxYw)NwrrzCan't create %s: %szCan't write %s: %szWrote changes to %sT)r`rrrrrr)rrrrrfprs rr#zRefactoringTool.write_files  32FB  D" ,h7   NN0(C @   D3XsCC DRsEAB%A< A9A44A9< B"BB%B""B%%B.z>>> z... c  g}d}d}d}d}|jdD] }|dz }|jj|jrK|#|j |j |||||}|g}|j |j} |d| }}|S|j||jzs#|||jjzdzk(r|j||#|j |j ||||d}d}|j||#|j |j ||||dj|S)NrTkeependsrrr) splitlineslstriprPS1rCrefactor_doctestfindPS2rstriprr) rrrresultblock block_linenoindentlinenolineis rrz"RefactoringTool.refactor_docstringsl  $$d$3D aKF{{}''1$MM$"7"7|8>#JK% IIdhh'bq$??6DHH#456DHHOO$55<< T"$MM$"7"7|8>#JK d#)4*   MM$//|06B Cwwvrc |j|||}|j||rt|jd}|d|dz ||dz d}} |djds |dxxdz cc<||jz|j!dzg}|r#||Dcgc]}||j"z|zc}z }|S#t$r}|jjtj r(|D]#}|j d|jd%|jd|||jj||cYd}~Sd}~wwxYwcc}w) Nz Source: %srz+Can't parse docstring in %s line %s: %s: %sTr(rrr) parse_blockr3r isEnabledForrDEBUGrr0rrr#rrr*endswithr,popr/) rr2r5r4rrrr6rclippeds rr-z RefactoringTool.refactor_doctestDsH  ##E66:D   dH -d)&&&5Cyq>3vaxy>SGr7##D)B4dhh&34EsCst&488+d2sCC # {{'' 6!DNN<T1BC" NNH#VS]]-C-CS JL   Ds$B=E= E A;EE E cX|jrd}nd}|js|jd|n4|jd||jD]}|j||jr3|jd|jD]}|j||jr{t |jdk(r|jdn%|jdt |j|jD]\}}}|j|g|i|yy) Nwerez need to bezNo files %s modified.zFiles that %s modified:z$Warnings/messages while refactoring:rzThere was 1 error:zThere were %d errors:)rrrrrr)rr@filemessagerrrs r summarizezRefactoringTool.summarizeas ::DDzz   4d ;   6 =   &# >>   C D>>  )* ;;4;;1$  !56  !8#dkk:JK#';;T4   4t4t4$/ rc~ |jj|j|||}t|_|Sr9)r parse_tokens wrap_toksrcr)rr2r5r4rs rr9zRefactoringTool.parse_blockxs9 {{''uff(MN({ rc#K tj|j||j}|D]+\}}\}}\} } } ||dz z }| |dz z } ||||f| | f| f-yw)Nr)rr_ gen_lines__next__) rr2r5r4rBr,rqline0col0line1col1 line_texts rrFzRefactoringTool.wrap_tokssI))$..*G*P*PQDJ @D%% y VaZ E VaZ E t}udmYF FEKsA"A$c#K ||jz}||jz}|}|D]R}|j|r|t|dn,||j dzk(rdnt d|d||}T dw)Nrzline=z , prefix=r)r,r/rrr0AssertionError)rr2r4prefix1prefix2prefixr6s rrHzRefactoringTool.gen_liness 488#488#Dv&3v;<((4// $T6%JKKFHsA?Br)FF)F)NFNr9)r#r$r%rrrrrrrrrrrrrrrrr rr#r,r/rr-rCr9rFrHr&rrrvrvs+0).279LK3Ln&5P   FL(& =.66 M ^#.GL $B** C C)V:5. Grrvc eZdZy)MultiprocessingUnsupportedNr"r&rrrUrUr'rrUcBeZdZfdZ dfd ZfdZfdZxZS)MultiprocessRefactoringToolcHtt| |i|d|_d|_yr9)superrWrqueue output_lockrrkwargsrs rrz$MultiprocessRefactoringTool.__init__s' )494J6J rc|dk(rtt| |||S ddl}|j td|j|_|j|_ t|Dcgc]}|j|j }} |D]}|jtt| ||||j jt|D]}|j j!d|D]#}|j#s|j%d|_y#t$rt wxYwcc}w#|j jt|D]}|j j!d|D]#}|j#s|j%d|_wxYw)Nrrz already doing multiple processes)target)rYrWrmultiprocessing ImportErrorrUrZ RuntimeError JoinableQueueLockr[rangeProcess_childstartrputis_alive) rrrr num_processesr`r7 processesr6rs rrz$MultiprocessRefactoringTool.refactors A 4dDum- - - " :: !AB B$224 *//1#M242%,,DKK,@2 4   -t =eU>K M JJOO =) t$*::<FFHDJ) -, , - 4 JJOO =) t$*::<FFHDJs$D6/#E ,E6EAG*Gc|jj}|Q|\}} tt||i||jj |jj}|Pyy#|jj wxYwr9)rZrrYrWr task_done)rtaskrr]rs rrgz"MultiprocessRefactoringTool._childszz~~LD& '14F%#% $$&::>>#D  $$&s A00B c~|j|jj||fytt||i|Sr9)rZrirYrWrr\s rrz)MultiprocessRefactoringTool.refactor_filesA :: ! JJNND&> *4dI!! !r)FFr)r#r$r%rrrgr __classcell__)rs@rrWrWs$ :? : $!!rrW)T)" __author__r`rrrrrr: itertoolsrpgen2rrr fixer_utilrrr r r rrr3r!r/rKrPrSrrrtobjectrvrUrWr&rrrws3   +*!   C82@%P''FfFR  4!/4!rPKz1]G!ff(__pycache__/pygram.cpython-312.opt-1.pycnu[ {|jdZddlZddlmZddlmZddlmZejjejje dZ ejjejje dZ Gd d e Zejd e ZeeZej%Zej(d =ej%Zej(d =ejd e ZeeZy)z&Export the Python grammar and symbols.N)token)driver)pytreez Grammar.txtzPatternGrammar.txtceZdZdZy)Symbolscb|jjD]\}}t|||y)zInitializer. Creates an attribute for each grammar symbol (nonterminal), whose value is the symbol's type (an int >= 256). N) symbol2numberitemssetattr)selfgrammarnamesymbols '/usr/lib64/python3.12/lib2to3/pygram.py__init__zSymbols.__init__s- $11779LD& D$ ':N)__name__ __module__ __qualname__rrrrrs(rrlib2to3printexec)__doc__ospgen2rrrpathjoindirname__file__ _GRAMMAR_FILE_PATTERN_GRAMMAR_FILEobjectrload_packaged_grammarpython_grammarpython_symbolscopy!python_grammar_no_print_statementkeywords*python_grammar_no_print_and_exec_statementpattern_grammarpattern_symbolsrrrr/s-  RWW__X6 F  RWW__X%>%9; (f (.--iG($2$7$7$9!%..w7-N-S-S-U*.77?.&..y:OP/*rPKz1] N+N+%__pycache__/btm_utils.cpython-312.pycnu[ {|j&dZddlmZddlmZmZddlmZmZeZ eZ ejZ eZ dZdZdZGdd eZdd Zd Zd Zy )z0Utility functions used by the btm_matcher module)pytree)grammartoken)pattern_symbolspython_symbolsc0eZdZdZddZdZdZdZdZy) MinNodezThis class serves as an intermediate representation of the pattern tree during the conversion to sets of leaf-to-root subpatternsNcf||_||_g|_d|_d|_g|_g|_y)NF)typenamechildrenleafparent alternativesgroup)selfrrs */usr/lib64/python3.12/lib2to3/btm_utils.py__init__zMinNode.__init__s4      c^t|jdzt|jzS)N )strrr)rs r__repr__zMinNode.__repr__s"499~#c$))n44rcD|}g}|r|jtk(r|jj|t |jt |j k(r*t |jg}g|_|j}|j}d} |S|jtk(r|jj|t |jt |j k(r*t|j}g|_ |j}|j}d} |S|jtjk(r(|jr|j|jn|j|j|j}|r|S)zInternal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a singleN)rTYPE_ALTERNATIVESrappendlenrtupler TYPE_GROUPrget_characteristic_subpattern token_labelsNAMEr)rnodesubps r leaf_to_rootzMinNode.leaf_to_root!sPyy--!!((.t(()S-??!$"3"345D(*D%;;D;;DD, )yyJ& !!$'tzz?c$--&888DD!#DJ;;D;;DD yyL---$)) DII& DII&;;DCD rcZ|jD]}|j}|s|cSy)aDrives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton's capabilities, leaf_to_root merges each group into a single choice based on 'characteristic'ity, i.e. (a|b c) -> (a|b) if b more characteristic than c Returns: The most 'characteristic'(as defined by get_characteristic_subpattern) path for the compiled pattern tree. N)leavesr()rlr's rget_linear_subpatternzMinNode.get_linear_subpatternKs( A>>#D rc#K|jD]}|jEd{|js|yy7w)z-Generator that returns the leaves of the treeN)rr*)rchilds rr*zMinNode.leaves`s9]]E||~ % %#}}J &s#A>A)NN) __name__ __module__ __qualname____doc__rrr(r,r*rrr r s!5(T*rr Nc d}|jtjk(r|jd}|jtjk(rt |jdkrt |jd|}ntt}|jD]K}|jj|dzr"t ||}|1|jj|Mna|jtjk(rt |jdkDr\tt}|jD],}t ||}|s|jj|.|jsd}nt |jd|}n|jtjk(rt|jdtj r5|jdj"dk(rt |jd|St|jdtj r|jdj"dk(sMt |jdkDr6t%|jddr|jdj"dk(ryd }d}d}d }d} d } |jD]}|jtj&k(rd }|}nA|jtj(k(rd }|} n|jtjk(r|}t%|dss|j"d k(sd } | r:|jd} t%| dr.| j"dk(r|jd } n|jd} | jt*j,k(r| j"d k(rtt.}nt%t*| j"r%tt1t*| j"}ntt1t2| j"}n| jt*j4k(rS| j"j7d} | t8vrtt8| }nEtt*j,| }n)| jtjk(r t ||}|rB| jdj"dk(rd}n#| jdj"dk(rnt:|r@|>|jddD],}t ||}||jj|.|r||_|S)z Internal function. Reduces a compiled pattern tree to an intermediate representation suitable for feeding the automaton. This also trims off any optional pattern elements(like [a], a*). N)rr([valueTF=any')rr*+r)rsymsMatcherr Alternativesr reduce_treer rindexr Alternativer"Unit isinstancerLeafr9hasattrDetailsRepeaterr$r%TYPE_ANYgetattrpysymsSTRINGstriptokensNotImplementedErrorr) r&rnew_noder.reducedr details_nodealternatives_node has_repeater repeater_nodehas_variable_name name_leafrs rrCrCgsIH yyDLL }}Q yyD%%% t}}  ""4==#3V>\.. .%'"1<9&GL)//,RSH&GFIOO,LMH ^^|22 2??((-Dv~"t 5" (9(9E ^^t00 0"#4f=H %%a(..#5''*00C7*) H0%..q4%eX6&%%,,W5 5   Orct|ts|St|dk(r|dSg}g}gdg}d|D]~}tt |dstt |fdr|j |Dtt |fdr|j |n|j ||r|}n |r|}n|r|}t |tS) zPicks the most characteristic from a list of linear patterns Current order used is: names > common_names > common_chars rr5)inforifnotNonez[]().,:c$t|tuSN)rr)xs rz/get_characteristic_subpattern..s d1gnrc0t|txr|vSrbrGr)rc common_charss rrdz/get_characteristic_subpattern..sjC&8&NQ,=N&Nrc0t|txr|vSrbrf)rc common_namess rrdz/get_characteristic_subpattern..s 1c(:(PqL?P(Pr)key)rGlistr r<rec_testrmax) subpatternssubpatterns_with_namessubpatterns_with_common_namessubpatterns_with_common_chars subpatternrgris @@rr#r#s k4 ( ;1~ $&!6L$&!L! x $<= >8JNPQ-44Z@XjPRS-44Z@'--j9", &3 &3 { $$rc#K|D]7}t|ttfrt||Ed{.||9y7w)zPTests test_func on all items of sequence and items of included sub-iterablesN)rGrkr!rl)sequence test_funcrcs rrlrls= a$ '9- - -A,   -s+AAArb)r2rpgen2rrpygramrrr@rNopmaprQr$rLrr"objectr rCr#rlr3rrr{sZ2!3     UfUnBJ#%JrPKz1]Kdaa(__pycache__/pytree.cpython-312.opt-2.pycnu[ {|jFm dZddlZddlmZdZiadZGddeZGdd eZ Gd d eZ d Z Gd deZ Gdde Z Gdde ZGdde ZGdde ZdZy)z#Guido van Rossum N)StringIOictsDddlm}|jj D]!\}}t |t k(s|t|<#tj||S)N)python_symbols) _type_reprspygramr__dict__itemstypeint setdefault)type_numrnamevals '/usr/lib64/python3.12/lib2to3/pytree.py type_reprrsO *(00668ID#CyCDS!19  ! !(H 55ceZdZ dZdZdZdZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZedZedZdZdZdZej4dkrdZyy)BaseNFc. tj|SNobject__new__clsargskwdss rrz Base.__new__1sE~~c""rcb |j|jurtS|j|Sr) __class__NotImplemented_eqselfothers r__eq__z Base.__eq__6s- >> 0! !xxrc trNotImplementedErrorr$s rr#zBase._eqBs "!rc trr)r%s rclonez Base.cloneM "!rc trr)r,s r post_orderzBase.post_orderUr.rc trr)r,s r pre_orderzBase.pre_order]r.rcT t|ts|g}g}d}|jjD]-}||ur||j |d}|j |/|jj ||j_|D]}|j|_d|_yNFT) isinstancelistparentchildrenextendappendchanged)r%new l_childrenfoundchxs rreplacez Base.replacees=#t$%C ++&&BTz?%%c*!!"%' ) A{{AH rc |}t|ts-|jsy|jd}t|ts-|jSNr)r5Leafr8linenor%nodes r get_linenozBase.get_lineno|sDGT4(====#DT4({{rc^|jr|jjd|_yNT)r7r; was_changedr,s rr;z Base.changeds! ;; KK   !rc |jrht|jjD]E\}}||us |jj|jj|=d|_|cSyyr)r7 enumerater8r;)r%irGs rremovez Base.removesg  ;;$T[[%9%9:44<KK'') ,,Q/"&DKH ; rc |jyt|jjD](\}}||us |jj|dzcSy#t$rYywxYw)Nr)r7rMr8 IndexErrorr%rNchilds r next_siblingzBase.next_siblingsn  ;; "$++"6"67HAu} ;;//!448"  sA A'&A'c |jyt|jjD].\}}||us |dk(ry|jj|dz cSyNrr)r7rMr8rRs r prev_siblingzBase.prev_siblings_  ;; "$++"6"67HAu}6{{++AaC00 8rc#bK|jD]}|jEd{y7wr)r8leavesr%rSs rrYz Base.leavess&]]E||~ % %# %s #/-/cV|jyd|jjzSrV)r7depthr,s rr\z Base.depths' ;; 4;;$$&&&rc: |j}|y|jSN)rTprefix)r%next_sibs r get_suffixzBase.get_suffixs' $$  rrc6t|jdS)Nascii)strencoder,s r__str__z Base.__str__st9##G, ,r)__name__ __module__ __qualname__r r7r8rK was_checkedrr'__hash__r#r-r0r2rArHr;rOpropertyrTrWrYr\rbsys version_inforirrrrrs D FHKK# H """".    1 1&'  &  -!rrceZdZ ddZdZdZejdkDreZdZ dZ dZ d Z e d Zejd Zd Zd ZdZy)NodeNc ||_t||_|jD] }||_ |||_|r |dd|_yd|_yr)r r6r8r7r`fixers_applied)r%r r8contextr`rur?s r__init__z Node.__init__sW  X --BBI    DK "0"3D "&D rc| |jjdt|jd|jdSN(, ))r!rjrr r8r,s r__repr__z Node.__repr__s/7#~~66(3#}}. .rcV djtt|jSr^)joinmaprgr8r,s r __unicode__zNode.__unicode__s# wws3 .//rrccf |j|jf|j|jfk(Sr)r r8r$s rr#zNode._eqs*- 4==)ejj%..-IIIrc t|j|jDcgc]}|jc}|jScc}wN)ru)rsr r8r-ru)r%r?s rr-z Node.clones?2DIIT]]C]r ]C#'#6#68 8CsA c#lK |jD]}|jEd{|y7 wr)r8r0rZs rr0zNode.post_orders38]]E'') ) )#  *s $42 4c#lK ||jD]}|jEd{y7wr)r8r2rZs rr2zNode.pre_order s/7 ]]E( ( (# (s (424cP |jsy|jdjS)Nr_rr8r`r,s rr`z Node.prefixs( }}}}Q&&&rcF|jr||jd_yyrCrr%r`s rr`z Node.prefixs ==&,DMM!  # rcz ||_d|j|_||j|<|jyr)r7r8r;rRs r set_childzNode.set_child s8  "& a  a rcl ||_|jj|||jyr)r7r8insertr;rRs r insert_childzNode.insert_child*s-   Q& rcj ||_|jj||jyr)r7r8r:r;rZs r append_childzNode.append_child3s+   U# rNNN)rjrkrlrwr}rrprqrir#r-r0r2ror`setterrrrrrrrsrss5 $'2. 0 & J8  ) '' ]]--rrsceZdZ dZdZdZddgfdZdZdZe jdkDreZ dZ d Z d Zd Zd Zed Zej&dZy)rDr_rNcz ||\|_\|_|_||_||_|||_|dd|_yr)_prefixrEcolumnr valueru)r%r rrvr`rus rrwz Leaf.__init__FsL   7> 4DL44;    !DL,Q/rcj |jjd|jd|jdSry)r!rjr rr,s rr}z Leaf.__repr__Ys*7#~~66#yy#zz+ +rcH |jt|jzSr)r`rgrr,s rrzLeaf.__unicode___s  {{S_,,rrccf |j|jf|j|jfk(Sr)r rr$s rr#zLeaf._eqjs*- 4::&5::u{{*CCCrc t|j|j|j|j|j ff|j Sr)rDr rr`rErrur,s rr-z Leaf.clonens@2DIItzz[[4;; "<=#'#6#68 8rc#K|ywrrr,s rrYz Leaf.leavests  sc#K |ywrrr,s rr0zLeaf.post_orderws8  c#K |ywrrr,s rr2zLeaf.pre_order{s7 rc |jSr)rr,s rr`z Leaf.prefixs ||rc2|j||_yr)r;rrs rr`z Leaf.prefixs  r)rjrkrlrrErrwr}rrprqrir#r-rYr0r2ror`rrrrrDrD=s1G F F "0&+ - & D8   ]]rrDc |\}}}}|s||jvr!t|dk(r|dSt|||St|||S)Nrr)rv) number2symbollenrsrD)grraw_noder rrvr8s rconvertrs]&."D%(42+++ x=A A; D(G44D%11rcBeZdZ dZdZdZdZdZdZddZ ddZ dZ y) BasePatternNc. tj|Srrrs rrzBasePattern.__new__sL~~c""rct|j|j|jg}|r|d |d=|r|d |jj ddj tt|dS)Nrzr{r|) rr contentrr!rjrrrepr)r%rs rr}zBasePattern.__repr__sd$))$dllDII>tBx'RtBx'>>22DIIc$o4NOOrc |Srrr,s roptimizezBasePattern.optimizes  rc |j|j|jk7ry|j,d}|i}|j||sy|r|j|||jr|||j<yr4)r r _submatchupdater)r%rGresultsrs rmatchzBasePattern.matchs|  99 TYY$))%; << #A">>$*q!  499!%GDII rcL t|dk7ry|j|d|S)NrFr)rr)r%nodesrs r match_seqzBasePattern.match_seqs, u:?zz%(G,,rc#PK i}|r|j|d|rd|fyyywrV)r)r%rrs rgenerate_matcheszBasePattern.generate_matchess6  TZZa!,Q$J-5s$&r) rjrkrlr rrrr}rrrrrrrrrs7  DG D# P 2-rrc$eZdZddZddZddZy) LeafPatternNc8 ||||_||_||_yr)r rr)r%r rrs rrwzLeafPattern.__init__s*        rcT t|tsytj|||SNF)r5rDrrr%rGrs rrzLeafPattern.match s'8$%  tW55rc6 |j|jk(Sr)rrrs rrzLeafPattern._submatchs ||tzz))rrr)rjrkrlrwrrrrrrrs(6 *rrc eZdZdZddZddZy) NodePatternFNc ||6t|}t|D]\}}t|tsd|_||_||_||_yrJ)r6rMr5WildcardPattern wildcardsr rr)r%r rrrNitems rrwzNodePattern.__init__$sY     7mG$W-4dO4%)DN.   rc |jrVt|j|jD]2\}}|t |jk(s||j |yyt |jt |jk7ryt |j|jD]\}}|j||ryyNTF)rrrr8rrzipr)r%rGrcr subpatternrSs rrzNodePattern._submatchAs  >>(t}}E1DMM***q) F  t|| DMM 2 2!$T\\4==!A J##E73"Brrr)rjrkrlrrwrrrrrr sI:rrcLeZdZ ddedfdZdZd dZd dZdZdZ d Z d Z y) rNrc | ttt|}|D]}||_||_||_||_yr)tuplerrminmaxr)r%rrrralts rrwzWildcardPattern.__init__ksE .  Cw/0Gw  rc d}|jEt|jdk(r-t|jddk(r|jdd}|jdk(r\|jdk(rM|jt |j S|)|j |j k(r|j S|jdkrt|trx|jdkri|j |j k(rPt|j|j|jz|j|jz|j S|S)Nrr)r) rrrrrrrr5r)r%rs rrzWildcardPattern.optimizes9 LL $   "s4<<?';q'@a+J 88q=TXX]||#" 22%499 +G!**,, HHMj_E NNa DII$@":#5#5#'88JNN#:#'88JNN#:#-??4 4 rc* |j|g|Sr)rrs rrzWildcardPattern.matchs5~~tfg..rc |j|D]L\}}|t|k(s|5|j||jrt |||j<yyr)rrrrr6)r%rrrrs rrzWildcardPattern.match_seqs\B))%0DAqCJ&NN1%yy-1%[ * 1rc #(K |jbt|jdtt||jzD](}i}|j r|d|||j <||f*y|j dk(r|j |yttdr#tj}tt_ |j|dD])\}}|j r|d|||j <||f+ ttdr t_ yy#t$r@|j|D])\}}|j r|d|||j <||f+YewxYw#ttdr t_ wwxYww)Nr bare_name getrefcountr)rrangerrrr_bare_name_matcheshasattrrpstderrr_recursive_matches RuntimeError_iterative_matches)r%rcountr save_stderrs rrz WildcardPattern.generate_matchessi  << txxSUTXX-F)FG99#(%=AdiiLQh H YY+ %))%0 0 sM*!jj %Z  - $ 7 7q AHE1yy',Ve}$)) (N!B3 .!,CJ/  #!% 7 7 >HE1yy',Ve}$)) (N!? #3 .!,CJ/s=CF >D%E1F%AE.+E1-E..E11FFc#K t|}d|jk\rdifg}|jD]/}t||D]\}}||f|j ||f 1|rg}|D]\}} ||ks ||j ks|jD]b}t|||dD]N\} } | dkDs i}|j | |j | || z|f|j || z|fPd|}|ryywrC)rrrrr:rr) r%rnodelenrrrr new_resultsc0r0c1r1s rrz"WildcardPattern._iterative_matchess 6e* =R%K<Dc d}i}d}t|}|sA||kr) __author__rpiorrrrrrrsrDrrrrrrrrrrrs3  6n-6n-`k4k\L4L\2&S&Sl)*+)*X:+:zy)ky)x [ F%rPKz1]I$__pycache__/__main__.cpython-312.pycnu[ {|jCHddlZddlmZejedy)N)mainz lib2to3.fixes)sysrexit)/usr/lib64/python3.12/lib2to3/__main__.pyr s o rPKz1]Zӝ(__pycache__/pygram.cpython-312.opt-2.pycnu[ {|j ddlZddlmZddlmZddlmZej jej je dZ ej jej je dZ Gdd e Z ejd e Ze eZej#Zej&d =ej#Zej&d =ejd e Ze eZy) N)token)driver)pytreez Grammar.txtzPatternGrammar.txtceZdZdZy)Symbolscd |jjD]\}}t|||y)N) symbol2numberitemssetattr)selfgrammarnamesymbols '/usr/lib64/python3.12/lib2to3/pygram.py__init__zSymbols.__init__s2 $11779LD& D$ ':N)__name__ __module__ __qualname__rrrrrs(rrlib2to3printexec)ospgen2rrrpathjoindirname__file__ _GRAMMAR_FILE_PATTERN_GRAMMAR_FILEobjectrload_packaged_grammarpython_grammarpython_symbolscopy!python_grammar_no_print_statementkeywords*python_grammar_no_print_and_exec_statementpattern_grammarpattern_symbolsrrrr.s-  RWW__X6 F  RWW__X%>%9; (f (.--iG($2$7$7$9!%..w7-N-S-S-U*.77?.&..y:OP/*rPKz1]T/(__pycache__/pytree.cpython-312.opt-1.pycnu[ {|jFmdZdZddlZddlmZdZiadZGddeZ Gd d e Z Gd d e Z d Z GddeZ Gdde ZGdde ZGdde ZGdde ZdZy)z Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here. z#Guido van Rossum N)StringIOictsDddlm}|jj D]!\}}t |t k(s|t|<#tj||S)N)python_symbols) _type_reprspygramr__dict__itemstypeint setdefault)type_numrnamevals '/usr/lib64/python3.12/lib2to3/pytree.py type_reprrsO *(00668ID#CyCDS!19  ! !(H 55ceZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZedZedZdZdZdZej6dkrdZyy)Basez Abstract base class for Node and Leaf. This provides some default functionality and boilerplate using the template pattern. A node may be a subnode of at most one parent. NFc,tj|S)z7Constructor that prevents Base from being instantiated.object__new__clsargskwdss rrz Base.__new__1~~c""rc`|j|jurtS|j|S)zW Compare two nodes for equality. This calls the method _eq(). ) __class__NotImplemented_eqselfothers r__eq__z Base.__eq__6s( >> 0! !xxrct)a_ Compare two nodes for equality. This is called by __eq__ and __ne__. It is only called if the two nodes have the same type. This must be implemented by the concrete subclass. Nodes should be considered equal if they have the same structure, ignoring the prefix string and other context information. NotImplementedErrorr$s rr#zBase._eqBs "!rct)zr Return a cloned (deep) copy of self. This must be implemented by the concrete subclass. r)r%s rclonez Base.cloneM "!rct)zx Return a post-order iterator for the tree. This must be implemented by the concrete subclass. r)r,s r post_orderzBase.post_orderUr.rct)zw Return a pre-order iterator for the tree. This must be implemented by the concrete subclass. r)r,s r pre_orderzBase.pre_order]r.rcRt|ts|g}g}d}|jjD]-}||ur||j |d}|j |/|jj ||j_|D]}|j|_d|_y)z/Replace this node with a new one in the parent.FNT) isinstancelistparentchildrenextendappendchanged)r%new l_childrenfoundchxs rreplacez Base.replacees#t$%C ++&&BTz?%%c*!!"%' ) A{{AH rc|}t|ts-|jsy|jd}t|ts-|jS)z9Return the line number which generated the invocant node.Nr)r4Leafr7linenor%nodes r get_linenozBase.get_lineno|sAT4(====#DT4({{rc^|jr|jjd|_y)NT)r6r: was_changedr,s rr:z Base.changeds! ;; KK   !rc|jrht|jjD]E\}}||us |jj|jj|=d|_|cSyy)z Remove the node from the tree. Returns the position of the node in its parent's children before it was removed. N)r6 enumerater7r:)r%irEs rremovez Base.removesb ;;$T[[%9%9:44<KK'') ,,Q/"&DKH ; rc|jyt|jjD](\}}||us |jj|dzcSy#t$rYywxYw)z The node immediately following the invocant in their parent's children list. If the invocant does not have a next sibling, it is None Nr)r6rJr7 IndexErrorr%rKchilds r next_siblingzBase.next_siblingsi ;; "$++"6"67HAu} ;;//!448"  sA A&%A&c|jyt|jjD].\}}||us |dk(ry|jj|dz cSy)z The node immediately preceding the invocant in their parent's children list. If the invocant does not have a previous sibling, it is None. Nrr)r6rJr7rOs r prev_siblingzBase.prev_siblingsZ ;; "$++"6"67HAu}6{{++AaC00 8rc#bK|jD]}|jEd{y7wN)r7leavesr%rPs rrVz Base.leavess&]]E||~ % %# %s #/-/cV|jyd|jjzS)Nrr)r6depthr,s rrYz Base.depths' ;; 4;;$$&&&rc8|j}|y|jS)z Return the string immediately following the invocant node. This is effectively equivalent to node.next_sibling.prefix )rQprefix)r%next_sibs r get_suffixzBase.get_suffixs" $$  rrc6t|jdS)Nascii)strencoder,s r__str__z Base.__str__st9##G, ,r)__name__ __module__ __qualname____doc__r r6r7rH was_checkedrr'__hash__r#r-r0r2r@rFr:rLpropertyrQrSrVrYr^sys version_inforerrrrrs D FHKK# H """".    1 1&'  &  -!rrceZdZdZ ddZdZdZejdkDreZ dZ dZ d Z d Z ed Zej d Zd ZdZdZy)Nodez+Concrete implementation for interior nodes.Nc||_t||_|jD] }||_ |||_|r |dd|_yd|_y)z Initializer. Takes a type constant (a symbol number >= 256), a sequence of child nodes, and an optional context keyword argument. As a side effect, the parent pointers of the children are updated. N)r r5r7r6r\fixers_applied)r%r r7contextr\rrr>s r__init__z Node.__init__sR X --BBI    DK "0"3D "&D rcz|jjdt|jd|jdSz)Return a canonical string representation.(, ))r!rfrr r7r,s r__repr__z Node.__repr__s,#~~66(3#}}. .rcTdjtt|jS)k Return a pretty string representation. This reproduces the input source exactly. r[)joinmaprcr7r,s r __unicode__zNode.__unicode__s wws3 .//rr_cd|j|jf|j|jfk(SzCompare two nodes for equality.)r r7r$s rr#zNode._eqs' 4==)ejj%..-IIIrct|j|jDcgc]}|jc}|jScc}wz$Return a cloned (deep) copy of self.)rr)rpr r7r-rr)r%r>s rr-z Node.clones<DIIT]]C]r ]C#'#6#68 8CsA c#jK|jD]}|jEd{|y7 wz*Return a post-order iterator for the tree.N)r7r0rWs rr0zNode.post_orders0]]E'') ) )#  *s #31 3c#jK||jD]}|jEd{y7wz)Return a pre-order iterator for the tree.N)r7r2rWs rr2zNode.pre_order s, ]]E( ( (# (s '313cN|jsy|jdjS)zO The whitespace and comments preceding this node in the input. r[rr7r\r,s rr\z Node.prefixs# }}}}Q&&&rcF|jr||jd_yyNrrr%r\s rr\z Node.prefixs ==&,DMM!  # rcx||_d|j|_||j|<|jy)z Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. N)r6r7r:rOs r set_childzNode.set_child s3  "& a  a rcj||_|jj|||jy)z Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. N)r6r7insertr:rOs r insert_childzNode.insert_child*s(   Q& rch||_|jj||jy)z Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately. N)r6r7r9r:rWs r append_childzNode.append_child3s&   U# rNNN)rfrgrhrirtrzrrmrnrer#r-r0r2rlr\setterrrrrrrrprps5 $'2. 0 & J8  ) '' ]]--rrpceZdZdZdZdZdZddgfdZdZdZ e jdkDre Z d Z d Zd Zd Zd ZedZej(dZy)rBz'Concrete implementation for leaf nodes.r[rNcx||\|_\|_|_||_||_|||_|dd|_y)z Initializer. Takes a type constant (a token number < 256), a string value, and an optional context keyword argument. N)_prefixrCcolumnr valuerr)r%r rrsr\rrs rrtz Leaf.__init__FsG  7> 4DL44;    !DL,Q/rch|jjd|jd|jdSrv)r!rfr rr,s rrzz Leaf.__repr__Ys'#~~66#yy#zz+ +rcF|jt|jzS)r|)r\rcrr,s rrzLeaf.__unicode___s {{S_,,rr_cd|j|jf|j|jfk(Sr)r rr$s rr#zLeaf._eqjs' 4::&5::u{{*CCCrct|j|j|j|j|j ff|j Sr)rBr rr\rCrrrr,s rr-z Leaf.clonens=DIItzz[[4;; "<=#'#6#68 8rc#K|ywrUrr,s rrVz Leaf.leavests  c#K|ywrrr,s rr0zLeaf.post_orderw  rc#K|ywrrr,s rr2zLeaf.pre_order{rrc|jS)zP The whitespace and comments preceding this token in the input. )rr,s rr\z Leaf.prefixs ||rc2|j||_yrU)r:rrs rr\z Leaf.prefixs  r)rfrgrhrirrCrrtrzrrmrnrer#r-rVr0r2rlr\rrrrrBrB=s1G F F "0&+ - & D8   ]]rrBc|\}}}}|s||jvr!t|dk(r|dSt|||St|||S)z Convert raw node information to a Node or Leaf instance. This is passed to the parser driver which calls it whenever a reduction of a grammar rule produces a new complete node, so that the tree is build strictly bottom-up. rr)rs) number2symbollenrprB)grraw_noder rrsr7s rconvertrsX&."D%(42+++ x=A A; D(G44D%11rcDeZdZdZdZdZdZdZdZdZ d dZ d dZ dZ y) BasePatterna A pattern is a tree matching pattern. It looks for a specific node type (token or symbol), and optionally for a specific content. This is an abstract base class. There are three concrete subclasses: - LeafPattern matches a single leaf node; - NodePattern matches a single node (usually non-leaf); - WildcardPattern matches a sequence of nodes of variable length. Nc,tj|S)z>Constructor that prevents BasePattern from being instantiated.rrs rrzBasePattern.__new__rrct|j|j|jg}|r|d |d=|r|d |jj ddj tt|dS)Nrwrxry) rr contentrr!rfr}r~repr)r%rs rrzzBasePattern.__repr__sd$))$dllDII>tBx'RtBx'>>22DIIc$o4NOOrc|S)z A subclass can define this as a hook for optimizations. Returns either self or another node with the same effect. rr,s roptimizezBasePattern.optimizes  rc|j|j|jk7ry|j,d}|i}|j||sy|r|j|||jr|||j<y)a# Does this pattern exactly match a node? Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. Default implementation for non-wildcard patterns. NFT)r r _submatchupdater)r%rEresultsrs rmatchzBasePattern.matchsw 99 TYY$))%; << #A">>$*q!  499!%GDII rcJt|dk7ry|j|d|S)z Does this pattern exactly match a sequence of nodes? Default implementation for non-wildcard patterns. rFr)rr)r%nodesrs r match_seqzBasePattern.match_seqs' u:?zz%(G,,rc#NKi}|r|j|d|rd|fyyyw)z} Generator yielding all matches for this pattern. Default implementation for non-wildcard patterns. rrN)r)r%rrs rgenerate_matcheszBasePattern.generate_matchess1  TZZa!,Q$J-5s#%rU) rfrgrhrir rrrrzrrrrrrrrrs7  DG D# P 2-rrc$eZdZddZddZddZy) LeafPatternNc6||||_||_||_y)ap Initializer. Takes optional type, content, and name. The type, if given must be a token type (< 256). If not given, this matches any *leaf* node; the content may still be required. The content, if given, must be a string. If a name is given, the matching node is stored in the results dict under that key. N)r rr)r%r rrs rrtzLeafPattern.__init__s%       rcRt|tsytj|||S)z*Override match() to insist on a leaf node.F)r4rBrrr%rErs rrzLeafPattern.match s$$%  tW55rc4|j|jk(S) Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. )rrrs rrzLeafPattern._submatchs||tzz))rrrU)rfrgrhrtrrrrrrrs(6 *rrc eZdZdZddZddZy) NodePatternFNc||6t|}t|D]\}}t|tsd|_||_||_||_y)ad Initializer. Takes optional type, content, and name. The type, if given, must be a symbol type (>= 256). If the type is None this matches *any* single node (leaf or not), except if content is not None, in which it only matches non-leaf nodes that also match the content pattern. The content, if not None, must be a sequence of Patterns that must match the node's children exactly. If the content is given, the type must not be None. If a name is given, the matching node is stored in the results dict under that key. NT)r5rJr4WildcardPattern wildcardsr rr)r%r rrrKitems rrtzNodePattern.__init__$sT    7mG$W-4dO4%)DN.   rc|jrVt|j|jD]2\}}|t |jk(s||j |yyt |jt |jk7ryt |j|jD]\}}|j||ryy)rTF)rrrr7rrzipr)r%rErcr subpatternrPs rrzNodePattern._submatchAs >>(t}}E1DMM***q) F  t|| DMM 2 2!$T\\4==!A J##E73"BrrrU)rfrgrhrrtrrrrrr sI:rrcNeZdZdZddedfdZdZd dZd dZdZ d Z d Z d Z y) ra A wildcard pattern can match zero or more nodes. This has all the flexibility needed to implement patterns like: .* .+ .? .{m,n} (a b c | d e | f) (...)* (...)+ (...)? (...){m,n} except it always uses non-greedy matching. Nrc| ttt|}|D]}||_||_||_||_y)a Initializer. Args: content: optional sequence of subsequences of patterns; if absent, matches one node; if present, each subsequence is an alternative [*] min: optional minimum number of times to match, default 0 max: optional maximum number of times to match, default HUGE name: optional name assigned to this match [*] Thus, if content is [[a, b, c], [d, e], [f, g, h]] this is equivalent to (a b c | d e | f g h); if content is None, this is equivalent to '.' in regular expression terms. The min and max parameters work as follows: min=0, max=maxint: .* min=1, max=maxint: .+ min=0, max=1: .? min=1, max=1: . If content is not None, replace the dot with the parenthesized list of alternatives, e.g. (a b c | d e | f g h)* N)tupler~rminmaxr)r%rrrralts rrtzWildcardPattern.__init__ks@0  Cw/0Gw  rcd}|jEt|jdk(r-t|jddk(r|jdd}|jdk(r\|jdk(rM|jt |j S|)|j |j k(r|j S|jdkrt|trx|jdkri|j |j k(rPt|j|j|jz|j|jz|j S|S)z+Optimize certain stacked wildcard patterns.Nrr)r) rrrrrrrr4r)r%rs rrzWildcardPattern.optimizes  LL $   "s4<<?';q'@a+J 88q=TXX]||#" 22%499 +G!**,, HHMj_E NNa DII$@":#5#5#'88JNN#:#'88JNN#:#-??4 4 rc(|j|g|S)z'Does this pattern exactly match a node?)rrs rrzWildcardPattern.matchs~~tfg..rc|j|D]L\}}|t|k(s|5|j||jrt |||j<yy)z4Does this pattern exactly match a sequence of nodes?TF)rrrrr5)r%rrrrs rrzWildcardPattern.match_seqsY))%0DAqCJ&NN1%yy-1%[ * 1rc #&K|jbt|jdtt||jzD](}i}|j r|d|||j <||f*y|j dk(r|j |yttdr#tj}tt_ |j|dD])\}}|j r|d|||j <||f+ ttdr t_ yy#t$r@|j|D])\}}|j r|d|||j <||f+YewxYw#ttdr t_ wwxYww)a" Generator yielding matches for a sequence of nodes. Args: nodes: sequence of nodes Yields: (count, results) tuples where: count: the match comprises nodes[:count]; results: dict containing named submatches. Nr bare_name getrefcountr)rrangerrrr_bare_name_matcheshasattrrmstderrr_recursive_matches RuntimeError_iterative_matches)r%rcountr save_stderrs rrz WildcardPattern.generate_matchessd << txxSUTXX-F)FG99#(%=AdiiLQh H YY+ %))%0 0 sM*!jj %Z  - $ 7 7q AHE1yy',Ve}$)) (N!B3 .!,CJ/  #!% 7 7 >HE1yy',Ve}$)) (N!? #3 .!,CJ/s=CF>D$E0F$AE-*E0,E--E00FFc#Kt|}d|jk\rdifg}|jD]/}t||D]\}}||f|j ||f 1|rg}|D]\}} ||ks ||j ks|jD]b}t|||dD]N\} } | dkDs i}|j | |j | || z|f|j || z|fPd|}|ryyw)z(Helper to iteratively yield the matches.rN)rrrrr9rr) r%rnodelenrrrr new_resultsc0r0c1r1s rrz"WildcardPattern._iterative_matchess e* =R%K<rs3  6n-6n-`k4k\L4L\2&S&Sl)*+)*X:+:zy)ky)x [ F%rPKz1]z,__pycache__/fixer_base.cpython-312.opt-1.pycnu[ {|j"`dZddlZddlmZddlmZddlmZGddeZ Gd d e Z y) z2Base class for fixers (optional, but recommended).N)PatternCompiler)pygram)does_tree_importceZdZdZdZdZdZdZdZe jdZ e Z dZdZdZdZdZdZej*ZdZdZd Zd Zd Zdd Zd ZddZdZdZ dZ!y)BaseFixaOptional base class for fixers. The subclass name must be FixFooBar where FooBar is the result of removing underscores and capitalizing the words of the fix name. For example, the class name for a fixer named 'has_key' should be FixHasKey. NrpostFc@||_||_|jy)aInitializer. Subclass may override. Args: options: a dict containing the options passed to RefactoringTool that could be used to customize the fixer through the command line. log: a list to append warnings and other messages to. N)optionslogcompile_pattern)selfr r s +/usr/lib64/python3.12/lib2to3/fixer_base.py__init__zBaseFix.__init__/s  c|j5t}|j|jd\|_|_yy)zCompiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match(). NT) with_tree)PATTERNrrpattern pattern_tree)rPCs rrzBaseFix.compile_pattern;sE << # "B.0.@.@KO/A/Q +DL$+ $rc||_y)zOSet the filename. The main refactoring tool should call this. N)filename)rrs r set_filenamezBaseFix.set_filenameFs ! rcJd|i}|jj||xr|S)aReturns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override. node)rmatchrrresultss rrz BaseFix.matchMs)4.||!!$0>"DN HHOO04==@ A  rc|j}|j}d|_d}|j|||fz|r|j|yy)aWarn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. zLine %d: could not convert: %sN) get_linenocloneprefixr1)rrreasonlineno for_outputmsgs rcannot_convertzBaseFix.cannot_convertzsV"ZZ\  .  334    V $ rcP|j}|jd||fzy)zUsed for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. z Line %d: %sN)r4r1)rrr7r8s rwarningzBaseFix.warnings(" &&)99:rc|j|_|j|tjd|_d|_y)zSome fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. rTN)r%r itertoolscountr(r.rtreers r start_treezBaseFix.start_trees4// (# q) rcy)zSome fixers need to maintain tree-wide state. This method is called once, at the conclusion of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. NrAs r finish_treezBaseFix.finish_trees r)xxx_todo_changemeN)"__name__ __module__ __qualname____doc__rrrr rr?r@r(setr%orderexplicit run_order _accept_typekeep_line_order BM_compatiblerpython_symbolssymsrrrrr#r,r1r;r=rCrFrErrrrsGGLGHiooa GJ EHILOM  D  Q! =$ ! %;  rrc,eZdZdZdZfdZdZxZS)ConditionalFixz@ Base class for fixers which not execute if an import is found. Nc4tt| |d|_yrH)superrWrC _should_skip)rargs __class__s rrCzConditionalFix.start_trees nd.5 rc|j |jS|jjd}|d}dj|dd}t ||||_|jS)N.)rZskip_onsplitjoinr)rrpkgr+s r should_skipzConditionalFix.should_skipsh    ($$ $ll  %2whhs3Bx ,S$=   r)rIrJrKrLr`rCrd __classcell__)r\s@rrWrWsJG!!rrW) rLr?patcomprr3r fixer_utilrobjectrrWrErrris59%(X fX v!W!rPKz1]//&__pycache__/main.cpython-312.opt-2.pycnu[ {|jN. ddlmZmZddlZddlZddlZddlZddlZddlZddl m Z dZ Gdde jZ dZd d Zy) )with_statementprint_functionN)refactorc | |j}|j}tj||||dddS)Nz (original)z (refactored))lineterm) splitlinesdifflib unified_diff)abfilenames %/usr/lib64/python3.12/lib2to3/main.py diff_textsrs>/ A A   1h ,n)+ --c:eZdZ dfd ZdZfdZdZxZS)StdoutRefactoringToolc  ||_||_|r2|jtjs|tjz }||_||_||_tt|+|||yN) nobackups show_diffsendswithossep_input_base_dir _output_dir_append_suffixsuperr__init__) selffixersoptionsexplicitrrinput_base_dir output_dir append_suffix __class__s rr zStdoutRefactoringTool.__init__$sf $#$ ."9"9"&&"A bff $N-%+ #T3FGXNrc|jj|||f|jj|g|i|yr)errorsappendloggererror)r!msgargskwargss r log_errorzStdoutRefactoringTool.log_errorAs9 Cv./ #///rc|}|jrw|j|jrAtjj |j|t |jd}ntd|d|j|jr||jz }||k7rhtjj|}tjj|s|rtj||jd|||jsQ|dz}tjj|r tj| tj"||t$t&|R}||||||jst+j,|||k7rt+j,||yy#t $r|jd|YwxYw#t $r|jd||YwxYw)Nz filename z( does not start with the input_base_dir zWriting converted %s to %s.z.bakzCan't remove backup %szCan't rename %s to %s)r startswithrrpathjoinlen ValueErrorrdirnameisdirmakedirs log_messagerlexistsremoveOSErrorrenamerr write_fileshutilcopymode) r!new_textrold_textencoding orig_filenamer&backupwriter(s rr@z StdoutRefactoringTool.write_fileEs   ""4#7#7877<<(8(8(0T5I5I1J1K(LN!)143G3G"IJJ    ++ +H H $2J77==, J'   :M% '~~&Fwwv&GIIf% L (F++T= h(H5~~ OOFH - H $ OOM8 4 %G$$%=vFG L  !8(FK Ls$GG%G"!G"%HHc|r|jd|y|jd||jrst|||} |jF|j5|D] }t |t j jdddy|D] }t |yy#1swYyxYw#t$rtd|dYywxYw)NzNo changes to %sz Refactored %szcouldn't encode z's diff for your terminal) r;rr output_lockprintsysstdoutflushUnicodeEncodeErrorwarn)r!oldnewrequal diff_lineslines r print_outputz"StdoutRefactoringTool.print_outputls    / :   _h 7'S(;  ''3!--(2 %d )3JJ,,..- %/D!$K%/.-*"%&s6B41B( B4B4(B1-B41B44CC)rrr)__name__ __module__ __qualname__r r1r@rV __classcell__)r(s@rrrs%BDO:0%5Nrrc@td|tjy)Nz WARNING: file)rKrLstderr)r.s rrPrPs 3 szz2rc  tjd}|jdddd|jdd d gd |jd ddddd|jddd gd |jdddd|jdddd|jdddd|jd d!dd"|jd#dd$|jd%d&dd'|jd(d)dd*d+ |jd,d-dd.d/d01|jd2d3dd4|jd5dd.d/d61d*}i}|j|\}}|jr#d7|d8<|j s t d9d7|_|jr|js|jd:|jr|js|jd;|j s|jr t d<|j s|jr|jd=|jr3td>tjD] }t||sy?|s7td@t j"AtdBt j"AyCdD|vr*d7}|j rtdEt j"AyC|j$rd7|dF<|j&rd7|dG<|j(rt*j,nt*j.}t+j0dH|It+j2dJ}t5tj6} t5fdK|j8D} t5} |j:rHd*} |j:D]!} | dLk(rd7} | j=dMz| z#| r| j?| n| }n| j?| }|jA| }tBjDjG|}|r]|jItBjJs>tBjDjM|stBjDjO|}|jr<|jQtBjJ}|jSdN|j|tUtW||tW| |j|j ||j|jO}|jXsV|r|j[n3 |j||j |j\|j^|jctetg|jXS#tj`$rtdPt j"AYywxYw)QNz2to3 [options] file|dir ...)usagez-dz--doctests_only store_truezFix up doctests only)actionhelpz-fz--fixr+z1Each FIX specifies a transformation; default: all)rbdefaultrcz-jz --processesstorerintzRun 2to3 concurrently)rbrdtypercz-xz--nofixz'Prevent a transformation from being runz-lz --list-fixeszList available transformationsz-pz--print-functionz0Modify the grammar so that print() is a functionz-ez--exec-functionz/Modify the grammar so that exec() is a functionz-vz --verbosezMore verbose loggingz --no-diffsz#Don't show diffs of the refactoringz-wz--writezWrite back modified filesz-nz --nobackupsFz&Don't write backups for modified filesz-oz --output-dirstrrzXPut output files in this directory instead of overwriting the input files. Requires -n.)rbrgrdrcz-Wz--write-unchanged-fileszYAlso write files even if no changes were required (useful with --output-dir); implies -w.z --add-suffixzuAppend this string to all output filenames. Requires -n if non-empty. ex: --add-suffix='3' will generate .py3 files.Twrite_unchanged_filesz&--write-unchanged-files/-W implies -w.z%Can't use --output-dir/-o without -n.z"Can't use --add-suffix without -n.z@not writing files and not printing diffs; that's not very usefulzCan't use -n without -wz2Available transformations for the -f/--fix option:rz1At least one file or directory argument required.r\zUse --help to show usage.-zCan't write to stdin.r exec_functionz%(name)s: %(message)s)formatlevelz lib2to3.mainc3.K|] }dz|zyw).fix_N).0fix fixer_pkgs r zmain..sLmsW,s2msallrpz7Output in %r will mirror the input directory %r layout.)r%r&r'z+Sorry, -j isn't supported on this platform.)4optparse OptionParser add_option parse_argsrirHrPr&rr- add_suffixno_diffs list_fixesrKrget_all_fix_namesrLr^rrlverboseloggingDEBUGINFO basicConfig getLoggersetget_fixers_from_packagenofixrsaddunion differencerr4 commonprefixrrr9r8rstripinforsortedr*refactor_stdin doctests_only processesMultiprocessingUnsupported summarizerfbool)rtr/parserrflagsr#fixnamernr, avail_fixesunwanted_fixesr$ all_presentrs requested fixer_namesr%rts` rmainrs` " ")F GF d-l13 dGHbNP dM'1 '>@ dIhDF dN<;= d.|MO d-lLN dK 13 l<@B dIl68 dM,CE dN7 (NO d5lAB nW5"GH N E%%d+MGT$$)-%&}} 9 : '"3"3 <='"3"3 9: ==W-- OP ==W.. ./ BC11) n-8'..rvv6 M&& 8  ; x(8   7#3#33)))!,,  .B 99       D'--1F1F#--/  tBII 66 C::'  s;2V.W  W r) __future__rrrLrr rrArwrrrMultiprocessRefactoringToolrrPrrqrrrsI6  -eH@@eN3L rPKz1]1ɖ66 __pycache__/main.cpython-312.pycnu[ {|jN.dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl m Z dZ Gdde jZd Zd d Zy) z Main program for 2to3. )with_statementprint_functionN)refactorc z|j}|j}tj||||dddS)z%Return a unified diff of two strings.z (original)z (refactored))lineterm) splitlinesdifflib unified_diff)abfilenames %/usr/lib64/python3.12/lib2to3/main.py diff_textsrs; A A   1h ,n)+ --c<eZdZdZ dfd ZdZfdZdZxZS)StdoutRefactoringToola2 A refactoring tool that can avoid overwriting its input files. Prints output to stdout. Output files can optionally be written to a different directory and or have an extra file suffix appended to their name for use in situations where you do not want to replace the input files. c ||_||_|r2|jtjs|tjz }||_||_||_tt|+|||y)aF Args: fixers: A list of fixers to import. options: A dict with RefactoringTool configuration. explicit: A list of fixers to run even if they are explicit. nobackups: If true no backup '.bak' files will be created for those files that are being refactored. show_diffs: Should diffs of the refactoring be printed to stdout? input_base_dir: The base directory for all input files. This class will strip this path prefix off of filenames before substituting it with output_dir. Only meaningful if output_dir is supplied. All files processed by refactor() must start with this path. output_dir: If supplied, all converted files will be written into this directory tree instead of input_base_dir. append_suffix: If supplied, all files output by this tool will have this appended to their filename. Useful for changing .py to .py3 for example by passing append_suffix='3'. N) nobackups show_diffsendswithossep_input_base_dir _output_dir_append_suffixsuperr__init__) selffixersoptionsexplicitrrinput_base_dir output_dir append_suffix __class__s rrzStdoutRefactoringTool.__init__$sa(#$ ."9"9"&&"A bff $N-%+ #T3FGXNrc|jj|||f|jj|g|i|yN)errorsappendloggererror)r msgargskwargss r log_errorzStdoutRefactoringTool.log_errorAs9 Cv./ #///rc|}|jrw|j|jrAtjj |j|t |jd}ntd|d|j|jr||jz }||k7rhtjj|}tjj|s|rtj||jd|||jsQ|dz}tjj|r tj| tj"||t$t&|R}||||||jst+j,|||k7rt+j,||yy#t $r|jd|YwxYw#t $r|jd||YwxYw)Nz filename z( does not start with the input_base_dir zWriting converted %s to %s.z.bakzCan't remove backup %szCan't rename %s to %s)r startswithrrpathjoinlen ValueErrorrdirnameisdirmakedirs log_messagerlexistsremoveOSErrorrenamerr write_fileshutilcopymode) r new_textrold_textencoding orig_filenamer%backupwriter's rr@z StdoutRefactoringTool.write_fileEs   ""4#7#7877<<(8(8(0T5I5I1J1K(LN!)143G3G"IJJ    ++ +H H $2J77==, J'   :M% '~~&Fwwv&GIIf% L (F++T= h(H5~~ OOFH - H $ OOM8 4 %G$$%=vFG L  !8(FK Ls$GG%G"!G"%HHc|r|jd|y|jd||jrst|||} |jF|j5|D] }t |t j jdddy|D] }t |yy#1swYyxYw#t$rtd|dYywxYw)NzNo changes to %sz Refactored %szcouldn't encode z's diff for your terminal) r;rr output_lockprintsysstdoutflushUnicodeEncodeErrorwarn)r oldnewrequal diff_lineslines r print_outputz"StdoutRefactoringTool.print_outputls    / :   _h 7'S(;  ''3!--(2 %d )3JJ,,..- %/D!$K%/.-*"%&s6B41B( B4B4(B1-B41B44CC)rrr) __name__ __module__ __qualname____doc__rr1r@rV __classcell__)r's@rrrs%BDO:0%5Nrrc@td|tjy)Nz WARNING: file)rKrLstderr)r.s rrPrPs 3 szz2rc  tjd}|jdddd|jdd d gd |jd ddddd|jddd gd |jdddd|jdddd|jdddd|jd d!dd"|jd#dd$|jd%d&dd'|jd(d)dd*d+ |jd,d-dd.d/d01|jd2d3dd4|jd5dd.d/d61d*}i}|j|\}}|jr#d7|d8<|j s t d9d7|_|jr|js|jd:|jr|js|jd;|j s|jr t d<|j s|jr|jd=|jr3td>tjD] }t||sy?|s7td@t j"AtdBt j"AyCdD|vr*d7}|j rtdEt j"AyC|j$rd7|dF<|j&rd7|dG<|j(rt*j,nt*j.}t+j0dH|It+j2dJ}t5tj6} t5fdK|j8D} t5} |j:rHd*} |j:D]!} | dLk(rd7} | j=dMz| z#| r| j?| n| }n| j?| }|jA| }tBjDjG|}|r]|jItBjJs>tBjDjM|stBjDjO|}|jr<|jQtBjJ}|jSdN|j|tUtW||tW| |j|j ||j|jO}|jXsV|r|j[n3 |j||j |j\|j^|jctetg|jXS#tj`$r/|j^dkDsJtdPt j"AYywxYw)QzMain program. Args: fixer_pkg: the name of a package where the fixers are located. args: optional; a list of command line arguments. If omitted, sys.argv[1:] is used. Returns a suggested exit status (0, 1, 2). z2to3 [options] file|dir ...)usagez-dz--doctests_only store_truezFix up doctests only)actionhelpz-fz--fixr+z1Each FIX specifies a transformation; default: all)rcdefaultrdz-jz --processesstorerintzRun 2to3 concurrently)rcretyperdz-xz--nofixz'Prevent a transformation from being runz-lz --list-fixeszList available transformationsz-pz--print-functionz0Modify the grammar so that print() is a functionz-ez--exec-functionz/Modify the grammar so that exec() is a functionz-vz --verbosezMore verbose loggingz --no-diffsz#Don't show diffs of the refactoringz-wz--writezWrite back modified filesz-nz --nobackupsFz&Don't write backups for modified filesz-oz --output-dirstrrzXPut output files in this directory instead of overwriting the input files. Requires -n.)rcrhrerdz-Wz--write-unchanged-fileszYAlso write files even if no changes were required (useful with --output-dir); implies -w.z --add-suffixzuAppend this string to all output filenames. Requires -n if non-empty. ex: --add-suffix='3' will generate .py3 files.Twrite_unchanged_filesz&--write-unchanged-files/-W implies -w.z%Can't use --output-dir/-o without -n.z"Can't use --add-suffix without -n.z@not writing files and not printing diffs; that's not very usefulzCan't use -n without -wz2Available transformations for the -f/--fix option:rz1At least one file or directory argument required.r]zUse --help to show usage.-zCan't write to stdin.r exec_functionz%(name)s: %(message)s)formatlevelz lib2to3.mainc3.K|] }dz|zyw).fix_N).0fix fixer_pkgs r zmain..sLmsW,s2msallrqz7Output in %r will mirror the input directory %r layout.)r$r%r&z+Sorry, -j isn't supported on this platform.)4optparse OptionParser add_option parse_argsrjrHrPr%rr- add_suffixno_diffs list_fixesrKrget_all_fix_namesrLr_rrmverboseloggingDEBUGINFO basicConfig getLoggersetget_fixers_from_packagenofixrtaddunion differencerr4 commonprefixrrr9r8rstripinforsortedr*refactor_stdin doctests_only processesMultiprocessingUnsupported summarizergbool)rur/parserrflagsr"fixnameror, avail_fixesunwanted_fixesr# all_presentrt requested fixer_namesr$rts` rmainrso " ")F GF d-l13 dGHbNP dM'1 '>@ dIhDF dN<;= d.|MO d-lLN dK 13 l<@B dIl68 dM,CE dN7 (NO d5lAB nW5"GH N E%%d+MGT$$)-%&}} 9 : '"3"3 <='"3"3 9: ==W-- OP ==W.. ./ BC11) n-8'..rvv6 M&& 8  ; x(8   7#3#33)))!,,  .B 99       D'--1F1F#--/  tBII 66 ((1,,,C::'  s:2V?WWr))rZ __future__rrrLrr rrArxrrrMultiprocessRefactoringToolrrPrrrrrrsI6  -eH@@eN3L rPKz1]>$PatternGrammar3.12.14.final.0.picklenu[}( symbol2number}(MatcherM AlternativeM AlternativesMDetailsM NegatedUnitMRepeaterMUnitMu number2symbol}(MhMhMhMhMhMhMh ustates](](]KKa]KKa]KKae](](KKK Ke](KKK KKKee](]K Ka](K KKKee](]K Ka]KKa]K Ka]KKae](]KKa](KKKKKKe]KKa](KKKKe]KKa]KKae](](KKKKKKe]KKa]KKa](KKKKe]KKa]KKae](](KKKKKKKKe]KKa]KKa](KKKKKKKKe](KKKKe]KKa]KKa](KKKKKK KKe]KKa](KKKKKK eeedfas}(Mh}(KKKKKKKKKKuMh}(KKKKKKKKKKuMh}(KKKKKKKKKKuMh#}K KsMh,}KKsMh<}(KKKKKKuMhL}(KKKKKKKKuulabels](KEMPTYMNKNKNK NKnotKNKNMNMNMNKNKNKNMNKNKNKNKNKNK NKNKNMNK Nekeywords}hKstokens}(KKKKK KKKKKKK KK KK KKKKKKKKKKK KKKKKK Ku symbol2label}( AlternativesK NegatedUnitKUnitK AlternativeK DetailsKRepeaterKustartMu.PKz1] ;;Grammar3.12.14.final.0.picklenu[;}( symbol2number}( file_inputMand_exprMand_testM annassignMarglistMargumentM arith_exprM assert_stmtM async_funcdefM async_stmtM atomM  augassignM  break_stmtM classdefM comp_forMcomp_ifM comp_iterMcomp_opM comparisonM compound_stmtM continue_stmtM decoratedM decoratorM decoratorsMdel_stmtM dictsetmakerMdotted_as_nameMdotted_as_namesM dotted_nameM encoding_declM eval_inputM except_clauseM exec_stmtM exprM! expr_stmtM"exprlistM#factorM$ flow_stmtM%for_stmtM&funcdefM' global_stmtM(if_stmtM)import_as_nameM*import_as_namesM+ import_fromM, import_nameM- import_stmtM.lambdefM/ listmakerM0namedexpr_testM1not_testM2 old_lambdefM3old_testM4or_testM5 parametersM6 pass_stmtM7powerM8 print_stmtM9 raise_stmtM: return_stmtM; shift_exprM< simple_stmtM= single_inputM>sliceopM? small_stmtM@ star_exprMAstmtMB subscriptMC subscriptlistMDsuiteMEtermMFtestMGtestlistMH testlist1MI testlist_gexpMJ testlist_safeMKtestlist_star_exprMLtfpdefMMtfplistMNtnameMOtrailerMPtry_stmtMQ typedargslistMR varargslistMSvfpdefMTvfplistMUvnameMV while_stmtMW with_itemMX with_stmtMYwith_varMZxor_exprM[ yield_argM\ yield_exprM] yield_stmtM^u number2symbol}(MhMhMhMhMhMhMh Mh Mh M h M h M hM hM hMhMhMhMhMhMhMhMhMhMhMhMhMhMhMhMh Mh!Mh"M h#M!h$M"h%M#h&M$h'M%h(M&h)M'h*M(h+M)h,M*h-M+h.M,h/M-h0M.h1M/h2M0h3M1h4M2h5M3h6M4h7M5h8M6h9M7h:M8h;M9hM<h?M=h@M>hAM?hBM@hCMAhDMBhEMChFMDhGMEhHMFhIMGhJMHhKMIhLMJhMMKhNMLhOMMhPMNhQMOhRMPhSMQhTMRhUMShVMThWMUhXMVhYMWhZMXh[MYh\MZh]M[h^M\h_M]h`M^haustates](](](KKKKKKe]KKae](]K*Ka](K+KKKee](]K,Ka](K-KKKee](]K.Ka]K/Ka](K0KKKe]K/Ka]KKae](]K1Ka](K2KKKe](K1KKKee](](KKK3KK/Ke]K/Ka](K4KK0KK5KKKe]KKae](]K6Ka](KKKKKKee](]K Ka]K/Ka](K2KKKe]K/Ka]KKae](]K%Ka]K7Ka]KKae](]K%Ka](K8KK7KK9Ke]KKae](](KKKKK KK KK#KK'KK(KK)Ke](K:KK;KKK e]K?K a](K@KKAK e]KKa](K)KKKe]K:Ka]KKa]K=Ka]K Ka]K@Kae](](KBKKCKKDKKEKKFKKGKKHKKIKKJKKKKKLKKMKKNKe]KKae](]K Ka]KKae](]KKa]K'Ka](KKK.Ke](K:KKOKe]KPKa]K.Ka]K:Ka]KKae](](KKK%Ke]KQKa]KKa]KRKa]KSKa](KTKKKe]KKae](]KKa]KUKa](KTKKKe]KKae](](K5KKVKe]KKae](](KWKKXKKYKKWKKZKK[KK\KKRKK]KKKe]KKa](KKKKe]KRKae](]K^Ka](K_KKKee](](K`KKaKKbKK8KK7KKcKKdKKeKK9Ke]KKae](]KKa]KKae](]KfKa](KgKKaKK7Ke]KKae](]K Ka]KhKa](KKKKe](K:KKOKe]KKa]KKa]K:Kae](]KiKa](KiKKKee](]KKa]KQKa]KKae](](K3KKjKK/Ke]K^Ka](K2KK5KKKe](K2KK.KK5KKKe](K2KK5KKKe](KjK K/K KKe]KKa]K/Ka](K3K K/K KKe](K2KKK e]K^K a]K.K a](K2KKK e]K/K ae](]KhKa](KkKKKe]K'Ka]KKae](]KlKa](K2KKKee](]K'Ka](KKKKee](]K'Ka]KKae](]KmKa](KKKKe]KKae](]KnKa](K/KKKe](K2KKkKKKe]K/Ka]KKae](]KKa]K^Ka](KRKKKe]K/Ka](K2KKKe]K/Ka]KKae](]KoKa](KpKKKee](]KqKa](K0KKrKKsKKKe](KqKKjL}(KKKKKKKKKKK KK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK KK!KK"KK#KK$KK%KK&KK'KKKK(KK)KuM?jU}K.KsM@j]}(KKKKKKKKKKK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKK"KK#KK$KK&KK'KK(KK)KuMAjj}KKsMBjq}(KKKKKKKKKKK KK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK KK!KK"KK#KK$KK%KK&KK'KK(KK)KuMCjw}(KKKKKKKKK.KK KK KKKKKK#KK$KK&KK'KK(KK)KuMDj}(KKKKKKKKK.KK KK KKKKKK#KK$KK&KK'KK(KK)KuMEj}(KKKKKKKKKKK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKK"KK#KK$KK&KK'KKKK(KK)KuMFj}(KKKKKKKKK KK KK#KK$KK&KK'KK(KK)KuMGj}(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMHj}(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMIj}(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMJj}(KKKKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMKj}(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMLj}(KKKKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMMj}(KKK'KuMNj}(KKK'KuMOj}K'KsMPj }(KKKKK KuMQj}KKsMRj>}(KKKKK3KK'KuMSj}(KKKKK3KK'KuMTj}(KKK'KuMUj}(KKK'KuMVj}K'KsMWj}K KsMXj}(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMYj}K!KsMZj}KkKsM[j}(KKKKKKKKK KK KK#KK$KK&KK'KK(KK)KuM\j!}(KKKKKKKKKKK KK KKKKKKKK#KK$KK&KK'KK(KK)KuM]j)}K"KsM^j1}K"Ksulabels](KEMPTYKNKNMBNKNKNKNKNKNK2NK NKNKassertKbreakKclassKcontinueKdefKdelKexecKforKfromKglobalKifKimportKlambdaKnonlocalKnotKpassKprintKraiseKreturnKtryKwhileKwithKyieldKNK NK9NK8NKNKNKNM<NKNM2NKandK NMGNKNMNK NK$NK;NMNMFNM'NM&NMYNKNMJNM]NK NM0NMINKNMNK)NK*NK/NK'NK%NK&NK1NK(NK-NK.NK3NK,NK+NMNMENM#NKinMKNMNM4NMNKNKNKNKNKNKNKisM!NMNM NM NMNM)NMQNMWNMNMNMNMNMANKasMNMHNKexceptM[NKNMLNMNM NM8NM$NM NMNM:NM;NM^NKelseM6NK7NM1NKelifM*NM+NMNM,NM-NMSNMNM3NM5NMNKorMRNM NMPNK#NMNK"NM@NK NMNM=NMNMNM NM"NM%NM(NM.NM7NM9NM?NMCNKNKNKNKNK0NM/NMONMNNMMNMDNKfinallyMNMTNMVNMUNMXNMNK!NM\Nekeywords}(jK jK j Kj Kj KjKjKjKjKjKjKjKjKjKj!Kj#Kj%Kj'Kj)Kj+Kj-K j/K!j1K"j=K-jcKRjoK]j~KkjKnjK{jKjKjKutokens}(KKKKKKKKKKKKKKK2K K K KK KK#K K$K9K%K8K&KK'KK(KK)KK+K K.KK0K K2K$K3K;K4KK:K K=KK@K)KBK*KCK/KDK'KEK%KFK&KGK1KHK(KIK-KJK.KKK3KLK,KMK+KNKKWKKXKKYKKZKK[KK\KKpK7K}K#KK"KK KKKKKKKKKK0KK!Ku symbol2label}(stmtK shift_exprK*not_testK,testK/argumentK1comp_forK5termK6funcdefK7for_stmtK8 with_stmtK9 testlist_gexpK; yield_exprK< listmakerK> testlist1K? dictsetmakerKAarglistKOsuiteKPexprlistKQ testlist_safeKS comp_iterKTold_testKUcomp_ifKVexprK^comp_opK_ async_stmtK`classdefKa decoratedKbif_stmtKctry_stmtKd while_stmtKe decoratorsKf async_funcdefKg dotted_nameKh decoratorKi star_exprKjdotted_as_nameKltestlistKmxor_exprKotestlist_star_exprKq annassignKr augassignKspowerKtfactorKu break_stmtKv continue_stmtKw raise_stmtKx return_stmtKy yield_stmtKz parametersK|namedexpr_testK~import_as_nameKimport_as_namesKdotted_as_namesK import_fromK import_nameK varargslistK comparisonK old_lambdefKor_testKand_testK typedargslistKatomKtrailerK arith_exprK small_stmtK compound_stmtK simple_stmtK assert_stmtKdel_stmtK exec_stmtK expr_stmtK flow_stmtK global_stmtK import_stmtK pass_stmtK print_stmtKsliceopK subscriptKlambdefKtnameKtfplistKtfpdefK subscriptlistK except_clauseKvfpdefKvnameKvfplistK with_itemKand_exprK yield_argKustartMu.PKz1]+##2fixes/__pycache__/fix_urllib.cpython-312.opt-1.pycnu[ {|j dZddlmZmZddlmZmZmZmZm Z m Z m Z dgdfdgdfdd gfgdgd fdd d gfgd Z e dje dddZGddeZy)zFix 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.request) URLopenerFancyURLopener urlretrieve _urlopenerurlopen urlcleanup pathname2url url2pathname getproxiesz urllib.parse)quote quote_plusunquote unquote_plus urlencode splitattr splithost splitnport splitpasswd splitport splitquerysplittag splittype splituser splitvaluez urllib.errorContentTooShortError)rinstall_opener build_openerRequestOpenerDirector BaseHandlerHTTPDefaultErrorHandlerHTTPRedirectHandlerHTTPCookieProcessor ProxyHandlerHTTPPasswordMgrHTTPPasswordMgrWithDefaultRealmAbstractBasicAuthHandlerHTTPBasicAuthHandlerProxyBasicAuthHandlerAbstractDigestAuthHandlerHTTPDigestAuthHandlerProxyDigestAuthHandler HTTPHandler HTTPSHandler FileHandler FTPHandlerCacheFTPHandlerUnknownHandlerURLError HTTPError)urlliburllib2r?r>c #Kt}tjD]N\}}|D]D}|\}}t|}d|d|dd|d|d|dd|zd |zd |d |d FPyw) Nzimport_name< 'import' (module=zB | dotted_as_names< any* module=z any* >) > zimport_from< 'from' mod_member=z* 'import' ( member=z | import_as_name< member=z] '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 > > zpower< bare_with_attr=z trailer< '.' member=z > any* > )setMAPPINGitemsr)bare old_modulechangeschange new_modulememberss 1/usr/lib64/python3.12/lib2to3/fixes/fix_urllib.py build_patternrL0s 5D&}} GF"( J )G$Z1 1 $Wg7 7"# #"# # $W. .! /sA1A3c*eZdZdZdZdZdZdZy) FixUrllibc4djtS)N|)joinrL)selfs rKrLzFixUrllib.build_patternIsxx ((cR|jd}|j}g}t|jddD]+}|j t |d|t g-|jt t|jdd||j|y)zTransform for the basic import case. Replaces the old import name with a comma separated list of its replacements. moduleNrprefix) getrXrCvalueextendrrappendreplace)rRnoderesults import_modprefnamesnames rKtransform_importzFixUrllib.transform_importLs [[*   J,,-cr2D LL$tAwt4eg> ?3 T'*"2"23B7:4HI5!rScD|jd}|j}|jd}|ryt|tr|d}d}t|j D]}|j |dvs|d}n|r|j t||y|j|dyg}i} |d} | D]}|jtjk(r3|jd j } |jdj } n|j } d} | d k7sgt|j D]I}| |dvs |d| vr|j|d| j|dgj|Kg} t|}d }d }|D]}| |}g}|dd D]3}|j!||||jt#5|j!||d |t%||}|r%|j&jj)|r||_| j|d}| rMg}| dd D]}|j!|t+g|j| d |j |y|j|dy)zTransform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module. mod_membermemberrNr@rW!This is an invalid module elementrJ,Tc\|jtjk(rxt|jdj ||jdj |jdj g}ttj|gSt|j |gS)NrrWr@ri)typer import_as_namerchildrenrZcloner )rcrXkidss rK handle_namez/FixUrllib.transform_member..handle_names99 3 33 q!1!7!7G MM!,224 MM!,2246D!!4!4d;<<TZZ788rSrVFzAll module elements are invalid)rYrX isinstancelistrCrZr]rcannot_convertrlr rmrnr\ setdefaultr r[rrparentendswithr)rRr^r_rfrargnew_namerHmodulesmod_dictrJas_name member_name new_nodes indentationfirstrqrUeltsrbeltnewnodesnew_nodes rKtransform_memberzFixUrllib.transform_member\s [[.   X& &$'H!*"2"23<<6!9,%ayH4""4#>?##D*MN GHi(G!;;$"5"55$ooa066G"(//!"4":":K"(,,K"G#%")**:*:";&&)3%ay8 'vay 9$//q 2>EEfM #<"I*40KE 9"'9CLLS$!78LL)% [b489 / 2 2 ; ;K H!,CJ  %" )#2HLL(GI!67!/ Yr]+ U###D*KLrScL|jd}|jd}d}t|tr|d}t|jD]}|j|dvs|d}n|r'|j t ||jy|j|dy)z.Transform for calls to module members in code.bare_with_attrrgNrr@rWrh) rYrrrsrCrZr]rrXrt)rRr^r_ module_dotrgrxrHs rK transform_dotzFixUrllib.transform_dots[[!12 X& fd #AYFj../F||vay(!!90    tH+5+<+< > ?   &I JrScl|jdr|j||y|jdr|j||y|jdr|j||y|jdr|j |dy|jdr|j |dyy)NrUrfr module_starzCannot handle star imports. module_asz#This module is now multiple modules)rYrdrrrt)rRr^r_s rK transformzFixUrllib.transforms ;;x  ! !$ 0 [[ &  ! !$ 0 [[) *   tW - [[ '   &C D [[ %   &K L&rSN)__name__ __module__ __qualname__rLrdrrrrSrKrNrNGs )" JMXK" MrSrNN)__doc__lib2to3.fixes.fix_importsrrlib2to3.fixer_utilrrrrr r r rCr\rLrNrrSrKrs=>>>"CD ?@  +,. /" ' ( -/  B '(+A./..}M }MrSPKz1]]ž((/fixes/__pycache__/fix_metaclass.cpython-312.pycnu[ {|j dZddlmZddlmZddlmZmZmZdZ dZ dZ dZ d Z d ZGd d ejZy )aFixer for __metaclass__ = X -> (metaclass=X) methods. The various forms of classef (inherits nothing, inherits once, inherits 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)symsNodeLeafc|jD]}|jtjk(r t |cS|jtj k(sK|jsX|jd}|jtj k(s|js|jd}t|ts|jdk(syy)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_node left_sides 4/usr/lib64/python3.12/lib2to3/fixes/fix_metaclass.pyrrs  99 " & & YY$** *t}} a(I~~/I4F4F%..q1 i.!?:  c|jD]!}|jtjk(s!yt |jD]$\}}|jt j k(s$n tdttjg}|j|dzdrT|j|dz}|j|j|j|j|dzdrT|j||}y)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_nodes rfixup_parse_treer$-s!! 99 " " X../4 99 # 0566 R E   AaCD !%%ac*  9??,-   AaCD ! % Drcxt|jD]$\}}|jtjk(s$ny|j t tjg}t tj|g}|j|drN|j|}|j|j|j |j|drN|j|||jdjd}|jdjd} | j|_ y)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 rSEMIr rrrrrr insert_childprefix) rr" stmt_nodesemi_indrnew_exprnew_stmtr# new_leaf1 old_leaf1s rfixup_simple_stmtr/Gs  $I$6$67$ 99 " 8 KKMDNNB'HD$$xj1H   XY '&&x0 ioo/0   XY ' 8$!!!$--a0I""1%..q1I ''Irc|jrI|jdjtjk(r|jdj yyy)N)r r rNEWLINEr )rs rremove_trailing_newliner3_s@ }}r*//5==@ b  "A}rc#6K|jD]!}|jtjk(s!n t dt t |jD]\}}|jtjk(s$|js1|jd}|jtjk(s^|jsk|jd}t|ts|jdk(st|||t||||fyw)NzNo class suite!r r )r r rr rlistrrrrrrr/r3)r!rr" simple_noder left_nodes r find_metasr8ds!! 99 " "*++y78;   t// /K4H4H#,,Q/I~~/I4F4F%..q1 i.!?:%dA{;+K8K009s/-DAD D ,D: DD'D7"Dc~|jddd}|r1|j}|jtjk(rn|r1|rv|j}t |t r1|jtjk7r|jrd|_y|j|jddd|ruyy)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 Nr1) r popr rINDENTrrDEDENTr(extend)r kidsrs r fixup_indentr@{s >>$B$ D xxz 99 $   xxz dD !dii5<<&?{{   KK dd+ , rceZdZdZdZdZy) FixMetaclassTz classdef ct|syt|d}t|D]\}}}|}|j|jdj }t |jdk(r|jdj tjk(r|jd}n4|jdj} ttj| g}|jd|nt |jdk(r-ttjg}|jd|nt |jdk(rttjg}|jdttjd|jd||jdttj dn t#d |jdjd} d | _| j&} |jr1|j)ttj*d d | _nd | _|jd} | j tj,k(sJd | jd_d | jd_|j)|t/|js^|jt|d} | | _|j)| |j)ttj0dyt |jdkDr|jdj tj2k(rt|jdj tj4k(rIt|d} |jd| |jdttj0dyyyy)Nr r)(zUnexpected class definition metaclass, r:rpass r1)rr$r8r r r lenrarglistrr set_childr'rrRPARLPARrrr(rCOMMArr@r2r<r=)selfrresultslast_metaclassr r"stmt text_typerQrmeta_txtorig_meta_prefixr pass_leafs r transformzFixMetaclass.transformsT" (.NE1d!N KKM/MM!$))  t}}  "}}Q$$ 4--*q)//1t||fX6q'*  1 $4<<,G   a )  1 $4<<,G   aejj#!6 7   a )   aejj#!6 7:; ;"**1-66q9$#??     ekk3!7 8!HO HO#++A. ~~///') 1$') 1$^,U~~ LLNY/I/I    i (   d5==$7 8  1 $..$))U\\9..$))U\\9Y/I   r9 -   r4 t#< = ::%rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr^rrrBrBsMGL>rrBN)__doc__r:rpygramr fixer_utilrrrrr$r/r3r8r@BaseFixrBrdrrrisJ())&4(0# 1.-,S>:%%S>rPKz1] n n 1fixes/__pycache__/fix_apply.cpython-312.opt-2.pycnu[ {|j* h ddlmZddlmZddlmZddlmZmZmZGddejZ y))pytree)token) fixer_base)CallComma parenthesizeceZdZdZdZdZy)FixApplyTa. power< 'apply' trailer< '(' arglist< (not argument ')' > > c|j}|d}|d}|jd}|r?|j|jjk(r|jdj dvry|r@|j|jjk(r|jdj dk(ry|j }|j}|jtj|jfvrN|j|jk7s*|jdjtjk(r t|}d|_|j}d|_||j}d|_tjtj d |g}|H|j#t%tjtjd|gd |d_t'||| S) Nfuncargskwds>***rr )prefix)symsgettypeargumentchildrenvaluerclonerNAMEatompower DOUBLESTARrrLeafSTARextendrr) selfnoderesultsrr r rr l_newargss 0/usr/lib64/python3.12/lib2to3/fixes/fix_apply.py transformzFixApply.transformsyyvv{{6"  TYY/// a &&+5 TYY$))"4"44]]1%++t3 zz| IIejj$))4 4 YY$** $ ]]2  # #u'7'7 7%D zz|  ::r4s-9 2264z!!64r*PKz1]+##,fixes/__pycache__/fix_urllib.cpython-312.pycnu[ {|j dZddlmZmZddlmZmZmZmZm Z m Z m Z dgdfdgdfdd gfgdgd fdd d gfgd Z e dje dddZGddeZy)zFix 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.request) URLopenerFancyURLopener urlretrieve _urlopenerurlopen urlcleanup pathname2url url2pathname getproxiesz urllib.parse)quote quote_plusunquote unquote_plus urlencode splitattr splithost splitnport splitpasswd splitport splitquerysplittag splittype splituser splitvaluez urllib.errorContentTooShortError)rinstall_opener build_openerRequestOpenerDirector BaseHandlerHTTPDefaultErrorHandlerHTTPRedirectHandlerHTTPCookieProcessor ProxyHandlerHTTPPasswordMgrHTTPPasswordMgrWithDefaultRealmAbstractBasicAuthHandlerHTTPBasicAuthHandlerProxyBasicAuthHandlerAbstractDigestAuthHandlerHTTPDigestAuthHandlerProxyDigestAuthHandler HTTPHandler HTTPSHandler FileHandler FTPHandlerCacheFTPHandlerUnknownHandlerURLError HTTPError)urlliburllib2r?r>c #Kt}tjD]N\}}|D]D}|\}}t|}d|d|dd|d|d|dd|zd |zd |d |d FPyw) Nzimport_name< 'import' (module=zB | dotted_as_names< any* module=z any* >) > zimport_from< 'from' mod_member=z* 'import' ( member=z | import_as_name< member=z] '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 > > zpower< bare_with_attr=z trailer< '.' member=z > any* > )setMAPPINGitemsr)bare old_modulechangeschange new_modulememberss 1/usr/lib64/python3.12/lib2to3/fixes/fix_urllib.py build_patternrL0s 5D&}} GF"( J )G$Z1 1 $Wg7 7"# #"# # $W. .! /sA1A3c*eZdZdZdZdZdZdZy) FixUrllibc4djtS)N|)joinrL)selfs rKrLzFixUrllib.build_patternIsxx ((cR|jd}|j}g}t|jddD]+}|j t |d|t g-|jt t|jdd||j|y)zTransform for the basic import case. Replaces the old import name with a comma separated list of its replacements. moduleNrprefix) getrXrCvalueextendrrappendreplace)rRnoderesults import_modprefnamesnames rKtransform_importzFixUrllib.transform_importLs [[*   J,,-cr2D LL$tAwt4eg> ?3 T'*"2"23B7:4HI5!rScD|jd}|j}|jd}|ryt|tr|d}d}t|j D]}|j |dvs|d}n|r|j t||y|j|dyg}i} |d} | D]}|jtjk(r3|jd j } |jdj } n|j } d} | d k7sgt|j D]I}| |dvs |d| vr|j|d| j|dgj|Kg} t|}d }d }|D]}| |}g}|dd D]3}|j!||||jt#5|j!||d |t%||}|r%|j&jj)|r||_| j|d}| rMg}| dd D]}|j!|t+g|j| d |j |y|j|dy)zTransform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module. mod_membermemberrNr@rW!This is an invalid module elementrJ,Tc\|jtjk(rxt|jdj ||jdj |jdj g}ttj|gSt|j |gS)NrrWr@ri)typer import_as_namerchildrenrZcloner )rcrXkidss rK handle_namez/FixUrllib.transform_member..handle_names99 3 33 q!1!7!7G MM!,224 MM!,2246D!!4!4d;<<TZZ788rSrVFzAll module elements are invalid)rYrX isinstancelistrCrZr]rcannot_convertrlr rmrnr\ setdefaultr r[rrparentendswithr)rRr^r_rfrargnew_namerHmodulesmod_dictrJas_name member_name new_nodes indentationfirstrqrUeltsrbeltnewnodesnew_nodes rKtransform_memberzFixUrllib.transform_member\s [[.   X& &$'H!*"2"23<<6!9,%ayH4""4#>?##D*MN GHi(G!;;$"5"55$ooa066G"(//!"4":":K"(,,K"G#%")**:*:";&&)3%ay8 'vay 9$//q 2>EEfM #<"I*40KE 9"'9CLLS$!78LL)% [b489 / 2 2 ; ;K H!,CJ  %" )#2HLL(GI!67!/ Yr]+ U###D*KLrScL|jd}|jd}d}t|tr|d}t|jD]}|j|dvs|d}n|r'|j t ||jy|j|dy)z.Transform for calls to module members in code.bare_with_attrrgNrr@rWrh) rYrrrsrCrZr]rrXrt)rRr^r_ module_dotrgrxrHs rK transform_dotzFixUrllib.transform_dots[[!12 X& fd #AYFj../F||vay(!!90    tH+5+<+< > ?   &I JrScl|jdr|j||y|jdr|j||y|jdr|j||y|jdr|j |dy|jdr|j |dyy)NrUrfr module_starzCannot handle star imports. module_asz#This module is now multiple modules)rYrdrrrt)rRr^r_s rK transformzFixUrllib.transforms ;;x  ! !$ 0 [[ &  ! !$ 0 [[) *   tW - [[ '   &C D [[ %   &K L&rSN)__name__ __module__ __qualname__rLrdrrrrSrKrNrNGs )" JMXK" MrSrNN)__doc__lib2to3.fixes.fix_importsrrlib2to3.fixer_utilrrrrr r r rCr\rLrNrrSrKrs=>>>"CD ?@  +,. /" ' ( -/  B '(+A./..}M }MrSPKz1]P =fixes/__pycache__/fix_itertools_imports.cpython-312.opt-2.pycnu[ {|j&P ddlmZddlmZmZmZGddej Zy)) fixer_base) BlankLinesymstokenc*eZdZdZdezZdZy)FixItertoolsImportsTzT import_from< 'from' 'itertools' 'import' imports=any > c|d}|jtjk(s |js|g}n |j}|dddD]}|jtj k(r|j }|}n.|jtjk(ry|jd}|j }|dvrd|_|j|dvs|j|ddk(rdnd |_|jddxs|g}d } |D]7}| r.|jtjk(r|j3| d z} 9|ra|d jtjk(rA|jj|r!|d jtjk(rA|js t|d dr |j|j} t}| |_|Sy) Nimportsr)imapizipifilter) ifilterfalse izip_longestf filterfalse zip_longestTvalue)typerimport_as_namechildrenrNAMErSTARremovechangedCOMMApopgetattrparentprefixr) selfnoderesultsr rchildmember name_node member_name remove_commaps r9s%G551*,,1r.PKz1]*e7 7 +fixes/__pycache__/fix_raise.cpython-312.pycnu[ {|jn rdZddlmZddlmZddlmZddlmZmZm Z m Z m Z GddejZ y) 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_tupleceZdZdZdZdZy)FixRaiseTzB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > cv|j}|dj}|jtjk(rd}|j ||yt |rHt |r6|jdjdj}t |r6d|_d|vr>tj|jtd|g}|j|_|S|dj}t |r+|jddDcgc]}|j} }n d |_|g} d |vr|d j} d | _|} |jtjk7s|jd k7r t|| } t!| td t#| ggz} tj|j$tdg| z}|j|_|Stj|jtdt|| g|j Scc}w)Nexcz+Python 3 does not support string exceptions valraisetbNonewith_traceback)prefix)symsclonetyperSTRINGcannot_convertr childrenrrNode raise_stmtrNAMEvaluerrr simple_stmt) selfnoderesultsrrmsgnewrcargsrewith_tbs 0/usr/lib64/python3.12/lib2to3/fixes/fix_raise.py transformzFixRaise.transform&syyen""$ 88u|| #?C   c *  C=3-ll1o..q17793-CJ  ++dooW s/CDCCJJen""$ C='*||Ab'9:'9!AGGI'9D:CJ5D 7?$$&BBIAxx5::%f)<dO1d#345"GG++d..g'0IJCCJJ;;t $W tC?&*kk3 3);sH6N)__name__ __module__ __qualname__ BM_compatiblePATTERNr/r.r r sMG43r6r N)__doc__rrpgen2rr fixer_utilrrrr r BaseFixr r5r6r.r;s-2<<;3z!!;3r6PKz1]9D9fixes/__pycache__/fix_standarderror.cpython-312.opt-2.pycnu[ {|jH ddlmZddlmZGddejZy)) fixer_base)NameceZdZdZdZdZy)FixStandarderrorTz- 'StandardError' c0td|jS)N Exception)prefix)rr )selfnoderesultss 8/usr/lib64/python3.12/lib2to3/fixes/fix_standarderror.py transformzFixStandarderror.transformsK 44N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrr rr sMG5rrN)r fixer_utilrBaseFixrrrr rs$,5z))5rPKz1]cLL8fixes/__pycache__/fix_tuple_params.cpython-312.opt-2.pycnu[ {|j ddlmZddlmZddlmZddlmZmZmZm Z m Z m Z dZ GddejZdZd Zgd fd Zd Zy ) )pytree)token) fixer_base)AssignNameNewlineNumber Subscriptsymsct|tjxr*|jdjt j k(S)N) isinstancerNodechildrentyperSTRING)stmts 7/usr/lib64/python3.12/lib2to3/fixes/fix_tuple_params.py is_docstringrs5 dFKK ( 1 ==  ELL 01c$eZdZdZdZdZdZdZy)FixTupleParamsTa funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > c d|vrj||Sg |d}|d}|djdjtjk(r)d}|djdj }t n(d}d}tjtjd d fd }|jtjk(r ||ne|jtjk(rHt|jD]0\}} | jtjk(s$|| |dkD 2 sy D] } |d| _ |} |dk(r d d_n*t|dj|r| d_|dz} D] } |d| _  |dj| | t!| dz| t# zdzD]}||dj|_|dj%y) Nlambdasuiteargsr rz; cTtj}|j}d|_t ||j}|rd|_|j |j tjtj|jgy)Nr ) rnew_namecloneprefixrreplaceappendrrr simple_stmt) tuple_arg add_prefixnargrend new_linesselfs r handle_tuplez.FixTupleParams.transform..handle_tupleCsT]]_%A//#CCJ#qwwy)D   a   V[[)9)9*. )<> ?r)r)r!)F)transform_lambdarrrINDENTvaluerrLeafr tfpdef typedargslist enumerateparentr$rrangelenchanged)r.noderesultsrrstartindentr/ir+lineafterr,r-s` @@r transformzFixTupleParams.transform.s w ((w7 7  v 8  Q  $ $ 4E1X&&q)//F)CEF++ellB/C ? 99 #   YY$,, ,#DMM2388t{{*!!a%9 3  D(DK A:"%IaL  %(++E2 3"(IaL AIED(DK)2a%&uQwc)n 4Q 67A*0E!H  a '8 arc |d}|d}t|d}|jtjk(r)|j }d|_|j |yt|}t|}|jt|}t|d} |j | j |jD]} | jtjk(s!| j|vs0|| jD cgc]} | j } } tjt j"| j g| z} | j | _| j | ycc} w)Nrbodyinnerr!)r$) simplify_argsrrNAMEr#r$r% find_params map_to_indexr" tuple_namer post_orderr2rrr power)r.r;r<rrDrEparamsto_indextup_name new_paramr*c subscriptsnews rr0zFixTupleParams.transform_lambdans-vvgg./ :: #KKMEEL LL  T"'==F!34#.  Y__&'"Avv#8(;19!''1BC1BAaggi1B Ckk$**#,??#4"5 "BDXX  # #Cs FN)__name__ __module__ __qualname__ run_order BM_compatiblePATTERNrBr0rrrrsIMG>@rrcL|jtjtjfvr|S|jtj k(rL|jtj k(r-|j d}|jtj k(r-|Std|z)NrzReceived unexpected node %s)rr vfplistrrGvfpdefr RuntimeError)r;s rrFrFsx yyT\\5::.. dkk !ii4;;&==#Dii4;;& 4t; <}t|tr|jt|.|j|@dj |S)N_)rrdr&rJjoin)relrfs rrJrJsF A c4 HHZ_ % HHSM  88A;r)rrpgen2rr fixer_utilrrrr r r rBaseFixrrFrHrIrJrZrrrosQ*GG1gZ''gX =L%'$  rPKz1]so1fixes/__pycache__/fix_types.cpython-312.opt-1.pycnu[ {|jdZddlmZddlmZidddddd d d d d dd ddddddddddddddddddd d!d"d#d$d d%d&d'ZeDcgc]}d(|z c}ZGd)d*ejZy+cc}w),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)Name BooleanTypebool BufferType memoryview ClassTypetype ComplexTypecomplexDictTypedictDictionaryType EllipsisTypeztype(Ellipsis) FloatTypefloatIntTypeintListTypelistLongType ObjectTypeobjectNoneTypez type(None)NotImplementedTypeztype(NotImplemented) SliceTypeslice StringTypebytes StringTypesz(str,)tuplestrrange) TupleTypeTypeType UnicodeType XRangeTypez)power< 'types' trailer< '.' name='%s' > >c8eZdZdZdj eZdZy)FixTypesT|cztj|dj}|rt||jSy)Nname)prefix) _TYPE_MAPPINGgetvaluerr-)selfnoderesults new_values 0/usr/lib64/python3.12/lib2to3/fixes/fix_types.py transformzFixTypes.transform9s3!%%gfo&;&;<  $++6 6N)__name__ __module__ __qualname__ BM_compatiblejoin_patsPATTERNr6r7r5r)r)5sMhhuoGr7r)N) __doc__r fixer_utilrr.r=BaseFixr))ts0r5rEs,&| f   F  6  ) W 5 F E x L 5 g!" g#$ %&- 2CPP-Q 4q 8-Pz!! Qs A4PKz1]8mm3fixes/__pycache__/fix_getcwdu.cpython-312.opt-2.pycnu[ {|jH ddlmZddlmZGddejZy)) fixer_base)NameceZdZdZdZdZy) FixGetcwduTzR power< 'os' trailer< dot='.' name='getcwdu' > any* > cZ|d}|jtd|jy)Nnamegetcwd)prefix)replacerr )selfnoderesultsrs 2/usr/lib64/python3.12/lib2to3/fixes/fix_getcwdu.py transformzFixGetcwdu.transforms"v T(4;;78N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG9rrN)r fixer_utilrBaseFixrrrrrs$  9## 9rPKz1]2fixes/__pycache__/fix_buffer.cpython-312.opt-1.pycnu[ {|jNJdZddlmZddlmZGddej Zy)z4Fixer that changes buffer(...) into memoryview(...).) fixer_base)NameceZdZdZdZdZdZy) FixBufferTzR power< name='buffer' trailer< '(' [any] ')' > any* > cZ|d}|jtd|jy)Nname memoryview)prefix)replacerr )selfnoderesultsrs 1/usr/lib64/python3.12/lib2to3/fixes/fix_buffer.py transformzFixBuffer.transforms"v T,t{{;<N)__name__ __module__ __qualname__ BM_compatibleexplicitPATTERNrrrrr sMHG=rrN)__doc__r fixer_utilrBaseFixrrrrrs$; = "" =rPKz1][56fixes/__pycache__/fix_basestring.cpython-312.opt-1.pycnu[ {|j@JdZddlmZddlmZGddej Zy)zFixer for basestring -> str.) fixer_base)NameceZdZdZdZdZy) FixBasestringTz 'basestring'c0td|jS)Nstr)prefix)rr )selfnoderesultss 5/usr/lib64/python3.12/lib2to3/fixes/fix_basestring.py transformzFixBasestring.transform sE$++..N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrr rrsMG/rrN)__doc__r fixer_utilrBaseFixrrrr rs""/J&&/rPKz1]Q>  .fixes/__pycache__/fix_ne.cpython-312.opt-1.pycnu[ {|j;VdZddlmZddlmZddlmZGddej Zy)zFixer that turns <> into !=.)pytree)token) fixer_basec0eZdZejZdZdZy)FixNec |jdk(S)Nz<>)value)selfnodes -/usr/lib64/python3.12/lib2to3/fixes/fix_ne.pymatchz FixNe.matchszzT!!cftjtjd|j}|S)Nz!=)prefix)rLeafrNOTEQUALr)r r resultsnews r transformzFixNe.transforms!kk%..$t{{C rN)__name__ __module__ __qualname__rr _accept_typer rrr rr s>>L"rrN)__doc__rpgen2rrBaseFixrrrr rs'# J   rPKz1]Ziߊ2fixes/__pycache__/fix_reload.cpython-312.opt-1.pycnu[ {|j9NdZddlmZddlmZmZGddej Zy)z5Fixer for reload(). reload(s) -> importlib.reload(s)) fixer_base) ImportAndCall touch_importceZdZdZdZdZdZy) FixReloadTprez power< 'reload' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > c|rF|d}|r?|j|jjk(r|jdjdvryd}t |||}t dd||S)Nobj>***) importlibreloadr)typesymsargumentchildrenvaluerr)selfnoderesultsr namesnews 1/usr/lib64/python3.12/lib2to3/fixes/fix_reload.py transformzFixReload.transformsf %.CHH 2 22LLO))[8'D'51T;- N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrr sM EG rrN)__doc__r fixer_utilrrBaseFixrr#rrr(s$$ 4 ""rPKz1]Rb +fixes/__pycache__/fix_throw.cpython-312.pycnu[ {|j.rdZddlmZddlmZddlmZddlmZmZm Z m Z m Z GddejZ y) 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_tupleceZdZdZdZdZy)FixThrowTz power< any trailer< '.' 'throw' > trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > | power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > > c|j}|dj}|jtjur|j |dy|j d}|y|j}t|r+|jddDcgc]}|j}}n d|_ |g}|d}d|vry|dj} d| _ t||} t| td t| ggz} |jtj |j"| y|jt||ycc}w) Nexcz+Python 3 does not support string exceptionsvalargstbwith_traceback)symsclonetyperSTRINGcannot_convertgetr childrenprefixrr rrreplacerNodepower) selfnoderesultsrrrcr throw_argsrewith_tbs 0/usr/lib64/python3.12/lib2to3/fixes/fix_throw.py transformzFixThrow.transforms)yyen""$ 88u|| #   &S T kk%  ; iik C='*||Ab'9:'9!AGGI'9D:CJ5DV_ 7?$$&BBIS$A1d#345"GG   v{{4::w? @   tC /;sEN)__name__ __module__ __qualname__ BM_compatiblePATTERNr)r(r r sMG0r0r N)__doc__rrpgen2rr fixer_utilrrrr r BaseFixr r/r0r(r5s-?<<(0z!!(0r0PKz1]O2fixes/__pycache__/fix_buffer.cpython-312.opt-2.pycnu[ {|jNH ddlmZddlmZGddejZy)) fixer_base)NameceZdZdZdZdZdZy) FixBufferTzR power< name='buffer' trailer< '(' [any] ')' > any* > cZ|d}|jtd|jy)Nname memoryview)prefix)replacerr )selfnoderesultsrs 1/usr/lib64/python3.12/lib2to3/fixes/fix_buffer.py transformzFixBuffer.transforms"v T,t{{;<N)__name__ __module__ __qualname__ BM_compatibleexplicitPATTERNrrrrr sMHG=rrN)r fixer_utilrBaseFixrrrrrs$; = "" =rPKz1]~A\2fixes/__pycache__/fix_xrange.cpython-312.opt-1.pycnu[ {|j ^dZddlmZddlmZmZmZddlmZGddejZ y)z/Fixer that changes xrange(...) into range(...).) fixer_base)NameCallconsuming_calls)patcompceZdZdZdZfdZdZdZdZdZ dZ e je Z d Ze jeZd ZxZS) FixXrangeTz power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > cLtt| ||t|_yN)superr start_treesettransformed_xranges)selftreefilename __class__s 1/usr/lib64/python3.12/lib2to3/fixes/fix_xrange.pyr zFixXrange.start_trees i)$9#&5 cd|_yr )r)rrrs r finish_treezFixXrange.finish_trees #' rc|d}|jdk(r|j||S|jdk(r|j||Stt |)Nnamexrangerange)valuetransform_xrangetransform_range ValueErrorreprrnoderesultsrs r transformzFixXrange.transformsXv :: !((w7 7 ZZ7 "''g6 6T$Z( (rc|d}|jtd|j|jj t |y)Nrrprefix)replacerr'raddidr!s rrzFixXrange.transform_xrange$s:v T'$++67   $$RX.rc"t||jvrx|j|sftt d|dj g}tt d|g|j }|dD]}|j||Syy)Nrargslistr&rest)r*rin_special_contextrrcloner' append_child)rr"r# range_call list_callns rrzFixXrange.transform_range*s tHD44 4''-d7mgfo.C.C.E-FGJT&\J<$(KK1IV_&&q)% . 5rz3power< 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*> cB|jyi}|jjL|jj|jj|r|d|ur|djtvS|j j|j|xr|d|uS)NFr"func)parentp1matchrrp2)rr"r#s rr/zFixXrange.in_special_context?s ;;  KK   *ww}}T[[//9v$&6?((O; ;ww}}T[['2Nwv$7NNr)__name__ __module__ __qualname__ BM_compatiblePATTERNr rr$rrP1rcompile_patternr8P2r:r/ __classcell__)rs@rr r sbMG )()/  ?B   $B B !  $B Orr N) __doc__r fixer_utilrrrrBaseFixr rrrIs,644=O ""=OrPKz1]G8fixes/__pycache__/fix_tuple_params.cpython-312.opt-1.pycnu[ {|jdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z dZ GddejZd Zd Zgd fd Zd Zy )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 Subscriptsymsct|tjxr*|jdjt j k(S)N) isinstancerNodechildrentyperSTRING)stmts 7/usr/lib64/python3.12/lib2to3/fixes/fix_tuple_params.py is_docstringrs5 dFKK ( 1 ==  ELL 01c$eZdZdZdZdZdZdZy)FixTupleParamsTa funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > c d|vrj||Sg |d}|d}|djdjtjk(r)d}|djdj }t n(d}d}tjtjd d fd }|jtjk(r ||ne|jtjk(rHt|jD]0\}} | jtjk(s$|| |dkD 2 sy D] } |d| _ |} |dk(r d d_n*t|dj|r| d_|dz} D] } |d| _  |dj| | t!| dz| t# zdzD]}||dj|_|dj%y) Nlambdasuiteargsr rz; cTtj}|j}d|_t ||j}|rd|_|j |j tjtj|jgy)Nr ) rnew_namecloneprefixrreplaceappendrrr simple_stmt) tuple_arg add_prefixnargrend new_linesselfs r handle_tuplez.FixTupleParams.transform..handle_tupleCsT]]_%A//#CCJ#qwwy)D   a   V[[)9)9*. )<> ?r)r)r!)F)transform_lambdarrrINDENTvaluerrLeafr tfpdef typedargslist enumerateparentr$rrangelenchanged)r.noderesultsrrstartindentr/ir+lineafterr,r-s` @@r transformzFixTupleParams.transform.s w ((w7 7  v 8  Q  $ $ 4E1X&&q)//F)CEF++ellB/C ? 99 #   YY$,, ,#DMM2388t{{*!!a%9 3  D(DK A:"%IaL  %(++E2 3"(IaL AIED(DK)2a%&uQwc)n 4Q 67A*0E!H  a '8 arc |d}|d}t|d}|jtjk(r)|j }d|_|j |yt|}t|}|jt|}t|d} |j | j |jD]} | jtjk(s!| j|vs0|| jD cgc]} | j } } tjt j"| j g| z} | j | _| j | ycc} w)Nrbodyinnerr!)r$) simplify_argsrrNAMEr#r$r% find_params map_to_indexr" tuple_namer post_orderr2rrr power)r.r;r<rrDrEparamsto_indextup_name new_paramr*c subscriptsnews rr0zFixTupleParams.transform_lambdans-vvgg./ :: #KKMEEL LL  T"'==F!34#.  Y__&'"Avv#8(;19!''1BC1BAaggi1B Ckk$**#,??#4"5 "BDXX  # #Cs FN)__name__ __module__ __qualname__ run_order BM_compatiblePATTERNrBr0rrrrsIMG>@rrcL|jtjtjfvr|S|jtj k(rL|jtj k(r-|j d}|jtj k(r-|Std|z)NrzReceived unexpected node %s)rr vfplistrrGvfpdefr RuntimeError)r;s rrFrFsx yyT\\5::.. dkk !ii4;;&==#Dii4;;& 4t; <}t|tr|jt|.|j|@dj |S)N_)rrdr&rJjoin)relrfs rrJrJsF A c4 HHZ_ % HHSM  88A;r)__doc__rrpgen2rr fixer_utilrrrr r r rBaseFixrrFrHrIrJrZrrrpsQ*GG1gZ''gX =L%'$  rPKz1]bRR5fixes/__pycache__/fix_itertools.cpython-312.opt-2.pycnu[ {|j H ddlmZddlmZGddejZy)) fixer_base)Namec2eZdZdZdZdezZdZdZy) 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] ')' > > cPd}|dd}d|vr_|jdvrQ|d|d}}|j}|j|j|jj ||xs |j}|j t |jdd|y)Nfuncit) ifilterfalse izip_longestdot)prefix)valuerremoveparentreplacer)selfnoderesultsrr rr s 4/usr/lib64/python3.12/lib2to3/fixes/fix_itertools.py transformzFixItertools.transformsvq! GO JJ> >u~wt}CYYF IIK JJL KK   %&4;; T$**QR.89N) __name__ __module__ __qualname__ BM_compatibleit_funcslocalsPATTERN run_orderrrrrrs+MHH H GI:rrN)r fixer_utilrBaseFixrr#rrr's$::%%:rPKz1]xr)fixes/__pycache__/fix_zip.cpython-312.pycnu[ {|j jdZddlmZddlmZddlmZddlm Z m Z m Z GddejZ y) 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_contextceZdZdZdZdZdZy)FixZipTzN power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*] > zfuture_builtins.zipc|j|ryt|ry|dj}d|_g}d|vr.|dDcgc]}|j}}|D] }d|_ t t j td|gd}t t j tdt|gg|z}|j|_|Scc}w)Nargstrailerszip)prefixlist) should_skiprclonerrsymspowerrr)selfnoderesultsr rnnews ./usr/lib64/python3.12/lib2to3/fixes/fix_zip.py transformzFixZip.transforms   D !  d #v$$&   +2:+>?+>a +>H?4::U T22>4::V gsen=HI[[  @sCN)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onrrr r sMG $Gr$r N)__doc__r rpytreerpygramrr fixer_utilrrrConditionalFixr r#r$rr*s-+::Z & &r$PKz1]^>50fixes/__pycache__/fix_dict.cpython-312.opt-1.pycnu[ {|jdZddlmZddlmZddlmZddlmZmZmZddlmZejdhzZ Gdd ejZ y ) 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_utilitercpeZdZdZdZdZdZejeZ dZ eje Z dZ y)FixDictTa power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues'| 'viewkeys'|'viewitems'|'viewvalues') > parens=trailer< '(' ')' > tail=any* > c |d}|dd}|d}|j}|j}|jd}|jd} |s| r|dd}|D cgc]} | j}} |D cgc]} | j}} | xr|j ||} |t j |jtt||jg|d jgz} t j |j| } | s#| s!d | _ tt|rdnd | g} |r$t j |j| g|z} |j| _ | Scc} wcc} w) Nheadmethodtailr view)prefixparenslist) symsvalue startswithclonein_special_contextrNodetrailerrrrpowerr)selfnoderesultsrrrr method_nameisiterisviewnspecialargsnews //usr/lib64/python3.12/lib2to3/fixes/fix_dict.py transformzFixDict.transform6spv"1%vyyll ''/''/ V%ab/K#'(4a 4(#'(4a 4((Dt66tVDv{{4<<$'E$(06 %?$@Ax(..0 22 kk$**d+6CJtfF&9C5AC ++djj3%$,7C[[  )(s E:7E?z3power< func=NAME trailer< '(' node=any ')' > any* >zmfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > c|jyi}|jjm|jj|jj|r=|d|ur6|r|djtvS|djt j vS|sy|jj|j|xr|d|uS)NFr!func)parentp1matchr iter_exemptr consuming_callsp2)r r!r$r"s r*rzFixDict.in_special_contextZs ;;  KK   *ww}}T[[//9v$&v,, ;;v,, 0J0JJJww}}T[['2Nwv$7NNN) __name__ __module__ __qualname__ BM_compatiblePATTERNr+P1rcompile_patternr/P2r3rr4r*r r )sMMG8 ?B   $B B !  $BOr4r N) __doc__rrrrr rrrr2r1BaseFixr r=r4r*r@sH6((((F83 AOj  AOr4PKz1]~Y3fixes/__pycache__/fix_sys_exc.cpython-312.opt-1.pycnu[ {|j bdZddlmZddlmZmZmZmZmZm Z m Z GddejZ y)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 SubscriptNodesymscTeZdZgdZdZddj deDzZdZy) FixSysExc)exc_type exc_value exc_tracebackTzN power< 'sys' trailer< dot='.' attribute=(%s) > > |c#&K|] }d|z yw)z'%s'N).0es 2/usr/lib64/python3.12/lib2to3/fixes/fix_sys_exc.py zFixSysExc.s:AVaZsc|dd}t|jj|j}t t d|j }tt d|}|dj |djd_|jt|ttj||j S)N attributeexc_info)prefixsysdot)rrindexvaluerrrrchildrenappendrr r power)selfnoderesultssys_attrrcallattrs r transformzFixSysExc.transforms;'*t}}**8>>:;D$X__=DK&%,U^%:%:Q" Ie$%DJJT[[99N)__name__ __module__ __qualname__r BM_compatiblejoinPATTERNr*rr+rr r s/9HMHH:::;G:r+r N) __doc__r fixer_utilrrrrrr r BaseFixr rr+rr6s*HHH: "":r+PKz1],fixes/__pycache__/fix_buffer.cpython-312.pycnu[ {|jNJdZddlmZddlmZGddej Zy)z4Fixer that changes buffer(...) into memoryview(...).) fixer_base)NameceZdZdZdZdZdZy) FixBufferTzR power< name='buffer' trailer< '(' [any] ')' > any* > cZ|d}|jtd|jy)Nname memoryview)prefix)replacerr )selfnoderesultsrs 1/usr/lib64/python3.12/lib2to3/fixes/fix_buffer.py transformzFixBuffer.transforms"v T,t{{;<N)__name__ __module__ __qualname__ BM_compatibleexplicitPATTERNrrrrr sMHG=rrN)__doc__r fixer_utilrBaseFixrrrrrs$; = "" =rPKz1]L-fixes/__pycache__/fix_getcwdu.cpython-312.pycnu[ {|jJdZddlmZddlmZGddej Zy)z1 Fixer that changes os.getcwdu() to os.getcwd(). ) fixer_base)NameceZdZdZdZdZy) FixGetcwduTzR power< 'os' trailer< dot='.' name='getcwdu' > any* > cZ|d}|jtd|jy)Nnamegetcwd)prefix)replacerr )selfnoderesultsrs 2/usr/lib64/python3.12/lib2to3/fixes/fix_getcwdu.py transformzFixGetcwdu.transforms"v T(4;;78N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG9rrN)__doc__r fixer_utilrBaseFixrrrrrs$  9## 9rPKz1])yѐ*fixes/__pycache__/__init__.cpython-312.pycnu[ {|j/y)Nr//usr/lib64/python3.12/lib2to3/fixes/__init__.pyrsrPKz1] 7fixes/__pycache__/fix_itertools_imports.cpython-312.pycnu[ {|j&RdZddlmZddlmZmZmZGddejZy)zA Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) ) fixer_base) BlankLinesymstokenc*eZdZdZdezZdZy)FixItertoolsImportsTzT import_from< 'from' 'itertools' 'import' imports=any > c|d}|jtjk(s |js|g}n |j}|dddD]}|jtj k(r|j }|}nM|jtjk(ry|jtjk(sJ|jd}|j }|dvrd|_|j|dvs|j|ddk(rdnd |_|jddxs|g}d } |D]7}| r.|jtjk(r|j3| d z} 9|ra|d jtjk(rA|jj|r!|d jtjk(rA|js t|d dr |j|j} t}| |_|Sy) Nimportsr)imapizipifilter) ifilterfalse izip_longestf filterfalse zip_longestTvalue)typerimport_as_namechildrenrNAMErSTARremovechangedCOMMApopgetattrparentprefixr) selfnoderesultsr rchildmember name_node member_name remove_commaps r:s%G551*,,1r.PKz1]EE2fixes/__pycache__/fix_reduce.cpython-312.opt-2.pycnu[ {|jEH ddlmZddlmZGddejZy)) fixer_base touch_importceZdZdZdZdZdZy) FixReduceTpreai power< 'reduce' trailer< '(' arglist< ( (not(argument) any ',' not(argument > ctdd|y)N functoolsreducer)selfnoderesultss 1/usr/lib64/python3.12/lib2to3/fixes/fix_reduce.py transformzFixReduce.transform"s[(D1N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrrsM E G2rrN)lib2to3rlib2to3.fixer_utilrBaseFixrrrrrs$ +2 ""2rPKz1]B]4fixes/__pycache__/fix_operator.cpython-312.opt-1.pycnu[ {|jb ddZddlZddlmZddlmZmZmZm Z dZ GddejZ y)aFixer for operator functions. operator.isCallable(obj) -> callable(obj) operator.sequenceIncludes(obj) -> operator.contains(obj) operator.isSequenceType(obj) -> isinstance(obj, collections.abc.Sequence) operator.isMappingType(obj) -> isinstance(obj, collections.abc.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_importcfd}|S)Nc|_|SN) invocation)fss 3/usr/lib64/python3.12/lib2to3/fixes/fix_operator.pydeczinvocation..decs )r rs` rr r s JrceZdZdZdZdZdZdeeezZdZ e dd Z e d d Z e d d Z e ddZe ddZe ddZe ddZdZdZdZy) FixOperatorTprez 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 > > )methodsobjc>|j||}| |||Syr ) _check_method)selfnoderesultsmethods r transformzFixOperator.transform+s,##D'2  $( ( rzoperator.contains(%s)c(|j||dS)Ncontains_handle_renamerrrs r_sequenceIncludeszFixOperator._sequenceIncludes0s""4*==rz callable(%s)cl|d}ttd|jg|jS)Nrcallableprefix)rrcloner')rrrrs r _isCallablezFixOperator._isCallable4s+enD$syy{mDKKHHrzoperator.mul(%s)c(|j||dS)Nmulr r"s r_repeatzFixOperator._repeat9s""4%88rzoperator.imul(%s)c(|j||dS)Nimulr r"s r_irepeatzFixOperator._irepeat=s""4&99rz(isinstance(%s, collections.abc.Sequence)c*|j||ddS)Ncollections.abcSequence_handle_type2abcr"s r_isSequenceTypezFixOperator._isSequenceTypeAs$$T74EzRRrz'isinstance(%s, collections.abc.Mapping)c*|j||ddS)Nr1Mappingr3r"s r_isMappingTypezFixOperator._isMappingTypeEs$$T74EyQQrzisinstance(%s, numbers.Number)c*|j||ddS)NnumbersNumberr3r"s r _isNumberTypezFixOperator._isNumberTypeIs$$T7IxHHrcB|dd}||_|jy)Nrr)valuechanged)rrrnamers rr!zFixOperator._handle_renameMs""1% rctd|||d}|jtddj||gzg}t t d||j S)Nrz, . isinstancer&)rr(rjoinrrr')rrrmoduleabcrargss rr4zFixOperator._handle_type2abcRsVT64(en VD388VSM+B$BCDD&T[[AArct|d|ddjz}t|tjj r9d|vr|St |df}|j|z}|j|d|zy)N_rrrErzYou should use '%s' here.) getattrr>rC collectionsrFCallablestrr warning)rrrrsubinvocation_strs rrzFixOperator._check_methodXs|sWX%6q%9%?%??@ fkoo66 77" 75>*,!'!2!2S!8 T#>#OPrN)__name__ __module__ __qualname__ BM_compatibleorderrrdictPATTERNrr r#r)r,r/r5r8r<r!r4rrrrrrsM EG C c2 3G) '(>)>I I"#9$9#$:%::;S<S9:R;R01I2I B rr) __doc__collections.abcrKlib2to3rlib2to3.fixer_utilrrrrr BaseFixrrrrr]s3 ??G*$$GrPKz1]+ȳr4fixes/__pycache__/fix_ws_comma.cpython-312.opt-1.pycnu[ {|jBVdZddlmZddlmZddlmZGddej Zy)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_baseceZdZdZdZej ejdZej ejdZ ee fZ dZ y) FixWsCommaTzH any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]> ,:c|j}d}|jD]S}||jvr*|j}|j r d|vrd|_d};|r|j}|sd|_d}U|S)NF T )clonechildrenSEPSprefixisspace)selfnoderesultsnewcommachildrs 3/usr/lib64/python3.12/lib2to3/fixes/fix_ws_comma.py transformzFixWsComma.transformstjjl\\E !>>#F(:#%EL"\\F!'* " N) __name__ __module__ __qualname__explicitPATTERNrLeafrCOMMACOLONrrrrrr sJHG FKK S )E FKK S )E 5>DrrN)__doc__r rpgen2rrBaseFixrr$rrr(s'##rPKz1]ⷫ2fixes/__pycache__/fix_idioms.cpython-312.opt-1.pycnu[ {|j fdZddlmZddlmZmZmZmZmZm Z dZ dZ GddejZ y) 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 ')' > >c XeZdZdZdedededed ZfdZdZdZ d Z d Z xZ S) FixIdiomsTz isinstance=comparison<  z8 T=any > | isinstance=comparison< T=any aX > | 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* > cVtt| |}|rd|vr|d|dk(r|Sy|S)Nsortedid1id2)superr match)selfnoder __class__s 1/usr/lib64/python3.12/lib2to3/fixes/fix_idioms.pyrzFixIdioms.matchOs< )T ( . Qx1U8#cd|vr|j||Sd|vr|j||Sd|vr|j||Std)N isinstancewhilerz Invalid match)transform_isinstancetransform_whiletransform_sort RuntimeError)rrresultss r transformzFixIdioms.transformZs^ 7 ",,T7; ;  ''g6 6  &&tW5 5/ /rc0|dj}|dj}d|_d|_ttd|t |g}d|vr,d|_t t jtd|g}|j|_|S)NxTr rnnot)cloneprefixrrrrr not_test)rrr r#r$tests rrzFixIdioms.transform_isinstanceds CL    CL   D&EGQ8 '>DK U T':;Dkk  rcZ|d}|jtd|jy)NrTruer))replacerr))rrr ones rrzFixIdioms.transform_whileps#g D 34rc|d}|d}|jd}|jd}|r'|jtd|jnV|rI|j }d|_|jt td|g|jn t d|j|j}d |vr~|r=|jd d |d jf} d j| |d _yt} |jj| |jd d | _yy) Nsortnextlistexprrr.r%zshould not have reached here ) getr/rr)r(rrremove rpartitionjoinrparent append_child) rrr sort_stmt next_stmt list_call simple_exprnewbtwn prefix_linesend_lines rrzFixIdioms.transform_sortts3FO FO KK' kk&)    d8I4D4DE F ##%CCJ   T(^cU,7,>,>!@ A=> > 4<!% 5a 8)A,:M:MN &*ii &= ! # %;  --h7#'//$"7":! r) __name__ __module__ __qualname__explicitTYPECMPPATTERNrr!rrr __classcell__)rs@rr r %s6HN c4K%!GN 0 5$;rr N)__doc__r%r fixer_utilrrrrrr rKrJBaseFixr rrrRs3<AA81s; ""s;rPKz1] 1fixes/__pycache__/fix_paren.cpython-312.opt-2.pycnu[ {|jL ddlmZddlmZmZGddej Zy)) fixer_base)LParenRParenceZdZdZdZdZy)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] > >) (']' | ')') > c|d}t}|j|_d|_|jd||jt y)Ntarget)rprefix insert_child append_childr)selfnoderesultsr lparens 0/usr/lib64/python3.12/lib2to3/fixes/fix_paren.py transformzFixParen.transform%sE"   Av&FH%N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG,&rrN)r r fixer_utilrrBaseFixrrrrrs%C' &z!! &rPKz1]xE4~~2fixes/__pycache__/fix_intern.cpython-312.opt-1.pycnu[ {|jxNdZddlmZddlmZmZGddej Zy)z/Fixer for intern(). intern(s) -> sys.intern(s)) fixer_base) ImportAndCall touch_importceZdZdZdZdZdZy) FixInternTprez power< 'intern' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > c|rF|d}|r?|j|jjk(r|jdjdvryd}t |||}t dd||S)Nobj>***)sysinternr)typesymsargumentchildrenvaluerr)selfnoderesultsr namesnews 1/usr/lib64/python3.12/lib2to3/fixes/fix_intern.py transformzFixIntern.transformsf %.CHH 2 22LLO))[8!D'51T5$' N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrr sM EG rrN)__doc__r fixer_utilrrBaseFixrr#rrr(s$ 4 ""rPKz1]6fixes/__pycache__/fix_basestring.cpython-312.opt-2.pycnu[ {|j@H ddlmZddlmZGddejZy)) fixer_base)NameceZdZdZdZdZy) FixBasestringTz 'basestring'c0td|jS)Nstr)prefix)rr )selfnoderesultss 5/usr/lib64/python3.12/lib2to3/fixes/fix_basestring.py transformzFixBasestring.transform sE$++..N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrr rrsMG/rrN)r fixer_utilrBaseFixrrrr rs""/J&&/rPKz1]t#3fixes/__pycache__/fix_asserts.cpython-312.opt-1.pycnu[ {|jbdZddlmZddlmZedddddd d dddddd d ZGddeZy)z5Fixer that replaces deprecated unittest method names.)BaseFix)Name assertTrue assertEqualassertNotEqualassertAlmostEqualassertNotAlmostEqual assertRegexassertRaisesRegex assertRaises assertFalse)assert_ assertEqualsassertNotEqualsassertAlmostEqualsassertNotAlmostEqualsassertRegexpMatchesassertRaisesRegexpfailUnlessEqual failIfEqualfailUnlessAlmostEqualfailIfAlmostEqual failUnlessfailUnlessRaisesfailIfcHeZdZddjeeezZdZy) FixAssertszH power< any+ trailer< '.' meth=(%s)> any* > |c|dd}|jttt||jy)Nmeth)prefix)replacerNAMESstrr")selfnoderesultsnames 2/usr/lib64/python3.12/lib2to3/fixes/fix_asserts.py transformzFixAsserts.transform s0vq! T%D *4;;?@N) __name__ __module__ __qualname__joinmapreprr$PATTERNr+r,r*rrs'HHSu-./GAr,rN)__doc__ fixer_baser fixer_utilrdictr$rr4r,r*r9sR;! $*0%*! -,#  $AAr,PKz1]K َ3fixes/__pycache__/fix_asserts.cpython-312.opt-2.pycnu[ {|j` ddlmZddlmZeddddddd dddddd d ZGd deZy))BaseFix)Name assertTrue assertEqualassertNotEqualassertAlmostEqualassertNotAlmostEqual assertRegexassertRaisesRegex assertRaises assertFalse)assert_ assertEqualsassertNotEqualsassertAlmostEqualsassertNotAlmostEqualsassertRegexpMatchesassertRaisesRegexpfailUnlessEqual failIfEqualfailUnlessAlmostEqualfailIfAlmostEqual failUnlessfailUnlessRaisesfailIfcHeZdZddjeeezZdZy) FixAssertszH power< any+ trailer< '.' meth=(%s)> any* > |c|dd}|jttt||jy)Nmeth)prefix)replacerNAMESstrr")selfnoderesultsnames 2/usr/lib64/python3.12/lib2to3/fixes/fix_asserts.py transformzFixAsserts.transform s0vq! T%D *4;;?@N) __name__ __module__ __qualname__joinmapreprr$PATTERNr+r,r*rrs'HHSu-./GAr,rN) fixer_baser fixer_utilrdictr$rr4r,r*r8sR;! $*0%*! -,#  $AAr,PKz1]35fixes/__pycache__/fix_funcattrs.cpython-312.opt-1.pycnu[ {|jJdZddlmZddlmZGddej Zy)z3Fix function attribute names (f.func_x -> f.__x__).) fixer_base)NameceZdZdZdZdZy) FixFuncattrsTz power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' | 'func_dict') > any* > c|dd}|jtd|jddz|jy)Nattrz__%s__)prefix)replacervaluer )selfnoderesultsrs 4/usr/lib64/python3.12/lib2to3/fixes/fix_funcattrs.py transformzFixFuncattrs.transforms;vq! T8djjn4!%. /N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG /rrN)__doc__r fixer_utilrBaseFixrrrrrs"9 /:%% /rPKz1] /fixes/__pycache__/fix_map.cpython-312.opt-1.pycnu[ {|j8~dZddlmZddlmZddlmZmZmZm Z m Z ddl m Z ddlmZGddej Zy ) 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)NodeceZdZdZdZdZdZy)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.mapc |j|ryg}d|vr)|dD]!}|j|j#|jjt j k(rA|j|d|j}d|_ttd|g}nd|vrbt|dj|dj|dj}tt j|g|zd }nbd |vr|d j}d|_n d |vr|d }|jt jk(r|jd jt j k(rs|jd jdjt"j$k(r<|jd jdj&dk(r|j|dytt jtd|jg}d|_t)|rytt jtdt+gg|z}d|_|j|_|S)Nextra_trailerszYou should use a for loop herelist map_lambdaxpfpit)prefixmap_noneargargsNonezjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequencemap) should_skipappendcloneparenttypesyms simple_stmtwarningrrrrr powertrailerchildrenarglistrNAMEvaluer r)selfnoderesultstrailerstnewrs ./usr/lib64/python3.12/lib2to3/fixes/fix_map.py transformzFixMap.transform@s   D !  w &-. */ ;;  t// / LL? @**,CCJtF|cU+C W $74=..0"4=..0"4=..02CtzzC58#3B?CW$en**, W$"6?DyyDLL0}}Q',, <}}Q'00388EJJF}}Q'00399VC T,NOtzzDK+FGC!#CJ%d+tzzDL'3%.#AH#LMCCJ[[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr3r4r2r r sMG:$G.r4r N)__doc__pgen2rrr fixer_utilrrrrr pygramr r#pytreer ConditionalFixr r;r4r2rBs2&JJ+PZ & &Pr4PKz1],fixes/__pycache__/fix_future.cpython-312.pycnu[ {|j#JdZddlmZddlmZGddej Zy)zVRemove __future__ imports from __future__ import foo is replaced with an empty line. ) fixer_base) BlankLineceZdZdZdZdZdZy) FixFutureTz;import_from< 'from' module_name="__future__" 'import' any > c<t}|j|_|S)N)rprefix)selfnoderesultsnews 1/usr/lib64/python3.12/lib2to3/fixes/fix_future.py transformzFixFuture.transformsk[[  N)__name__ __module__ __qualname__ BM_compatiblePATTERN run_orderrrrrr sMOGIrrN)__doc__r fixer_utilrBaseFixrrrrrs$"  "" rPKz1]x8*fixes/__pycache__/fix_dict.cpython-312.pycnu[ {|jdZddlmZddlmZddlmZddlmZmZmZddlmZejdhzZ Gdd ejZ y ) 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_utilitercpeZdZdZdZdZdZejeZ dZ eje Z dZ y)FixDictTa power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues'| 'viewkeys'|'viewitems'|'viewvalues') > parens=trailer< '(' ')' > tail=any* > c 0|d}|dd}|d}|j}|j}|jd}|jd} |s| r|dd}|dvsJt||D cgc]} | j }} |D cgc]} | j }} | xr|j ||} |t j|jtt||j g|d j gz} t j|j| } | s#| s!d | _ tt|rdnd | g} |r$t j|j| g|z} |j| _ | Scc} wcc} w) Nheadmethodtailr view)keysitemsvalues)prefixparenslist)symsvalue startswithreprclonein_special_contextrNodetrailerrrrpowerr)selfnoderesultsrrrr method_nameisiterisviewnspecialargsnews //usr/lib64/python3.12/lib2to3/fixes/fix_dict.py transformzFixDict.transform6sv"1%vyyll ''/''/ V%ab/K99G4<G9#'(4a 4(#'(4a 4((Dt66tVDv{{4<<$'E$(06 %?$@Ax(..0 22 kk$**d+6CJtfF&9C5AC ++djj3%$,7C[[  )(s .F Fz3power< func=NAME trailer< '(' node=any ')' > any* >zmfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > c|jyi}|jjm|jj|jj|r=|d|ur6|r|djtvS|djt j vS|sy|jj|j|xr|d|uS)NFr%func)parentp1matchr iter_exemptr consuming_callsp2)r$r%r(r&s r.r zFixDict.in_special_contextZs ;;  KK   *ww}}T[[//9v$&v,, ;;v,, 0J0JJJww}}T[['2Nwv$7NNN) __name__ __module__ __qualname__ BM_compatiblePATTERNr/P1rcompile_patternr3P2r7r r8r.r r )sMMG8 ?B   $B B !  $BOr8r N) __doc__rrrrr rrrr6r5BaseFixr rAr8r.rDsH6((((F83 AOj  AOr8PKz1]q6fixes/__pycache__/fix_xreadlines.cpython-312.opt-2.pycnu[ {|jH ddlmZddlmZGddejZy)) fixer_base)NameceZdZdZdZdZy) FixXreadlinesTz power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | power< any+ trailer< '.' no_call='xreadlines' > > c|jd}|r'|jtd|jy|j|dDcgc]}|j c}ycc}w)Nno_call__iter__)prefixcall)getreplacerr clone)selfnoderesultsrxs 5/usr/lib64/python3.12/lib2to3/fixes/fix_xreadlines.py transformzFixXreadlines.transformsR++i(  OODGNNC D LLWV_=_!'')_= >=s A,N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrr sMG ?rrN)r fixer_utilrBaseFixrrrrrs%D ?J&&?rPKz1]vv-fixes/__pycache__/fix_unicode.cpython-312.pycnu[ {|jTdZddlmZddlmZdddZGddej Zy ) 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)unichrunicodec,eZdZdZdZfdZdZxZS) FixUnicodeTzSTRING | 'unicode' | 'unichr'cTtt| ||d|jv|_y)Nunicode_literals)superr start_treefuture_featuresr )selftreefilename __class__s 2/usr/lib64/python3.12/lib2to3/fixes/fix_unicode.pyrzFixUnicode.start_trees' j$*4: 2d6J6J Jc $|jtjk(r*|j}t|j |_|S|jtj k(r|j }|jsY|ddvrRd|vrNdj|jdDcgc]$}|jddjdd&c}}|dd vr|d d}||j k(r|S|j}||_|Sycc}w) Nz'"\z\\z\uz\\uz\Uz\\UuU) typerNAMEclone_mappingvalueSTRINGr joinsplitreplace)rnoderesultsnewvalvs r transformzFixUnicode.transforms 99 "**,C ,CIJ YY%,, &**C((SVu_jj YYu-"-IIeV,44UFC-"1v~!"gdjj  **,CCIJ'"s&)D )__name__ __module__ __qualname__ BM_compatiblePATTERNrr) __classcell__)rs@rr r sM-GKrr N)__doc__pgen2rrrBaseFixr rrr5s.% 0##rPKz1]\* .fixes/__pycache__/fix_exitfunc.cpython-312.pycnu[ {|j bdZddlmZmZddlmZmZmZmZm Z m Z GddejZ y)z7 Convert use of sys.exitfunc to use the atexit module. )pytree fixer_base)NameAttrCallCommaNewlinesymsc:eZdZdZdZdZfdZfdZdZxZ S) FixExitfuncTa ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) c&tt| |yN)superr __init__)selfargs __class__s 3/usr/lib64/python3.12/lib2to3/fixes/fix_exitfunc.pyrzFixExitfunc.__init__s k4)40c<tt| ||d|_yr)rr start_tree sys_import)rtreefilenamers rrzFixExitfunc.start_tree!s k4+D(;rc d|vr|j |d|_y|dj}d|_tjt j ttdtd}t||g|j}|j||j|j|dy|jjd}|jt jk(r5|jt!|jtddy|jj"}|jj%|j}|j"} tjt j&td tddg} tjt j(| g} |j+|dzt-|j+|d z| y) NrfuncatexitregisterzKCan't find sys import; Please add an atexit import at the top of your file. import)rcloneprefixrNoder powerrrrreplacewarningchildrentypedotted_as_names append_childrparentindex import_name simple_stmt insert_childr ) rnoderesultsrrcallnamescontaining_stmtpositionstmt_container new_importnews r transformzFixExitfunc.transform%s 7 "&"),"7 v$$& ;;tzz#DND4DE!Htfdkk2 T ?? " LL ? @ ((+ ::-- -   uw '   tHc2 3"oo44O&//55dooFH,33NT%5%5#H~tHc/BC J++d.. =C  ( (Awy A  ( (As ;r) __name__ __module__ __qualname__keep_line_order BM_compatiblePATTERNrrr< __classcell__)rs@rr r s#OM G1#rIs' 'EE=<*$$= c<t}|j|_|S)N)rprefix)selfnoderesultsnews 1/usr/lib64/python3.12/lib2to3/fixes/fix_future.py transformzFixFuture.transformsk[[  N)__name__ __module__ __qualname__ BM_compatiblePATTERN run_orderrrrrr sMOGIrrN)__doc__r fixer_utilrBaseFixrrrrrs$"  "" rPKz1]}((0fixes/__pycache__/fix_repr.cpython-312.opt-2.pycnu[ {|jeP ddlmZddlmZmZmZGddej Zy)) fixer_base)CallName parenthesizeceZdZdZdZdZy)FixReprTz7 atom < '`' expr=any '`' > c|dj}|j|jjk(r t |}t t d|g|jS)Nexprrepr)prefix)clonetypesyms testlist1rrrr )selfnoderesultsr s //usr/lib64/python3.12/lib2to3/fixes/fix_repr.py transformzFixRepr.transformsMv$$& 99 ++ +%DDL4&==N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG>rrN)r fixer_utilrrrBaseFixrrrrr s'611 >j  >rPKz1]_badd0fixes/__pycache__/fix_repr.cpython-312.opt-1.pycnu[ {|jeRdZddlmZddlmZmZmZGddejZy)z/Fixer that transforms `xyzzy` into repr(xyzzy).) fixer_base)CallName parenthesizeceZdZdZdZdZy)FixReprTz7 atom < '`' expr=any '`' > c|dj}|j|jjk(r t |}t t d|g|jS)Nexprrepr)prefix)clonetypesyms testlist1rrrr )selfnoderesultsr s //usr/lib64/python3.12/lib2to3/fixes/fix_repr.py transformzFixRepr.transformsMv$$& 99 ++ +%DDL4&==N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG>rrN) __doc__r fixer_utilrrrBaseFixrrrrr!s'611 >j  >rPKz1]`#1fixes/__pycache__/fix_types.cpython-312.opt-2.pycnu[ {|j ddlmZddlmZiddddddd d d d d d dddddddddddddddddddd d!d"d#dd$d%d&ZeDcgc]}d'|z c}ZGd(d)ej Zy*cc}w)+) fixer_base)Name BooleanTypebool BufferType memoryview ClassTypetype ComplexTypecomplexDictTypedictDictionaryType EllipsisTypeztype(Ellipsis) FloatTypefloatIntTypeintListTypelistLongType ObjectTypeobjectNoneTypez type(None)NotImplementedTypeztype(NotImplemented) SliceTypeslice StringTypebytes StringTypesz(str,)tuplestrrange) TupleTypeTypeType UnicodeType XRangeTypez)power< 'types' trailer< '.' name='%s' > >c8eZdZdZdj eZdZy)FixTypesT|cztj|dj}|rt||jSy)Nname)prefix) _TYPE_MAPPINGgetvaluerr-)selfnoderesults new_values 0/usr/lib64/python3.12/lib2to3/fixes/fix_types.py transformzFixTypes.transform9s3!%%gfo&;&;<  $++6 6N)__name__ __module__ __qualname__ BM_compatiblejoin_patsPATTERNr6r7r5r)r)5sMhhuoGr7r)N)r fixer_utilrr.r=BaseFixr))ts0r5rDs,&| f   F  6  ) W 5 F E x L 5 g!" g#$ %&- 2CPP-Q 4q 8-Pz!! Qs A3PKz1]' ' 6fixes/__pycache__/fix_isinstance.cpython-312.opt-1.pycnu[ {|jHJdZddlmZddlmZGddej Zy)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)tokenceZdZdZdZdZdZy) FixIsinstanceTz power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > ct}|d}|j}g}t|}|D]\}} | jtj k(rP| j |vrB|t|dz ksC||dzjtjk(sgt|s|j| | jtj k(s|j| j |r#|djtjk(r|d=t|dk(r5|j} | j|d_ | j|dy||dd|jy)Nargs)setchildren enumeratetyperNAMEvaluelenCOMMAnextappendaddparentprefixreplacechanged) selfnoderesultsnames_insertedtestlistr new_argsiteratoridxargatoms 5/usr/lib64/python3.12/lib2to3/fixes/fix_isinstance.py transformzFixIsinstance.transforms6?  T? HCxx5::%#))~*ETQ&4a=+=+=+LN$88uzz)"&&syy1!  ))U[[8 x=A ??D!%HQK  LL! %DG LLNN)__name__ __module__ __qualname__ BM_compatiblePATTERN run_orderr'r(r&rrsMGIr(rN)__doc__r fixer_utilrBaseFixrr/r(r&r4s$$J&&$r(PKz1]Smm3fixes/__pycache__/fix_has_key.cpython-312.opt-1.pycnu[ {|j| ZdZddlmZddlmZddlmZmZGddejZy)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 parenthesizeceZdZdZdZdZy) 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 `|j}|jj|jk(r&|jj |jry|j d}|d}|j}|dDcgc]}|j}}|dj} |j d} | r| Dcgc]}|j} }| j|j|j|j|j|j|j|jfvr t| } t!|dk(r|d}n t#j$|j&|}d|_t)d d } |r/t)d d } t#j$|j*| | f} t#j$|j| | |f} | r8t| } t#j$|j&| ft-| z} |jj|j|j.|j0|j2|j4|j6|j8|j:|j&f vr t| } || _| Scc}wcc}w) Nnegationanchorbeforeargafter in)prefixnot)symsparenttypenot_testpatternmatchgetrclone comparisonand_testor_testtestlambdefargumentrlenrNodepowerrcomp_optupleexprxor_exprand_expr shift_expr arith_exprtermfactor)selfnoderesultsrr r rnr r rn_opn_notnews 2/usr/lib64/python3.12/lib2to3/fixes/fix_has_key.py transformzFixHasKey.transformGsyy KK   - LL  t{{ +;;z*"%,X%67%6!'')%67en""$ G$ (-.1QWWYE. 88  diit}}N Ns#C v;! AYF[[V4F D% s+E;;t||eT];Dkk$//Cv+>? s#C++djj3&5<*?@C ;;  DMM $ t $ $ TZZ 9 9s#C  78/s ?J&J+N)__name__ __module__ __qualname__ BM_compatiblePATTERNr7r6rr&sMG<&r>rN) __doc__rr fixer_utilrrBaseFixrr=r>r6rCs):+G ""Gr>PKz1]o8||-fixes/__pycache__/fix_has_key.cpython-312.pycnu[ {|j| ZdZddlmZddlmZddlmZmZGddejZy)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 parenthesizeceZdZdZdZdZy) 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 h|sJ|j}|jj|jk(r&|jj |jry|j d}|d}|j}|dDcgc]}|j}}|dj} |j d} | r| Dcgc]}|j} }| j|j|j|j|j|j|j|jfvr t| } t!|dk(r|d}n t#j$|j&|}d|_t)d d } |r/t)d d } t#j$|j*| | f} t#j$|j| | |f} | r8t| } t#j$|j&| ft-| z} |jj|j|j.|j0|j2|j4|j6|j8|j:|j&f vr t| } || _| Scc}wcc}w) Nnegationanchorbeforeargafter in)prefixnot)symsparenttypenot_testpatternmatchgetrclone comparisonand_testor_testtestlambdefargumentrlenrNodepowerrcomp_optupleexprxor_exprand_expr shift_expr arith_exprtermfactor)selfnoderesultsrr r rnr r rn_opn_notnews 2/usr/lib64/python3.12/lib2to3/fixes/fix_has_key.py transformzFixHasKey.transformGs&wyy KK   - LL  t{{ +;;z*"%,X%67%6!'')%67en""$ G$ (-.1QWWYE. 88  diit}}N Ns#C v;! AYF[[V4F D% s+E;;t||eT];Dkk$//Cv+>? s#C++djj3&5<*?@C ;;  DMM $ t $ $ TZZ 9 9s#C  78/s J*J/N)__name__ __module__ __qualname__ BM_compatiblePATTERNr7r6rr&sMG<&r>rN) __doc__rr fixer_utilrrBaseFixrr=r>r6rCs):+G ""Gr>PKz1]G2fixes/__pycache__/fix_tuple_params.cpython-312.pycnu[ {|jdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z dZ GddejZd Zd Zgd fd Zd Zy )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 Subscriptsymsct|tjxr*|jdjt j k(S)N) isinstancerNodechildrentyperSTRING)stmts 7/usr/lib64/python3.12/lib2to3/fixes/fix_tuple_params.py is_docstringrs5 dFKK ( 1 ==  ELL 01c$eZdZdZdZdZdZdZy)FixTupleParamsTa funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > c d|vrj||Sg |d}|d}|djdjtjk(r)d}|djdj }t n(d}d}tjtjd d fd }|jtjk(r ||ne|jtjk(rHt|jD]0\}} | jtjk(s$|| |dkD 2 sy D] } |d| _ |} |dk(r d d_n*t|dj|r| d_|dz} D] } |d| _  |dj| | t!| dz| t# zdzD]}||dj|_|dj%y) Nlambdasuiteargsr rz; cTtj}|j}d|_t ||j}|rd|_|j |j tjtj|jgy)Nr ) rnew_namecloneprefixrreplaceappendrrr simple_stmt) tuple_arg add_prefixnargrend new_linesselfs r handle_tuplez.FixTupleParams.transform..handle_tupleCsT]]_%A//#CCJ#qwwy)D   a   V[[)9)9*. )<> ?r)r)r!)F)transform_lambdarrrINDENTvaluerrLeafr tfpdef typedargslist enumerateparentr$rrangelenchanged)r.noderesultsrrstartindentr/ir+lineafterr,r-s` @@r transformzFixTupleParams.transform.s w ((w7 7  v 8  Q  $ $ 4E1X&&q)//F)CEF++ellB/C ? 99 #   YY$,, ,#DMM2388t{{*!!a%9 3  D(DK A:"%IaL  %(++E2 3"(IaL AIED(DK)2a%&uQwc)n 4Q 67A*0E!H  a '8 arc |d}|d}t|d}|jtjk(r)|j }d|_|j |yt|}t|}|jt|}t|d} |j | j |jD]} | jtjk(s!| j|vs0|| jD cgc]} | j } } tjt j"| j g| z} | j | _| j | ycc} w)Nrbodyinnerr!)r$) simplify_argsrrNAMEr#r$r% find_params map_to_indexr" tuple_namer post_orderr2rrr power)r.r;r<rrDrEparamsto_indextup_name new_paramr*c subscriptsnews rr0zFixTupleParams.transform_lambdans-vvgg./ :: #KKMEEL LL  T"'==F!34#.  Y__&'"Avv#8(;19!''1BC1BAaggi1B Ckk$**#,??#4"5 "BDXX  # #Cs FN)__name__ __module__ __qualname__ run_order BM_compatiblePATTERNrBr0rrrrsIMG>@rrcL|jtjtjfvr|S|jtj k(rL|jtj k(r-|j d}|jtj k(r-|Std|z)NrzReceived unexpected node %s)rr vfplistrrGvfpdefr RuntimeError)r;s rrFrFsx yyT\\5::.. dkk !ii4;;&==#Dii4;;& 4t; <}t|tr|jt|.|j|@dj |S)N_)rrdr&rJjoin)relrfs rrJrJsF A c4 HHZ_ % HHSM  88A;r)__doc__rrpgen2rr fixer_utilrrrr r r rBaseFixrrFrHrIrJrZrrrpsQ*GG1gZ''gX =L%'$  rPKz1]44-fixes/__pycache__/fix_nonzero.cpython-312.pycnu[ {|jOJdZddlmZddlmZGddej Zy)z*Fixer for __nonzero__ -> __bool__ methods.) fixer_base)NameceZdZdZdZdZy) FixNonzeroTz classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='__nonzero__' parameters< '(' NAME ')' > any+ > any* > > c^|d}td|j}|j|y)Nname__bool__)prefix)rr replace)selfnoderesultsrnews 2/usr/lib64/python3.12/lib2to3/fixes/fix_nonzero.py transformzFixNonzero.transforms'v:dkk2 SN)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrsMGrrN)__doc__r fixer_utilrBaseFixrrrrrs"0 ## rPKz1]\61fixes/__pycache__/fix_numliterals.cpython-312.pycnu[ {|jVdZddlmZddlmZddlmZGddejZy)z-Fixer that turns 1L into 1, 0755 into 0o755. )token) fixer_base)Numberc0eZdZejZdZdZy)FixNumliteralsc^|jjdxs|jddvS)N0Ll)value startswith)selfnodes 6/usr/lib64/python3.12/lib2to3/fixes/fix_numliterals.pymatchzFixNumliterals.matchs) %%c*Ddjjn.DEc|j}|ddvr|dd}n@|jdr/|jrtt |dkDrd|ddz}t ||j S)Nr r r 0o)prefix)r r isdigitlensetrr)rrresultsvals r transformzFixNumliterals.transformsdjj r7d?cr(C ^^C S[[]s3s8}q7HQR.Cc$++..rN)__name__ __module__ __qualname__rNUMBER _accept_typerrrrrr s<r(s' /Z''/rPKz1]vv3fixes/__pycache__/fix_unicode.cpython-312.opt-1.pycnu[ {|jTdZddlmZddlmZdddZGddej Zy ) 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)unichrunicodec,eZdZdZdZfdZdZxZS) FixUnicodeTzSTRING | 'unicode' | 'unichr'cTtt| ||d|jv|_y)Nunicode_literals)superr start_treefuture_featuresr )selftreefilename __class__s 2/usr/lib64/python3.12/lib2to3/fixes/fix_unicode.pyrzFixUnicode.start_trees' j$*4: 2d6J6J Jc $|jtjk(r*|j}t|j |_|S|jtj k(r|j }|jsY|ddvrRd|vrNdj|jdDcgc]$}|jddjdd&c}}|dd vr|d d}||j k(r|S|j}||_|Sycc}w) Nz'"\z\\z\uz\\uz\Uz\\UuU) typerNAMEclone_mappingvalueSTRINGr joinsplitreplace)rnoderesultsnewvalvs r transformzFixUnicode.transforms 99 "**,C ,CIJ YY%,, &**C((SVu_jj YYu-"-IIeV,44UFC-"1v~!"gdjj  **,CCIJ'"s&)D )__name__ __module__ __qualname__ BM_compatiblePATTERNrr) __classcell__)rs@rr r sM-GKrr N)__doc__pgen2rrrBaseFixr rrr5s.% 0##rPKz1]j`0]]7fixes/__pycache__/fix_numliterals.cpython-312.opt-2.pycnu[ {|jT ddlmZddlmZddlmZGddej Zy))token) fixer_base)Numberc0eZdZejZdZdZy)FixNumliteralsc^|jjdxs|jddvS)N0Ll)value startswith)selfnodes 6/usr/lib64/python3.12/lib2to3/fixes/fix_numliterals.pymatchzFixNumliterals.matchs) %%c*Ddjjn.DEc|j}|ddvr|dd}n@|jdr/|jrtt |dkDrd|ddz}t ||j S)Nr r r 0o)prefix)r r isdigitlensetrr)rrresultsvals r transformzFixNumliterals.transformsdjj r7d?cr(C ^^C S[[]s3s8}q7HQR.Cc$++..rN)__name__ __module__ __qualname__rNUMBER _accept_typerrrrrr s<r's' /Z''/rPKz1]xE4~~,fixes/__pycache__/fix_intern.cpython-312.pycnu[ {|jxNdZddlmZddlmZmZGddej Zy)z/Fixer for intern(). intern(s) -> sys.intern(s)) fixer_base) ImportAndCall touch_importceZdZdZdZdZdZy) FixInternTprez power< 'intern' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > c|rF|d}|r?|j|jjk(r|jdjdvryd}t |||}t dd||S)Nobj>***)sysinternr)typesymsargumentchildrenvaluerr)selfnoderesultsr namesnews 1/usr/lib64/python3.12/lib2to3/fixes/fix_intern.py transformzFixIntern.transformsf %.CHH 2 22LLO))[8!D'51T5$' N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrr sM EG rrN)__doc__r fixer_utilrrBaseFixrr#rrr(s$ 4 ""rPKz1]A5pp2fixes/__pycache__/fix_import.cpython-312.opt-2.pycnu[ {|j n ddlmZddlmZmZmZmZddlmZm Z m Z dZ GddejZ y) ) fixer_base)dirnamejoinexistssep) FromImportsymstokenc#XK |g}|r|j}|jtjk(r|jn|jt j k(r6dj|jDcgc]}|jc}n|jt jk(r|j|jdnJ|jt jk(r"|j|jdddn td|ryycc}ww)Nrzunknown node type)poptyper NAMEvaluer dotted_namerchildrendotted_as_nameappenddotted_as_namesextendAssertionError)namespendingnodechs 1/usr/lib64/python3.12/lib2to3/fixes/fix_import.pytraverse_importsrsgG {{} 99 "**  YY$** *''dmm | import_name< 'import' imp=any > cTtt| ||d|jv|_y)Nabsolute_import)superr! start_treefuture_featuresskip)selftreename __class__s rr%zFixImport.start_tree/s& i)$5%)=)== c|jry|d}|jtjk(rit |ds|j d}t |ds|j |jr%d|jz|_|jyyd}d}t|D]}|j |rd}d}|r|r|j|dytd|g}|j|_ |S)Nimprr.FTz#absolute and local imports together) r'rr import_fromhasattrrprobably_a_local_importrchangedrwarningr prefix)r(rresultsr. have_local have_absolutemod_namenews r transformzFixImport.transform3s 99 en 99(( ( c7+ll1oc7+++CII6#))O  7J!M,S1//9!%J$(M 2 LL'LMS3%(CCJJr,c|jdry|jddd}t|j}t ||}t t t|dsydt ddd d fD]}t ||zsy y) Nr/Frz __init__.pyz.pyz.pycz.soz.slz.pydT) startswithsplitrfilenamerrr)r(imp_name base_pathexts rr2z!FixImport.probably_a_local_importUs   s #>>#q)!,DMM* H- d79-}=>3uf=Ci#o&>r,) __name__ __module__ __qualname__ BM_compatiblePATTERNr%r;r2 __classcell__)r+s@rr!r!&sMG > Dr,r!N)r ros.pathrrrr fixer_utilr r r rBaseFixr!r,rrNs2 ..006&= ""=r,PKz1]4fixes/__pycache__/fix_operator.cpython-312.opt-2.pycnu[ {|jb b ddlZddlmZddlmZmZmZmZdZ GddejZ y)N) fixer_base)CallNameString touch_importcfd}|S)Nc|_|SN) invocation)fss 3/usr/lib64/python3.12/lib2to3/fixes/fix_operator.pydeczinvocation..decs )r rs` rr r s JrceZdZdZdZdZdZdeeezZdZ e dd Z e d d Z e d d Z e ddZe ddZe ddZe ddZdZdZdZy) FixOperatorTprez 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 > > )methodsobjc>|j||}| |||Syr ) _check_method)selfnoderesultsmethods r transformzFixOperator.transform+s,##D'2  $( ( rzoperator.contains(%s)c(|j||dS)Ncontains_handle_renamerrrs r_sequenceIncludeszFixOperator._sequenceIncludes0s""4*==rz callable(%s)cl|d}ttd|jg|jS)Nrcallableprefix)rrcloner')rrrrs r _isCallablezFixOperator._isCallable4s+enD$syy{mDKKHHrzoperator.mul(%s)c(|j||dS)Nmulr r"s r_repeatzFixOperator._repeat9s""4%88rzoperator.imul(%s)c(|j||dS)Nimulr r"s r_irepeatzFixOperator._irepeat=s""4&99rz(isinstance(%s, collections.abc.Sequence)c*|j||ddS)Ncollections.abcSequence_handle_type2abcr"s r_isSequenceTypezFixOperator._isSequenceTypeAs$$T74EzRRrz'isinstance(%s, collections.abc.Mapping)c*|j||ddS)Nr1Mappingr3r"s r_isMappingTypezFixOperator._isMappingTypeEs$$T74EyQQrzisinstance(%s, numbers.Number)c*|j||ddS)NnumbersNumberr3r"s r _isNumberTypezFixOperator._isNumberTypeIs$$T7IxHHrcB|dd}||_|jy)Nrr)valuechanged)rrrnamers rr!zFixOperator._handle_renameMs""1% rctd|||d}|jtddj||gzg}t t d||j S)Nrz, . isinstancer&)rr(rjoinrrr')rrrmoduleabcrargss rr4zFixOperator._handle_type2abcRsVT64(en VD388VSM+B$BCDD&T[[AArct|d|ddjz}t|tjj r9d|vr|St |df}|j|z}|j|d|zy)N_rrrErzYou should use '%s' here.) getattrr>rC collectionsrFCallablestrr warning)rrrrsubinvocation_strs rrzFixOperator._check_methodXs|sWX%6q%9%?%??@ fkoo66 77" 75>*,!'!2!2S!8 T#>#OPrN)__name__ __module__ __qualname__ BM_compatibleorderrrdictPATTERNrr r#r)r,r/r5r8r<r!r4rrrrrrsM EG C c2 3G) '(>)>I I"#9$9#$:%::;S<S9:R;R01I2I B rr) collections.abcrKlib2to3rlib2to3.fixer_utilrrrrr BaseFixrrrrr\s3 ??G*$$GrPKz1]/oRqq5fixes/__pycache__/fix_raw_input.cpython-312.opt-2.pycnu[ {|jH ddlmZddlmZGddejZy)) fixer_base)NameceZdZdZdZdZy) FixRawInputTzU power< name='raw_input' trailer< '(' [any] ')' > any* > cZ|d}|jtd|jy)Nnameinput)prefix)replacerr )selfnoderesultsrs 4/usr/lib64/python3.12/lib2to3/fixes/fix_raw_input.py transformzFixRawInput.transforms"v T'$++67N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrsMG8rrN)r fixer_utilrBaseFixrrrrrs"8 8*$$ 8rPKz1]/5V0fixes/__pycache__/fix_dict.cpython-312.opt-2.pycnu[ {|j ddlmZddlmZddlmZddlmZmZmZddlmZejdhzZ GddejZ y ) )pytree)patcomp) fixer_base)NameCallDot) fixer_utilitercpeZdZdZdZdZdZejeZ dZ eje Z dZ y)FixDictTa power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues'| 'viewkeys'|'viewitems'|'viewvalues') > parens=trailer< '(' ')' > tail=any* > c |d}|dd}|d}|j}|j}|jd}|jd} |s| r|dd}|D cgc]} | j}} |D cgc]} | j}} | xr|j ||} |t j |jtt||jg|d jgz} t j |j| } | s#| s!d | _ tt|rdnd | g} |r$t j |j| g|z} |j| _ | Scc} wcc} w) Nheadmethodtailr view)prefixparenslist) symsvalue startswithclonein_special_contextrNodetrailerrrrpowerr)selfnoderesultsrrrr method_nameisiterisviewnspecialargsnews //usr/lib64/python3.12/lib2to3/fixes/fix_dict.py transformzFixDict.transform6spv"1%vyyll ''/''/ V%ab/K#'(4a 4(#'(4a 4((Dt66tVDv{{4<<$'E$(06 %?$@Ax(..0 22 kk$**d+6CJtfF&9C5AC ++djj3%$,7C[[  )(s E:7E?z3power< func=NAME trailer< '(' node=any ')' > any* >zmfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > c|jyi}|jjm|jj|jj|r=|d|ur6|r|djtvS|djt j vS|sy|jj|j|xr|d|uS)NFr!func)parentp1matchr iter_exemptr consuming_callsp2)r r!r$r"s r*rzFixDict.in_special_contextZs ;;  KK   *ww}}T[[//9v$&v,, ;;v,, 0J0JJJww}}T[['2Nwv$7NNN) __name__ __module__ __qualname__ BM_compatiblePATTERNr+P1rcompile_patternr/P2r3rr4r*r r )sMMG8 ?B   $B B !  $BOr4r N) rrrrr rrrr2r1BaseFixr r=r4r*r?sH6((((F83 AOj  AOr4PKz1][50fixes/__pycache__/fix_basestring.cpython-312.pycnu[ {|j@JdZddlmZddlmZGddej Zy)zFixer for basestring -> str.) fixer_base)NameceZdZdZdZdZy) FixBasestringTz 'basestring'c0td|jS)Nstr)prefix)rr )selfnoderesultss 5/usr/lib64/python3.12/lib2to3/fixes/fix_basestring.py transformzFixBasestring.transform sE$++..N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrr rrsMG/rrN)__doc__r fixer_utilrBaseFixrrrr rs""/J&&/rPKz1]J0fixes/__pycache__/fix_next.cpython-312.opt-1.pycnu[ {|jf dZddlmZddlmZddlmZddlm Z m Z m Z dZ GddejZd Zd Zd Zy ) 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 bindingc0eZdZdZdZdZfdZdZxZS)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* > prectt| ||td|}|r|j |t d|_yd|_y)NnextTF)superr start_treerwarning bind_warning shadowed_next)selftreefilenamen __class__s //usr/lib64/python3.12/lib2to3/fixes/fix_next.pyrzFixNext.start_tree$sA gt'h7  & LLL )!%D !&D c,|jd}|jd}|jd}|r|jr'|jtd|jy|Dcgc]}|j }}d|d_|jt td|j|y|r)td|j}|j|y|r{t|rU|d }dj|Dcgc] }t|c}jd k(r|j|ty|jtdyd |vr|j|td |_yycc}wcc}w) Nbaseattrname__next__)prefixr head __builtin__globalT) getrreplacerrcloneris_assign_targetjoinstrstriprr)rnoderesultsrrrrr"s r transformzFixNext.transform.sD{{6"{{6"{{6" !! T*T[[AB+/04a 40!#Q T$vdkk"BDIJ Z 4A LLO  %v77D1DqCFD1288:mKLL|4 LLj) *  LL| ,!%D !!12s -F  F) __name__ __module__ __qualname__ BM_compatiblePATTERNorderrr. __classcell__)rs@rr r s M G E'&rr ct|}|y|jD]/}|jtjk(ryt ||s/yy)NFT) find_assignchildrentyperEQUAL is_subtree)r,assignchilds rr(r(QsG  F ~ :: $ t $ ! rc|jtjk(r|S|jtjk(s |jyt |jSN)r9syms expr_stmt simple_stmtparentr7)r,s rr7r7]sD yyDNN"  yyD$$$ (; t{{ ##rcL|k(rytfd|jDS)NTc36K|]}t|ywr?)r;).0cr,s r zis_subtree..gs:Mqz!T"Ms)anyr8)rootr,s `rr;r;ds" t| :DMM: ::rN)__doc__pgen2rpygramrr@r r fixer_utilrrrrBaseFixr r(r7r;rrrQs@4+11L :&j  :&@ $;rPKz1]haҰ,,2fixes/__pycache__/fix_future.cpython-312.opt-2.pycnu[ {|j#H ddlmZddlmZGddejZy)) fixer_base) BlankLineceZdZdZdZdZdZy) FixFutureTz;import_from< 'from' module_name="__future__" 'import' any > c<t}|j|_|S)N)rprefix)selfnoderesultsnews 1/usr/lib64/python3.12/lib2to3/fixes/fix_future.py transformzFixFuture.transformsk[[  N)__name__ __module__ __qualname__ BM_compatiblePATTERN run_orderrrrrr sMOGIrrN)r fixer_utilrBaseFixrrrrrs$"  "" rPKz1]\67fixes/__pycache__/fix_numliterals.cpython-312.opt-1.pycnu[ {|jVdZddlmZddlmZddlmZGddejZy)z-Fixer that turns 1L into 1, 0755 into 0o755. )token) fixer_base)Numberc0eZdZejZdZdZy)FixNumliteralsc^|jjdxs|jddvS)N0Ll)value startswith)selfnodes 6/usr/lib64/python3.12/lib2to3/fixes/fix_numliterals.pymatchzFixNumliterals.matchs) %%c*Ddjjn.DEc|j}|ddvr|dd}n@|jdr/|jrtt |dkDrd|ddz}t ||j S)Nr r r 0o)prefix)r r isdigitlensetrr)rrresultsvals r transformzFixNumliterals.transformsdjj r7d?cr(C ^^C S[[]s3s8}q7HQR.Cc$++..rN)__name__ __module__ __qualname__rNUMBER _accept_typerrrrrr s<r(s' /Z''/rPKz1]443fixes/__pycache__/fix_nonzero.cpython-312.opt-1.pycnu[ {|jOJdZddlmZddlmZGddej Zy)z*Fixer for __nonzero__ -> __bool__ methods.) fixer_base)NameceZdZdZdZdZy) FixNonzeroTz classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='__nonzero__' parameters< '(' NAME ')' > any+ > any* > > c^|d}td|j}|j|y)Nname__bool__)prefix)rr replace)selfnoderesultsrnews 2/usr/lib64/python3.12/lib2to3/fixes/fix_nonzero.py transformzFixNonzero.transforms'v:dkk2 SN)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrsMGrrN)__doc__r fixer_utilrBaseFixrrrrrs"0 ## rPKz1]f+ + -fixes/__pycache__/fix_renames.cpython-312.pycnu[ {|jjdZddlmZddlmZmZdddiiZiZdZdZ Gd d ejZ y ) z?Fix incompatible renames Fixes: * sys.maxint -> sys.maxsize ) fixer_base)Name attr_chainsysmaxintmaxsizecLddjtt|zdzS)N(|))joinmaprepr)memberss 2/usr/lib64/python3.12/lib2to3/fixes/fix_renames.py alternatesrs" #dG,- - 33c #KttjD]J\}}t|jD])\}}|t||f<d|d|d|dd|d|d+Lyw)Nz3 import_from< 'from' module_name=z, 'import' ( attr_name=z | import_as_name< attr_name=z! 'as' any >) > z& power< module_name=z trailer< '.' attr_name=z > any* > )listMAPPINGitemsLOOKUP)modulereplaceold_attrnew_attrs r build_patternrsl 0"&w}}"7 Hh)1FFH% & 85 5  + +#81sA,A.cXeZdZdZdj eZdZfdZdZ xZ S) FixRenamesTr precztt| |}|r!tfdt |dDry|Sy)Nc3.K|] }|yw)N).0objmatchs r z#FixRenames.match..5sD)C#5:)CsparentF)superrr&anyr)selfnoderesultsr& __class__s @rr&zFixRenames.match1s;j$-+ DD()CDDNrc|jd}|jd}|rI|rFt|j|jf}|jt ||j yyy)N module_name attr_name)prefix)getrvaluerrr2)r+r,r-mod_namer1rs r transformzFixRenames.transform>s^;;}-KK ,   x~~y?@H   d8I4D4DE F"8r) __name__ __module__ __qualname__ BM_compatibler rPATTERNorderr&r6 __classcell__)r.s@rrr*s(Mhh}'G EGrrN) __doc__r fixer_utilrrrrrrBaseFixrr#rrrBsF) Hy)  4+*G##GrPKz1]܏2fixes/__pycache__/fix_idioms.cpython-312.opt-2.pycnu[ {|j d ddlmZddlmZmZmZmZmZmZdZ dZ GddejZ y)) fixer_base)CallCommaNameNode BlankLinesymsz0(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)z(power< 'type' trailer< '(' x=any ')' > >c XeZdZdZdedededed ZfdZdZdZ d Z d Z xZ S) FixIdiomsTz isinstance=comparison<  z8 T=any > | isinstance=comparison< T=any aX > | 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* > cVtt| |}|rd|vr|d|dk(r|Sy|S)Nsortedid1id2)superr match)selfnoder __class__s 1/usr/lib64/python3.12/lib2to3/fixes/fix_idioms.pyrzFixIdioms.matchOs< )T ( . Qx1U8#cd|vr|j||Sd|vr|j||Sd|vr|j||Std)N isinstancewhilerz Invalid match)transform_isinstancetransform_whiletransform_sort RuntimeError)rrresultss r transformzFixIdioms.transformZs^ 7 ",,T7; ;  ''g6 6  &&tW5 5/ /rc0|dj}|dj}d|_d|_ttd|t |g}d|vr,d|_t t jtd|g}|j|_|S)NxTr rnnot)cloneprefixrrrrr not_test)rrr r#r$tests rrzFixIdioms.transform_isinstanceds CL    CL   D&EGQ8 '>DK U T':;Dkk  rcZ|d}|jtd|jy)NrTruer))replacerr))rrr ones rrzFixIdioms.transform_whileps#g D 34rc|d}|d}|jd}|jd}|r'|jtd|jnV|rI|j }d|_|jt td|g|jn t d|j|j}d |vr~|r=|jd d |d jf} d j| |d _yt} |jj| |jd d | _yy) Nsortnextlistexprrr.r%zshould not have reached here ) getr/rr)r(rrremove rpartitionjoinrparent append_child) rrr sort_stmt next_stmt list_call simple_exprnewbtwn prefix_linesend_lines rrzFixIdioms.transform_sortts3FO FO KK' kk&)    d8I4D4DE F ##%CCJ   T(^cU,7,>,>!@ A=> > 4<!% 5a 8)A,:M:MN &*ii &= ! # %;  --h7#'//$"7":! r) __name__ __module__ __qualname__explicitTYPECMPPATTERNrr!rrr __classcell__)rs@rr r %s6HN c4K%!GN 0 5$;rr N) r%r fixer_utilrrrrrr rKrJBaseFixr rrrQs3<AA81s; ""s;rPKz1]DPHH2fixes/__pycache__/fix_reload.cpython-312.opt-2.pycnu[ {|j9L ddlmZddlmZmZGddej Zy)) fixer_base) ImportAndCall touch_importceZdZdZdZdZdZy) FixReloadTprez power< 'reload' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > c|rF|d}|r?|j|jjk(r|jdjdvryd}t |||}t dd||S)Nobj>***) importlibreloadr)typesymsargumentchildrenvaluerr)selfnoderesultsr namesnews 1/usr/lib64/python3.12/lib2to3/fixes/fix_reload.py transformzFixReload.transformsf %.CHH 2 22LLO))[8'D'51T;- N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrr sM EG rrN)r fixer_utilrrBaseFixrr#rrr's$$ 4 ""rPKz1]^/ +fixes/__pycache__/fix_apply.cpython-312.pycnu[ {|j* jdZddlmZddlmZddlmZddlmZmZm Z GddejZ y) zIFixer for apply(). This converts apply(func, v, k) into (func)(*v, **k).)pytree)token) fixer_base)CallComma parenthesizeceZdZdZdZdZy)FixApplyTa. power< 'apply' trailer< '(' arglist< (not argument ')' > > c|j}|sJ|d}|d}|jd}|r?|j|jjk(r|jdj dvry|r@|j|jjk(r|jdj dk(ry|j }|j}|jtj|jfvrN|j|jk7s*|jdjtjk(r t|}d|_|j}d|_||j}d|_tjtj d |g}|H|j#t%tjtjd|gd |d_t'||| S) Nfuncargskwds>***rr )prefix)symsgettypeargumentchildrenvaluerclonerNAMEatompower DOUBLESTARrrLeafSTARextendrr) selfnoderesultsrr r rr l_newargss 0/usr/lib64/python3.12/lib2to3/fixes/fix_apply.py transformzFixApply.transformsyywvv{{6"  TYY/// a &&+5 TYY$))"4"44]]1%++t3 zz| IIejj$))4 4 YY$** $ ]]2  # #u'7'7 7%D zz|  ::r5s-9 2264z!!64r*PKz1]uOTBB2fixes/__pycache__/fix_intern.cpython-312.opt-2.pycnu[ {|jxL ddlmZddlmZmZGddej Zy)) fixer_base) ImportAndCall touch_importceZdZdZdZdZdZy) FixInternTprez power< 'intern' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > c|rF|d}|r?|j|jjk(r|jdjdvryd}t |||}t dd||S)Nobj>***)sysinternr)typesymsargumentchildrenvaluerr)selfnoderesultsr namesnews 1/usr/lib64/python3.12/lib2to3/fixes/fix_intern.py transformzFixIntern.transformsf %.CHH 2 22LLO))[8!D'51T5$' N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrr sM EG rrN)r fixer_utilrrBaseFixrr#rrr's$ 4 ""rPKz1]2fixes/__pycache__/fix_import.cpython-312.opt-1.pycnu[ {|j pdZddlmZddlmZmZmZmZddlm Z m Z m Z dZ GddejZy ) 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) FromImportsymstokenc#VK|g}|r|j}|jtjk(r|jn|jt j k(r6dj|jDcgc]}|jc}n|jt jk(r|j|jdnJ|jt jk(r"|j|jdddn td|ryycc}ww)zF Walks over all the names imported in a dotted_as_names node. rNzunknown node type)poptyper NAMEvaluer dotted_namerchildrendotted_as_nameappenddotted_as_namesextendAssertionError)namespendingnodechs 1/usr/lib64/python3.12/lib2to3/fixes/fix_import.pytraverse_importsrsgG {{} 99 "**  YY$** *''dmm | import_name< 'import' imp=any > cTtt| ||d|jv|_y)Nabsolute_import)superr! start_treefuture_featuresskip)selftreename __class__s rr%zFixImport.start_tree/s& i)$5%)=)== c|jry|d}|jtjk(rit |ds|j d}t |ds|j |jr%d|jz|_|jyyd}d}t|D]}|j |rd}d}|r|r|j|dytd|g}|j|_ |S)Nimprr.FTz#absolute and local imports together) r'rr import_fromhasattrrprobably_a_local_importrchangedrwarningr prefix)r(rresultsr. have_local have_absolutemod_namenews r transformzFixImport.transform3s 99 en 99(( ( c7+ll1oc7+++CII6#))O  7J!M,S1//9!%J$(M 2 LL'LMS3%(CCJJr,c|jdry|jddd}t|j}t ||}t t t|dsydt ddd d fD]}t ||zsy y) Nr/Frz __init__.pyz.pyz.pycz.soz.slz.pydT) startswithsplitrfilenamerrr)r(imp_name base_pathexts rr2z!FixImport.probably_a_local_importUs   s #>>#q)!,DMM* H- d79-}=>3uf=Ci#o&>r,) __name__ __module__ __qualname__ BM_compatiblePATTERNr%r;r2 __classcell__)r+s@rr!r!&sMG > Dr,r!N)__doc__r ros.pathrrrr fixer_utilr r r rBaseFixr!r,rrOs2 ..006&= ""=r,PKz1]6fixes/__pycache__/fix_xreadlines.cpython-312.opt-1.pycnu[ {|jJdZddlmZddlmZGddej Zy)zpFix "for x in f.xreadlines()" -> "for x in f". This fixer will also convert g(f.xreadlines) into g(f.__iter__).) fixer_base)NameceZdZdZdZdZy) FixXreadlinesTz power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | power< any+ trailer< '.' no_call='xreadlines' > > c|jd}|r'|jtd|jy|j|dDcgc]}|j c}ycc}w)Nno_call__iter__)prefixcall)getreplacerr clone)selfnoderesultsrxs 5/usr/lib64/python3.12/lib2to3/fixes/fix_xreadlines.py transformzFixXreadlines.transformsR++i(  OODGNNC D LLWV_=_!'')_= >=s A,N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrr sMG ?rrN)__doc__r fixer_utilrBaseFixrrrrr s%D ?J&&?rPKz1]~1@ @ =fixes/__pycache__/fix_itertools_imports.cpython-312.opt-1.pycnu[ {|j&RdZddlmZddlmZmZmZGddejZy)zA Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) ) fixer_base) BlankLinesymstokenc*eZdZdZdezZdZy)FixItertoolsImportsTzT import_from< 'from' 'itertools' 'import' imports=any > c|d}|jtjk(s |js|g}n |j}|dddD]}|jtj k(r|j }|}n.|jtjk(ry|jd}|j }|dvrd|_|j|dvs|j|ddk(rdnd |_|jddxs|g}d } |D]7}| r.|jtjk(r|j3| d z} 9|ra|d jtjk(rA|jj|r!|d jtjk(rA|js t|d dr |j|j} t}| |_|Sy) Nimportsr)imapizipifilter) ifilterfalse izip_longestf filterfalse zip_longestTvalue)typerimport_as_namechildrenrNAMErSTARremovechangedCOMMApopgetattrparentprefixr) selfnoderesultsr rchildmember name_node member_name remove_commaps r:s%G551*,,1r.PKz1]o0fixes/__pycache__/fix_exec.cpython-312.opt-2.pycnu[ {|jP ddlmZddlmZmZmZGddej Zy)) fixer_base)CommaNameCallceZdZdZdZdZy)FixExecTzx exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > | exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > c|j}|d}|jd}|jd}|jg}d|d_|)|j t |jg|)|j t |jgt td||jS)Nabcexec)prefix)symsgetclonerextendrrr)selfnoderesultsrr r r argss //usr/lib64/python3.12/lib2to3/fixes/fix_exec.py transformzFixExec.transformsyy CL KK  KK  {Q = KK!''), - = KK!''), -DL$t{{;;N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrsMG r$s'** | single=any) ']' > | atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > ) ')' > > c|jd}|rGtjtj|j g}|j ||}n|d}tjtjdg}|jd|jD|jtjtjd|jj|d_tjtj |}|j|_t#|jdk(r=|jd}|j%|j|jd_|S) Nsingleitems{c3<K|]}|jyw)N)clone).0ns 6/usr/lib64/python3.12/lib2to3/fixes/fix_set_literal.py z*FixSetLiteral.transform..'s9.Qqwwy.s})getrNoder listmakerrreplaceLeafrLBRACEextendchildrenappendRBRACE next_siblingprefix dictsetmakerlenremove) selfnoderesultsr faker literalmakerrs r transformzFixSetLiteral.transformsX& ;;t~~ /?@D NN4 EG$E;;u||S129%..99v{{5<<56"//66  D--w7{{  u~~ ! #q!A HHJ()ENN2  % N)__name__ __module__ __qualname__ BM_compatibleexplicitPATTERNr,r-rrr sMHGr-rN) __doc__lib2to3rrlib2to3.fixer_utilrrBaseFixrr4r-rr9s$ '*)J&&)r-PKz1]v  1fixes/__pycache__/fix_print.cpython-312.opt-1.pycnu[ {|j dZddlmZddlmZddlmZddlmZddlmZm Z m Z m Z ejdZ Gdd ejZy ) 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 eZdZdZdZdZdZy)FixPrintTzP simple_stmt< any* bare='print' any* > | print_stmt c :|jd}|r1|jttdg|jy|j dd}t |dk(rtj|drydx}x}}|r|dtk(r|dd}d}|rB|dtjtjdk(r|dj}|d d}|Dcgc]}|j} }| r d | d_|||c|%|j| d t!t#||%|j| d t!t#|||j| d |ttd| } |j| _| Scc}w)Nbareprint)prefix z>>sependfile)getreplacerrrchildrenlen parend_exprmatchr rLeafr RIGHTSHIFTclone add_kwargr repr) selfnoderesults bare_printargsrrrargl_argsn_stmts 0/usr/lib64/python3.12/lib2to3/fixes/fix_print.py transformzFixPrint.transform%s[[(    tDM2&0&7&7 9 : }}QR  t9>k//Q8 cD DH'9DC DGv{{5+;+;TBB7==?D8D)-.##))+. !F1I  ?co1AvufT#Y.?@vufT#Y.?@vvt4d7mV,   /s"Fc(d|_tj|jjt |tj tjd|f}|r |jtd|_|j|y)Nr=r) rrNodesymsargumentrr rEQUALappendr )r%l_nodess_kwdn_expr n_arguments r-r#zFixPrint.add_kwargMsk [[!3!3"&u+"(++ekk3"?"("*+   NN57 # #J z"N)__name__ __module__ __qualname__ BM_compatiblePATTERNr.r#r:r-r r sMG&P #r:r N)__doc__rrrpgen2rr fixer_utilrrr r compile_patternrBaseFixr r@r:r-rFsG 22&g%%6 :#z!!:#r:PKz1],fixes/__pycache__/fix_import.cpython-312.pycnu[ {|j pdZddlmZddlmZmZmZmZddlm Z m Z m Z dZ GddejZy ) 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) FromImportsymstokenc#VK|g}|r|j}|jtjk(r|jn|jt j k(r6dj|jDcgc]}|jc}n|jt jk(r|j|jdnJ|jt jk(r"|j|jdddn td|ryycc}ww)zF Walks over all the names imported in a dotted_as_names node. rNzunknown node type)poptyper NAMEvaluer dotted_namerchildrendotted_as_nameappenddotted_as_namesextendAssertionError)namespendingnodechs 1/usr/lib64/python3.12/lib2to3/fixes/fix_import.pytraverse_importsrsgG {{} 99 "**  YY$** *''dmm | import_name< 'import' imp=any > cTtt| ||d|jv|_y)Nabsolute_import)superr! start_treefuture_featuresskip)selftreename __class__s rr%zFixImport.start_tree/s& i)$5%)=)== c|jry|d}|jtjk(rit |ds|j d}t |ds|j |jr%d|jz|_|jyyd}d}t|D]}|j |rd}d}|r|r|j|dytd|g}|j|_ |S)Nimprr.FTz#absolute and local imports together) r'rr import_fromhasattrrprobably_a_local_importrchangedrwarningr prefix)r(rresultsr. have_local have_absolutemod_namenews r transformzFixImport.transform3s 99 en 99(( ( c7+ll1oc7+++CII6#))O  7J!M,S1//9!%J$(M 2 LL'LMS3%(CCJJr,c|jdry|jddd}t|j}t ||}t t t|dsydt ddd d fD]}t ||zsy y) Nr/Frz __init__.pyz.pyz.pycz.soz.slz.pydT) startswithsplitrfilenamerrr)r(imp_name base_pathexts rr2z!FixImport.probably_a_local_importUs   s #>>#q)!,DMM* H- d79-}=>3uf=Ci#o&>r,) __name__ __module__ __qualname__ BM_compatiblePATTERNr%r;r2 __classcell__)r+s@rr!r!&sMG > Dr,r!N)__doc__r ros.pathrrrr fixer_utilr r r rBaseFixr!r,rrOs2 ..006&= ""=r,PKz1]mxAA3fixes/__pycache__/fix_standarderror.cpython-312.pycnu[ {|jJdZddlmZddlmZGddej Zy)z%Fixer for StandardError -> Exception.) fixer_base)NameceZdZdZdZdZy)FixStandarderrorTz- 'StandardError' c0td|jS)N Exception)prefix)rr )selfnoderesultss 8/usr/lib64/python3.12/lib2to3/fixes/fix_standarderror.py transformzFixStandarderror.transformsK 44N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrr rr sMG5rrN)__doc__r fixer_utilrBaseFixrrrr rs$,5z))5rPKz1]Q;5fixes/__pycache__/fix_raw_input.cpython-312.opt-1.pycnu[ {|jJdZddlmZddlmZGddej Zy)z2Fixer that changes raw_input(...) into input(...).) fixer_base)NameceZdZdZdZdZy) FixRawInputTzU power< name='raw_input' trailer< '(' [any] ')' > any* > cZ|d}|jtd|jy)Nnameinput)prefix)replacerr )selfnoderesultsrs 4/usr/lib64/python3.12/lib2to3/fixes/fix_raw_input.py transformzFixRawInput.transforms"v T'$++67N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrsMG8rrN)__doc__r fixer_utilrBaseFixrrrrrs"8 8*$$ 8rPKz1]p 1fixes/__pycache__/fix_apply.cpython-312.opt-1.pycnu[ {|j* jdZddlmZddlmZddlmZddlmZmZm Z GddejZ y) zIFixer for apply(). This converts apply(func, v, k) into (func)(*v, **k).)pytree)token) fixer_base)CallComma parenthesizeceZdZdZdZdZy)FixApplyTa. power< 'apply' trailer< '(' arglist< (not argument ')' > > c|j}|d}|d}|jd}|r?|j|jjk(r|jdj dvry|r@|j|jjk(r|jdj dk(ry|j }|j}|jtj|jfvrN|j|jk7s*|jdjtjk(r t|}d|_|j}d|_||j}d|_tjtj d |g}|H|j#t%tjtjd|gd |d_t'||| S) Nfuncargskwds>***rr )prefix)symsgettypeargumentchildrenvaluerclonerNAMEatompower DOUBLESTARrrLeafSTARextendrr) selfnoderesultsrr r rr l_newargss 0/usr/lib64/python3.12/lib2to3/fixes/fix_apply.py transformzFixApply.transformsyyvv{{6"  TYY/// a &&+5 TYY$))"4"44]]1%++t3 zz| IIejj$))4 4 YY$** $ ]]2  # #u'7'7 7%D zz|  ::r5s-9 2264z!!64r*PKz1]wʹu,fixes/__pycache__/fix_except.cpython-312.pycnu[ {|j |dZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z dZ GddejZy ) 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_listsymsc#Kt|D]L\}}|jtjk(s$|jdj dk(sA|||dzfNyw)Nexceptr) enumeratetyper except_clausechildrenvalue)nodesins 1/usr/lib64/python3.12/lib2to3/fixes/fix_except.py find_exceptsrsS% 1 66T'' 'zz!}""h.%!*o%!s/AAAceZdZdZdZdZy) 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)]) > c |j}|dDcgc]}|j}}|dDcgc]}|j}}t|D]\}} t|jdk(s |jdd\} } } | j t dd| jtjk7r t |jd} | j}d|_ | j | | j} | j}t|D]!\}}t|tjs!nt!| s t#| r t%|t'| t d }n t%|| }t)|dD]}| j+d || j+||v| jdk(sd| _ |jdd Dcgc]}|jc}|z|z}tj|j|Scc}wcc}wcc}w) Ntailcleanupas )prefixargsr )r clonerlenrreplacerrrNAMEnew_namer"r isinstancerNoder r rrreversed insert_child)selfnoderesultsr rrch try_cleanupre_suiteEcommaNnew_Ntarget suite_stmtsrstmtassignchildcrs r transformzFixExcept.transform/syy#*6?3?a ?3,3I,>?,>brxxz,> ?&2;&? "M7=))*a/ - 6 6q ; E1 d44566UZZ' =EWWYF$&FMIIe$!KKME #*"2"2K#,[#94%dFKK8!$:  {gaj!'UDL0I!J!'!6"*+bq/!:,,Q6";((F3XX^ #AHI'@N(,}}Ra'89'8!AGGI'89KG$N{{499h//W4?P:sH:H?:IN)__name__ __module__ __qualname__ BM_compatiblePATTERNr?rrr$sMG.0rFrN)__doc__r#rpgen2rr fixer_utilrrrr r r rBaseFixrrErFrrKs20DD& 90 ""90rFPKz1]  4fixes/__pycache__/fix_exitfunc.cpython-312.opt-2.pycnu[ {|j ` ddlmZmZddlmZmZmZmZmZm Z GddejZ y))pytree fixer_base)NameAttrCallCommaNewlinesymsc:eZdZdZdZdZfdZfdZdZxZ S) FixExitfuncTa ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) c&tt| |yN)superr __init__)selfargs __class__s 3/usr/lib64/python3.12/lib2to3/fixes/fix_exitfunc.pyrzFixExitfunc.__init__s k4)40c<tt| ||d|_yr)rr start_tree sys_import)rtreefilenamers rrzFixExitfunc.start_tree!s k4+D(;rc d|vr|j |d|_y|dj}d|_tjt j ttdtd}t||g|j}|j||j|j|dy|jjd}|jt jk(r5|jt!|jtddy|jj"}|jj%|j}|j"} tjt j&td tddg} tjt j(| g} |j+|dzt-|j+|d z| y) NrfuncatexitregisterzKCan't find sys import; Please add an atexit import at the top of your file. import)rcloneprefixrNoder powerrrrreplacewarningchildrentypedotted_as_names append_childrparentindex import_name simple_stmt insert_childr ) rnoderesultsrrcallnamescontaining_stmtpositionstmt_container new_importnews r transformzFixExitfunc.transform%s 7 "&"),"7 v$$& ;;tzz#DND4DE!Htfdkk2 T ?? " LL ? @ ((+ ::-- -   uw '   tHc2 3"oo44O&//55dooFH,33NT%5%5#H~tHc/BC J++d.. =C  ( (Awy A  ( (As ;r) __name__ __module__ __qualname__keep_line_order BM_compatiblePATTERNrrr< __classcell__)rs@rr r s#OM G1#rHs' 'EE=<*$$= 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_tupleceZdZdZdZdZy)FixThrowTz power< any trailer< '.' 'throw' > trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > | power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > > c|j}|dj}|jtjur|j |dy|j d}|y|j}t|r+|jddDcgc]}|j}}n d|_ |g}|d}d|vry|dj} d| _ t||} t| td t| ggz} |jtj |j"| y|jt||ycc}w) Nexcz+Python 3 does not support string exceptionsvalargstbwith_traceback)symsclonetyperSTRINGcannot_convertgetr childrenprefixrr rrreplacerNodepower) selfnoderesultsrrrcr throw_argsrewith_tbs 0/usr/lib64/python3.12/lib2to3/fixes/fix_throw.py transformzFixThrow.transforms)yyen""$ 88u|| #   &S T kk%  ; iik C='*||Ab'9:'9!AGGI'9D:CJ5DV_ 7?$$&BBIS$A1d#345"GG   v{{4::w? @   tC /;sEN)__name__ __module__ __qualname__ BM_compatiblePATTERNr)r(r r sMG0r0r N)__doc__rrpgen2rr fixer_utilrrrr r BaseFixr r/r0r(r5s-?<<(0z!!(0r0PKz1]#Z3fixes/__pycache__/fix_imports.cpython-312.opt-2.pycnu[ {|j4R ddlmZddlmZmZidddddddd d d d d ddddddddddddddddddddd d!id"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAdBdCdCdDdEdFdGdHdIdIdIdJdKdKdLdMdNZdOZefdPZGdQdRejZ yS)T) fixer_base)Name attr_chainStringIOio cStringIOcPicklepickle __builtin__builtinscopy_regcopyregQueuequeue SocketServer socketserver ConfigParser configparserreprreprlib FileDialogztkinter.filedialog tkFileDialog SimpleDialogztkinter.simpledialogtkSimpleDialogtkColorChooserztkinter.colorchoosertkCommonDialogztkinter.commondialogDialogztkinter.dialogTkdndz tkinter.dndtkFontz tkinter.font tkMessageBoxztkinter.messagebox ScrolledTextztkinter.scrolledtext Tkconstantsztkinter.constantsTixz tkinter.tixttkz tkinter.ttkTkintertkinter markupbase _markupbase_winregwinregthread_thread dummy_thread _dummy_threaddbhashzdbm.bsddumbdbmzdbm.dumbdbmzdbm.ndbmgdbmzdbm.gnu xmlrpclibz xmlrpc.clientDocXMLRPCServerz xmlrpc.serverz http.clientz html.entitiesz html.parserz http.cookieszhttp.cookiejarz http.server subprocess collectionsz urllib.parsezurllib.robotparser)SimpleXMLRPCServerhttplibhtmlentitydefs HTMLParserCookie cookielibBaseHTTPServerSimpleHTTPServer CGIHTTPServercommands UserStringUserListurlparse robotparsercLddjtt|zdzS)N(|))joinmapr)memberss 2/usr/lib64/python3.12/lib2to3/fixes/fix_imports.py alternatesrM=s" #dG,- - 33c#Kdj|Dcgc]}d|z c}}t|j}d|d|dd|zd|d|d d |zycc}ww) Nz | zmodule_name='%s'z$name_import=import_name< 'import' ((z;) | multiple_imports=dotted_as_names< any* (z) any* >) > zimport_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > z(import_name< 'import' (dotted_as_name< (zg) 'as' any > | multiple_imports=dotted_as_names< any* dotted_as_name< (z!) 'as' any > any* >) > z3power< bare_with_attr=(%s) trailer<'.' any > any* >)rIrMkeys)mappingkeymod_list bare_namess rL build_patternrUAszzwGw-3wGHHGLLN+J8 %%  8 %% @* LL!HsA( A#A A(cNeZdZdZdZeZdZdZfdZ fdZ fdZ dZ xZ S) FixImportsTcJdjt|jS)NrG)rIrUrQ)selfs rLrUzFixImports.build_pattern`sxx dll344rNcT|j|_tt|yN)rUPATTERNsuperrWcompile_pattern)rZ __class__s rLr_zFixImports.compile_patterncs"))+  j$/1rNctt| |}|r%d|vrtfdt |dDry|Sy)Nbare_with_attrc3.K|] }|ywr\).0objmatchs rL z#FixImports.match..qsI.Hsc .HsparentF)r^rWrganyr)rZnoderesultsrgr`s @rLrgzFixImports.matchjsEj$-+  w.Ijx.HIINrNc<tt| ||i|_yr\)r^rW start_treereplace)rZtreefilenamer`s rLrnzFixImports.start_treevs j$*4: rNc|jd}|r|j}|j|}|jt ||j d|vr||j|<d|vr'|j |}|r|j||yyy|dd}|jj|j}|r'|jt ||j yy)N module_name)prefix name_importmultiple_importsrb)getvaluerQrorrtrg transform)rZrkrl import_modmod_namenew_name bare_names rLrzzFixImports.transformzs[[/ !''H||H-H   tHZ5F5FG H'*2 X&!W, **T*NN41 - 01!4I||'' 8H!!$x 8H8H"IJrN)__name__ __module__ __qualname__ BM_compatiblekeep_line_orderMAPPINGrQ run_orderrUr_rgrnrz __classcell__)r`s@rLrWrWUs3MOGI52 KrNrWN) r fixer_utilrrrrMrUBaseFixrWrdrNrLrs5)2 :2  2  h2  :2  y 2  G 2  > 2  >2  92  -2  /2  12  32  32  32  %2  M!2 " ^#2 $ /%2 & 1'2 ( -)2 * -+2 , --2 . i/2 0 12 2 h32 4 Y52 6 ?72 : Y;2 < j=2 > *?2 @ 9A2 B C2 D oE2 F"1#-'#(*,)#'%&/c2 j4"M(<K##<KrNPKz1]+ȳr.fixes/__pycache__/fix_ws_comma.cpython-312.pycnu[ {|jBVdZddlmZddlmZddlmZGddej Zy)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_baseceZdZdZdZej ejdZej ejdZ ee fZ dZ y) FixWsCommaTzH any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]> ,:c|j}d}|jD]S}||jvr*|j}|j r d|vrd|_d};|r|j}|sd|_d}U|S)NF T )clonechildrenSEPSprefixisspace)selfnoderesultsnewcommachildrs 3/usr/lib64/python3.12/lib2to3/fixes/fix_ws_comma.py transformzFixWsComma.transformstjjl\\E !>>#F(:#%EL"\\F!'* " N) __name__ __module__ __qualname__explicitPATTERNrLeafrCOMMACOLONrrrrrr sJHG FKK S )E FKK S )E 5>DrrN)__doc__r rpgen2rrBaseFixrr$rrr(s'##rPKz1]qWW1fixes/__pycache__/fix_paren.cpython-312.opt-1.pycnu[ {|jNdZddlmZddlmZmZGddej Zy)ztFixer that adds parentheses where they are required This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``.) fixer_base)LParenRParenceZdZdZdZdZy)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] > >) (']' | ')') > c|d}t}|j|_d|_|jd||jt y)Ntarget)rprefix insert_child append_childr)selfnoderesultsr lparens 0/usr/lib64/python3.12/lib2to3/fixes/fix_paren.py transformzFixParen.transform%sE"   Av&FH%N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG,&rrN)__doc__r r fixer_utilrrBaseFixrrrrrs%C' &z!! &rPKz1] _!#!#5fixes/__pycache__/fix_metaclass.cpython-312.opt-2.pycnu[ {|j  ddlmZddlmZddlmZmZmZdZdZ dZ dZ dZ d Z Gd d ejZy ) ) fixer_base)token)symsNodeLeafc |jD]}|jtjk(r t |cS|jtj k(sK|jsX|jd}|jtj k(s|js|jd}t|ts|jdk(syy)N __metaclass__TF) childrentypersuite has_metaclass simple_stmt expr_stmt isinstancervalue)parentnode expr_node left_sides 4/usr/lib64/python3.12/lib2to3/fixes/fix_metaclass.pyrrs  99 " & & YY$** *t}} a(I~~/I4F4F%..q1 i.!?:  c |jD]!}|jtjk(s!yt |jD]$\}}|jt j k(s$n tdttjg}|j|dzdrT|j|dz}|j|j|j|j|dzdrT|j||}y)NzNo class suite and no ':'!) r r rr enumeraterCOLON ValueErrorr append_childcloneremove)cls_noderir move_nodes rfixup_parse_treer$-s!! 99 " " X../4 99 # 0566 R E   AaCD !%%ac*  9??,-   AaCD ! % Drcz t|jD]$\}}|jtjk(s$ny|j t tjg}t tj|g}|j|drN|j|}|j|j|j |j|drN|j|||jdjd}|jdjd} | j|_ y)Nr )rr r rSEMIr rrrrrr insert_childprefix) rr" stmt_nodesemi_indrnew_exprnew_stmtr# new_leaf1 old_leaf1s rfixup_simple_stmtr/Gs$I$6$67$ 99 " 8 KKMDNNB'HD$$xj1H   XY '&&x0 ioo/0   XY ' 8$!!!$--a0I""1%..q1I ''Irc|jrI|jdjtjk(r|jdj yyy)N)r r rNEWLINEr )rs rremove_trailing_newliner3_s@ }}r*//5==@ b  "A}rc#6K|jD]!}|jtjk(s!n t dt t |jD]\}}|jtjk(s$|js1|jd}|jtjk(s^|jsk|jd}t|ts|jdk(st|||t||||fyw)NzNo class suite!r r )r r rr rlistrrrrrrr/r3)r!rr" simple_noder left_nodes r find_metasr8ds!! 99 " "*++y78;   t// /K4H4H#,,Q/I~~/I4F4F%..q1 i.!?:%dA{;+K8K009s/-DAD D ,D: DD'D7"Dc |jddd}|r1|j}|jtjk(rn|r1|rv|j}t |t r1|jtjk7r|jrd|_y|j|jddd|ruyy)Nr1) r popr rINDENTrrDEDENTr(extend)r kidsrs r fixup_indentr@{s >>$B$ D xxz 99 $   xxz dD !dii5<<&?{{   KK dd+ , rceZdZdZdZdZy) FixMetaclassTz classdef ct|syt|d}t|D]\}}}|}|j|jdj }t |jdk(r|jdj tjk(r|jd}n4|jdj} ttj| g}|jd|nt |jdk(r-ttjg}|jd|nt |jdk(rttjg}|jdttjd|jd||jdttj dn t#d |jdjd} d | _| j&} |jr1|j)ttj*d d | _nd | _|jd} d | jd_d | jd_|j)|t-|js^|jt|d} | | _|j)| |j)ttj.dyt |jdkDr|jdj tj0k(rt|jdj tj2k(rIt|d} |jd| |jdttj.dyyyy)Nr r)(zUnexpected class definition metaclass, r:rpass r1)rr$r8r r r lenrarglistrr set_childr'rrRPARLPARrrr(rCOMMAr@r2r<r=)selfrresultslast_metaclassr r"stmt text_typerQrmeta_txtorig_meta_prefixr pass_leafs r transformzFixMetaclass.transformsT" (.NE1d!N KKM/MM!$))  t}}  "}}Q$$ 4--*q)//1t||fX6q'*  1 $4<<,G   a )  1 $4<<,G   aejj#!6 7   a )   aejj#!6 7:; ;"**1-66q9$#??     ekk3!7 8!HO HO#++A. ') 1$') 1$^,U~~ LLNY/I/I    i (   d5==$7 8  1 $..$))U\\9..$))U\\9Y/I   r9 -   r4 t#< = ::%rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr^rrrBrBsMGL>rrBN)r:rpygramr fixer_utilrrrrr$r/r3r8r@BaseFixrBrdrrrhsJ())&4(0# 1.-,S>:%%S>rPKz1]ƦVV,fixes/__pycache__/fix_idioms.cpython-312.pycnu[ {|j fdZddlmZddlmZmZmZmZmZm Z dZ dZ GddejZ y) 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 ')' > >c XeZdZdZdedededed ZfdZdZdZ d Z d Z xZ S) FixIdiomsTz isinstance=comparison<  z8 T=any > | isinstance=comparison< T=any aX > | 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* > cVtt| |}|rd|vr|d|dk(r|Sy|S)Nsortedid1id2)superr match)selfnoder __class__s 1/usr/lib64/python3.12/lib2to3/fixes/fix_idioms.pyrzFixIdioms.matchOs< )T ( . Qx1U8#cd|vr|j||Sd|vr|j||Sd|vr|j||Std)N isinstancewhilerz Invalid match)transform_isinstancetransform_whiletransform_sort RuntimeError)rrresultss r transformzFixIdioms.transformZs^ 7 ",,T7; ;  ''g6 6  &&tW5 5/ /rc0|dj}|dj}d|_d|_ttd|t |g}d|vr,d|_t t jtd|g}|j|_|S)NxTr rnnot)cloneprefixrrrrr not_test)rrr r#r$tests rrzFixIdioms.transform_isinstanceds CL    CL   D&EGQ8 '>DK U T':;Dkk  rcZ|d}|jtd|jy)NrTruer))replacerr))rrr ones rrzFixIdioms.transform_whileps#g D 34rc|d}|d}|jd}|jd}|r'|jtd|jnV|rI|j }d|_|jt td|g|jn t d|j|j}d |vr|r=|jd d |d jf} d j| |d _y|jsJ|jJt} |jj| |j| usJ|jd d | _yy) Nsortnextlistexprrr.r%zshould not have reached here )getr/rr)r(rrremove rpartitionjoinparent next_siblingr append_child) rrr sort_stmt next_stmt list_call simple_exprnewbtwn prefix_linesend_lines rrzFixIdioms.transform_sorttsfFO FO KK' kk&)    d8I4D4DE F ##%CCJ   T(^cU,7,>,>!@ A=> > 4<!% 5a 8)A,:M:MN &*ii &= ! # '''' --555$;  --h7 --999#'//$"7":! r) __name__ __module__ __qualname__explicitTYPECMPPATTERNrr!rrr __classcell__)rs@rr r %s6HN c4K%!GN 0 5$;rr N)__doc__r%r fixer_utilrrrrrr rLrKBaseFixr rrrSs3<AA81s; ""s;rPKz1])Cn 3fixes/__pycache__/fix_renames.cpython-312.opt-2.pycnu[ {|jh ddlmZddlmZmZdddiiZiZdZdZGdd ejZ y ) ) fixer_base)Name attr_chainsysmaxintmaxsizecLddjtt|zdzS)N(|))joinmaprepr)memberss 2/usr/lib64/python3.12/lib2to3/fixes/fix_renames.py alternatesrs" #dG,- - 33c #KttjD]J\}}t|jD])\}}|t||f<d|d|d|dd|d|d+Lyw)Nz3 import_from< 'from' module_name=z, 'import' ( attr_name=z | import_as_name< attr_name=z! 'as' any >) > z& power< module_name=z trailer< '.' attr_name=z > any* > )listMAPPINGitemsLOOKUP)modulereplaceold_attrnew_attrs r build_patternrsl 0"&w}}"7 Hh)1FFH% & 85 5  + +#81sA,A.cXeZdZdZdj eZdZfdZdZ xZ S) FixRenamesTr precztt| |}|r!tfdt |dDry|Sy)Nc3.K|] }|yw)N).0objmatchs r z#FixRenames.match..5sD)C#5:)CsparentF)superrr&anyr)selfnoderesultsr& __class__s @rr&zFixRenames.match1s;j$-+ DD()CDDNrc|jd}|jd}|rI|rFt|j|jf}|jt ||j yyy)N module_name attr_name)prefix)getrvaluerrr2)r+r,r-mod_namer1rs r transformzFixRenames.transform>s^;;}-KK ,   x~~y?@H   d8I4D4DE F"8r) __name__ __module__ __qualname__ BM_compatibler rPATTERNorderr&r6 __classcell__)r.s@rrr*s(Mhh}'G EGrrN) r fixer_utilrrrrrrBaseFixrr#rrrAsF) Hy)  4+*G##GrPKz1] 3fixes/__pycache__/fix_unicode.cpython-312.opt-2.pycnu[ {|jR ddlmZddlmZdddZGddej Zy) )token) fixer_basechrstr)unichrunicodec,eZdZdZdZfdZdZxZS) FixUnicodeTzSTRING | 'unicode' | 'unichr'cTtt| ||d|jv|_y)Nunicode_literals)superr start_treefuture_featuresr )selftreefilename __class__s 2/usr/lib64/python3.12/lib2to3/fixes/fix_unicode.pyrzFixUnicode.start_trees' j$*4: 2d6J6J Jc $|jtjk(r*|j}t|j |_|S|jtj k(r|j }|jsY|ddvrRd|vrNdj|jdDcgc]$}|jddjdd&c}}|dd vr|d d}||j k(r|S|j}||_|Sycc}w) Nz'"\z\\z\uz\\uz\Uz\\UuU) typerNAMEclone_mappingvalueSTRINGr joinsplitreplace)rnoderesultsnewvalvs r transformzFixUnicode.transforms 99 "**,C ,CIJ YY%,, &**C((SVu_jj YYu-"-IIeV,44UFC-"1v~!"gdjj  **,CCIJ'"s&)D )__name__ __module__ __qualname__ BM_compatiblePATTERNrr) __classcell__)rs@rr r sM-GKrr N)pgen2rrrBaseFixr rrr4s.% 0##rPKz1][r1fixes/__pycache__/fix_input.cpython-312.opt-1.pycnu[ {|j~dZddlmZddlmZmZddlmZejdZGddejZ y) z4Fixer that changes input(...) into eval(input(...)).) fixer_base)CallName)patcompz&power< 'eval' trailer< '(' any ')' > >ceZdZdZdZdZy)FixInputTzL power< 'input' args=trailer< '(' [any] ')' > > ctj|jjry|j}d|_t t d|g|jS)Neval)prefix)contextmatchparentcloner rr)selfnoderesultsnews 0/usr/lib64/python3.12/lib2to3/fixes/fix_input.py transformzFixInput.transformsF ==++ , jjl DL3% <<N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG=rrN) __doc__r r fixer_utilrrrcompile_patternr BaseFixrrrrr"s::# "' ! !"J K =z!! =rPKz1]w!!2fixes/__pycache__/fix_urllib.cpython-312.opt-2.pycnu[ {|j  ddlmZmZddlmZmZmZmZmZm Z m Z dgdfdgdfddgfgdgd fdd d gfgd Z e d je dddZ GddeZy)) alternates FixImports)NameComma FromImportNewlinefind_indentationNodesymszurllib.request) URLopenerFancyURLopener urlretrieve _urlopenerurlopen urlcleanup pathname2url url2pathname getproxiesz urllib.parse)quote quote_plusunquote unquote_plus urlencode splitattr splithost splitnport splitpasswd splitport splitquerysplittag splittype splituser splitvaluez urllib.errorContentTooShortError)rinstall_opener build_openerRequestOpenerDirector BaseHandlerHTTPDefaultErrorHandlerHTTPRedirectHandlerHTTPCookieProcessor ProxyHandlerHTTPPasswordMgrHTTPPasswordMgrWithDefaultRealmAbstractBasicAuthHandlerHTTPBasicAuthHandlerProxyBasicAuthHandlerAbstractDigestAuthHandlerHTTPDigestAuthHandlerProxyDigestAuthHandler HTTPHandler HTTPSHandler FileHandler FTPHandlerCacheFTPHandlerUnknownHandlerURLError HTTPError)urlliburllib2r?r>c #Kt}tjD]N\}}|D]D}|\}}t|}d|d|dd|d|d|dd|zd |zd |d |d FPyw) Nzimport_name< 'import' (module=zB | dotted_as_names< any* module=z any* >) > zimport_from< 'from' mod_member=z* 'import' ( member=z | import_as_name< member=z] '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 > > zpower< bare_with_attr=z trailer< '.' member=z > any* > )setMAPPINGitemsr)bare old_modulechangeschange new_modulememberss 1/usr/lib64/python3.12/lib2to3/fixes/fix_urllib.py build_patternrL0s 5D&}} GF"( J )G$Z1 1 $Wg7 7"# #"# # $W. .! /sA1A3c*eZdZdZdZdZdZdZy) FixUrllibc4djtS)N|)joinrL)selfs rKrLzFixUrllib.build_patternIsxx ((cT |jd}|j}g}t|jddD]+}|j t |d|t g-|jt t|jdd||j|y)Nmodulerprefix) getrXrCvalueextendrrappendreplace)rRnoderesults import_modprefnamesnames rKtransform_importzFixUrllib.transform_importLs [[*   J,,-cr2D LL$tAwt4eg> ?3 T'*"2"23B7:4HI5!rScF |jd}|j}|jd}|ryt|tr|d}d}t|j D]}|j |dvs|d}n|r|j t||y|j|dyg}i} |d} | D]}|jtjk(r3|jdj } |jdj } n|j } d} | d k7sgt|j D]I}| |dvs |d| vr|j|d| j|dgj|Kg} t|}d }d }|D]}| |}g}|dd D]3}|j!||||jt#5|j!||d |t%||}|r%|j&jj)|r||_| j|d }| rMg}| dd D]}|j!|t+g|j| d |j |y|j|dy)N mod_membermemberrr@rW!This is an invalid module elementrJ,Tc\|jtjk(rxt|jdj ||jdj |jdj g}ttj|gSt|j |gS)NrrWr@ri)typer import_as_namerchildrenrZcloner )rcrXkidss rK handle_namez/FixUrllib.transform_member..handle_names99 3 33 q!1!7!7G MM!,224 MM!,2246D!!4!4d;<<TZZ788rSrVFzAll module elements are invalid)rYrX isinstancelistrCrZr]rcannot_convertrlr rmrnr\ setdefaultr r[rrparentendswithr)rRr^r_rfrargnew_namerHmodulesmod_dictrJas_name member_name new_nodes indentationfirstrqrUeltsrbeltnewnodesnew_nodes rKtransform_memberzFixUrllib.transform_member\s [[.   X& &$'H!*"2"23<<6!9,%ayH4""4#>?##D*MN GHi(G!;;$"5"55$ooa066G"(//!"4":":K"(,,K"G#%")**:*:";&&)3%ay8 'vay 9$//q 2>EEfM #<"I*40KE 9"'9CLLS$!78LL)% [b489 / 2 2 ; ;K H!,CJ  %" )#2HLL(GI!67!/ Yr]+ U###D*KLrScN |jd}|jd}d}t|tr|d}t|jD]}|j|dvs|d}n|r'|j t ||jy|j|dy)Nbare_with_attrrgrr@rWrh) rYrrrsrCrZr]rrXrt)rRr^r_ module_dotrgrxrHs rK transform_dotzFixUrllib.transform_dots<[[!12 X& fd #AYFj../F||vay(!!90    tH+5+<+< > ?   &I JrScl|jdr|j||y|jdr|j||y|jdr|j||y|jdr|j |dy|jdr|j |dyy)NrUrfr module_starzCannot handle star imports. module_asz#This module is now multiple modules)rYrdrrrt)rRr^r_s rK transformzFixUrllib.transforms ;;x  ! !$ 0 [[ &  ! !$ 0 [[) *   tW - [[ '   &C D [[ %   &K L&rSN)__name__ __module__ __qualname__rLrdrrrrSrKrNrNGs )" JMXK" MrSrNN)lib2to3.fixes.fix_importsrrlib2to3.fixer_utilrrrrr r r rCr\rLrNrrSrKrs=>>>"CD ?@  +,. /" ' ( -/  B '(+A./..}M }MrSPKz1]Q;/fixes/__pycache__/fix_raw_input.cpython-312.pycnu[ {|jJdZddlmZddlmZGddej Zy)z2Fixer that changes raw_input(...) into input(...).) fixer_base)NameceZdZdZdZdZy) FixRawInputTzU power< name='raw_input' trailer< '(' [any] ')' > any* > cZ|d}|jtd|jy)Nnameinput)prefix)replacerr )selfnoderesultsrs 4/usr/lib64/python3.12/lib2to3/fixes/fix_raw_input.py transformzFixRawInput.transforms"v T'$++67N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrsMG8rrN)__doc__r fixer_utilrBaseFixrrrrrs"8 8*$$ 8rPKz1]cdd.fixes/__pycache__/fix_imports2.cpython-312.pycnu[ {|j!HdZddlmZdddZGddejZy)zTFix incompatible imports and module references that must be fixed after fix_imports.) fix_importsdbm)whichdbanydbmceZdZdZeZy) FixImports2N)__name__ __module__ __qualname__ run_orderMAPPINGmapping3/usr/lib64/python3.12/lib2to3/fixes/fix_imports2.pyrr s IGrrN)__doc__rr FixImportsrrrrrs.  +((rPKz1]EOw-fixes/__pycache__/fix_imports.cpython-312.pycnu[ {|j4TdZddlmZddlmZmZiddddddd d d d d ddddddddddddddddddddd d!d"id#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdDdEdFdGdHdIdJdJdJdKdLdLdMdNdOZdPZefdQZGdRdSejZ yT)Uz/Fix incompatible imports and module references.) fixer_base)Name attr_chainStringIOio cStringIOcPicklepickle __builtin__builtinscopy_regcopyregQueuequeue SocketServer socketserver ConfigParser configparserreprreprlib FileDialogztkinter.filedialog tkFileDialog SimpleDialogztkinter.simpledialogtkSimpleDialogtkColorChooserztkinter.colorchoosertkCommonDialogztkinter.commondialogDialogztkinter.dialogTkdndz tkinter.dndtkFontz tkinter.font tkMessageBoxztkinter.messagebox ScrolledTextztkinter.scrolledtext Tkconstantsztkinter.constantsTixz tkinter.tixttkz tkinter.ttkTkintertkinter markupbase _markupbase_winregwinregthread_thread dummy_thread _dummy_threaddbhashzdbm.bsddumbdbmzdbm.dumbdbmzdbm.ndbmgdbmzdbm.gnu xmlrpclibz xmlrpc.clientDocXMLRPCServerz xmlrpc.serverz http.clientz html.entitiesz html.parserz http.cookieszhttp.cookiejarz http.server subprocess collectionsz urllib.parsezurllib.robotparser)SimpleXMLRPCServerhttplibhtmlentitydefs HTMLParserCookie cookielibBaseHTTPServerSimpleHTTPServer CGIHTTPServercommands UserStringUserListurlparse robotparsercLddjtt|zdzS)N(|))joinmapr)memberss 2/usr/lib64/python3.12/lib2to3/fixes/fix_imports.py alternatesrM=s" #dG,- - 33c#Kdj|Dcgc]}d|z c}}t|j}d|d|dd|zd|d|d d |zycc}ww) Nz | zmodule_name='%s'z$name_import=import_name< 'import' ((z;) | multiple_imports=dotted_as_names< any* (z) any* >) > zimport_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > z(import_name< 'import' (dotted_as_name< (zg) 'as' any > | multiple_imports=dotted_as_names< any* dotted_as_name< (z!) 'as' any > any* >) > z3power< bare_with_attr=(%s) trailer<'.' any > any* >)rIrMkeys)mappingkeymod_list bare_namess rL build_patternrUAszzwGw-3wGHHGLLN+J8 %%  8 %% @* LL!HsA( A#A A(cNeZdZdZdZeZdZdZfdZ fdZ fdZ dZ xZ S) FixImportsTcJdjt|jS)NrG)rIrUrQ)selfs rLrUzFixImports.build_pattern`sxx dll344rNcT|j|_tt|yN)rUPATTERNsuperrWcompile_pattern)rZ __class__s rLr_zFixImports.compile_patterncs"))+  j$/1rNctt| |}|r%d|vrtfdt |dDry|Sy)Nbare_with_attrc3.K|] }|ywr\).0objmatchs rL z#FixImports.match..qsI.Hsc .HsparentF)r^rWrganyr)rZnoderesultsrgr`s @rLrgzFixImports.matchjsEj$-+  w.Ijx.HIINrNc<tt| ||i|_yr\)r^rW start_treereplace)rZtreefilenamer`s rLrnzFixImports.start_treevs j$*4: rNc|jd}|r|j}|j|}|jt ||j d|vr||j|<d|vr'|j |}|r|j||yyy|dd}|jj|j}|r'|jt ||j yy)N module_name)prefix name_importmultiple_importsrb)getvaluerQrorrtrg transform)rZrkrl import_modmod_namenew_name bare_names rLrzzFixImports.transformzs[[/ !''H||H-H   tHZ5F5FG H'*2 X&!W, **T*NN41 - 01!4I||'' 8H!!$x 8H8H"IJrN)__name__ __module__ __qualname__ BM_compatiblekeep_line_orderMAPPINGrQ run_orderrUr_rgrnrz __classcell__)r`s@rLrWrWUs3MOGI52 KrNrWN) __doc__r fixer_utilrrrrMrUBaseFixrWrdrNrLrs5)2 :2  2  h2  :2  y 2  G 2  > 2  >2  92  -2  /2  12  32  32  32  %2  M!2 " ^#2 $ /%2 & 1'2 ( -)2 * -+2 , --2 . i/2 0 12 2 h32 4 Y52 6 ?72 : Y;2 < j=2 > *?2 @ 9A2 B C2 D oE2 F"1#-'#(*,)#'%&/c2 j4"M(<K##<KrNPKz1]rc880fixes/__pycache__/fix_exec.cpython-312.opt-1.pycnu[ {|jRdZddlmZddlmZmZmZGddejZy)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)CommaNameCallceZdZdZdZdZy)FixExecTzx exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > | exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > c|j}|d}|jd}|jd}|jg}d|d_|)|j t |jg|)|j t |jgt td||jS)Nabcexec)prefix)symsgetclonerextendrrr)selfnoderesultsrr r r argss //usr/lib64/python3.12/lib2to3/fixes/fix_exec.py transformzFixExec.transformsyy CL KK  KK  {Q = KK!''), - = KK!''), -DL$t{{;;N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrsMG r%s'**rs.  +((rPKz1]~Y-fixes/__pycache__/fix_sys_exc.cpython-312.pycnu[ {|j bdZddlmZddlmZmZmZmZmZm Z m Z GddejZ y)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 SubscriptNodesymscTeZdZgdZdZddj deDzZdZy) FixSysExc)exc_type exc_value exc_tracebackTzN power< 'sys' trailer< dot='.' attribute=(%s) > > |c#&K|] }d|z yw)z'%s'N).0es 2/usr/lib64/python3.12/lib2to3/fixes/fix_sys_exc.py zFixSysExc.s:AVaZsc|dd}t|jj|j}t t d|j }tt d|}|dj |djd_|jt|ttj||j S)N attributeexc_info)prefixsysdot)rrindexvaluerrrrchildrenappendrr r power)selfnoderesultssys_attrrcallattrs r transformzFixSysExc.transforms;'*t}}**8>>:;D$X__=DK&%,U^%:%:Q" Ie$%DJJT[[99N)__name__ __module__ __qualname__r BM_compatiblejoinPATTERNr*rr+rr r s/9HMHH:::;G:r+r N) __doc__r fixer_utilrrrrrr r BaseFixr rr+rr6s*HHH: "":r+PKz1]ܷ1fixes/__pycache__/fix_input.cpython-312.opt-2.pycnu[ {|j| ddlmZddlmZmZddlmZej dZGddejZ y)) fixer_base)CallName)patcompz&power< 'eval' trailer< '(' any ')' > >ceZdZdZdZdZy)FixInputTzL power< 'input' args=trailer< '(' [any] ')' > > ctj|jjry|j}d|_t t d|g|jS)Neval)prefix)contextmatchparentcloner rr)selfnoderesultsnews 0/usr/lib64/python3.12/lib2to3/fixes/fix_input.py transformzFixInput.transformsF ==++ , jjl DL3% <<N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG=rrN) r r fixer_utilrrrcompile_patternr BaseFixrrrrr!s::# "' ! !"J K =z!! =rPKz1]T˿  *fixes/__pycache__/fix_next.cpython-312.pycnu[ {|jf dZddlmZddlmZddlmZddlm Z m Z m Z dZ GddejZd Zd Zd Zy ) 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 bindingc0eZdZdZdZdZfdZdZxZS)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* > prectt| ||td|}|r|j |t d|_yd|_y)NnextTF)superr start_treerwarning bind_warning shadowed_next)selftreefilenamen __class__s //usr/lib64/python3.12/lib2to3/fixes/fix_next.pyrzFixNext.start_tree$sA gt'h7  & LLL )!%D !&D c4|sJ|jd}|jd}|jd}|r|jr'|jtd|jy|Dcgc]}|j }}d|d_|jt td|j|y|r)td|j}|j|y|r{t|rU|d }dj|Dcgc] }t|c}jd k(r|j|ty|jtdyd |vr|j|td |_yycc}wcc}w) Nbaseattrname__next__)prefixr head __builtin__globalT) getrreplacerrcloneris_assign_targetjoinstrstriprr)rnoderesultsrrrrr"s r transformzFixNext.transform.sIw{{6"{{6"{{6" !! T*T[[AB+/04a 40!#Q T$vdkk"BDIJ Z 4A LLO  %v77D1DqCFD1288:mKLL|4 LLj) *  LL| ,!%D !!12s 1FF) __name__ __module__ __qualname__ BM_compatiblePATTERNorderrr. __classcell__)rs@rr r s M G E'&rr ct|}|y|jD]/}|jtjk(ryt ||s/yy)NFT) find_assignchildrentyperEQUAL is_subtree)r,assignchilds rr(r(QsG  F ~ :: $ t $ ! rc|jtjk(r|S|jtjk(s |jyt |jSN)r9syms expr_stmt simple_stmtparentr7)r,s rr7r7]sD yyDNN"  yyD$$$ (; t{{ ##rcL|k(rytfd|jDS)NTc36K|]}t|ywr?)r;).0cr,s r zis_subtree..gs:Mqz!T"Ms)anyr8)rootr,s `rr;r;ds" t| :DMM: ::rN)__doc__pgen2rpygramrr@r r fixer_utilrrrrBaseFixr r(r7r;rrrQs@4+11L :&j  :&@ $;rPKz1]t#-fixes/__pycache__/fix_asserts.cpython-312.pycnu[ {|jbdZddlmZddlmZedddddd d dddddd d ZGddeZy)z5Fixer that replaces deprecated unittest method names.)BaseFix)Name assertTrue assertEqualassertNotEqualassertAlmostEqualassertNotAlmostEqual assertRegexassertRaisesRegex assertRaises assertFalse)assert_ assertEqualsassertNotEqualsassertAlmostEqualsassertNotAlmostEqualsassertRegexpMatchesassertRaisesRegexpfailUnlessEqual failIfEqualfailUnlessAlmostEqualfailIfAlmostEqual failUnlessfailUnlessRaisesfailIfcHeZdZddjeeezZdZy) FixAssertszH power< any+ trailer< '.' meth=(%s)> any* > |c|dd}|jttt||jy)Nmeth)prefix)replacerNAMESstrr")selfnoderesultsnames 2/usr/lib64/python3.12/lib2to3/fixes/fix_asserts.py transformzFixAsserts.transform s0vq! T%D *4;;?@N) __name__ __module__ __qualname__joinmapreprr$PATTERNr+r,r*rrs'HHSu-./GAr,rN)__doc__ fixer_baser fixer_utilrdictr$rr4r,r*r9sR;! $*0%*! -,#  $AAr,PKz1]/fixes/__pycache__/fix_itertools.cpython-312.pycnu[ {|j JdZddlmZddlmZGddej Zy)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)Namec2eZdZdZdZdezZdZdZy) 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] ')' > > cPd}|dd}d|vr_|jdvrQ|d|d}}|j}|j|j|jj ||xs |j}|j t |jdd|y)Nfuncit) ifilterfalse izip_longestdot)prefix)valuerremoveparentreplacer)selfnoderesultsrr rr s 4/usr/lib64/python3.12/lib2to3/fixes/fix_itertools.py transformzFixItertools.transformsvq! GO JJ> >u~wt}CYYF IIK JJL KK   %&4;; T$**QR.89N) __name__ __module__ __qualname__ BM_compatibleit_funcslocalsPATTERN run_orderrrrrrs+MHH H GI:rrN)__doc__r fixer_utilrBaseFixrr#rrr(s$::%%:rPKz1] $e(e(5fixes/__pycache__/fix_metaclass.cpython-312.opt-1.pycnu[ {|j dZddlmZddlmZddlmZmZmZdZ dZ dZ dZ d Z d ZGd d ejZy )aFixer for __metaclass__ = X -> (metaclass=X) methods. The various forms of classef (inherits nothing, inherits once, inherits 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)symsNodeLeafc|jD]}|jtjk(r t |cS|jtj k(sK|jsX|jd}|jtj k(s|js|jd}t|ts|jdk(syy)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_node left_sides 4/usr/lib64/python3.12/lib2to3/fixes/fix_metaclass.pyrrs  99 " & & YY$** *t}} a(I~~/I4F4F%..q1 i.!?:  c|jD]!}|jtjk(s!yt |jD]$\}}|jt j k(s$n tdttjg}|j|dzdrT|j|dz}|j|j|j|j|dzdrT|j||}y)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_nodes rfixup_parse_treer$-s!! 99 " " X../4 99 # 0566 R E   AaCD !%%ac*  9??,-   AaCD ! % Drcxt|jD]$\}}|jtjk(s$ny|j t tjg}t tj|g}|j|drN|j|}|j|j|j |j|drN|j|||jdjd}|jdjd} | j|_ y)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 rSEMIr rrrrrr insert_childprefix) rr" stmt_nodesemi_indrnew_exprnew_stmtr# new_leaf1 old_leaf1s rfixup_simple_stmtr/Gs  $I$6$67$ 99 " 8 KKMDNNB'HD$$xj1H   XY '&&x0 ioo/0   XY ' 8$!!!$--a0I""1%..q1I ''Irc|jrI|jdjtjk(r|jdj yyy)N)r r rNEWLINEr )rs rremove_trailing_newliner3_s@ }}r*//5==@ b  "A}rc#6K|jD]!}|jtjk(s!n t dt t |jD]\}}|jtjk(s$|js1|jd}|jtjk(s^|jsk|jd}t|ts|jdk(st|||t||||fyw)NzNo class suite!r r )r r rr rlistrrrrrrr/r3)r!rr" simple_noder left_nodes r find_metasr8ds!! 99 " "*++y78;   t// /K4H4H#,,Q/I~~/I4F4F%..q1 i.!?:%dA{;+K8K009s/-DAD D ,D: DD'D7"Dc~|jddd}|r1|j}|jtjk(rn|r1|rv|j}t |t r1|jtjk7r|jrd|_y|j|jddd|ruyy)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 Nr1) r popr rINDENTrrDEDENTr(extend)r kidsrs r fixup_indentr@{s >>$B$ D xxz 99 $   xxz dD !dii5<<&?{{   KK dd+ , rceZdZdZdZdZy) FixMetaclassTz classdef ct|syt|d}t|D]\}}}|}|j|jdj }t |jdk(r|jdj tjk(r|jd}n4|jdj} ttj| g}|jd|nt |jdk(r-ttjg}|jd|nt |jdk(rttjg}|jdttjd|jd||jdttj dn t#d |jdjd} d | _| j&} |jr1|j)ttj*d d | _nd | _|jd} d | jd_d | jd_|j)|t-|js^|jt|d} | | _|j)| |j)ttj.dyt |jdkDr|jdj tj0k(rt|jdj tj2k(rIt|d} |jd| |jdttj.dyyyy)Nr r)(zUnexpected class definition metaclass, r:rpass r1)rr$r8r r r lenrarglistrr set_childr'rrRPARLPARrrr(rCOMMAr@r2r<r=)selfrresultslast_metaclassr r"stmt text_typerQrmeta_txtorig_meta_prefixr pass_leafs r transformzFixMetaclass.transformsT" (.NE1d!N KKM/MM!$))  t}}  "}}Q$$ 4--*q)//1t||fX6q'*  1 $4<<,G   a )  1 $4<<,G   aejj#!6 7   a )   aejj#!6 7:; ;"**1-66q9$#??     ekk3!7 8!HO HO#++A. ') 1$') 1$^,U~~ LLNY/I/I    i (   d5==$7 8  1 $..$))U\\9..$))U\\9Y/I   r9 -   r4 t#< = ::%rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr^rrrBrBsMGL>rrBN)__doc__r:rpygramr fixer_utilrrrrr$r/r3r8r@BaseFixrBrdrrrisJ())&4(0# 1.-,S>:%%S>rPKz1]֥IL 2fixes/__pycache__/fix_except.cpython-312.opt-2.pycnu[ {|j z ddlmZddlmZddlmZddlmZmZmZm Z m Z m Z dZ GddejZy) )pytree)token) fixer_base)AssignAttrNameis_tupleis_listsymsc#Kt|D]L\}}|jtjk(s$|jdj dk(sA|||dzfNyw)Nexceptr) enumeratetyper except_clausechildrenvalue)nodesins 1/usr/lib64/python3.12/lib2to3/fixes/fix_except.py find_exceptsrsS% 1 66T'' 'zz!}""h.%!*o%!s/AAAceZdZdZdZdZy) 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)]) > c |j}|dDcgc]}|j}}|dDcgc]}|j}}t|D]\}} t|jdk(s |jdd\} } } | j t dd| jtjk7r t |jd} | j}d|_ | j | | j} | j}t|D]!\}}t|tjs!nt!| s t#| r t%|t'| t d }n t%|| }t)|dD]}| j+d || j+||v| jdk(sd| _ |jdd Dcgc]}|jc}|z|z}tj|j|Scc}wcc}wcc}w) Ntailcleanupas )prefixargsr )r clonerlenrreplacerrrNAMEnew_namer"r isinstancerNoder r rrreversed insert_child)selfnoderesultsr rrch try_cleanupre_suiteEcommaNnew_Ntarget suite_stmtsrstmtassignchildcrs r transformzFixExcept.transform/syy#*6?3?a ?3,3I,>?,>brxxz,> ?&2;&? "M7=))*a/ - 6 6q ; E1 d44566UZZ' =EWWYF$&FMIIe$!KKME #*"2"2K#,[#94%dFKK8!$:  {gaj!'UDL0I!J!'!6"*+bq/!:,,Q6";((F3XX^ #AHI'@N(,}}Ra'89'8!AGGI'89KG$N{{499h//W4?P:sH:H?:IN)__name__ __module__ __qualname__ BM_compatiblePATTERNr?rrr$sMG.0rFrN)r#rpgen2rr fixer_utilrrrr r r rBaseFixrrErFrrJs20DD& 90 ""90rFPKz1]2fixes/__pycache__/fix_xrange.cpython-312.opt-2.pycnu[ {|j \ ddlmZddlmZmZmZddlmZGddejZy)) fixer_base)NameCallconsuming_calls)patcompceZdZdZdZfdZdZdZdZdZ dZ e je Z d Ze jeZd ZxZS) FixXrangeTz power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > cLtt| ||t|_yN)superr start_treesettransformed_xranges)selftreefilename __class__s 1/usr/lib64/python3.12/lib2to3/fixes/fix_xrange.pyr zFixXrange.start_trees i)$9#&5 cd|_yr )r)rrrs r finish_treezFixXrange.finish_trees #' rc|d}|jdk(r|j||S|jdk(r|j||Stt |)Nnamexrangerange)valuetransform_xrangetransform_range ValueErrorreprrnoderesultsrs r transformzFixXrange.transformsXv :: !((w7 7 ZZ7 "''g6 6T$Z( (rc|d}|jtd|j|jj t |y)Nrrprefix)replacerr'raddidr!s rrzFixXrange.transform_xrange$s:v T'$++67   $$RX.rc"t||jvrx|j|sftt d|dj g}tt d|g|j }|dD]}|j||Syy)Nrargslistr&rest)r*rin_special_contextrrcloner' append_child)rr"r# range_call list_callns rrzFixXrange.transform_range*s tHD44 4''-d7mgfo.C.C.E-FGJT&\J<$(KK1IV_&&q)% . 5rz3power< 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*> cB|jyi}|jjL|jj|jj|r|d|ur|djtvS|j j|j|xr|d|uS)NFr"func)parentp1matchrrp2)rr"r#s rr/zFixXrange.in_special_context?s ;;  KK   *ww}}T[[//9v$&6?((O; ;ww}}T[['2Nwv$7NNr)__name__ __module__ __qualname__ BM_compatiblePATTERNr rr$rrP1rcompile_patternr8P2r:r/ __classcell__)rs@rr r sbMG )()/  ?B   $B B !  $B Orr N) r fixer_utilrrrrBaseFixr rrrHs,644=O ""=OrPKz1]GL L 2fixes/__pycache__/fix_filter.cpython-312.opt-2.pycnu[ {|j p ddlmZddlmZddlmZddlmZm Z m Z m Z m Z GddejZy)) fixer_base)Node)python_symbols)NameArgListListCompin_special_context parenthesizeceZdZdZdZdZdZy) 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.filterc|j|ryg}d|vr)|dD]!}|j|j#d|vr|jdj}|jt j k(rd|_t|}t|jdj|jdj|jdj|}tt j|g|zd}nd|vr[ttd td |d jtd }tt j|g|zd}nt|ry|d j}tt jtd |gd}tt jtd t|gg|z}d|_|j|_|S)Nextra_trailers filter_lambdaxpfpit)prefixnone_fseqargsfilterlist) should_skipappendclonegettypesymstestrr rrpowerrr r)selfnoderesultstrailerstrnewrs 1/usr/lib64/python3.12/lib2to3/fixes/fix_filter.py transformzFixFilter.transform:s   D !  w &-. */ g %T"((*Bww$))# !"%7;;t,224";;t,224";;t,224b:CtzzC58#3B?C w 4::"5>//1:'CtzzC58#3B?C"$'6?((*DtzzDND#9"ECtzzDL'3%.#AH#LMCCJ[[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr*r+r)r r sMG<'G$r+r N)rrpytreerpygramrr fixer_utilrrrr r ConditionalFixr r2r+r)r7s/ +RRG ))Gr+PKz1]3/fixes/__pycache__/fix_funcattrs.cpython-312.pycnu[ {|jJdZddlmZddlmZGddej Zy)z3Fix function attribute names (f.func_x -> f.__x__).) fixer_base)NameceZdZdZdZdZy) FixFuncattrsTz power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' | 'func_dict') > any* > c|dd}|jtd|jddz|jy)Nattrz__%s__)prefix)replacervaluer )selfnoderesultsrs 4/usr/lib64/python3.12/lib2to3/fixes/fix_funcattrs.py transformzFixFuncattrs.transforms;vq! T8djjn4!%. /N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG /rrN)__doc__r fixer_utilrBaseFixrrrrrs"9 /:%% /rPKz1]L1fixes/__pycache__/fix_throw.cpython-312.opt-2.pycnu[ {|j.p ddlmZddlmZddlmZddlmZmZmZm Z m Z GddejZ y))pytree)token) fixer_base)NameCallArgListAttris_tupleceZdZdZdZdZy)FixThrowTz power< any trailer< '.' 'throw' > trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > | power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > > c|j}|dj}|jtjur|j |dy|j d}|y|j}t|r+|jddDcgc]}|j}}n d|_ |g}|d}d|vry|dj} d| _ t||} t| td t| ggz} |jtj |j"| y|jt||ycc}w) Nexcz+Python 3 does not support string exceptionsvalargstbwith_traceback)symsclonetyperSTRINGcannot_convertgetr childrenprefixrr rrreplacerNodepower) selfnoderesultsrrrcr throw_argsrewith_tbs 0/usr/lib64/python3.12/lib2to3/fixes/fix_throw.py transformzFixThrow.transforms)yyen""$ 88u|| #   &S T kk%  ; iik C='*||Ab'9:'9!AGGI'9D:CJ5DV_ 7?$$&BBIS$A1d#345"GG   v{{4::w? @   tC /;sEN)__name__ __module__ __qualname__ BM_compatiblePATTERNr)r(r r sMG0r0r N) rrpgen2rr fixer_utilrrrr r BaseFixr r/r0r(r4s-?<<(0z!!(0r0PKz1]\* 4fixes/__pycache__/fix_exitfunc.cpython-312.opt-1.pycnu[ {|j bdZddlmZmZddlmZmZmZmZm Z m Z GddejZ y)z7 Convert use of sys.exitfunc to use the atexit module. )pytree fixer_base)NameAttrCallCommaNewlinesymsc:eZdZdZdZdZfdZfdZdZxZ S) FixExitfuncTa ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) c&tt| |yN)superr __init__)selfargs __class__s 3/usr/lib64/python3.12/lib2to3/fixes/fix_exitfunc.pyrzFixExitfunc.__init__s k4)40c<tt| ||d|_yr)rr start_tree sys_import)rtreefilenamers rrzFixExitfunc.start_tree!s k4+D(;rc d|vr|j |d|_y|dj}d|_tjt j ttdtd}t||g|j}|j||j|j|dy|jjd}|jt jk(r5|jt!|jtddy|jj"}|jj%|j}|j"} tjt j&td tddg} tjt j(| g} |j+|dzt-|j+|d z| y) NrfuncatexitregisterzKCan't find sys import; Please add an atexit import at the top of your file. import)rcloneprefixrNoder powerrrrreplacewarningchildrentypedotted_as_names append_childrparentindex import_name simple_stmt insert_childr ) rnoderesultsrrcallnamescontaining_stmtpositionstmt_container new_importnews r transformzFixExitfunc.transform%s 7 "&"),"7 v$$& ;;tzz#DND4DE!Htfdkk2 T ?? " LL ? @ ((+ ::-- -   uw '   tHc2 3"oo44O&//55dooFH,33NT%5%5#H~tHc/BC J++d.. =C  ( (Awy A  ( (As ;r) __name__ __module__ __qualname__keep_line_order BM_compatiblePATTERNrrr< __classcell__)rs@rr r s#OM G1#rIs' 'EE=<*$$=M 1fixes/__pycache__/fix_raise.cpython-312.opt-2.pycnu[ {|jn p ddlmZddlmZddlmZddlmZmZmZm Z m Z GddejZ y))pytree)token) fixer_base)NameCallAttrArgListis_tupleceZdZdZdZdZy)FixRaiseTzB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > cv|j}|dj}|jtjk(rd}|j ||yt |rHt |r6|jdjdj}t |r6d|_d|vr>tj|jtd|g}|j|_|S|dj}t |r+|jddDcgc]}|j} }n d |_|g} d |vr|d j} d | _|} |jtjk7s|jd k7r t|| } t!| td t#| ggz} tj|j$tdg| z}|j|_|Stj|jtdt|| g|j Scc}w)Nexcz+Python 3 does not support string exceptions valraisetbNonewith_traceback)prefix)symsclonetyperSTRINGcannot_convertr childrenrrNode raise_stmtrNAMEvaluerrr simple_stmt) selfnoderesultsrrmsgnewrcargsrewith_tbs 0/usr/lib64/python3.12/lib2to3/fixes/fix_raise.py transformzFixRaise.transform&syyen""$ 88u|| #?C   c *  C=3-ll1o..q17793-CJ  ++dooW s/CDCCJJen""$ C='*||Ab'9:'9!AGGI'9D:CJ5D 7?$$&BBIAxx5::%f)<dO1d#345"GG++d..g'0IJCCJJ;;t $W tC?&*kk3 3);sH6N)__name__ __module__ __qualname__ BM_compatiblePATTERNr/r.r r sMG43r6r N) rrpgen2rr fixer_utilrrrr r BaseFixr r5r6r.r:s-2<<;3z!!;3r6PKz1]EOw3fixes/__pycache__/fix_imports.cpython-312.opt-1.pycnu[ {|j4TdZddlmZddlmZmZiddddddd d d d d ddddddddddddddddddddd d!d"id#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdDdEdFdGdHdIdJdJdJdKdLdLdMdNdOZdPZefdQZGdRdSejZ yT)Uz/Fix incompatible imports and module references.) fixer_base)Name attr_chainStringIOio cStringIOcPicklepickle __builtin__builtinscopy_regcopyregQueuequeue SocketServer socketserver ConfigParser configparserreprreprlib FileDialogztkinter.filedialog tkFileDialog SimpleDialogztkinter.simpledialogtkSimpleDialogtkColorChooserztkinter.colorchoosertkCommonDialogztkinter.commondialogDialogztkinter.dialogTkdndz tkinter.dndtkFontz tkinter.font tkMessageBoxztkinter.messagebox ScrolledTextztkinter.scrolledtext Tkconstantsztkinter.constantsTixz tkinter.tixttkz tkinter.ttkTkintertkinter markupbase _markupbase_winregwinregthread_thread dummy_thread _dummy_threaddbhashzdbm.bsddumbdbmzdbm.dumbdbmzdbm.ndbmgdbmzdbm.gnu xmlrpclibz xmlrpc.clientDocXMLRPCServerz xmlrpc.serverz http.clientz html.entitiesz html.parserz http.cookieszhttp.cookiejarz http.server subprocess collectionsz urllib.parsezurllib.robotparser)SimpleXMLRPCServerhttplibhtmlentitydefs HTMLParserCookie cookielibBaseHTTPServerSimpleHTTPServer CGIHTTPServercommands UserStringUserListurlparse robotparsercLddjtt|zdzS)N(|))joinmapr)memberss 2/usr/lib64/python3.12/lib2to3/fixes/fix_imports.py alternatesrM=s" #dG,- - 33c#Kdj|Dcgc]}d|z c}}t|j}d|d|dd|zd|d|d d |zycc}ww) Nz | zmodule_name='%s'z$name_import=import_name< 'import' ((z;) | multiple_imports=dotted_as_names< any* (z) any* >) > zimport_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > z(import_name< 'import' (dotted_as_name< (zg) 'as' any > | multiple_imports=dotted_as_names< any* dotted_as_name< (z!) 'as' any > any* >) > z3power< bare_with_attr=(%s) trailer<'.' any > any* >)rIrMkeys)mappingkeymod_list bare_namess rL build_patternrUAszzwGw-3wGHHGLLN+J8 %%  8 %% @* LL!HsA( A#A A(cNeZdZdZdZeZdZdZfdZ fdZ fdZ dZ xZ S) FixImportsTcJdjt|jS)NrG)rIrUrQ)selfs rLrUzFixImports.build_pattern`sxx dll344rNcT|j|_tt|yN)rUPATTERNsuperrWcompile_pattern)rZ __class__s rLr_zFixImports.compile_patterncs"))+  j$/1rNctt| |}|r%d|vrtfdt |dDry|Sy)Nbare_with_attrc3.K|] }|ywr\).0objmatchs rL z#FixImports.match..qsI.Hsc .HsparentF)r^rWrganyr)rZnoderesultsrgr`s @rLrgzFixImports.matchjsEj$-+  w.Ijx.HIINrNc<tt| ||i|_yr\)r^rW start_treereplace)rZtreefilenamer`s rLrnzFixImports.start_treevs j$*4: rNc|jd}|r|j}|j|}|jt ||j d|vr||j|<d|vr'|j |}|r|j||yyy|dd}|jj|j}|r'|jt ||j yy)N module_name)prefix name_importmultiple_importsrb)getvaluerQrorrtrg transform)rZrkrl import_modmod_namenew_name bare_names rLrzzFixImports.transformzs[[/ !''H||H-H   tHZ5F5FG H'*2 X&!W, **T*NN41 - 01!4I||'' 8H!!$x 8H8H"IJrN)__name__ __module__ __qualname__ BM_compatiblekeep_line_orderMAPPINGrQ run_orderrUr_rgrnrz __classcell__)r`s@rLrWrWUs3MOGI52 KrNrWN) __doc__r fixer_utilrrrrMrUBaseFixrWrdrNrLrs5)2 :2  2  h2  :2  y 2  G 2  > 2  >2  92  -2  /2  12  32  32  32  %2  M!2 " ^#2 $ /%2 & 1'2 ( -)2 * -+2 , --2 . i/2 0 12 2 h32 4 Y52 6 ?72 : Y;2 < j=2 > *?2 @ 9A2 B C2 D oE2 F"1#-'#(*,)#'%&/c2 j4"M(<K##<KrNPKz1] )fixes/__pycache__/fix_map.cpython-312.pycnu[ {|j8~dZddlmZddlmZddlmZmZmZm Z m Z ddl m Z ddlmZGddej Zy ) 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)NodeceZdZdZdZdZdZy)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.mapc |j|ryg}d|vr)|dD]!}|j|j#|jjt j k(rA|j|d|j}d|_ttd|g}nd|vrbt|dj|dj|dj}tt j|g|zd }nbd |vr|d j}d|_n d |vr|d }|jt jk(r|jd jt j k(rs|jd jdjt"j$k(r<|jd jdj&dk(r|j|dytt jtd|jg}d|_t)|rytt jtdt+gg|z}d|_|j|_|S)Nextra_trailerszYou should use a for loop herelist map_lambdaxpfpit)prefixmap_noneargargsNonezjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequencemap) should_skipappendcloneparenttypesyms simple_stmtwarningrrrrr powertrailerchildrenarglistrNAMEvaluer r)selfnoderesultstrailerstnewrs ./usr/lib64/python3.12/lib2to3/fixes/fix_map.py transformzFixMap.transform@s   D !  w &-. */ ;;  t// / LL? @**,CCJtF|cU+C W $74=..0"4=..0"4=..02CtzzC58#3B?CW$en**, W$"6?DyyDLL0}}Q',, <}}Q'00388EJJF}}Q'00399VC T,NOtzzDK+FGC!#CJ%d+tzzDL'3%.#AH#LMCCJ[[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr3r4r2r r sMG:$G.r4r N)__doc__pgen2rrr fixer_utilrrrrr pygramr r#pytreer ConditionalFixr r;r4r2rBs2&JJ+PZ & &Pr4PKz1]5fixes/__pycache__/fix_itertools.cpython-312.opt-1.pycnu[ {|j JdZddlmZddlmZGddej Zy)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)Namec2eZdZdZdZdezZdZdZy) 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] ')' > > cPd}|dd}d|vr_|jdvrQ|d|d}}|j}|j|j|jj ||xs |j}|j t |jdd|y)Nfuncit) ifilterfalse izip_longestdot)prefix)valuerremoveparentreplacer)selfnoderesultsrr rr s 4/usr/lib64/python3.12/lib2to3/fixes/fix_itertools.py transformzFixItertools.transformsvq! GO JJ> >u~wt}CYYF IIK JJL KK   %&4;; T$**QR.89N) __name__ __module__ __qualname__ BM_compatibleit_funcslocalsPATTERN run_orderrrrrrs+MHH H GI:rrN)__doc__r fixer_utilrBaseFixrr#rrr(s$::%%:rPKz1]~A\,fixes/__pycache__/fix_xrange.cpython-312.pycnu[ {|j ^dZddlmZddlmZmZmZddlmZGddejZ y)z/Fixer that changes xrange(...) into range(...).) fixer_base)NameCallconsuming_calls)patcompceZdZdZdZfdZdZdZdZdZ dZ e je Z d Ze jeZd ZxZS) FixXrangeTz power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > cLtt| ||t|_yN)superr start_treesettransformed_xranges)selftreefilename __class__s 1/usr/lib64/python3.12/lib2to3/fixes/fix_xrange.pyr zFixXrange.start_trees i)$9#&5 cd|_yr )r)rrrs r finish_treezFixXrange.finish_trees #' rc|d}|jdk(r|j||S|jdk(r|j||Stt |)Nnamexrangerange)valuetransform_xrangetransform_range ValueErrorreprrnoderesultsrs r transformzFixXrange.transformsXv :: !((w7 7 ZZ7 "''g6 6T$Z( (rc|d}|jtd|j|jj t |y)Nrrprefix)replacerr'raddidr!s rrzFixXrange.transform_xrange$s:v T'$++67   $$RX.rc"t||jvrx|j|sftt d|dj g}tt d|g|j }|dD]}|j||Syy)Nrargslistr&rest)r*rin_special_contextrrcloner' append_child)rr"r# range_call list_callns rrzFixXrange.transform_range*s tHD44 4''-d7mgfo.C.C.E-FGJT&\J<$(KK1IV_&&q)% . 5rz3power< 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*> cB|jyi}|jjL|jj|jj|r|d|ur|djtvS|j j|j|xr|d|uS)NFr"func)parentp1matchrrp2)rr"r#s rr/zFixXrange.in_special_context?s ;;  KK   *ww}}T[[//9v$&6?((O; ;ww}}T[['2Nwv$7NNr)__name__ __module__ __qualname__ BM_compatiblePATTERNr rr$rrP1rcompile_patternr8P2r:r/ __classcell__)rs@rr r sbMG )()/  ?B   $B B !  $B Orr N) __doc__r fixer_utilrrrrBaseFixr rrrIs,644=O ""=OrPKz1]Dzz7fixes/__pycache__/fix_methodattrs.cpython-312.opt-1.pycnu[ {|j^VdZddlmZddlmZddddZGdd ej Zy ) z;Fix bound method attributes (method.im_? -> method.__?__). ) fixer_base)Name__func____self__z__self__.__class__)im_funcim_selfim_classceZdZdZdZdZy)FixMethodattrsTzU power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > c|dd}t|j}|jt||jy)Nattr)prefix)MAPvaluereplacerr)selfnoderesultsr news 6/usr/lib64/python3.12/lib2to3/fixes/fix_methodattrs.py transformzFixMethodattrs.transforms4vq!$**o T#dkk23N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrr r sMG4rr N)__doc__r fixer_utilrrBaseFixr rrrr$s6 % 4Z'' 4rPKz1]i GG*fixes/__pycache__/fix_exec.cpython-312.pycnu[ {|jRdZddlmZddlmZmZmZGddejZy)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)CommaNameCallceZdZdZdZdZy)FixExecTzx exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > | exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > c|sJ|j}|d}|jd}|jd}|jg}d|d_|)|j t |jg|)|j t |jgt td||jS)Nabcexec)prefix)symsgetclonerextendrrr)selfnoderesultsrr r r argss //usr/lib64/python3.12/lib2to3/fixes/fix_exec.py transformzFixExec.transformswyy CL KK  KK  {Q = KK!''), - = KK!''), -DL$t{{;;N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrsMG r%s'**), list(<>), tuple(<>), sorted(<>), ...join(<>), or for V in <>:. ) fixer_base)Node)python_symbols)NameArgListin_special_contextceZdZdZdZdZdZy)FixZipTzN power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*] > zfuture_builtins.zipc|j|ryt|ry|dj}d|_g}d|vr.|dDcgc]}|j}}|D] }d|_ t t j td|gd}t t j tdt|gg|z}|j|_|Scc}w)Nargstrailerszip)prefixlist) should_skiprclonerrsymspowerrr)selfnoderesultsr rnnews ./usr/lib64/python3.12/lib2to3/fixes/fix_zip.py transformzFixZip.transforms   D !  d #v$$&   +2:+>?+>a +>H?4::U T22>4::V gsen=HI[[  @sCN)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onrrr r sMG $Gr$r N)__doc__r rpytreerpygramrr fixer_utilrrrConditionalFixr r#r$rr*s-+::Z & &r$PKz1]DQpE E 1fixes/__pycache__/fix_set_literal.cpython-312.pycnu[ {|jRdZddlmZmZddlmZmZGddejZy)z: Optional fixer to transform set() calls to set literals. ) fixer_basepytree)tokensymsceZdZdZdZdZdZy) FixSetLiteralTajpower< 'set' trailer< '(' (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) > | single=any) ']' > | atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > ) ')' > > c|jd}|rGtjtj|j g}|j ||}n|d}tjtjdg}|jd|jD|jtjtjd|jj|d_tjtj |}|j|_t#|jdk(r=|jd}|j%|j|jd_|S) Nsingleitems{c3<K|]}|jyw)N)clone).0ns 6/usr/lib64/python3.12/lib2to3/fixes/fix_set_literal.py z*FixSetLiteral.transform..'s9.Qqwwy.s})getrNoder listmakerrreplaceLeafrLBRACEextendchildrenappendRBRACE next_siblingprefix dictsetmakerlenremove) selfnoderesultsr faker literalmakerrs r transformzFixSetLiteral.transformsX& ;;t~~ /?@D NN4 EG$E;;u||S129%..99v{{5<<56"//66  D--w7{{  u~~ ! #q!A HHJ()ENN2  % N)__name__ __module__ __qualname__ BM_compatibleexplicitPATTERNr,r-rrr sMHGr-rN) __doc__lib2to3rrlib2to3.fixer_utilrrBaseFixrr4r-rr9s$ '*)J&&)r-PKz1])yѐ0fixes/__pycache__/__init__.cpython-312.opt-1.pycnu[ {|j/y)Nr//usr/lib64/python3.12/lib2to3/fixes/__init__.pyrsrPKz1])yѐ0fixes/__pycache__/__init__.cpython-312.opt-2.pycnu[ {|j/y)Nr//usr/lib64/python3.12/lib2to3/fixes/__init__.pyrsrPKz1]773fixes/__pycache__/fix_has_key.cpython-312.opt-2.pycnu[ {|j| X ddlmZddlmZddlmZmZGddej Zy))pytree) fixer_base)Name parenthesizeceZdZdZdZdZy) 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 `|j}|jj|jk(r&|jj |jry|j d}|d}|j}|dDcgc]}|j}}|dj} |j d} | r| Dcgc]}|j} }| j|j|j|j|j|j|j|jfvr t| } t!|dk(r|d}n t#j$|j&|}d|_t)d d } |r/t)d d } t#j$|j*| | f} t#j$|j| | |f} | r8t| } t#j$|j&| ft-| z} |jj|j|j.|j0|j2|j4|j6|j8|j:|j&f vr t| } || _| Scc}wcc}w) Nnegationanchorbeforeargafter in)prefixnot)symsparenttypenot_testpatternmatchgetrclone comparisonand_testor_testtestlambdefargumentrlenrNodepowerrcomp_optupleexprxor_exprand_expr shift_expr arith_exprtermfactor)selfnoderesultsrr r rnr r rn_opn_notnews 2/usr/lib64/python3.12/lib2to3/fixes/fix_has_key.py transformzFixHasKey.transformGsyy KK   - LL  t{{ +;;z*"%,X%67%6!'')%67en""$ G$ (-.1QWWYE. 88  diit}}N Ns#C v;! AYF[[V4F D% s+E;;t||eT];Dkk$//Cv+>? s#C++djj3&5<*?@C ;;  DMM $ t $ $ TZZ 9 9s#C  78/s ?J&J+N)__name__ __module__ __qualname__ BM_compatiblePATTERNr7r6rr&sMG<&r>rN)rr fixer_utilrrBaseFixrr=r>r6rBs):+G ""Gr>PKz1] 2fixes/__pycache__/fix_filter.cpython-312.opt-1.pycnu[ {|j rdZddlmZddlmZddlmZddlm Z m Z m Z m Z m Z GddejZy) 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_context parenthesizeceZdZdZdZdZdZy) 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.filterc|j|ryg}d|vr)|dD]!}|j|j#d|vr|jdj}|jt j k(rd|_t|}t|jdj|jdj|jdj|}tt j|g|zd}nd|vr[ttd td |d jtd }tt j|g|zd}nt|ry|d j}tt jtd |gd}tt jtd t|gg|z}d|_|j|_|S)Nextra_trailers filter_lambdaxpfpit)prefixnone_fseqargsfilterlist) should_skipappendclonegettypesymstestrr rrpowerrr r)selfnoderesultstrailerstrnewrs 1/usr/lib64/python3.12/lib2to3/fixes/fix_filter.py transformzFixFilter.transform:s   D !  w &-. */ g %T"((*Bww$))# !"%7;;t,224";;t,224";;t,224b:CtzzC58#3B?C w 4::"5>//1:'CtzzC58#3B?C"$'6?((*DtzzDND#9"ECtzzDL'3%.#AH#LMCCJ[[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr*r+r)r r sMG<'G$r+r N)__doc__rrpytreerpygramrr fixer_utilrrrr r ConditionalFixr r2r+r)r8s/ +RRG ))Gr+PKz1]Q>  (fixes/__pycache__/fix_ne.cpython-312.pycnu[ {|j;VdZddlmZddlmZddlmZGddej Zy)zFixer that turns <> into !=.)pytree)token) fixer_basec0eZdZejZdZdZy)FixNec |jdk(S)Nz<>)value)selfnodes -/usr/lib64/python3.12/lib2to3/fixes/fix_ne.pymatchz FixNe.matchszzT!!cftjtjd|j}|S)Nz!=)prefix)rLeafrNOTEQUALr)r r resultsnews r transformzFixNe.transforms!kk%..$t{{C rN)__name__ __module__ __qualname__rr _accept_typer rrr rr s>>L"rrN)__doc__rpgen2rrBaseFixrrrr rs'# J   rPKz1]v/FF*fixes/__pycache__/fix_long.cpython-312.pycnu[ {|jJdZddlmZddlmZGddej Zy)z/Fixer that turns 'long' into 'int' everywhere. ) fixer_base)is_probably_builtinceZdZdZdZdZy)FixLongTz'long'cJt|rd|_|jyy)Nint)rvaluechanged)selfnoderesultss //usr/lib64/python3.12/lib2to3/fixes/fix_long.py transformzFixLong.transforms t $DJ LLN %N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMGrrN)__doc__lib2to3rlib2to3.fixer_utilrBaseFixrrrrrs$2j  rPKz1]ޥ' ' 4fixes/__pycache__/fix_execfile.cpython-312.opt-2.pycnu[ {|jl ddlmZddlmZmZmZmZmZmZm Z m Z m Z m Z GddejZy)) fixer_base) CommaNameCallLParenRParenDotNodeArgListStringsymsceZdZdZdZdZy) FixExecfileTz power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > | power< 'execfile' trailer< '(' filename=any ')' > > c|d}|jd}|jd}|jdjdj}t|jt t ddg|}t tjtd|g}t tjttd gt tjttgg} |g| z} |j} d| _t d d} | t | t | gz} ttd | d }|g}|)|j!t |jg|)|j!t |jgttd ||jS)Nfilenameglobalslocalsz"rb" )rparenopenreadz'exec'compileexec)prefix)getchildrencloner rr r r powerrtrailerr rrrrextend)selfnoderesultsrrrexecfile_paren open_args open_callr open_expr filename_argexec_str compile_args compile_callargss 3/usr/lib64/python3.12/lib2to3/fixes/fix_execfile.py transformzFixExecfile.transformsu:&++i(X&r*33B7==?X^^-uwvs8KL#13 d6lI%>? T\\CE4<#89T\\FHfh#78:K$&  ~~' ! (C( EG\57H#MM DO\2> ~   KK'--/2 3   KK&,,.1 2DL$t{{;;N)__name__ __module__ __qualname__ BM_compatiblePATTERNr0r1r/rrsMG r:s0 111&<*$$& ,:c|j}d}|jD]S}||jvr*|j}|j r d|vrd|_d};|r|j}|sd|_d}U|S)NF T )clonechildrenSEPSprefixisspace)selfnoderesultsnewcommachildrs 3/usr/lib64/python3.12/lib2to3/fixes/fix_ws_comma.py transformzFixWsComma.transformstjjl\\E !>>#F(:#%EL"\\F!'* " N) __name__ __module__ __qualname__explicitPATTERNrLeafrCOMMACOLONrrrrrr sJHG FKK S )E FKK S )E 5>DrrN)r rpgen2rrBaseFixrr$rrr's'##rPKz1]Ziߊ,fixes/__pycache__/fix_reload.cpython-312.pycnu[ {|j9NdZddlmZddlmZmZGddej Zy)z5Fixer for reload(). reload(s) -> importlib.reload(s)) fixer_base) ImportAndCall touch_importceZdZdZdZdZdZy) FixReloadTprez power< 'reload' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > c|rF|d}|r?|j|jjk(r|jdjdvryd}t |||}t dd||S)Nobj>***) importlibreloadr)typesymsargumentchildrenvaluerr)selfnoderesultsr namesnews 1/usr/lib64/python3.12/lib2to3/fixes/fix_reload.py transformzFixReload.transformsf %.CHH 2 22LLO))[8'D'51T;- N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrr sM EG rrN)__doc__r fixer_utilrrBaseFixrr#rrr(s$$ 4 ""rPKz1] ,fixes/__pycache__/fix_filter.cpython-312.pycnu[ {|j rdZddlmZddlmZddlmZddlm Z m Z m Z m Z m Z GddejZy) 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_context parenthesizeceZdZdZdZdZdZy) 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.filterc|j|ryg}d|vr)|dD]!}|j|j#d|vr|jdj}|jt j k(rd|_t|}t|jdj|jdj|jdj|}tt j|g|zd}nd|vr[ttd td |d jtd }tt j|g|zd}nt|ry|d j}tt jtd |gd}tt jtd t|gg|z}d|_|j|_|S)Nextra_trailers filter_lambdaxpfpit)prefixnone_fseqargsfilterlist) should_skipappendclonegettypesymstestrr rrpowerrr r)selfnoderesultstrailerstrnewrs 1/usr/lib64/python3.12/lib2to3/fixes/fix_filter.py transformzFixFilter.transform:s   D !  w &-. */ g %T"((*Bww$))# !"%7;;t,224";;t,224";;t,224b:CtzzC58#3B?C w 4::"5>//1:'CtzzC58#3B?C"$'6?((*DtzzDND#9"ECtzzDL'3%.#AH#LMCCJ[[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr*r+r)r r sMG<'G$r+r N)__doc__rrpytreerpygramrr fixer_utilrrrr r ConditionalFixr r2r+r)r8s/ +RRG ))Gr+PKz1]Dzz1fixes/__pycache__/fix_methodattrs.cpython-312.pycnu[ {|j^VdZddlmZddlmZddddZGdd ej Zy ) z;Fix bound method attributes (method.im_? -> method.__?__). ) fixer_base)Name__func____self__z__self__.__class__)im_funcim_selfim_classceZdZdZdZdZy)FixMethodattrsTzU power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > c|dd}t|j}|jt||jy)Nattr)prefix)MAPvaluereplacerr)selfnoderesultsr news 6/usr/lib64/python3.12/lib2to3/fixes/fix_methodattrs.py transformzFixMethodattrs.transforms4vq!$**o T#dkk23N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrr r sMG4rr N)__doc__r fixer_utilrrBaseFixr rrrr$s6 % 4Z'' 4rPKz1]L3fixes/__pycache__/fix_getcwdu.cpython-312.opt-1.pycnu[ {|jJdZddlmZddlmZGddej Zy)z1 Fixer that changes os.getcwdu() to os.getcwd(). ) fixer_base)NameceZdZdZdZdZy) FixGetcwduTzR power< 'os' trailer< dot='.' name='getcwdu' > any* > cZ|d}|jtd|jy)Nnamegetcwd)prefix)replacerr )selfnoderesultsrs 2/usr/lib64/python3.12/lib2to3/fixes/fix_getcwdu.py transformzFixGetcwdu.transforms"v T(4;;78N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG9rrN)__doc__r fixer_utilrBaseFixrrrrrs$  9## 9rPKz1]>D .fixes/__pycache__/fix_execfile.cpython-312.pycnu[ {|jndZddlmZddlmZmZmZmZmZm Z m Z m Z m Z m Z GddejZy)zoFixer for execfile. This converts usages of the execfile function into calls to the built-in exec() function. ) fixer_base) CommaNameCallLParenRParenDotNodeArgListStringsymsceZdZdZdZdZy) FixExecfileTz power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > | power< 'execfile' trailer< '(' filename=any ')' > > c|sJ|d}|jd}|jd}|jdjdj}t|jt t ddg|}t tjtd|g}t tjttd gt tjttgg} |g| z} |j} d| _t d d} | t | t | gz} ttd | d }|g}|)|j!t |jg|)|j!t |jgttd ||jS)Nfilenameglobalslocalsz"rb" )rparenopenreadz'exec'compileexec)prefix)getchildrencloner rr r r powerrtrailerr rrrrextend)selfnoderesultsrrrexecfile_paren open_args open_callr open_expr filename_argexec_str compile_args compile_callargss 3/usr/lib64/python3.12/lib2to3/fixes/fix_execfile.py transformzFixExecfile.transforms|w:&++i(X&r*33B7==?X^^-uwvs8KL#13 d6lI%>? T\\CE4<#89T\\FHfh#78:K$&  ~~' ! (C( EG\57H#MM DO\2> ~   KK'--/2 3   KK&,,.1 2DL$t{{;;N)__name__ __module__ __qualname__ BM_compatiblePATTERNr0r1r/rrsMG r;s0 111&<*$$& any* > c|dd}|jtd|jddz|jy)Nattrz__%s__)prefix)replacervaluer )selfnoderesultsrs 4/usr/lib64/python3.12/lib2to3/fixes/fix_funcattrs.py transformzFixFuncattrs.transforms;vq! T8djjn4!%. /N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG /rrN)r fixer_utilrBaseFixrrrrrs"9 /:%% /rPKz1]5@#2fixes/__pycache__/fix_reduce.cpython-312.opt-1.pycnu[ {|jEJdZddlmZddlmZGddej Zy)zqFixer for reduce(). Makes sure reduce() is imported from the functools module if reduce is used in that module. ) fixer_base touch_importceZdZdZdZdZdZy) FixReduceTpreai power< 'reduce' trailer< '(' arglist< ( (not(argument) any ',' not(argument > ctdd|y)N functoolsreducer)selfnoderesultss 1/usr/lib64/python3.12/lib2to3/fixes/fix_reduce.py transformzFixReduce.transform"s[(D1N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrrsM E G2rrN)__doc__lib2to3rlib2to3.fixer_utilrBaseFixrrrrrs$ +2 ""2rPKz1]~ 4fixes/__pycache__/fix_execfile.cpython-312.opt-1.pycnu[ {|jndZddlmZddlmZmZmZmZmZm Z m Z m Z m Z m Z GddejZy)zoFixer for execfile. This converts usages of the execfile function into calls to the built-in exec() function. ) fixer_base) CommaNameCallLParenRParenDotNodeArgListStringsymsceZdZdZdZdZy) FixExecfileTz power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > | power< 'execfile' trailer< '(' filename=any ')' > > c|d}|jd}|jd}|jdjdj}t|jt t ddg|}t tjtd|g}t tjttd gt tjttgg} |g| z} |j} d| _t d d} | t | t | gz} ttd | d }|g}|)|j!t |jg|)|j!t |jgttd ||jS)Nfilenameglobalslocalsz"rb" )rparenopenreadz'exec'compileexec)prefix)getchildrencloner rr r r powerrtrailerr rrrrextend)selfnoderesultsrrrexecfile_paren open_args open_callr open_expr filename_argexec_str compile_args compile_callargss 3/usr/lib64/python3.12/lib2to3/fixes/fix_execfile.py transformzFixExecfile.transformsu:&++i(X&r*33B7==?X^^-uwvs8KL#13 d6lI%>? T\\CE4<#89T\\FHfh#78:K$&  ~~' ! (C( EG\57H#MM DO\2> ~   KK'--/2 3   KK&,,.1 2DL$t{{;;N)__name__ __module__ __qualname__ BM_compatiblePATTERNr0r1r/rrsMG r;s0 111&<*$$& 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* > prectt| ||td|}|r|j |t d|_yd|_y)NnextTF)superr start_treerwarning bind_warning shadowed_next)selftreefilenamen __class__s //usr/lib64/python3.12/lib2to3/fixes/fix_next.pyrzFixNext.start_tree$sA gt'h7  & LLL )!%D !&D c,|jd}|jd}|jd}|r|jr'|jtd|jy|Dcgc]}|j }}d|d_|jt td|j|y|r)td|j}|j|y|r{t|rU|d }dj|Dcgc] }t|c}jd k(r|j|ty|jtdyd |vr|j|td |_yycc}wcc}w) Nbaseattrname__next__)prefixr head __builtin__globalT) getrreplacerrcloneris_assign_targetjoinstrstriprr)rnoderesultsrrrrr"s r transformzFixNext.transform.sD{{6"{{6"{{6" !! T*T[[AB+/04a 40!#Q T$vdkk"BDIJ Z 4A LLO  %v77D1DqCFD1288:mKLL|4 LLj) *  LL| ,!%D !!12s -F  F) __name__ __module__ __qualname__ BM_compatiblePATTERNorderrr. __classcell__)rs@rr r s M G E'&rr ct|}|y|jD]/}|jtjk(ryt ||s/yy)NFT) find_assignchildrentyperEQUAL is_subtree)r,assignchilds rr(r(QsG  F ~ :: $ t $ ! rc|jtjk(r|S|jtjk(s |jyt |jSN)r9syms expr_stmt simple_stmtparentr7)r,s rr7r7]sD yyDNN"  yyD$$$ (; t{{ ##rcL|k(rytfd|jDS)NTc36K|]}t|ywr?)r;).0cr,s r zis_subtree..gs:Mqz!T"Ms)anyr8)rootr,s `rr;r;ds" t| :DMM: ::rN)pgen2rpygramrr@r r fixer_utilrrrrBaseFixr r(r7r;rrrPs@4+11L :&j  :&@ $;rPKz1]Oo'j227fixes/__pycache__/fix_methodattrs.cpython-312.opt-2.pycnu[ {|j^T ddlmZddlmZddddZGddej Zy ) ) fixer_base)Name__func____self__z__self__.__class__)im_funcim_selfim_classceZdZdZdZdZy)FixMethodattrsTzU power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > c|dd}t|j}|jt||jy)Nattr)prefix)MAPvaluereplacerr)selfnoderesultsr news 6/usr/lib64/python3.12/lib2to3/fixes/fix_methodattrs.py transformzFixMethodattrs.transforms4vq!$**o T#dkk23N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrr r sMG4rr N)r fixer_utilrrBaseFixr rrrr#s6 % 4Z'' 4rPKz1]$N +fixes/__pycache__/fix_print.cpython-312.pycnu[ {|j dZddlmZddlmZddlmZddlmZddlmZm Z m Z m Z ejdZ Gdd ejZy ) 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 eZdZdZdZdZdZy)FixPrintTzP simple_stmt< any* bare='print' any* > | print_stmt c |sJ|jd}|r1|jttdg|jy|j dtdk(sJ|j dd}t |dk(rtj|drydx}x}}|r|dtk(r|dd}d}|rR|dtjtjdk(r(t |d k\sJ|dj}|d d}|Dcgc]}|j} }| r d | d_|||c|%|j| d t!t#||%|j| d t!t#|||j| d|ttd| } |j| _| Scc}w)Nbareprint)prefix z>>rsependfile)getreplacerrrchildrenlen parend_exprmatchr rLeafr RIGHTSHIFTclone add_kwargr repr) selfnoderesults bare_printargsrrrargl_argsn_stmts 0/usr/lib64/python3.12/lib2to3/fixes/fix_print.py transformzFixPrint.transform%sw[[(    tDM2&0&7&7 9 : }}Q4=000}}QR  t9>k//Q8 cD DH'9DC DGv{{5+;+;TBBt9> !>7==?D8D)-.##))+. !F1I  ?co1AvufT#Y.?@vufT#Y.?@vvt4d7mV,   /sG c(d|_tj|jjt |tj tjd|f}|r |jtd|_|j|y)Nr=r) rrNodesymsargumentrr rEQUALappendr )r%l_nodess_kwdn_expr n_arguments r-r#zFixPrint.add_kwargMsk [[!3!3"&u+"(++ekk3"?"("*+   NN57 # #J z"N)__name__ __module__ __qualname__ BM_compatiblePATTERNr.r#r:r-r r sMG&P #r:r N)__doc__rrrpgen2rr fixer_utilrrr r compile_patternrBaseFixr r@r:r-rFsG 22&g%%6 :#z!!:#r:PKz1]' ' 0fixes/__pycache__/fix_isinstance.cpython-312.pycnu[ {|jHJdZddlmZddlmZGddej Zy)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)tokenceZdZdZdZdZdZy) FixIsinstanceTz power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > ct}|d}|j}g}t|}|D]\}} | jtj k(rP| j |vrB|t|dz ksC||dzjtjk(sgt|s|j| | jtj k(s|j| j |r#|djtjk(r|d=t|dk(r5|j} | j|d_ | j|dy||dd|jy)Nargs)setchildren enumeratetyperNAMEvaluelenCOMMAnextappendaddparentprefixreplacechanged) selfnoderesultsnames_insertedtestlistr new_argsiteratoridxargatoms 5/usr/lib64/python3.12/lib2to3/fixes/fix_isinstance.py transformzFixIsinstance.transforms6?  T? HCxx5::%#))~*ETQ&4a=+=+=+LN$88uzz)"&&syy1!  ))U[[8 x=A ??D!%HQK  LL! %DG LLNN)__name__ __module__ __qualname__ BM_compatiblePATTERN run_orderr'r(r&rrsMGIr(rN)__doc__r fixer_utilrBaseFixrr/r(r&r4s$$J&&$r(PKz1]  0fixes/__pycache__/fix_long.cpython-312.opt-2.pycnu[ {|jH ddlmZddlmZGddejZy)) fixer_base)is_probably_builtinceZdZdZdZdZy)FixLongTz'long'cJt|rd|_|jyy)Nint)rvaluechanged)selfnoderesultss //usr/lib64/python3.12/lib2to3/fixes/fix_long.py transformzFixLong.transforms t $DJ LLN %N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMGrrN)lib2to3rlib2to3.fixer_utilrBaseFixrrrrrs$2j  rPKz1][r+fixes/__pycache__/fix_input.cpython-312.pycnu[ {|j~dZddlmZddlmZmZddlmZejdZGddejZ y) z4Fixer that changes input(...) into eval(input(...)).) fixer_base)CallName)patcompz&power< 'eval' trailer< '(' any ')' > >ceZdZdZdZdZy)FixInputTzL power< 'input' args=trailer< '(' [any] ')' > > ctj|jjry|j}d|_t t d|g|jS)Neval)prefix)contextmatchparentcloner rr)selfnoderesultsnews 0/usr/lib64/python3.12/lib2to3/fixes/fix_input.py transformzFixInput.transformsF ==++ , jjl DL3% <<N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG=rrN) __doc__r r fixer_utilrrrcompile_patternr BaseFixrrrrr"s::# "' ! !"J K =z!! =rPKz1]vEÀ/fixes/__pycache__/fix_map.cpython-312.opt-2.pycnu[ {|j8| ddlmZddlmZddlmZmZmZmZm Z ddl m Z ddl mZGddejZy) )token) fixer_base)NameArgListCallListCompin_special_context)python_symbols)NodeceZdZdZdZdZdZy)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.mapc |j|ryg}d|vr)|dD]!}|j|j#|jjt j k(rA|j|d|j}d|_ttd|g}nd|vrbt|dj|dj|dj}tt j|g|zd }nbd |vr|d j}d|_n d |vr|d }|jt jk(r|jd jt j k(rs|jd jdjt"j$k(r<|jd jdj&dk(r|j|dytt jtd|jg}d|_t)|rytt jtdt+gg|z}d|_|j|_|S)Nextra_trailerszYou should use a for loop herelist map_lambdaxpfpit)prefixmap_noneargargsNonezjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequencemap) should_skipappendcloneparenttypesyms simple_stmtwarningrrrrr powertrailerchildrenarglistrNAMEvaluer r)selfnoderesultstrailerstnewrs ./usr/lib64/python3.12/lib2to3/fixes/fix_map.py transformzFixMap.transform@s   D !  w &-. */ ;;  t// / LL? @**,CCJtF|cU+C W $74=..0"4=..0"4=..02CtzzC58#3B?CW$en**, W$"6?DyyDLL0}}Q',, <}}Q'00388EJJF}}Q'00399VC T,NOtzzDK+FGC!#CJ%d+tzzDL'3%.#AH#LMCCJ[[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr3r4r2r r sMG:$G.r4r N)pgen2rrr fixer_utilrrrrr pygramr r#pytreer ConditionalFixr r;r4r2rAs2&JJ+PZ & &Pr4PKz1]g 1fixes/__pycache__/fix_print.cpython-312.opt-2.pycnu[ {|j  ddlmZddlmZddlmZddlmZddlmZmZm Z m Z ejdZ GddejZy ) )patcomp)pytree)token) fixer_base)NameCallCommaStringz"atom< '(' [atom|STRING|NAME] ')' >c eZdZdZdZdZdZy)FixPrintTzP simple_stmt< any* bare='print' any* > | print_stmt c :|jd}|r1|jttdg|jy|j dd}t |dk(rtj|drydx}x}}|r|dtk(r|dd}d}|rB|dtjtjdk(r|dj}|d d}|Dcgc]}|j} }| r d | d_|||c|%|j| d t!t#||%|j| d t!t#|||j| d |ttd| } |j| _| Scc}w)Nbareprint)prefix z>>sependfile)getreplacerrrchildrenlen parend_exprmatchr rLeafr RIGHTSHIFTclone add_kwargr repr) selfnoderesults bare_printargsrrrargl_argsn_stmts 0/usr/lib64/python3.12/lib2to3/fixes/fix_print.py transformzFixPrint.transform%s[[(    tDM2&0&7&7 9 : }}QR  t9>k//Q8 cD DH'9DC DGv{{5+;+;TBB7==?D8D)-.##))+. !F1I  ?co1AvufT#Y.?@vufT#Y.?@vvt4d7mV,   /s"Fc(d|_tj|jjt |tj tjd|f}|r |jtd|_|j|y)Nr=r) rrNodesymsargumentrr rEQUALappendr )r%l_nodess_kwdn_expr n_arguments r-r#zFixPrint.add_kwargMsk [[!3!3"&u+"(++ekk3"?"("*+   NN57 # #J z"N)__name__ __module__ __qualname__ BM_compatiblePATTERNr.r#r:r-r r sMG&P #r:r N)rrrpgen2rr fixer_utilrrr r compile_patternrBaseFixr r@r:r-rEsG 22&g%%6 :#z!!:#r:PKz1]v/FF0fixes/__pycache__/fix_long.cpython-312.opt-1.pycnu[ {|jJdZddlmZddlmZGddej Zy)z/Fixer that turns 'long' into 'int' everywhere. ) fixer_base)is_probably_builtinceZdZdZdZdZy)FixLongTz'long'cJt|rd|_|jyy)Nint)rvaluechanged)selfnoderesultss //usr/lib64/python3.12/lib2to3/fixes/fix_long.py transformzFixLong.transforms t $DJ LLN %N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMGrrN)__doc__lib2to3rlib2to3.fixer_utilrBaseFixrrrrrs$2j  rPKz1]B].fixes/__pycache__/fix_operator.cpython-312.pycnu[ {|jb ddZddlZddlmZddlmZmZmZm Z dZ GddejZ y)aFixer for operator functions. operator.isCallable(obj) -> callable(obj) operator.sequenceIncludes(obj) -> operator.contains(obj) operator.isSequenceType(obj) -> isinstance(obj, collections.abc.Sequence) operator.isMappingType(obj) -> isinstance(obj, collections.abc.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_importcfd}|S)Nc|_|SN) invocation)fss 3/usr/lib64/python3.12/lib2to3/fixes/fix_operator.pydeczinvocation..decs )r rs` rr r s JrceZdZdZdZdZdZdeeezZdZ e dd Z e d d Z e d d Z e ddZe ddZe ddZe ddZdZdZdZy) FixOperatorTprez 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 > > )methodsobjc>|j||}| |||Syr ) _check_method)selfnoderesultsmethods r transformzFixOperator.transform+s,##D'2  $( ( rzoperator.contains(%s)c(|j||dS)Ncontains_handle_renamerrrs r_sequenceIncludeszFixOperator._sequenceIncludes0s""4*==rz callable(%s)cl|d}ttd|jg|jS)Nrcallableprefix)rrcloner')rrrrs r _isCallablezFixOperator._isCallable4s+enD$syy{mDKKHHrzoperator.mul(%s)c(|j||dS)Nmulr r"s r_repeatzFixOperator._repeat9s""4%88rzoperator.imul(%s)c(|j||dS)Nimulr r"s r_irepeatzFixOperator._irepeat=s""4&99rz(isinstance(%s, collections.abc.Sequence)c*|j||ddS)Ncollections.abcSequence_handle_type2abcr"s r_isSequenceTypezFixOperator._isSequenceTypeAs$$T74EzRRrz'isinstance(%s, collections.abc.Mapping)c*|j||ddS)Nr1Mappingr3r"s r_isMappingTypezFixOperator._isMappingTypeEs$$T74EyQQrzisinstance(%s, numbers.Number)c*|j||ddS)NnumbersNumberr3r"s r _isNumberTypezFixOperator._isNumberTypeIs$$T7IxHHrcB|dd}||_|jy)Nrr)valuechanged)rrrnamers rr!zFixOperator._handle_renameMs""1% rctd|||d}|jtddj||gzg}t t d||j S)Nrz, . isinstancer&)rr(rjoinrrr')rrrmoduleabcrargss rr4zFixOperator._handle_type2abcRsVT64(en VD388VSM+B$BCDD&T[[AArct|d|ddjz}t|tjj r9d|vr|St |df}|j|z}|j|d|zy)N_rrrErzYou should use '%s' here.) getattrr>rC collectionsrFCallablestrr warning)rrrrsubinvocation_strs rrzFixOperator._check_methodXs|sWX%6q%9%?%??@ fkoo66 77" 75>*,!'!2!2S!8 T#>#OPrN)__name__ __module__ __qualname__ BM_compatibleorderrrdictPATTERNrr r#r)r,r/r5r8r<r!r4rrrrrrsM EG C c2 3G) '(>)>I I"#9$9#$:%::;S<S9:R;R01I2I B rr) __doc__collections.abcrKlib2to3rlib2to3.fixer_utilrrrrr BaseFixrrrrr]s3 ??G*$$GrPKz1]qWW+fixes/__pycache__/fix_paren.cpython-312.pycnu[ {|jNdZddlmZddlmZmZGddej Zy)ztFixer that adds parentheses where they are required This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``.) fixer_base)LParenRParenceZdZdZdZdZy)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] > >) (']' | ')') > c|d}t}|j|_d|_|jd||jt y)Ntarget)rprefix insert_child append_childr)selfnoderesultsr lparens 0/usr/lib64/python3.12/lib2to3/fixes/fix_paren.py transformzFixParen.transform%sE"   Av&FH%N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG,&rrN)__doc__r r fixer_utilrrBaseFixrrrrrs%C' &z!! &rPKz1]wʹu2fixes/__pycache__/fix_except.cpython-312.opt-1.pycnu[ {|j |dZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z dZ GddejZy ) 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_listsymsc#Kt|D]L\}}|jtjk(s$|jdj dk(sA|||dzfNyw)Nexceptr) enumeratetyper except_clausechildrenvalue)nodesins 1/usr/lib64/python3.12/lib2to3/fixes/fix_except.py find_exceptsrsS% 1 66T'' 'zz!}""h.%!*o%!s/AAAceZdZdZdZdZy) 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)]) > c |j}|dDcgc]}|j}}|dDcgc]}|j}}t|D]\}} t|jdk(s |jdd\} } } | j t dd| jtjk7r t |jd} | j}d|_ | j | | j} | j}t|D]!\}}t|tjs!nt!| s t#| r t%|t'| t d }n t%|| }t)|dD]}| j+d || j+||v| jdk(sd| _ |jdd Dcgc]}|jc}|z|z}tj|j|Scc}wcc}wcc}w) Ntailcleanupas )prefixargsr )r clonerlenrreplacerrrNAMEnew_namer"r isinstancerNoder r rrreversed insert_child)selfnoderesultsr rrch try_cleanupre_suiteEcommaNnew_Ntarget suite_stmtsrstmtassignchildcrs r transformzFixExcept.transform/syy#*6?3?a ?3,3I,>?,>brxxz,> ?&2;&? "M7=))*a/ - 6 6q ; E1 d44566UZZ' =EWWYF$&FMIIe$!KKME #*"2"2K#,[#94%dFKK8!$:  {gaj!'UDL0I!J!'!6"*+bq/!:,,Q6";((F3XX^ #AHI'@N(,}}Ra'89'8!AGGI'89KG$N{{499h//W4?P:sH:H?:IN)__name__ __module__ __qualname__ BM_compatiblePATTERNr?rrr$sMG.0rFrN)__doc__r#rpgen2rr fixer_utilrrrr r r rBaseFixrrErFrrKs20DD& 90 ""90rFPKz1]_badd*fixes/__pycache__/fix_repr.cpython-312.pycnu[ {|jeRdZddlmZddlmZmZmZGddejZy)z/Fixer that transforms `xyzzy` into repr(xyzzy).) fixer_base)CallName parenthesizeceZdZdZdZdZy)FixReprTz7 atom < '`' expr=any '`' > c|dj}|j|jjk(r t |}t t d|g|jS)Nexprrepr)prefix)clonetypesyms testlist1rrrr )selfnoderesultsr s //usr/lib64/python3.12/lib2to3/fixes/fix_repr.py transformzFixRepr.transformsMv$$& 99 ++ +%DDL4&==N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr sMG>rrN) __doc__r fixer_utilrrrBaseFixrrrrr!s'611 >j  >rPKz1] 7fixes/__pycache__/fix_set_literal.cpython-312.opt-2.pycnu[ {|jP ddlmZmZddlmZmZGddej Zy)) fixer_basepytree)tokensymsceZdZdZdZdZdZy) FixSetLiteralTajpower< 'set' trailer< '(' (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) > | single=any) ']' > | atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > ) ')' > > c|jd}|rGtjtj|j g}|j ||}n|d}tjtjdg}|jd|jD|jtjtjd|jj|d_tjtj |}|j|_t#|jdk(r=|jd}|j%|j|jd_|S) Nsingleitems{c3<K|]}|jyw)N)clone).0ns 6/usr/lib64/python3.12/lib2to3/fixes/fix_set_literal.py z*FixSetLiteral.transform..'s9.Qqwwy.s})getrNoder listmakerrreplaceLeafrLBRACEextendchildrenappendRBRACE next_siblingprefix dictsetmakerlenremove) selfnoderesultsr faker literalmakerrs r transformzFixSetLiteral.transformsX& ;;t~~ /?@D NN4 EG$E;;u||S129%..99v{{5<<56"//66  D--w7{{  u~~ ! #q!A HHJ()ENN2  % N)__name__ __module__ __qualname__ BM_compatibleexplicitPATTERNr,r-rrr sMHGr-rN)lib2to3rrlib2to3.fixer_utilrrBaseFixrr4r-rr8s$ '*)J&&)r-PKz1]^rr/fixes/__pycache__/fix_zip.cpython-312.opt-2.pycnu[ {|j h ddlmZddlmZddlmZddlmZm Z m Z GddejZ y)) fixer_base)Node)python_symbols)NameArgListin_special_contextceZdZdZdZdZdZy)FixZipTzN power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*] > zfuture_builtins.zipc|j|ryt|ry|dj}d|_g}d|vr.|dDcgc]}|j}}|D] }d|_ t t j td|gd}t t j tdt|gg|z}|j|_|Scc}w)Nargstrailerszip)prefixlist) should_skiprclonerrsymspowerrr)selfnoderesultsr rnnews ./usr/lib64/python3.12/lib2to3/fixes/fix_zip.py transformzFixZip.transforms   D !  d #v$$&   +2:+>?+>a +>H?4::U T22>4::V gsen=HI[[  @sCN)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onrrr r sMG $Gr$r N) r rpytreerpygramrr fixer_utilrrrConditionalFixr r#r$rr)s-+::Z & &r$PKz1]*e7 7 1fixes/__pycache__/fix_raise.cpython-312.opt-1.pycnu[ {|jn rdZddlmZddlmZddlmZddlmZmZm Z m Z m Z GddejZ y) 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_tupleceZdZdZdZdZy)FixRaiseTzB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > cv|j}|dj}|jtjk(rd}|j ||yt |rHt |r6|jdjdj}t |r6d|_d|vr>tj|jtd|g}|j|_|S|dj}t |r+|jddDcgc]}|j} }n d |_|g} d |vr|d j} d | _|} |jtjk7s|jd k7r t|| } t!| td t#| ggz} tj|j$tdg| z}|j|_|Stj|jtdt|| g|j Scc}w)Nexcz+Python 3 does not support string exceptions valraisetbNonewith_traceback)prefix)symsclonetyperSTRINGcannot_convertr childrenrrNode raise_stmtrNAMEvaluerrr simple_stmt) selfnoderesultsrrmsgnewrcargsrewith_tbs 0/usr/lib64/python3.12/lib2to3/fixes/fix_raise.py transformzFixRaise.transform&syyen""$ 88u|| #?C   c *  C=3-ll1o..q17793-CJ  ++dooW s/CDCCJJen""$ C='*||Ab'9:'9!AGGI'9D:CJ5D 7?$$&BBIAxx5::%f)<dO1d#345"GG++d..g'0IJCCJJ;;t $W tC?&*kk3 3);sH6N)__name__ __module__ __qualname__ BM_compatiblePATTERNr/r.r r sMG43r6r N)__doc__rrpgen2rr fixer_utilrrrr r BaseFixr r5r6r.r;s-2<<;3z!!;3r6PKz1]*773fixes/__pycache__/fix_sys_exc.cpython-312.opt-2.pycnu[ {|j ` ddlmZddlmZmZmZmZmZmZm Z GddejZ y)) fixer_base)AttrCallNameNumber SubscriptNodesymscTeZdZgdZdZddj deDzZdZy) FixSysExc)exc_type exc_value exc_tracebackTzN power< 'sys' trailer< dot='.' attribute=(%s) > > |c#&K|] }d|z yw)z'%s'N).0es 2/usr/lib64/python3.12/lib2to3/fixes/fix_sys_exc.py zFixSysExc.s:AVaZsc|dd}t|jj|j}t t d|j }tt d|}|dj |djd_|jt|ttj||j S)N attributeexc_info)prefixsysdot)rrindexvaluerrrrchildrenappendrr r power)selfnoderesultssys_attrrcallattrs r transformzFixSysExc.transforms;'*t}}**8>>:;D$X__=DK&%,U^%:%:Q" Ie$%DJJT[[99N)__name__ __module__ __qualname__r BM_compatiblejoinPATTERNr*rr+rr r s/9HMHH:::;G:r+r N) r fixer_utilrrrrrr r BaseFixr rr+rr5s*HHH: "":r+PKz1]5@#,fixes/__pycache__/fix_reduce.cpython-312.pycnu[ {|jEJdZddlmZddlmZGddej Zy)zqFixer for reduce(). Makes sure reduce() is imported from the functools module if reduce is used in that module. ) fixer_base touch_importceZdZdZdZdZdZy) FixReduceTpreai power< 'reduce' trailer< '(' arglist< ( (not(argument) any ',' not(argument > ctdd|y)N functoolsreducer)selfnoderesultss 1/usr/lib64/python3.12/lib2to3/fixes/fix_reduce.py transformzFixReduce.transform"s[(D1N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrrsM E G2rrN)__doc__lib2to3rlib2to3.fixer_utilrBaseFixrrrrrs$ +2 ""2rPKz1]cdd4fixes/__pycache__/fix_imports2.cpython-312.opt-1.pycnu[ {|j!HdZddlmZdddZGddejZy)zTFix incompatible imports and module references that must be fixed after fix_imports.) fix_importsdbm)whichdbanydbmceZdZdZeZy) FixImports2N)__name__ __module__ __qualname__ run_orderMAPPINGmapping3/usr/lib64/python3.12/lib2to3/fixes/fix_imports2.pyrr s IGrrN)__doc__rr FixImportsrrrrrs.  +((rPKz1]6fixes/__pycache__/fix_isinstance.cpython-312.opt-2.pycnu[ {|jHH ddlmZddlmZGddejZy)) fixer_base)tokenceZdZdZdZdZdZy) FixIsinstanceTz power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > ct}|d}|j}g}t|}|D]\}} | jtj k(rP| j |vrB|t|dz ksC||dzjtjk(sgt|s|j| | jtj k(s|j| j |r#|djtjk(r|d=t|dk(r5|j} | j|d_ | j|dy||dd|jy)Nargs)setchildren enumeratetyperNAMEvaluelenCOMMAnextappendaddparentprefixreplacechanged) selfnoderesultsnames_insertedtestlistr new_argsiteratoridxargatoms 5/usr/lib64/python3.12/lib2to3/fixes/fix_isinstance.py transformzFixIsinstance.transforms6?  T? HCxx5::%#))~*ETQ&4a=+=+=+LN$88uzz)"&&syy1!  ))U[[8 x=A ??D!%HQK  LL! %DG LLNN)__name__ __module__ __qualname__ BM_compatiblePATTERN run_orderr'r(r&rrsMGIr(rN)r fixer_utilrBaseFixrr/r(r&r3s$$J&&$r(PKz1]f+ + 3fixes/__pycache__/fix_renames.cpython-312.opt-1.pycnu[ {|jjdZddlmZddlmZmZdddiiZiZdZdZ Gd d ejZ y ) z?Fix incompatible renames Fixes: * sys.maxint -> sys.maxsize ) fixer_base)Name attr_chainsysmaxintmaxsizecLddjtt|zdzS)N(|))joinmaprepr)memberss 2/usr/lib64/python3.12/lib2to3/fixes/fix_renames.py alternatesrs" #dG,- - 33c #KttjD]J\}}t|jD])\}}|t||f<d|d|d|dd|d|d+Lyw)Nz3 import_from< 'from' module_name=z, 'import' ( attr_name=z | import_as_name< attr_name=z! 'as' any >) > z& power< module_name=z trailer< '.' attr_name=z > any* > )listMAPPINGitemsLOOKUP)modulereplaceold_attrnew_attrs r build_patternrsl 0"&w}}"7 Hh)1FFH% & 85 5  + +#81sA,A.cXeZdZdZdj eZdZfdZdZ xZ S) FixRenamesTr precztt| |}|r!tfdt |dDry|Sy)Nc3.K|] }|yw)N).0objmatchs r z#FixRenames.match..5sD)C#5:)CsparentF)superrr&anyr)selfnoderesultsr& __class__s @rr&zFixRenames.match1s;j$-+ DD()CDDNrc|jd}|jd}|rI|rFt|j|jf}|jt ||j yyy)N module_name attr_name)prefix)getrvaluerrr2)r+r,r-mod_namer1rs r transformzFixRenames.transform>s^;;}-KK ,   x~~y?@H   d8I4D4DE F"8r) __name__ __module__ __qualname__ BM_compatibler rPATTERNorderr&r6 __classcell__)r.s@rrr*s(Mhh}'G EGrrN) __doc__r fixer_utilrrrrrrBaseFixrr#rrrBsF) Hy)  4+*G##GrPKz1]so+fixes/__pycache__/fix_types.cpython-312.pycnu[ {|jdZddlmZddlmZidddddd d d d d dd ddddddddddddddddddd d!d"d#d$d d%d&d'ZeDcgc]}d(|z c}ZGd)d*ejZy+cc}w),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)Name BooleanTypebool BufferType memoryview ClassTypetype ComplexTypecomplexDictTypedictDictionaryType EllipsisTypeztype(Ellipsis) FloatTypefloatIntTypeintListTypelistLongType ObjectTypeobjectNoneTypez type(None)NotImplementedTypeztype(NotImplemented) SliceTypeslice StringTypebytes StringTypesz(str,)tuplestrrange) TupleTypeTypeType UnicodeType XRangeTypez)power< 'types' trailer< '.' name='%s' > >c8eZdZdZdj eZdZy)FixTypesT|cztj|dj}|rt||jSy)Nname)prefix) _TYPE_MAPPINGgetvaluerr-)selfnoderesults new_values 0/usr/lib64/python3.12/lib2to3/fixes/fix_types.py transformzFixTypes.transform9s3!%%gfo&;&;<  $++6 6N)__name__ __module__ __qualname__ BM_compatiblejoin_patsPATTERNr6r7r5r)r)5sMhhuoGr7r)N) __doc__r fixer_utilrr.r=BaseFixr))ts0r5rEs,&| f   F  6  ) W 5 F E x L 5 g!" g#$ %&- 2CPP-Q 4q 8-Pz!! Qs A4PKz1]0fixes/__pycache__/fix_xreadlines.cpython-312.pycnu[ {|jJdZddlmZddlmZGddej Zy)zpFix "for x in f.xreadlines()" -> "for x in f". This fixer will also convert g(f.xreadlines) into g(f.__iter__).) fixer_base)NameceZdZdZdZdZy) FixXreadlinesTz power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | power< any+ trailer< '.' no_call='xreadlines' > > c|jd}|r'|jtd|jy|j|dDcgc]}|j c}ycc}w)Nno_call__iter__)prefixcall)getreplacerr clone)selfnoderesultsrxs 5/usr/lib64/python3.12/lib2to3/fixes/fix_xreadlines.py transformzFixXreadlines.transformsR++i(  OODGNNC D LLWV_=_!'')_= >=s A,N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrr sMG ?rrN)__doc__r fixer_utilrBaseFixrrrrr s%D ?J&&?rPKz1]#.fixes/__pycache__/fix_ne.cpython-312.opt-2.pycnu[ {|j;T ddlmZddlmZddlmZGddej Zy))pytree)token) fixer_basec0eZdZejZdZdZy)FixNec |jdk(S)Nz<>)value)selfnodes -/usr/lib64/python3.12/lib2to3/fixes/fix_ne.pymatchz FixNe.matchszzT!!cftjtjd|j}|S)Nz!=)prefix)rLeafrNOTEQUALr)r r resultsnews r transformzFixNe.transforms!kk%..$t{{C rN)__name__ __module__ __qualname__rr _accept_typer rrr rr s>>L"rrN)rpgen2rrBaseFixrrrr rs'# J   rPKz1]73fixes/__pycache__/fix_nonzero.cpython-312.opt-2.pycnu[ {|jOH ddlmZddlmZGddejZy)) fixer_base)NameceZdZdZdZdZy) FixNonzeroTz classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='__nonzero__' parameters< '(' NAME ')' > any+ > any* > > c^|d}td|j}|j|y)Nname__bool__)prefix)rr replace)selfnoderesultsrnews 2/usr/lib64/python3.12/lib2to3/fixes/fix_nonzero.py transformzFixNonzero.transforms'v:dkk2 SN)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrsMGrrN)r fixer_utilrBaseFixrrrrrs"0 ## rPKz1]mxAA9fixes/__pycache__/fix_standarderror.cpython-312.opt-1.pycnu[ {|jJdZddlmZddlmZGddej Zy)z%Fixer for StandardError -> Exception.) fixer_base)NameceZdZdZdZdZy)FixStandarderrorTz- 'StandardError' c0td|jS)N Exception)prefix)rr )selfnoderesultss 8/usr/lib64/python3.12/lib2to3/fixes/fix_standarderror.py transformzFixStandarderror.transformsK 44N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrr rr sMG5rrN)__doc__r fixer_utilrBaseFixrrrr rs$,5z))5rPKz1]&)-pgen2/__pycache__/token.cpython-312.opt-1.pycnu[ {|jzdZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;dZ>iZ?e@eAjD]\ZCZDeEeDeFseCe?eD<d?ZGd@ZHdAZIyB)Cz!Token constants (from "token.h").  !"#$%&'()*+,-./0123456789:;<c|tkSN NT_OFFSETxs ,/usr/lib64/python3.12/lib2to3/pgen2/token.py ISTERMINALrGOs y=c|tk\SrArBrDs rF ISNONTERMINALrJR >rHc|tk(SrA) ENDMARKERrDs rFISEOFrNUrKrHN)J__doc__rMNAMENUMBERSTRINGNEWLINEINDENTDEDENTLPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENT BACKQUOTELBRACERBRACEEQEQUALNOTEQUAL LESSEQUAL GREATEREQUALTILDE CIRCUMFLEX LEFTSHIFT RIGHTSHIFT DOUBLESTAR PLUSEQUALMINEQUAL STAREQUAL SLASHEQUAL PERCENTEQUAL AMPEREQUAL VBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUAL DOUBLESLASHDOUBLESLASHEQUALATATEQUALOPCOMMENTNLRARROWAWAITASYNC ERRORTOKEN COLONEQUALN_TOKENSrCtok_namelistglobalsitems_name_value isinstanceintrGrJrNrHrFrs(                                                      ')//+,ME6&# - rHPKz1]Vf辳*pgen2/__pycache__/__init__.cpython-312.pycnu[ {|jdZy)zThe pgen2 package.N)__doc__//usr/lib64/python3.12/lib2to3/pgen2/__init__.pyrs rPKz1]a%\\)pgen2/__pycache__/grammar.cpython-312.pycnu[ {|jdZddlZddlmZGddeZdZiZejD]$Z e se j\Z Z e ee ee <&[ [ [ y)aThis module defines the data structures used to represent a grammar. These are a bit arcane because they are derived from the data structures used by Python's 'pgen' parser generator. There's also a table here mapping operators to their names in the token module; the Python tokenize module reports all operators as the fallback token code OP, but the parser needs the actual token code. N)tokenc4eZdZdZdZdZdZdZdZdZ y) Grammara Pgen parsing tables conversion class. Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine accesses the instance variables directly. The class here does not provide initialization of the tables; several subclasses exist to do this (see the conv and pgen modules). The load() method reads the tables from a pickle file, which is much faster than the other ways offered by subclasses. The pickle file is written by calling dump() (after loading the grammar tables using a subclass). The report() method prints a readable representation of the tables to stdout, for debugging. The instance variables are as follows: symbol2number -- a dict mapping symbol names to numbers. Symbol numbers are always 256 or higher, to distinguish them from token numbers, which are between 0 and 255 (inclusive). number2symbol -- a dict mapping numbers to symbol names; these two are each other's inverse. states -- a list of DFAs, where each DFA is a list of states, each state is a list of arcs, and each arc is a (i, j) pair where i is a label and j is a state number. The DFA number is the index into this list. (This name is slightly confusing.) Final states are represented by a special arc of the form (0, j) where j is its own state number. dfas -- a dict mapping symbol numbers to (DFA, first) pairs, where DFA is an item from the states list above, and first is a set of tokens that can begin this grammar rule (represented by a dict whose values are always 1). labels -- a list of (x, y) pairs where x is either a token number or a symbol number, and y is either None or a string; the strings are keywords. The label number is the index in this list; label numbers are used to mark state transitions (arcs) in the DFAs. start -- the number of the grammar's start symbol. keywords -- a dict mapping keyword strings to arc labels. tokens -- a dict mapping token numbers to arc labels. ci|_i|_g|_i|_dg|_i|_i|_i|_d|_y)N)rEMPTY) symbol2number number2symbolstatesdfaslabelskeywordstokens symbol2labelstart)selfs ./usr/lib64/python3.12/lib2to3/pgen2/grammar.py__init__zGrammar.__init__LsF  #n    ct|d5}tj|j|tjdddy#1swYyxYw)z)Dump the grammar tables to a pickle file.wbN)openpickledump__dict__HIGHEST_PROTOCOL)rfilenamefs rrz Grammar.dumpWs4 (D !Q KK q&*A*A B" ! !s 0AAct|d5}tj|}ddd|jj y#1swY%xYw)z+Load the grammar tables from a pickle file.rbN)rrloadrupdate)rrrds rr"z Grammar.load\s; (D !Q AA" Q" !s AAc`|jjtj|y)z3Load the grammar tables from a pickle bytes object.N)rr#rloads)rpkls rr&z Grammar.loadsbs V\\#./rc |j}dD]'}t||t||j)|jdd|_|j dd|_|j |_|S)z# Copy the grammar. )r r r rrrN) __class__setattrgetattrcopyrr r)rnew dict_attrs rr,z Grammar.copyfshnn4I CGD)$<$A$A$C D4[[^ [[^ JJ  rc^ddlm}td||jtd||jtd||jtd||j td||j td|jy ) z:Dump the grammar tables to standard output, for debugging.r)pprints2nn2sr r rrN)r0printr r r r rr)rr0s rreportzGrammar.reportssv! e t!!" e t!!" ht{{ f tyy ht{{ gtzz"rN) __name__ __module__ __qualname____doc__rrr"r&r,r4rrrrs'3j C  0  #rra ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW := COLONEQUAL )r8rrobjectr opmap_rawopmap splitlineslinesplitopnamer+r9rrrCsp j#fj#^1  f   "D ::<DE4(b  # "drPKz1]&&,pgen2/__pycache__/conv.cpython-312.opt-1.pycnu[ {|j%JdZddlZddlmZmZGddej Zy)aConvert graminit.[ch] spit out by pgen to Python code. Pgen is the Python parser generator. It is useful to quickly create a parser from a grammar file in Python's grammar notation. But I don't want my parsers to be written in C (yet), so I'm translating the parsing tables to Python data structures and writing a Python parse engine. Note that the token numbers are constants determined by the standard Python tokenizer. The standard token module defines these numbers and their names (the names are not used much). The token numbers are hardcoded into the Python tokenizer and into pgen. A Python implementation of the Python tokenizer is also available, in the standard tokenize module. On the other hand, symbol numbers (representing the grammar's non-terminals) are assigned by pgen based on the actual grammar input. Note: this module is pretty much obsolete; the pgen module generates equivalent grammar tables directly from the Grammar.txt input file without having to invoke the Python pgen C program. N)grammartokenc(eZdZdZdZdZdZdZy) Convertera2Grammar subclass that reads classic pgen output files. The run() method reads the tables as produced by the pgen parser generator, typically contained in two C files, graminit.h and graminit.c. The other methods are for internal use only. See the base class for more documentation. ch|j||j||jy)z_[] = { {, }, ... }; - followed by a state array, of the form: static state states_[] = { {, arcs__}, ... }; rrNFrrz static arc z)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$z\s+{(\d+), (\d+)},$z'static state states_(\d+)\[(\d+)\] = {$z\s+{(\d+), arcs_(\d+)_(\d+)},$zstatic dfa dfas\[(\d+)\] = {$z0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$z\s+("(?:\\\d\d\d)*")},$z!static label labels\[(\d+)\] = {$z\s+{(\d+), (0|"\w+")},$0z \s+(\d+),$z\s+{(\d+), labels},$z \s+(\d+)$)rrrnext startswithrrlistmaprrrangeappendstatesgroupeval enumerateorddfaslabelsstart StopIteration)!r r r!r"r#r$allarcsr5r%nmkarcs_ijststater:ndfasr&r'xyzfirst rawbitsetcbyter;nlabelsr<s! rr zConverter.parse_graminit_cTsP8 XA axaaxaaxaoom,//-0XXJ"$s3 451aqA#)!8T!WDF"8$?BC 56DAqKKA' " &axa"&A%axa//-0 DdKBC-.DAqE1X%axaXX?Fs3 451aq!t} T" MM% !!8T!WDF!!8T!WDFCoom,D  XX6 =BHHQK uA!!8T!WDFM BXXa[F"3sBHHQ1a,@#ABOFAq!1IE!!8T!WDF4d;BERXXa[)I!),11vqAq!t})*acAg"- "5>DL-.axa axa XX:D Abhhqk"wA!!8T!WDF4d;B99;DAqAACxG MM1a& ! axa axaaxa XXmT *BHHQK axaaxa XX-t 4bhhqk"axa XXlD )BHHQK  axa %!!8T!WDFC  37 8 D   s) V6V. V+V&&V+. V:9V:ci|_i|_t|jD]?\}\}}|tj k(r|||j|<.|1||j|<Ay)z1Create additional useful structures. (Internal).N)keywordstokensr8r;rNAME)r ilabeltypevalues rr zConverter.finish_offs^  %.t{{%; !FMT5uzz!e&7'- e$$* D! &c%J+rr)r\rpgen2rrGrammarrr]rrr`s&4 !]+]+rPKz1]&)'pgen2/__pycache__/token.cpython-312.pycnu[ {|jzdZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;dZ>iZ?e@eAjD]\ZCZDeEeDeFseCe?eD<d?ZGd@ZHdAZIyB)Cz!Token constants (from "token.h").  !"#$%&'()*+,-./0123456789:;<c|tkSN NT_OFFSETxs ,/usr/lib64/python3.12/lib2to3/pgen2/token.py ISTERMINALrGOs y=c|tk\SrArBrDs rF ISNONTERMINALrJR >rHc|tk(SrA) ENDMARKERrDs rFISEOFrNUrKrHN)J__doc__rMNAMENUMBERSTRINGNEWLINEINDENTDEDENTLPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENT BACKQUOTELBRACERBRACEEQEQUALNOTEQUAL LESSEQUAL GREATEREQUALTILDE CIRCUMFLEX LEFTSHIFT RIGHTSHIFT DOUBLESTAR PLUSEQUALMINEQUAL STAREQUAL SLASHEQUAL PERCENTEQUAL AMPEREQUAL VBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUAL DOUBLESLASHDOUBLESLASHEQUALATATEQUALOPCOMMENTNLRARROWAWAITASYNC ERRORTOKEN COLONEQUALN_TOKENSrCtok_namelistglobalsitems_name_value isinstanceintrGrJrNrHrFrs(                                                      ')//+,ME6&# - rHPKz1]""'pgen2/__pycache__/parse.cpython-312.pycnu[ {|j@dZddlmZGddeZGddeZy)zParser engine for the grammar tables generated by pgen. The grammar table must be loaded first. See Parser/parser.c in the Python distribution for additional info on how this parsing engine works. )tokenceZdZdZdZdZy) ParseErrorz(Exception to signal the parser is stuck.c ~tj||d|d|d|||_||_||_||_y)Nz: type=z, value=z , context=) Exception__init__msgtypevaluecontext)selfr r r r s ,/usr/lib64/python3.12/lib2to3/pgen2/parse.pyrzParseError.__init__s<4ug"7 8   ctt||j|j|j|jffSN)r r r r )r s r __reduce__zParseError.__reduce__s*DzDHHdiiT\\JJJrN)__name__ __module__ __qualname____doc__rrrrrrs2Krrc>eZdZdZd dZd dZdZdZdZdZ d Z y) Parsera5Parser engine. The proper usage sequence is: p = Parser(grammar, [converter]) # create instance p.setup([start]) # prepare for parsing : if p.addtoken(...): # parse a token; may raise ParseError break root = p.rootnode # root of abstract syntax tree A Parser instance may be reused by calling setup() repeatedly. A Parser instance contains state pertaining to the current token sequence, and should not be used concurrently by different threads to parse separate token sequences. See driver.py for how to get input tokens by tokenizing a file or string. Parsing is complete when addtoken() returns True; the root of the abstract syntax tree can then be retrieved from the rootnode instance variable. When a syntax error occurs, addtoken() raises the ParseError exception. There is no error recovery; the parser cannot be used after a syntax error was reported (but it can be reinitialized by calling setup()). Nc*||_|xsd|_y)aConstructor. The grammar argument is a grammar.Grammar instance; see the grammar module for more information. The parser is not ready yet for parsing; you must call the setup() method to get it started. The optional convert argument is a function mapping concrete syntax tree nodes to abstract syntax tree nodes. If not given, no conversion is done and the syntax tree produced is the concrete syntax tree. If given, it must be a function of two arguments, the first being the grammar (a grammar.Grammar instance), and the second being the concrete syntax tree node to be converted. The syntax tree is converted from the bottom up. A concrete syntax tree node is a (type, value, context, nodes) tuple, where type is the node type (a token or symbol number), value is None for symbols and a string for tokens, context is None or an opaque value used for error reporting (typically a (lineno, offset) pair), and nodes is a list of children for symbols, and None for tokens. An abstract syntax tree node may be anything; this is entirely up to the converter function. c|Srr)grammarnodes rz!Parser.__init__..ZsrN)rconvert)r rrs rrzParser.__init__<s: >#= rc||jj}|ddgf}|jj|d|f}|g|_d|_t |_y)aPrepare for parsing. This *must* be called before starting to parse. The optional argument is an alternative start symbol; it defaults to the grammar's start symbol. You can use a Parser instance to parse any number of programs; each time you call setup() the parser is reset to an initial state determined by the (implicit or explicit) start symbol. N)rstartdfasstackrootnodeset used_names)r r"newnode stackentrys rsetupz Parser.setup\s\ =LL&&E$b)ll''.7;  \  %rc|j|||} |jd\}}}|\}} ||} | D]\} } |jj| \} }|| k(rl| dksJ|j ||| || }||d|fgk(rB|j |jsy|jd\}}}|\}} ||d|fgk(rBy| dk\s|jj | }|\}}||vs|j| |jj | | |n?d|f| vr*|j |jstd|||td|||I)z$E -QJ<7 #zz#'+/::b>(UD(+  !-QJ<7!#X!\\..q1F*0'Ix) !T\\%6%6q%98WM3 $6u:%HHJ::()9)-ug??%[$wGGSrc|tjk(rD|jj||jj j |}||S|jjj |}|td||||S)z&Turn a token into a label. (Internal)z bad token) rNAMEr'addrkeywordsgettokensr)r r r r r3s rr.zParser.classifysz 5::  OO   &\\**..u5F! $$((. >[$w? ? rc|jd\}}}|||df}|j|j|}||dj||||f|jd<y)zShift a token. (Internal)r,N)r$rrappend) r r r r:r r4r5rr(s rr0z Parser.shiftsb::b>UD.,,t||W5   HOOG $x. 2rc|jd\}}}|d|gf}|||f|jd<|jj|d|fy)zPush a nonterminal. (Internal)r,Nr!)r$rH) r r newdfar:r r4r5rr(s rr2z Parser.pushsQ::b>UDw+x. 2 61g./rc*|jj\}}}|j|j|}|W|jr(|jd\}}}|dj |y||_|j |j _yy)zPop a nonterminal. (Internal)Nr,)r$r1rrrHr%r')r popdfapopstatepopnoder(r4r5rs rr1z Parser.popsz$(JJNN$4!',,t||W5  zz#'::b> UDR( ' +/?? ( rr) rrrrrr*r@r.r0r2r1rrrrrs-:?@ 0.H` /0 ;rrN)rrrrobjectrrrrrQs+ K Kn;Vn;rPKz1]$E-pgen2/__pycache__/parse.cpython-312.opt-2.pycnu[ {|j> ddlmZGddeZGddeZy))tokenceZdZ dZdZy) ParseErrorc ~tj||d|d|d|||_||_||_||_y)Nz: type=z, value=z , context=) Exception__init__msgtypevaluecontext)selfr r r r s ,/usr/lib64/python3.12/lib2to3/pgen2/parse.pyrzParseError.__init__s<4ug"7 8   ctt||j|j|j|jffSN)r r r r )r s r __reduce__zParseError.__reduce__s*DzDHHdiiT\\JJJrN)__name__ __module__ __qualname__rrrrrrs2Krrc<eZdZ d dZd dZdZdZdZdZdZ y) ParserNc, ||_|xsd|_y)Nc|Srr)grammarnodes rz!Parser.__init__..Zsr)rconvert)r rrs rrzParser.__init__<s 8 >#= rc ||jj}|ddgf}|jj|d|f}|g|_d|_t |_y)N)rstartdfasstackrootnodeset used_names)r r!newnode stackentrys rsetupz Parser.setup\sa  =LL&&E$b)ll''.7;  \  %rc |j|||} |jd\}}}|\}} ||} | D]\} } |jj| \} }|| k(re|j ||| || }||d|fgk(rB|j |jsy|jd\}}}|\}} ||d|fgk(rBy| dk\s|jj | }|\}}||vs|j| |jj | | |n?d|f| vr*|j |jstd|||td|||B)NTr Fztoo much inputz bad input) classifyr#rlabelsshiftpopr"pushr)r r r r ilabeldfastaterstatesfirstarcsinewstatetvitsdfa itsstatesitsfirsts raddtokenzParser.addtokentsJtUG4#zz"~ CMFE%=D# 8||**1-1Q;JJtUHg>$E -QJ<7 #zz#'+/::b>(UD(+  !-QJ<7!#X!\\..q1F*0'Ix) !T\\%6%6q%98WM3 $6u:%HHJ::()9)-ug??%[$wGGSrc  |tjk(rD|jj||jj j |}||S|jjj |}|td||||S)Nz bad token) rNAMEr&addrkeywordsgettokensr)r r r r r2s rr-zParser.classifys}4 5::  OO   &\\**..u5F! $$((. >[$w? ? rc |jd\}}}|||df}|j|j|}||dj||||f|jd<yNr+)r#rrappend) r r r r9r r3r4rr's rr/z Parser.shiftse(::b>UD.,,t||W5   HOOG $x. 2rc |jd\}}}|d|gf}|||f|jd<|jj|d|fy)Nr+r )r#rH) r r newdfar9r r3r4rr's rr1z Parser.pushsT-::b>UDw+x. 2 61g./rc, |jj\}}}|j|j|}|W|jr(|jd\}}}|dj |y||_|j |j _yyrG)r#r0rrrHr$r&)r popdfapopstatepopnoder'r3r4rs rr0z Parser.pops},$(JJNN$4!',,t||W5  zz#'::b> UDR( ' +/?? ( rr) rrrrr)r?r-r/r1r0rrrrrs-:?@ 0.H` /0 ;rrN)rrrobjectrrrrrQs+ K Kn;Vn;rPKz1][?  0pgen2/__pycache__/literals.cpython-312.opt-2.pycnu[ {|jc T ddlZdddddddd d d d Zd ZdZdZedk(reyy)N     '"\) abfnrtvr r r c|jdd\}}tj|}||S|jdr9|dd}t |dkrt d|z t |d}t|S t |d}t|S#t $rt d|zdwxYw#t $rt d|zdwxYw) Nrxz!invalid hex string escape ('\%s')z#invalid octal string escape ('\%s'))groupsimple_escapesget startswithlen ValueErrorintchr)malltaileschexesis //usr/lib64/python3.12/lib2to3/pgen2/literals.pyescaper)s1 IC   T "C   sQR u:>ADHI I TE2A q6M  VD! A q6M TADHIt S T  VCdJKQU U Vs" B: B-B*-Cc|d}|dd|dzk(r|dz}|t|t| }tjdt|S)Nrz)\\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3}))rresubr))sqs r( evalStringr0(sQ !A!u!| aC #a&#a&A 66> JJctdD]7}t|}t|}t|}||k7s*t ||||9y)N)ranger!reprr0print)r'cr.es r(testr92s@ 3Z F G qM 6 !Q1  r1__main__)r,rr)r0r9__name__r1r(r=sWC  *K zFr1PKz1]:JQJQ0pgen2/__pycache__/tokenize.cpython-312.opt-1.pycnu[ {|jR dZdZdZddlZddlZddlmZmZddlddl m Z e e Dcgc] }|dd k7s |c}gd zZ [ e d Zd Zd ZdZdZdZeedezzeezZdZdZdZdZeddZeeeeeZdZeddeezZdezZeeeZ ede dzZ!ee!e eZ"dZ#dZ$d Z%d!Z&d"Z'ee'd#ze'd$zZ(ee'd%ze'd&zZ)ed'd(d)d*d+d,d-d.d/ Z*d0Z+ed1d2d3Z,ee*e+e,Z-ee"e-e)eZ.ee.zZ/ee'd4zed5dze'd6zed7dzZ0edee(Z1eee1e"e-e0ezZ2e3ejhe/e2e%e&f\Z5Z6Z7Z8ed8d9d:d;ed8d9dzZ9ejhe#ejhe$e7e8d?e9Dcic]}|d#e7 c}e9Dcic]}|d$e8 c}e9Dcic]}|dc}Z:d#d$he9Dchc]}|d# c}ze9Dchc]}|d$ c}zZ;d5d7he9Dchc]}|d5 c}ze9Dchc]}|d7 c}zZZ?GdCdDe>Z@dEZAeAfdFZBdGZCGdHdIZDejhdJejZFejhdKejZGdLZHdMZIdNZJdOZKeLdPk(r\ddlMZMeNeMjdkDr&eBePeMjdjyeBeMjjyycc}w#e$reZ YwxYwcc}wcc}wcc}wcc}wcc}wcc}wcc}w)QaTokenization help for Python programs. generate_tokens(readline) is a generator that breaks a stream of text into Python tokens. It accepts a readline-like method which is called repeatedly to get the next line of input (or "" for EOF). It generates 5-tuples with these members: the token type (see token.py) the token (a string) the starting (row, column) indices of the token (a 2-tuple of ints) the ending (row, column) indices of the token (a 2-tuple of ints) the original line (string) It is designed to match the working of the Python tokenizer exactly, except that it produces COMMENT tokens for comments and gives type OP for all operators Older entry points tokenize_loop(readline, tokeneater) tokenize(readline, tokeneater=printtoken) are the same, except instead of generating tokens, tokeneater is a callback function to which the 5 fields described above are passed as 5 arguments, each time a new token is found.zKa-Ping Yee z@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip MontanaroN)BOM_UTF8lookup)*)token_)tokenizegenerate_tokens untokenizec0ddj|zdzS)N(|))joinchoicess //usr/lib64/python3.12/lib2to3/pgen2/tokenize.pygroupr0sC#((7"33c99ct|dzS)Nrrrs ranyr1s%/C//rct|dzS)N?rrs rmayber2sE7Oc11rc,tfdDS)Nc3K|]5}dzD]+}|j|jk7s%||z-7yw))N)casefold).0xyls r z _combinations..4s8!!e)Qqzz|qzz|/KA)qs.> >)set)r#s`r _combinationsr&3s  rz[ \f\t]*z #[^\r\n]*z\\\r?\nz\w+z0[bB]_?[01]+(?:_[01]+)*z(0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?z0[oO]?_?[0-7]+(?:_[0-7]+)*[lL]?z[1-9]\d*(?:_\d+)*[lL]?z0[lL]?z[eE][-+]?\d+(?:_\d+)*z\d+(?:_\d+)*\.(?:\d+(?:_\d+)*)?z\.\d+(?:_\d+)*z \d+(?:_\d+)*z\d+(?:_\d+)*[jJ]z[jJ]z[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'(?:[uUrRbBfF]|[rR][fFbB]|[fFbBuU][rR])?'''"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z<>z!=z//=?z->z[+\-*/%&@|^=<>]=?~z[][(){}]z\r?\nz:=z[:;.,`@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"rRfFbB>UuURUruRur)r*r+r'r(c eZdZy) TokenErrorN__name__ __module__ __qualname__rrr:r:rr:c eZdZy)StopTokenizingNr;r?rrrBrBr@rrBc `|\}}|\}}td||||t|t|fzy)Nz%d,%d-%d,%d: %s %s)printtok_namerepr) typerxxx_todo_changemexxx_todo_changeme1linesrowscolerowecols r printtokenrOs<$LT4%LT4 tT4$e= >?rc< t||y#t$rYywxYw)a: The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. The second parameter, tokeneater, must also be a callable object. It is called once for each token, with five arguments, corresponding to the tuples generated by generate_tokens(). N) tokenize_looprB)readline tokeneaters rr r s# h +    s  c.t|D]}|| yN)r )rRrS token_infos rrQrQs%h/ J0rc$eZdZdZdZdZdZy) Untokenizerc.g|_d|_d|_y)Nrr)tokensprev_rowprev_col)selfs r__init__zUntokenizer.__init__s   rcn|\}}||jz }|r|jjd|zyy)N )r\rZappend)r]startrowcol col_offsets radd_whitespacezUntokenizer.add_whitespaces8S4==(  KK  sZ/ 0 rcf|D]}t|dk(r|j||np|\}}}}}|j||jj ||\|_|_|ttfvsw|xj dz c_d|_dj|jS)Nrrr) lencompatrfrZrar[r\NEWLINENLr)r]iterablettok_typerrbendrJs rr zUntokenizer.untokenizesA1v{ Ax(01 -HeUC    & KK  u %+. (DM4=GR=( " ! wwt{{##rcd}g}|jj}|\}}|ttfvr|dz }|tt fvrd}|D]}|dd\}}|ttt tfvr|dz }|tk(r|j|C|tk(r|j]|tt fvrd}n|r|r ||dd}||y)NFr`Trh) rZraNAMENUMBERrkrlASYNCAWAITINDENTDEDENTpop) r]rrm startlineindents toks_appendtoknumtokvaltoks rrjzUntokenizer.compats kk((  dF^ # cMF gr] "IC !WNFF$u55# v&6! GR=( wGBK(!  #rN)r<r=r>r^rfr rjr?rrrXrXs 1 $ rrXz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)c|ddjjdd}|dk(s|jdry|dvs|jdry |S) z(Imitates get_normal_name in tokenizer.c.N r-utf-8zutf-8-)zlatin-1 iso-8859-1z iso-latin-1)zlatin-1-z iso-8859-1-z iso-latin-1-r)lowerreplace startswith)orig_encencs r_get_normal_namersX 3B-    ' 'S 1C g~1 66 ~~AB Orcdd}d}fd}fd}|}|jtr d|dd}d}|s|gfS||}|r||gfStj|s||gfS|}|s||gfS||}|r|||gfS|||gfS) a The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. FNrcF S#t$r tcYSwxYwrU) StopIterationbytes)rRsr read_or_stopz%detect_encoding..read_or_stops& :  7N s    c> |jd}tj|}|syt |j d} t |}r|jdk7r td|dz }|S#t$rYywxYw#t$rtd|zwxYw)Nasciirzunknown encoding: rzencoding problem: utf-8z-sig) decodeUnicodeDecodeError cookie_rematchrrr LookupError SyntaxErrorname)rJ line_stringrencodingcodec bom_founds r find_cookiez$detect_encoding..find_cookie s ++g.K ,#EKKN3 ?8$E zzW$!";<<  H#"   ?2X=> > ?sA5 B5 BBBTz utf-8-sig)rrblank_rer)rRrdefaultrrfirstsecondrs` @rdetect_encodingrs$IHG , NE ! ab  {5!H%  >>%  ^F 6"H%(( UFO ##rc8t}|j|S)aTransform tokens back into Python source code. Each element returned by the iterable must be a token sequence with at least two elements, a token number and token value. If only two tokens are passed, the resulting output is poor. Round-trip invariant for full input: Untokenized source will match input source exactly Round-trip invariant for limited input: # Output text will tokenize the back to the input t1 = [tok[:2] for tok in generate_tokens(f.readline)] newcode = untokenize(t1) readline = iter(newcode.splitlines(1)).next t2 = [tok[:2] for tokin generate_tokens(readline)] assert t1 == t2 )rXr )rmuts rr r :s$ B == ""rc#v Kdx}x}}d\}}d}dg}d}d} d} d} |} |dz}dt| }} |r| s tdj| }|r4|j dx} }t || d|z||f|| zfd\}}d}n|r0| ddd k7r(| d dd k7r t || z|t| f|fd}d}|| z}|| z}|dk(r|s| snd}| |krA| | d k(r|dz}n(| | d k(r|tzdztz}n | | dk(rd}nn | dz} | |krA| |k(rn|r|d}| | dvr| | dk(r]| | djd}| t|z}t||| f|| t|zf| ft| |d||f|t| f| fn,ttf| | dk(| | d|| f|t| f| f||dkDr%|j|t| d| |df|| f| f||dkrC||vrtdd|| | f|dd}| r| |dk\rd} d} d} td|| f|| f| f||dkrC| r#| r!| |dk\rd} d} d} n| std|dfd}| |krtj| | }|rI|j!d\}}||f||f|} }}| ||| |}}|t"j$vs |dk(r|dk7rt&|||| fn|dvr)t(}|dkDrt}n| rd} |r|d}||||| fn|dk(r|r|d}t|||| fn|t*vrYt,|}|j| | }|r/|j d} | || }|r|d}t |||| f| fnu||f}| |d}| }no|t.vs|ddt.vs |ddt.vrR|ddk(r4||f}t,|xst,|dxs t,|d}| |dd}}| }n|r|d}t |||| fn|j1r|dvr| r|dk(rt2nt4|||| ft6|||| f}|dk(r|s|}|dvr=|r;|dt6k(r/|ddk(r'|dk(rd} |d} t2|d|d|d|dfd}|r|d}|nd|d k(r|r|d}t|||| f| fd}nE|d!vr|dz}n |d"vr|dz }|r|d}t8|||| fnt | | || f|| dzf| f| dz} | |kr|r|d}|ddD]}td|df|dfdft:d|df|dfdfy#t$rd} YwxYww)#a4 The generate_tokens() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. Alternately, readline can be a callable function terminating with StopIteration: readline = open(myfile).next # Example of alternate readline The generator produces 5-tuples with these members: the token type; the token string; a 2-tuple (srow, scol) of ints specifying the row and column where the token begins in the source; a 2-tuple (erow, ecol) of ints specifying the row and column where the token ends in the source; and the line on which the token was found. The line passed is the physical line. r)rrNFrrzEOF in multi-line stringz\ z\ r`  z# #z rrz3unindent does not match any outer indentation levelz zEOF in multi-line statement.Trhr )asyncawaitr)defforr\z([{z)]})rrir:rrpSTRING ERRORTOKENtabsizerstripCOMMENTrlrarwIndentationErrorrx pseudoprogspanstringdigitsrtrk triple_quotedendprogs single_quoted isidentifierrurvrsOP ENDMARKER)rRlnumparenlev continuedcontstrneedcontcontliner{stashed async_defasync_def_indent async_def_nlrJposmaxstrstartendprogendmatchrpcolumn comment_tokennl_pos pseudomatchrbsposeposrinitialnewlinerindents rr r Osy #$#D#8iGXHcGGIL  :Daxc$iS  !;XFF}}T*H$LLO+cwds3$ho??$)!d23i61d23i86K!7T>#dCI%6BB!D.#d? ]9F)9#fqjV#Y$&&'/A2Ew1N#Y$&Ag ) cz5 CyG#9#$(J$5$5f$=M 3}#55F"M #;sS5G/G(H$PPtFG} &>D#d)+'"+.M! $ #$  !>q JJICi$**45K(--a0 s#'-$cCd!%eC$u+wfmm+sNu|!5$d;;&%G!|"$"'+ % "&"E4t<<^% "&"E4t<<m+&uoG&}}T37H&ll1o $U3"")M&*G%udT3KFF$(%="&uv,#' -"1I."1I.RyD($(%=#+G#4$6q8J$6#+E!H#5 ,0L!#'"")M&*G%udD$??))+ 22$,1W,<5%#($d#<<$dD9C'"% .#$+AJ$$6$+AJ'$9$~,0 3:2; 0#('!*#*1:wqz#*1:#//'+G% "&I_% "&udT3K>> !I%'HqL E)hl8% "&udD$77!49 #;s1u t==AgSCii ~ !"+rD!9tQi44 b4)dAY 33E D s<T9T'C:T9D T9J.T907T9' T62T95T66T9__main__)S__doc__ __author__ __credits__rrecodecsrrlib2to3.pgen2.tokenrrdir__all__r NameErrorstrrrrr& WhitespaceCommentIgnoreName Binnumber Hexnumber Octnumber Decnumber IntnumberExponent PointfloatExpfloat Floatnumber ImagnumberNumberSingleDoubleSingle3Double3 _litprefixTripleStringOperatorBracketSpecialFunny PlainTokenTokenContStr PseudoExtras PseudoTokenmapcompile tokenprogr single3prog double3prog _strprefixesrrrr Exceptionr:rBrOr rQrXASCIIrrrrr r r<sysriargvopenrRstdin)r!prefixs00rrs#0* F #!%j 0jAaDCK1j 04, ,  :/1   c*z12 2U7^ C  & 7 . +X 6 )Y 9 = # 57H IERZO [ X %J) & g(= > z; 2 $ # 2 2 7 zE!:#5 6 z;;;; = GWeU%%   % - h) 65&$ /   ;;c:&';;c:&' (Z&1 5vugtLL 25JJ Wg638/ :{K#sC%#sC%&&' F#*"**V*<{ 99EFv&~{*F 9:FFv&~{*F 9+77,vt|,7  9 EN"./,xs^,/0"./,xs^,/0  #J ,- fxq\ -. ,- fxq\ -. !!%Y%? #- & 6 6 p BJJ@"(( K 2::0"(( ; G$R#*`4D z 388}q(4 #4#=#=> 399%% &Y 1  E\GF70/.-sF L$L$L) L7 L<) M> M M * M> M)L43L4PKz1]a%\\/pgen2/__pycache__/grammar.cpython-312.opt-1.pycnu[ {|jdZddlZddlmZGddeZdZiZejD]$Z e se j\Z Z e ee ee <&[ [ [ y)aThis module defines the data structures used to represent a grammar. These are a bit arcane because they are derived from the data structures used by Python's 'pgen' parser generator. There's also a table here mapping operators to their names in the token module; the Python tokenize module reports all operators as the fallback token code OP, but the parser needs the actual token code. N)tokenc4eZdZdZdZdZdZdZdZdZ y) Grammara Pgen parsing tables conversion class. Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine accesses the instance variables directly. The class here does not provide initialization of the tables; several subclasses exist to do this (see the conv and pgen modules). The load() method reads the tables from a pickle file, which is much faster than the other ways offered by subclasses. The pickle file is written by calling dump() (after loading the grammar tables using a subclass). The report() method prints a readable representation of the tables to stdout, for debugging. The instance variables are as follows: symbol2number -- a dict mapping symbol names to numbers. Symbol numbers are always 256 or higher, to distinguish them from token numbers, which are between 0 and 255 (inclusive). number2symbol -- a dict mapping numbers to symbol names; these two are each other's inverse. states -- a list of DFAs, where each DFA is a list of states, each state is a list of arcs, and each arc is a (i, j) pair where i is a label and j is a state number. The DFA number is the index into this list. (This name is slightly confusing.) Final states are represented by a special arc of the form (0, j) where j is its own state number. dfas -- a dict mapping symbol numbers to (DFA, first) pairs, where DFA is an item from the states list above, and first is a set of tokens that can begin this grammar rule (represented by a dict whose values are always 1). labels -- a list of (x, y) pairs where x is either a token number or a symbol number, and y is either None or a string; the strings are keywords. The label number is the index in this list; label numbers are used to mark state transitions (arcs) in the DFAs. start -- the number of the grammar's start symbol. keywords -- a dict mapping keyword strings to arc labels. tokens -- a dict mapping token numbers to arc labels. ci|_i|_g|_i|_dg|_i|_i|_i|_d|_y)N)rEMPTY) symbol2number number2symbolstatesdfaslabelskeywordstokens symbol2labelstart)selfs ./usr/lib64/python3.12/lib2to3/pgen2/grammar.py__init__zGrammar.__init__LsF  #n    ct|d5}tj|j|tjdddy#1swYyxYw)z)Dump the grammar tables to a pickle file.wbN)openpickledump__dict__HIGHEST_PROTOCOL)rfilenamefs rrz Grammar.dumpWs4 (D !Q KK q&*A*A B" ! !s 0AAct|d5}tj|}ddd|jj y#1swY%xYw)z+Load the grammar tables from a pickle file.rbN)rrloadrupdate)rrrds rr"z Grammar.load\s; (D !Q AA" Q" !s AAc`|jjtj|y)z3Load the grammar tables from a pickle bytes object.N)rr#rloads)rpkls rr&z Grammar.loadsbs V\\#./rc |j}dD]'}t||t||j)|jdd|_|j dd|_|j |_|S)z# Copy the grammar. )r r r rrrN) __class__setattrgetattrcopyrr r)rnew dict_attrs rr,z Grammar.copyfshnn4I CGD)$<$A$A$C D4[[^ [[^ JJ  rc^ddlm}td||jtd||jtd||jtd||j td||j td|jy ) z:Dump the grammar tables to standard output, for debugging.r)pprints2nn2sr r rrN)r0printr r r r rr)rr0s rreportzGrammar.reportssv! e t!!" e t!!" ht{{ f tyy ht{{ gtzz"rN) __name__ __module__ __qualname____doc__rrr"r&r,r4rrrrs'3j C  0  #rra ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW := COLONEQUAL )r8rrobjectr opmap_rawopmap splitlineslinesplitopnamer+r9rrrCsp j#fj#^1  f   "D ::<DE4(b  # "drPKz1]?\\.pgen2/__pycache__/driver.cpython-312.opt-1.pycnu[ {|jQdZdZddgZddlZddlZddlZddlZddlZddlm Z m Z m Z m Z m Z GddeZd Z dd Zd Zd Zd Zedk(rej,ee yy)zZParser driver. This provides a high-level interface to parse a file into a syntax tree. z#Guido van Rossum Driver load_grammarN)grammarparsetokentokenizepgenc<eZdZddZd dZd dZd dZd dZd dZy) rNcZ||_|tj}||_||_y)N)rlogging getLoggerloggerconvert)selfrrrs -/usr/lib64/python3.12/lib2to3/pgen2/driver.py__init__zDriver.__init__s* >&&(F  cBtj|j|j}|j d}d}dx}x}x}x} } d} |D]6} | \}}}} } |||fk7r(|\} }|| kr| d| |z zz } | }d}||kr | | ||z } |}|t j t jfvr#| |z } | \}}|jdr|dz }d}|tjk(rtj|}|r/|jjdtj||| |j||| |fr*|r|jjd|j"Sd} | \}}|jds0|dz }d}9tj d||| |f) z4Parse a series of tokens and return the syntax tree.rrN z%s %r (prefix=%r)zStop.zincomplete input)rParserrrsetupr COMMENTNLendswithrOPopmaprdebugtok_nameaddtoken ParseErrorrootnode)rtokensrplinenocolumntypevaluestartend line_textprefix quintuples_linenos_columns r parse_tokenszDriver.parse_tokens&s LLt|| 4  1555u5u5sYI1: .D%Y((%*"(H$dh&788F%FFH$ix88F%F(((++66%!$>>$'aKFFuxx}}U+ !!"5"'.."6vGzz$7KK%%g.zzF NFF~~d#! A F""#5#'A Arcdtj|j}|j||Sz*Parse a stream and return the syntax tree.)r generate_tokensreadliner1)rstreamrr$s rparse_stream_rawzDriver.parse_stream_rawVs)))&//:  //rc&|j||Sr3)r7)rr6rs r parse_streamzDriver.parse_stream[s$$VU33rctj|d|5}|j||cdddS#1swYyxYw)z(Parse a file and return the syntax tree.r)encodingN)ioopenr9)rfilenamer<rr6s r parse_filezDriver.parse_file_s0 WWXsX 6&$$VU37 6 6s5>ctjtj|j}|j ||S)z*Parse a string and return the syntax tree.)r r4r=StringIOr5r1)rtextrr$s r parse_stringzDriver.parse_stringds4))"++d*;*D*DE  //r)NN)F)NF) __name__ __module__ __qualname__rr1r7r9r@rDrrrrs!.`0 44 0rctjj|\}}|dk(rd}||zdjt t t jzdzS)Nz.txtr.z.pickle)ospathsplitextjoinmapstrsys version_info)gtheadtails r_generate_pickle_namerVjsP!!"%JD$ v~ $;#c3+;+;"<= = IIrc|tj}| t|n|}|s t||sQ|j d|t j |}|r&|j d| |j||S|Stj}|j||S#t$r}|j d|Yd}~|Sd}~wwxYw)z'Load the grammar (maybe from a pickle).Nz!Generating grammar tables from %szWriting grammar tables to %szWriting failed: %s) r rrV_newerinfor generate_grammardumpOSErrorrGrammarload)rSgpsaveforcerges rrrqs~""$&(j r "bB F2rN 7<  ! !" %  KK6 ; 5r H1H OO  r H  5 0!44 H  5s0B,, C5C  Cctjj|sytjj|sytjj|tjj|k\S)z0Inquire whether file a was written since file b.FT)rKrLexistsgetmtime)abs rrXrXsQ 77>>!  77>>!  77  A "''"2"21"5 55rc tjj|r t|St tjj |}t j||}tj}|j||S)aNormally, loads a pickled grammar by doing pkgutil.get_data(package, pickled_grammar) where *pickled_grammar* is computed from *grammar_source* by adding the Python version and using a ``.pickle`` extension. However, if *grammar_source* is an extant file, load_grammar(grammar_source) is called instead. This facilitates using a packaged grammar file when needed but preserves load_grammar's automatic regeneration behavior when possible. ) rKrLisfilerrVbasenamepkgutilget_datarr]loads)packagegrammar_source pickled_namedatarbs rload_packaged_grammarrssf ww~~n%N++()9)9.)IJL   G\ 2DAGGDM Hrc|stjdd}tjtjtj d|D]}t |ddy)zMain program, when run as a script: produce grammar pickle files. Calls load_grammar for each argument, a path to a grammar text file. rNz %(message)s)levelr6formatT)r`ra)rQargvr basicConfigINFOstdoutr)argsrSs rmainr|sL xx| gll3::,.Rd$/ r__main__)z Grammar.txtNTFN)__doc__ __author____all__r=rKr rlrQrrrrr r objectrrVrrXrsr|rEexitintrHrrrs 3 ^ $  43J0VJ0ZJ'+04 *6 (  z CHHSTV_rPKz1]«CII&pgen2/__pycache__/pgen.cpython-312.pycnu[ {|j6ddlmZmZmZGddejZGddeZGddeZGdd eZ d d Z y ) )grammartokentokenizec eZdZy) PgenGrammarN)__name__ __module__ __qualname__+/usr/lib64/python3.12/lib2to3/pgen2/pgen.pyrrsr rc|eZdZddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZddZdZdZy)ParserGeneratorNc<d}|t|d}|j}||_||_t j |j |_|j|j\|_ |_ ||i|_ |jy)Nzutf-8)encoding)openclosefilenamestreamrgenerate_tokensreadline generatorgettokenparsedfas startsymbolfirst addfirstsets)selfrr close_streams r __init__zParserGenerator.__init__ s >(W5F!<==KKCIIe$4 56 d#  HHOOF #-3T__Q5M,NAFF1??4( )//$"2"23r cv|j|}i}t|D]}|j||}d||<|SNr)rr-r1)rr7r9rawfirstrr=ilabels r r5zParserGenerator.make_first4sD::d#H%E__Q.FE&M& r ct|j}|djr||jvrX||jvr|j|S|jj |j|df||j|<|St t|d}t|tsJ||tjvsJ|||jvr|j|S|jj |df||j|<|S|ddvsJ|t|}|djrY||jvr|j|S|jj tj|f||j|<|Stj |}||jvr|j|S|jj |df||j|<|S)Nr#)"')r*labelsisalphar+ symbol2labelr0getattrr isinstanceinttok_nametokensevalkeywordsNAMEropmap)rr7r=rCitokenvalues r r1zParserGenerator.make_label=sQXX 8   'ANN*>>%00HHOOQ__U%;T$BC,2ANN5)!M!t4!&#.55./66/QXX%88F++HHOOVTN3'-AHHV$!M8z) 05 0)KEQx!AJJ&::e,,HHOOUZZ$78(.AJJu%!M!u-QXX%88F++HHOOVTN3'-AHHV$!Mr ct|jj}|j|D]"}||jvs|j |$yN)r%rr&r'r calcfirst)rr8r9s r rzParserGenerator.addfirstsetsksBTYY^^%& D4::%t$r c 8|j|}d|j|<|d}i}i}|jjD]\}}||jvrd||jvr|j|}|.t d|z|j ||j|}|j ||||<xd||<|di||<i} |jD]/\}} | D]%} | | vrt d|d| d|d| | || | <'1||j|<y)Nr#zrecursion for rule %rrzrule z is ambiguous; z is in the first sets of z as well as )rrr.r/ ValueErrorrWupdate) rr9r;r<totalset overlapcheckr=r>fsetinverseitsfirstsymbols r rWzParserGenerator.calcfirstss;iio 4A  ::++-KE4 !DJJ&::e,D|()@4)GHHNN5)::e,D%&* U#"#',aj U#.+113OE8"W$$&*FE76?&LMM#( # 4$ 4r ci}d}|jtjk7r|jtjk(r.|j |jtjk(r.|j tj }|j tjd|j\}}|j tj|j||}t|}|j|t|}|||<||}|jtjk7r||fS)N:) typer ENDMARKERNEWLINErexpectrQOP parse_rhsmake_dfar* simplify_dfa) rrrr9azr;oldlennewlens r rzParserGenerator.parses ii5??*))u}}, ))u}},;;uzz*D KK# &>>#DAq KK &--1%CXF   c "XFDJ"" #ii5??*$[  r c  t|tsJt|tsJ fd} fd t|||g}|D]}i}|jD]2}|jD]!\}} |  | |j |i#4t |jD]L\}} |D]} | j| k(snt| |} |j| |j| |N|S)Nci}|||SrVr )r<base addclosures r closurez)ParserGenerator.make_dfa..closuresD ud #Kr c~t|tsJ||vryd||<|jD]\}}| ||yrA)rKNFAStater.)r<rqr=r>rrs r rrz,ParserGenerator.make_dfa..addclosuresGeX. ..}DK$zz t=tT* *r ) rKruDFAStatenfasetr. setdefaultr-r/r0addarc) rr6finishrsr4r<r.nfastater=r>rwstrrs @r rizParserGenerator.make_dfas %***&(+++  +75>623ED!LL#+==KE4("4)CD$1)"( !5 v ByyF*!"&&1BMM"% R'"6  r cDtd||g}t|D]\}}td|||uxrdxsd|jD]X\}}||vr|j|} nt |} |j ||td| zItd|| fzZy)NzDump of NFA for State(final)z -> %d %s -> %d)print enumerater.r2r*r0) rr9r6rztodor:r<r=r>js r dump_nfazParserGenerator.dump_nfas &w!$HAu )Q =I C D$zz t4< 4(AD AKK%=+/*.E1:56 *(r c td|t|D]n\}}td||jxrdxsdt|jj D]$\}}td||j |fz&py)NzDump of DFA forr~rrr)rrr3r-r.r/r2)rr9r;r:r<r=r>s r dump_dfazParserGenerator.dump_dfass &!#HAu )Q ;) Ar B%ejj&6&6&89 tnsyy'??@ :'r cd}|r`d}t|D]L\}}t|dzt|D],}||}||k(s||=|D]}|j||d}LN|r_yy)NTFr)rranger* unifystate)rr;changesr:state_irstate_jr<s r rjzParserGenerator.simplify_dfas{G'n 7qsCH-A!!fG')F%(E!,,Wg>&)"&.-r c|j\}}|jdk7r||fSt}t}|j||j||jdk(rU|j |j\}}|j||j||jdk(rU||fS)N|) parse_altrTruryr)rrkrlaazzs r rhzParserGenerator.parse_rhss~~1 :: a4KBB IIaL HHRL**# ~~'1 !  **# r6Mr ch|j\}}|jdvs,|jtjtj fvrb|j\}}|j ||}|jdvr5|jtjtj fvrb||fS)N)([) parse_itemrTrcrrQSTRINGry)rrkbr7ds r rzParserGenerator.parse_alt s 1zzZ'yyUZZ66??$DAq HHQKA zzZ'yyUZZ66!t r cz|jdk(rX|j|j\}}|jtj d|j |||fS|j\}}|j}|dvr||fS|j|j ||dk(r||fS||fS)Nr])+*r)rTrrhrfrrgry parse_atom)rrkrlrTs r rzParserGenerator.parse_items ::  MMO>>#DAq KK# & HHQKa4K??$DAqJJEJ&!t MMO HHQK|!t !t r c|jdk(rG|j|j\}}|jtj d||fS|j tjtjfvrDt}t}|j||j|j||fS|jd|j |jy)Nr)z+expected (...) or NAME or STRING, got %s/%s) rTrrhrfrrgrcrQrrury raise_error)rrkrls r rzParserGenerator.parse_atom(s ::  MMO>>#DAq KK# &a4K YY5::u||4 4 A A HHQ # MMOa4K   J!YY  4r c|j|k7s|8|j|k7r)|jd|||j|j|j}|j|S)Nzexpected %s/%s, got %s/%s)rcrTrr)rrcrTs r rfzParserGenerator.expect9sX 99 !2tzzU7J   8!5$))TZZ A   r c0t|j}|dtjtjfvr;t|j}|dtjtjfvr;|\|_|_|_|_|_ y)Nr#) r>rrCOMMENTNLrcrTbeginendline)rtups r rzParserGenerator.gettokenAsp4>>"!f))8;;77t~~&C!f))8;;77AD> 4:tz48TYr c |r ||z}t ||j |j d|j d|jf#dj|gttt|z}YnxYw)N r#r)joinr%mapstr SyntaxErrorrrr)rmsgargss r rzParserGenerator.raise_errorHsq  =Dj# txx{ $ TYY 89 9 =hhutCTN';;<s A.A7rV)rr r r!r?r5r1rrWrrirrrjrhrrrrfrrr r r rr s` 2,"\%$<!0"H7 A*"(4"E9r rceZdZdZddZy)rucg|_yrV)r.)rs r r!zNFAState.__init__Ss  r Nc|t|tsJt|tsJ|jj ||fyrV)rKrrur.r0rr>r=s r ryzNFAState.addarcVs<} 5# 666$))) %'r rV)rr r r!ryr r r ruruQs (r ruc(eZdZdZdZdZdZdZy)rvct|tsJttt|tsJt|tsJ||_||v|_i|_yrV)rKdictr>iterrurwr3r.)rrwfinals r r!zDFAState.__init__]sT&$'''$tF|,h777%***   r ct|tsJ||jvsJt|tsJ||j|<yrV)rKrr.rvrs r ryzDFAState.addarcesB%%%%DII%%%$))) %r cp|jjD]\}}||us ||j|<yrV)r.r/)roldnewr=r>s r rzDFAState.unifystateks099??,KE4s{#& % -r c6t|tsJ|j|jk7ryt|jt|jk7ry|jj D]$\}}||jj |us$yy)NFT)rKrvr3r*r.r/get)rotherr=r>s r __eq__zDFAState.__eq__psx%*** <<5== ( tyy>S_ ,99??,KE45::>>%00-r N)rr r r!ryrr__hash__r r r rvrv[s ' Hr rvc8t|}|jSrV)rr?)rps r generate_grammarrs!A >> r N)z Grammar.txt) rrrrGrammarrobjectrrurvrr r r rsJ '& '// E9fE9N (v(#v#Jr PKz1]l' ,pgen2/__pycache__/conv.cpython-312.opt-2.pycnu[ {|j%H ddlZddlmZmZGddejZy)N)grammartokenc&eZdZ dZdZdZdZy) Convertercj |j||j||jyN)parse_graminit_hparse_graminit_c finish_off)self graminit_h graminit_cs +/usr/lib64/python3.12/lib2to3/pgen2/conv.pyrunz Converter.run/s+J j) j) c  t|}i|_i|_d}|D]}|dz }t j d|}|s2|jr"t|d|d|jR|j\}}t|}||j|<||j|<y #t$r}td|d|Yd}~yd}~wwxYw) N Can't open : Frz^#define\s+(\w+)\s+(\d+)$(z): can't parse T) openOSErrorprint symbol2number number2symbolrematchstripgroupsint) r filenameferrlinenolinemosymbolnumbers rr zConverter.parse_graminit_h5s  XA D aKF6=B$**,(F26**,@A"$V.4""6*-3""6*'  37 8 s B11 C:CCc | t|}d}|dzt|}}|dzt|}}|dzt|}}i}g}|j dr|j drt j d|}ttt|j\} } } g} t| D]e} |dzt|}}t j d|}ttt|j\}}| j||fg|dzt|}}| || | f<|dzt|}}|j drt j d |}ttt|j\}}g}t|D]k} |dzt|}}t j d |}ttt|j\} } } || | f} |j| m|j||dzt|}}|dzt|}}|j dr||_ i}t j d |}t|jd}t|D]}|dzt|}}t j d |}|jd }ttt|jdddd\}}}}||}|dzt|}}t j d|}i}t|jd}t!|D]4\}}t#|}tdD]}|d|zzs d||dz|z<6||f||<|dzt|}}||_g}|dzt|}}t j d|}t|jd}t|D]l}|dzt|}}t j d|}|j\}}t|}|dk(rd}n t|}|j||fn|dzt|}}||_|dzt|}}|dzt|}}t j d|}t|jd}|dzt|}}|dzt|}}t j d|}t|jd}|dzt|}}t j d|}t|jd} | |_|dzt|}} |dzt|}}y#t$r}td|d|Yd}~yd}~wwxYw#t*$rYywxYw)NrrFrrz static arc z)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$z\s+{(\d+), (\d+)},$z'static state states_(\d+)\[(\d+)\] = {$z\s+{(\d+), arcs_(\d+)_(\d+)},$zstatic dfa dfas\[(\d+)\] = {$z0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$z\s+("(?:\\\d\d\d)*")},$z!static label labels\[(\d+)\] = {$z\s+{(\d+), (0|"\w+")},$0z \s+(\d+),$z\s+{(\d+), labels},$z \s+(\d+)$)rrrnext startswithrrlistmapr rrangeappendstatesgroupeval enumerateorddfaslabelsstart StopIteration)!r r!r"r#r$r%allarcsr6r&nmkarcs_ijststater;ndfasr'r(xyzfirst rawbitsetcbyter<nlabelsr=s! rr zConverter.parse_graminit_cTsU 6 XA axaaxaaxaoom,//-0XXJ"$s3 451aqA#)!8T!WDF"8$?BC 56DAqKKA' " &axa"&A%axa//-0 DdKBC-.DAqE1X%axaXX?Fs3 451aq!t} T" MM% !!8T!WDF!!8T!WDFCoom,D  XX6 =BHHQK uA!!8T!WDFM BXXa[F"3sBHHQ1a,@#ABOFAq!1IE!!8T!WDF4d;BERXXa[)I!),11vqAq!t})*acAg"- "5>DL-.axa axa XX:D Abhhqk"wA!!8T!WDF4d;B99;DAqAACxG MM1a& ! axa axaaxa XXmT *BHHQK axaaxa XX-t 4bhhqk"axa XXlD )BHHQK  axa %!!8T!WDFC  37 8 D   s) V7V/ V,V''V,/ V;:V;c i|_i|_t|jD]?\}\}}|tj k(r|||j|<.|1||j|<Ayr)keywordstokensr9r<rNAME)r ilabeltypevalues rr zConverter.finish_offsa?  %.t{{%; !FMT5uzz!e&7'- e$$* D! &c%J+rr)rpgen2rrGrammarrr]rrr`s&4 !]+]+rPKz1]KT7B7B0pgen2/__pycache__/tokenize.cpython-312.opt-2.pycnu[ {|jR  dZdZddlZddlZddlmZmZddlddlm Z e e Dcgc] }|ddk7s |c}gd zZ [ e d Zd Zd Zd ZdZdZeedezzeezZdZdZdZdZeddZeeeeeZdZeddeezZdezZeeeZededzZ ee eeZ!dZ"dZ#dZ$d Z%d!Z&ee&d"ze&d#zZ'ee&d$ze&d%zZ(ed&d'd(d)d*d+d,d-d. Z)d/Z*ed0d1d2Z+ee)e*e+Z,ee!e,e(eZ-ee-zZ.ee&d3zed4dze&d5zed6dzZ/edee'Z0eee0e!e,e/ezZ1e2ejfe.e1e$e%f\Z4Z5Z6Z7ed7d8d9d:ed7d8d;d<zhd=zZ8ejfe"ejfe#e6e7d>e8Dcic]}|d"e6 c}e8Dcic]}|d#e7 c}e8Dcic]}|dc}Z9d"d#he8Dchc]}|d" c}ze8Dchc]}|d# c}zZ:d4d6he8Dchc]}|d4 c}ze8Dchc]}|d6 c}zZ;d?Z<Gd@dAe=Z>GdBdCe=Z?dDZ@e@fdEZAdFZBGdGdHZCejfdIejZEejfdJejZFdKZGdLZHdMZIdNZJeKdOk(r\ddlLZLeMeLjdkDr&eAeOeLjdjyeAeLjjyycc}w#e $reZ YwxYwcc}wcc}wcc}wcc}wcc}wcc}wcc}w)PzKa-Ping Yee z@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip MontanaroN)BOM_UTF8lookup)*)token_)tokenizegenerate_tokens untokenizec0ddj|zdzS)N(|))joinchoicess //usr/lib64/python3.12/lib2to3/pgen2/tokenize.pygroupr0sC#((7"33c99ct|dzS)Nrrrs ranyr1s%/C//rct|dzS)N?rrs rmayber2sE7Oc11rc,tfdDS)Nc3K|]5}dzD]+}|j|jk7s%||z-7yw))N)casefold).0xyls r z _combinations..4s8!!e)Qqzz|qzz|/KA)qs.> >)set)r#s`r _combinationsr&3s  rz[ \f\t]*z #[^\r\n]*z\\\r?\nz\w+z0[bB]_?[01]+(?:_[01]+)*z(0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?z0[oO]?_?[0-7]+(?:_[0-7]+)*[lL]?z[1-9]\d*(?:_\d+)*[lL]?z0[lL]?z[eE][-+]?\d+(?:_\d+)*z\d+(?:_\d+)*\.(?:\d+(?:_\d+)*)?z\.\d+(?:_\d+)*z \d+(?:_\d+)*z\d+(?:_\d+)*[jJ]z[jJ]z[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'(?:[uUrRbBfF]|[rR][fFbB]|[fFbBuU][rR])?'''"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z<>z!=z//=?z->z[+\-*/%&@|^=<>]=?~z[][(){}]z\r?\nz:=z[:;.,`@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"rRfFbB>UuURUruRur)r*r+r'r(c eZdZy) TokenErrorN__name__ __module__ __qualname__rrr:r:rr:c eZdZy)StopTokenizingNr;r?rrrBrBr@rrBc `|\}}|\}}td||||t|t|fzy)Nz%d,%d-%d,%d: %s %s)printtok_namerepr) typerxxx_todo_changemexxx_todo_changeme1linesrowscolerowecols r printtokenrOs<$LT4%LT4 tT4$e= >?rc> t||y#t$rYywxYwN) tokenize_looprB)readline tokeneaters rr r s(  h +    s  c.t|D]}|| yrQ)r )rSrT token_infos rrRrRs%h/ J0rc$eZdZdZdZdZdZy) Untokenizerc.g|_d|_d|_y)Nrr)tokensprev_rowprev_col)selfs r__init__zUntokenizer.__init__s   rcn|\}}||jz }|r|jjd|zyy)N )r\rZappend)r]startrowcol col_offsets radd_whitespacezUntokenizer.add_whitespaces8S4==(  KK  sZ/ 0 rcf|D]}t|dk(r|j||np|\}}}}}|j||jj ||\|_|_|ttfvsw|xj dz c_d|_dj|jS)Nrrr) lencompatrfrZrar[r\NEWLINENLr)r]iterablettok_typerrbendrJs rr zUntokenizer.untokenizesA1v{ Ax(01 -HeUC    & KK  u %+. (DM4=GR=( " ! wwt{{##rcd}g}|jj}|\}}|ttfvr|dz }|tt fvrd}|D]}|dd\}}|ttt tfvr|dz }|tk(r|j|C|tk(r|j]|tt fvrd}n|r|r ||dd}||y)NFr`Trh) rZraNAMENUMBERrkrlASYNCAWAITINDENTDEDENTpop) r]rrm startlineindents toks_appendtoknumtokvaltoks rrjzUntokenizer.compats kk((  dF^ # cMF gr] "IC !WNFF$u55# v&6! GR=( wGBK(!  #rN)r<r=r>r^rfr rjr?rrrXrXs 1 $ rrXz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)c |ddjjdd}|dk(s|jdry|dvs|jdry|S) N r-utf-8zutf-8-)zlatin-1 iso-8859-1z iso-latin-1)zlatin-1-z iso-8859-1-z iso-latin-1-r)lowerreplace startswith)orig_encencs r_get_normal_namersY2 3B-    ' 'S 1C g~1 66 ~~AB Orc dd}d}fd}fd}|}|jtr d|dd}d}|s|gfS||}|r||gfStj|s||gfS|}|s||gfS||}|r|||gfS|||gfS)NFrcF S#t$r tcYSwxYwrQ) StopIterationbytes)rSsr read_or_stopz%detect_encoding..read_or_stops& :  7N s    c> |jd}tj|}|syt |j d} t |}r|jdk7r td|dz }|S#t$rYywxYw#t$rtd|zwxYw)Nasciirzunknown encoding: rzencoding problem: utf-8z-sig) decodeUnicodeDecodeError cookie_rematchrrr LookupError SyntaxErrorname)rJ line_stringrencodingcodec bom_founds r find_cookiez$detect_encoding..find_cookie s ++g.K ,#EKKN3 ?8$E zzW$!";<<  H#"   ?2X=> > ?sA5 B5 BBBTz utf-8-sig)rrblank_rer)rSrdefaultrrfirstsecondrs` @rdetect_encodingrs"IHG , NE ! ab  {5!H%  >>%  ^F 6"H%(( UFO ##rc: t}|j|SrQ)rXr )rmuts rr r :s" B == ""rc#x K dx}x}}d\}}d}dg}d}d} d} d} |} |dz}dt| }} |r| s tdj| }|r4|j dx} }t || d|z||f|| zfd\}}d}n|r0| dddk7r(| d dd k7r t || z|t| f|fd}d}|| z}|| z}|dk(r|s| snd}| |krA| | d k(r|dz}n(| | d k(r|tzdztz}n | | d k(rd}nn | dz} | |krA| |k(rn|r|d}| | dvr| | dk(r]| | djd}| t|z}t||| f|| t|zf| ft| |d||f|t| f| fn,ttf| | dk(| | d|| f|t| f| f||dkDr%|j|t| d| |df|| f| f||dkrC||vrtdd|| | f|dd}| r| |dk\rd} d} d} td|| f|| f| f||dkrC| r#| r!| |dk\rd} d} d} n| std|dfd}| |krtj| | }|rI|j!d\}}||f||f|} }}| ||| |}}|t"j$vs |dk(r|dk7rt&|||| fn|dvr)t(}|dkDrt}n| rd} |r|d}||||| fn|dk(r|r|d}t|||| fn|t*vrYt,|}|j| | }|r/|j d} | || }|r|d}t |||| f| fnu||f}| |d}| }no|t.vs|ddt.vs |ddt.vrR|ddk(r4||f}t,|xst,|dxs t,|d}| |dd}}| }n|r|d}t |||| fn|j1r|dvr| r|dk(rt2nt4|||| ft6|||| f}|dk(r|s|}|dvr=|r;|dt6k(r/|ddk(r'|dk(rd} |d} t2|d|d|d|dfd}|r|d}|nd|dk(r|r|d}t|||| f| fd}nE|d vr|dz}n |d!vr|dz }|r|d}t8|||| fnt | | || f|| dzf| f| dz} | |kr|r|d}|ddD]}td|df|dfdft:d|df|dfdfy#t$rd} YwxYww)"Nr)rrFrrzEOF in multi-line stringz\ z\ r`  z# #z rrz3unindent does not match any outer indentation levelz zEOF in multi-line statement.Trhr )asyncawaitr)defforr\z([{z)]})rrir:rrpSTRING ERRORTOKENtabsizerstripCOMMENTrlrarwIndentationErrorrx pseudoprogspanstringdigitsrtrk triple_quotedendprogs single_quoted isidentifierrurvrsOP ENDMARKER)rSlnumparenlev continuedcontstrneedcontcontliner{stashed async_defasync_def_indent async_def_nlrJposmaxstrstartendprogendmatchrpcolumn comment_tokennl_pos pseudomatchrbsposeposrinitialnewlinerindents rr r Os~#$#D#8iGXHcGGIL  :Daxc$iS  !;XFF}}T*H$LLO+cwds3$ho??$)!d23i61d23i86K!7T>#dCI%6BB!D.#d? ]9F)9#fqjV#Y$&&'/A2Ew1N#Y$&Ag ) cz5 CyG#9#$(J$5$5f$=M 3}#55F"M #;sS5G/G(H$PPtFG} &>D#d)+'"+.M! $ #$  !>q JJICi$**45K(--a0 s#'-$cCd!%eC$u+wfmm+sNu|!5$d;;&%G!|"$"'+ % "&"E4t<<^% "&"E4t<<m+&uoG&}}T37H&ll1o $U3"")M&*G%udT3KFF$(%="&uv,#' -"1I."1I.RyD($(%=#+G#4$6q8J$6#+E!H#5 ,0L!#'"")M&*G%udD$??))+ 22$,1W,<5%#($d#<<$dD9C'"% .#$+AJ$$6$+AJ'$9$~,0 3:2; 0#('!*#*1:wqz#*1:#//'+G% "&I_% "&udT3K>> !I%'HqL E)hl8% "&udD$77!49 #;s1u t==AgSCii ~ !"+rD!9tQi44 b4)dAY 33E D s<T:T(C:T: D T:J.T:17T:( T73T:6T77T:__main__)R __author__ __credits__rrecodecsrrlib2to3.pgen2.tokenrrdir__all__r NameErrorstrrrrr& WhitespaceCommentIgnoreName Binnumber Hexnumber Octnumber Decnumber IntnumberExponent PointfloatExpfloat Floatnumber ImagnumberNumberSingleDoubleSingle3Double3 _litprefixTripleStringOperatorBracketSpecialFunny PlainTokenTokenContStr PseudoExtras PseudoTokenmapcompile tokenprogr single3prog double3prog _strprefixesrrrr Exceptionr:rBrOr rRrXASCIIrrrrr r r<sysriargvopenrSstdin)r!prefixs00rrs#0* F #!%j 0jAaDCK1j 04, ,  :/1   c*z12 2U7^ C  & 7 . +X 6 )Y 9 = # 57H IERZO [ X %J) & g(= > z; 2 $ # 2 2 7 zE!:#5 6 z;;;; = GWeU%%   % - h) 65&$ /   ;;c:&';;c:&' (Z&1 5vugtLL 25JJ Wg638/ :{K#sC%#sC%&&' F#*"**V*<{ 99EFv&~{*F 9:FFv&~{*F 9+77,vt|,7  9 EN"./,xs^,/0"./,xs^,/0  #J ,- fxq\ -. ,- fxq\ -. !!%Y%? #- & 6 6 p BJJ@"(( K 2::0"(( ; G$R#*`4D z 388}q(4 #4#=#=> 399%% &Y 1  E\GF70/.-sF L#L#L( L6 L;( M= M M ) M= M(L32L3PKz1]x}iΖ-pgen2/__pycache__/token.cpython-312.opt-2.pycnu[ {|jx dZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;de?e@jD]\ZBZCeDeCeEseBe>eC<d>ZFd?ZGd@ZHyA)B  !"#$%&'()*+,-./0123456789:;<c|tkSN NT_OFFSETxs ,/usr/lib64/python3.12/lib2to3/pgen2/token.py ISTERMINALrGOs y=c|tk\SrArBrDs rF ISNONTERMINALrJR >rHc|tk(SrA) ENDMARKERrDs rFISEOFrNUrKrHN)IrMNAMENUMBERSTRINGNEWLINEINDENTDEDENTLPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENT BACKQUOTELBRACERBRACEEQEQUALNOTEQUAL LESSEQUAL GREATEREQUALTILDE CIRCUMFLEX LEFTSHIFT RIGHTSHIFT DOUBLESTAR PLUSEQUALMINEQUAL STAREQUAL SLASHEQUAL PERCENTEQUAL AMPEREQUAL VBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUAL DOUBLESLASHDOUBLESLASHEQUALATATEQUALOPCOMMENTNLRARROWAWAITASYNC ERRORTOKEN COLONEQUALN_TOKENSrCtok_namelistglobalsitems_name_value isinstanceintrGrJrNrHrFrs(                                                      ')//+,ME6&# - rHPKz1]3!!-pgen2/__pycache__/parse.cpython-312.opt-1.pycnu[ {|j@dZddlmZGddeZGddeZy)zParser engine for the grammar tables generated by pgen. The grammar table must be loaded first. See Parser/parser.c in the Python distribution for additional info on how this parsing engine works. )tokenceZdZdZdZdZy) ParseErrorz(Exception to signal the parser is stuck.c ~tj||d|d|d|||_||_||_||_y)Nz: type=z, value=z , context=) Exception__init__msgtypevaluecontext)selfr r r r s ,/usr/lib64/python3.12/lib2to3/pgen2/parse.pyrzParseError.__init__s<4ug"7 8   ctt||j|j|j|jffSN)r r r r )r s r __reduce__zParseError.__reduce__s*DzDHHdiiT\\JJJrN)__name__ __module__ __qualname____doc__rrrrrrs2Krrc>eZdZdZd dZd dZdZdZdZdZ d Z y) Parsera5Parser engine. The proper usage sequence is: p = Parser(grammar, [converter]) # create instance p.setup([start]) # prepare for parsing : if p.addtoken(...): # parse a token; may raise ParseError break root = p.rootnode # root of abstract syntax tree A Parser instance may be reused by calling setup() repeatedly. A Parser instance contains state pertaining to the current token sequence, and should not be used concurrently by different threads to parse separate token sequences. See driver.py for how to get input tokens by tokenizing a file or string. Parsing is complete when addtoken() returns True; the root of the abstract syntax tree can then be retrieved from the rootnode instance variable. When a syntax error occurs, addtoken() raises the ParseError exception. There is no error recovery; the parser cannot be used after a syntax error was reported (but it can be reinitialized by calling setup()). Nc*||_|xsd|_y)aConstructor. The grammar argument is a grammar.Grammar instance; see the grammar module for more information. The parser is not ready yet for parsing; you must call the setup() method to get it started. The optional convert argument is a function mapping concrete syntax tree nodes to abstract syntax tree nodes. If not given, no conversion is done and the syntax tree produced is the concrete syntax tree. If given, it must be a function of two arguments, the first being the grammar (a grammar.Grammar instance), and the second being the concrete syntax tree node to be converted. The syntax tree is converted from the bottom up. A concrete syntax tree node is a (type, value, context, nodes) tuple, where type is the node type (a token or symbol number), value is None for symbols and a string for tokens, context is None or an opaque value used for error reporting (typically a (lineno, offset) pair), and nodes is a list of children for symbols, and None for tokens. An abstract syntax tree node may be anything; this is entirely up to the converter function. c|Srr)grammarnodes rz!Parser.__init__..ZsrN)rconvert)r rrs rrzParser.__init__<s: >#= rc||jj}|ddgf}|jj|d|f}|g|_d|_t |_y)aPrepare for parsing. This *must* be called before starting to parse. The optional argument is an alternative start symbol; it defaults to the grammar's start symbol. You can use a Parser instance to parse any number of programs; each time you call setup() the parser is reset to an initial state determined by the (implicit or explicit) start symbol. N)rstartdfasstackrootnodeset used_names)r r"newnode stackentrys rsetupz Parser.setup\s\ =LL&&E$b)ll''.7;  \  %rc|j|||} |jd\}}}|\}} ||} | D]\} } |jj| \} }|| k(re|j ||| || }||d|fgk(rB|j |jsy|jd\}}}|\}} ||d|fgk(rBy| dk\s|jj | }|\}}||vs|j| |jj | | |n?d|f| vr*|j |jstd|||td|||B)z$E -QJ<7 #zz#'+/::b>(UD(+  !-QJ<7!#X!\\..q1F*0'Ix) !T\\%6%6q%98WM3 $6u:%HHJ::()9)-ug??%[$wGGSrc|tjk(rD|jj||jj j |}||S|jjj |}|td||||S)z&Turn a token into a label. (Internal)z bad token) rNAMEr'addrkeywordsgettokensr)r r r r r3s rr.zParser.classifysz 5::  OO   &\\**..u5F! $$((. >[$w? ? rc|jd\}}}|||df}|j|j|}||dj||||f|jd<y)zShift a token. (Internal)r,N)r$rrappend) r r r r:r r4r5rr(s rr0z Parser.shiftsb::b>UD.,,t||W5   HOOG $x. 2rc|jd\}}}|d|gf}|||f|jd<|jj|d|fy)zPush a nonterminal. (Internal)r,Nr!)r$rH) r r newdfar:r r4r5rr(s rr2z Parser.pushsQ::b>UDw+x. 2 61g./rc*|jj\}}}|j|j|}|W|jr(|jd\}}}|dj |y||_|j |j _yy)zPop a nonterminal. (Internal)Nr,)r$r1rrrHr%r')r popdfapopstatepopnoder(r4r5rs rr1z Parser.popsz$(JJNN$4!',,t||W5  zz#'::b> UDR( ' +/?? ( rr) rrrrrr*r@r.r0r2r1rrrrrs-:?@ 0.H` /0 ;rrN)rrrrobjectrrrrrQs+ K Kn;Vn;rPKz1]D(pgen2/__pycache__/driver.cpython-312.pycnu[ {|jQdZdZddgZddlZddlZddlZddlZddlZddlm Z m Z m Z m Z m Z GddeZd Z dd Zd Zd Zd Zedk(rej,ee yy)zZParser driver. This provides a high-level interface to parse a file into a syntax tree. z#Guido van Rossum Driver load_grammarN)grammarparsetokentokenizepgenc<eZdZddZd dZd dZd dZd dZd dZy) rNcZ||_|tj}||_||_y)N)rlogging getLoggerloggerconvert)selfrrrs -/usr/lib64/python3.12/lib2to3/pgen2/driver.py__init__zDriver.__init__s* >&&(F  cftj|j|j}|j d}d}dx}x}x}x} } d} |D]H} | \}}}} } |||fk7r:||f|ks J||f|f|\} }|| kr| d| |z zz } | }d}||kr | | ||z } |}|t j t jfvr#| |z } | \}}|jdr|dz }d}|tjk(rtj|}|r/|jjdtj||| |j||| |fr*|r|jjd|j"Sd} | \}}|jdsB|dz }d}Ktj d||| |f) z4Parse a series of tokens and return the syntax tree.rrN z%s %r (prefix=%r)zStop.zincomplete input)rParserrrsetupr COMMENTNLendswithrOPopmaprdebugtok_nameaddtoken ParseErrorrootnode)rtokensrplinenocolumntypevaluestartend line_textprefix quintuples_linenos_columns r parse_tokenszDriver.parse_tokens&s LLt|| 4  1555u5u5sYI1: .D%Y(('50KFF3CU2KK0%*"(H$dh&788F%FFH$ix88F%F(((++66%!$>>$'aKFFuxx}}U+ !!"5"'.."6vGzz$7KK%%g.zzF NFF~~d#! A F""#5#'A Arcdtj|j}|j||Sz*Parse a stream and return the syntax tree.)r generate_tokensreadliner1)rstreamrr$s rparse_stream_rawzDriver.parse_stream_rawVs)))&//:  //rc&|j||Sr3)r7)rr6rs r parse_streamzDriver.parse_stream[s$$VU33rctj|d|5}|j||cdddS#1swYyxYw)z(Parse a file and return the syntax tree.r)encodingN)ioopenr9)rfilenamer<rr6s r parse_filezDriver.parse_file_s0 WWXsX 6&$$VU37 6 6s5>ctjtj|j}|j ||S)z*Parse a string and return the syntax tree.)r r4r=StringIOr5r1)rtextrr$s r parse_stringzDriver.parse_stringds4))"++d*;*D*DE  //r)NN)F)NF) __name__ __module__ __qualname__rr1r7r9r@rDrrrrs!.`0 44 0rctjj|\}}|dk(rd}||zdjt t t jzdzS)Nz.txtr.z.pickle)ospathsplitextjoinmapstrsys version_info)gtheadtails r_generate_pickle_namerVjsP!!"%JD$ v~ $;#c3+;+;"<= = IIrc|tj}| t|n|}|s t||sQ|j d|t j |}|r&|j d| |j||S|Stj}|j||S#t$r}|j d|Yd}~|Sd}~wwxYw)z'Load the grammar (maybe from a pickle).Nz!Generating grammar tables from %szWriting grammar tables to %szWriting failed: %s) r rrV_newerinfor generate_grammardumpOSErrorrGrammarload)rSgpsaveforcerges rrrqs~""$&(j r "bB F2rN 7<  ! !" %  KK6 ; 5r H1H OO  r H  5 0!44 H  5s0B,, C5C  Cctjj|sytjj|sytjj|tjj|k\S)z0Inquire whether file a was written since file b.FT)rKrLexistsgetmtime)abs rrXrXsQ 77>>!  77>>!  77  A "''"2"21"5 55rc tjj|r t|St tjj |}t j||}tj}|j||S)aNormally, loads a pickled grammar by doing pkgutil.get_data(package, pickled_grammar) where *pickled_grammar* is computed from *grammar_source* by adding the Python version and using a ``.pickle`` extension. However, if *grammar_source* is an extant file, load_grammar(grammar_source) is called instead. This facilitates using a packaged grammar file when needed but preserves load_grammar's automatic regeneration behavior when possible. ) rKrLisfilerrVbasenamepkgutilget_datarr]loads)packagegrammar_source pickled_namedatarbs rload_packaged_grammarrssf ww~~n%N++()9)9.)IJL   G\ 2DAGGDM Hrc|stjdd}tjtjtj d|D]}t |ddy)zMain program, when run as a script: produce grammar pickle files. Calls load_grammar for each argument, a path to a grammar text file. rNz %(message)s)levelr6formatT)r`ra)rQargvr basicConfigINFOstdoutr)argsrSs rmainr|sL xx| gll3::,.Rd$/ r__main__)z Grammar.txtNTFN)__doc__ __author____all__r=rKr rlrQrrrrr r objectrrVrrXrsr|rEexitintrHrrrs 3 ^ $  43J0VJ0ZJ'+04 *6 (  z CHHSTV_rPKz1]Vf辳0pgen2/__pycache__/__init__.cpython-312.opt-1.pycnu[ {|jdZy)zThe pgen2 package.N)__doc__//usr/lib64/python3.12/lib2to3/pgen2/__init__.pyrs rPKz1]Kf}0pgen2/__pycache__/__init__.cpython-312.opt-2.pycnu[ {|jy)Nr//usr/lib64/python3.12/lib2to3/pgen2/__init__.pyrs rPKz1]zZ9ejhe#ejhe$e7e8d?e9Dcic]}|d#e7 c}e9Dcic]}|d$e8 c}e9Dcic]}|dc}Z:d#d$he9Dchc]}|d# c}ze9Dchc]}|d$ c}zZ;d5d7he9Dchc]}|d5 c}ze9Dchc]}|d7 c}zZZ?GdCdDe>Z@dEZAeAfdFZBdGZCGdHdIZDejhdJejZFejhdKejZGdLZHdMZIdNZJdOZKeLdPk(r\ddlMZMeNeMjdkDr&eBePeMjdjyeBeMjjyycc}w#e$reZ YwxYwcc}wcc}wcc}wcc}wcc}wcc}wcc}w)QaTokenization help for Python programs. generate_tokens(readline) is a generator that breaks a stream of text into Python tokens. It accepts a readline-like method which is called repeatedly to get the next line of input (or "" for EOF). It generates 5-tuples with these members: the token type (see token.py) the token (a string) the starting (row, column) indices of the token (a 2-tuple of ints) the ending (row, column) indices of the token (a 2-tuple of ints) the original line (string) It is designed to match the working of the Python tokenizer exactly, except that it produces COMMENT tokens for comments and gives type OP for all operators Older entry points tokenize_loop(readline, tokeneater) tokenize(readline, tokeneater=printtoken) are the same, except instead of generating tokens, tokeneater is a callback function to which the 5 fields described above are passed as 5 arguments, each time a new token is found.zKa-Ping Yee z@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip MontanaroN)BOM_UTF8lookup)*)token_)tokenizegenerate_tokens untokenizec0ddj|zdzS)N(|))joinchoicess //usr/lib64/python3.12/lib2to3/pgen2/tokenize.pygroupr0sC#((7"33c99ct|dzS)Nrrrs ranyr1s%/C//rct|dzS)N?rrs rmayber2sE7Oc11rc,tfdDS)Nc3K|]5}dzD]+}|j|jk7s%||z-7yw))N)casefold).0xyls r z _combinations..4s8!!e)Qqzz|qzz|/KA)qs.> >)set)r#s`r _combinationsr&3s  rz[ \f\t]*z #[^\r\n]*z\\\r?\nz\w+z0[bB]_?[01]+(?:_[01]+)*z(0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?z0[oO]?_?[0-7]+(?:_[0-7]+)*[lL]?z[1-9]\d*(?:_\d+)*[lL]?z0[lL]?z[eE][-+]?\d+(?:_\d+)*z\d+(?:_\d+)*\.(?:\d+(?:_\d+)*)?z\.\d+(?:_\d+)*z \d+(?:_\d+)*z\d+(?:_\d+)*[jJ]z[jJ]z[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'(?:[uUrRbBfF]|[rR][fFbB]|[fFbBuU][rR])?'''"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z<>z!=z//=?z->z[+\-*/%&@|^=<>]=?~z[][(){}]z\r?\nz:=z[:;.,`@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"rRfFbB>UuURUruRur)r*r+r'r(c eZdZy) TokenErrorN__name__ __module__ __qualname__rrr:r:rr:c eZdZy)StopTokenizingNr;r?rrrBrBr@rrBc `|\}}|\}}td||||t|t|fzy)Nz%d,%d-%d,%d: %s %s)printtok_namerepr) typerxxx_todo_changemexxx_todo_changeme1linesrowscolerowecols r printtokenrOs<$LT4%LT4 tT4$e= >?rc< t||y#t$rYywxYw)a: The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. The second parameter, tokeneater, must also be a callable object. It is called once for each token, with five arguments, corresponding to the tuples generated by generate_tokens(). N) tokenize_looprB)readline tokeneaters rr r s# h +    s  c.t|D]}|| yN)r )rRrS token_infos rrQrQs%h/ J0rc$eZdZdZdZdZdZy) Untokenizerc.g|_d|_d|_y)Nrr)tokensprev_rowprev_col)selfs r__init__zUntokenizer.__init__s   rc|\}}||jksJ||jz }|r|jjd|zyy)N )r[r\rZappend)r]startrowcol col_offsets radd_whitespacezUntokenizer.add_whitespacesJSdmm###4==(  KK  sZ/ 0 rcf|D]}t|dk(r|j||np|\}}}}}|j||jj ||\|_|_|ttfvsw|xj dz c_d|_dj|jS)Nrrr) lencompatrfrZrar[r\NEWLINENLr)r]iterablettok_typerrbendrJs rr zUntokenizer.untokenizesA1v{ Ax(01 -HeUC    & KK  u %+. (DM4=GR=( " ! wwt{{##rcd}g}|jj}|\}}|ttfvr|dz }|tt fvrd}|D]}|dd\}}|ttt tfvr|dz }|tk(r|j|C|tk(r|j]|tt fvrd}n|r|r ||dd}||y)NFr`Trh) rZraNAMENUMBERrkrlASYNCAWAITINDENTDEDENTpop) r]rrm startlineindents toks_appendtoknumtokvaltoks rrjzUntokenizer.compats kk((  dF^ # cMF gr] "IC !WNFF$u55# v&6! GR=( wGBK(!  #rN)r<r=r>r^rfr rjr?rrrXrXs 1 $ rrXz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)c|ddjjdd}|dk(s|jdry|dvs|jdry |S) z(Imitates get_normal_name in tokenizer.c.N r-utf-8zutf-8-)zlatin-1 iso-8859-1z iso-latin-1)zlatin-1-z iso-8859-1-z iso-latin-1-r)lowerreplace startswith)orig_encencs r_get_normal_namersX 3B-    ' 'S 1C g~1 66 ~~AB Orcdd}d}fd}fd}|}|jtr d|dd}d}|s|gfS||}|r||gfStj|s||gfS|}|s||gfS||}|r|||gfS|||gfS) a The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. FNrcF S#t$r tcYSwxYwrU) StopIterationbytes)rRsr read_or_stopz%detect_encoding..read_or_stops& :  7N s    c> |jd}tj|}|syt |j d} t |}r|jdk7r td|dz }|S#t$rYywxYw#t$rtd|zwxYw)Nasciirzunknown encoding: rzencoding problem: utf-8z-sig) decodeUnicodeDecodeError cookie_rematchrrr LookupError SyntaxErrorname)rJ line_stringrencodingcodec bom_founds r find_cookiez$detect_encoding..find_cookie s ++g.K ,#EKKN3 ?8$E zzW$!";<<  H#"   ?2X=> > ?sA5 B5 BBBTz utf-8-sig)rrblank_rer)rRrdefaultrrfirstsecondrs` @rdetect_encodingrs$IHG , NE ! ab  {5!H%  >>%  ^F 6"H%(( UFO ##rc8t}|j|S)aTransform tokens back into Python source code. Each element returned by the iterable must be a token sequence with at least two elements, a token number and token value. If only two tokens are passed, the resulting output is poor. Round-trip invariant for full input: Untokenized source will match input source exactly Round-trip invariant for limited input: # Output text will tokenize the back to the input t1 = [tok[:2] for tok in generate_tokens(f.readline)] newcode = untokenize(t1) readline = iter(newcode.splitlines(1)).next t2 = [tok[:2] for tokin generate_tokens(readline)] assert t1 == t2 )rXr )rmuts rr r :s$ B == ""rc# Kdx}x}}d\}}d}dg}d}d} d} d} |} |dz}dt| }} |r| s tdj| }|r4|j dx} }t || d|z||f|| zfd\}}d}n|r0| ddd k7r(| d dd k7r t || z|t| f|fd}d}|| z}|| z}|dk(r|s| sn/d}| |krA| | d k(r|dz}n(| | d k(r|tzdztz}n | | dk(rd}nn | dz} | |krA| |k(rn|r|d}| | dvr| | dk(r]| | djd}| t|z}t||| f|| t|zf| ft| |d||f|t| f| fn,ttf| | dk(| | d|| f|t| f| f||dkDr%|j|t| d| |df|| f| f||dkrC||vrtdd|| | f|dd}| r| |dk\rd} d} d} td|| f|| f| f||dkrC| r#| r!| |dk\rd} d} d} n| std|dfd}| |krtj| | }|r]|j!d\}}||f||f|} }}| ||| |}}|t"j$vs |dk(r|dk7rt&|||| fn&|dvr)t(}|dkDrt}n| rd} |r|d}||||| fn|dk(r+|j*drJ|r|d}t|||| fn|t,vrYt.|}|j| | }|r/|j d} | || }|r|d}t |||| f| fnu||f}| |d}| }no|t0vs|ddt0vs |ddt0vrR|ddk(r4||f}t.|xst.|dxs t.|d}| |dd}}| }n|r|d}t |||| fn|j3r|dvr| r|dk(rt4nt6|||| ft8|||| f}|dk(r|s|}|dvr=|r;|dt8k(r/|ddk(r'|dk(rd} |d} t4|d|d|d|dfd}|r|d}|nd|d k(r|r|d}t|||| f| fd}nE|d!vr|dz}n |d"vr|dz }|r|d}t:|||| fnt | | || f|| dzf| f| dz} | |kr|r|d}|ddD]}td|df|dfdft<d|df|dfdfy#t$rd} Y%wxYww)#a4 The generate_tokens() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. Alternately, readline can be a callable function terminating with StopIteration: readline = open(myfile).next # Example of alternate readline The generator produces 5-tuples with these members: the token type; the token string; a 2-tuple (srow, scol) of ints specifying the row and column where the token begins in the source; a 2-tuple (erow, ecol) of ints specifying the row and column where the token ends in the source; and the line on which the token was found. The line passed is the physical line. r)rrNFrrzEOF in multi-line stringz\ z\ r`  z# #z rrz3unindent does not match any outer indentation levelz zEOF in multi-line statement.T rhr)asyncawaitr)defforr\z([{z)]})rrir:rrpSTRING ERRORTOKENtabsizerstripCOMMENTrlrarwIndentationErrorrx pseudoprogspanstringdigitsrtrkendswith triple_quotedendprogs single_quoted isidentifierrurvrsOP ENDMARKER)rRlnumparenlev continuedcontstrneedcontcontliner{stashed async_defasync_def_indent async_def_nlrJposmaxstrstartendprogendmatchrpcolumn comment_tokennl_pos pseudomatchrbsposeposrinitialnewlinerindents rr r Os #$#D#8iGXHcGGIL  :Daxc$iS  !;XFF}}T*H$LLO+cwds3$ho??$)!d23i61d23i86K!7T>#dCI%6BB!D.#d? ]9F)9#fqjV#Y$&&'/A2Ew1N#Y$&Ag ) cz5 CyG#9#$(J$5$5f$=M 3}#55F"M #;sS5G/G(H$PPtFG} &>D#d)+'"+.M! $ #$  !>q JJICi$**45K(--a0 s#'-$cCd!%eC$u+wfmm+sNu|!5$d;;&%G!|"$"'+ % "&"E4t<<^-u~~d333% "&"E4t<<m+&uoG&}}T37H&ll1o $U3"")M&*G%udT3KFF$(%="&uv,#' -"1I."1I.RyD($(%=#+G#4$6q8J$6#+E!H#5 ,0L!#'"")M&*G%udD$??))+ 22$,1W,<5%#($d#<<$dD9C'"% .#$+AJ$$6$+AJ'$9$~,0 3:2; 0#('!*#*1:wqz#*1:#//'+G% "&I_% "&udT3K>> !I%'HqL E)hl8% "&udD$77!49 #;s1u t==AgSCii ~ !"+rD!9tQi44 b4)dAY 33E D s<U T;C:U D U KU 7U ; U U  U  U __main__)S__doc__ __author__ __credits__rrecodecsrrlib2to3.pgen2.tokenrrdir__all__r NameErrorstrrrrr& WhitespaceCommentIgnoreName Binnumber Hexnumber Octnumber Decnumber IntnumberExponent PointfloatExpfloat Floatnumber ImagnumberNumberSingleDoubleSingle3Double3 _litprefixTripleStringOperatorBracketSpecialFunny PlainTokenTokenContStr PseudoExtras PseudoTokenmapcompile tokenprogr single3prog double3prog _strprefixesrrrr Exceptionr:rBrOr rQrXASCIIrrrrr r r<sysriargvopenrRstdin)r!prefixs00rrs#0* F #!%j 0jAaDCK1j 04, ,  :/1   c*z12 2U7^ C  & 7 . +X 6 )Y 9 = # 57H IERZO [ X %J) & g(= > z; 2 $ # 2 2 7 zE!:#5 6 z;;;; = GWeU%%   % - h) 65&$ /   ;;c:&';;c:&' (Z&1 5vugtLL 25JJ Wg638/ :{K#sC%#sC%&&' F#*"**V*<{ 99EFv&~{*F 9:FFv&~{*F 9+77,vt|,7  9 EN"./,xs^,/0"./,xs^,/0  #J ,- fxq\ -. ,- fxq\ -. !!%Y%? #- & 6 6 p BJJ@"(( K 2::0"(( ; G$R#*`4D z 388}q(4 #4#=#=> 399%% &Y 1  E\GF70/.-sF L$L$L) L7 L<) M> M M * M> M)L43L4PKz1]e1.pgen2/__pycache__/driver.cpython-312.opt-2.pycnu[ {|jQ dZddgZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z Gdde ZdZ dd Zd Zd Zd Zed k(rej*ee yy)z#Guido van Rossum Driver load_grammarN)grammarparsetokentokenizepgenc<eZdZddZd dZd dZd dZd dZd dZy) rNcZ||_|tj}||_||_yN)rlogging getLoggerloggerconvert)selfrrrs -/usr/lib64/python3.12/lib2to3/pgen2/driver.py__init__zDriver.__init__s* >&&(F  cD tj|j|j}|j d}d}dx}x}x}x} } d} |D]6} | \}}}} } |||fk7r(|\} }|| kr| d| |z zz } | }d}||kr | | ||z } |}|t j t jfvr#| |z } | \}}|jdr|dz }d}|tjk(rtj|}|r/|jjdtj||| |j||| |fr*|r|jjd|j"Sd} | \}}|jds0|dz }d}9tj d||| |f)Nrr z%s %r (prefix=%r)zStop.zincomplete input)rParserrrsetupr COMMENTNLendswithrOPopmaprdebugtok_nameaddtoken ParseErrorrootnode)rtokensr plinenocolumntypevaluestartend line_textprefix quintuples_linenos_columns r parse_tokenszDriver.parse_tokens&sB LLt|| 4  1555u5u5sYI1: .D%Y((%*"(H$dh&788F%FFH$ix88F%F(((++66%!$>>$'aKFFuxx}}U+ !!"5"'.."6vGzz$7KK%%g.zzF NFF~~d#! A F""#5#'A Arcf tj|j}|j||Sr )r generate_tokensreadliner2)rstreamr r%s rparse_stream_rawzDriver.parse_stream_rawVs,8))&//:  //rc( |j||Sr )r7)rr6r s r parse_streamzDriver.parse_stream[s8$$VU33rc tj|d|5}|j||cdddS#1swYyxYw)Nr)encoding)ioopenr9)rfilenamer<r r6s r parse_filezDriver.parse_file_s36 WWXsX 6&$$VU37 6 6s6?c tjtj|j}|j ||Sr )r r4r=StringIOr5r2)rtextr r%s r parse_stringzDriver.parse_stringds78))"++d*;*D*DE  //r)NN)F)NF) __name__ __module__ __qualname__rr2r7r9r@rDrrrrs!.`0 44 0rctjj|\}}|dk(rd}||zdjt t t jzdzS)Nz.txtr.z.pickle)ospathsplitextjoinmapstrsys version_info)gtheadtails r_generate_pickle_namerVjsP!!"%JD$ v~ $;#c3+;+;"<= = IIrc |tj}| t|n|}|s t||sQ|j d|t j |}|r&|j d| |j||S|Stj}|j||S#t$r}|j d|Yd}~|Sd}~wwxYw)Nz!Generating grammar tables from %szWriting grammar tables to %szWriting failed: %s) rrrV_newerinfor generate_grammardumpOSErrorrGrammarload)rSgpsaveforcerges rrrqs1 ~""$&(j r "bB F2rN 7<  ! !" %  KK6 ; 5r H1H OO  r H  5 0!44 H  5s1B-- C6CCc tjj|sytjj|sytjj|tjj|k\S)NFT)rKrLexistsgetmtime)abs rrXrXsT: 77>>!  77>>!  77  A "''"2"21"5 55rc" tjj|r t|St tjj |}t j||}tj}|j||Sr ) rKrLisfilerrVbasenamepkgutilget_datarr]loads)packagegrammar_source pickled_namedatarbs rload_packaged_grammarrssk  ww~~n%N++()9)9.)IJL   G\ 2DAGGDM Hrc |stjdd}tjtjtj d|D]}t |ddy)Nrz %(message)s)levelr6formatT)r`ra)rQargvr basicConfigINFOstdoutr)argsrSs rmainr|sQ xx| gll3::,.Rd$/ r__main__)z Grammar.txtNTFN) __author____all__r=rKrrlrQrrrrr r objectrrVrrXrsr|rEexitintrHrrrs 3 ^ $  43J0VJ0ZJ'+04 *6 (  z CHHSTV_rPKz1]3oBTT0pgen2/__pycache__/literals.cpython-312.opt-1.pycnu[ {|jc VdZddlZddddddd d d d d ZdZdZdZedk(reyy)zADHI I TE2A q6M  VD! A q6M TADHIt S T  VCdJKQU U Vs" B: B-B*-Cc|d}|dd|dzk(r|dz}|t|t| }tjdt|S)Nrz)\\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3}))rresubr))sqs r( evalStringr0(sQ !A!u!| aC #a&#a&A 66> JJctdD]7}t|}t|}t|}||k7s*t ||||9y)N)ranger!reprr0print)r'cr.es r(testr92s@ 3Z F G qM 6 !Q1  r1__main__)__doc__r,rr)r0r9__name__r1r(r>sWC  *K zFr1PKz1]C --&pgen2/__pycache__/conv.cpython-312.pycnu[ {|j%JdZddlZddlmZmZGddej Zy)aConvert graminit.[ch] spit out by pgen to Python code. Pgen is the Python parser generator. It is useful to quickly create a parser from a grammar file in Python's grammar notation. But I don't want my parsers to be written in C (yet), so I'm translating the parsing tables to Python data structures and writing a Python parse engine. Note that the token numbers are constants determined by the standard Python tokenizer. The standard token module defines these numbers and their names (the names are not used much). The token numbers are hardcoded into the Python tokenizer and into pgen. A Python implementation of the Python tokenizer is also available, in the standard tokenize module. On the other hand, symbol numbers (representing the grammar's non-terminals) are assigned by pgen based on the actual grammar input. Note: this module is pretty much obsolete; the pgen module generates equivalent grammar tables directly from the Grammar.txt input file without having to invoke the Python pgen C program. N)grammartokenc(eZdZdZdZdZdZdZy) Convertera2Grammar subclass that reads classic pgen output files. The run() method reads the tables as produced by the pgen parser generator, typically contained in two C files, graminit.h and graminit.c. The other methods are for internal use only. See the base class for more documentation. ch|j||j||jy)z_[] = { {, }, ... }; - followed by a state array, of the form: static state states_[] = { {, arcs__}, ... }; rrNFrrz#include "pgenheaders.h" z#include "grammar.h" z static arc z)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$z\s+{(\d+), (\d+)},$z}; z'static state states_(\d+)\[(\d+)\] = {$z\s+{(\d+), arcs_(\d+)_(\d+)},$zstatic dfa dfas\[(\d+)\] = {$z0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$z\s+("(?:\\\d\d\d)*")},$z!static label labels\[(\d+)\] = {$z\s+{(\d+), (0|"\w+")},$0zgrammar _PyParser_Grammar = { z \s+(\d+),$z dfas, z\s+{(\d+), labels},$z \s+(\d+)$)rrrnext startswithrrlistmaprrrangeappendlenstatesgrouprreval enumerateorddfaslabelsstart StopIteration)!r r r!r"r#r$allarcsr6r%nmkarcs_ijststater;ndfasr&r'xyzfirst rawbitsetcbyter<nlabelsr=s! rr zConverter.parse_graminit_cTs8 XA axa33Cfd^C3axa//?&$?/axaoom,//-0XXJ"$)FD>)rs3 451aqA#)!8T!WDF"8$?B-~-2C 56DAqKKA' " &axav~5~5~"&A%axa//-0 DdKB %~ %2C-.DAqF # 3fd^ 3#E1X%axaXX?F)FD>)rs3 451aq!t}CI~5~5~ T" MM% !!8T!WDF6> 1FD> 1>!!8T!WDFCoom,D  XX6 =!FD>!rBHHQK uA!!8T!WDFM B %~ %2XXa[F"3sBHHQ1a,@#ABOFAq!%%f-7 G&$ G7%%f-7 G&$ G76 )FD> )61IEE ? 2VTN 2?!!8T!WDF4d;B %~ %2ERXXa[)I!),11vqAq!t})*acAg"- "5>DL-.axav~-~-~ axa XX:D A!FD>!rbhhqk"wA!!8T!WDF4d;B %~ %299;DAqAACxG MM1a& ! axav~-~-~ axa88H64.H8axa XXmT *!FD>!rBHHQK DII&&&axa{"2VTN2"axa XX-t 4!FD>!rbhhqk"#dkk**:VTN:*axa XXlD )!FD>!rBHHQK ***:VTN:* axav~-~-~ %!!8T!WDF %vtn $1K  37 8 D   s) ]0^0 ^9^^ ^#"^#ci|_i|_t|jD]?\}\}}|tj k(r|||j|<.|1||j|<Ay)z1Create additional useful structures. (Internal).N)keywordstokensr9r<rNAME)r ilabeltypevalues rr zConverter.finish_offs^  %.t{{%; !FMT5uzz!e&7'- e$$* D! &c%J+rr)r]rpgen2rrGrammarrr^rrras&4 !]+]+rPKz1](Jf5E5E,pgen2/__pycache__/pgen.cpython-312.opt-1.pycnu[ {|j6ddlmZmZmZGddejZGddeZGddeZGdd eZ d d Z y ) )grammartokentokenizec eZdZy) PgenGrammarN)__name__ __module__ __qualname__+/usr/lib64/python3.12/lib2to3/pgen2/pgen.pyrrsr rc|eZdZddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZddZdZdZy)ParserGeneratorNc<d}|t|d}|j}||_||_t j |j |_|j|j\|_ |_ ||i|_ |jy)Nzutf-8)encoding)openclosefilenamestreamrgenerate_tokensreadline generatorgettokenparsedfas startsymbolfirst addfirstsets)selfrr close_streams r __init__zParserGenerator.__init__ s >(W5F!<==KKCIIe$4 56 d#  HHOOF #-3T__Q5M,NAFF1??4( )//$"2"23r cv|j|}i}t|D]}|j||}d||<|SNr)rr-r1)rr7r9rawfirstrr=ilabels r r5zParserGenerator.make_first4sD::d#H%E__Q.FE&M& r ct|j}|djr||jvrX||jvr|j|S|jj |j|df||j|<|St t|d}||jvr|j|S|jj |df||j|<|St|}|djrY||jvr|j|S|jj tj|f||j|<|Stj|}||jvr|j|S|jj |df||j|<|SNr#)r*labelsisalphar+ symbol2labelr0getattrrtokensevalkeywordsNAMEropmap)rr7r=rCitokenvalues r r1zParserGenerator.make_label=sQXX 8   'ANN*>>%00HHOOQ__U%;T$BC,2ANN5)!M!t4QXX%88F++HHOOVTN3'-AHHV$!MKEQx!AJJ&::e,,HHOOUZZ$78(.AJJu%!M!u-QXX%88F++HHOOVTN3'-AHHV$!Mr ct|jj}|j|D]"}||jvs|j |$yN)r%rr&r'r calcfirst)rr8r9s r rzParserGenerator.addfirstsetsksBTYY^^%& D4::%t$r c 8|j|}d|j|<|d}i}i}|jjD]\}}||jvrd||jvr|j|}|.t d|z|j ||j|}|j ||||<xd||<|di||<i} |jD]/\}} | D]%} | | vrt d|d| d|d| | || | <'1||j|<y)Nr#zrecursion for rule %rrzrule z is ambiguous; z is in the first sets of z as well as )rrr.r/ ValueErrorrSupdate) rr9r;r<totalset overlapcheckr=r>fsetinverseitsfirstsymbols r rSzParserGenerator.calcfirstss;iio 4A  ::++-KE4 !DJJ&::e,D|()@4)GHHNN5)::e,D%&* U#"#',aj U#.+113OE8"W$$&*FE76?&LMM#( # 4$ 4r ci}d}|jtjk7r|jtjk(r.|j |jtjk(r.|j tj }|j tjd|j\}}|j tj|j||}t|}|j|t|}|||<||}|jtjk7r||fS)N:) typer ENDMARKERNEWLINErexpectrMOP parse_rhsmake_dfar* simplify_dfa) rrrr9azr;oldlennewlens r rzParserGenerator.parses ii5??*))u}}, ))u}},;;uzz*D KK# &>>#DAq KK &--1%CXF   c "XFDJ"" #ii5??*$[  r c  fd} fd t|||g}|D]}i}|jD]2}|jD]!\}} |  | |j|i#4t |j D]L\}} |D]} | j| k(snt| |} |j | |j| |N|S)Nci}|||SrRr )r<base addclosures r closurez)ParserGenerator.make_dfa..closuresD ud #Kr cZ||vryd||<|jD]\}}| ||yrAr.)r<rmr=r>rns r rnz,ParserGenerator.make_dfa..addclosures7}DK$zz t=tT* *r )DFAStatenfasetr. setdefaultr-r/r0addarc) rr6finishror4r<r.nfastater=r>rsstrns @r rezParserGenerator.make_dfas  +75>623ED!LL#+==KE4("4)CD$1)"( !5 v ByyF*!"&&1BMM"% R'"6  r cDtd||g}t|D]\}}td|||uxrdxsd|jD]X\}}||vr|j|} nt |} |j ||td| zItd|| fzZy)NzDump of NFA for State(final)z -> %d %s -> %d)print enumerater.r2r*r0) rr9r6rvtodor:r<r=r>js r dump_nfazParserGenerator.dump_nfas &w!$HAu )Q =I C D$zz t4< 4(AD AKK%=+/*.E1:56 *(r c td|t|D]n\}}td||jxrdxsdt|jj D]$\}}td||j |fz&py)NzDump of DFA forrzr{r|r})r~rr3r-r.r/r2)rr9r;r:r<r=r>s r dump_dfazParserGenerator.dump_dfass &!#HAu )Q ;) Ar B%ejj&6&6&89 tnsyy'??@ :'r cd}|r`d}t|D]L\}}t|dzt|D],}||}||k(s||=|D]}|j||d}LN|r_yy)NTFr)rranger* unifystate)rr;changesr:state_irstate_jr<s r rfzParserGenerator.simplify_dfas{G'n 7qsCH-A!!fG')F%(E!,,Wg>&)"&.-r c|j\}}|jdk7r||fSt}t}|j||j||jdk(rU|j |j\}}|j||j||jdk(rU||fS)N|) parse_altrPNFAStaterur)rrgrhaazzs r rdzParserGenerator.parse_rhss~~1 :: a4KBB IIaL HHRL**# ~~'1 !  **# r6Mr ch|j\}}|jdvs,|jtjtj fvrb|j\}}|j ||}|jdvr5|jtjtj fvrb||fS)N)([) parse_itemrPr_rrMSTRINGru)rrgbr7ds r rzParserGenerator.parse_alt s 1zzZ'yyUZZ66??$DAq HHQKA zzZ'yyUZZ66!t r cz|jdk(rX|j|j\}}|jtj d|j |||fS|j\}}|j}|dvr||fS|j|j ||dk(r||fS||fS)Nr])+*r)rPrrdrbrrcru parse_atom)rrgrhrPs r rzParserGenerator.parse_items ::  MMO>>#DAq KK# & HHQKa4K??$DAqJJEJ&!t MMO HHQK|!t !t r c|jdk(rG|j|j\}}|jtj d||fS|j tjtjfvrDt}t}|j||j|j||fS|jd|j |jy)Nr)z+expected (...) or NAME or STRING, got %s/%s) rPrrdrbrrcr_rMrrru raise_error)rrgrhs r rzParserGenerator.parse_atom(s ::  MMO>>#DAq KK# &a4K YY5::u||4 4 A A HHQ # MMOa4K   J!YY  4r c|j|k7s|8|j|k7r)|jd|||j|j|j}|j|S)Nzexpected %s/%s, got %s/%s)r_rPrr)rr_rPs r rbzParserGenerator.expect9sX 99 !2tzzU7J   8!5$))TZZ A   r c0t|j}|dtjtjfvr;t|j}|dtjtjfvr;|\|_|_|_|_|_ yrE) r>rrCOMMENTNLr_rPbeginendline)rtups r rzParserGenerator.gettokenAsp4>>"!f))8;;77t~~&C!f))8;;77AD> 4:tz48TYr c |r ||z}t ||j |j d|j d|jf#dj|gttt|z}YnxYw)N r#r)joinr%mapstr SyntaxErrorrrr)rmsgargss r rzParserGenerator.raise_errorHsq  =Dj# txx{ $ TYY 89 9 =hhutCTN';;<s A.A7rR)rr r r!r?r5r1rrSrrerrrfrdrrrrbrrr r r rr s` 2,"\%$<!0"H7 A*"(4"E9r rceZdZdZddZy)rcg|_yrRrq)rs r r!zNFAState.__init__Ss  r Nc>|jj||fyrR)r.r0rr>r=s r ruzNFAState.addarcVs %'r rR)rr r r!rur r r rrQs (r rc(eZdZdZdZdZdZdZy)rrc2||_||v|_i|_yrR)rsr3r.)rrsfinals r r!zDFAState.__init__]s   r c"||j|<yrRrqrs r ruzDFAState.addarces  %r cp|jjD]\}}||us ||j|<yrR)r.r/)roldnewr=r>s r rzDFAState.unifystateks099??,KE4s{#& % -r c|j|jk7ryt|jt|jk7ry|jjD]$\}}||jj |us$yy)NFT)r3r*r.r/get)rotherr=r>s r __eq__zDFAState.__eq__psj <<5== ( tyy>S_ ,99??,KE45::>>%00-r N)rr r r!rurr__hash__r r r rrrr[s ' Hr rrc8t|}|jSrR)rr?)rps r generate_grammarrs!A >> r N)z Grammar.txt) r|rrrGrammarrobjectrrrrrr r r rsJ '& '// E9fE9N (v(#v#Jr PKz1]]A! ! *pgen2/__pycache__/literals.cpython-312.pycnu[ {|jc VdZddlZddddddd d d d d ZdZdZdZedk(reyy)z>$     T "C   sQR u:>ADHI I TE2A q6M  VD! A q6M TADHIt S T  VCdJKQU U Vs5 B$ C$B=Cc|jds$|jdsJt|dd|d}|dd|dzk(r|dz}|j|sJt|t| dt|dt|zk\sJ|t|t| }t j dt |S)Nr r rrrz)\\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3}))rreprendswithrresubr))sqs r( evalStringr2(s <<  S 1>4"1;> 1 !A!u!| aC ::a=+$q#a&{++= q6Qs1vX   #a&#a&A 66> JJctdD]7}t|}t|}t|}||k7s*t ||||9y)N)ranger!r,r2print)r'cr0es r(testr:2s@ 3Z F G qM 6 !Q1  r3__main__)__doc__r.rr)r2r:__name__r3r(r?sWC  *K zFr3PKz1](Jf5E5E,pgen2/__pycache__/pgen.cpython-312.opt-2.pycnu[ {|j6ddlmZmZmZGddejZGddeZGddeZGdd eZ d d Z y ) )grammartokentokenizec eZdZy) PgenGrammarN)__name__ __module__ __qualname__+/usr/lib64/python3.12/lib2to3/pgen2/pgen.pyrrsr rc|eZdZddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZddZdZdZy)ParserGeneratorNc<d}|t|d}|j}||_||_t j |j |_|j|j\|_ |_ ||i|_ |jy)Nzutf-8)encoding)openclosefilenamestreamrgenerate_tokensreadline generatorgettokenparsedfas startsymbolfirst addfirstsets)selfrr close_streams r __init__zParserGenerator.__init__ s >(W5F!<==KKCIIe$4 56 d#  HHOOF #-3T__Q5M,NAFF1??4( )//$"2"23r cv|j|}i}t|D]}|j||}d||<|SNr)rr-r1)rr7r9rawfirstrr=ilabels r r5zParserGenerator.make_first4sD::d#H%E__Q.FE&M& r ct|j}|djr||jvrX||jvr|j|S|jj |j|df||j|<|St t|d}||jvr|j|S|jj |df||j|<|St|}|djrY||jvr|j|S|jj tj|f||j|<|Stj|}||jvr|j|S|jj |df||j|<|SNr#)r*labelsisalphar+ symbol2labelr0getattrrtokensevalkeywordsNAMEropmap)rr7r=rCitokenvalues r r1zParserGenerator.make_label=sQXX 8   'ANN*>>%00HHOOQ__U%;T$BC,2ANN5)!M!t4QXX%88F++HHOOVTN3'-AHHV$!MKEQx!AJJ&::e,,HHOOUZZ$78(.AJJu%!M!u-QXX%88F++HHOOVTN3'-AHHV$!Mr ct|jj}|j|D]"}||jvs|j |$yN)r%rr&r'r calcfirst)rr8r9s r rzParserGenerator.addfirstsetsksBTYY^^%& D4::%t$r c 8|j|}d|j|<|d}i}i}|jjD]\}}||jvrd||jvr|j|}|.t d|z|j ||j|}|j ||||<xd||<|di||<i} |jD]/\}} | D]%} | | vrt d|d| d|d| | || | <'1||j|<y)Nr#zrecursion for rule %rrzrule z is ambiguous; z is in the first sets of z as well as )rrr.r/ ValueErrorrSupdate) rr9r;r<totalset overlapcheckr=r>fsetinverseitsfirstsymbols r rSzParserGenerator.calcfirstss;iio 4A  ::++-KE4 !DJJ&::e,D|()@4)GHHNN5)::e,D%&* U#"#',aj U#.+113OE8"W$$&*FE76?&LMM#( # 4$ 4r ci}d}|jtjk7r|jtjk(r.|j |jtjk(r.|j tj }|j tjd|j\}}|j tj|j||}t|}|j|t|}|||<||}|jtjk7r||fS)N:) typer ENDMARKERNEWLINErexpectrMOP parse_rhsmake_dfar* simplify_dfa) rrrr9azr;oldlennewlens r rzParserGenerator.parses ii5??*))u}}, ))u}},;;uzz*D KK# &>>#DAq KK &--1%CXF   c "XFDJ"" #ii5??*$[  r c  fd} fd t|||g}|D]}i}|jD]2}|jD]!\}} |  | |j|i#4t |j D]L\}} |D]} | j| k(snt| |} |j | |j| |N|S)Nci}|||SrRr )r<base addclosures r closurez)ParserGenerator.make_dfa..closuresD ud #Kr cZ||vryd||<|jD]\}}| ||yrAr.)r<rmr=r>rns r rnz,ParserGenerator.make_dfa..addclosures7}DK$zz t=tT* *r )DFAStatenfasetr. setdefaultr-r/r0addarc) rr6finishror4r<r.nfastater=r>rsstrns @r rezParserGenerator.make_dfas  +75>623ED!LL#+==KE4("4)CD$1)"( !5 v ByyF*!"&&1BMM"% R'"6  r cDtd||g}t|D]\}}td|||uxrdxsd|jD]X\}}||vr|j|} nt |} |j ||td| zItd|| fzZy)NzDump of NFA for State(final)z -> %d %s -> %d)print enumerater.r2r*r0) rr9r6rvtodor:r<r=r>js r dump_nfazParserGenerator.dump_nfas &w!$HAu )Q =I C D$zz t4< 4(AD AKK%=+/*.E1:56 *(r c td|t|D]n\}}td||jxrdxsdt|jj D]$\}}td||j |fz&py)NzDump of DFA forrzr{r|r})r~rr3r-r.r/r2)rr9r;r:r<r=r>s r dump_dfazParserGenerator.dump_dfass &!#HAu )Q ;) Ar B%ejj&6&6&89 tnsyy'??@ :'r cd}|r`d}t|D]L\}}t|dzt|D],}||}||k(s||=|D]}|j||d}LN|r_yy)NTFr)rranger* unifystate)rr;changesr:state_irstate_jr<s r rfzParserGenerator.simplify_dfas{G'n 7qsCH-A!!fG')F%(E!,,Wg>&)"&.-r c|j\}}|jdk7r||fSt}t}|j||j||jdk(rU|j |j\}}|j||j||jdk(rU||fS)N|) parse_altrPNFAStaterur)rrgrhaazzs r rdzParserGenerator.parse_rhss~~1 :: a4KBB IIaL HHRL**# ~~'1 !  **# r6Mr ch|j\}}|jdvs,|jtjtj fvrb|j\}}|j ||}|jdvr5|jtjtj fvrb||fS)N)([) parse_itemrPr_rrMSTRINGru)rrgbr7ds r rzParserGenerator.parse_alt s 1zzZ'yyUZZ66??$DAq HHQKA zzZ'yyUZZ66!t r cz|jdk(rX|j|j\}}|jtj d|j |||fS|j\}}|j}|dvr||fS|j|j ||dk(r||fS||fS)Nr])+*r)rPrrdrbrrcru parse_atom)rrgrhrPs r rzParserGenerator.parse_items ::  MMO>>#DAq KK# & HHQKa4K??$DAqJJEJ&!t MMO HHQK|!t !t r c|jdk(rG|j|j\}}|jtj d||fS|j tjtjfvrDt}t}|j||j|j||fS|jd|j |jy)Nr)z+expected (...) or NAME or STRING, got %s/%s) rPrrdrbrrcr_rMrrru raise_error)rrgrhs r rzParserGenerator.parse_atom(s ::  MMO>>#DAq KK# &a4K YY5::u||4 4 A A HHQ # MMOa4K   J!YY  4r c|j|k7s|8|j|k7r)|jd|||j|j|j}|j|S)Nzexpected %s/%s, got %s/%s)r_rPrr)rr_rPs r rbzParserGenerator.expect9sX 99 !2tzzU7J   8!5$))TZZ A   r c0t|j}|dtjtjfvr;t|j}|dtjtjfvr;|\|_|_|_|_|_ yrE) r>rrCOMMENTNLr_rPbeginendline)rtups r rzParserGenerator.gettokenAsp4>>"!f))8;;77t~~&C!f))8;;77AD> 4:tz48TYr c |r ||z}t ||j |j d|j d|jf#dj|gttt|z}YnxYw)N r#r)joinr%mapstr SyntaxErrorrrr)rmsgargss r rzParserGenerator.raise_errorHsq  =Dj# txx{ $ TYY 89 9 =hhutCTN';;<s A.A7rR)rr r r!r?r5r1rrSrrerrrfrdrrrrbrrr r r rr s` 2,"\%$<!0"H7 A*"(4"E9r rceZdZdZddZy)rcg|_yrRrq)rs r r!zNFAState.__init__Ss  r Nc>|jj||fyrR)r.r0rr>r=s r ruzNFAState.addarcVs %'r rR)rr r r!rur r r rrQs (r rc(eZdZdZdZdZdZdZy)rrc2||_||v|_i|_yrR)rsr3r.)rrsfinals r r!zDFAState.__init__]s   r c"||j|<yrRrqrs r ruzDFAState.addarces  %r cp|jjD]\}}||us ||j|<yrR)r.r/)roldnewr=r>s r rzDFAState.unifystateks099??,KE4s{#& % -r c|j|jk7ryt|jt|jk7ry|jjD]$\}}||jj |us$yy)NFT)r3r*r.r/get)rotherr=r>s r __eq__zDFAState.__eq__psj <<5== ( tyy>S_ ,99??,KE45::>>%00-r N)rr r r!rurr__hash__r r r rrrr[s ' Hr rrc8t|}|jSrR)rr?)rps r generate_grammarrs!A >> r N)z Grammar.txt) r|rrrGrammarrobjectrrrrrr r r rsJ '& '// E9fE9N (v(#v#Jr PKz1]I00/pgen2/__pycache__/grammar.cpython-312.opt-2.pycnu[ {|j ddlZddlmZGddeZdZiZejD]$Zesej\Z Z e ee ee <&[[ [ y)N)tokenc2eZdZ dZdZdZdZdZdZy)Grammarci|_i|_g|_i|_dg|_i|_i|_i|_d|_y)N)rEMPTY) symbol2number number2symbolstatesdfaslabelskeywordstokens symbol2labelstart)selfs ./usr/lib64/python3.12/lib2to3/pgen2/grammar.py__init__zGrammar.__init__LsF  #n    c t|d5}tj|j|tjdddy#1swYyxYw)Nwb)openpickledump__dict__HIGHEST_PROTOCOL)rfilenamefs rrz Grammar.dumpWs77 (D !Q KK q&*A*A B" ! !s 0AAc t|d5}tj|}ddd|jj y#1swY%xYw)Nrb)rrloadrupdate)rrrds rr"z Grammar.load\s>9 (D !Q AA" Q" !s AAcb |jjtj|y)N)rr#rloads)rpkls rr&z Grammar.loadsbs A V\\#./rc  |j}dD]'}t||t||j)|jdd|_|j dd|_|j |_|S)N)r r r rrr) __class__setattrgetattrcopyrr r)rnew dict_attrs rr,z Grammar.copyfsm nn4I CGD)$<$A$A$C D4[[^ [[^ JJ  rc` ddlm}td||jtd||jtd||jtd||j td||j td|jy) Nr)pprints2nn2sr r rr)r0printr r r r rr)rr0s rreportzGrammar.reportssyH! e t!!" e t!!" ht{{ f tyy ht{{ gtzz"rN) __name__ __module__ __qualname__rrr"r&r,r4rrrrs'3j C  0  #rra ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW := COLONEQUAL ) rrobjectr opmap_rawopmap splitlineslinesplitopnamer+r8rrrBsp j#fj#^1  f   "D ::<DE4(b  # "drPKG13]~!wsWsW&__pycache__/fixer_util.cpython-311.pycnu[ !A?hf;dZddlmZddlmZmZddlmZddl m Z dZ dZ dZ d Zd-d Zd Zd ZdZe e fdZd.dZdZdZd-dZdZd-dZd-dZdZdZdZdZdZhdZ dZ!da"da#d a$d!a%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,d)Z-ej.ej/hZ0d-d*Z1ej/ej.ej2hZ3d+Z4d-d,Z5d S)/z1Utility functions, node construction macros, etc.)token)LeafNode)python_symbols)patcompclttj|ttjd|gS)N=)rsymsargumentrrEQUAL)keywordvalues ?/opt/alt/python-internal/lib64/python3.11/lib2to3/fixer_util.py KeywordArgrs.  $u{C00%8 : ::c6ttjdS)N()rrLPARrrLParenr  C  rc6ttjdS)N))rrRPARrrrRParenrrrc t|ts|g}t|ts d|_|g}ttj|t tjddgz|zS)zBuild an assignment statement r prefix) isinstancelistrrr atomrrr )targetsources rAssignr%su fd # # fd # #   $u{C<<<==F H HHrNc:ttj||S)zReturn a NAME leafr)rrNAME)namers rNamer)$s  D 0 0 00rcV|ttjt|ggS)zA node tuple for obj.attr)rr trailerDot)objattrs rAttrr/(s! dlSUUDM22 33rc6ttjdS)z A comma leaf,)rrCOMMArrrCommar3,s  S ! !!rc6ttjdS)zA period (.) leaf.)rrDOTrrrr,r,0s  3  rcttj||g}|r.|dttj||S)z-A parenthesised argument list, used by Call()r)rr r+clone insert_childarglist)argslparenrparennodes rArgListr?4sW  v||~~v||~~> ? ?D 7 !T$,55666 Krcjttj|t|g}|||_|S)zA function call)rr powerr?r) func_namer;rr>s rCallrC;s0  Y 6 7 7D  Krc6ttjdS)zA newline literal rrNEWLINErrrNewlinerHBs  t $ $$rc6ttjdS)z A blank linerFrrr BlankLinerKFs  r " ""rc:ttj||S)Nr)rrNUMBER)nrs rNumberrOJs  a / / //rc ttjttjd|ttjdgS)zA numeric or string subscript[])rr r+rrLBRACERBRACE) index_nodes r SubscriptrVMs=  tEL#66)#EL#668 9 99rc:ttj||S)z A string leafr)rrSTRING)stringrs rStringrZSs  fV 4 4 44rc pd|_d|_d|_ttjd}d|_ttjd}d|_||||g}|rWd|_ttjd}d|_|t t j||gt t j|t t j |g}t t j ttj d|ttj dgS)zuA list comprehension of the form [xp for fp in it if test]. If test is None, the "if test" part is omitted. rJrforinifrQrR) rrrr'appendrr comp_if listmakercomp_forr"rSrT) xpfpittestfor_leafin_leaf inner_argsif_leafinners rListComprlWs BIBIBIEJ&&HHO5:t$$GGNB,J ? uz4(($t|gt_==>>> "d4=*&E&E!F G GE  U\3//U\3//1 2 22rc@|D]}|ttjdttj|dttjddt t j|g}t t j|}|S)zO Return an import statement in the form: from package import name_leafsfromrrimport)removerrr'rr import_as_names import_from) package_name name_leafsleafchildrenimps r FromImportrxos UZ((UZc:::UZ#666T):668H t * *C Jrc l|d}|jtjkr|}n-t tj|g}|d}|r d|D}t tjt t|dt|dt tj|d||dggz|z}|j |_ |S)zfReturns an import statement and calls a method of the module: import module module.name()r-afterc6g|]}|Sr)r8).0rNs r z!ImportAndCall..s ***q***rrlparrpar) r8typer r:rrAr/r)r+r)r>resultsnamesr- newarglistrznews r ImportAndCallrs %.   C x4<YY[[ $, 66 G E +**E*** tzDqNNDqNN33T\fo++-- fo++--/001149 9 : :C CJ Jrct|tr'|jtt gkrdSt|tot |jdkot|jdt okt|jdtoKt|jdt o+|jdjdko|jdjdkS)z(Does the node represent a tuple literal?Tr~rrr)r rrvrrlenrrr>s ris_tuplers$$-FHHfhh3G"G"Gt tT " " .DM""a' .4=+T22 .4=+T22 .4=+T22  .  a &#-  .  a &#- /rc4t|tot|jdkokt|jdtoKt|jdto+|jdjdko|jdjdkS)z'Does the node represent a list literal?rr~rQrR)r rrrvrrrs ris_listrs tT " " /DM""Q& /4=+T22 /4=,d33 / a &#-  /  b!'3. 0rclttjt|t gSN)rr r"rrrs r parenthesizers#  FHHdFHH5 6 66r> allanymaxminsetsumr!tuplesorted enumeratec#^Kt||}|r|Vt||}|dSdS)alFollow an attribute chain. If you have a chain of objects where a.foo -> b, b.foo-> c, etc, use this to iterate over all objects in the chain. Iteration is terminated by getattr(x, attr) is None. Args: obj: the starting object attr: the name of the chaining attribute Yields: Each successive object in the chain. N)getattr)r-r.nexts r attr_chainrsU 3  D # tT"" #####rzefor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > z power< ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | 'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) ) trailer< '(' node=any ')' > any* > z` power< ( 'sorted' | 'enumerate' ) trailer< '(' arglist ')' > any* > FchtsMtjtatjtatjt adattt g}t |t|dD]*\}}i}|||r |d|urdS+dS)a Returns true if node is in an environment where all that is required of it is being iterable (ie, it doesn't matter if it returns a list or an iterator). See test_map_nochange in test_fixers.py for some examples and tests. Tparentr>F) pats_builtrcompile_patternp0p1p2ziprmatch)r>patternspatternrrs rin_special_contextrs   $R ( (  $R ( (  $R ( ( B|HxD()C)CDD == ) ) gfo.E.E44 5rc|j}||jtjkrdS|j}|jt jt jfvrdS|jt jkr|j d|urdS|jt j ks;|jt j kr(||jtj ks|j d|urdSdS)zG Check that something isn't an attribute or function name etc. NFr~T) prev_siblingrrr6rr funcdefclassdef expr_stmtrv parameters typedargslistr2)r>prevrs ris_probably_builtinrs  D DI22u [F {t|T]333u {dn$$);t)C)Cu {do%% [D. . .  $)u{":": OA $ & &u 4rc|_|jtjkrAt|jdkr)|jd}|jt jkr|jS|j}|_dS)zFind the indentation of *node*.NrrrJ) rr suiterrvrINDENTrr)r>indents rfind_indentationrsd   9 " "s4='9'9A'='=]1%F{el**|#{   2rc|jtjkr|S|}|jdc}|_t tj|g}||_|Sr)rr rr8rr)r>rrs r make_suitersR yDJ ::<bindings rdoes_tree_importr/s' 44'::G ==rc@|jtjtjfvS)z0Returns true if the node is an import statement.)rr import_namerrrs r is_importr7s 9)4+;< <.is_import_stmt>s4 T--,$-,$-*++ -rNr~rrorr)rrrrvrr rrrXrrrr'rxrHr9) rr(r>rroot insert_posoffsetidxnode2import_rvs r touch_importr;s--- T??Dt,,Jt}-- T~d##  &t}STT':;;  MFE!>%((  6\  Q"4=11  IC T---$--}Q$ 44 1W t' X & & T# . . .*    WtEJS'I'I'I&JKK#Hj$t'7"B"BCCCCCrc P|jD]}d}|jtjkrNt ||jdr|cSt |t |jd|}|r|}n|jtjtjfvr/t |t |jd|}|r|}nK|jtj krt |t |jd|}|r|}nt|jddD]U\}}|jtj kr;|j dkr0t |t |j|dz|}|r|}Vn|jtvr|jdj |kr|}nmt|||r|}nY|jtjkrt |||}n2|jtjkrt ||jdr|}|r|s|cSt%|r|cSdS) z Returns the node which binds variable name, otherwise None. If optional argument package is supplied, only imports will be returned. See test cases for examples.Nrrrr:r~)rvrr for_stmt_findrrif_stmt while_stmttry_stmtrrCOLONr _def_syms_is_import_bindingrrr)r(r>rchildretrNikids rrris3 "" : & &T5>!,--  T:enR.@#A#A7KKAM# ZDL$/: : :T:enR.@#A#A7KKAM# Z4= ( (T:enQ.?#@#@'JJA &'qrr(:;;&&FAsx5;..393C3C(z%.1:M/N/NPWXX Ac & Z9 $ $):)@D)H)HCC tW 5 5 CC Z4+ + +tUG44CC Z4> ) )T5>!,--     ~~  4rc|g}|rl|}|jdkr)|jtvr||jn"|jt jkr |j|kr|S|ldS)N)popr _block_symsextendrvrr'r)r(r>nodess rrrs} FE yy{{ 9s??ty ;; LL ' ' ' ' Y%* $ $t););K  4rc.|jtjkr|s|jd}|jtjkr`|jD]V}|jtjkr|jdj|kr|cS2|jtjkr|j|kr|cSWn{|jtjkr1|jd}|jtjkr |j|kr|Sn5|jtjkr |j|kr|Sn|jtj kr|r2t|jd |krdS|jd}|rtd|rdS|jtj krt||r|S|jtjkr0|jd}|jtjkr |j|kr|Sn;|jtjkr |j|kr|S|r|jtjkr|SdS)z Will return node if node will import name, or node will import * from package. None is returned otherwise. See test cases for examples. rrrNras)rr rrvdotted_as_namesdotted_as_namerrr'rrstrstriprrqimport_as_nameSTAR)r>r(rrwrlastrNs rrrs   yD$$$W$mA 8t+ + +  :!444~a(.$66# 7Z5:--%+2E2EKKK  X, , ,<#DyEJ&&4:+=+= X # # T(9(9K d& & &  s4=+,,2244??4 M!   uT1~~ 4 Vt+ + +dA +K Vt* * *JqMEzUZ''EK4,?,? Vuz ! !agooK  5:--K 4rr)NN)6__doc__pgen2rpytreerrpygramrr rJrrrrr%r)r/r3r,r?rCrHrKrOrVrZrlrxrrrrconsuming_callsrrrrrrrrrrrrrrrrrr+rrrrrrrs77******:::!!!!!! H H H1111444"""    &&((%%%###0000999 555522220&8 / / /000777...###&  &.===*D*D*DZ]DL ) ((((T|T]DL9 ''''''rPKG13]d(__pycache__/pytree.cpython-311.opt-1.pycnu[ !A?hFmdZdZddlZddlmZdZiadZGddeZ Gd d e Z Gd d e Z d Z GddeZ Gdde ZGdde ZGdde ZGdde ZdZdS)z Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here. z#Guido van Rossum N)StringIOictsGddlm}|jD]'\}}t |t kr |t|<(t||S)N)python_symbols) _type_reprspygramr__dict__itemstypeint setdefault)type_numrnamevals ;/opt/alt/python-internal/lib64/python3.11/lib2to3/pytree.py type_reprrsq 9******(06688 9 9ID#CyyCDS!1  ! !(H 5 55ceZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZedZedZdZdZdZejdkrdZdSdS)Basez Abstract base class for Node and Leaf. This provides some default functionality and boilerplate using the template pattern. A node may be a subnode of at most one parent. NFc6t|S)z7Constructor that prevents Base from being instantiated.object__new__clsargskwdss rrz Base.__new__1~~c"""rcV|j|jurtS||S)zW Compare two nodes for equality. This calls the method _eq(). ) __class__NotImplemented_eqselfothers r__eq__z Base.__eq__6s) > 0 0! !xxrct)a_ Compare two nodes for equality. This is called by __eq__ and __ne__. It is only called if the two nodes have the same type. This must be implemented by the concrete subclass. Nodes should be considered equal if they have the same structure, ignoring the prefix string and other context information. NotImplementedErrorr$s rr#zBase._eqBs "!rct)zr Return a cloned (deep) copy of self. This must be implemented by the concrete subclass. r)r%s rclonez Base.cloneM "!rct)zx Return a post-order iterator for the tree. This must be implemented by the concrete subclass. r)r,s r post_orderzBase.post_orderUr.rct)zw Return a pre-order iterator for the tree. This must be implemented by the concrete subclass. r)r,s r pre_orderzBase.pre_order]r.rc<t|ts|g}g}d}|jjD]5}||ur|||d} ||6|j||j_|D]}|j|_d|_dS)z/Replace this node with a new one in the parent.FNT) isinstancelistparentchildrenextendappendchanged)r%new l_childrenfoundchxs rreplacez Base.replacees#t$$ %C +& & &BTzz?%%c***!!"%%%% )  # #A{AHH rc|}t|ts+|jsdS|jd}t|t+|jS)z9Return the line number which generated the invocant node.Nr)r4Leafr7linenor%nodes r get_linenozBase.get_lineno|sRT4(( $= =#DT4(( ${rcT|jr|jd|_dS)NT)r6r: was_changedr,s rr:z Base.changeds. ; " K   ! ! !rc|jrTt|jjD]<\}}||ur1|j|jj|=d|_|cS;dSdS)z Remove the node from the tree. Returns the position of the node in its parent's children before it was removed. N)r6 enumerater7r:)r%irEs rremovez Base.removes ; $T[%9::  44<<K''))) ,Q/"&DKHHH      rc|jdSt|jjD]3\}}||ur* |jj|dzcS#t$rYdSwxYw4dS)z The node immediately following the invocant in their parent's children list. If the invocant does not have a next sibling, it is None Nr)r6rJr7 IndexErrorr%rKchilds r next_siblingzBase.next_siblings ; 4"$+"677  HAu}} ;/!4444!   444   sA AAc|jdSt|jjD])\}}||ur |dkrdS|jj|dz cS*dS)z The node immediately preceding the invocant in their parent's children list. If the invocant does not have a previous sibling, it is None. Nrr)r6rJr7rOs r prev_siblingzBase.prev_siblingsu ; 4"$+"677 1 1HAu}}6644{+AaC0000 1 1rc#RK|jD]}|Ed{VdSN)r7leavesr%rPs rrVz Base.leavessD] & &E||~~ % % % % % % % % & &rcL|jdSd|jzS)Nrr)r6depthr,s rrYz Base.depths( ; 14;$$&&&&rc&|j}|dS|jS)z Return the string immediately following the invocant node. This is effectively equivalent to node.next_sibling.prefix N)rQprefix)r%next_sibs r get_suffixzBase.get_suffixs $  2rrcFt|dS)Nascii)strencoder,s r__str__z Base.__str__st99##G,, ,r)__name__ __module__ __qualname____doc__r r6r7rH was_checkedrr'__hash__r#r-r0r2r@rFr:rLpropertyrQrSrVrYr^sys version_inforerrrrrs` D FHKK### H " " """""""""".       X  1 1X 1&&&'''  &   - - - - -! rrceZdZdZ ddZdZdZejdkreZ dZ dZ d Z d Z ed Zejd Zd ZdZdZdS)Nodez+Concrete implementation for interior nodes.Nc||_t||_|jD] }||_ |||_|r|dd|_dSd|_dS)z Initializer. Takes a type constant (a symbol number >= 256), a sequence of child nodes, and an optional context keyword argument. As a side effect, the parent pointers of the children are updated. N)r r5r7r6r\fixers_applied)r%r r7contextr\rrr>s r__init__z Node.__init__sl X -  BBII   DK  '"0"3D   "&D   rcZ|jjdt|jd|jdSz)Return a canonical string representation.(, ))r!rfrr r7r,s r__repr__z Node.__repr__s6#~666(3333#}}}. .rc\dtt|jS)k Return a pretty string representation. This reproduces the input source exactly. r[)joinmaprcr7r,s r __unicode__zNode.__unicode__s" wws3 ..///rr_c>|j|jf|j|jfkSzCompare two nodes for equality.)r r7r$s rr#zNode._eqs 4=)ej%.-IIIrcXt|jd|jD|jS)$Return a cloned (deep) copy of self.c6g|]}|Sr)r-).0r>s r zNode.clone..s CCCr CCCrrr)rpr r7rrr,s rr-z Node.clones6DICCT]CCC#'#6888 8rc#ZK|jD]}|Ed{V|VdSz*Return a post-order iterator for the tree.N)r7r0rWs rr0zNode.post_ordersK] * *E'')) ) ) ) ) ) ) ) ) rc#ZK|V|jD]}|Ed{VdSz)Return a pre-order iterator for the tree.N)r7r2rWs rr2zNode.pre_order sO ] ) )E(( ( ( ( ( ( ( ( ( ) )rc8|jsdS|jdjS)zO The whitespace and comments preceding this node in the input. r[rr7r\r,s rr\z Node.prefixs# } 2}Q&&rc<|jr||jd_dSdSNrrr%r\s rr\z Node.prefixs+ = -&,DM!  # # # - -rct||_d|j|_||j|<|dS)z Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. N)r6r7r:rOs r set_childzNode.set_child s7  "& a  a rcr||_|j|||dS)z Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. N)r6r7insertr:rOs r insert_childzNode.insert_child*s4   Q&&& rcp||_|j||dS)z Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately. N)r6r7r9r:rWs r append_childzNode.append_child3s2   U### rNNN)rfrgrhrirtrzrrmrnrer#r-r0r2rlr\setterrrrrrrrprps55 $''''2... 000 &  JJJ888  ))) ''X' ]--]-rrpceZdZdZdZdZdZddgfdZdZdZ e j dkre Z d Z d Zd Zd Zd ZedZejdZdS)rBz'Concrete implementation for leaf nodes.r[rNc||\|_\|_|_||_||_|||_|dd|_dS)z Initializer. Takes a type constant (a token number < 256), a string value, and an optional context keyword argument. N)_prefixrCcolumnr valuerr)r%r rrsr\rrs rrtz Leaf.__init__FsQ  7> 4DL44;    !DL,QQQ/rc@|jjd|jd|jdSrv)r!rfr rr,s rrzz Leaf.__repr__Ys,#~666#yyy#zzz+ +rc:|jt|jzS)r|)r\rcrr,s rrzLeaf.__unicode___s {S__,,rr_c>|j|jf|j|jfkSr)r rr$s rr#zLeaf._eqjs 4:&5:u{*CCCrclt|j|j|j|j|jff|jS)rr)rBr rr\rCrrrr,s rr-z Leaf.clonens:DItz[4; "<=#'#6888 8rc#K|VdSrUrr,s rrVz Leaf.leavests rc#K|VdSrrr,s rr0zLeaf.post_orderw rc#K|VdSrrr,s rr2zLeaf.pre_order{rrc|jS)zP The whitespace and comments preceding this token in the input. )rr,s rr\z Leaf.prefixs |rc<|||_dSrU)r:rrs rr\z Leaf.prefixs  r)rfrgrhrirrCrrtrzrrmrnrer#r-rVr0r2rlr\rrrrrBrB=s11G F F "0000&+++ --- &  DDD888 X  ]]rrBc|\}}}}|s ||jvr-t|dkr|dSt|||St|||S)z Convert raw node information to a Node or Leaf instance. This is passed to the parser driver which calls it whenever a reduction of a grammar rule produces a new complete node, so that the tree is build strictly bottom-up. rr)rs) number2symbollenrprB)grraw_noder rrsr7s rconvertrsn&."D%(242+++ x==A  A; D(G4444D%1111rcFeZdZdZdZdZdZdZdZdZ d dZ d dZ dZ dS) BasePatterna A pattern is a tree matching pattern. It looks for a specific node type (token or symbol), and optionally for a specific content. This is an abstract base class. There are three concrete subclasses: - LeafPattern matches a single leaf node; - NodePattern matches a single node (usually non-leaf); - WildcardPattern matches a sequence of nodes of variable length. Nc6t|S)z>Constructor that prevents BasePattern from being instantiated.rrs rrzBasePattern.__new__rrct|j|j|jg}|r|d |d=|r|d |jjddtt|dS)Nrwrxry) rr contentrr!rfr}r~repr)r%rs rrzzBasePattern.__repr__sw$)$$dlDI> tBx'R tBx'>222DIIc$oo4N4N4N4NOOrc|S)z A subclass can define this as a hook for optimizations. Returns either self or another node with the same effect. rr,s roptimizezBasePattern.optimizes  rc|j|j|jkrdS|j5d}|i}|||sdS|r||||jr |||j<dS)a# Does this pattern exactly match a node? Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. Default implementation for non-wildcard patterns. NFT)r r _submatchupdater)r%rEresultsrs rmatchzBasePattern.matchs 9 TY$)%;%;5 < #A">>$** u "q!!!  49 !%GDI trcdt|dkrdS||d|S)z Does this pattern exactly match a sequence of nodes? Default implementation for non-wildcard patterns. rFr)rr)r%nodesrs r match_seqzBasePattern.match_seqs0 u::??5zz%(G,,,rc#^Ki}|r$||d|r d|fVdSdSdS)z} Generator yielding all matches for this pattern. Default implementation for non-wildcard patterns. rrN)r)r%rrs rgenerate_matcheszBasePattern.generate_matchessS   TZZa!,, Q$JJJJJ    rrU) rfrgrhrir rrrrzrrrrrrrrrs   DG D### PPP 2----rrc&eZdZddZddZddZdS) LeafPatternNc8||||_||_||_dS)ap Initializer. Takes optional type, content, and name. The type, if given must be a token type (< 256). If not given, this matches any *leaf* node; the content may still be required. The content, if given, must be a string. If a name is given, the matching node is stored in the results dict under that key. N)r rr)r%r rrs rrtzLeafPattern.__init__s)       rcht|tsdSt|||S)z*Override match() to insist on a leaf node.F)r4rBrrr%rErs rrzLeafPattern.match s1$%% 5  tW555rc"|j|jkS) Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. )rrrs rrzLeafPattern._submatchs|tz))rrrU)rfrgrhrtrrrrrrrsP(6666 * * * * * *rrc"eZdZdZddZddZdS) NodePatternFNc||@t|}t|D]!\}}t|trd|_"||_||_||_dS)ad Initializer. Takes optional type, content, and name. The type, if given, must be a symbol type (>= 256). If the type is None this matches *any* single node (leaf or not), except if content is not None, in which it only matches non-leaf nodes that also match the content pattern. The content, if not None, must be a sequence of Patterns that must match the node's children exactly. If the content is given, the type must not be None. If a name is given, the matching node is stored in the results dict under that key. NT)r5rJr4WildcardPattern wildcardsr rr)r%r rrrKitems rrtzNodePattern.__init__$si    7mmG$W-- * *4dO44*%)DN   rc|jrTt|j|jD]7\}}|t |jkr|||dS8dSt |jt |jkrdSt |j|jD]\}}|||sdSdS)rNTF)rrrr7rrzipr)r%rErcr subpatternrPs rrzNodePattern._submatchAs > (t}EE  1DM*****q)))44+5 t|  DM 2 2 2 25!$T\4=!A!A   J##E733 uu trrrU)rfrgrhrrtrrrrrr sAI:rrcPeZdZdZddedfdZdZd dZd dZdZ d Z d Z d Z dS) ra A wildcard pattern can match zero or more nodes. This has all the flexibility needed to implement patterns like: .* .+ .? .{m,n} (a b c | d e | f) (...)* (...)+ (...)? (...){m,n} except it always uses non-greedy matching. Nrc|'ttt|}|D]}||_||_||_||_dS)a Initializer. Args: content: optional sequence of subsequences of patterns; if absent, matches one node; if present, each subsequence is an alternative [*] min: optional minimum number of times to match, default 0 max: optional maximum number of times to match, default HUGE name: optional name assigned to this match [*] Thus, if content is [[a, b, c], [d, e], [f, g, h]] this is equivalent to (a b c | d e | f g h); if content is None, this is equivalent to '.' in regular expression terms. The min and max parameters work as follows: min=0, max=maxint: .* min=1, max=maxint: .+ min=0, max=1: .? min=1, max=1: . If content is not None, replace the dot with the parenthesized list of alternatives, e.g. (a b c | d e | f g h)* N)tupler~rminmaxr)r%rrrralts rrtzWildcardPattern.__init__ksT0  Cw//00G + +  rc<d}|jIt|jdkr1t|jddkr|jdd}|jdkrM|jdkrB|jt |jS|$|j|jkr|S|jdkrft|trQ|jdkrF|j|jkr6t|j|j|jz|j|jz|jS|S)z+Optimize certain stacked wildcard patterns.Nrr)r) rrrrrrrr4r)r%rs rrzWildcardPattern.optimizes L $    " "s4<?';';q'@'@a+J 8q==TX]]|#" 2222%49 +G+G!**,,, HMMj_EEM Na  DI$@$@":#5#'8JN#:#'8JN#:#-?44 4 rc0||g|S)z'Does this pattern exactly match a node?)rrs rrzWildcardPattern.matchs~~tfg...rc||D]P\}}|t|kr8|3|||jrt |||j<dSQdS)z4Does this pattern exactly match a sequence of nodes?NTF)rrrrr5)r%rrrrs rrzWildcardPattern.match_seqsy))%00  DAqCJJ&NN1%%%y9-1%[[ *tt  urc #.K|j^t|jdtt||jzD]#}i}|jr|d|||j<||fV$dS|jdkr||VdSttdr$tj }tt_ | |dD]$\}}|jr|d|||j<||fV%nJ#t$r=| |D]$\}}|jr|d|||j<||fV%YnwxYwttdr|t_ dSdS#ttdr |t_ wxYw)a" Generator yielding matches for a sequence of nodes. Args: nodes: sequence of nodes Yields: (count, results) tuples where: count: the match comprises nodes[:count]; results: dict containing named submatches. Nr bare_name getrefcountr)rrangerrrr_bare_name_matcheshasattrrmstderrr_recursive_matches RuntimeError_iterative_matches)r%rcountr save_stderrs rrz WildcardPattern.generate_matchess < txSUTX-F-F)FGG  91#(%=AdiLQh    Y+ % %))%00 0 0 0 0 0 sM** (!j %ZZ  - $ 7 7q A A##HE1y5',VeV}$) (NNNN#  # # #!% 7 7 > >##HE1y5',VeV}$) (NNNN## #3 ..-!,CJJJ--73 ..-!,CJ,,,,s+;DE1AE E1E  E11#Fc#Kt|}d|jkrdifVg}|jD]5}t||D]"\}}||fV|||f#6|rg}|D]\}} ||kr||jkr}|jD]u}t|||dD]Z\} } | dkrOi}|| || || z|fV||| z|f[v|}|dSdS)z(Helper to iteratively yield the matches.rN)rrrrr9rr) r%rnodelenrrrr new_resultsc0r0c1r1s rrz"WildcardPattern._iterative_matchesse** ==R%KKK< ' 'C(e44 ' '1d 1v&&&& '  "K! A AB<K||jkrdifV||jkr||jD]v}t||D]a\}}|||d|dzD]:\}}i}||||||z|fV;budSdS)z(Helper to recursively yield the matches.rNr)rrrrrr) r%rrrrrrrrs rrz"WildcardPattern._recursive_matches s DH  R%KKK 48  | ) ).sE::))FB"&"9"9%*eAg"N"N))B   2gqj(((( ))   ) )rrU) rfrgrhriHUGErtrrrrrrrrrrrr]s   $4!!!!F&////    +-+-+-Z""": ) ) ) ) )rrc(eZdZddZdZdZdZdS)NegatedPatternNc|||_dS)a Initializer. The argument is either a pattern or None. If it is None, this only matches an empty sequence (effectively '$' in regex lingo). If it is not None, this matches whenever the argument pattern doesn't have any matches. N)r)r%rs rrtzNegatedPattern.__init__s   rcdS)NFrrDs rrzNegatedPattern.match(surc(t|dkSr)r)r%rs rrzNegatedPattern.match_seq,s5zzQrc#K|jt|dkrdifVdSdS|j|D]\}}dSdifVdSr)rrr)r%rrrs rrzNegatedPattern.generate_matches0sr < 5zzQe  55e<<  1R%KKKKKrrU)rfrgrhrtrrrrrrrrsU         rrc#0K|sdifVdS|d|dd}}||D]a\}}|s||fVt|||dD]:\}}i}||||||z|fV;bdS)aR Generator yielding matches for a sequence of patterns and nodes. Args: patterns: a sequence of patterns nodes: a sequence of nodes Yields: (count, results) tuples where: count: the entire sequence of patterns matches nodes[:count]; results: dict containing named submatches. rrN)rr) patternsrprestrrrrrs rrr<s  %e 1+x|4((// % %FB %"f .tU233Z@@%%FBAHHRLLLHHRLLLr'1*$$$$ %  % %r)ri __author__rmiorrrrrrrprBrrrrrrrrrrrs3  666n-n-n-n-n-6n-n-n-`kkkkk4kkk\LLLLL4LLL\222&SSSSS&SSSl)*)*)*)*)*+)*)*)*X:::::+:::zy)y)y)y)y)ky)y)y)x     [   F%%%%%rPKG13]U0 &__pycache__/fixer_base.cpython-311.pycnu[ !A?h"ndZddlZddlmZddlmZddlmZGddeZ Gd d e Z dS) z2Base class for fixers (optional, but recommended).N)PatternCompiler)pygram)does_tree_importceZdZdZdZdZdZdZdZe j dZ e Z dZdZdZdZdZdZejZdZdZd Zd Zd Zdd ZdZddZdZdZ dZ!dS)BaseFixaOptional base class for fixers. The subclass name must be FixFooBar where FooBar is the result of removing underscores and capitalizing the words of the fix name. For example, the class name for a fixer named 'has_key' should be FixHasKey. NrpostFcJ||_||_|dS)aInitializer. Subclass may override. Args: options: a dict containing the options passed to RefactoringTool that could be used to customize the fixer through the command line. log: a list to append warnings and other messages to. N)optionslogcompile_pattern)selfr r s ?/opt/alt/python-internal/lib64/python3.11/lib2to3/fixer_base.py__init__zBaseFix.__init__/s*  c|j9t}||jd\|_|_dSdS)zCompiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match(). NT) with_tree)PATTERNrrpattern pattern_tree)rPCs rrzBaseFix.compile_pattern;sS < # ""B.0.@.@KO/A/Q/Q +DL$+++ $ #rc||_dS)zOSet the filename. The main refactoring tool should call this. N)filename)rrs r set_filenamezBaseFix.set_filenameFs ! rcDd|i}|j||o|S)aReturns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override. node)rmatchrrresultss rrz BaseFix.matchMs*4.|!!$00 B"DN HOO04=@ A A A      rc|}|}d|_d}||||fz|r||dSdS)aWarn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. zLine %d: could not convert: %sN) get_linenocloneprefixr2)rrreasonlineno for_outputmsgs rcannot_convertzBaseFix.cannot_convertzsw""ZZ\\  .  33444  %   V $ $ $ $ $ % %rcb|}|d||fzdS)zUsed for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. z Line %d: %sN)r5r2)rrr8r9s rwarningzBaseFix.warnings7"" &&)99:::::rc|j|_||tjd|_d|_dS)zSome fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. rTN)r&r itertoolscountr)r/rtreers r start_treezBaseFix.start_trees=/ (### q)) rcdS)zSome fixers need to maintain tree-wide state. This method is called once, at the conclusion of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. NrBs r finish_treezBaseFix.finish_trees  r)r$N)"__name__ __module__ __qualname____doc__rrrr rr@rAr)setr&orderexplicit run_order _accept_typekeep_line_order BM_compatiblerpython_symbolssymsrrrrr#r-r2r<r>rDrGrFrrrrs1GGLGHioa  GJ EHILOM  D    Q Q Q!!! = = =$$$    !!! % % % %;;;        rrc,eZdZdZdZfdZdZxZS)ConditionalFixz@ Base class for fixers which not execute if an import is found. NcPtt|j|d|_dSrH)superrWrD _should_skip)rargs __class__s rrDzConditionalFix.start_trees+.nd##.55 rc|j|jS|jd}|d}d|dd}t ||||_|jS)N.)rZskip_onsplitjoinr)rrpkgr,s r should_skipzConditionalFix.should_skipsh   ($ $l  %%2whhs3B3x  ,S$==  r)rIrJrKrLr`rDrd __classcell__)r\s@rrWrWsTJJG!!!!!!!!!!!!rrW) rLr@patcomprr4r fixer_utilrobjectrrWrFrrris98%$$$$$((((((X X X X X fX X X v!!!!!W!!!!!rPKG13] ڨ;; __pycache__/main.cpython-311.pycnu[ !A?hN.dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl m Z dZ Gdde j Zd Zd d ZdS) z Main program for 2to3. )with_statementprint_functionN)refactorc |}|}tj||||dddS)z%Return a unified diff of two strings.z (original)z (refactored))lineterm) splitlinesdifflib unified_diff)abfilenames 9/opt/alt/python-internal/lib64/python3.11/lib2to3/main.py diff_textsrsF A A  1h ,n)+ - - --c<eZdZdZ dfd ZdZfdZdZxZS)StdoutRefactoringToola2 A refactoring tool that can avoid overwriting its input files. Prints output to stdout. Output files can optionally be written to a different directory and or have an extra file suffix appended to their name for use in situations where you do not want to replace the input files. rc ||_||_|r.|tjs|tjz }||_||_||_tt| |||dS)aF Args: fixers: A list of fixers to import. options: A dict with RefactoringTool configuration. explicit: A list of fixers to run even if they are explicit. nobackups: If true no backup '.bak' files will be created for those files that are being refactored. show_diffs: Should diffs of the refactoring be printed to stdout? input_base_dir: The base directory for all input files. This class will strip this path prefix off of filenames before substituting it with output_dir. Only meaningful if output_dir is supplied. All files processed by refactor() must start with this path. output_dir: If supplied, all converted files will be written into this directory tree instead of input_base_dir. append_suffix: If supplied, all files output by this tool will have this appended to their filename. Useful for changing .py to .py3 for example by passing append_suffix='3'. N) nobackups show_diffsendswithossep_input_base_dir _output_dir_append_suffixsuperr__init__) selffixersoptionsexplicitrrinput_base_dir output_dir append_suffix __class__s rrzStdoutRefactoringTool.__init__$s(#$  %."9"9"&"A"A % bf $N-%+ #T**33FGXNNNNNrcl|j|||f|jj|g|Ri|dSN)errorsappendloggererror)r msgargskwargss r log_errorzStdoutRefactoringTool.log_errorAsJ Cv./// #/////////rc|}|jrt||jr@tj|j|t |jd}ntd|d|j|jr ||jz }||krktj |}tj |s|rtj || d|||j s|dz}tj|r< tj|n&#t $r| d|YnwxYw tj||n'#t $r| d||YnwxYwt%t&|j}||||||j st+j||||krt+j||dSdS)Nz filename z( does not start with the input_base_dir zWriting converted %s to %s.z.bakzCan't remove backup %szCan't rename %s to %s)r startswithrrpathjoinlen ValueErrorrdirnameisdirmakedirs log_messagerlexistsremoveOSErrorrenamerr write_fileshutilcopymode) r new_textrold_textencoding orig_filenamer%backupwriter's rr@z StdoutRefactoringTool.write_fileEsd   J""4#788 J7<<(8(0T5I1J1J1K1K(LNN!j)143G3G"IJJJ   , + +H H $ $22J7==,, ( ( J'''   :M% ' ' '~ L&Fwv&& GGIf%%%%GGG$$%=vFFFFFG L (F++++ L L L  !8(FKKKKK L+T22= h(H555~ . OFH - - - H $ $ OM8 4 4 4 4 4 % $s$-E E%$E%)E??!F#"F#c|r|d|dS|d||jrt|||} |jU|j5|D]}t |t jdddn #1swxYwYdSdS|D]}t |dS#t$rtd|dYdSwxYwdS)NzNo changes to %sz Refactored %szcouldn't encode z's diff for your terminal) r;rr output_lockprintsysstdoutflushUnicodeEncodeErrorwarn)r oldnewrequal diff_lineslines r print_outputz"StdoutRefactoringTool.print_outputls|     / : : : : :   _h 7 7 7 'S(;;  '3!-//(2,, %d J,,.../////////////////// %/((D!$KKKK(()D"((%&&&FF  s< B<3B B<BB<BB<&B<<CC)rrr) __name__ __module__ __qualname____doc__rr1r@rV __classcell__)r's@rrrsBDOOOOOO:000%5%5%5%5%5NrrcBtd|tjdS)Nz WARNING: file)rKrLstderr)r.s rrPrPs$ E33 sz222222rc  tjd}|dddd|dd d gd |d ddddd|ddd gd |dddd|dddd|dddd|d d!dd"|d#dd$|d%d&dd'|d(d)dd*d+ |d,d-dd.d/d01|d2d3dd4|d5dd.d/d61d*}i}||\}}|jr"d7|d8<|jst d9d7|_|jr|js| d:|j r|js| d;|js|j rt d<|js|jr| d=|j r9td>tjD]}t||sd?S|s8td@t jAtdBt jAdCSdD|vr&d7}|jrtdEt jAdCS|jrd7|dF<|jrd7|dG<|jr t*jn t*j}t+jdH|It+jdJ}t5tj} t5fdK|jD} t5} |jrJd*} |jD]&} | dLkrd7} | dMz| z'| r| | n| }n| | }| | }tBj"#|}|r]|$tBj%s>tBj"&|stBj"'|}|jr;|(tBj%}|)dN|j|tUtW||tW| |j|j ||j|j O}|j,s|r|-ng |||j|j.|j/n>#tj0$r,|j/dksJtdPt jAYdSwxYw|1tetg|j,S)QzMain program. Args: fixer_pkg: the name of a package where the fixers are located. args: optional; a list of command line arguments. If omitted, sys.argv[1:] is used. Returns a suggested exit status (0, 1, 2). z2to3 [options] file|dir ...)usagez-dz--doctests_only store_truezFix up doctests only)actionhelpz-fz--fixr+z1Each FIX specifies a transformation; default: all)rcdefaultrdz-jz --processesstorerintzRun 2to3 concurrently)rcretyperdz-xz--nofixz'Prevent a transformation from being runz-lz --list-fixeszList available transformationsz-pz--print-functionz0Modify the grammar so that print() is a functionz-ez--exec-functionz/Modify the grammar so that exec() is a functionz-vz --verbosezMore verbose loggingz --no-diffsz#Don't show diffs of the refactoringz-wz--writezWrite back modified filesz-nz --nobackupsFz&Don't write backups for modified filesz-oz --output-dirstrrzXPut output files in this directory instead of overwriting the input files. Requires -n.)rcrhrerdz-Wz--write-unchanged-fileszYAlso write files even if no changes were required (useful with --output-dir); implies -w.z --add-suffixzuAppend this string to all output filenames. Requires -n if non-empty. ex: --add-suffix='3' will generate .py3 files.Twrite_unchanged_filesz&--write-unchanged-files/-W implies -w.z%Can't use --output-dir/-o without -n.z"Can't use --add-suffix without -n.z@not writing files and not printing diffs; that's not very usefulzCan't use -n without -wz2Available transformations for the -f/--fix option:rz1At least one file or directory argument required.r]zUse --help to show usage.-zCan't write to stdin.r exec_functionz%(name)s: %(message)s)formatlevelz lib2to3.mainc3(K|] }dz|zV dS).fix_N).0fix fixer_pkgs r zmain..s-LLsW,s2LLLLLLrallrqz7Output in %r will mirror the input directory %r layout.)r$r%r&z+Sorry, -j isn't supported on this platform.)4optparse OptionParser add_option parse_argsrjrHrPr%rr- add_suffixno_diffs list_fixesrKrget_all_fix_namesrLr_rrmverboseloggingDEBUGINFO basicConfig getLoggersetget_fixers_from_packagenofixrtaddunion differencerr4 commonprefixrrr9r8rstripinforsortedr*refactor_stdin doctests_only processesMultiprocessingUnsupported summarizergbool)rur/parserrflagsr"fixnameror, avail_fixesunwanted_fixesr# all_presentrt requested fixer_namesr$rts` rmainrs! ")F G G GF d-l1333 dGHbNPPP dM'1 '>@@@ dIhDFFF dN<;=== d.|MOOO d-lLNNN dK 1333 l<@BBB dIl6888 dM,CEEE dN7 (NOOO d5lABBB nW5"GHHH N E%%d++MGT$)-%&} ; 9 : : : >'"3> <===;'"3; 9::: =QW-Q OPPP =0W.0 ./// BCCC1)<<  G 'NNNN 1  A SSSS ) ;;;;q d{{ =  ) ; ; ; ;1'"&&!%o%_ >GMM',E 6eDDDD  ~ . .Fh6yAABBKLLLLgmLLLLLNuuH{ 0 ; 8 8Ce||"  Y03677773>LK%%h///H %%h// &&~66KW))$//N9~66rv>>9 n--9 888'..rv66 M& 8 8 8  ;  x(8(8  7#33))!,  . . .B 9            D'-1F#-////6   (1,,,,C:''''qq    tBI  s;'U##7VVr))rZ __future__rrrLrr rrArxrrrMultiprocessRefactoringToolrrPrrrrrrs65555555  ---eeeeeH@eeeN333L L L L L L rPKG13]A!2*__pycache__/refactor.cpython-311.opt-2.pycnu[ !A?hsk> dZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z ddlmZddlmZmZddlmZdd ZGd d eZd ZdZdZdZdZGddeZGddeZGddeZ GddeZ!dS)z#Guido van Rossum N)chain)drivertokenizetoken) find_root)pytreepygram) btm_matcherTc t|ggdg}g}tj|jD]<\}}}|dr!|r |dd}||=|S)N*fix_) __import__pkgutil iter_modules__path__ startswithappend) fixer_pkg remove_prefixpkg fix_namesfindernameispkgs =/opt/alt/python-internal/lib64/python3.11/lib2to3/refactor.pyget_all_fix_namesrsO YB . .CI&3CLAA##e ??6 " " # ABBx   T " " " ceZdZdS) _EveryNodeN__name__ __module__ __qualname__rrr!r!+Drr!c t|tjtjfr|jt |jhSt|tjr"|jrt|jSt t|tj rAt}|jD])}|D]$}| t|%*|Std|z)Nz$Oh no! I don't understand pattern %s) isinstancer NodePattern LeafPatterntyper!NegatedPatterncontent_get_head_typesWildcardPatternsetupdate Exception)patrpxs rr/r//s9#*F,>?@@ 8  z#v,-- ; 0"3;// /#v-.. EE - -A - -++,,,, - :SA B BBrc\ tjt}g}|D]}|jr[ t |j}|D]}|||?#t $r||Y`wxYw|j!||j|||ttj j tj j D]}|||t|SN) collections defaultdictlistpatternr/rr! _accept_typerr python_grammar symbol2numbervaluestokensextenddict) fixer_list head_nodeseveryfixerheads node_types r_get_headnode_dictrKKsO/(..J E $ $ = $ 8' 66"'88Iy)0077778 $ $ $ U##### $ !-5-.55e<<<< U####60>EEGG!0799,, 9$$U++++   sAB?Bc> fdtdDS)Nc g|] }dz|z S.r&).0fix_namepkg_names r z+get_fixers_from_package..hs8 @ @ @ sNX % @ @ @rF)r)rRs`rget_fixers_from_packagerTdsE @ @ @ @-h>> @ @ @@rc|Sr9r&)objs r _identityrWks Jrchd}tjtj|jfd}t t jtjt j h}t} |\}}||vr|t j kr|rnd}n|t j kr|dkr|\}}|t j ks|dkrn|\}}|t j ks|dkrn|\}}|t j kr|dkr |\}}|t j krV|||\}}|t j ks|dkrn|\}}|t j kVnn n#t$rYnwxYwt |S) NFcBt}|d|dfS)Nrr)next)tokgens radvancez(_detect_future_features..advancers 3ii1vs1v~rTfrom __future__import(,)rgenerate_tokensioStringIOreadline frozensetrNEWLINENLCOMMENTr1STRINGNAMEOPadd StopIteration)sourcehave_docstringr]ignorefeaturestpvaluer\s @r_detect_future_featuresrvosN  "2;v#6#6#? @ @C x{EMB C CFuuH   IBV||u|##!!%uz!!evoo#GII E##u '<'<#GII E##u'8'8#GII E>>esll ' IBEJ&&LL''' ' IBUX~~# ' IB EJ&&3 4      X  s3D!F F"!F"ceZdZdS) FixerErrorNr"r&rrrxrxs&&rrxceZdZddddZdZdZddZdZdZd Z d Z d Z dd Z dd Z dZddZdZd dZdZdZ d!dZd"dZdZdZdZdZdZdZdZdZdS)#RefactoringToolF)print_function exec_functionwrite_unchanged_filesFixrNcR ||_|pg|_|j|_||j|t j|_|jdr|jj d=n|jdr |jj d=|j d|_ g|_ tjd|_g|_d|_t%j|jt(j|j|_|\|_|_g|_t5j|_g|_g|_t?|j|jD]k}|j r|j!|$||jvr|j"|H||jvr|j"|ltG|j|_$tG|j|_%dS) Nr{printr|execr}rzF)convertlogger)&fixersexplicit_default_optionscopyoptionsr2r r?grammarkeywordsgetr}errorslogging getLoggerr fixer_logwroterDriverr r get_fixers pre_order post_orderfilesbm BottomMatcherBM bmi_pre_orderbmi_post_orderr BM_compatible add_fixerrrKbmi_pre_order_headsbmi_post_order_heads)self fixer_namesrrrHs r__init__zRefactoringTool.__init__s "  B ,1133   L   ( ( (,1133 <( ) . %g.. \/ * . %f- &*\%5%56M%N%N" '(9::  mDL,2N+/;888 +///*;*;' "$$ 4?DN;; 2 2E" 2!!%(((($.(("))%0000$/))#**5111#5d6H#I#I $6t7J$K$K!!!rc g}g}|jD]}t|iidg}|ddd}||jr|t |jd}|d}|jdd|Dz} t||}n$#t$rtd|d|dwxYw||j |j } | jr*|jd ur!||jvr|d |!|d || jd kr|| Y| jd kr|| {td| jzt'jd} || || ||fS)Nr rOr_c6g|]}|Sr&)title)rPr6s rrSz.RefactoringTool.get_fixers..s 5O5O5OAaggii5O5O5Orz Can't find TzSkipping optional fixer: %szAdding transformation: %sprepostzIllegal fixer order: %r run_orderkey)rrrsplitr FILE_PREFIXlensplit CLASS_PREFIXjoingetattrAttributeErrorrxrrr log_message log_debugorderroperator attrgettersort) rpre_order_fixerspost_order_fixers fix_mod_pathmodrQparts class_name fix_classrHkey_funcs rrzRefactoringTool.get_fixerss'  K J JL\2rC599C#**32226H""4#344 <#C(8$9$9$:$:;NN3''E*RWW5O5O5O5O5O-P-PPJ X#C44 ! X X X jxxx!LMMSWW XIdlDN;;E~ $-t";";  55  !>III NN6 A A A{e## ''....&&!((//// !:U[!HIII&{33(+++8,,, "344s 2C!C$c r9r&)rmsgargskwdss r log_errorzRefactoringTool.log_errors* rcJ |r||z}|j|dSr9)rinforrrs rrzRefactoringTool.log_messages2$  *C rcH|r||z}|j|dSr9)rdebugrs rrzRefactoringTool.log_debug s/  *C #rc dSr9r&)rold_textnew_textfilenameequals r print_outputzRefactoringTool.print_outputs   rc |D]P}tj|r||||9||||QdSr9)ospathisdir refactor_dir refactor_file)ritemswrite doctests_only dir_or_files rrefactorzRefactoringTool.refactorso7  F FKw}}[)) F!!+umDDDD"";}EEEE  F Frc tjdz}tj|D]\}}}|d||||D]w}|ds`tj|d|kr7tj||} | | ||xd|D|dd<dS)NpyzDescending into %srOrc<g|]}|d|SrN)r)rPdns rrSz0RefactoringTool.refactor_dir..2s)KKK" c8J8JK2KKKr) rextsepwalkrrrrsplitextrr) rdir_namerrpy_extdirpathdirnames filenamesrfullnames rrzRefactoringTool.refactor_dir s T!,.GH,=,= L L (GXy NN/ 9 9 9 MMOOO NN   ! G G,,GG$$T**1-77!w||GT::H&&x FFFKKKKKHQQQKK L Lrc t|d}n/#t$r"}|d||Yd}~dSd}~wwxYw tj|jd}|n#|wxYwtj|d|d5}||fcdddS#1swxYwYdS)NrbzCan't open %s: %sNNrr5rencodingnewline) openOSErrorrrdetect_encodingrfcloserdread)rrferrrs r_read_python_sourcez#RefactoringTool._read_python_source4s'  Xt$$AA    NN.# > > >:::::  / ;;A>H GGIIIIAGGIIII WXsXr B B B &a6688X% & & & & & & & & & & & & & & & & & &s0 A;AA88B)C  CCc ||\}}|dS|dz }|rl|d||||}|js||kr||||||dS|d|dS|||}|js |r7|jr0|t|dd|||dS|d|dS)N zRefactoring doctests in %szNo doctest changes in %sr)rrzNo changes in %s)rrrefactor_docstringr}processed_filerefactor_string was_changedstr)rrrrinputroutputtrees rrzRefactoringTool.refactor_fileDsC228<<x = F    = NN7 B B B,,UH==F) EVu__##FHeUHMMMMM98DDDDD''x88D) =d =t7G =##CIIcrcNH*/($DDDDD18<<<<}|d||jj |Yd}~|j|j_dSd}~wwxYw |j|j_n#|j|j_wxYw||_ | d|| |||S)Nr{zCan't parse %s: %s: %szRefactoring %s) rvr !python_grammar_no_print_statementrr parse_stringr3r __class__r#future_featuresr refactor_tree)rdatarrsrrs rrzRefactoringTool.refactor_string[s +400 x ' '"("JDK  /;++D11DD    NN3!7 > > > FFF"&,DK       #',DK  $,DK  . . . .' '... 4&&& s/AB% B"B 3B% BB%%B8ctj}|rh|d||d}|js||kr||d|dS|ddS||d}|js |r-|jr&|t|d|dS|ddS)NzRefactoring doctests in stdinzzNo doctest changes in stdinzNo changes in stdin) sysstdinrrrr}rrrr)rrrrrs rrefactor_stdinzRefactoringTool.refactor_stdinvs     6 NN: ; ; ;,,UI>>F) >Vu__##FIu=====<=====''y99D) 6d 6t7G 6##CIIy%@@@@@455555rc  t|j|jD]}|||||j|||j||j| }t| r|jj D]}||vr||r|| tjjd|jr+|| tjjt'||D]8}|||vr||| t+|n#t,$rYEwxYw|jr ||jvrZ||}|r|||}||||D]*}|jsg|_|j|+|j| }|D],} | |vrg|| <|| || -:t| t|j|jD]}||||jS)NT)rreverser)rrr start_tree traverse_byrrrrunleavesanyrArrr Basedepthkeep_line_order get_linenor<remover ValueErrorfixers_appliedmatch transformreplacerrC finish_treer) rrrrH match_setnoderesultsnew new_matchesfxrs rrzRefactoringTool.refactor_trees* 4>4?;; ) )E   T4 ( ( ( ( 14>>3C3CDDD 2DOO4E4EFFFGKK .. )""$$%%/ L. L. LI%%)E*:%e$))fk.?)NNN,J"%(--&+2H-III $Yu%5 6 6$L$L9U#333%e,33D999%%dOOOO)%%%%H%  .%5D%A>@(;$($7$>$>u$E$E$E$E/3gkk#**,,.G.G +6!L!LC+.)+;+;79 #$-cN$9$9+c:J$K$K$K$K_)""$$%%/ Lb4>4?;; * *E   dD ) ) ) )sF&& F32F3c |sdS|D]X}||jD]H}||}|r/|||}||||}IYdSr9)r,rrr)rr traversalr!rHr"r#s rrzRefactoringTool.traverse_bys   F # #D * # #++d++#//$88C S)))"  # # #rc` |j||||d}|dS||k}||||||r|d||jsdS|r|||||dS|d|dS)NrzNo changes to %szNot writing changes to %s)rrrrrr} write_file)rrrrrrrs rrzRefactoringTool.processed_files  (###  //99!>>   NN-x 8 8 8-   B OOHh( C C C C C NN6 A A A A Arc tj|d|d}n/#t$r"}|d||Yd}~dSd}~wwxYw|5 ||n.#t$r!}|d||Yd}~nd}~wwxYwdddn #1swxYwY|d|d|_dS)NwrrzCan't create %s: %szCan't write %s: %szWrote changes to %sT)rdrrrrrr)rrrrrfprs rr)zRefactoringTool.write_files]  32FFFBB    NN0(C @ @ @ FFFFF  D D D"""" D D D3XsCCCCCCCC D D D D D D D D D D D D D D D D ,h777 sP AAA BA%$B% B/B B BBB#&B#z>>> z... c  g}d}d}d}d}|dD])}|dz }||jrW|+|||||||}|g}||j} |d| }|V|||jzs#|||jzdzkr| ||+||||||d}d}| |+|+||||||d |S)NrTkeependsrrr) splitlineslstriprPS1rCrefactor_doctestfindPS2rstriprr) rrrresultblock block_linenoindentlinenolineis rrz"RefactoringTool.refactor_docstrings  $$d$33 $ $D aKF{{}}''11 $$MM$"7"7|8>#J#JKKK% IIdh''bqb$??6DH#455%6DHOO$5$55<<< T""""$MM$"7"7|8>#J#JKKK d####   MM$//|06BB C C Cwwvrc ||}n#t$r}jtjr.|D]+}d|d,d|||j j ||cYd}~Sd}~wwxYw ||rt| d}|d|dz ||dz d}} |dds|dxxdz cc<jz|dzg}|r|fd |Dz }|S) Nz Source: %srz+Can't parse docstring in %s line %s: %s: %sTr.rrrc*g|]}jz|zSr&)r5)rPr<r:rs rrSz4RefactoringTool.refactor_doctest..^s%CCCt&48+d2CCCr) parse_blockr3r isEnabledForrDEBUGrr6rrr#rrr0endswithr2pop) rr8r;r:rrrr<r#clippeds ` ` rr3z RefactoringTool.refactor_doctestDs  ##E66::DD   {'' 66 D!DDDNN<T1B1BCCCC NNH#VS]-CS J J JLLLLLL     dH - - Dd))&&&55Cyqy>3vaxyy>SGr7##D)) B4dh&34E DCCCCCsCCCC s B(A6B#B(#B(c6|jrd}nd}|js|d|n5|d||jD]}|||jr4|d|jD]}|||jrut |jdkr|dn(|dt |j|jD]\}}}|j|g|Ri|dSdS) Nwerez need to bezNo files %s modified.zFiles that %s modified:z$Warnings/messages while refactoring:rzThere was 1 error:zThere were %d errors:)rrrrrr)rrGfilemessagerrrs r summarizezRefactoringTool.summarizeask : DDDz '   4d ; ; ; ;   6 = = =  ' '  &&&& > *   C D D D> * *  )))) ; 54;1$$  !56666  !8#dk:J:JKKK#'; 5 5T4  4t444t4444  5 5  5 5rc |j||||}t|_|Sr9)r parse_tokens wrap_toksrgr)rr8r;r:rs rr@zRefactoringTool.parse_blockxs? {''uff(M(MNN({{ rc#K tj|||j}|D]+\}}\}}\} } } ||dz z }| |dz z } ||||f| | f| fV,dS)Nr)rrc gen_lines__next__) rr8r;r:rBr,ruline0col0line1col1 line_texts rrMzRefactoringTool.wrap_tokssI)$..*G*G*PQQDJ G G @D%% y VaZ E VaZ E t}udmYF F F F F G Grc#K ||jz}||jz}|}|D]h}||r|t|dVn5||dzkrdVnt d|d||}i dV)Nrzline=z , prefix=Tr)r2r5rrr6AssertionError)rr8r:prefix1prefix2prefixr<s rrOzRefactoringTool.gen_liness 48#48#  Dv&& L3v;;<<(((((4/// $nTTT66%JKKKFF HHH rr)FF)F)NFNr9)r#r$r%rrrrrrrrrrrrrrr rrrr)r2r5rr3rJr@rMrOr&rrrzrzs+0).2799LK3L3L3L3Ln&5&5&5P     FFFFLLLL(&&& ====.66666 M M M ^###.GL $BBBB** C C)))V:555. G G GrrzceZdZdS)MultiprocessingUnsupportedNr"r&rrr\r\r'rr\cBeZdZfdZ dfd ZfdZfdZxZS)MultiprocessRefactoringToolcdtt|j|i|d|_d|_dSr9)superr^rqueue output_lockrrkwargsrs rrz$MultiprocessRefactoringTool.__init__s;9)40094J6JJJ rFrc|dkr*tt|||S ddln#t$rt wxYwjtd_ _ fdt|D} |D]}| tt|||j t|D]}jd|D]*}|r| +d_dS#j t|D]}jd|D]*}|r| +d_wxYw)Nrrz already doing multiple processescFg|]}jS))target)Process_child)rPr=multiprocessingrs rrSz8MultiprocessRefactoringTool.refactor..s<444%,,DK,@@444r)r`r^rrj ImportErrorr\ra RuntimeError JoinableQueueLockrbrangestartrputis_alive) rrrr num_processes processesr6r=rjrs ` @rrz$MultiprocessRefactoringTool.refactors/ A  4d;;DDum-- - - " " " " " - - -, , - : !ABB B$2244 *//1144444#M22444     -t 4 4 = =eU>K M M M JOO   =)) % % t$$$$  ::<<FFHHHDJJJ JOO   =)) % % t$$$$  ::<<FFHHHDJ    s:A 4AE22A;G-c4|j}|{|\}} tt|j|i||jn#|jwxYw|j}|ydSdSr9)rarr`r^r task_done)rtaskrrdrs rriz"MultiprocessRefactoringTool._childsz~~LD& 'F1488F%#%%% $$&&&& $$&&&&:>>##Ds AA8c|j|j||fdStt|j|i|Sr9)rarqr`r^rrcs rrz)MultiprocessRefactoringTool.refactor_filesV : ! JNND&> * * * * *I54d;;I!!! !r)FFr)r#r$r%rrrir __classcell__)rs@rr^r^s     :? : $ $ $ $ $!!!!!!!!!rr^)T)" __author__rdrrr rrr: itertoolsrpgen2rrr fixer_utilrrr r r rrr3r!r/rKrTrWrvrxobjectrzr\r^r&rrrs3   +*********!!!!!!            CCC82@@@%%%P''''''''FFFFFfFFFR        4!4!4!4!4!/4!4!4!4!4!rPKG13] WW(__pycache__/pygram.cpython-311.opt-2.pycnu[ !A?h ddlZddlmZddlmZddlmZejeje dZ ejeje dZ Gdd e Z ejd e Ze eZeZejd =eZejd =ejd e Ze eZdS) N)token)driver)pytreez Grammar.txtzPatternGrammar.txtceZdZdZdS)Symbolsch |jD]\}}t|||dS)N) symbol2numberitemssetattr)selfgrammarnamesymbols ;/opt/alt/python-internal/lib64/python3.11/lib2to3/pygram.py__init__zSymbols.__init__sJ $17799 ( (LD& D$ ' ' ' ' ( (N)__name__ __module__ __qualname__rrrrrs#(((((rrlib2to3printexec)ospgen2rrrpathjoindirname__file__ _GRAMMAR_FILE_PATTERN_GRAMMAR_FILEobjectrload_packaged_grammarpython_grammarpython_symbolscopy!python_grammar_no_print_statementkeywords*python_grammar_no_print_and_exec_statementpattern_grammarpattern_symbolsrrrr.sL-  RW__X66 FF  RW__X%>%>%9;; ( ( ( ( (f ( ( (.-iGG(($2$7$7$9$9!%.w7-N-S-S-U-U*.7?.&.y:OPP'/**rPKG13]{('__pycache__/btm_matcher.cpython-311.pycnu[ !A?hdZdZddlZddlZddlmZddlmZddlm Z Gdd e Z Gd d e Z ia d ZdS) aA bottom-up tree matching algorithm implementation meant to speed up 2to3's matching process. After the tree patterns are reduced to their rarest linear path, a linear Aho-Corasick automaton is created. The linear automaton traverses the linear paths from the leaves to the root of the AST and returns a set of nodes for further matching. This reduces significantly the number of candidate nodes.z+George Boutsioukis N) defaultdict)pytree) reduce_treec6eZdZdZejZdZdS)BMNodez?Class for a node of the Aho-Corasick automaton used in matchingcli|_g|_ttj|_d|_dS)N)transition_tablefixersnextrcountidcontentselfs @/opt/alt/python-internal/lib64/python3.11/lib2to3/btm_matcher.py__init__zBMNode.__init__s- " v|$$ N)__name__ __module__ __qualname____doc__ itertoolsrrrrrrs8II IO  Errc0eZdZdZdZdZdZdZdZdS) BottomMatcherzgThe main matcher class. After instantiating the patterns should be added using the add_fixer methodct|_t|_|jg|_g|_t jd|_dS)NRefactoringTool) setmatchrrootnodesr logging getLoggerloggerrs rrzBottomMatcher.__init__sAUU HH i[  '(9:: rc|j|t|j}|}|||j}|D]}|j|dS)zReduces a fixer's pattern tree to a linear path and adds it to the matcher(a common Aho-Corasick automaton). The fixer is appended on the matching states and called when they are reachedstartN)r appendr pattern_treeget_linear_subpatternaddr")rfixertreelinear match_nodes match_nodes r add_fixerzBottomMatcher.add_fixer%s 5!!!5-..++--hhvTYh77 % , ,J   $ $U + + + + , ,rc |s|gSt|dtr\g}|dD]O}|||}|D]3}|||dd|4P|S|d|jvrt }||j|d<n|j|d}|ddr ||dd|}n|g}|S)z5Recursively adds a linear pattern to the AC automatonrr(rN) isinstancetupler-extendr r)rpatternr)r1 alternative end_nodesend next_nodes rr-zBottomMatcher.add1s& 7N gaj% ( ( K&qz C C !HH[H>> $CCC&&txx S'A'ABBBBC qz!777"HH 5>&wqz22"271:> qrr{ ( HHWQRR[ HBB &K  rc6|j}tt}|D]}|}|rd|_|jD]0}t |t jr|jdkr d|_n1|j dkr|j}n|j }||j vr3|j |}|j D]}|| |nV|j}|j |j jrnD||j vr2|j |}|j D]}|| ||j }||S)auThe main interface with the bottom matcher. The tree is traversed from the bottom using the constructed automaton. Nodes are only checked once as the tree is retraversed. When the automaton fails, we give it one more shot(in case the above tree matches as a whole with the rejected leaf), then we break for the next leaf. There is the special case of multiple arguments(see code comments) where we recheck the nodes Args: The leaves of the AST tree to be matched Returns: A dictionary of node matches with fixers as the keys T;Fr)r"rlist was_checkedchildrenr5rLeafvaluetyper r r*parent) rleavescurrent_ac_noderesultsleafcurrent_ast_nodechild node_tokenr.s rrunzBottomMatcher.runSs )d### ;# ;D# "! ;/3 ,-6E!%55%+:L:L7<(4#(A--!1!7JJ!1!6J!AAA&5&Fz&RO!0!7@@--.>????@'+iO(/;,3?<"_%EEE*9*J:*V%4%;DDE#EN112BCCCC#3#: C#! ;Drcntdfd|jtddS)z %d [label=%s] //%sr)r keysprintr type_reprstrr r)node subnode_keysubnode print_nodes rrWz*BottomMatcher.print_ac..print_nodes#499;; $ $ / <0w Ik,B,BCDWDWXYZZZ!##'/*** 7####  $ $r}N)rQr")rrWs @rprint_aczBottomMatcher.print_acsM l $ $ $ $ $  49 c rN) rrrrrr3r-rMrYrrrrrsk++;;; , , ,   D666p     rrctsGddlm}|jD]'\}}t |t kr |t|<(t||S)Nr)python_symbols) _type_reprspygramr[__dict__itemsrDint setdefault)type_numr[namevals rrRrRsq 9******(06688 9 9ID#CyyCDS!1  ! !(H 5 55r)r __author__r$r collectionsrr r btm_utilsrobjectrrr\rRrrrrisGG; ######""""""V}}}}}F}}}@ 66666rPKG13];'')__pycache__/patcomp.cpython-311.opt-1.pycnu[ !A?hdZdZddlZddlmZmZmZmZmZm Z ddl m Z ddl m Z Gdd e Zd ZGd d eZejejejdd ZdZdZdZdS)zPattern compiler. The grammar is taken from PatternGrammar.txt. The compiler compiles a pattern to a pytree.*Pattern instance. z#Guido van Rossum N)driverliteralstokentokenizeparsegrammar)pytree)pygramceZdZdS)PatternSyntaxErrorN)__name__ __module__ __qualname__z0PatternCompiler.compile_node..Os'GGGbD%%b))GGGrNrcg|]}|gSrr)rFas rrHz0PatternCompiler.compile_node..Rs':':':':':':rminmaxc:g|]}|SrrDrEs rrHz0PatternCompiler.compile_node..Vs'CCCrT&&r**CCCr)r r,Matcherchildren Alternativeslenr WildcardPatternoptimize Alternative NegatedUnit compile_basicNegatedPatternrEQUALr!RepeaterSTARHUGEPLUSLBRACEget_intname) r5nodealtspunitspatternrdnodesrepeatrTchildrMrNs ` rr=zPatternCompiler.compile_nodeCs 9 ) ) )=#D 9 . . .GGGGDM##A#4FGGGD4yyA~~Aw&':':T':':':qIIIA::<<  9 - - -CCCCT]CCCE5zzQQx&wA1===A::<<  9 - - -((qrr):;;G%g..A::<<   u::??uQx} ;;8>D!""IE u::??uRy~1CCC2YF#2#JE$$UF33  HQKEzUZ''kuz))ku|++!LL!555cx==A%%,,x{33Caxx3!88!**,, 07)#3OOO  GL!!!rc|d}|jtjkrHtt j|j}tjt||S|jtj kr|j}| rS|tvrtd|z|ddrtdtjt|S|dkrd}n?|ds*t|j|d}|td|z|ddr(||djdg}nd}tj||S|jdkr||dS|jd kr4||d}tj|ggdd SdS) NrzInvalid token: %rrzCan't have details for tokenany_zInvalid symbol: %r([rL)r rSTRINGr<r evalStringr!r LeafPattern_type_of_literalNAMEisupper TOKEN_MAPr startswithgetattrr2r=rT NodePatternrW)r5rjrkrer!r content subpatterns rr[zPatternCompiler.compile_basicsQx 9 $ $+DJ7788E%&6u&=&=uEE E Y%* $ $JE}} 9 )),-@5-HIII9M,-KLLL))E*:;;;E>>DD))#..O"4;t<rs=3  EDDDDDDDDDDDDDDD        IIIIIfIIIZZ||   99966666rPKG13][ݥ*__pycache__/__init__.cpython-311.opt-2.pycnu[ !A?h4ddlZejdeddS)NzGlib2to3 package is deprecated and may not be able to parse Python 3.10+) stacklevel)warningswarnDeprecationWarning=/opt/alt/python-internal/lib64/python3.11/lib2to3/__init__.pyr s> Mr PKG13]R;(__pycache__/pygram.cpython-311.opt-1.pycnu[ !A?hdZddlZddlmZddlmZddlmZejej e dZ ejej e dZ Gd d e Zejd e ZeeZeZejd =eZejd =ejd e ZeeZdS)z&Export the Python grammar and symbols.N)token)driver)pytreez Grammar.txtzPatternGrammar.txtceZdZdZdS)Symbolscf|jD]\}}t|||dS)zInitializer. Creates an attribute for each grammar symbol (nonterminal), whose value is the symbol's type (an int >= 256). N) symbol2numberitemssetattr)selfgrammarnamesymbols ;/opt/alt/python-internal/lib64/python3.11/lib2to3/pygram.py__init__zSymbols.__init__sE $17799 ( (LD& D$ ' ' ' ' ( (N)__name__ __module__ __qualname__rrrrrs#(((((rrlib2to3printexec)__doc__ospgen2rrrpathjoindirname__file__ _GRAMMAR_FILE_PATTERN_GRAMMAR_FILEobjectrload_packaged_grammarpython_grammarpython_symbolscopy!python_grammar_no_print_statementkeywords*python_grammar_no_print_and_exec_statementpattern_grammarpattern_symbolsrrrr/sO-,  RW__X66 FF  RW__X%>%>%9;; ( ( ( ( (f ( ( (.-iGG(($2$7$7$9$9!%.w7-N-S-S-U-U*.7?.&.y:OPP'/**rPKG13]U0 ,__pycache__/fixer_base.cpython-311.opt-1.pycnu[ !A?h"ndZddlZddlmZddlmZddlmZGddeZ Gd d e Z dS) z2Base class for fixers (optional, but recommended).N)PatternCompiler)pygram)does_tree_importceZdZdZdZdZdZdZdZe j dZ e Z dZdZdZdZdZdZejZdZdZd Zd Zd Zdd ZdZddZdZdZ dZ!dS)BaseFixaOptional base class for fixers. The subclass name must be FixFooBar where FooBar is the result of removing underscores and capitalizing the words of the fix name. For example, the class name for a fixer named 'has_key' should be FixHasKey. NrpostFcJ||_||_|dS)aInitializer. Subclass may override. Args: options: a dict containing the options passed to RefactoringTool that could be used to customize the fixer through the command line. log: a list to append warnings and other messages to. N)optionslogcompile_pattern)selfr r s ?/opt/alt/python-internal/lib64/python3.11/lib2to3/fixer_base.py__init__zBaseFix.__init__/s*  c|j9t}||jd\|_|_dSdS)zCompiles self.PATTERN into self.pattern. Subclass may override if it doesn't want to use self.{pattern,PATTERN} in .match(). NT) with_tree)PATTERNrrpattern pattern_tree)rPCs rrzBaseFix.compile_pattern;sS < # ""B.0.@.@KO/A/Q/Q +DL$+++ $ #rc||_dS)zOSet the filename. The main refactoring tool should call this. N)filename)rrs r set_filenamezBaseFix.set_filenameFs ! rcDd|i}|j||o|S)aReturns match for a given parse tree node. Should return a true or false object (not necessarily a bool). It may return a non-empty dict of matching sub-nodes as returned by a matching pattern. Subclass may override. node)rmatchrrresultss rrz BaseFix.matchMs*4.|!!$00 B"DN HOO04=@ A A A      rc|}|}d|_d}||||fz|r||dSdS)aWarn the user that a given chunk of code is not valid Python 3, but that it cannot be converted automatically. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. zLine %d: could not convert: %sN) get_linenocloneprefixr2)rrreasonlineno for_outputmsgs rcannot_convertzBaseFix.cannot_convertzsw""ZZ\\  .  33444  %   V $ $ $ $ $ % %rcb|}|d||fzdS)zUsed for warning the user about possible uncertainty in the translation. First argument is the top-level node for the code in question. Optional second argument is why it can't be converted. z Line %d: %sN)r5r2)rrr8r9s rwarningzBaseFix.warnings7"" &&)99:::::rc|j|_||tjd|_d|_dS)zSome fixers need to maintain tree-wide state. This method is called once, at the start of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. rTN)r&r itertoolscountr)r/rtreers r start_treezBaseFix.start_trees=/ (### q)) rcdS)zSome fixers need to maintain tree-wide state. This method is called once, at the conclusion of tree fix-up. tree - the root node of the tree to be processed. filename - the name of the file the tree came from. NrBs r finish_treezBaseFix.finish_trees  r)r$N)"__name__ __module__ __qualname____doc__rrrr rr@rAr)setr&orderexplicit run_order _accept_typekeep_line_order BM_compatiblerpython_symbolssymsrrrrr#r-r2r<r>rDrGrFrrrrs1GGLGHioa  GJ EHILOM  D    Q Q Q!!! = = =$$$    !!! % % % %;;;        rrc,eZdZdZdZfdZdZxZS)ConditionalFixz@ Base class for fixers which not execute if an import is found. NcPtt|j|d|_dSrH)superrWrD _should_skip)rargs __class__s rrDzConditionalFix.start_trees+.nd##.55 rc|j|jS|jd}|d}d|dd}t ||||_|jS)N.)rZskip_onsplitjoinr)rrpkgr,s r should_skipzConditionalFix.should_skipsh   ($ $l  %%2whhs3B3x  ,S$==  r)rIrJrKrLr`rDrd __classcell__)r\s@rrWrWsTJJG!!!!!!!!!!!!rrW) rLr@patcomprr4r fixer_utilrobjectrrWrFrrris98%$$$$$((((((X X X X X fX X X v!!!!!W!!!!!rPKG13]88΄$__pycache__/refactor.cpython-311.pycnu[ !A?hsk@dZdZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZddlmZddlmZmZdd lmZdd ZGd d eZdZdZdZdZdZGddeZGddeZ GddeZ!Gdde Z"dS)zRefactoring framework. Used as a main program, this can refactor any number of files and/or recursively descend down directories. Imported as a module, this provides infrastructure to write your own refactoring tool. z#Guido van Rossum N)chain)drivertokenizetoken) find_root)pytreepygram) btm_matcherTct|ggdg}g}tj|jD]<\}}}|dr!|r |dd}||=|S)zEReturn a sorted list of all available fix names in the given package.*fix_N) __import__pkgutil iter_modules__path__ startswithappend) fixer_pkg remove_prefixpkg fix_namesfindernameispkgs =/opt/alt/python-internal/lib64/python3.11/lib2to3/refactor.pyget_all_fix_namesrs YB . .CI&3CLAA##e ??6 " " # ABBx   T " " " ceZdZdS) _EveryNodeN__name__ __module__ __qualname__rrr!r!+Drr!ct|tjtjfr|jt |jhSt|tjr"|jrt|jSt t|tj rAt}|jD])}|D]$}| t|%*|Std|z)zf Accepts a pytree Pattern Node and returns a set of the pattern types which will match first. Nz$Oh no! I don't understand pattern %s) isinstancer NodePattern LeafPatterntyper!NegatedPatterncontent_get_head_typesWildcardPatternsetupdate Exception)patrpxs rr/r//s#*F,>?@@ 8  z#v,-- ; 0"3;// /#v-.. EE - -A - -++,,,, - :SA B BBrcZtjt}g}|D]}|jr[ t |j}|D]}|||?#t $r||Y`wxYw|j!||j|||ttj j tj j D]}|||t|S)z^ Accepts a list of fixers and returns a dictionary of head node type --> fixer list. ) collections defaultdictlistpatternr/rr! _accept_typerr python_grammar symbol2numbervaluestokensextenddict) fixer_list head_nodeseveryfixerheads node_types r_get_headnode_dictrJKsL(..J E $ $ = $ 8' 66"'88Iy)0077778 $ $ $ U##### $ !-5-.55e<<<< U####60>EEGG!0799,, 9$$U++++   sAA?>A?c<fdtdDS)zN Return the fully qualified names for fixers in the package pkg_name. c g|] }dz|z S.r&).0fix_namepkg_names r z+get_fixers_from_package..hs8 @ @ @ sNX % @ @ @rF)r)rQs`rget_fixers_from_packagerSds@ @ @ @ @-h>> @ @ @@rc|SNr&)objs r _identityrWks Jrchd}tjtj|jfd}t t jtjt j h}t} |\}}||vr|t j kr|rnd}n|t j kr|dkr|\}}|t j ks|dkrn|\}}|t j ks|dkrn|\}}|t j kr|dkr |\}}|t j krV|||\}}|t j ks|dkrn|\}}|t j kVnn n#t$rYnwxYwt |S) NFcBt}|d|dfS)Nrr)next)tokgens radvancez(_detect_future_features..advancers 3ii1vs1v~rTfrom __future__import(,)rgenerate_tokensioStringIOreadline frozensetrNEWLINENLCOMMENTr1STRINGNAMEOPadd StopIteration)sourcehave_docstringr]ignorefeaturestpvaluer\s @r_detect_future_featuresrvosN  "2;v#6#6#? @ @C x{EMB C CFuuH   IBV||u|##!!%uz!!evoo#GII E##u '<'<#GII E##u'8'8#GII E>>esll ' IBEJ&&LL''' ' IBUX~~# ' IB EJ&&3 4      X  s3D!F F"!F"ceZdZdZdS) FixerErrorzA fixer could not be loaded.N)r#r$r%__doc__r&rrrxrxs&&&&rrxceZdZddddZdZdZddZdZdZd Z d Z d Z dd Z dd Z dZddZdZd dZdZdZ d!dZd"dZdZdZdZdZdZdZdZdZdS)#RefactoringToolF)print_function exec_functionwrite_unchanged_filesFixrNcP||_|pg|_|j|_||j|t j|_|jdr|jj d=n|jdr |jj d=|j d|_ g|_ tjd|_g|_d|_t%j|jt(j|j |_|\|_|_g|_t5j|_g|_g|_t?|j|jD]k}|j r|j!|$||jvr|j"|H||jvr|j"|ltG|j|_$tG|j|_%dS) zInitializer. Args: fixer_names: a list of fixers to import options: a dict with configuration. explicit: a list of fixers to run even if they are explicit. Nr|printr}execr~r{F)convertlogger)&fixersexplicit_default_optionscopyoptionsr2r r>grammarkeywordsgetr~errorslogging getLoggerr fixer_logwroterDriverr r get_fixers pre_order post_orderfilesbm BottomMatcherBM bmi_pre_orderbmi_post_orderr BM_compatible add_fixerrrJbmi_pre_order_headsbmi_post_order_heads)self fixer_namesrrrGs r__init__zRefactoringTool.__init__s"  B ,1133   L   ( ( (,1133 <( ) . %g.. \/ * . %f- &*\%5%56M%N%N" '(9::  mDL,2N+/;888 +///*;*;' "$$ 4?DN;; 2 2E" 2!!%(((($.(("))%0000$/))#**5111#5d6H#I#I $6t7J$K$K!!!rcg}g}|jD]}t|iidg}|ddd}||jr|t |jd}|d}|jdd|Dz} t||}n$#t$rtd |d|dwxYw||j |j } | jr*|jd ur!||jvr|d |!|d || jd kr|| Y| jdkr|| {td| jzt'jd} || || ||fS)aInspects the options to load the requested patterns and handlers. Returns: (pre_order, post_order), where pre_order is the list of fixers that want a pre-order AST traversal, and post_order is the list that want post-order traversal. r rNrN_c6g|]}|Sr&)title)rOr6s rrRz.RefactoringTool.get_fixers..s 5O5O5OAaggii5O5O5Orz Can't find TzSkipping optional fixer: %szAdding transformation: %sprepostzIllegal fixer order: %r run_orderkey)rrrsplitr FILE_PREFIXlensplit CLASS_PREFIXjoingetattrAttributeErrorrxrrr log_message log_debugorderroperator attrgettersort) rpre_order_fixerspost_order_fixers fix_mod_pathmodrPparts class_name fix_classrGkey_funcs rrzRefactoringTool.get_fixerss" K J JL\2rC599C#**32226H""4#344 <#C(8$9$9$:$:;NN3''E*RWW5O5O5O5O5O-P-PPJ X#C44 ! X X X jxxx!LMMSWW XIdlDN;;E~ $-t";";  55  !>III NN6 A A A{e## ''....&&!((//// !:U[!HIII&{33(+++8,,, "344s 1C!C#c)zCalled when an error occurs.r&)rmsgargskwdss r log_errorzRefactoringTool.log_errors rcH|r||z}|j|dS)zHook to log a message.N)rinforrrs rrzRefactoringTool.log_messages/  *C rcH|r||z}|j|dSrU)rdebugrs rrzRefactoringTool.log_debug s/  *C #rcdS)zTCalled with the old version, new version, and filename of a refactored file.Nr&)rold_textnew_textfilenameequals r print_outputzRefactoringTool.print_outputs  rc|D]P}tj|r||||9||||QdS)z)Refactor a list of files and directories.N)ospathisdir refactor_dir refactor_file)ritemswrite doctests_only dir_or_files rrefactorzRefactoringTool.refactorsn! F FKw}}[)) F!!+umDDDD"";}EEEE  F Frctjdz}tj|D]\}}}|d||||D]w}|ds`tj|d|kr7tj||} | | ||xd|D|dd<dS)zDescends down a directory and refactor every Python file found. Python files are assumed to have a .py extension. Files and subdirectories starting with '.' are skipped. pyzDescending into %srNrc<g|]}|d|SrM)r)rOdns rrRz0RefactoringTool.refactor_dir..2s)KKK" c8J8JK2KKKrN) rextsepwalkrrrrsplitextrr) rdir_namerrpy_extdirpathdirnames filenamesrfullnames rrzRefactoringTool.refactor_dir sT!,.GH,=,= L L (GXy NN/ 9 9 9 MMOOO NN   ! G G,,GG$$T**1-77!w||GT::H&&x FFFKKKKKHQQQKK L Lrc t|d}n/#t$r"}|d||Yd}~dSd}~wwxYw tj|jd}|n#|wxYwtj|d|d5}||fcdddS#1swxYwYdS) zG Do our best to decode a Python source file correctly. rbzCan't open %s: %sNNNrr5rencodingnewline) openOSErrorrrdetect_encodingrfcloserdread)rrferrrs r_read_python_sourcez#RefactoringTool._read_python_source4s" Xt$$AA    NN.# > > >:::::  / ;;A>H GGIIIIAGGIIII WXsXr B B B &a6688X% & & & & & & & & & & & & & & & & & &s. ?:?A77B (C  CCc||\}}|dS|dz }|rl|d||||}|js||kr||||||dS|d|dS|||}|js |r7|jr0|t|dd|||dS|d|dS)zRefactors a file.N zRefactoring doctests in %szNo doctest changes in %sr)rrzNo changes in %s)rrrefactor_docstringr~processed_filerefactor_string was_changedstr)rrrrinputroutputtrees rrzRefactoringTool.refactor_fileDs@228<<x = F    = NN7 B B B,,UH==F) EVu__##FHeUHMMMMM98DDDDD''x88D) =d =t7G =##CIIcrcNH*/($DDDDD18<<<<}|d||jj |Yd}~|j|j_dSd}~wwxYw |j|j_n#|j|j_wxYw||_ | d|| |||S)aFRefactor a given input string. Args: data: a string holding the code to be refactored. name: a human-readable name for use in error/log messages. Returns: An AST corresponding to the refactored input stream; None if there were errors during the parse. r|zCan't parse %s: %s: %sNzRefactoring %s) rvr !python_grammar_no_print_statementrr parse_stringr3r __class__r#future_featuresr refactor_tree)rdatarrsrrs rrzRefactoringTool.refactor_string[s +400 x ' '"("JDK  /;++D11DD    NN3!7 > > > FFF"&,DK       #',DK  $,DK  . . . .' '... 4&&& s/AB$ B"B 2B$ BB$$B7ctj}|rh|d||d}|js||kr||d|dS|ddS||d}|js |r-|jr&|t|d|dS|ddS)NzRefactoring doctests in stdinzzNo doctest changes in stdinzNo changes in stdin) sysstdinrrrr~rrrr)rrrrrs rrefactor_stdinzRefactoringTool.refactor_stdinvs     6 NN: ; ; ;,,UI>>F) >Vu__##FIu=====<=====''y99D) 6d 6t7G 6##CIIy%@@@@@455555rct|j|jD]}|||||j|||j||j| }t| r|jj D]}||vr||r|| tjjd|jr+|| tjjt'||D]8}|||vr||| t+|n#t,$rYEwxYw|jr ||jvrZ||}|r|||}||||D]*}|jsg|_|j|+|j| }|D],} | |vrg|| <|| || -:t| t|j|jD]}||||jS)aRefactors a parse tree (modifying the tree in place). For compatible patterns the bottom matcher module is used. Otherwise the tree is traversed node-to-node for matches. Args: tree: a pytree.Node instance representing the root of the tree to be refactored. name: a human-readable name for this tree. Returns: True if the tree was modified, False otherwise. T)rreverser)rrr start_tree traverse_byrrrrunleavesanyr@rrr Basedepthkeep_line_order get_linenor;remover ValueErrorfixers_appliedmatch transformreplacerrB finish_treer) rrrrG match_setnoderesultsnew new_matchesfxrs rr zRefactoringTool.refactor_trees% 4>4?;; ) )E   T4 ( ( ( ( 14>>3C3CDDD 2DOO4E4EFFFGKK .. )""$$%%/ L. L. LI%%)E*:%e$))fk.?)NNN,J"%(--&+2H-III $Yu%5 6 6$L$L9U#333%e,33D999%%dOOOO)%%%%H%  .%5D%A>@(;$($7$>$>u$E$E$E$E/3gkk#**,,.G.G +6!L!LC+.)+;+;79 #$-cN$9$9+c:J$K$K$K$K_)""$$%%/ Lb4>4?;; * *E   dD ) ) ) )sF%% F21F2c|sdS|D]X}||jD]H}||}|r/|||}||||}IYdS)aTraverse an AST, applying a set of fixers to each node. This is a helper method for refactor_tree(). Args: fixers: a list of fixer instances. traversal: a generator that yields AST nodes. Returns: None N)r,rrr)rr traversalr"rGr#r$s rrzRefactoringTool.traverse_bys  F # #D * # #++d++#//$88C S)))"  # # #rc^|j||||d}|dS||k}||||||r|d||jsdS|r|||||dS|d|dS)zR Called when a file has been refactored and there may be changes. NrzNo changes to %szNot writing changes to %s)rrrrrr~ write_file)rrrrrrrs rrzRefactoringTool.processed_files (###  //99!>>   NN-x 8 8 8-   B OOHh( C C C C C NN6 A A A A Arc tj|d|d}n/#t$r"}|d||Yd}~dSd}~wwxYw|5 ||n.#t$r!}|d||Yd}~nd}~wwxYwdddn #1swxYwY|d|d|_dS) zWrites a string to a file. It first shows a unified diff between the old text and the new text, and then rewrites the file; the latter is only done if the write option is set. wrrzCan't create %s: %sNzCan't write %s: %szWrote changes to %sT)rdrrrrrr)rrrrrfprs rr*zRefactoringTool.write_filesX 32FFFBB    NN0(C @ @ @ FFFFF  D D D"""" D D D3XsCCCCCCCC D D D D D D D D D D D D D D D D ,h777 sP AAA BA$#B$ B.B B BBB"%B"z>>> z... c g}d}d}d}d}|dD])}|dz }||jrW|+|||||||}|g}||j} |d| }|V|||jzs#|||jzdzkr| ||+||||||d}d}| |+|+||||||d |S)aRefactors a docstring, looking for doctests. This returns a modified version of the input string. It looks for doctests, which start with a ">>>" prompt, and may be continued with "..." prompts, as long as the "..." is indented the same as the ">>>". (Unfortunately we can't use the doctest module's parser, since, like most parsers, it is not geared towards preserving the original source.) NrTkeependsrrr) splitlineslstriprPS1rBrefactor_doctestfindPS2rstriprr) rrrresultblock block_linenoindentlinenolineis rrz"RefactoringTool.refactor_docstrings $$d$33 $ $D aKF{{}}''11 $$MM$"7"7|8>#J#JKKK% IIdh''bqb$??6DH#455%6DHOO$5$55<<< T""""$MM$"7"7|8>#J#JKKK d####   MM$//|06BB C C Cwwvrc ||}n#t$r}jtjr.|D]+}d|d,d|||j j ||cYd}~Sd}~wwxYw ||rt| d}|d|dz ||dz d}} | dg|dz zks J| |dds|dxxdz cc<jz|d zg}|r|fd |Dz }|S) zRefactors one doctest. A doctest is given as a block of lines, the first of which starts with ">>>" (possibly indented), while the remaining lines start with "..." (identically indented). z Source: %srz+Can't parse docstring in %s line %s: %s: %sNTr/rrrc*g|]}jz|zSr&)r6)rOr=r;rs rrRz4RefactoringTool.refactor_doctest..^s%CCCt&48+d2CCCr) parse_blockr3r isEnabledForrDEBUGrr7rrr#r rr1endswithr3pop) rr9r<r;rrrr=r$clippeds ` ` rr4z RefactoringTool.refactor_doctestDs ##E66::DD   {'' 66 D!DDDNN<T1B1BCCCC NNH#VS]-CS J J JLLLLLL     dH - - Dd))&&&55Cyqy>3vaxyy>SGtfq11117111r7##D)) B4dh&34E DCCCCCsCCCC s B'A6B"B'"B'c6|jrd}nd}|js|d|n5|d||jD]}|||jr4|d|jD]}|||jrut |jdkr|dn(|dt |j|jD]\}}}|j|g|Ri|dSdS) Nwerez need to bezNo files %s modified.zFiles that %s modified:z$Warnings/messages while refactoring:rzThere was 1 error:zThere were %d errors:)rrrrrr)rrHfilemessagerrrs r summarizezRefactoringTool.summarizeask : DDDz '   4d ; ; ; ;   6 = = =  ' '  &&&& > *   C D D D> * *  )))) ; 54;1$$  !56666  !8#dk:J:JKKK#'; 5 5T4  4t444t4444  5 5  5 5rc|j||||}t|_|S)zParses a block into a tree. This is necessary to get correct line number / offset information in the parser diagnostics and embedded into the parse tree. )r parse_tokens wrap_toksrgr)rr9r<r;rs rrAzRefactoringTool.parse_blockxs: {''uff(M(MNN({{ rc#Ktj|||j}|D]+\}}\}}\} } } ||dz z }| |dz z } ||||f| | f| fV,dS)z;Wraps a tokenize stream to systematically modify start/end.rN)rrc gen_lines__next__) rr9r<r;rAr,ruline0col0line1col1 line_texts rrNzRefactoringTool.wrap_tokss)$..*G*G*PQQDJ G G @D%% y VaZ E VaZ E t}udmYF F F F F G Grc#K||jz}||jz}|}|D]h}||r|t|dVn5||dzkrdVnt d|d||}i dV)zGenerates lines as expected by tokenize from a list of lines. This strips the first len(indent + self.PS1) characters off each line. Nrzline=z , prefix=Tr)r3r6rrr7AssertionError)rr9r;prefix1prefix2prefixr=s rrPzRefactoringTool.gen_liness 48#48#  Dv&& L3v;;<<(((((4/// $nTTT66%JKKKFF HHH rr)FF)F)NFNrU)r#r$r%rrrrrrrrrrrrrrrr rrr*r3r6rr4rKrArNrPr&rrr{r{s+0).2799LK3L3L3L3Ln&5&5&5P     FFFFLLLL(&&& ====.66666 M M M ^###.GL $BBBB** C C)))V:555. G G Grr{ceZdZdS)MultiprocessingUnsupportedNr"r&rrr]r]r'rr]cBeZdZfdZ dfd ZfdZfdZxZS)MultiprocessRefactoringToolcdtt|j|i|d|_d|_dSrU)superr_rqueue output_lockrrkwargsrs rrz$MultiprocessRefactoringTool.__init__s;9)40094J6JJJ rFrc|dkr*tt|||S ddln#t$rt wxYwjtd_ _ fdt|D} |D]}| tt|||j t|D]}jd|D]*}|r| +d_dS#j t|D]}jd|D]*}|r| +d_wxYw)Nrrz already doing multiple processescFg|]}jS))target)Process_child)rOr>multiprocessingrs rrRz8MultiprocessRefactoringTool.refactor..s<444%,,DK,@@444r)rar_rrk ImportErrorr]rb RuntimeError JoinableQueueLockrcrangestartrputis_alive) rrrr num_processes processesr6r>rkrs ` @rrz$MultiprocessRefactoringTool.refactors/ A  4d;;DDum-- - - " " " " " - - -, , - : !ABB B$2244 *//1144444#M22444     -t 4 4 = =eU>K M M M JOO   =)) % % t$$$$  ::<<FFHHHDJJJ JOO   =)) % % t$$$$  ::<<FFHHHDJ    s:A 4AE22A;G-c4|j}|{|\}} tt|j|i||jn#|jwxYw|j}|ydSdSrU)rbrrar_r task_done)rtaskrrers rrjz"MultiprocessRefactoringTool._childsz~~LD& 'F1488F%#%%% $$&&&& $$&&&&:>>##Ds AA8c|j|j||fdStt|j|i|SrU)rbrrrar_rrds rrz)MultiprocessRefactoringTool.refactor_filesV : ! JNND&> * * * * *I54d;;I!!! !r)FFr)r#r$r%rrrjr __classcell__)rs@rr_r_s     :? : $ $ $ $ $!!!!!!!!!rr_)T)#ry __author__rdrrr rrr9 itertoolsrpgen2rrr fixer_utilrrr r r rrr3r!r/rJrSrWrvrxobjectr{r]r_r&rrrs3   +*********!!!!!!            CCC82@@@%%%P''''''''FFFFFfFFFR        4!4!4!4!4!/4!4!4!4!4!rPKG13]67y22*__pycache__/refactor.cpython-311.opt-1.pycnu[ !A?hsk@dZdZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZddlmZddlmZmZdd lmZdd ZGd d eZdZdZdZdZdZGddeZGddeZ GddeZ!Gdde Z"dS)zRefactoring framework. Used as a main program, this can refactor any number of files and/or recursively descend down directories. Imported as a module, this provides infrastructure to write your own refactoring tool. z#Guido van Rossum N)chain)drivertokenizetoken) find_root)pytreepygram) btm_matcherTct|ggdg}g}tj|jD]<\}}}|dr!|r |dd}||=|S)zEReturn a sorted list of all available fix names in the given package.*fix_N) __import__pkgutil iter_modules__path__ startswithappend) fixer_pkg remove_prefixpkg fix_namesfindernameispkgs =/opt/alt/python-internal/lib64/python3.11/lib2to3/refactor.pyget_all_fix_namesrs YB . .CI&3CLAA##e ??6 " " # ABBx   T " " " ceZdZdS) _EveryNodeN__name__ __module__ __qualname__rrr!r!+Drr!ct|tjtjfr|jt |jhSt|tjr"|jrt|jSt t|tj rAt}|jD])}|D]$}| t|%*|Std|z)zf Accepts a pytree Pattern Node and returns a set of the pattern types which will match first. Nz$Oh no! I don't understand pattern %s) isinstancer NodePattern LeafPatterntyper!NegatedPatterncontent_get_head_typesWildcardPatternsetupdate Exception)patrpxs rr/r//s#*F,>?@@ 8  z#v,-- ; 0"3;// /#v-.. EE - -A - -++,,,, - :SA B BBrcZtjt}g}|D]}|jr[ t |j}|D]}|||?#t $r||Y`wxYw|j!||j|||ttj j tj j D]}|||t|S)z^ Accepts a list of fixers and returns a dictionary of head node type --> fixer list. ) collections defaultdictlistpatternr/rr! _accept_typerr python_grammar symbol2numbervaluestokensextenddict) fixer_list head_nodeseveryfixerheads node_types r_get_headnode_dictrJKsL(..J E $ $ = $ 8' 66"'88Iy)0077778 $ $ $ U##### $ !-5-.55e<<<< U####60>EEGG!0799,, 9$$U++++   sAA?>A?c<fdtdDS)zN Return the fully qualified names for fixers in the package pkg_name. c g|] }dz|z S.r&).0fix_namepkg_names r z+get_fixers_from_package..hs8 @ @ @ sNX % @ @ @rF)r)rQs`rget_fixers_from_packagerSds@ @ @ @ @-h>> @ @ @@rc|SNr&)objs r _identityrWks Jrchd}tjtj|jfd}t t jtjt j h}t} |\}}||vr|t j kr|rnd}n|t j kr|dkr|\}}|t j ks|dkrn|\}}|t j ks|dkrn|\}}|t j kr|dkr |\}}|t j krV|||\}}|t j ks|dkrn|\}}|t j kVnn n#t$rYnwxYwt |S) NFcBt}|d|dfS)Nrr)next)tokgens radvancez(_detect_future_features..advancers 3ii1vs1v~rTfrom __future__import(,)rgenerate_tokensioStringIOreadline frozensetrNEWLINENLCOMMENTr1STRINGNAMEOPadd StopIteration)sourcehave_docstringr]ignorefeaturestpvaluer\s @r_detect_future_featuresrvosN  "2;v#6#6#? @ @C x{EMB C CFuuH   IBV||u|##!!%uz!!evoo#GII E##u '<'<#GII E##u'8'8#GII E>>esll ' IBEJ&&LL''' ' IBUX~~# ' IB EJ&&3 4      X  s3D!F F"!F"ceZdZdZdS) FixerErrorzA fixer could not be loaded.N)r#r$r%__doc__r&rrrxrxs&&&&rrxceZdZddddZdZdZddZdZdZd Z d Z d Z dd Z dd Z dZddZdZd dZdZdZ d!dZd"dZdZdZdZdZdZdZdZdZdS)#RefactoringToolF)print_function exec_functionwrite_unchanged_filesFixrNcP||_|pg|_|j|_||j|t j|_|jdr|jj d=n|jdr |jj d=|j d|_ g|_ tjd|_g|_d|_t%j|jt(j|j |_|\|_|_g|_t5j|_g|_g|_t?|j|jD]k}|j r|j!|$||jvr|j"|H||jvr|j"|ltG|j|_$tG|j|_%dS) zInitializer. Args: fixer_names: a list of fixers to import options: a dict with configuration. explicit: a list of fixers to run even if they are explicit. Nr|printr}execr~r{F)convertlogger)&fixersexplicit_default_optionscopyoptionsr2r r>grammarkeywordsgetr~errorslogging getLoggerr fixer_logwroterDriverr r get_fixers pre_order post_orderfilesbm BottomMatcherBM bmi_pre_orderbmi_post_orderr BM_compatible add_fixerrrJbmi_pre_order_headsbmi_post_order_heads)self fixer_namesrrrGs r__init__zRefactoringTool.__init__s"  B ,1133   L   ( ( (,1133 <( ) . %g.. \/ * . %f- &*\%5%56M%N%N" '(9::  mDL,2N+/;888 +///*;*;' "$$ 4?DN;; 2 2E" 2!!%(((($.(("))%0000$/))#**5111#5d6H#I#I $6t7J$K$K!!!rcg}g}|jD]}t|iidg}|ddd}||jr|t |jd}|d}|jdd|Dz} t||}n$#t$rtd |d|dwxYw||j |j } | jr*|jd ur!||jvr|d |!|d || jd kr|| Y| jdkr|| {td| jzt'jd} || || ||fS)aInspects the options to load the requested patterns and handlers. Returns: (pre_order, post_order), where pre_order is the list of fixers that want a pre-order AST traversal, and post_order is the list that want post-order traversal. r rNrN_c6g|]}|Sr&)title)rOr6s rrRz.RefactoringTool.get_fixers..s 5O5O5OAaggii5O5O5Orz Can't find TzSkipping optional fixer: %szAdding transformation: %sprepostzIllegal fixer order: %r run_orderkey)rrrsplitr FILE_PREFIXlensplit CLASS_PREFIXjoingetattrAttributeErrorrxrrr log_message log_debugorderroperator attrgettersort) rpre_order_fixerspost_order_fixers fix_mod_pathmodrPparts class_name fix_classrGkey_funcs rrzRefactoringTool.get_fixerss" K J JL\2rC599C#**32226H""4#344 <#C(8$9$9$:$:;NN3''E*RWW5O5O5O5O5O-P-PPJ X#C44 ! X X X jxxx!LMMSWW XIdlDN;;E~ $-t";";  55  !>III NN6 A A A{e## ''....&&!((//// !:U[!HIII&{33(+++8,,, "344s 1C!C#c)zCalled when an error occurs.r&)rmsgargskwdss r log_errorzRefactoringTool.log_errors rcH|r||z}|j|dS)zHook to log a message.N)rinforrrs rrzRefactoringTool.log_messages/  *C rcH|r||z}|j|dSrU)rdebugrs rrzRefactoringTool.log_debug s/  *C #rcdS)zTCalled with the old version, new version, and filename of a refactored file.Nr&)rold_textnew_textfilenameequals r print_outputzRefactoringTool.print_outputs  rc|D]P}tj|r||||9||||QdS)z)Refactor a list of files and directories.N)ospathisdir refactor_dir refactor_file)ritemswrite doctests_only dir_or_files rrefactorzRefactoringTool.refactorsn! F FKw}}[)) F!!+umDDDD"";}EEEE  F Frctjdz}tj|D]\}}}|d||||D]w}|ds`tj|d|kr7tj||} | | ||xd|D|dd<dS)zDescends down a directory and refactor every Python file found. Python files are assumed to have a .py extension. Files and subdirectories starting with '.' are skipped. pyzDescending into %srNrc<g|]}|d|SrM)r)rOdns rrRz0RefactoringTool.refactor_dir..2s)KKK" c8J8JK2KKKrN) rextsepwalkrrrrsplitextrr) rdir_namerrpy_extdirpathdirnames filenamesrfullnames rrzRefactoringTool.refactor_dir sT!,.GH,=,= L L (GXy NN/ 9 9 9 MMOOO NN   ! G G,,GG$$T**1-77!w||GT::H&&x FFFKKKKKHQQQKK L Lrc t|d}n/#t$r"}|d||Yd}~dSd}~wwxYw tj|jd}|n#|wxYwtj|d|d5}||fcdddS#1swxYwYdS) zG Do our best to decode a Python source file correctly. rbzCan't open %s: %sNNNrr5rencodingnewline) openOSErrorrrdetect_encodingrfcloserdread)rrferrrs r_read_python_sourcez#RefactoringTool._read_python_source4s" Xt$$AA    NN.# > > >:::::  / ;;A>H GGIIIIAGGIIII WXsXr B B B &a6688X% & & & & & & & & & & & & & & & & & &s. ?:?A77B (C  CCc||\}}|dS|dz }|rl|d||||}|js||kr||||||dS|d|dS|||}|js |r7|jr0|t|dd|||dS|d|dS)zRefactors a file.N zRefactoring doctests in %szNo doctest changes in %sr)rrzNo changes in %s)rrrefactor_docstringr~processed_filerefactor_string was_changedstr)rrrrinputroutputtrees rrzRefactoringTool.refactor_fileDs@228<<x = F    = NN7 B B B,,UH==F) EVu__##FHeUHMMMMM98DDDDD''x88D) =d =t7G =##CIIcrcNH*/($DDDDD18<<<<}|d||jj |Yd}~|j|j_dSd}~wwxYw |j|j_n#|j|j_wxYw||_ | d|| |||S)aFRefactor a given input string. Args: data: a string holding the code to be refactored. name: a human-readable name for use in error/log messages. Returns: An AST corresponding to the refactored input stream; None if there were errors during the parse. r|zCan't parse %s: %s: %sNzRefactoring %s) rvr !python_grammar_no_print_statementrr parse_stringr3r __class__r#future_featuresr refactor_tree)rdatarrsrrs rrzRefactoringTool.refactor_string[s +400 x ' '"("JDK  /;++D11DD    NN3!7 > > > FFF"&,DK       #',DK  $,DK  . . . .' '... 4&&& s/AB$ B"B 2B$ BB$$B7ctj}|rh|d||d}|js||kr||d|dS|ddS||d}|js |r-|jr&|t|d|dS|ddS)NzRefactoring doctests in stdinzzNo doctest changes in stdinzNo changes in stdin) sysstdinrrrr~rrrr)rrrrrs rrefactor_stdinzRefactoringTool.refactor_stdinvs     6 NN: ; ; ;,,UI>>F) >Vu__##FIu=====<=====''y99D) 6d 6t7G 6##CIIy%@@@@@455555rct|j|jD]}|||||j|||j||j| }t| r|jj D]}||vr||r|| tjjd|jr+|| tjjt'||D]8}|||vr||| t+|n#t,$rYEwxYw|jr ||jvrZ||}|r|||}||||D]*}|jsg|_|j|+|j| }|D],} | |vrg|| <|| || -:t| t|j|jD]}||||jS)aRefactors a parse tree (modifying the tree in place). For compatible patterns the bottom matcher module is used. Otherwise the tree is traversed node-to-node for matches. Args: tree: a pytree.Node instance representing the root of the tree to be refactored. name: a human-readable name for this tree. Returns: True if the tree was modified, False otherwise. T)rreverser)rrr start_tree traverse_byrrrrunleavesanyr@rrr Basedepthkeep_line_order get_linenor;remover ValueErrorfixers_appliedmatch transformreplacerrB finish_treer) rrrrG match_setnoderesultsnew new_matchesfxrs rr zRefactoringTool.refactor_trees% 4>4?;; ) )E   T4 ( ( ( ( 14>>3C3CDDD 2DOO4E4EFFFGKK .. )""$$%%/ L. L. LI%%)E*:%e$))fk.?)NNN,J"%(--&+2H-III $Yu%5 6 6$L$L9U#333%e,33D999%%dOOOO)%%%%H%  .%5D%A>@(;$($7$>$>u$E$E$E$E/3gkk#**,,.G.G +6!L!LC+.)+;+;79 #$-cN$9$9+c:J$K$K$K$K_)""$$%%/ Lb4>4?;; * *E   dD ) ) ) )sF%% F21F2c|sdS|D]X}||jD]H}||}|r/|||}||||}IYdS)aTraverse an AST, applying a set of fixers to each node. This is a helper method for refactor_tree(). Args: fixers: a list of fixer instances. traversal: a generator that yields AST nodes. Returns: None N)r,rrr)rr traversalr"rGr#r$s rrzRefactoringTool.traverse_bys  F # #D * # #++d++#//$88C S)))"  # # #rc^|j||||d}|dS||k}||||||r|d||jsdS|r|||||dS|d|dS)zR Called when a file has been refactored and there may be changes. NrzNo changes to %szNot writing changes to %s)rrrrrr~ write_file)rrrrrrrs rrzRefactoringTool.processed_files (###  //99!>>   NN-x 8 8 8-   B OOHh( C C C C C NN6 A A A A Arc tj|d|d}n/#t$r"}|d||Yd}~dSd}~wwxYw|5 ||n.#t$r!}|d||Yd}~nd}~wwxYwdddn #1swxYwY|d|d|_dS) zWrites a string to a file. It first shows a unified diff between the old text and the new text, and then rewrites the file; the latter is only done if the write option is set. wrrzCan't create %s: %sNzCan't write %s: %szWrote changes to %sT)rdrrrrrr)rrrrrfprs rr*zRefactoringTool.write_filesX 32FFFBB    NN0(C @ @ @ FFFFF  D D D"""" D D D3XsCCCCCCCC D D D D D D D D D D D D D D D D ,h777 sP AAA BA$#B$ B.B B BBB"%B"z>>> z... c g}d}d}d}d}|dD])}|dz }||jrW|+|||||||}|g}||j} |d| }|V|||jzs#|||jzdzkr| ||+||||||d}d}| |+|+||||||d |S)aRefactors a docstring, looking for doctests. This returns a modified version of the input string. It looks for doctests, which start with a ">>>" prompt, and may be continued with "..." prompts, as long as the "..." is indented the same as the ">>>". (Unfortunately we can't use the doctest module's parser, since, like most parsers, it is not geared towards preserving the original source.) NrTkeependsrrr) splitlineslstriprPS1rBrefactor_doctestfindPS2rstriprr) rrrresultblock block_linenoindentlinenolineis rrz"RefactoringTool.refactor_docstrings $$d$33 $ $D aKF{{}}''11 $$MM$"7"7|8>#J#JKKK% IIdh''bqb$??6DH#455%6DHOO$5$55<<< T""""$MM$"7"7|8>#J#JKKK d####   MM$//|06BB C C Cwwvrc ||}n#t$r}jtjr.|D]+}d|d,d|||j j ||cYd}~Sd}~wwxYw ||rt| d}|d|dz ||dz d}} |dds|dxxdz cc<jz|d zg}|r|fd |Dz }|S) zRefactors one doctest. A doctest is given as a block of lines, the first of which starts with ">>>" (possibly indented), while the remaining lines start with "..." (identically indented). z Source: %srz+Can't parse docstring in %s line %s: %s: %sNTr/rrrc*g|]}jz|zSr&)r6)rOr=r;rs rrRz4RefactoringTool.refactor_doctest..^s%CCCt&48+d2CCCr) parse_blockr3r isEnabledForrDEBUGrr7rrr#r rr1endswithr3pop) rr9r<r;rrrr=r$clippeds ` ` rr4z RefactoringTool.refactor_doctestDs ##E66::DD   {'' 66 D!DDDNN<T1B1BCCCC NNH#VS]-CS J J JLLLLLL     dH - - Dd))&&&55Cyqy>3vaxyy>SGr7##D)) B4dh&34E DCCCCCsCCCC s B'A6B"B'"B'c6|jrd}nd}|js|d|n5|d||jD]}|||jr4|d|jD]}|||jrut |jdkr|dn(|dt |j|jD]\}}}|j|g|Ri|dSdS) Nwerez need to bezNo files %s modified.zFiles that %s modified:z$Warnings/messages while refactoring:rzThere was 1 error:zThere were %d errors:)rrrrrr)rrHfilemessagerrrs r summarizezRefactoringTool.summarizeask : DDDz '   4d ; ; ; ;   6 = = =  ' '  &&&& > *   C D D D> * *  )))) ; 54;1$$  !56666  !8#dk:J:JKKK#'; 5 5T4  4t444t4444  5 5  5 5rc|j||||}t|_|S)zParses a block into a tree. This is necessary to get correct line number / offset information in the parser diagnostics and embedded into the parse tree. )r parse_tokens wrap_toksrgr)rr9r<r;rs rrAzRefactoringTool.parse_blockxs: {''uff(M(MNN({{ rc#Ktj|||j}|D]+\}}\}}\} } } ||dz z }| |dz z } ||||f| | f| fV,dS)z;Wraps a tokenize stream to systematically modify start/end.rN)rrc gen_lines__next__) rr9r<r;rAr,ruline0col0line1col1 line_texts rrNzRefactoringTool.wrap_tokss)$..*G*G*PQQDJ G G @D%% y VaZ E VaZ E t}udmYF F F F F G Grc#K||jz}||jz}|}|D]h}||r|t|dVn5||dzkrdVnt d|d||}i dV)zGenerates lines as expected by tokenize from a list of lines. This strips the first len(indent + self.PS1) characters off each line. Nrzline=z , prefix=Tr)r3r6rrr7AssertionError)rr9r;prefix1prefix2prefixr=s rrPzRefactoringTool.gen_liness 48#48#  Dv&& L3v;;<<(((((4/// $nTTT66%JKKKFF HHH rr)FF)F)NFNrU)r#r$r%rrrrrrrrrrrrrrrr rrr*r3r6rr4rKrArNrPr&rrr{r{s+0).2799LK3L3L3L3Ln&5&5&5P     FFFFLLLL(&&& ====.66666 M M M ^###.GL $BBBB** C C)))V:555. G G Grr{ceZdZdS)MultiprocessingUnsupportedNr"r&rrr]r]r'rr]cBeZdZfdZ dfd ZfdZfdZxZS)MultiprocessRefactoringToolcdtt|j|i|d|_d|_dSrU)superr_rqueue output_lockrrkwargsrs rrz$MultiprocessRefactoringTool.__init__s;9)40094J6JJJ rFrc|dkr*tt|||S ddln#t$rt wxYwjtd_ _ fdt|D} |D]}| tt|||j t|D]}jd|D]*}|r| +d_dS#j t|D]}jd|D]*}|r| +d_wxYw)Nrrz already doing multiple processescFg|]}jS))target)Process_child)rOr>multiprocessingrs rrRz8MultiprocessRefactoringTool.refactor..s<444%,,DK,@@444r)rar_rrk ImportErrorr]rb RuntimeError JoinableQueueLockrcrangestartrputis_alive) rrrr num_processes processesr6r>rkrs ` @rrz$MultiprocessRefactoringTool.refactors/ A  4d;;DDum-- - - " " " " " - - -, , - : !ABB B$2244 *//1144444#M22444     -t 4 4 = =eU>K M M M JOO   =)) % % t$$$$  ::<<FFHHHDJJJ JOO   =)) % % t$$$$  ::<<FFHHHDJ    s:A 4AE22A;G-c4|j}|{|\}} tt|j|i||jn#|jwxYw|j}|ydSdSrU)rbrrar_r task_done)rtaskrrers rrjz"MultiprocessRefactoringTool._childsz~~LD& 'F1488F%#%%% $$&&&& $$&&&&:>>##Ds AA8c|j|j||fdStt|j|i|SrU)rbrrrar_rrds rrz)MultiprocessRefactoringTool.refactor_filesV : ! JNND&> * * * * *I54d;;I!!! !r)FFr)r#r$r%rrrjr __classcell__)rs@rr_r_s     :? : $ $ $ $ $!!!!!!!!!rr_)T)#ry __author__rdrrr rrr9 itertoolsrpgen2rrr fixer_utilrrr r r rrr3r!r/rJrSrWrvrxobjectr{r]r_r&rrrs3   +*********!!!!!!            CCC82@@@%%%P''''''''FFFFFfFFFR        4!4!4!4!4!/4!4!4!4!4!rPKG13](׸QQ*__pycache__/__main__.cpython-311.opt-1.pycnu[ !A?hCLddlZddlmZejeddS)N)mainz lib2to3.fixes)sysrexit=/opt/alt/python-internal/lib64/python3.11/lib2to3/__main__.pyr sB o  rPKG13]^~8~~,__pycache__/fixer_base.cpython-311.opt-2.pycnu[ !A?h"l ddlZddlmZddlmZddlmZGddeZGdd eZ dS) N)PatternCompiler)pygram)does_tree_importceZdZ dZdZdZdZdZej dZ e Z dZ dZdZdZdZdZejZdZdZdZd Zd Zdd Zd ZddZdZdZdZ dS)BaseFixNrpostFcL ||_||_|dSN)optionslogcompile_pattern)selfr rs ?/opt/alt/python-internal/lib64/python3.11/lib2to3/fixer_base.py__init__zBaseFix.__init__/s/   c |j9t}||jd\|_|_dSdS)NT) with_tree)PATTERNrrpattern pattern_tree)rPCs rrzBaseFix.compile_pattern;sX < # ""B.0.@.@KO/A/Q/Q +DL$+++ $ #rc ||_dSr )filename)rrs r set_filenamezBaseFix.set_filenameFs ! rcF d|i}|j||o|S)Nnode)rmatchrrresultss rrz BaseFix.matchMs/ 4.|!!$00 B"DN HOO04=@ A A A      rc |}|}d|_d}||||fz|r||dSdS)NzLine %d: could not convert: %s) get_linenocloneprefixr3)rrreasonlineno for_outputmsgs rcannot_convertzBaseFix.cannot_convertzs| ""ZZ\\  .  33444  %   V $ $ $ $ $ % %rcd |}|d||fzdS)Nz Line %d: %s)r6r3)rrr9r:s rwarningzBaseFix.warnings< "" &&)99:::::rc |j|_||tjd|_d|_dS)NrT)r'r itertoolscountr*r0rtreers r start_treezBaseFix.start_treesB / (### q)) rc dSr rCs r finish_treezBaseFix.finish_trees r)r%r )!__name__ __module__ __qualname__rrrr rrArBr*setr'orderexplicit run_order _accept_typekeep_line_order BM_compatiblerpython_symbolssymsrrrrr$r.r3r=r?rErHrGrrrrs,GGLGHioa  GJ EHILOM  D    Q Q Q!!! = = =$$$    !!! % % % %;;;        rrc*eZdZ dZfdZdZxZS)ConditionalFixNcPtt|j|d|_dSr )superrVrE _should_skip)rargs __class__s rrEzConditionalFix.start_trees+.nd##.55 rc|j|jS|jd}|d}d|dd}t ||||_|jS)N.)rYskip_onsplitjoinr)rrpkgr-s r should_skipzConditionalFix.should_skipsh   ($ $l  %%2whhs3B3x  ,S$==  r)rIrJrKr_rErc __classcell__)r[s@rrVrVsQJG!!!!!!!!!!!!rrV) rApatcomprr5r fixer_utilrobjectrrVrGrrrhs9%$$$$$((((((X X X X X fX X X v!!!!!W!!!!!rPKG13]gON'N'+__pycache__/btm_utils.cpython-311.opt-2.pycnu[ !A?h& ddlmZddlmZmZddlmZmZeZeZ ej Z eZ dZ dZdZGddeZd d Zd Zd Zd S))pytree)grammartoken)pattern_symbolspython_symbolsc0eZdZ ddZdZdZdZdZdS)MinNodeNch||_||_g|_d|_d|_g|_g|_dS)NF)typenamechildrenleafparent alternativesgroup)selfrrs >/opt/alt/python-internal/lib64/python3.11/lib2to3/btm_utils.py__init__zMinNode.__init__s8      cZt|jdzt|jzS)N )strrr)rs r__repr__zMinNode.__repr__s"49~~#c$)nn44rc |}g}|r^|jtkrr|j|t |jt |jkr$t |jg}g|_|j}{|j}d}n|jtkrq|j |t |j t |jkr#t|j }g|_ |j}|j}d}n[|jtj kr"|j r||j n||j|j}|^|SN)rTYPE_ALTERNATIVESrappendlenrtupler TYPE_GROUPrget_characteristic_subpattern token_labelsNAMEr)rnodesubps r leaf_to_rootzMinNode.leaf_to_root!s_ 7! y---!((...t())S-?-???!$"3445D(*D%;D;DDyJ&& !!$'''tz??c$-&8&8888DDD!#DJ;D;DDyL---$)- DI&&&& DI&&&;DC! D rcj |D]}|}|r|cSdSr)leavesr))rlr(s rget_linear_subpatternzMinNode.get_linear_subpatternKsO   A>>##D     rc#nK |jD]}|Ed{V|js|VdSdSr)rr+)rchilds rr+zMinNode.leaves`s^7] & &E||~~ % % % % % % % %} JJJJJ  r)NN)__name__ __module__ __qualname__rrr)r-r+rrr r sj555(((T*rr Nc d}|jtjkr |jd}|jtjkrt |jdkrt |jd|}nstt}|jD]L}|j |dzr t ||}||j |Mn|jtj krt |jdkrVtt}|jD].}t ||}|r|j |/|jsd}nt |jd|}nh|jtj krRt|jdtjr1|jdjdkrt |jd|St|jdtjr|jdjdksIt |jdkr3t%|jddr|jdjdkrdSd}d}d}d }d} d } |jD]j}|jtjkrd }|}n1|jtjkrd}|} n|jtjkr|}t%|dr |jd krd} k| r6|jd} t%| dr| jdkr |jd } n |jd} | jt*jkr| jd krtt.}nt%t*| jr)tt1t*| j}ntt1t2| j}n| jt*jkr[| jd } | t8vrtt8| }nAtt*j| }n%| jtjkrt ||}|r7| jdjdkrd}n| jdjdkrnt:|r@|>|jddD].}t ||}||j |/|r||_|S)N)rr([valueTF=any')rr*+r)rsymsMatcherr Alternativesr! reduce_treer rindexr Alternativer#Unit isinstancerLeafr9hasattrDetailsRepeaterr%r&TYPE_ANYgetattrpysymsSTRINGstriptokensNotImplementedErrorr) r'rnew_noder/reducedr details_nodealternatives_node has_repeater repeater_nodehas_variable_name name_leafrs rrCrCgsH yDL  }Q yD%%% t}   " ""4=#3V<\. . .%''"111<99N&GL)/,R,RSSSHH&GFIO,L,LMMMHH ^|2 2 2?((--Dv~~"t 555" (9EEE ^t0 0 0"#4f==H  *%a(.#55'*0C77*)  6H0%.qt4 6 6%eX66&%,,W555!  Orc t|ts|St|dkr|dSg}g}gdg}d|D]}tt |drtt |fdr||Vtt |fdr|||||r|}n |r|}n|r|}t |tS) Nrr5)inforifnotNonez[]().,:c.t|tuSr)rr)xs rz/get_characteristic_subpattern..sd1ggnrc6t|to|vSrrGr)rb common_charss rrcz/get_characteristic_subpattern..sjC&8&8&NQ,=Nrc6t|to|vSrre)rb common_namess rrcz/get_characteristic_subpattern..s 1c(:(:(PqL?Pr)key)rGlistr!r<rec_testr max) subpatternssubpatterns_with_namessubpatterns_with_common_namessubpatterns_with_common_chars subpatternrfrhs @@rr$r$st k4 ( ( ;1~ $&!666L$&!L! : : x $<$<== > > :8JNNNNPPQQ :-44Z@@@@XjPPPPRRSS :-44Z@@@@'--j9994, &43 &43 { $ $ $$rc#K |D]B}t|ttfrt||Ed{V5||VCdSr)rGrjr"rk)sequence test_funcrbs rrkrksv  a$ ' ' 9-- - - - - - - - -)A,,     rr)rpgen2rrpygramrrr@rNopmaprQr%rLrr#objectr rCr$rkr3rrrzs2!!!!!!!!33333333     UUUUUfUUUnBBBBJ#%#%#%JrPKG13]=wn~~-__pycache__/btm_matcher.cpython-311.opt-2.pycnu[ !A?h dZddlZddlZddlmZddlmZddlmZGdde Z Gd d e Z ia d Z dS) z+George Boutsioukis N) defaultdict)pytree) reduce_treec4eZdZ ejZdZdS)BMNodecli|_g|_ttj|_d|_dS)N)transition_tablefixersnextrcountidcontentselfs @/opt/alt/python-internal/lib64/python3.11/lib2to3/btm_matcher.py__init__zBMNode.__init__s- " v|$$ N)__name__ __module__ __qualname__ itertoolsrrrrrrs5I IO  Errc.eZdZ dZdZdZdZdZdS) BottomMatcherct|_t|_|jg|_g|_t jd|_dS)NRefactoringTool) setmatchrrootnodesr logging getLoggerloggerrs rrzBottomMatcher.__init__sAUU HH i[  '(9:: rc |j|t|j}|}|||j}|D]}|j|dS)Nstart)r appendr pattern_treeget_linear_subpatternaddr!)rfixertreelinear match_nodes match_nodes r add_fixerzBottomMatcher.add_fixer%s  5!!!5-..++--hhvTYh77 % , ,J   $ $U + + + + , ,rc  |s|gSt|dtr\g}|dD]O}|||}|D]3}|||dd|4P|S|d|jvrt }||j|d<n|j|d}|ddr ||dd|}n|g}|S)Nrr'r) isinstancetupler,extendr r)rpatternr(r0 alternative end_nodesend next_nodes rr,zBottomMatcher.add1s'? 7N gaj% ( ( K&qz C C !HH[H>> $CCC&&txx S'A'ABBBBC qz!777"HH 5>&wqz22"271:> qrr{ ( HHWQRR[ HBB &K  rc8 |j}tt}|D]}|}|rd|_|jD]0}t |t jr|jdkr d|_n1|j dkr|j}n|j }||j vr3|j |}|j D]}|| |nV|j}|j |j jrnD||j vr2|j |}|j D]}|| ||j }||S)NT;Fr)r!rlist was_checkedchildrenr4rLeafvaluetyper r r)parent) rleavescurrent_ac_noderesultsleafcurrent_ast_nodechild node_tokenr-s rrunzBottomMatcher.runSs )d### ;# ;D# "! ;/3 ,-6E!%55%+:L:L7<(4#(A--!1!7JJ!1!6J!AAA&5&Fz&RO!0!7@@--.>????@'+iO(/;,3?<"_%EEE*9*J:*V%4%;DDE#EN112BCCCC#3#: C#! ;Drcp tdfd|jtddS)Nz digraph g{c "|jD]s}|j|}td|j|jt |t |jfz|dkrt|j|tdS)Nz%d -> %d [label=%s] //%sr)r keysprintr type_reprstrr r)node subnode_keysubnode print_nodes rrVz*BottomMatcher.print_ac..print_nodes#499;; $ $ / <0w Ik,B,BCDWDWXYZZZ!##'/*** 7####  $ $r})rPr!)rrVs @rprint_aczBottomMatcher.print_acsPF l $ $ $ $ $  49 c rN)rrrrr2r,rLrXrrrrrsf+;;; , , ,   D666p     rrctsGddlm}|jD]'\}}t |t kr |t|<(t||S)Nr)python_symbols) _type_reprspygramrZ__dict__itemsrCint setdefault)type_numrZnamevals rrQrQsq 9******(06688 9 9ID#CyyCDS!1  ! !(H 5 55r) __author__r#r collectionsrr r btm_utilsrobjectrrr[rQrrrrhsG; ######""""""V}}}}}F}}}@ 66666rPKG13]~!wsWsW,__pycache__/fixer_util.cpython-311.opt-1.pycnu[ !A?hf;dZddlmZddlmZmZddlmZddl m Z dZ dZ dZ d Zd-d Zd Zd ZdZe e fdZd.dZdZdZd-dZdZd-dZd-dZdZdZdZdZdZhdZ dZ!da"da#d a$d!a%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,d)Z-ej.ej/hZ0d-d*Z1ej/ej.ej2hZ3d+Z4d-d,Z5d S)/z1Utility functions, node construction macros, etc.)token)LeafNode)python_symbols)patcompclttj|ttjd|gS)N=)rsymsargumentrrEQUAL)keywordvalues ?/opt/alt/python-internal/lib64/python3.11/lib2to3/fixer_util.py KeywordArgrs.  $u{C00%8 : ::c6ttjdS)N()rrLPARrrLParenr  C  rc6ttjdS)N))rrRPARrrrRParenrrrc t|ts|g}t|ts d|_|g}ttj|t tjddgz|zS)zBuild an assignment statement r prefix) isinstancelistrrr atomrrr )targetsources rAssignr%su fd # # fd # #   $u{C<<<==F H HHrNc:ttj||S)zReturn a NAME leafr)rrNAME)namers rNamer)$s  D 0 0 00rcV|ttjt|ggS)zA node tuple for obj.attr)rr trailerDot)objattrs rAttrr/(s! dlSUUDM22 33rc6ttjdS)z A comma leaf,)rrCOMMArrrCommar3,s  S ! !!rc6ttjdS)zA period (.) leaf.)rrDOTrrrr,r,0s  3  rcttj||g}|r.|dttj||S)z-A parenthesised argument list, used by Call()r)rr r+clone insert_childarglist)argslparenrparennodes rArgListr?4sW  v||~~v||~~> ? ?D 7 !T$,55666 Krcjttj|t|g}|||_|S)zA function call)rr powerr?r) func_namer;rr>s rCallrC;s0  Y 6 7 7D  Krc6ttjdS)zA newline literal rrNEWLINErrrNewlinerHBs  t $ $$rc6ttjdS)z A blank linerFrrr BlankLinerKFs  r " ""rc:ttj||S)Nr)rrNUMBER)nrs rNumberrOJs  a / / //rc ttjttjd|ttjdgS)zA numeric or string subscript[])rr r+rrLBRACERBRACE) index_nodes r SubscriptrVMs=  tEL#66)#EL#668 9 99rc:ttj||S)z A string leafr)rrSTRING)stringrs rStringrZSs  fV 4 4 44rc pd|_d|_d|_ttjd}d|_ttjd}d|_||||g}|rWd|_ttjd}d|_|t t j||gt t j|t t j |g}t t j ttj d|ttj dgS)zuA list comprehension of the form [xp for fp in it if test]. If test is None, the "if test" part is omitted. rJrforinifrQrR) rrrr'appendrr comp_if listmakercomp_forr"rSrT) xpfpittestfor_leafin_leaf inner_argsif_leafinners rListComprlWs BIBIBIEJ&&HHO5:t$$GGNB,J ? uz4(($t|gt_==>>> "d4=*&E&E!F G GE  U\3//U\3//1 2 22rc@|D]}|ttjdttj|dttjddt t j|g}t t j|}|S)zO Return an import statement in the form: from package import name_leafsfromrrimport)removerrr'rr import_as_names import_from) package_name name_leafsleafchildrenimps r FromImportrxos UZ((UZc:::UZ#666T):668H t * *C Jrc l|d}|jtjkr|}n-t tj|g}|d}|r d|D}t tjt t|dt|dt tj|d||dggz|z}|j |_ |S)zfReturns an import statement and calls a method of the module: import module module.name()r-afterc6g|]}|Sr)r8).0rNs r z!ImportAndCall..s ***q***rrlparrpar) r8typer r:rrAr/r)r+r)r>resultsnamesr- newarglistrznews r ImportAndCallrs %.   C x4<YY[[ $, 66 G E +**E*** tzDqNNDqNN33T\fo++-- fo++--/001149 9 : :C CJ Jrct|tr'|jtt gkrdSt|tot |jdkot|jdt okt|jdtoKt|jdt o+|jdjdko|jdjdkS)z(Does the node represent a tuple literal?Tr~rrr)r rrvrrlenrrr>s ris_tuplers$$-FHHfhh3G"G"Gt tT " " .DM""a' .4=+T22 .4=+T22 .4=+T22  .  a &#-  .  a &#- /rc4t|tot|jdkokt|jdtoKt|jdto+|jdjdko|jdjdkS)z'Does the node represent a list literal?rr~rQrR)r rrrvrrrs ris_listrs tT " " /DM""Q& /4=+T22 /4=,d33 / a &#-  /  b!'3. 0rclttjt|t gSN)rr r"rrrs r parenthesizers#  FHHdFHH5 6 66r> allanymaxminsetsumr!tuplesorted enumeratec#^Kt||}|r|Vt||}|dSdS)alFollow an attribute chain. If you have a chain of objects where a.foo -> b, b.foo-> c, etc, use this to iterate over all objects in the chain. Iteration is terminated by getattr(x, attr) is None. Args: obj: the starting object attr: the name of the chaining attribute Yields: Each successive object in the chain. N)getattr)r-r.nexts r attr_chainrsU 3  D # tT"" #####rzefor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > z power< ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | 'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) ) trailer< '(' node=any ')' > any* > z` power< ( 'sorted' | 'enumerate' ) trailer< '(' arglist ')' > any* > FchtsMtjtatjtatjt adattt g}t |t|dD]*\}}i}|||r |d|urdS+dS)a Returns true if node is in an environment where all that is required of it is being iterable (ie, it doesn't matter if it returns a list or an iterator). See test_map_nochange in test_fixers.py for some examples and tests. Tparentr>F) pats_builtrcompile_patternp0p1p2ziprmatch)r>patternspatternrrs rin_special_contextrs   $R ( (  $R ( (  $R ( ( B|HxD()C)CDD == ) ) gfo.E.E44 5rc|j}||jtjkrdS|j}|jt jt jfvrdS|jt jkr|j d|urdS|jt j ks;|jt j kr(||jtj ks|j d|urdSdS)zG Check that something isn't an attribute or function name etc. NFr~T) prev_siblingrrr6rr funcdefclassdef expr_stmtrv parameters typedargslistr2)r>prevrs ris_probably_builtinrs  D DI22u [F {t|T]333u {dn$$);t)C)Cu {do%% [D. . .  $)u{":": OA $ & &u 4rc|_|jtjkrAt|jdkr)|jd}|jt jkr|jS|j}|_dS)zFind the indentation of *node*.NrrrJ) rr suiterrvrINDENTrr)r>indents rfind_indentationrsd   9 " "s4='9'9A'='=]1%F{el**|#{   2rc|jtjkr|S|}|jdc}|_t tj|g}||_|Sr)rr rr8rr)r>rrs r make_suitersR yDJ ::<bindings rdoes_tree_importr/s' 44'::G ==rc@|jtjtjfvS)z0Returns true if the node is an import statement.)rr import_namerrrs r is_importr7s 9)4+;< <.is_import_stmt>s4 T--,$-,$-*++ -rNr~rrorr)rrrrvrr rrrXrrrr'rxrHr9) rr(r>rroot insert_posoffsetidxnode2import_rvs r touch_importr;s--- T??Dt,,Jt}-- T~d##  &t}STT':;;  MFE!>%((  6\  Q"4=11  IC T---$--}Q$ 44 1W t' X & & T# . . .*    WtEJS'I'I'I&JKK#Hj$t'7"B"BCCCCCrc P|jD]}d}|jtjkrNt ||jdr|cSt |t |jd|}|r|}n|jtjtjfvr/t |t |jd|}|r|}nK|jtj krt |t |jd|}|r|}nt|jddD]U\}}|jtj kr;|j dkr0t |t |j|dz|}|r|}Vn|jtvr|jdj |kr|}nmt|||r|}nY|jtjkrt |||}n2|jtjkrt ||jdr|}|r|s|cSt%|r|cSdS) z Returns the node which binds variable name, otherwise None. If optional argument package is supplied, only imports will be returned. See test cases for examples.Nrrrr:r~)rvrr for_stmt_findrrif_stmt while_stmttry_stmtrrCOLONr _def_syms_is_import_bindingrrr)r(r>rchildretrNikids rrris3 "" : & &T5>!,--  T:enR.@#A#A7KKAM# ZDL$/: : :T:enR.@#A#A7KKAM# Z4= ( (T:enQ.?#@#@'JJA &'qrr(:;;&&FAsx5;..393C3C(z%.1:M/N/NPWXX Ac & Z9 $ $):)@D)H)HCC tW 5 5 CC Z4+ + +tUG44CC Z4> ) )T5>!,--     ~~  4rc|g}|rl|}|jdkr)|jtvr||jn"|jt jkr |j|kr|S|ldS)N)popr _block_symsextendrvrr'r)r(r>nodess rrrs} FE yy{{ 9s??ty ;; LL ' ' ' ' Y%* $ $t););K  4rc.|jtjkr|s|jd}|jtjkr`|jD]V}|jtjkr|jdj|kr|cS2|jtjkr|j|kr|cSWn{|jtjkr1|jd}|jtjkr |j|kr|Sn5|jtjkr |j|kr|Sn|jtj kr|r2t|jd |krdS|jd}|rtd|rdS|jtj krt||r|S|jtjkr0|jd}|jtjkr |j|kr|Sn;|jtjkr |j|kr|S|r|jtjkr|SdS)z Will return node if node will import name, or node will import * from package. None is returned otherwise. See test cases for examples. rrrNras)rr rrvdotted_as_namesdotted_as_namerrr'rrstrstriprrqimport_as_nameSTAR)r>r(rrwrlastrNs rrrs   yD$$$W$mA 8t+ + +  :!444~a(.$66# 7Z5:--%+2E2EKKK  X, , ,<#DyEJ&&4:+=+= X # # T(9(9K d& & &  s4=+,,2244??4 M!   uT1~~ 4 Vt+ + +dA +K Vt* * *JqMEzUZ''EK4,?,? Vuz ! !agooK  5:--K 4rr)NN)6__doc__pgen2rpytreerrpygramrr rJrrrrr%r)r/r3r,r?rCrHrKrOrVrZrlrxrrrrconsuming_callsrrrrrrrrrrrrrrrrrr+rrrrrrrs77******:::!!!!!! H H H1111444"""    &&((%%%###0000999 555522220&8 / / /000777...###&  &.===*D*D*DZ]DL ) ((((T|T]DL9 ''''''rPKG13]!۲44&__pycache__/main.cpython-311.opt-2.pycnu[ !A?hN. ddlmZmZddlZddlZddlZddlZddlZddlZddl m Z dZ Gdde j Z dZd d ZdS) )with_statementprint_functionN)refactorc  |}|}tj||||dddS)Nz (original)z (refactored))lineterm) splitlinesdifflib unified_diff)abfilenames 9/opt/alt/python-internal/lib64/python3.11/lib2to3/main.py diff_textsrsI/ A A  1h ,n)+ - - --c:eZdZ dfd ZdZfdZdZxZS)StdoutRefactoringToolrc  ||_||_|r.|tjs|tjz }||_||_||_tt| |||dSN) nobackups show_diffsendswithossep_input_base_dir _output_dir_append_suffixsuperr__init__) selffixersoptionsexplicitrrinput_base_dir output_dir append_suffix __class__s rr zStdoutRefactoringTool.__init__$s $#$  %."9"9"&"A"A % bf $N-%+ #T**33FGXNNNNNrcl|j|||f|jj|g|Ri|dSr)errorsappendloggererror)r!msgargskwargss r log_errorzStdoutRefactoringTool.log_errorAsJ Cv./// #/////////rc|}|jrt||jr@tj|j|t |jd}ntd|d|j|jr ||jz }||krktj |}tj |s|rtj || d|||j s|dz}tj|r< tj|n&#t $r| d|YnwxYw tj||n'#t $r| d||YnwxYwt%t&|j}||||||j st+j||||krt+j||dSdS)Nz filename z( does not start with the input_base_dir zWriting converted %s to %s.z.bakzCan't remove backup %szCan't rename %s to %s)r startswithrrpathjoinlen ValueErrorrdirnameisdirmakedirs log_messagerlexistsremoveOSErrorrenamerr write_fileshutilcopymode) r!new_textrold_textencoding orig_filenamer&backupwriter(s rr@z StdoutRefactoringTool.write_fileEsd   J""4#788 J7<<(8(0T5I1J1J1K1K(LNN!j)143G3G"IJJJ   , + +H H $ $22J7==,, ( ( J'''   :M% ' ' '~ L&Fwv&& GGIf%%%%GGG$$%=vFFFFFG L (F++++ L L L  !8(FKKKKK L+T22= h(H555~ . OFH - - - H $ $ OM8 4 4 4 4 4 % $s$-E E%$E%)E??!F#"F#c|r|d|dS|d||jrt|||} |jU|j5|D]}t |t jdddn #1swxYwYdSdS|D]}t |dS#t$rtd|dYdSwxYwdS)NzNo changes to %sz Refactored %szcouldn't encode z's diff for your terminal) r;rr output_lockprintsysstdoutflushUnicodeEncodeErrorwarn)r!oldnewrequal diff_lineslines r print_outputz"StdoutRefactoringTool.print_outputls|     / : : : : :   _h 7 7 7 'S(;;  '3!-//(2,, %d J,,.../////////////////// %/((D!$KKKK(()D"((%&&&FF  s< B<3B B<BB<BB<&B<<CC)rrr)__name__ __module__ __qualname__r r1r@rV __classcell__)r(s@rrrsBDOOOOOO:000%5%5%5%5%5NrrcBtd|tjdS)Nz WARNING: file)rKrLstderr)r.s rrPrPs$ E33 sz222222rc  tjd}|dddd|dd d gd |d ddddd|ddd gd |dddd|dddd|dddd|d d!dd"|d#dd$|d%d&dd'|d(d)dd*d+ |d,d-dd.d/d01|d2d3dd4|d5dd.d/d61d*}i}||\}}|jr"d7|d8<|jst d9d7|_|jr|js| d:|j r|js| d;|js|j rt d<|js|jr| d=|j r9td>tjD]}t||sd?S|s8td@t jAtdBt jAdCSdD|vr&d7}|jrtdEt jAdCS|jrd7|dF<|jrd7|dG<|jr t*jn t*j}t+jdH|It+jdJ}t5tj} t5fdK|jD} t5} |jrJd*} |jD]&} | dLkrd7} | dMz| z'| r| | n| }n| | }| | }tBj"#|}|r]|$tBj%s>tBj"&|stBj"'|}|jr;|(tBj%}|)dN|j|tUtW||tW| |j|j ||j|j O}|j,s|r|-nZ |||j|j.|j/n1#tj0$rtdPt jAYdSwxYw|1tetg|j,S)QNz2to3 [options] file|dir ...)usagez-dz--doctests_only store_truezFix up doctests only)actionhelpz-fz--fixr+z1Each FIX specifies a transformation; default: all)rbdefaultrcz-jz --processesstorerintzRun 2to3 concurrently)rbrdtypercz-xz--nofixz'Prevent a transformation from being runz-lz --list-fixeszList available transformationsz-pz--print-functionz0Modify the grammar so that print() is a functionz-ez--exec-functionz/Modify the grammar so that exec() is a functionz-vz --verbosezMore verbose loggingz --no-diffsz#Don't show diffs of the refactoringz-wz--writezWrite back modified filesz-nz --nobackupsFz&Don't write backups for modified filesz-oz --output-dirstrrzXPut output files in this directory instead of overwriting the input files. Requires -n.)rbrgrdrcz-Wz--write-unchanged-fileszYAlso write files even if no changes were required (useful with --output-dir); implies -w.z --add-suffixzuAppend this string to all output filenames. Requires -n if non-empty. ex: --add-suffix='3' will generate .py3 files.Twrite_unchanged_filesz&--write-unchanged-files/-W implies -w.z%Can't use --output-dir/-o without -n.z"Can't use --add-suffix without -n.z@not writing files and not printing diffs; that's not very usefulzCan't use -n without -wz2Available transformations for the -f/--fix option:rz1At least one file or directory argument required.r\zUse --help to show usage.-zCan't write to stdin.r exec_functionz%(name)s: %(message)s)formatlevelz lib2to3.mainc3(K|] }dz|zV dS).fix_N).0fix fixer_pkgs r zmain..s-LLsW,s2LLLLLLrallrpz7Output in %r will mirror the input directory %r layout.)r%r&r'z+Sorry, -j isn't supported on this platform.)4optparse OptionParser add_option parse_argsrirHrPr&rr- add_suffixno_diffs list_fixesrKrget_all_fix_namesrLr^rrlverboseloggingDEBUGINFO basicConfig getLoggersetget_fixers_from_packagenofixrsaddunion differencerr4 commonprefixrrr9r8rstripinforsortedr*refactor_stdin doctests_only processesMultiprocessingUnsupported summarizerfbool)rtr/parserrflagsr#fixnamernr, avail_fixesunwanted_fixesr$ all_presentrs requested fixer_namesr%rts` rmainrs ")F G G GF d-l1333 dGHbNPPP dM'1 '>@@@ dIhDFFF dN<;=== d.|MOOO d-lLNNN dK 1333 l<@BBB dIl6888 dM,CEEE dN7 (NOOO d5lABBB nW5"GHHH N E%%d++MGT$)-%&} ; 9 : : : >'"3> <===;'"3; 9::: =QW-Q OPPP =0W.0 ./// BCCC1)<<  G 'NNNN 1  A SSSS ) ;;;;q d{{ =  ) ; ; ; ;1'"&&!%o%_ >GMM',E 6eDDDD  ~ . .Fh6yAABBKLLLLgmLLLLLNuuH{ 0 ; 8 8Ce||"  Y03677773>LK%%h///H %%h// &&~66KW))$//N9~66rv>>9 n--9 888'..rv66 M& 8 8 8  ;  x(8(8  7#33))!,  . . .B 9            D'-1F#-////6   C:''''qq    tBI  s<'U$$*VVr) __future__rrrLrr rrArwrrrMultiprocessRefactoringToolrrPrrqrrrs65555555  ---eeeeeH@eeeN333L L L L L L rPKG13]`z;z;&__pycache__/main.cpython-311.opt-1.pycnu[ !A?hN.dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl m Z dZ Gdde j Zd Zd d ZdS) z Main program for 2to3. )with_statementprint_functionN)refactorc |}|}tj||||dddS)z%Return a unified diff of two strings.z (original)z (refactored))lineterm) splitlinesdifflib unified_diff)abfilenames 9/opt/alt/python-internal/lib64/python3.11/lib2to3/main.py diff_textsrsF A A  1h ,n)+ - - --c<eZdZdZ dfd ZdZfdZdZxZS)StdoutRefactoringToola2 A refactoring tool that can avoid overwriting its input files. Prints output to stdout. Output files can optionally be written to a different directory and or have an extra file suffix appended to their name for use in situations where you do not want to replace the input files. rc ||_||_|r.|tjs|tjz }||_||_||_tt| |||dS)aF Args: fixers: A list of fixers to import. options: A dict with RefactoringTool configuration. explicit: A list of fixers to run even if they are explicit. nobackups: If true no backup '.bak' files will be created for those files that are being refactored. show_diffs: Should diffs of the refactoring be printed to stdout? input_base_dir: The base directory for all input files. This class will strip this path prefix off of filenames before substituting it with output_dir. Only meaningful if output_dir is supplied. All files processed by refactor() must start with this path. output_dir: If supplied, all converted files will be written into this directory tree instead of input_base_dir. append_suffix: If supplied, all files output by this tool will have this appended to their filename. Useful for changing .py to .py3 for example by passing append_suffix='3'. N) nobackups show_diffsendswithossep_input_base_dir _output_dir_append_suffixsuperr__init__) selffixersoptionsexplicitrrinput_base_dir output_dir append_suffix __class__s rrzStdoutRefactoringTool.__init__$s(#$  %."9"9"&"A"A % bf $N-%+ #T**33FGXNNNNNrcl|j|||f|jj|g|Ri|dSN)errorsappendloggererror)r msgargskwargss r log_errorzStdoutRefactoringTool.log_errorAsJ Cv./// #/////////rc|}|jrt||jr@tj|j|t |jd}ntd|d|j|jr ||jz }||krktj |}tj |s|rtj || d|||j s|dz}tj|r< tj|n&#t $r| d|YnwxYw tj||n'#t $r| d||YnwxYwt%t&|j}||||||j st+j||||krt+j||dSdS)Nz filename z( does not start with the input_base_dir zWriting converted %s to %s.z.bakzCan't remove backup %szCan't rename %s to %s)r startswithrrpathjoinlen ValueErrorrdirnameisdirmakedirs log_messagerlexistsremoveOSErrorrenamerr write_fileshutilcopymode) r new_textrold_textencoding orig_filenamer%backupwriter's rr@z StdoutRefactoringTool.write_fileEsd   J""4#788 J7<<(8(0T5I1J1J1K1K(LNN!j)143G3G"IJJJ   , + +H H $ $22J7==,, ( ( J'''   :M% ' ' '~ L&Fwv&& GGIf%%%%GGG$$%=vFFFFFG L (F++++ L L L  !8(FKKKKK L+T22= h(H555~ . OFH - - - H $ $ OM8 4 4 4 4 4 % $s$-E E%$E%)E??!F#"F#c|r|d|dS|d||jrt|||} |jU|j5|D]}t |t jdddn #1swxYwYdSdS|D]}t |dS#t$rtd|dYdSwxYwdS)NzNo changes to %sz Refactored %szcouldn't encode z's diff for your terminal) r;rr output_lockprintsysstdoutflushUnicodeEncodeErrorwarn)r oldnewrequal diff_lineslines r print_outputz"StdoutRefactoringTool.print_outputls|     / : : : : :   _h 7 7 7 'S(;;  '3!-//(2,, %d J,,.../////////////////// %/((D!$KKKK(()D"((%&&&FF  s< B<3B B<BB<BB<&B<<CC)rrr) __name__ __module__ __qualname____doc__rr1r@rV __classcell__)r's@rrrsBDOOOOOO:000%5%5%5%5%5NrrcBtd|tjdS)Nz WARNING: file)rKrLstderr)r.s rrPrPs$ E33 sz222222rc  tjd}|dddd|dd d gd |d ddddd|ddd gd |dddd|dddd|dddd|d d!dd"|d#dd$|d%d&dd'|d(d)dd*d+ |d,d-dd.d/d01|d2d3dd4|d5dd.d/d61d*}i}||\}}|jr"d7|d8<|jst d9d7|_|jr|js| d:|j r|js| d;|js|j rt d<|js|jr| d=|j r9td>tjD]}t||sd?S|s8td@t jAtdBt jAdCSdD|vr&d7}|jrtdEt jAdCS|jrd7|dF<|jrd7|dG<|jr t*jn t*j}t+jdH|It+jdJ}t5tj} t5fdK|jD} t5} |jrJd*} |jD]&} | dLkrd7} | dMz| z'| r| | n| }n| | }| | }tBj"#|}|r]|$tBj%s>tBj"&|stBj"'|}|jr;|(tBj%}|)dN|j|tUtW||tW| |j|j ||j|j O}|j,s|r|-nZ |||j|j.|j/n1#tj0$rtdPt jAYdSwxYw|1tetg|j,S)QzMain program. Args: fixer_pkg: the name of a package where the fixers are located. args: optional; a list of command line arguments. If omitted, sys.argv[1:] is used. Returns a suggested exit status (0, 1, 2). z2to3 [options] file|dir ...)usagez-dz--doctests_only store_truezFix up doctests only)actionhelpz-fz--fixr+z1Each FIX specifies a transformation; default: all)rcdefaultrdz-jz --processesstorerintzRun 2to3 concurrently)rcretyperdz-xz--nofixz'Prevent a transformation from being runz-lz --list-fixeszList available transformationsz-pz--print-functionz0Modify the grammar so that print() is a functionz-ez--exec-functionz/Modify the grammar so that exec() is a functionz-vz --verbosezMore verbose loggingz --no-diffsz#Don't show diffs of the refactoringz-wz--writezWrite back modified filesz-nz --nobackupsFz&Don't write backups for modified filesz-oz --output-dirstrrzXPut output files in this directory instead of overwriting the input files. Requires -n.)rcrhrerdz-Wz--write-unchanged-fileszYAlso write files even if no changes were required (useful with --output-dir); implies -w.z --add-suffixzuAppend this string to all output filenames. Requires -n if non-empty. ex: --add-suffix='3' will generate .py3 files.Twrite_unchanged_filesz&--write-unchanged-files/-W implies -w.z%Can't use --output-dir/-o without -n.z"Can't use --add-suffix without -n.z@not writing files and not printing diffs; that's not very usefulzCan't use -n without -wz2Available transformations for the -f/--fix option:rz1At least one file or directory argument required.r]zUse --help to show usage.-zCan't write to stdin.r exec_functionz%(name)s: %(message)s)formatlevelz lib2to3.mainc3(K|] }dz|zV dS).fix_N).0fix fixer_pkgs r zmain..s-LLsW,s2LLLLLLrallrqz7Output in %r will mirror the input directory %r layout.)r$r%r&z+Sorry, -j isn't supported on this platform.)4optparse OptionParser add_option parse_argsrjrHrPr%rr- add_suffixno_diffs list_fixesrKrget_all_fix_namesrLr_rrmverboseloggingDEBUGINFO basicConfig getLoggersetget_fixers_from_packagenofixrtaddunion differencerr4 commonprefixrrr9r8rstripinforsortedr*refactor_stdin doctests_only processesMultiprocessingUnsupported summarizergbool)rur/parserrflagsr"fixnameror, avail_fixesunwanted_fixesr# all_presentrt requested fixer_namesr$rts` rmainrs  ")F G G GF d-l1333 dGHbNPPP dM'1 '>@@@ dIhDFFF dN<;=== d.|MOOO d-lLNNN dK 1333 l<@BBB dIl6888 dM,CEEE dN7 (NOOO d5lABBB nW5"GHHH N E%%d++MGT$)-%&} ; 9 : : : >'"3> <===;'"3; 9::: =QW-Q OPPP =0W.0 ./// BCCC1)<<  G 'NNNN 1  A SSSS ) ;;;;q d{{ =  ) ; ; ; ;1'"&&!%o%_ >GMM',E 6eDDDD  ~ . .Fh6yAABBKLLLLgmLLLLLNuuH{ 0 ; 8 8Ce||"  Y03677773>LK%%h///H %%h// &&~66KW))$//N9~66rv>>9 n--9 888'..rv66 M& 8 8 8  ;  x(8(8  7#33))!,  . . .B 9            D'-1F#-////6   C:''''qq    tBI  s;'U##*VVr))rZ __future__rrrLrr rrArxrrrMultiprocessRefactoringToolrrPrrrrrrs65555555  ---eeeeeH@eeeN333L L L L L L rPKG13]R;"__pycache__/pygram.cpython-311.pycnu[ !A?hdZddlZddlmZddlmZddlmZejej e dZ ejej e dZ Gd d e Zejd e ZeeZeZejd =eZejd =ejd e ZeeZdS)z&Export the Python grammar and symbols.N)token)driver)pytreez Grammar.txtzPatternGrammar.txtceZdZdZdS)Symbolscf|jD]\}}t|||dS)zInitializer. Creates an attribute for each grammar symbol (nonterminal), whose value is the symbol's type (an int >= 256). N) symbol2numberitemssetattr)selfgrammarnamesymbols ;/opt/alt/python-internal/lib64/python3.11/lib2to3/pygram.py__init__zSymbols.__init__sE $17799 ( (LD& D$ ' ' ' ' ( (N)__name__ __module__ __qualname__rrrrrs#(((((rrlib2to3printexec)__doc__ospgen2rrrpathjoindirname__file__ _GRAMMAR_FILE_PATTERN_GRAMMAR_FILEobjectrload_packaged_grammarpython_grammarpython_symbolscopy!python_grammar_no_print_statementkeywords*python_grammar_no_print_and_exec_statementpattern_grammarpattern_symbolsrrrr/sO-,  RW__X66 FF  RW__X%>%>%9;; ( ( ( ( (f ( ( (.-iGG(($2$7$7$9$9!%.w7-N-S-S-U-U*.7?.&.y:OPP'/**rPKG13]0--+__pycache__/btm_utils.cpython-311.opt-1.pycnu[ !A?h&dZddlmZddlmZmZddlmZmZeZ eZ ej Z eZ dZdZdZGdd eZdd Zd Zd Zd S)z0Utility functions used by the btm_matcher module)pytree)grammartoken)pattern_symbolspython_symbolsc2eZdZdZddZdZdZdZdZdS) MinNodezThis class serves as an intermediate representation of the pattern tree during the conversion to sets of leaf-to-root subpatternsNch||_||_g|_d|_d|_g|_g|_dS)NF)typenamechildrenleafparent alternativesgroup)selfrrs >/opt/alt/python-internal/lib64/python3.11/lib2to3/btm_utils.py__init__zMinNode.__init__s8      cZt|jdzt|jzS)N )strrr)rs r__repr__zMinNode.__repr__s"49~~#c$)nn44rc|}g}|r^|jtkrr|j|t |jt |jkr$t |jg}g|_|j}{|j}d}n|jtkrq|j |t |j t |jkr#t|j }g|_ |j}|j}d}n[|jtj kr"|j r||j n||j|j}|^|S)zInternal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a singleN)rTYPE_ALTERNATIVESrappendlenrtupler TYPE_GROUPrget_characteristic_subpattern token_labelsNAMEr)rnodesubps r leaf_to_rootzMinNode.leaf_to_root!sZ! y---!((...t())S-?-???!$"3445D(*D%;D;DDyJ&& !!$'''tz??c$-&8&8888DDD!#DJ;D;DDyL---$)- DI&&&& DI&&&;DC! D rch|D]}|}|r|cSdS)aDrives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton's capabilities, leaf_to_root merges each group into a single choice based on 'characteristic'ity, i.e. (a|b c) -> (a|b) if b more characteristic than c Returns: The most 'characteristic'(as defined by get_characteristic_subpattern) path for the compiled pattern tree. N)leavesr()rlr's rget_linear_subpatternzMinNode.get_linear_subpatternKsJ   A>>##D     rc#lK|jD]}|Ed{V|js|VdSdS)z-Generator that returns the leaves of the treeN)rr*)rchilds rr*zMinNode.leaves`s[] & &E||~~ % % % % % % % %} JJJJJ  r)NN) __name__ __module__ __qualname____doc__rrr(r,r*rrr r so555(((T*rr Nc d}|jtjkr |jd}|jtjkrt |jdkrt |jd|}nstt}|jD]L}|j |dzr t ||}||j |Mn|jtj krt |jdkrVtt}|jD].}t ||}|r|j |/|jsd}nt |jd|}nh|jtj krRt|jdtjr1|jdjdkrt |jd|St|jdtjr|jdjdksIt |jdkr3t%|jddr|jdjdkrdSd }d}d}d }d} d } |jD]j}|jtjkrd }|}n1|jtjkrd }|} n|jtjkr|}t%|dr |jd krd } k| r6|jd} t%| dr| jdkr |jd } n |jd} | jt*jkr| jd krtt.}nt%t*| jr)tt1t*| j}ntt1t2| j}n| jt*jkr[| jd} | t8vrtt8| }nAtt*j| }n%| jtjkrt ||}|r7| jdjdkrd}n| jdjdkrnt:|r@|>|jddD].}t ||}||j |/|r||_|S)z Internal function. Reduces a compiled pattern tree to an intermediate representation suitable for feeding the automaton. This also trims off any optional pattern elements(like [a], a*). N)rr([valueTF=any')rr*+r)rsymsMatcherr Alternativesr reduce_treer rindexr Alternativer"Unit isinstancerLeafr9hasattrDetailsRepeaterr$r%TYPE_ANYgetattrpysymsSTRINGstriptokensNotImplementedErrorr) r&rnew_noder.reducedr details_nodealternatives_node has_repeater repeater_nodehas_variable_name name_leafrs rrCrCgsH yDL  }Q yD%%% t}   " ""4=#3V<\. . .%''"111<99N&GL)/,R,RSSSHH&GFIO,L,LMMMHH ^|2 2 2?((--Dv~~"t 555" (9EEE ^t0 0 0"#4f==H  *%a(.#55'*0C77*)  6H0%.qt4 6 6%eX66&%,,W555!  Orct|ts|St|dkr|dSg}g}gdg}d|D]}tt |drtt |fdr||Vtt |fdr|||||r|}n |r|}n|r|}t |tS) zPicks the most characteristic from a list of linear patterns Current order used is: names > common_names > common_chars rr5)inforifnotNonez[]().,:c.t|tuSN)rr)xs rz/get_characteristic_subpattern..sd1ggnrc6t|to|vSrbrGr)rc common_charss rrdz/get_characteristic_subpattern..sjC&8&8&NQ,=Nrc6t|to|vSrbrf)rc common_namess rrdz/get_characteristic_subpattern..s 1c(:(:(PqL?Pr)key)rGlistr r<rec_testrmax) subpatternssubpatterns_with_namessubpatterns_with_common_namessubpatterns_with_common_chars subpatternrgris @@rr#r#so k4 ( ( ;1~ $&!666L$&!L! : : x $<$<== > > :8JNNNNPPQQ :-44Z@@@@XjPPPPRRSS :-44Z@@@@'--j9994, &43 &43 { $ $ $$rc#K|D]B}t|ttfrt||Ed{V5||VCdS)zPTests test_func on all items of sequence and items of included sub-iterablesN)rGrkr!rl)sequence test_funcrcs rrlrlss a$ ' ' 9-- - - - - - - - -)A,,     rrb)r2rpgen2rrpygramrrr@rNopmaprQr$rLrr"objectr rCr#rlr3rrr{s22!!!!!!!!33333333     UUUUUfUUUnBBBBJ#%#%#%JrPKG13]ZHhh(__pycache__/pytree.cpython-311.opt-2.pycnu[ !A?hFm dZddlZddlmZdZiadZGddeZGdd eZ Gd d eZ d Z Gd deZ Gdde Z Gdde ZGdde ZGdde ZdZdS)z#Guido van Rossum N)StringIOictsGddlm}|jD]'\}}t |t kr |t|<(t||S)N)python_symbols) _type_reprspygramr__dict__itemstypeint setdefault)type_numrnamevals ;/opt/alt/python-internal/lib64/python3.11/lib2to3/pytree.py type_reprrsq 9******(06688 9 9ID#CyyCDS!1  ! !(H 5 55ceZdZ dZdZdZdZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZedZedZdZdZdZejdkrdZdSdS)BaseNFc8 t|SNobject__new__clsargskwdss rrz Base.__new__1sE~~c"""rcX |j|jurtS||Sr) __class__NotImplemented_eqselfothers r__eq__z Base.__eq__6s. > 0 0! !xxrc trNotImplementedErrorr$s rr#zBase._eqBs "!rc trr)r%s rclonez Base.cloneM "!rc trr)r,s r post_orderzBase.post_orderUr.rc trr)r,s r pre_orderzBase.pre_order]r.rc> t|ts|g}g}d}|jjD]5}||ur|||d} ||6|j||j_|D]}|j|_d|_dSNFT) isinstancelistparentchildrenextendappendchanged)r%new l_childrenfoundchxs rreplacez Base.replacees=#t$$ %C +& & &BTzz?%%c***!!"%%%% )  # #A{AHH rc |}t|ts+|jsdS|jd}t|t+|jSNr)r5Leafr8linenor%nodes r get_linenozBase.get_lineno|sUGT4(( $= =#DT4(( ${rcT|jr|jd|_dSNT)r7r; was_changedr,s rr;z Base.changeds. ; " K   ! ! !rc |jrTt|jjD]<\}}||ur1|j|jj|=d|_|cS;dSdSr)r7 enumerater8r;)r%irGs rremovez Base.removes  ; $T[%9::  44<<K''))) ,Q/"&DKHHH      rc |jdSt|jjD]3\}}||ur* |jj|dzcS#t$rYdSwxYw4dS)Nr)r7rMr8 IndexErrorr%rNchilds r next_siblingzBase.next_siblings  ; 4"$+"677  HAu}} ;/!4444!   444   sA AAc |jdSt|jjD])\}}||ur |dkrdS|jj|dz cS*dSNrr)r7rMr8rRs r prev_siblingzBase.prev_siblingsz  ; 4"$+"677 1 1HAu}}6644{+AaC0000 1 1rc#RK|jD]}|Ed{VdSr)r8leavesr%rSs rrYz Base.leavessD] & &E||~~ % % % % % % % % & &rcL|jdSd|jzSrV)r7depthr,s rr\z Base.depths( ; 14;$$&&&&rc( |j}|dS|jSN)rTprefix)r%next_sibs r get_suffixzBase.get_suffixs$ $  2rrcFt|dS)Nascii)strencoder,s r__str__z Base.__str__st99##G,, ,r)__name__ __module__ __qualname__r r7r8rK was_checkedrr'__hash__r#r-r0r2rArHr;rOpropertyrTrWrYr\rbsys version_inforirrrrrs[ D FHKK### H " " """""""""".       X  1 1X 1&&&'''  &   - - - - -! rrceZdZ ddZdZdZejdkreZdZ dZ dZ d Z e d Zejd Zd Zd ZdZdS)NodeNc ||_t||_|jD] }||_ |||_|r|dd|_dSd|_dSr)r r6r8r7r`fixers_applied)r%r r8contextr`rur?s r__init__z Node.__init__sq  X -  BBII   DK  '"0"3D   "&D   rc\ |jjdt|jd|jdSN(, ))r!rjrr r8r,s r__repr__z Node.__repr__s97#~666(3333#}}}. .rc^ dtt|jSr^)joinmaprgr8r,s r __unicode__zNode.__unicode__s' wws3 ..///rrcc@ |j|jf|j|jfkSr)r r8r$s rr#zNode._eqs"- 4=)ej%.-IIIrcZ t|jd|jD|jS)Nc6g|]}|Sr)r-).0r?s r zNode.clone..s CCCr CCCrru)rsr r8rur,s rr-z Node.clones92DICCT]CCC#'#6888 8rc#\K |jD]}|Ed{V|VdSr)r8r0rZs rr0zNode.post_ordersN8] * *E'')) ) ) ) ) ) ) ) ) rc#\K |V|jD]}|Ed{VdSr)r8r2rZs rr2zNode.pre_order sR7 ] ) )E(( ( ( ( ( ( ( ( ( ) )rc: |jsdS|jdjS)Nr_rr8r`r,s rr`z Node.prefixs( } 2}Q&&rc<|jr||jd_dSdSrCrr%r`s rr`z Node.prefixs+ = -&,DM!  # # # - -rcv ||_d|j|_||j|<|dSr)r7r8r;rRs r set_childzNode.set_child s<  "& a  a rct ||_|j|||dSr)r7r8insertr;rRs r insert_childzNode.insert_child*s9   Q&&& rcr ||_|j||dSr)r7r8r:r;rZs r append_childzNode.append_child3s7   U### rNNN)rjrkrlrwr}rrprqrir#r-r0r2ror`setterrrrrrrrsrss 5 $''''2... 000 &  JJJ888  ))) ''X' ]--]-rrsceZdZ dZdZdZddgfdZdZdZe j dkreZ dZ d Z d Zd Zd Zed ZejdZdS)rDr_rNc ||\|_\|_|_||_||_|||_|dd|_dSr)_prefixrEcolumnr valueru)r%r rrvr`rus rrwz Leaf.__init__FsV   7> 4DL44;    !DL,QQQ/rcB |jjd|jd|jdSry)r!rjr rr,s rr}z Leaf.__repr__Ys/7#~666#yyy#zzz+ +rc< |jt|jzSr)r`rgrr,s rrzLeaf.__unicode___s {S__,,rrcc@ |j|jf|j|jfkSr)r rr$s rr#zLeaf._eqjs"- 4:&5:u{*CCCrcn t|j|j|j|j|jff|jS)Nr)rDr rr`rErrur,s rr-z Leaf.clonens=2DItz[4; "<=#'#6888 8rc#K|VdSrrr,s rrYz Leaf.leavests rc#K |VdSrrr,s rr0zLeaf.post_orderws8 rc#K |VdSrrr,s rr2zLeaf.pre_order{s7 rc |jSr)rr,s rr`z Leaf.prefixs |rc<|||_dSr)r;rrs rr`z Leaf.prefixs  r)rjrkrlrrErrwr}rrprqrir#r-rYr0r2ror`rrrrrDrD=s1G F F "0000&+++ --- &  DDD888 X  ]]rrDc |\}}}}|s ||jvr-t|dkr|dSt|||St|||S)Nrr)rv) number2symbollenrsrD)grraw_noder rrvr8s rconvertrss&."D%(242+++ x==A  A; D(G4444D%1111rcDeZdZ dZdZdZdZdZdZddZ ddZ dZ dS) BasePatternNc8 t|Srrrs rrzBasePattern.__new__sL~~c"""rct|j|j|jg}|r|d |d=|r|d |jjddtt|dS)Nrzr{r|) rr contentrr!rjrrrepr)r%rs rr}zBasePattern.__repr__sw$)$$dlDI> tBx'R tBx'>222DIIc$oo4N4N4N4NOOrc |Srrr,s roptimizezBasePattern.optimizes  rc |j|j|jkrdS|j5d}|i}|||sdS|r||||jr |||j<dSr4)r r _submatchupdater)r%rGresultsrs rmatchzBasePattern.matchs  9 TY$)%;%;5 < #A">>$** u "q!!!  49 !%GDI trcf t|dkrdS||d|S)NrFr)rr)r%nodesrs r match_seqzBasePattern.match_seqs5 u::??5zz%(G,,,rc#`K i}|r$||d|r d|fVdSdSdSrV)r)r%rrs rgenerate_matcheszBasePattern.generate_matchessX   TZZa!,, Q$JJJJJ    rr) rjrkrlr rrrr}rrrrrrrrrs  DG D### PPP 2----rrc&eZdZddZddZddZdS) LeafPatternNc: ||||_||_||_dSr)r rr)r%r rrs rrwzLeafPattern.__init__s.        rcj t|tsdSt|||SNF)r5rDrrr%rGrs rrzLeafPattern.match s48$%% 5  tW555rc$ |j|jkSr)rrrs rrzLeafPattern._submatchs |tz))rrr)rjrkrlrwrrrrrrrsP(6666 * * * * * *rrc"eZdZdZddZddZdS) NodePatternFNc ||@t|}t|D]!\}}t|trd|_"||_||_||_dSrJ)r6rMr5WildcardPattern wildcardsr rr)r%r rrrNitems rrwzNodePattern.__init__$sn     7mmG$W-- * *4dO44*%)DN   rc |jrTt|j|jD]7\}}|t |jkr|||dS8dSt |jt |jkrdSt |j|jD]\}}|||sdSdSNTF)rrrr8rrzipr)r%rGrcr subpatternrSs rrzNodePattern._submatchAs  > (t}EE  1DM*****q)))44+5 t|  DM 2 2 2 25!$T\4=!A!A   J##E733 uu trrr)rjrkrlrrwrrrrrr sAI:rrcNeZdZ ddedfdZdZd dZd dZdZdZ d Z d Z dS) rNrc |'ttt|}|D]}||_||_||_||_dSr)tuplerrminmaxr)r%rrrralts rrwzWildcardPattern.__init__ksY .  Cw//00G + +  rc> d}|jIt|jdkr1t|jddkr|jdd}|jdkrM|jdkrB|jt |jS|$|j|jkr|S|jdkrft|trQ|jdkrF|j|jkr6t|j|j|jz|j|jz|jS|S)Nrr)r) rrrrrrrr5r)r%rs rrzWildcardPattern.optimizes9 L $    " "s4<?';';q'@'@a+J 8q==TX]]|#" 2222%49 +G+G!**,,, HMMj_EEM Na  DI$@$@":#5#'8JN#:#'8JN#:#-?44 4 rc2 ||g|Sr)rrs rrzWildcardPattern.matchs5~~tfg...rc ||D]P\}}|t|kr8|3|||jrt |||j<dSQdSr)rrrrr6)r%rrrrs rrzWildcardPattern.match_seqs|B))%00  DAqCJJ&NN1%%%y9-1%[[ *tt  urc #0K |j^t|jdtt||jzD]#}i}|jr|d|||j<||fV$dS|jdkr||VdSttdr$tj }tt_ | |dD]$\}}|jr|d|||j<||fV%nJ#t$r=| |D]$\}}|jr|d|||j<||fV%YnwxYwttdr|t_ dSdS#ttdr |t_ wxYw)Nr bare_name getrefcountr)rrangerrrr_bare_name_matcheshasattrrpstderrr_recursive_matches RuntimeError_iterative_matches)r%rcountr save_stderrs rrz WildcardPattern.generate_matchess  < txSUTX-F-F)FGG  91#(%=AdiLQh    Y+ % %))%00 0 0 0 0 0 sM** (!j %ZZ  - $ 7 7q A A##HE1y5',VeV}$) (NNNN#  # # #!% 7 7 > >##HE1y5',VeV}$) (NNNN## #3 ..-!,CJJJ--73 ..-!,CJ,,,,s+;DE2AE E2 E  E22#Fc# K t|}d|jkrdifVg}|jD]5}t||D]"\}}||fV|||f#6|rg}|D]\}} ||kr||jkr}|jD]u}t|||dD]Z\} } | dkrOi}|| || || z|fV||| z|f[v|}|dSdSrC)rrrrr:rr) r%rnodelenrrrr new_resultsc0r0c1r1s rrz"WildcardPattern._iterative_matchess6e** ==R%KKK< ' 'C(e44 ' '1d 1v&&&& '  "K! A AB<rs3  666n-n-n-n-n-6n-n-n-`kkkkk4kkk\LLLLL4LLL\222&SSSSS&SSSl)*)*)*)*)*+)*)*)*X:::::+:::zy)y)y)y)y)ky)y)y)x     [   F%%%%%rPKG13] OO,__pycache__/fixer_util.cpython-311.opt-2.pycnu[ !A?hf; ddlmZddlmZmZddlmZddlm Z dZ dZ dZ dZ d,d Zd Zd Zd Ze e fdZd-dZdZdZd,dZdZd,dZd,dZdZdZdZdZdZhdZdZ da!da"da#d a$d!Z%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,ej-ej.hZ/d,d)Z0ej.ej-ej1hZ2d*Z3d,d+Z4d S).)token)LeafNode)python_symbols)patcompclttj|ttjd|gS)N=)rsymsargumentrrEQUAL)keywordvalues ?/opt/alt/python-internal/lib64/python3.11/lib2to3/fixer_util.py KeywordArgrs.  $u{C00%8 : ::c6ttjdS)N()rrLPARrrLParenr  C  rc6ttjdS)N))rrRPARrrrRParenrrrc  t|ts|g}t|ts d|_|g}ttj|t tjddgz|zS)N r prefix) isinstancelistrrr atomrrr )targetsources rAssignr%sx' fd # # fd # #   $u{C<<<==F H HHrNc< ttj||SNr)rrNAME)namers rNamer*$s  D 0 0 00rcX |ttjt|ggSN)rr trailerDot)objattrs rAttrr1(s$# dlSUUDM22 33rc8 ttjdS)N,)rrCOMMArrrCommar5,s  S ! !!rc8 ttjdS)N.)rrDOTrrrr.r.0s  3  rc ttj||g}|r.|dttj||S)Nr)rr r-clone insert_childarglist)argslparenrparennodes rArgListrA4sZ7  v||~~v||~~> ? ?D 7 !T$,55666 Krcl ttj|t|g}|||_|Sr,)rr powerrAr) func_namer=rr@s rCallrE;s3  Y 6 7 7D  Krc8 ttjdS)N rrNEWLINErrrNewlinerJBs  t $ $$rc8 ttjdS)NrHrrr BlankLinerMFs  r " ""rc:ttj||Sr')rrNUMBER)nrs rNumberrQJs  a / / //rc  ttjttjd|ttjdgS)N[])rr r-rrLBRACERBRACE) index_nodes r SubscriptrXMs@'  tEL#66)#EL#668 9 99rc< ttj||Sr')rrSTRING)stringrs rStringr\Ss  fV 4 4 44rc r d|_d|_d|_ttjd}d|_ttjd}d|_||||g}|rWd|_ttjd}d|_|t t j||gt t j|t t j |g}t t j ttj d|ttj dgS)NrLrforinifrSrT) rrrr(appendrr comp_if listmakercomp_forr"rUrV) xpfpittestfor_leafin_leaf inner_argsif_leafinners rListComprnWsBIBIBIEJ&&HHO5:t$$GGNB,J ? uz4(($t|gt_==>>> "d4=*&E&E!F G GE  U\3//U\3//1 2 22rcB |D]}|ttjdttj|dttjddt t j|g}t t j|}|S)Nfromrrimport)removerrr(rr import_as_names import_from) package_name name_leafsleafchildrenimps r FromImportrzos* UZ((UZc:::UZ#666T):668H t * *C Jrc n |d}|jtjkr|}n-t tj|g}|d}|r d|D}t tjt t|dt|dt tj|d||dggz|z}|j |_ |S)Nr/afterc6g|]}|Sr)r:).0rPs r z!ImportAndCall..s ***q***rrlparrpar) r:typer r<rrCr1r*r-r)r@resultsnamesr/ newarglistr|news r ImportAndCallrs %.   C x4<YY[[ $, 66 G E +**E*** tzDqNNDqNN33T\fo++-- fo++--/001149 9 : :C CJ Jrc t|tr'|jtt gkrdSt|tot |jdkot|jdt okt|jdtoKt|jdt o+|jdjdko|jdjdkS)NTrrrr)r rrxrrlenrrr@s ris_tuplers2$$-FHHfhh3G"G"Gt tT " " .DM""a' .4=+T22 .4=+T22 .4=+T22  .  a &#-  .  a &#- /rc6 t|tot|jdkokt|jdtoKt|jdto+|jdjdko|jdjdkS)NrrrSrT)r rrrxrrrs ris_listrs1 tT " " /DM""Q& /4=+T22 /4=,d33 / a &#-  /  b!'3. 0rclttjt|t gSr,)rr r"rrrs r parenthesizers#  FHHdFHH5 6 66r> allanymaxminsetsumr!tuplesorted enumeratec#`K t||}|r|Vt||}|dSdSr,)getattr)r/r0nexts r attr_chainrsZ  3  D # tT"" #####rzefor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > z power< ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' | 'any' | 'all' | 'enumerate' | (any* trailer< '.' 'join' >) ) trailer< '(' node=any ')' > any* > z` power< ( 'sorted' | 'enumerate' ) trailer< '(' arglist ')' > any* > Fcj tsMtjtatjtatjt adattt g}t |t|dD]*\}}i}|||r |d|urdS+dS)NTparentr@F) pats_builtrcompile_patternp0p1p2ziprmatch)r@patternspatternrrs rin_special_contextrs   $R ( (  $R ( (  $R ( ( B|HxD()C)CDD == ) ) gfo.E.E44 5rc |j}||jtjkrdS|j}|jt jt jfvrdS|jt jkr|j d|urdS|jt j ks;|jt j kr(||jtj ks|j d|urdSdS)NFrT) prev_siblingrrr8rr funcdefclassdef expr_stmtrx parameters typedargslistr4)r@prevrs ris_probably_builtinrs  D DI22u [F {t|T]333u {dn$$);t)C)Cu {do%% [D. . .  $)u{":": OA $ & &u 4rc |_|jtjkrAt|jdkr)|jd}|jt jkr|jS|j}|_dS)NrrrL) rr suiterrxrINDENTrr)r@indents rfind_indentationrsg)   9 " "s4='9'9A'='=]1%F{el**|#{   2rc|jtjkr|S|}|jdc}|_t tj|g}||_|Sr,)rr rr:rr)r@rrs r make_suitersR yDJ ::<.is_import_stmt>s4 T--,$-,$-*++ -rrrrqrr)rrrrxrr rrrZrrrr(rzrJr;) rr)r@rroot insert_posoffsetidxnode2import_rxs r touch_importr;s$--- T??Dt,,Jt}-- T~d##  &t}STT':;;  MFE!>%((  6\  Q"4=11  IC T---$--}Q$ 44 1W t' X & & T# . . .*    WtEJS'I'I'I&JKK#Hj$t'7"B"BCCCCCrc R |jD]}d}|jtjkrNt ||jdr|cSt |t |jd|}|r|}n|jtjtjfvr/t |t |jd|}|r|}nK|jtj krt |t |jd|}|r|}nt|jddD]U\}}|jtj kr;|j dkr0t |t |j|dz|}|r|}Vn|jtvr|jdj |kr|}nmt|||r|}nY|jtjkrt |||}n2|jtjkrt ||jdr|}|r|s|cSt%|r|cSdS)Nrrrr:r)rxrr for_stmt_findrrif_stmt while_stmttry_stmtrrCOLONr _def_syms_is_import_bindingrrr)r)r@rchildretrPikids rrris8("" : & &T5>!,--  T:enR.@#A#A7KKAM# ZDL$/: : :T:enR.@#A#A7KKAM# Z4= ( (T:enQ.?#@#@'JJA &'qrr(:;;&&FAsx5;..393C3C(z%.1:M/N/NPWXX Ac & Z9 $ $):)@D)H)HCC tW 5 5 CC Z4+ + +tUG44CC Z4> ) )T5>!,--     ~~  4rc|g}|rl|}|jdkr)|jtvr||jn"|jt jkr |j|kr|S|ldS)N)popr _block_symsextendrxrr(r)r)r@nodess rrrs} FE yy{{ 9s??ty ;; LL ' ' ' ' Y%* $ $t););K  4rc0 |jtjkr|s|jd}|jtjkr`|jD]V}|jtjkr|jdj|kr|cS2|jtjkr|j|kr|cSWn{|jtjkr1|jd}|jtjkr |j|kr|Sn5|jtjkr |j|kr|Sn|jtj kr|r2t|jd |krdS|jd}|rtd|rdS|jtj krt||r|S|jtjkr0|jd}|jtjkr |j|kr|Sn;|jtjkr |j|kr|S|r|jtjkr|SdS)Nrrrras)rr rrxdotted_as_namesdotted_as_namerrr(rtstrstriprrsimport_as_nameSTAR)r@r)rryrlastrPs rrrs) yD$$$W$mA 8t+ + +  :!444~a(.$66# 7Z5:--%+2E2EKKK  X, , ,<#DyEJ&&4:+=+= X # # T(9(9K d& & &  s4=+,,2244??4 M!   uT1~~ 4 Vt+ + +dA +K Vt* * *JqMEzUZ''EK4,?,? Vuz ! !agooK  5:--K 4rr,)NN)5pgen2rpytreerrpygramrr rLrrrrr%r*r1r5r.rArErJrMrQrXr\rnrzrrrrconsuming_callsrrrrrrrrrrrrrrrrrr-rrrrrrrs7******:::!!!!!! H H H1111444"""    &&((%%%###0000999 555522220&8 / / /000777...###&  &.===*D*D*DZ]DL ) ((((T|T]DL9 ''''''rPKG13][ݥ$__pycache__/__init__.cpython-311.pycnu[ !A?h4ddlZejdeddS)NzGlib2to3 package is deprecated and may not be able to parse Python 3.10+) stacklevel)warningswarnDeprecationWarning=/opt/alt/python-internal/lib64/python3.11/lib2to3/__init__.pyr s> Mr PKG13]0--%__pycache__/btm_utils.cpython-311.pycnu[ !A?h&dZddlmZddlmZmZddlmZmZeZ eZ ej Z eZ dZdZdZGdd eZdd Zd Zd Zd S)z0Utility functions used by the btm_matcher module)pytree)grammartoken)pattern_symbolspython_symbolsc2eZdZdZddZdZdZdZdZdS) MinNodezThis class serves as an intermediate representation of the pattern tree during the conversion to sets of leaf-to-root subpatternsNch||_||_g|_d|_d|_g|_g|_dS)NF)typenamechildrenleafparent alternativesgroup)selfrrs >/opt/alt/python-internal/lib64/python3.11/lib2to3/btm_utils.py__init__zMinNode.__init__s8      cZt|jdzt|jzS)N )strrr)rs r__repr__zMinNode.__repr__s"49~~#c$)nn44rc|}g}|r^|jtkrr|j|t |jt |jkr$t |jg}g|_|j}{|j}d}n|jtkrq|j |t |j t |jkr#t|j }g|_ |j}|j}d}n[|jtj kr"|j r||j n||j|j}|^|S)zInternal method. Returns a characteristic path of the pattern tree. This method must be run for all leaves until the linear subpatterns are merged into a singleN)rTYPE_ALTERNATIVESrappendlenrtupler TYPE_GROUPrget_characteristic_subpattern token_labelsNAMEr)rnodesubps r leaf_to_rootzMinNode.leaf_to_root!sZ! y---!((...t())S-?-???!$"3445D(*D%;D;DDyJ&& !!$'''tz??c$-&8&8888DDD!#DJ;D;DDyL---$)- DI&&&& DI&&&;DC! D rch|D]}|}|r|cSdS)aDrives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton's capabilities, leaf_to_root merges each group into a single choice based on 'characteristic'ity, i.e. (a|b c) -> (a|b) if b more characteristic than c Returns: The most 'characteristic'(as defined by get_characteristic_subpattern) path for the compiled pattern tree. N)leavesr()rlr's rget_linear_subpatternzMinNode.get_linear_subpatternKsJ   A>>##D     rc#lK|jD]}|Ed{V|js|VdSdS)z-Generator that returns the leaves of the treeN)rr*)rchilds rr*zMinNode.leaves`s[] & &E||~~ % % % % % % % %} JJJJJ  r)NN) __name__ __module__ __qualname____doc__rrr(r,r*rrr r so555(((T*rr Nc d}|jtjkr |jd}|jtjkrt |jdkrt |jd|}nstt}|jD]L}|j |dzr t ||}||j |Mn|jtj krt |jdkrVtt}|jD].}t ||}|r|j |/|jsd}nt |jd|}nh|jtj krRt|jdtjr1|jdjdkrt |jd|St|jdtjr|jdjdksIt |jdkr3t%|jddr|jdjdkrdSd }d}d}d }d} d } |jD]j}|jtjkrd }|}n1|jtjkrd }|} n|jtjkr|}t%|dr |jd krd } k| r6|jd} t%| dr| jdkr |jd } n |jd} | jt*jkr| jd krtt.}nt%t*| jr)tt1t*| j}ntt1t2| j}n| jt*jkr[| jd} | t8vrtt8| }nAtt*j| }n%| jtjkrt ||}|r7| jdjdkrd}n| jdjdkrnt:|r@|>|jddD].}t ||}||j |/|r||_|S)z Internal function. Reduces a compiled pattern tree to an intermediate representation suitable for feeding the automaton. This also trims off any optional pattern elements(like [a], a*). N)rr([valueTF=any')rr*+r)rsymsMatcherr Alternativesr reduce_treer rindexr Alternativer"Unit isinstancerLeafr9hasattrDetailsRepeaterr$r%TYPE_ANYgetattrpysymsSTRINGstriptokensNotImplementedErrorr) r&rnew_noder.reducedr details_nodealternatives_node has_repeater repeater_nodehas_variable_name name_leafrs rrCrCgsH yDL  }Q yD%%% t}   " ""4=#3V<\. . .%''"111<99N&GL)/,R,RSSSHH&GFIO,L,LMMMHH ^|2 2 2?((--Dv~~"t 555" (9EEE ^t0 0 0"#4f==H  *%a(.#55'*0C77*)  6H0%.qt4 6 6%eX66&%,,W555!  Orct|ts|St|dkr|dSg}g}gdg}d|D]}tt |drtt |fdr||Vtt |fdr|||||r|}n |r|}n|r|}t |tS) zPicks the most characteristic from a list of linear patterns Current order used is: names > common_names > common_chars rr5)inforifnotNonez[]().,:c.t|tuSN)rr)xs rz/get_characteristic_subpattern..sd1ggnrc6t|to|vSrbrGr)rc common_charss rrdz/get_characteristic_subpattern..sjC&8&8&NQ,=Nrc6t|to|vSrbrf)rc common_namess rrdz/get_characteristic_subpattern..s 1c(:(:(PqL?Pr)key)rGlistr r<rec_testrmax) subpatternssubpatterns_with_namessubpatterns_with_common_namessubpatterns_with_common_chars subpatternrgris @@rr#r#so k4 ( ( ;1~ $&!666L$&!L! : : x $<$<== > > :8JNNNNPPQQ :-44Z@@@@XjPPPPRRSS :-44Z@@@@'--j9994, &43 &43 { $ $ $$rc#K|D]B}t|ttfrt||Ed{V5||VCdS)zPTests test_func on all items of sequence and items of included sub-iterablesN)rGrkr!rl)sequence test_funcrcs rrlrlss a$ ' ' 9-- - - - - - - - -)A,,     rrb)r2rpgen2rrpygramrrr@rNopmaprQr$rLrr"objectr rCr#rlr3rrr{s22!!!!!!!!33333333     UUUUUfUUUnBBBBJ#%#%#%JrPKG13]ߣp凐"__pycache__/pytree.cpython-311.pycnu[ !A?hFmdZdZddlZddlmZdZiadZGddeZ Gd d e Z Gd d e Z d Z GddeZ Gdde ZGdde ZGdde ZGdde ZdZdS)z Python parse tree definitions. This is a very concrete parse tree; we need to keep every token and even the comments and whitespace between tokens. There's also a pattern matching implementation here. z#Guido van Rossum N)StringIOictsGddlm}|jD]'\}}t |t kr |t|<(t||S)N)python_symbols) _type_reprspygramr__dict__itemstypeint setdefault)type_numrnamevals ;/opt/alt/python-internal/lib64/python3.11/lib2to3/pytree.py type_reprrsq 9******(06688 9 9ID#CyyCDS!1  ! !(H 5 55ceZdZdZdZdZdZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZedZedZdZdZdZejdkrdZdSdS)Basez Abstract base class for Node and Leaf. This provides some default functionality and boilerplate using the template pattern. A node may be a subnode of at most one parent. NFc\|tus Jdt|S)z7Constructor that prevents Base from being instantiated.zCannot instantiate Base)robject__new__clsargskwdss rrz Base.__new__1s($ 9~~c"""rcV|j|jurtS||S)zW Compare two nodes for equality. This calls the method _eq(). ) __class__NotImplemented_eqselfothers r__eq__z Base.__eq__6s) > 0 0! !xxrct)a_ Compare two nodes for equality. This is called by __eq__ and __ne__. It is only called if the two nodes have the same type. This must be implemented by the concrete subclass. Nodes should be considered equal if they have the same structure, ignoring the prefix string and other context information. NotImplementedErrorr"s rr!zBase._eqBs "!rct)zr Return a cloned (deep) copy of self. This must be implemented by the concrete subclass. r'r#s rclonez Base.cloneM "!rct)zx Return a post-order iterator for the tree. This must be implemented by the concrete subclass. r'r*s r post_orderzBase.post_orderUr,rct)zw Return a pre-order iterator for the tree. This must be implemented by the concrete subclass. r'r*s r pre_orderzBase.pre_order]r,rc|jJt||Jt|ts|g}g}d}|jjD]N}||ur3|rJ|jj||f|||d}9||O|sJ|j||f|j||j_|D]}|j|_d|_dS)z/Replace this node with a new one in the parent.NFT)parentstr isinstancelistchildrenextendappendchanged)r#new l_childrenfoundchxs rreplacez Base.replacees{&&D &&&#t$$ %C +& & &BTzz CC4;#7s"CCCy?%%c***!!"%%%%00t}dC000u )  # #A{AHH rc|}t|ts+|jsdS|jd}t|t+|jS)z9Return the line number which generated the invocant node.Nr)r4Leafr6linenor#nodes r get_linenozBase.get_lineno|sRT4(( $= =#DT4(( ${rcT|jr|jd|_dS)NT)r2r9 was_changedr*s rr9z Base.changeds. ; " K   ! ! !rc|jrTt|jjD]<\}}||ur1|j|jj|=d|_|cS;dSdS)z Remove the node from the tree. Returns the position of the node in its parent's children before it was removed. N)r2 enumerater6r9)r#irDs rremovez Base.removes ; $T[%9::  44<<K''))) ,Q/"&DKHHH      rc|jdSt|jjD]3\}}||ur* |jj|dzcS#t$rYdSwxYw4dS)z The node immediately following the invocant in their parent's children list. If the invocant does not have a next sibling, it is None Nr)r2rIr6 IndexErrorr#rJchilds r next_siblingzBase.next_siblings ; 4"$+"677  HAu}} ;/!4444!   444   sA AAc|jdSt|jjD])\}}||ur |dkrdS|jj|dz cS*dS)z The node immediately preceding the invocant in their parent's children list. If the invocant does not have a previous sibling, it is None. Nrr)r2rIr6rNs r prev_siblingzBase.prev_siblingsu ; 4"$+"677 1 1HAu}}6644{+AaC0000 1 1rc#RK|jD]}|Ed{VdSN)r6leavesr#rOs rrUz Base.leavessD] & &E||~~ % % % % % % % % & &rcL|jdSd|jzS)Nrr)r2depthr*s rrXz Base.depths( ; 14;$$&&&&rc&|j}|dS|jS)z Return the string immediately following the invocant node. This is effectively equivalent to node.next_sibling.prefix N)rPprefix)r#next_sibs r get_suffixzBase.get_suffixs $  2rrcFt|dS)Nascii)r3encoder*s r__str__z Base.__str__st99##G,, ,r)__name__ __module__ __qualname____doc__r r2r6rG was_checkedrr%__hash__r!r+r.r0r?rEr9rKpropertyrPrRrUrXr]sys version_inforcrrrrrs` D FHKK### H " " """""""""".       X  1 1X 1&&&'''  &   - - - - -! rrceZdZdZ ddZdZdZejdkreZ dZ dZ d Z d Z ed Zejd Zd ZdZdZdS)Nodez+Concrete implementation for interior nodes.Nc|dks J|||_t||_|jD]'}|jJt |||_(|||_|r|dd|_dSd|_dS)z Initializer. Takes a type constant (a symbol number >= 256), a sequence of child nodes, and an optional context keyword argument. As a side effect, the parent pointers of the children are updated. N)r r5r6r2reprr[fixers_applied)r#r r6contextr[rrr=s r__init__z Node.__init__ss{{{D{{{ X -  B9$$d2hh$$$BII   DK  '"0"3D   "&D   rcZ|jjdt|jd|jdSz)Return a canonical string representation.(, ))rrdrr r6r*s r__repr__z Node.__repr__s6#~666(3333#}}}. .rc\dtt|jS)k Return a pretty string representation. This reproduces the input source exactly. rZ)joinmapr3r6r*s r __unicode__zNode.__unicode__s" wws3 ..///rr^c>|j|jf|j|jfkSzCompare two nodes for equality.)r r6r"s rr!zNode._eqs 4=)ej%.-IIIrcXt|jd|jD|jS)$Return a cloned (deep) copy of self.c6g|]}|Sr)r+).0r=s r zNode.clone..s CCCr CCCrrr)rnr r6rrr*s rr+z Node.clones6DICCT]CCC#'#6888 8rc#ZK|jD]}|Ed{V|VdSz*Return a post-order iterator for the tree.N)r6r.rVs rr.zNode.post_ordersK] * *E'')) ) ) ) ) ) ) ) ) rc#ZK|V|jD]}|Ed{VdSz)Return a pre-order iterator for the tree.N)r6r0rVs rr0zNode.pre_order sO ] ) )E(( ( ( ( ( ( ( ( ( ) )rc8|jsdS|jdjS)zO The whitespace and comments preceding this node in the input. rZrr6r[r*s rr[z Node.prefixs# } 2}Q&&rc<|jr||jd_dSdSNrrr#r[s rr[z Node.prefixs+ = -&,DM!  # # # - -rct||_d|j|_||j|<|dS)z Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. N)r2r6r9rNs r set_childzNode.set_child s7  "& a  a rcr||_|j|||dS)z Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. N)r2r6insertr9rNs r insert_childzNode.insert_child*s4   Q&&& rcp||_|j||dS)z Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately. N)r2r6r8r9rVs r append_childzNode.append_child3s2   U### rNNN)rdrerfrgrtrzrrkrlrcr!r+r.r0rjr[setterrrrrrrrnrns55 $''''2... 000 &  JJJ888  ))) ''X' ]--]-rrnceZdZdZdZdZdZddgfdZdZdZ e j dkre Z d Z d Zd Zd Zd ZedZejdZdS)rAz'Concrete implementation for leaf nodes.rZrNcd|cxkrdks nJ|||\|_\|_|_||_||_|||_|dd|_dS)z Initializer. Takes a type constant (a token number < 256), a string value, and an optional context keyword argument. rrpN)_prefixrBcolumnr valuerr)r#r rrsr[rrs rrtz Leaf.__init__FsrD3  7> 4DL44;    !DL,QQQ/rc@|jjd|jd|jdSrv)rrdr rr*s rrzz Leaf.__repr__Ys,#~666#yyy#zzz+ +rc:|jt|jzS)r|)r[r3rr*s rrzLeaf.__unicode___s {S__,,rr^c>|j|jf|j|jfkSr)r rr"s rr!zLeaf._eqjs 4:&5:u{*CCCrclt|j|j|j|j|jff|jS)rr)rAr rr[rBrrrr*s rr+z Leaf.clonens:DItz[4; "<=#'#6888 8rc#K|VdSrTrr*s rrUz Leaf.leavests rc#K|VdSrrr*s rr.zLeaf.post_orderw rc#K|VdSrrr*s rr0zLeaf.pre_order{rrc|jS)zP The whitespace and comments preceding this token in the input. )rr*s rr[z Leaf.prefixs |rc<|||_dSrT)r9rrs rr[z Leaf.prefixs  r)rdrerfrgrrBrrtrzrrkrlrcr!r+rUr.r0rjr[rrrrrArA=s11G F F "0000&+++ --- &  DDD888 X  ]]rrAc|\}}}}|s ||jvr-t|dkr|dSt|||St|||S)z Convert raw node information to a Node or Leaf instance. This is passed to the parser driver which calls it whenever a reduction of a grammar rule produces a new complete node, so that the tree is build strictly bottom-up. rr)rs) number2symbollenrnrA)grraw_noder rrsr6s rconvertrsn&."D%(242+++ x==A  A; D(G4444D%1111rcFeZdZdZdZdZdZdZdZdZ d dZ d dZ dZ dS) BasePatterna A pattern is a tree matching pattern. It looks for a specific node type (token or symbol), and optionally for a specific content. This is an abstract base class. There are three concrete subclasses: - LeafPattern matches a single leaf node; - NodePattern matches a single node (usually non-leaf); - WildcardPattern matches a sequence of nodes of variable length. Nc\|tus Jdt|S)z>Constructor that prevents BasePattern from being instantiated.zCannot instantiate BasePattern)rrrrs rrzBasePattern.__new__s.+%%%'G%%%~~c"""rct|j|j|jg}|r|d |d=|r|d |jjddtt|dS)Nrwrxry) rr contentrrrdr}r~rq)r#rs rrzzBasePattern.__repr__sw$)$$dlDI> tBx'R tBx'>222DIIc$oo4N4N4N4NOOrc|S)z A subclass can define this as a hook for optimizations. Returns either self or another node with the same effect. rr*s roptimizezBasePattern.optimizes  rc|j|j|jkrdS|j5d}|i}|||sdS|r||||jr |||j<dS)a# Does this pattern exactly match a node? Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. Default implementation for non-wildcard patterns. NFT)r r _submatchupdater)r#rDresultsrs rmatchzBasePattern.matchs 9 TY$)%;%;5 < #A">>$** u "q!!!  49 !%GDI trcdt|dkrdS||d|S)z Does this pattern exactly match a sequence of nodes? Default implementation for non-wildcard patterns. rFr)rr)r#nodesrs r match_seqzBasePattern.match_seqs0 u::??5zz%(G,,,rc#^Ki}|r$||d|r d|fVdSdSdS)z} Generator yielding all matches for this pattern. Default implementation for non-wildcard patterns. rrN)r)r#rrs rgenerate_matcheszBasePattern.generate_matchessS   TZZa!,, Q$JJJJJ    rrT) rdrerfrgr rrrrzrrrrrrrrrs   DG D### PPP 2----rrc&eZdZddZddZddZdS) LeafPatternNc|d|cxkrdks nJ||,t|tsJt|||_||_||_dS)ap Initializer. Takes optional type, content, and name. The type, if given must be a token type (< 256). If not given, this matches any *leaf* node; the content may still be required. The content, if given, must be a string. If a name is given, the matching node is stored in the results dict under that key. Nrrp)r4r3rqr rr)r#r rrs rrtzLeafPattern.__init__sn  ????s?????D???  gs++ : :T']] : :+   rcht|tsdSt|||S)z*Override match() to insist on a leaf node.F)r4rArrr#rDrs rrzLeafPattern.match s1$%% 5  tW555rc"|j|jkS) Match the pattern's content to the node's children. This assumes the node type matches and self.content is not None. Returns True if it matches, False if not. If results is not None, it must be a dict which will be updated with the nodes matching named subpatterns. When returning False, the results dict may still be updated. )rrrs rrzLeafPattern._submatchs|tz))rrrT)rdrerfrtrrrrrrrsP(6666 * * * * * *rrc"eZdZdZddZddZdS) NodePatternFNcr||dks J||t|trJt|t|}t |D]B\}}t|t s J||ft|t rd|_C||_||_ ||_ dS)ad Initializer. Takes optional type, content, and name. The type, if given, must be a symbol type (>= 256). If the type is None this matches *any* single node (leaf or not), except if content is not None, in which it only matches non-leaf nodes that also match the content pattern. The content, if not None, must be a sequence of Patterns that must match the node's children exactly. If the content is given, the type must not be None. If a name is given, the matching node is stored in the results dict under that key. NrpT) r4r3rqr5rIrWildcardPattern wildcardsr rr)r#r rrrJitems rrtzNodePattern.__init__$s  3;;;;;;  !'3// > >g > >/7mmG$W-- * *4!$ 44??q$i??4dO44*%)DN   rc|jrTt|j|jD]7\}}|t |jkr|||dS8dSt |jt |jkrdSt |j|jD]\}}|||sdSdS)rNTF)rrrr6rrzipr)r#rDrcr subpatternrOs rrzNodePattern._submatchAs > (t}EE  1DM*****q)))44+5 t|  DM 2 2 2 25!$T\4=!A!A   J##E733 uu trrrT)rdrerfrrtrrrrrr sAI:rrcPeZdZdZddedfdZdZd dZd dZdZ d Z d Z d Z dS) ra A wildcard pattern can match zero or more nodes. This has all the flexibility needed to implement patterns like: .* .+ .? .{m,n} (a b c | d e | f) (...)* (...)+ (...)? (...){m,n} except it always uses non-greedy matching. Nrcvd|cxkr|cxkr tksnJ||f|sttt|}t|sJt ||D](}t|sJt |)||_||_||_||_dS)a Initializer. Args: content: optional sequence of subsequences of patterns; if absent, matches one node; if present, each subsequence is an alternative [*] min: optional minimum number of times to match, default 0 max: optional maximum number of times to match, default HUGE name: optional name assigned to this match [*] Thus, if content is [[a, b, c], [d, e], [f, g, h]] this is equivalent to (a b c | d e | f g h); if content is None, this is equivalent to '.' in regular expression terms. The min and max parameters work as follows: min=0, max=maxint: .* min=1, max=maxint: .+ min=0, max=1: .? min=1, max=1: . If content is not None, replace the dot with the parenthesized list of alternatives, e.g. (a b c | d e | f g h)* rN) HUGEtupler~rrqrminmaxr)r#rrrralts rrtzWildcardPattern.__init__ks.C&&&&3&&&&$&&&&&c &&&  Cw//00Gw<< . .g . .< + +3xx**c**x*  rc<d}|jIt|jdkr1t|jddkr|jdd}|jdkrM|jdkrB|jt |jS|$|j|jkr|S|jdkrft|trQ|jdkrF|j|jkr6t|j|j|jz|j|jz|jS|S)z+Optimize certain stacked wildcard patterns.Nrr)r) rrrrrrrr4r)r#rs rrzWildcardPattern.optimizes L $    " "s4<?';';q'@'@a+J 8q==TX]]|#" 2222%49 +G+G!**,,, HMMj_EEM Na  DI$@$@":#5#'8JN#:#'8JN#:#-?44 4 rc0||g|S)z'Does this pattern exactly match a node?)rrs rrzWildcardPattern.matchs~~tfg...rc||D]P\}}|t|kr8|3|||jrt |||j<dSQdS)z4Does this pattern exactly match a sequence of nodes?NTF)rrrrr5)r#rrrrs rrzWildcardPattern.match_seqsy))%00  DAqCJJ&NN1%%%y9-1%[[ *tt  urc #.K|j^t|jdtt||jzD]#}i}|jr|d|||j<||fV$dS|jdkr||VdSttdr$tj }tt_ | |dD]$\}}|jr|d|||j<||fV%nJ#t$r=| |D]$\}}|jr|d|||j<||fV%YnwxYwttdr|t_ dSdS#ttdr |t_ wxYw)a" Generator yielding matches for a sequence of nodes. Args: nodes: sequence of nodes Yields: (count, results) tuples where: count: the match comprises nodes[:count]; results: dict containing named submatches. Nr bare_name getrefcountr)rrangerrrr_bare_name_matcheshasattrrkstderrr_recursive_matches RuntimeError_iterative_matches)r#rcountr save_stderrs rrz WildcardPattern.generate_matchess < txSUTX-F-F)FGG  91#(%=AdiLQh    Y+ % %))%00 0 0 0 0 0 sM** (!j %ZZ  - $ 7 7q A A##HE1y5',VeV}$) (NNNN#  # # #!% 7 7 > >##HE1y5',VeV}$) (NNNN## #3 ..-!,CJJJ--73 ..-!,CJ,,,,s+;DE1AE E1E  E11#Fc#Kt|}d|jkrdifVg}|jD]5}t||D]"\}}||fV|||f#6|rg}|D]\}} ||kr||jkr}|jD]u}t|||dD]Z\} } | dkrOi}|| || || z|fV||| z|f[v|}|dSdS)z(Helper to iteratively yield the matches.rN)rrrrr8rr) r#rnodelenrrrr new_resultsc0r0c1r1s rrz"WildcardPattern._iterative_matchesse** ==R%KKK< ' 'C(e44 ' '1d 1v&&&& '  "K! A AB<rs3  666n-n-n-n-n-6n-n-n-`kkkkk4kkk\LLLLL4LLL\222&SSSSS&SSSl)*)*)*)*)*+)*)*)*X:::::+:::zy)y)y)y)y)ky)y)y)x     [   F%%%%%rPKG13](׸QQ$__pycache__/__main__.cpython-311.pycnu[ !A?hCLddlZddlmZejeddS)N)mainz lib2to3.fixes)sysrexit=/opt/alt/python-internal/lib64/python3.11/lib2to3/__main__.pyr sB o  rPKG13]4))#__pycache__/patcomp.cpython-311.pycnu[ !A?hdZdZddlZddlmZmZmZmZmZm Z ddl m Z ddl m Z Gdd e Zd ZGd d eZejejejdd ZdZdZdZdS)zPattern compiler. The grammar is taken from PatternGrammar.txt. The compiler compiles a pattern to a pytree.*Pattern instance. z#Guido van Rossum N)driverliteralstokentokenizeparsegrammar)pytree)pygramceZdZdS)PatternSyntaxErrorN)__name__ __module__ __qualname__z0PatternCompiler.compile_node..Os'GGGbD%%b))GGGrNrcg|]}|gSrr)rFas rrHz0PatternCompiler.compile_node..Rs':':':':':':rminmaxc:g|]}|SrrDrEs rrHz0PatternCompiler.compile_node..Vs'CCCrT&&r**CCCr)rPrR)r r,Matcherchildren Alternativeslenr WildcardPatternoptimize Alternative NegatedUnit compile_basicNegatedPatternUnitrEQUALr!RepeaterSTARHUGEPLUSLBRACERBRACEget_intname) r5nodealtspunitspatternrfnodesrepeatrTchildrMrNs ` rr=zPatternCompiler.compile_nodeCs] 9 ) ) )=#D 9 . . .GGGGDM##A#4FGGGD4yyA~~Aw&':':T':':':qIIIA::<<  9 - - -CCCCT]CCCE5zzQQx&wA1===A::<<  9 - - -((qrr):;;G%g..A::<< yDIN****  u::??uQx} ;;8>D!""IE u::??uRy~1CCC2YF#2#JE$$UF33  ;$)"44444HQKEzUZ''kuz))ku|++|(EL8888H //// LL!555cx==A%%,,x{33Cuaxx3!88!**,, 07)#3OOO  GL!!!rct|dksJ|d}|jtjkrHt t j|j}tj t||S|jtj kr|j}| rS|tvrtd|z|ddrtdtj t|S|dkrd}n?|ds*t!|j|d}|td|z|ddr(||djdg}nd}tj||S|jdkr||dS|jd kr8|J||d}tj|ggdd SJ|) NrrzInvalid token: %rzCan't have details for tokenany_zInvalid symbol: %r([rL)rVr rSTRINGr<r evalStringr!r LeafPattern_type_of_literalNAMEisupper TOKEN_MAPr startswithgetattrr2r=rT NodePatternrW)r5rlrmrgr!r content subpatterns rr[zPatternCompiler.compile_basics5zzQQx 9 $ $+DJ7788E%&6u&=&=uEE E Y%* $ $JE}} 9 )),-@5-HIII9M,-KLLL))E*:;;;E>>DD))#..O"4;t<>>**5844J)J<.aQGGG GdurcX|jtjksJt|jSN)r rNUMBERintr!)r5rgs rrezPatternCompiler.get_ints%yEL((((4:rr)FF)rrrr7rAr=r[rerrrr'r'&sw K K K K + + + +E"E"E"N!!!!Frr')rxrtrTOKENc|dr tjS|tjvrtj|SdS)Nr)isalpharrxr opmap)r!s rrwrwsA Qxz '-  }U##trc|\}}}}|s ||jvrtj|||Stj|||S)z9Converts raw node information to a Node or Leaf instance.)context) number2symbolr NodeLeaf)r raw_node_infor r!rrTs rr4r4sS%2"D%(947000{47;;;;{48888rcDt|Sr)r'rA)rks rrArAs    , ,W 5 55r)__doc__ __author__rpgen2rrrrrr r r Exceptionr r%objectr'rxrtrrzrwr4rArrrrs=3  EDDDDDDDDDDDDDDD        IIIIIfIIIZZ||   99966666rPKG13][ݥ*__pycache__/__init__.cpython-311.opt-1.pycnu[ !A?h4ddlZejdeddS)NzGlib2to3 package is deprecated and may not be able to parse Python 3.10+) stacklevel)warningswarnDeprecationWarning=/opt/alt/python-internal/lib64/python3.11/lib2to3/__init__.pyr s> Mr PKG13]#r&&)__pycache__/patcomp.cpython-311.opt-2.pycnu[ !A?h dZddlZddlmZmZmZmZmZmZddl m Z ddl m Z Gdde Z d ZGd d eZejejejdd Zd ZdZdZdS)z#Guido van Rossum N)driverliteralstokentokenizeparsegrammar)pytree)pygramceZdZdS)PatternSyntaxErrorN)__name__ __module__ __qualname__.0chr6s r z0PatternCompiler.compile_node..Os'GGGbD%%b))GGGrrcg|]}|gSrr)rGas rrIz0PatternCompiler.compile_node..Rs':':':':':':rminmaxc:g|]}|SrrErFs rrIz0PatternCompiler.compile_node..Vs'CCCrT&&r**CCCr)r!r-Matcherchildren Alternativeslenr WildcardPatternoptimize Alternative NegatedUnit compile_basicNegatedPatternrEQUALr"RepeaterSTARHUGEPLUSLBRACEget_intname) r6nodealtspunitspatternrenodesrepeatrUchildrNrOs ` rr>zPatternCompiler.compile_nodeCs 9 ) ) )=#D 9 . . .GGGGDM##A#4FGGGD4yyA~~Aw&':':T':':':qIIIA::<<  9 - - -CCCCT]CCCE5zzQQx&wA1===A::<<  9 - - -((qrr):;;G%g..A::<<   u::??uQx} ;;8>D!""IE u::??uRy~1CCC2YF#2#JE$$UF33  HQKEzUZ''kuz))ku|++!LL!555cx==A%%,,x{33Caxx3!88!**,, 07)#3OOO  GL!!!rc|d}|jtjkrHtt j|j}tjt||S|jtj kr|j}| rS|tvrtd|z|ddrtdtjt|S|dkrd}n?|ds*t|j|d}|td|z|ddr(||djdg}nd}tj||S|jdkr||dS|jd kr4||d}tj|ggdd SdS) NrzInvalid token: %rrzCan't have details for tokenany_zInvalid symbol: %r([rM)r!rSTRINGr=r evalStringr"r LeafPattern_type_of_literalNAMEisupper TOKEN_MAPr startswithgetattrr3r>rU NodePatternrX)r6rkrlrfr"r!content subpatterns rr\zPatternCompiler.compile_basicsQx 9 $ $+DJ7788E%&6u&=&=uEE E Y%* $ $JE}} 9 )),-@5-HIII9M,-KLLL))E*:;;;E>>DD))#..O"4;t<r\rdrrrr(r(&sw K K K K + + + +E"E"E"N!!!!Frr()rwrsNUMBERTOKENc|dr tjS|tjvrtj|SdS)Nr)isalpharrwr opmap)r"s rrvrvsA Qxz '-  }U##trc |\}}}}|s ||jvrtj|||Stj|||S)N)context) number2symbolr NodeLeaf)r raw_node_infor!r"rrUs rr5r5sVC%2"D%(947000{47;;;;{48888rcDt|Sr)r(rB)rjs rrBrBs    , ,W 5 55r) __author__rpgen2rrrrrr r r Exceptionr r&objectr(rwrsrryrvr5rBrrrrs83  EDDDDDDDDDDDDDDD        IIIIIfIIIZZ||   99966666rPKG13](׸QQ*__pycache__/__main__.cpython-311.opt-2.pycnu[ !A?hCLddlZddlmZejeddS)N)mainz lib2to3.fixes)sysrexit=/opt/alt/python-internal/lib64/python3.11/lib2to3/__main__.pyr sB o  rPKG13]{(-__pycache__/btm_matcher.cpython-311.opt-1.pycnu[ !A?hdZdZddlZddlZddlmZddlmZddlm Z Gdd e Z Gd d e Z ia d ZdS) aA bottom-up tree matching algorithm implementation meant to speed up 2to3's matching process. After the tree patterns are reduced to their rarest linear path, a linear Aho-Corasick automaton is created. The linear automaton traverses the linear paths from the leaves to the root of the AST and returns a set of nodes for further matching. This reduces significantly the number of candidate nodes.z+George Boutsioukis N) defaultdict)pytree) reduce_treec6eZdZdZejZdZdS)BMNodez?Class for a node of the Aho-Corasick automaton used in matchingcli|_g|_ttj|_d|_dS)N)transition_tablefixersnextrcountidcontentselfs @/opt/alt/python-internal/lib64/python3.11/lib2to3/btm_matcher.py__init__zBMNode.__init__s- " v|$$ N)__name__ __module__ __qualname____doc__ itertoolsrrrrrrs8II IO  Errc0eZdZdZdZdZdZdZdZdS) BottomMatcherzgThe main matcher class. After instantiating the patterns should be added using the add_fixer methodct|_t|_|jg|_g|_t jd|_dS)NRefactoringTool) setmatchrrootnodesr logging getLoggerloggerrs rrzBottomMatcher.__init__sAUU HH i[  '(9:: rc|j|t|j}|}|||j}|D]}|j|dS)zReduces a fixer's pattern tree to a linear path and adds it to the matcher(a common Aho-Corasick automaton). The fixer is appended on the matching states and called when they are reachedstartN)r appendr pattern_treeget_linear_subpatternaddr")rfixertreelinear match_nodes match_nodes r add_fixerzBottomMatcher.add_fixer%s 5!!!5-..++--hhvTYh77 % , ,J   $ $U + + + + , ,rc |s|gSt|dtr\g}|dD]O}|||}|D]3}|||dd|4P|S|d|jvrt }||j|d<n|j|d}|ddr ||dd|}n|g}|S)z5Recursively adds a linear pattern to the AC automatonrr(rN) isinstancetupler-extendr r)rpatternr)r1 alternative end_nodesend next_nodes rr-zBottomMatcher.add1s& 7N gaj% ( ( K&qz C C !HH[H>> $CCC&&txx S'A'ABBBBC qz!777"HH 5>&wqz22"271:> qrr{ ( HHWQRR[ HBB &K  rc6|j}tt}|D]}|}|rd|_|jD]0}t |t jr|jdkr d|_n1|j dkr|j}n|j }||j vr3|j |}|j D]}|| |nV|j}|j |j jrnD||j vr2|j |}|j D]}|| ||j }||S)auThe main interface with the bottom matcher. The tree is traversed from the bottom using the constructed automaton. Nodes are only checked once as the tree is retraversed. When the automaton fails, we give it one more shot(in case the above tree matches as a whole with the rejected leaf), then we break for the next leaf. There is the special case of multiple arguments(see code comments) where we recheck the nodes Args: The leaves of the AST tree to be matched Returns: A dictionary of node matches with fixers as the keys T;Fr)r"rlist was_checkedchildrenr5rLeafvaluetyper r r*parent) rleavescurrent_ac_noderesultsleafcurrent_ast_nodechild node_tokenr.s rrunzBottomMatcher.runSs )d### ;# ;D# "! ;/3 ,-6E!%55%+:L:L7<(4#(A--!1!7JJ!1!6J!AAA&5&Fz&RO!0!7@@--.>????@'+iO(/;,3?<"_%EEE*9*J:*V%4%;DDE#EN112BCCCC#3#: C#! ;Drcntdfd|jtddS)z %d [label=%s] //%sr)r keysprintr type_reprstrr r)node subnode_keysubnode print_nodes rrWz*BottomMatcher.print_ac..print_nodes#499;; $ $ / <0w Ik,B,BCDWDWXYZZZ!##'/*** 7####  $ $r}N)rQr")rrWs @rprint_aczBottomMatcher.print_acsM l $ $ $ $ $  49 c rN) rrrrrr3r-rMrYrrrrrsk++;;; , , ,   D666p     rrctsGddlm}|jD]'\}}t |t kr |t|<(t||S)Nr)python_symbols) _type_reprspygramr[__dict__itemsrDint setdefault)type_numr[namevals rrRrRsq 9******(06688 9 9ID#CyyCDS!1  ! !(H 5 55r)r __author__r$r collectionsrr r btm_utilsrobjectrrr\rRrrrrisGG; ######""""""V}}}}}F}}}@ 66666rPKG13]>$PatternGrammar3.11.13.final.0.picklenu[}( symbol2number}(MatcherM AlternativeM AlternativesMDetailsM NegatedUnitMRepeaterMUnitMu number2symbol}(MhMhMhMhMhMhMh ustates](](]KKa]KKa]KKae](](KKK Ke](KKK KKKee](]K Ka](K KKKee](]K Ka]KKa]K Ka]KKae](]KKa](KKKKKKe]KKa](KKKKe]KKa]KKae](](KKKKKKe]KKa]KKa](KKKKe]KKa]KKae](](KKKKKKKKe]KKa]KKa](KKKKKKKKe](KKKKe]KKa]KKa](KKKKKK KKe]KKa](KKKKKK eeedfas}(Mh}(KKKKKKKKKKuMh}(KKKKKKKKKKuMh}(KKKKKKKKKKuMh#}K KsMh,}KKsMh<}(KKKKKKuMhL}(KKKKKKKKuulabels](KEMPTYMNKNKNK NKnotKNKNMNMNMNKNKNKNMNKNKNKNKNKNK NKNKNMNK Nekeywords}hKstokens}(KKKKK KKKKKKK KK KK KKKKKKKKKKK KKKKKK Ku symbol2label}( AlternativesK NegatedUnitKUnitK AlternativeK DetailsKRepeaterKustartMu.PKH13]&ww.fixes/__pycache__/fix_ws_comma.cpython-311.pycnu[ !A?hBTdZddlmZddlmZddlmZGddejZdS)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|eZdZdZdZejejdZejej dZ ee fZ dZ dS) FixWsCommaTzH any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]> ,:c|}d}|jD]H}||jvr)|j}|r d|vrd|_d}4|r|j}|sd|_d}I|S)NF T )clonechildrenSEPSprefixisspace)selfnoderesultsnewcommachildrs G/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_ws_comma.py transformzFixWsComma.transformsjjll\  E !!>>##&F(:(:#%EL+"\F!+'*  N) __name__ __module__ __qualname__explicitPATTERNrLeafrCOMMACOLONrrrrrr sdHG FK S ) )E FK S ) )E 5>DrrN)__doc__r rpgen2rrBaseFixrr$rrr(s~#rPKH13]'I4fixes/__pycache__/fix_operator.cpython-311.opt-1.pycnu[ !A?hb bdZddlZddlmZddlmZmZmZm Z dZ Gddej Z dS)aFixer for operator functions. operator.isCallable(obj) -> callable(obj) operator.sequenceIncludes(obj) -> operator.contains(obj) operator.isSequenceType(obj) -> isinstance(obj, collections.abc.Sequence) operator.isMappingType(obj) -> isinstance(obj, collections.abc.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_importcfd}|S)Nc|_|SN) invocation)fss G/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_operator.pydeczinvocation..decs )r rs` rr r s# JrcneZdZdZdZdZdZdeeezZdZ e dd Z e d d Z e d d Z e ddZe ddZe ddZe ddZdZdZdZdS) FixOperatorTprez 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 > > )methodsobjcN|||}| |||SdSr ) _check_method)selfnoderesultsmethods r transformzFixOperator.transform+s7##D'22  6$(( (  rzoperator.contains(%s)c0|||dS)Ncontains_handle_renamerrrs r_sequenceIncludeszFixOperator._sequenceIncludes0s""4*===rz callable(%s)c|d}ttd|g|jS)Nrcallableprefix)rrcloner')rrrrs r _isCallablezFixOperator._isCallable4s4enD$$syy{{mDKHHHHrzoperator.mul(%s)c0|||dS)Nmulr r"s r_repeatzFixOperator._repeat9s""4%888rzoperator.imul(%s)c0|||dS)Nimulr r"s r_irepeatzFixOperator._irepeat=s""4&999rz(isinstance(%s, collections.abc.Sequence)c2|||ddS)Ncollections.abcSequence_handle_type2abcr"s r_isSequenceTypezFixOperator._isSequenceTypeAs$$T74EzRRRrz'isinstance(%s, collections.abc.Mapping)c2|||ddS)Nr1Mappingr3r"s r_isMappingTypezFixOperator._isMappingTypeEs$$T74EyQQQrzisinstance(%s, numbers.Number)c2|||ddS)NnumbersNumberr3r"s r _isNumberTypezFixOperator._isNumberTypeIs$$T7IxHHHrcX|dd}||_|dS)Nrr)valuechanged)rrrnamers rr!zFixOperator._handle_renameMs."1% rctd|||d}|tdd||gzg}t t d||jS)Nrz, . isinstancer&)rr(rjoinrrr')rrrmoduleabcrargss rr4zFixOperator._handle_type2abcRskT64(((en VD388VSM+B+B$BCCDD&&T[AAAArc t|d|ddjz}t|tjjr?d|vr|St |df}|j|z}||d|zdS)N_rrrErzYou should use '%s' here.) getattrr>rC collectionsrFCallablestrr warning)rrrrsubinvocation_strs rrzFixOperator._check_methodXssWX%6q%9%??@@ fko6 7 7 Q7"" 75>**,!'!2S!8 T#>#OPPPtrN)__name__ __module__ __qualname__ BM_compatibleorderrrdictPATTERNrr r#r)r,r/r5r8r<r!r4rrrrrrsM EG C Dc222 3G))) Z'((>>)(>ZII IZ"##99$#9Z#$$::%$:Z:;;SS<;SZ9::RR;:RZ011II21I BBB     rr) __doc__collections.abcrKlib2to3rlib2to3.fixer_utilrrrrr BaseFixrrrrr]s  ????????????GGGGG*$GGGGGrPKH13]~-fixes/__pycache__/fix_sys_exc.cpython-311.pycnu[ !A?h `dZddlmZddlmZmZmZmZmZm Z m Z Gddej 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 SubscriptNodesymscdeZdZgdZdZdddeDzZdZdS) FixSysExc)exc_type exc_value exc_tracebackTzN power< 'sys' trailer< dot='.' attribute=(%s) > > |c# K|] }d|zV dS)z'%s'N).0es F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_sys_exc.py zFixSysExc.s&::AVaZ::::::c|dd}t|j|j}t t d|j}tt d|}|dj|djd_| t|ttj ||jS)N attributeexc_info)prefixsysdot)rrindexvaluerrrrchildrenappendrr r power)selfnoderesultssys_attrr callattrs r transformzFixSysExc.transforms;'*t}**8>::;;D$$X_===DKK&&%,U^%:Q" Ie$$%%%DJT[9999rN)__name__ __module__ __qualname__r BM_compatiblejoinPATTERNr+rrrr r s]999HMHH:::::::;G:::::rr N) __doc__r fixer_utilrrrrrr r BaseFixr rrrr6sHHHHHHHHHHHHHHHHHH::::: ":::::rPKH13]} 1fixes/__pycache__/fix_set_literal.cpython-311.pycnu[ !A?hPdZddlmZmZddlmZmZGddejZdS)z: Optional fixer to transform set() calls to set literals. ) fixer_basepytree)tokensymsc eZdZdZdZdZdZdS) FixSetLiteralTajpower< 'set' trailer< '(' (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) > | single=any) ']' > | atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > ) ')' > > c|d}|rJtjtj|g}|||}n|d}tjtj dg}| d|j D| tjtj d|jj|d_tjtj|}|j|_t#|j dkr8|j d}||j|j d_|S) Nsingleitems{c3>K|]}|VdS)N)clone).0ns J/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_set_literal.py z*FixSetLiteral.transform..'s*99Qqwwyy999999})getrNoder listmakerrreplaceLeafrLBRACEextendchildrenappendRBRACE next_siblingprefix dictsetmakerlenremove) selfnoderesultsr faker literalmakerrs r transformzFixSetLiteral.transforms.X&&  %;t~ /?@@D NN4 EEG$E;u|S11299%.999999v{5<55666"/6  D-w77{  u~  ! # #q!A HHJJJ()EN2  % rN)__name__ __module__ __qualname__ BM_compatibleexplicitPATTERNr-rrrr s4MHGrrN) __doc__lib2to3rrlib2to3.fixer_utilrrBaseFixrr4rrr9sx '&&&&&&&********)))))J&)))))rPKH13]6<^rr3fixes/__pycache__/fix_has_key.cpython-311.opt-1.pycnu[ !A?h| XdZddlmZddlmZddlmZmZGddejZdS)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 parenthesizeceZdZdZdZdZdS) 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 J|j}|jj|jkr!|j|jrdS|d}|d}|j}d|dD}|d}|d} | r d| D} |j|j |j|j |j |j |j |jfvrt|}t!|dkr |d }nt#j|j|}d |_t)d d } |r-t)d d } t#j|j| | f} t#j|j || |f} | r:t| } t#j|j| ft-| z} |jj|j |j|j|j|j|j|j|j|jf vrt| } || _| S)Nnegationanchorc6g|]}|Sclone.0ns F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_has_key.py z'FixHasKey.transform..Rs 777!''))777beforeargafterc6g|]}|Sr rrs rrz'FixHasKey.transform..Vs ...1QWWYY...r in)prefixnot)symsparenttypenot_testpatternmatchgetrr comparisonand_testor_testtestlambdefargumentrlenrNodepowerrcomp_optupleexprxor_exprand_expr shift_expr arith_exprtermfactor) selfnoderesultsr r r rrrrn_opn_notnews r transformzFixHasKey.transformGsy K  - - L  t{ + + .4;;z**"77WX%6777en""$$ G$$  /.....E 8  dit}N N Ns##C v;;!  AYFF[V44F D%%%  <s+++E;t|eT];;Dk$/Cv+>??  As##C+dj3&5<<*?@@C ; DM $ t $ $ TZ 9 9 9s##C  rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr?r rrrr&s/MG<&&&&&rrN) __doc__rr fixer_utilrrBaseFixrr rrrIs:++++++++GGGGG "GGGGGrPKH13]֏6fixes/__pycache__/fix_isinstance.cpython-311.opt-2.pycnu[ !A?hHF ddlmZddlmZGddejZdS)) fixer_base)tokenc eZdZdZdZdZdZdS) FixIsinstanceTz power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > ct}|d}|j}g}t|}|D]\}} | jtjkrN| j|vrE|t|dz kr.||dzjtjkrt|gh| | | jtjkr| | j|r|djtjkr|d=t|dkr6|j } | j |d_ | |ddS||dd<|dS)Nargs)setchildren enumeratetyperNAMEvaluelenCOMMAnextappendaddparentprefixreplacechanged) selfnoderesultsnames_insertedtestlistr new_argsiteratoridxargatoms I/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_isinstance.py transformzFixIsinstance.transformsO6? T??  2 2HCx5:%%#)~*E*ETQ&&4a=+=+L+LNNN$$$8uz))"&&sy111   )U[88 x==A  ?D!%HQK  LL! % % % % %DG LLNNNNNN)__name__ __module__ __qualname__ BM_compatiblePATTERN run_orderr'r(r&rrs6MGIr(rN)r fixer_utilrBaseFixrr/r(r&r3sg$$$$$J&$$$$$r(PKH13] PL3fixes/__pycache__/fix_asserts.cpython-311.opt-1.pycnu[ !A?hpdZddlmZddlmZedddddd d dddddd d ZGddeZdS)z5Fixer that replaces deprecated unittest method names.)BaseFix)Name assertTrue assertEqualassertNotEqualassertAlmostEqualassertNotAlmostEqual assertRegexassertRaisesRegex assertRaises assertFalse)assert_ assertEqualsassertNotEqualsassertAlmostEqualsassertNotAlmostEqualsassertRegexpMatchesassertRaisesRegexpfailUnlessEqual failIfEqualfailUnlessAlmostEqualfailIfAlmostEqual failUnlessfailUnlessRaisesfailIfcXeZdZddeeezZdZdS) FixAssertszH power< any+ trailer< '.' meth=(%s)> any* > |c|dd}|ttt||jdS)Nmeth)prefix)replacerNAMESstrr")selfnoderesultsnames F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_asserts.py transformzFixAsserts.transform sBvq! T%D *4;???@@@@@N) __name__ __module__ __qualname__joinmapreprr$PATTERNr+r,r*rrsOHHSSu--../GAAAAAr,rN)__doc__ fixer_baser fixer_utilrdictr$rr4r,r*r9s;;!   $*0%*! -,#    $AAAAAAAAAAr,PKH13] s4fixes/__pycache__/fix_operator.cpython-311.opt-2.pycnu[ !A?hb ` ddlZddlmZddlmZmZmZmZdZ Gddej Z dS)N) fixer_base)CallNameString touch_importcfd}|S)Nc|_|SN) invocation)fss G/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_operator.pydeczinvocation..decs )r rs` rr r s# JrcneZdZdZdZdZdZdeeezZdZ e dd Z e d d Z e d d Z e ddZe ddZe ddZe ddZdZdZdZdS) FixOperatorTprez 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 > > )methodsobjcN|||}| |||SdSr ) _check_method)selfnoderesultsmethods r transformzFixOperator.transform+s7##D'22  6$(( (  rzoperator.contains(%s)c0|||dS)Ncontains_handle_renamerrrs r_sequenceIncludeszFixOperator._sequenceIncludes0s""4*===rz callable(%s)c|d}ttd|g|jS)Nrcallableprefix)rrcloner')rrrrs r _isCallablezFixOperator._isCallable4s4enD$$syy{{mDKHHHHrzoperator.mul(%s)c0|||dS)Nmulr r"s r_repeatzFixOperator._repeat9s""4%888rzoperator.imul(%s)c0|||dS)Nimulr r"s r_irepeatzFixOperator._irepeat=s""4&999rz(isinstance(%s, collections.abc.Sequence)c2|||ddS)Ncollections.abcSequence_handle_type2abcr"s r_isSequenceTypezFixOperator._isSequenceTypeAs$$T74EzRRRrz'isinstance(%s, collections.abc.Mapping)c2|||ddS)Nr1Mappingr3r"s r_isMappingTypezFixOperator._isMappingTypeEs$$T74EyQQQrzisinstance(%s, numbers.Number)c2|||ddS)NnumbersNumberr3r"s r _isNumberTypezFixOperator._isNumberTypeIs$$T7IxHHHrcX|dd}||_|dS)Nrr)valuechanged)rrrnamers rr!zFixOperator._handle_renameMs."1% rctd|||d}|tdd||gzg}t t d||jS)Nrz, . isinstancer&)rr(rjoinrrr')rrrmoduleabcrargss rr4zFixOperator._handle_type2abcRskT64(((en VD388VSM+B+B$BCCDD&&T[AAAArc t|d|ddjz}t|tjjr?d|vr|St |df}|j|z}||d|zdS)N_rrrErzYou should use '%s' here.) getattrr>rC collectionsrFCallablestrr warning)rrrrsubinvocation_strs rrzFixOperator._check_methodXssWX%6q%9%??@@ fko6 7 7 Q7"" 75>**,!'!2S!8 T#>#OPPPtrN)__name__ __module__ __qualname__ BM_compatibleorderrrdictPATTERNrr r#r)r,r/r5r8r<r!r4rrrrrrsM EG C Dc222 3G))) Z'((>>)(>ZII IZ"##99$#9Z#$$::%$:Z:;;SS<;SZ9::RR;:RZ011II21I BBB     rr) collections.abcrKlib2to3rlib2to3.fixer_utilrrrrr BaseFixrrrrr\s ????????????GGGGG*$GGGGGrPKH13]}5fixes/__pycache__/fix_funcattrs.cpython-311.opt-2.pycnu[ !A?hF ddlmZddlmZGddejZdS)) fixer_base)NameceZdZdZdZdZdS) FixFuncattrsTz power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' | 'func_dict') > any* > c|dd}|td|jddz|jdS)Nattrz__%s__)prefix)replacervaluer )selfnoderesultsrs H/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_funcattrs.py transformzFixFuncattrs.transformsWvq! T8djn4!%... / / / / /N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG /////rrN)r fixer_utilrBaseFixrrrrrse9 / / / / /:% / / / / /rPKH13]~1fixes/__pycache__/fix_paren.cpython-311.opt-2.pycnu[ !A?hJ ddlmZddlmZmZGddejZdS)) fixer_base)LParenRParenceZdZdZdZdZdS)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] > >) (']' | ')') > c|d}t}|j|_d|_|d||t dS)Ntarget)rprefix insert_child append_childr)selfnoderesultsr lparens D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_paren.py transformzFixParen.transform%sY"   Av&&&FHH%%%%%N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG,&&&&&rrN)r r fixer_utilrrBaseFixrrrrrsnC'''''''' & & & & &z! & & & & &rPKH13]3fixes/__pycache__/fix_nonzero.cpython-311.opt-2.pycnu[ !A?hOF ddlmZddlmZGddejZdS)) fixer_base)NameceZdZdZdZdZdS) FixNonzeroTz classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='__nonzero__' parameters< '(' NAME ')' > any+ > any* > > cl|d}td|j}||dS)Nname__bool__)prefix)rr replace)selfnoderesultsrnews F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_nonzero.py transformzFixNonzero.transforms7v:dk222 SN)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrs/MGrrN)r fixer_utilrBaseFixrrrrrse0     #     rPKH13],EE2fixes/__pycache__/fix_xrange.cpython-311.opt-2.pycnu[ !A?h Z ddlmZddlmZmZmZddlmZGddejZdS)) fixer_base)NameCallconsuming_calls)patcompceZdZdZdZfdZdZdZdZdZ dZ e j e Z d Ze j eZd ZxZS) FixXrangeTz power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > ctt|||t|_dSN)superr start_treesettransformed_xranges)selftreefilename __class__s E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_xrange.pyr zFixXrange.start_trees5 i))$999#&55   cd|_dSr )r)rrrs r finish_treezFixXrange.finish_trees#'   rc|d}|jdkr|||S|jdkr|||Stt |)Nnamexrangerange)valuetransform_xrangetransform_range ValueErrorreprrnoderesultsrs r transformzFixXrange.transformsev : ! !((w77 7 Z7 " "''g66 6T$ZZ(( (rc|d}|td|j|jt |dS)Nrrprefix)replacerr'raddidr!s rrzFixXrange.transform_xrange$sOv T'$+666777  $$RXX.....rcZt||jvr||stt d|dg}tt d|g|j}|dD]}|||SdSdS)Nrargslistr&rest)r*rin_special_contextrrcloner' append_child)rr"r# range_call list_callns rrzFixXrange.transform_range*s tHHD4 4 4''-- 5d7mmgfo.C.C.E.E-FGGJT&\\J<$(K111IV_ * *&&q))))  5 4 4 4rz3power< 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*> c |jdSi}|jjC|j|jj|r|d|ur|djtvS|j|j|o |d|uS)NFr"func)parentp1matchrrp2)rr"r#s rr/zFixXrange.in_special_context?s ; 5 K  *w}}T[/99 +v$&&6?(O; ;w}}T['22Nwv$7NNr)__name__ __module__ __qualname__ BM_compatiblePATTERNr rr$rrP1rcompile_patternr8P2r:r/ __classcell__)rs@rr r sMG )))))((()))///    ?B   $ $B B !  $ $B O O O O O O Orr N) r fixer_utilrrrrBaseFixr rrrHs64444444444=O=O=O=O=O "=O=O=O=O=OrPKH13]Y^, 6fixes/__pycache__/fix_isinstance.cpython-311.opt-1.pycnu[ !A?hHHdZddlmZddlmZGddejZdS)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 eZdZdZdZdZdZdS) FixIsinstanceTz power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > ct}|d}|j}g}t|}|D]\}} | jtjkrN| j|vrE|t|dz kr.||dzjtjkrt|gh| | | jtjkr| | j|r|djtjkr|d=t|dkr6|j } | j |d_ | |ddS||dd<|dS)Nargs)setchildren enumeratetyperNAMEvaluelenCOMMAnextappendaddparentprefixreplacechanged) selfnoderesultsnames_insertedtestlistr new_argsiteratoridxargatoms I/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_isinstance.py transformzFixIsinstance.transformsO6? T??  2 2HCx5:%%#)~*E*ETQ&&4a=+=+L+LNNN$$$8uz))"&&sy111   )U[88 x==A  ?D!%HQK  LL! % % % % %DG LLNNNNNN)__name__ __module__ __qualname__ BM_compatiblePATTERN run_orderr'r(r&rrs6MGIr(rN)__doc__r fixer_utilrBaseFixrr/r(r&r4sl$$$$$J&$$$$$r(PKH13]cc1fixes/__pycache__/fix_numliterals.cpython-311.pycnu[ !A?hTdZddlmZddlmZddlmZGddejZdS)z-Fixer that turns 1L into 1, 0755 into 0o755. )token) fixer_base)Numberc(eZdZejZdZdZdS)FixNumliteralscT|jdp|jddvS)N0Ll)value startswith)selfnodes J/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_numliterals.pymatchzFixNumliterals.matchs( %%c**Ddjn.DEc|j}|ddvr |dd}nV|drA|r-tt |dkr d|ddz}t ||jS)Nr r r 0o)prefix)r r isdigitlensetrr)rrresultsvals r transformzFixNumliterals.transformsj r7d??crc(CC ^^C  !S[[]] !s3s88}}q7H7HQRR.Cc$+....rN)__name__ __module__ __qualname__rNUMBER _accept_typerrrrrr s>r(s~ /////Z'/////rPKH13]&((,fixes/__pycache__/fix_urllib.cpython-311.pycnu[ !A?h dZddlmZmZddlmZmZmZmZm Z m Z m Z dgdfdgdfdd gfgdgd fdd d gfgd Z e d e dddZGddeZdS)zFix 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.request) URLopenerFancyURLopener urlretrieve _urlopenerurlopen urlcleanup pathname2url url2pathname getproxiesz urllib.parse)quote quote_plusunquote unquote_plus urlencode splitattr splithost splitnport splitpasswd splitport splitquerysplittag splittype splituser splitvaluez urllib.errorContentTooShortError)rinstall_opener build_openerRequestOpenerDirector BaseHandlerHTTPDefaultErrorHandlerHTTPRedirectHandlerHTTPCookieProcessor ProxyHandlerHTTPPasswordMgrHTTPPasswordMgrWithDefaultRealmAbstractBasicAuthHandlerHTTPBasicAuthHandlerProxyBasicAuthHandlerAbstractDigestAuthHandlerHTTPDigestAuthHandlerProxyDigestAuthHandler HTTPHandler HTTPSHandler FileHandler FTPHandlerCacheFTPHandlerUnknownHandlerURLError HTTPError)urlliburllib2r?r>c #Kt}tD]P\}}|D]H}|\}}t|}d|d|dVd|d|d|dVd|zVd |zVd |d |d VIQdS) Nzimport_name< 'import' (module=zB | dotted_as_names< any* module=z any* >) > zimport_from< 'from' mod_member=z* 'import' ( member=z | import_as_name< member=z] '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 > > zpower< bare_with_attr=z trailer< '.' member=z > any* > )setMAPPINGitemsr)bare old_modulechangeschange new_modulememberss E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_urllib.py build_patternrL0s 55D&}}.. G . .F"( J ))GG$ZZZ1 1 1 1 1 $WWWggg7 7 7 7"# # # #"# # # # # $WWW. . . . .! ...c,eZdZdZdZdZdZdZdS) FixUrllibcDdtS)N|)joinrL)selfs rKrLzFixUrllib.build_patternIsxx (((rMc|d}|j}g}t|jddD]:}|t |d|t g;|t t|jdd|||dS)zTransform for the basic import case. Replaces the old import name with a comma separated list of its replacements. moduleNrprefix) getrXrCvalueextendrrappendreplace)rSnoderesults import_modprefnamesnames rKtransform_importzFixUrllib.transform_importLs [[**  J,-crc2 @ @D LL$tAwt444egg> ? ? ? ? T'*"23B7:4HHHIII5!!!!!rMc|d}|j}|d}|rt|tr|d}d}t|jD]}|j|dvr |d}n|r&|t||dS||ddSg}i} |d} | D]}|j tj kr%|j d j} |j dj} n |j} d} | d krst|jD]`}| |dvrT|d| vr| |d| |dg |ag} t|}d }d }|D]}| |}g}|dd D]B}||||| t#C|||d |t%||}|r|jj|r||_| |d}| rdg}| dd D]%}||t+g&| | d ||dS||ddS)zTransform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module. mod_membermemberrNr@rW!This is an invalid module elementrJ,TcL|jtjkryt|jdj||jd|jdg}ttj|gSt|j|gS)NrrWr@ri)typer import_as_namerchildrenrZcloner )rcrXkidss rK handle_namez/FixUrllib.transform_member..handle_names9 333 q!1!7GGG M!,2244 M!,22446D!!4d;;<<TZ77788rMrVFzAll module elements are invalid)rYrX isinstancelistrCrZr]rcannot_convertrlr rmrnr\ setdefaultr r[rrparentendswithr)rSr^r_rfrargnew_namerHmodulesmod_dictrJas_name member_name new_nodes indentationfirstrqrUeltsrbeltnewnodesnew_nodes rKtransform_memberzFixUrllib.transform_member\s` [[..  X&& @ M&$'' #H!*"23  <6!9,,%ayHE- O""4#>#>#>?????##D*MNNNNN GHi(G! N N;$"555$oa06G"(/!"4":KK"(,K"G#%%")**:";NN&&)33%ay88 'vay 9 9 9$//q 2>>EEfMMMI*400KE 9 9 9"  '9**CLLS$!7!7888LL)))) [[b488999 //- 2 ; ;K H H-!,CJ  %%% M )#2#88HLL(GII!67777 Yr]+++ U#######D*KLLLLLrMcz|d}|d}d}t|tr|d}t|jD]}|j|dvr |d}n|r+|t ||jdS||ddS)z.Transform for calls to module members in code.bare_with_attrrgNrr@rWrh) rYrrrsrCrZr]rrXrt)rSr^r_ module_dotrgrxrHs rK transform_dotzFixUrllib.transform_dots[[!122 X&& fd # # AYFj./  F|vay((!!9)  K   tH+5+< > > > ? ? ? ? ?   &I J J J J JrMc|dr|||dS|dr|||dS|dr|||dS|dr||ddS|dr||ddSdS)NrUrfr module_starzCannot handle star imports. module_asz#This module is now multiple modules)rYrdrrrt)rSr^r_s rK transformzFixUrllib.transforms ;;x M  ! !$ 0 0 0 0 0 [[ & & M  ! !$ 0 0 0 0 0 [[) * * M   tW - - - - - [[ ' ' M   &C D D D D D [[ % % M   &K L L L L L M MrMN)__name__ __module__ __qualname__rLrdrrrrMrKrOrOGsn)))""" JMJMJMXKKK" M M M M MrMrON)__doc__lib2to3.fixes.fix_importsrrlib2to3.fixer_utilrrrrr r r rCr\rLrOrrMrKrs=<<<<<<<>>>>>>>>>>>>>>>>>>"CCCD ???@  +,. /" ' ' ' ( -/   B '(+A.///....}M}M}M}M}M }M}M}M}M}MrMPKH13]zVs,fixes/__pycache__/fix_intern.cpython-311.pycnu[ !A?hxLdZddlmZddlmZmZGddejZdS)z/Fixer for intern(). intern(s) -> sys.intern(s)) fixer_base) ImportAndCall touch_importc eZdZdZdZdZdZdS) FixInternTprez power< 'intern' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > c|r5|d}|r+|j|jjkr|jdjdvrdSd}t |||}t dd||S)Nobj>***)sysinternr)typesymsargumentchildrenvaluerr)selfnoderesultsr namesnews E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_intern.py transformzFixIntern.transformsu  %.C H 222LO)[88F!D'511T5$''' N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrr s4M EG     rrN)__doc__r fixer_utilrrBaseFixrr#rrr(sr 44444444 "rPKH13]z/fixes/__pycache__/fix_map.cpython-311.opt-1.pycnu[ !A?h8|dZddlmZddlmZddlmZmZmZm Z m Z ddl m Z ddlmZGddejZd 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 eZdZdZdZdZdZdS)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.mapcN||rdSg}d|vr2|dD])}||*|jjt jkrQ||d|}d|_ttd|g}nd|vr{t|d|d|d}tt j |g|zd }n_d |vr"|d }d|_nd |vr|d }|jt jkr|jd jt jkrd|jd jdjt"jkr9|jd jdjdkr||ddStt j td|g}d|_t)|rdStt j tdt+|gg|z}d|_|j|_|S)Nextra_trailerszYou should use a for loop herelist map_lambdaxpfpit)prefixmap_noneargargsNonezjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequencemap) should_skipappendcloneparenttypesyms simple_stmtwarningrrrrr powertrailerchildrenarglistrNAMEvaluer r)selfnoderesultstrailerstnewrs B/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_map.py transformzFixMap.transform@sn   D ! !  F w & &-. + + **** ; t/ / / LL? @ @ @**,,CCJtF||cU++CC W $ $74=..00"4=..00"4=..0022CtzC58#3B???CCW$$en**,, W$$"6?DyDL00}Q', <<}Q'038EJFF}Q'039VCC T,NOOOtzDKK+FGGC!#CJ%d++ 4tzDLL'3%..#AH#LMMCCJ[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr3r4r2r r s6MG:$G.....r4r N)__doc__pgen2rrr fixer_utilrrrrr pygramr r#pytreer ConditionalFixr r;r4r2rBs&JJJJJJJJJJJJJJ++++++PPPPPZ &PPPPPr4PKH13]GG0fixes/__pycache__/fix_exec.cpython-311.opt-2.pycnu[ !A?hN ddlmZddlmZmZmZGddejZdS)) fixer_base)CommaNameCallceZdZdZdZdZdS)FixExecTzx exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > | exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > c|j}|d}|d}|d}|g}d|d_|5|t |g|5|t |gt td||jS)Nabcexec)prefix)symsgetclonerextendrrr)selfnoderesultsrr r r argss C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_exec.py transformzFixExec.transformsy CL KK   KK   {Q = KK!'')), - - - = KK!'')), - - -DLL$t{;;;;N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrs/MG < < < < r$ss**********<<<<) any ','> ) rpar=')' > after=any* > c|r5|d}|r+|j|jjkr|jdjdvrdSd}t |||}t dd||S)Nobj>***) importlibreloadr)typesymsargumentchildrenvaluerr)selfnoderesultsr namesnews E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_reload.py transformzFixReload.transformsu  %.C H 222LO)[88F'D'511T;--- N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrr s4M EG     rrN)r fixer_utilrrBaseFixrr#rrr'sm$ 44444444 "rPKH13][ [ =fixes/__pycache__/fix_itertools_imports.cpython-311.opt-2.pycnu[ !A?h&N ddlmZddlmZmZmZGddejZdS)) fixer_base) BlankLinesymstokenc2eZdZdZdezZdZdS)FixItertoolsImportsTzT import_from< 'from' 'itertools' 'import' imports=any > c~|d}|jtjks|js|g}n|j}|dddD]}|jtjkr |j}|}n%|jtjkrdS|jd}|j}|dvrd|_|m|dvr)| |ddkrdnd |_|jddp|g}d } |D]3}| r*|jtj kr|.| d z} 4|r^|d jtj krC| |r|d jtj kC|jst|d dr|j |j} t}| |_|SdS) Nimportsr)imapizipifilter) ifilterfalse izip_longestf filterfalse zip_longestTvalue)typerimport_as_namechildrenrNAMErSTARremovechangedCOMMApopgetattrparentprefixr) selfnoderesultsr rchildmember name_node member_name remove_commaps P/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_itertools_imports.py transformzFixItertoolsImports.transforms)$ <4. . .g6F .yHH'Hccc] 7 7EzUZ''! uz))"N1- #/K999"   @@@ 4?Nc4I4I==(5#AAA&37)  % %E % ek 9 9 $  $8B<, ;; LLNN ! ! # # # $8B<, ;;! WWgt%D%D  N " A;;DDKK # "N)__name__ __module__ __qualname__ BM_compatiblelocalsPATTERNr-r.r,rrs=MFHHG+++++r.rN)lib2to3rlib2to3.fixer_utilrrrBaseFixrr5r.r,r9sqG555555555511111*,11111r.PKH13]'e330fixes/__pycache__/fix_next.cpython-311.opt-2.pycnu[ !A?hf | ddlmZddlmZddlmZddlmZm Z m Z dZ Gddej Z dZd Zd Zd S) )token)python_symbols) fixer_base)NameCall find_bindingz;Calls to builtin next() possibly shadowed by global bindingc0eZdZdZdZdZfdZdZxZS)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* > prectt|||td|}|r$||t d|_dSd|_dS)NnextTF)superr start_treerwarning bind_warning shadowed_next)selftreefilenamen __class__s C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_next.pyrzFixNext.start_tree$sj gt''h777  & &  ' LLL ) ) )!%D   !&D   c\|d}|d}|d}|r|jr+|td|jdSd|D}d|d_|t td |j|dS|r-td|j}||dS|rt |rZ|d }dd |Dd kr| |tdS|tddSd |vr$| |td|_dSdS)Nbaseattrname__next__)prefixc6g|]}|S)clone.0rs r z%FixNext.transform..9s 000a 000rr headc,g|]}t|Sr!)strr#s rr%z%FixNext.transform..Es111qCFF111r __builtin__globalT) getrreplacerrris_assign_targetjoinstriprr)rnoderesultsrrrrr(s r transformzFixNext.transform.s{{6""{{6""{{6""  &! K T*T[AAABBBBB004000!#Q T$vdk"B"B"BDIIJJJJJ  &Z 444A LLOOOOO  & %% v7711D1112288::mKKLL|444 LLj)) * * * * *  LL| , , ,!%D   ! r) __name__ __module__ __qualname__ BM_compatiblePATTERNorderrr4 __classcell__)rs@rr r sZM G E'''''&&&&&&&rr ct|}|dS|jD]-}|jtjkrdSt ||rdS.dS)NFT) find_assignchildrentyperEQUAL is_subtree)r2assignchilds rr/r/Qsc   F ~u : $ $55 t $ $ 44  5rc|jtjkr|S|jtjks|jdSt |jSN)r?syms expr_stmt simple_stmtparentr=)r2s rr=r=]sB yDN""  yD$$$ (;t t{ # ##rcT|krdStfd|jDS)NTc38K|]}t|VdSrE)rA)r$cr2s r zis_subtree..gs-::qz!T""::::::r)anyr>)rootr2s `rrArAds6 t||t ::::DM::: : ::rN)pgen2rpygramrrFr&r fixer_utilrrrrBaseFixr r/r=rAr!rrrTs4++++++1111111111L :&:&:&:&:&j :&:&:&@   $$$;;;;;rPKH13] 8fixes/__pycache__/fix_tuple_params.cpython-311.opt-2.pycnu[ !A?h ddlmZddlmZddlmZddlmZmZmZm Z m Z m Z dZ Gddej ZdZd Zgd fd Zd Zd S) )pytree)token) fixer_base)AssignNameNewlineNumber Subscriptsymscvt|tjo|jdjt jkS)N) isinstancerNodechildrentyperSTRING)stmts K/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_tuple_params.py is_docstringrs/ dFK ( ( 1 =  EL 01c&eZdZdZdZdZdZdZdS)FixTupleParamsTa funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > c d|vr||Sg |d}|d}|djdjtjkr)d}|djdj}t n#d}d}tjtjd d fd }|jtj kr ||nU|jtj kr@t|jD]+\}} | jtj kr|| |dk , sdS D]} |d| _ |} |dkrd d_n2t|dj|r| d_|dz} D]} |d| _  |dj| | <t!| dz| t# zdzD]}||dj|_|ddS)Nlambdasuiteargsr rz; Fct}|}d|_t ||}|rd|_||tjtj |gdS)Nr ) rnew_namecloneprefixrreplaceappendrrr simple_stmt) tuple_arg add_prefixnargrend new_linesselfs r handle_tuplez.FixTupleParams.transform..handle_tupleCsT]]__%%A//##CCJ#qwwyy))D    a   V[)9*. )<>> ? ? ? ? ?r)r)r!)F)transform_lambdarrrINDENTvaluerrLeafr tfpdef typedargslist enumerateparentr$rrangelenchanged)r.noderesultsrrstartindentr/ir+lineafterr,r-s` @@r transformzFixTupleParams.transform.sM w  ((w77 7  v 8 Q  $ 4 4E1X&q)/F))CCEF+elB//C ? ? ? ? ? ? ? ? 9 # # L     Y$, , ,#DM22 : :38t{**!L!a%9999  F # #D(DKK A::"%IaL   %(+E2 3 3 "(IaL AIE # #D(DKK)2a%+&uQwc)nn 4Q 677 1 1A*0E!H a ' ' arc|d}|d}t|d}|jtjkr2|}d|_||dSt|}t|}| t|}t|d} || | D]} | jtjkrv| j |vrmd|| j D} tjt j| g| z} | j| _| | dS)Nrbodyinnerr!)r$c6g|]}|S)r#.0cs r z3FixTupleParams.transform_lambda..s CCCAaggiiCCCr) simplify_argsrrNAMEr#r$r% find_params map_to_indexr" tuple_namer post_orderr2rrr power) r.r;r<rrDrEparamsto_indextup_name new_paramr* subscriptsnews rr0zFixTupleParams.transform_lambdans`vvgg.// : # #KKMMEEL LL    FT""''==F!3!344#...  Y__&&'''""  Av##8(;(;CC!'1BCCC k$*#,??#4#4"5 "BDDX  #   rN)__name__ __module__ __qualname__ run_order BM_compatiblePATTERNrBr0rGrrrrsDIMG>>>@rrc|jtjtjfvr|S|jtjkr9|jtjkr"|jd}|jtjk"|Std|z)NrzReceived unexpected node %s)rr vfplistrrMvfpdefr RuntimeErrorr;s rrLrLss yT\5:... dk ! !i4;&&=#Di4;&& 4t; < <.s, K K KqQVu{5J5JKNN5J5J5Jr)rr rarNrrrMr2rcs rrNrNsS yDK4=+,,, ej z K KDM K K KKrNc|i}t|D]_\}}ttt|g}t |t rt |||W||z||<`|S)N)d)r6r r strrlistrO) param_listr$rhr?objtrailers rrOrOsy J''&&3VCFF^^,,- c4  & g + + + + +g%AcFF Hrcg}|D]O}t|tr#|t|:||Pd|S)N_)rrjr&rPjoin)rklrls rrPrPsd A c4   HHZ__ % % % % HHSMMMM 88A;;r)rrpgen2rr fixer_utilrrrr r r rBaseFixrrLrNrOrPrGrrrus *GGGGGGGGGGGGGGGG111gggggZ'gggX = = =LLL%'$     rPKH13](c='  +fixes/__pycache__/fix_apply.cpython-311.pycnu[ !A?h* hdZddlmZddlmZddlmZddlmZmZm Z Gddej Z dS) zIFixer for apply(). This converts apply(func, v, k) into (func)(*v, **k).)pytree)token) fixer_base)CallComma parenthesizeceZdZdZdZdZdS)FixApplyTa. power< 'apply' trailer< '(' arglist< (not argument ')' > > c|j}|sJ|d}|d}|d}|r+|j|jjkr|jdjdvrdS|r-|j|jjkr|jdjdkrdS|j}|}|jtj |j fvr?|j|j ks |jdjtj krt|}d|_|}d|_||}d|_tjtjd |g}|N|t%tjtj d|gd |d_t'||| S) Nfuncargskwds>***rr )prefix)symsgettypeargumentchildrenvaluerclonerNAMEatompower DOUBLESTARrrLeafSTARextendrr) selfnoderesultsrr r rr l_newargss D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_apply.py transformzFixApply.transformsywvv{{6""   TY/// a &+55  TY$)"444]1%+t33 Fzz|| Iej$)4 4 4 Y$* $ $ ]2  #u'7 7 7%%D zz||  ::<r5s99 22222222226464646464z!6464646464r*PKH13]}ϟ<  4fixes/__pycache__/fix_execfile.cpython-311.opt-2.pycnu[ !A?hj ddlmZddlmZmZmZmZmZmZm Z m Z m Z m Z Gddej ZdS)) fixer_base) CommaNameCallLParenRParenDotNodeArgListStringsymsceZdZdZdZdZdS) FixExecfileTz power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > | power< 'execfile' trailer< '(' filename=any ')' > > ch|d}|d}|d}|jdjd}t|t t ddg|}t tjtd|g}t tj ttd gt tj ttgg} |g| z} |} d| _t d d} | t | t | gz} ttd | d }|g}|5|t |g|5|t |gttd ||jS)Nfilenameglobalslocalsz"rb" )rparenopenreadz'exec'compileexec)prefix)getchildrencloner rr r r powerrtrailerr rrrrextend)selfnoderesultsrrrexecfile_paren open_args open_callr open_expr filename_argexec_str compile_args compile_callargss G/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_execfile.py transformzFixExecfile.transforms:&++i((X&&r*3B7==??X^^--uwwvs8K8KL#1333 d6llI%>?? T\CEE4<<#899T\FHHfhh#788:K$&  ~~'' ! (C(( EGG\577H#MM DOO\2>> ~   KK'--//2 3 3 3   KK&,,..1 2 2 2DLL$t{;;;;N)__name__ __module__ __qualname__ BM_compatiblePATTERNr0r1r/rrs/MG <<<<r:s 111111111111111111111111&<&<&<&<&<*$&<&<&<&<& [any] > > | testlist_gexp< any comp_for< 'for' NAME 'in' target=testlist_safe< any (',' any)+ [','] > [any] > >) (']' | ')') > c|d}t}|j|_d|_|d||t dS)Ntarget)rprefix insert_child append_childr)selfnoderesultsr lparens D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_paren.py transformzFixParen.transform%sY"   Av&&&FHH%%%%%N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG,&&&&&rrN)__doc__r r fixer_utilrrBaseFixrrrrrstCC'''''''' & & & & &z! & & & & &rPKH13]{/fixes/__pycache__/fix_map.cpython-311.opt-2.pycnu[ !A?h8z ddlmZddlmZddlmZmZmZmZm Z ddl m Z ddl mZGddejZdS) )token) fixer_base)NameArgListCallListCompin_special_context)python_symbols)Nodec eZdZdZdZdZdZdS)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.mapcN||rdSg}d|vr2|dD])}||*|jjt jkrQ||d|}d|_ttd|g}nd|vr{t|d|d|d}tt j |g|zd }n_d |vr"|d }d|_nd |vr|d }|jt jkr|jd jt jkrd|jd jdjt"jkr9|jd jdjdkr||ddStt j td|g}d|_t)|rdStt j tdt+|gg|z}d|_|j|_|S)Nextra_trailerszYou should use a for loop herelist map_lambdaxpfpit)prefixmap_noneargargsNonezjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequencemap) should_skipappendcloneparenttypesyms simple_stmtwarningrrrrr powertrailerchildrenarglistrNAMEvaluer r)selfnoderesultstrailerstnewrs B/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_map.py transformzFixMap.transform@sn   D ! !  F w & &-. + + **** ; t/ / / LL? @ @ @**,,CCJtF||cU++CC W $ $74=..00"4=..00"4=..0022CtzC58#3B???CCW$$en**,, W$$"6?DyDL00}Q', <<}Q'038EJFF}Q'039VCC T,NOOOtzDKK+FGGC!#CJ%d++ 4tzDLL'3%..#AH#LMMCCJ[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr3r4r2r r s6MG:$G.....r4r N)pgen2rrr fixer_utilrrrrr pygramr r#pytreer ConditionalFixr r;r4r2rAs&JJJJJJJJJJJJJJ++++++PPPPPZ &PPPPPr4PKH13]Qy/1fixes/__pycache__/fix_raise.cpython-311.opt-1.pycnu[ !A?hn pdZddlmZddlmZddlmZddlmZmZm Z m Z m Z Gddej 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_tupleceZdZdZdZdZdS)FixRaiseTzB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > ch|j}|d}|jtjkrd}|||dSt |rOt |r9|jdjd}t |9d|_d|vr7tj |j td|g}|j|_|S|d}t |rd|jdd D}n d |_|g}d |vr|d } d | _|} |jtj ks |jd krt||} t!| td t#| ggz} tj |jtdg| z}|j|_|Stj |j tdt||g|jS)Nexcz+Python 3 does not support string exceptions valraisec6g|]}|S)clone).0cs D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_raise.py z&FixRaise.transform..Ds :::!AGGII:::tbNonewith_traceback)prefix)symsrtyperSTRINGcannot_convertr childrenr!rNode raise_stmtrNAMEvaluerrr simple_stmt) selfnoderesultsr"rmsgnewrargsrewith_tbs r transformzFixRaise.transform&syen""$$ 8u| # #?C   c * * * F C== 3-- :l1o.q177993-- :CJ   +doW s/CDDCCJJen""$$ C== ::s|AbD'9:::DDCJ5D 7??$$&&BBIAx5:%%f)<)<dOO1d#34455"GG+d.g'0IJJCCJJ;t $W tC?&*k333 3rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr4rrrr r s/MG4343434343rr N)__doc__rrpgen2rr fixer_utilrrrr r BaseFixr rrrr>s2<<<<<<<<<<<<<<;3;3;3;3;3z!;3;3;3;3;3rPKH13]BOkk/fixes/__pycache__/fix_itertools.cpython-311.pycnu[ !A?h HdZddlmZddlmZGddejZdS)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:eZdZdZdZdezZdZdZdS) 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] ')' > > cfd}|dd}d|vrb|jdvrY|d|d}}|j}|||j||p|j}|t |jdd|dS)Nfuncit) ifilterfalse izip_longestdot)prefix)valuerremoveparentreplacer)selfnoderesultsrr rr s H/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_itertools.py transformzFixItertools.transformsvq! GOO J> > >u~wt}CYF IIKKK JJLLL K   % % %&4; T$*QRR.88899999N) __name__ __module__ __qualname__ BM_compatibleit_funcslocalsPATTERN run_orderrrrrrsKMHH FHH GI:::::rrN)__doc__r fixer_utilrBaseFixrr#rrr(sl::::::%:::::rPKH13]l2fixes/__pycache__/fix_reload.cpython-311.opt-1.pycnu[ !A?h9LdZddlmZddlmZmZGddejZdS)z5Fixer for reload(). reload(s) -> importlib.reload(s)) fixer_base) ImportAndCall touch_importc eZdZdZdZdZdZdS) FixReloadTprez power< 'reload' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > c|r5|d}|r+|j|jjkr|jdjdvrdSd}t |||}t dd||S)Nobj>***) importlibreloadr)typesymsargumentchildrenvaluerr)selfnoderesultsr namesnews E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_reload.py transformzFixReload.transformsu  %.C H 222LO)[88F'D'511T;--- N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrr s4M EG     rrN)__doc__r fixer_utilrrBaseFixrr#rrr(sr$$ 44444444 "rPKH13]Pe 3fixes/__pycache__/fix_renames.cpython-311.opt-2.pycnu[ !A?hf ddlmZddlmZmZdddiiZiZdZdZGdd ej Z d S) ) fixer_base)Name attr_chainsysmaxintmaxsizec^ddtt|zdzS)N(|))joinmaprepr)memberss F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_renames.py alternatesrs( #dG,,-- - 33c #KttD]Q\}}t|D]*\}}|t||f<d|d|d|dVd|d|dV+RdS)Nz3 import_from< 'from' module_name=z, 'import' ( attr_name=z | import_as_name< attr_name=z! 'as' any >) > z& power< module_name=z trailer< '.' attr_name=z > any* > )listMAPPINGitemsLOOKUP)modulereplaceold_attrnew_attrs r build_patternrs 00++"&w}}"7"7 + + Hh)1FFH% & & 8885 5 5 5 5  + + + + + +++rcfeZdZdZdeZdZfdZdZ xZ S) FixRenamesTr prectt|j|}|r-tfdt |dDrdS|SdS)Nc3.K|]}|VdS)N).0objmatchs r z#FixRenames.match..5s+DD#55::DDDDDDrparentF)superrr&anyr)selfnoderesultsr& __class__s @rr&zFixRenames.match1sij$''-%++  DDDDD()C)CDDDDD uNurc|d}|d}|rF|rFt|j|jf}|t ||jdSdSdS)N module_name attr_name)prefix)getrvaluerrr2)r+r,r-mod_namer1rs r transformzFixRenames.transform>s;;}--KK ,,   G  Gx~y?@H   d8I4DEEE F F F F F G G G Gr) __name__ __module__ __qualname__ BM_compatibler rPATTERNorderr&r6 __classcell__)r.s@rrr*soMhh}}''G EGGGGGGGrrN) r fixer_utilrrrrrrBaseFixrr#rrrAs)))))))) Hy)  444+++*GGGGG#GGGGGrPKH13]U,Oc c 1fixes/__pycache__/fix_throw.cpython-311.opt-1.pycnu[ !A?h.pdZddlmZddlmZddlmZddlmZmZm Z m Z m Z Gddej 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_tupleceZdZdZdZdZdS)FixThrowTz power< any trailer< '.' 'throw' > trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > | power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > > c|j}|d}|jtjur||ddS|d}|dS|}t|rd|jddD}n d|_ |g}|d}d |vr|d }d|_ t||} t| td t|ggz} |tj|j| dS|t||dS) Nexcz+Python 3 does not support string exceptionsvalc6g|]}|S)clone).0cs D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_throw.py z&FixThrow.transform..)s :::!AGGII:::argstbwith_traceback)symsrtyperSTRINGcannot_convertgetr childrenprefixrr rrreplacerNodepower) selfnoderesultsrrrr throw_argsrewith_tbs r transformzFixThrow.transforms[yen""$$ 8u| # #   &S T T T Fkk%   ; Fiikk C== ::s|AbD'9:::DDCJ5DV_ 7??$$&&BBIS$A1d#34455"GG   v{4:w?? @ @ @ @ @   tC / / / / /rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr.rrrr r s/MG00000rr N)__doc__rrpgen2rr fixer_utilrrrr r BaseFixr rrrr8s??<<<<<<<<<<<<<<(0(0(0(0(0z!(0(0(0(0(0rPKH13]*||0fixes/__pycache__/fix_basestring.cpython-311.pycnu[ !A?h@HdZddlmZddlmZGddejZdS)zFixer for basestring -> str.) fixer_base)NameceZdZdZdZdZdS) FixBasestringTz 'basestring'c.td|jS)Nstr)prefix)rr )selfnoderesultss I/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_basestring.py transformzFixBasestring.transform sE$+....N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrr rrs-MG/////rrN)__doc__r fixer_utilrBaseFixrrrr rsh""/////J&/////rPKH13]$D D /fixes/__pycache__/fix_zip.cpython-311.opt-1.pycnu[ !A?h hdZddlmZddlmZddlmZddlm Z m Z m Z Gddej 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 eZdZdZdZdZdZdS)FixZipTzN power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*] > zfuture_builtins.zipc||rdSt|rdS|d}d|_g}d|vrd|dD}|D] }d|_ t t jtd|gd}t t jtdt|gg|z}|j|_|S)Nargstrailersc6g|]}|S)clone).0ns B/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_zip.py z$FixZip.transform..'s ???a ???zip)prefixlist) should_skiprrrrsymspowerrr)selfnoderesultsr rrnews r transformzFixZip.transforms   D ! !  F d # # 4v$$&&   ??7:+>???H  4:U T22>>>4:V gsenn=HII[  rN)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr!rrrr r s6MG $Grr N)__doc__r rpytreerpygramrr fixer_utilrrrConditionalFixr rrrr-s++++++::::::::::Z &rPKH13]ƒ1/fixes/__pycache__/fix_zip.cpython-311.opt-2.pycnu[ !A?h f ddlmZddlmZddlmZddlmZm Z m Z Gddej Z dS)) fixer_base)Node)python_symbols)NameArgListin_special_contextc eZdZdZdZdZdZdS)FixZipTzN power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*] > zfuture_builtins.zipc||rdSt|rdS|d}d|_g}d|vrd|dD}|D] }d|_ t t jtd|gd}t t jtdt|gg|z}|j|_|S)Nargstrailersc6g|]}|S)clone).0ns B/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_zip.py z$FixZip.transform..'s ???a ???zip)prefixlist) should_skiprrrrsymspowerrr)selfnoderesultsr rrnews r transformzFixZip.transforms   D ! !  F d # # 4v$$&&   ??7:+>???H  4:U T22>>>4:V gsenn=HII[  rN)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr!rrrr r s6MG $Grr N) r rpytreerpygramrr fixer_utilrrrConditionalFixr rrrr,s++++++::::::::::Z &rPKH13]2F F 3fixes/__pycache__/fix_unicode.cpython-311.opt-2.pycnu[ !A?hP ddlmZddlmZdddZGddejZdS) )token) fixer_basechrstr)unichrunicodec,eZdZdZdZfdZdZxZS) FixUnicodeTzSTRING | 'unicode' | 'unichr'cvtt|||d|jv|_dS)Nunicode_literals)superr start_treefuture_featuresr )selftreefilename __class__s F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_unicode.pyrzFixUnicode.start_trees9 j$**4::: 2d6J Jc|jtjkr-|}t|j|_|S|jtjkr|j}|js@|ddvr6d|vr2dd| dD}|ddvr |dd}||jkr|S|}||_|SdS)Nz'"\z\\cbg|],}|dddd-S)z\uz\\uz\Uz\\U)replace).0vs r z(FixUnicode.transform.. sF"""IIeV,,44UFCC"""ruU) typerNAMEclone_mappingvalueSTRINGr joinsplit)rnoderesultsnewvals r transformzFixUnicode.transforms 9 " "**,,C ,CIJ Y%, & &*C( SVu__jj"" YYu--"""1v~~!""gdj   **,,CCIJ' &r)__name__ __module__ __qualname__ BM_compatiblePATTERNrr, __classcell__)rs@rr r sVM-GKKKKKrr N)pgen2rrr#BaseFixr rrr7st% 0 0#rPKH13]t$$7fixes/__pycache__/fix_numliterals.cpython-311.opt-2.pycnu[ !A?hR ddlmZddlmZddlmZGddejZdS))token) fixer_base)Numberc(eZdZejZdZdZdS)FixNumliteralscT|jdp|jddvS)N0Ll)value startswith)selfnodes J/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_numliterals.pymatchzFixNumliterals.matchs( %%c**Ddjn.DEc|j}|ddvr |dd}nV|drA|r-tt |dkr d|ddz}t ||jS)Nr r r 0o)prefix)r r isdigitlensetrr)rrresultsvals r transformzFixNumliterals.transformsj r7d??crc(CC ^^C  !S[[]] !s3s88}}q7H7HQRR.Cc$+....rN)__name__ __module__ __qualname__rNUMBER _accept_typerrrrrr s>r'sy /////Z'/////rPKH13]d3 3 3fixes/__pycache__/fix_renames.cpython-311.opt-1.pycnu[ !A?hhdZddlmZddlmZmZdddiiZiZdZdZ Gd d ej Z d S) z?Fix incompatible renames Fixes: * sys.maxint -> sys.maxsize ) fixer_base)Name attr_chainsysmaxintmaxsizec^ddtt|zdzS)N(|))joinmaprepr)memberss F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_renames.py alternatesrs( #dG,,-- - 33c #KttD]Q\}}t|D]*\}}|t||f<d|d|d|dVd|d|dV+RdS)Nz3 import_from< 'from' module_name=z, 'import' ( attr_name=z | import_as_name< attr_name=z! 'as' any >) > z& power< module_name=z trailer< '.' attr_name=z > any* > )listMAPPINGitemsLOOKUP)modulereplaceold_attrnew_attrs r build_patternrs 00++"&w}}"7"7 + + Hh)1FFH% & & 8885 5 5 5 5  + + + + + +++rcfeZdZdZdeZdZfdZdZ xZ S) FixRenamesTr prectt|j|}|r-tfdt |dDrdS|SdS)Nc3.K|]}|VdS)N).0objmatchs r z#FixRenames.match..5s+DD#55::DDDDDDrparentF)superrr&anyr)selfnoderesultsr& __class__s @rr&zFixRenames.match1sij$''-%++  DDDDD()C)CDDDDD uNurc|d}|d}|rF|rFt|j|jf}|t ||jdSdSdS)N module_name attr_name)prefix)getrvaluerrr2)r+r,r-mod_namer1rs r transformzFixRenames.transform>s;;}--KK ,,   G  Gx~y?@H   d8I4DEEE F F F F F G G G Gr) __name__ __module__ __qualname__ BM_compatibler rPATTERNorderr&r6 __classcell__)r.s@rrr*soMhh}}''G EGGGGGGGrrN) __doc__r fixer_utilrrrrrrBaseFixrr#rrrBs)))))))) Hy)  444+++*GGGGG#GGGGGrPKH13]'I.fixes/__pycache__/fix_operator.cpython-311.pycnu[ !A?hb bdZddlZddlmZddlmZmZmZm Z dZ Gddej Z dS)aFixer for operator functions. operator.isCallable(obj) -> callable(obj) operator.sequenceIncludes(obj) -> operator.contains(obj) operator.isSequenceType(obj) -> isinstance(obj, collections.abc.Sequence) operator.isMappingType(obj) -> isinstance(obj, collections.abc.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_importcfd}|S)Nc|_|SN) invocation)fss G/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_operator.pydeczinvocation..decs )r rs` rr r s# JrcneZdZdZdZdZdZdeeezZdZ e dd Z e d d Z e d d Z e ddZe ddZe ddZe ddZdZdZdZdS) FixOperatorTprez 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 > > )methodsobjcN|||}| |||SdSr ) _check_method)selfnoderesultsmethods r transformzFixOperator.transform+s7##D'22  6$(( (  rzoperator.contains(%s)c0|||dS)Ncontains_handle_renamerrrs r_sequenceIncludeszFixOperator._sequenceIncludes0s""4*===rz callable(%s)c|d}ttd|g|jS)Nrcallableprefix)rrcloner')rrrrs r _isCallablezFixOperator._isCallable4s4enD$$syy{{mDKHHHHrzoperator.mul(%s)c0|||dS)Nmulr r"s r_repeatzFixOperator._repeat9s""4%888rzoperator.imul(%s)c0|||dS)Nimulr r"s r_irepeatzFixOperator._irepeat=s""4&999rz(isinstance(%s, collections.abc.Sequence)c2|||ddS)Ncollections.abcSequence_handle_type2abcr"s r_isSequenceTypezFixOperator._isSequenceTypeAs$$T74EzRRRrz'isinstance(%s, collections.abc.Mapping)c2|||ddS)Nr1Mappingr3r"s r_isMappingTypezFixOperator._isMappingTypeEs$$T74EyQQQrzisinstance(%s, numbers.Number)c2|||ddS)NnumbersNumberr3r"s r _isNumberTypezFixOperator._isNumberTypeIs$$T7IxHHHrcX|dd}||_|dS)Nrr)valuechanged)rrrnamers rr!zFixOperator._handle_renameMs."1% rctd|||d}|tdd||gzg}t t d||jS)Nrz, . isinstancer&)rr(rjoinrrr')rrrmoduleabcrargss rr4zFixOperator._handle_type2abcRskT64(((en VD388VSM+B+B$BCCDD&&T[AAAArc t|d|ddjz}t|tjjr?d|vr|St |df}|j|z}||d|zdS)N_rrrErzYou should use '%s' here.) getattrr>rC collectionsrFCallablestrr warning)rrrrsubinvocation_strs rrzFixOperator._check_methodXssWX%6q%9%??@@ fko6 7 7 Q7"" 75>**,!'!2S!8 T#>#OPPPtrN)__name__ __module__ __qualname__ BM_compatibleorderrrdictPATTERNrr r#r)r,r/r5r8r<r!r4rrrrrrsM EG C Dc222 3G))) Z'((>>)(>ZII IZ"##99$#9Z#$$::%$:Z:;;SS<;SZ9::RR;:RZ011II21I BBB     rr) __doc__collections.abcrKlib2to3rlib2to3.fixer_utilrrrrr BaseFixrrrrr]s  ????????????GGGGG*$GGGGGrPKH13]&ww4fixes/__pycache__/fix_ws_comma.cpython-311.opt-1.pycnu[ !A?hBTdZddlmZddlmZddlmZGddejZdS)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|eZdZdZdZejejdZejej dZ ee fZ dZ dS) FixWsCommaTzH any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]> ,:c|}d}|jD]H}||jvr)|j}|r d|vrd|_d}4|r|j}|sd|_d}I|S)NF T )clonechildrenSEPSprefixisspace)selfnoderesultsnewcommachildrs G/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_ws_comma.py transformzFixWsComma.transformsjjll\  E !!>>##&F(:(:#%EL+"\F!+'*  N) __name__ __module__ __qualname__explicitPATTERNrLeafrCOMMACOLONrrrrrr sdHG FK S ) )E FK S ) )E 5>DrrN)__doc__r rpgen2rrBaseFixrr$rrr(s~#rPKH13]8ސ0fixes/__pycache__/__init__.cpython-311.opt-2.pycnu[ !A?h/dS)NrC/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/__init__.pyrsrPKH13]z1k,fixes/__pycache__/fix_idioms.cpython-311.pycnu[ !A?h ddZddlmZddlmZmZmZmZmZm Z dZ dZ Gddej 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 ')' > >c XeZdZdZdedededed ZfdZdZdZ d Z d Z xZ S) FixIdiomsTz isinstance=comparison<  z8 T=any > | isinstance=comparison< T=any aX > | 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* > ctt||}|rd|vr|d|dkr|SdS|S)Nsortedid1id2)superr match)selfnoder __class__s E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_idioms.pyrzFixIdioms.matchOsT )T " " ( ( . .  Qx1U8##4cd|vr|||Sd|vr|||Sd|vr|||Std)N isinstancewhilerz Invalid match)transform_isinstancetransform_whiletransform_sort RuntimeError)rrresultss r transformzFixIdioms.transformZss 7 " ",,T7;; ;   ''g66 6  &&tW55 5// /rcb|d}|d}d|_d|_ttd|t |g}d|vr0d|_t t jtd|g}|j|_|S)NxTr rnnot)cloneprefixrrrrr not_test)rrr r#r$tests rrzFixIdioms.transform_isinstanceds CL    CL   D&&EGGQ88 '>>DK U T':;;Dk  rch|d}|td|jdS)NrTruer))replacerr))rrr ones rrzFixIdioms.transform_whileps3g D 33344444rc@|d}|d}|d}|d}|r*|td|jne|rT|}d|_|t td|g|jnt d||j}d |vr|rJ|d d |d jf} d | |d _dS|j sJ|j Jt} |j | |j | usJ|d d | _dSdS) Nsortnextlistexprrr.r%zshould not have reached here )getr/rr)r(rrremove rpartitionjoinparent next_siblingr append_child) rrr sort_stmt next_stmt list_call simple_exprnewbtwn prefix_linesend_lines rrzFixIdioms.transform_sorttsFO FO KK'' kk&))  ?   d8I4DEEE F F F F  ?##%%CCJ   T(^^cU,7,>!@!@!@ A A A A=>> > 4<< ;!% 5 5a 8)A,:MN &*ii &=&= ! ### '''' -555$;; --h777 -9999#'//$"7"7":! rSs<AAAAAAAAAAAAAAAA81s;s;s;s;s; "s;s;s;s;s;rPKH13] c3fixes/__pycache__/fix_asserts.cpython-311.opt-2.pycnu[ !A?hn ddlmZddlmZeddddddd dddddd d ZGd deZdS))BaseFix)Name assertTrue assertEqualassertNotEqualassertAlmostEqualassertNotAlmostEqual assertRegexassertRaisesRegex assertRaises assertFalse)assert_ assertEqualsassertNotEqualsassertAlmostEqualsassertNotAlmostEqualsassertRegexpMatchesassertRaisesRegexpfailUnlessEqual failIfEqualfailUnlessAlmostEqualfailIfAlmostEqual failUnlessfailUnlessRaisesfailIfcXeZdZddeeezZdZdS) FixAssertszH power< any+ trailer< '.' meth=(%s)> any* > |c|dd}|ttt||jdS)Nmeth)prefix)replacerNAMESstrr")selfnoderesultsnames F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_asserts.py transformzFixAsserts.transform sBvq! T%D *4;???@@@@@N) __name__ __module__ __qualname__joinmapreprr$PATTERNr+r,r*rrsOHHSSu--../GAAAAAr,rN) fixer_baser fixer_utilrdictr$rr4r,r*r8s;!   $*0%*! -,#    $AAAAAAAAAAr,PKH13]@2fixes/__pycache__/fix_reduce.cpython-311.opt-2.pycnu[ !A?hEF ddlmZddlmZGddejZdS)) fixer_base touch_importc eZdZdZdZdZdZdS) FixReduceTpreai power< 'reduce' trailer< '(' arglist< ( (not(argument) any ',' not(argument > c(tdd|dS)N functoolsreducer)selfnoderesultss E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_reduce.py transformzFixReduce.transform"s[(D11111N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrrs4M E G22222rrN)lib2to3rlib2to3.fixer_utilrBaseFixrrrrrsg ++++++22222 "22222rPKH13]ù9fixes/__pycache__/fix_standarderror.cpython-311.opt-1.pycnu[ !A?hHdZddlmZddlmZGddejZdS)z%Fixer for StandardError -> Exception.) fixer_base)NameceZdZdZdZdZdS)FixStandarderrorTz- 'StandardError' c.td|jS)N Exception)prefix)rr )selfnoderesultss L/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_standarderror.py transformzFixStandarderror.transformsK 4444N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrr rr s/MG55555rrN)__doc__r fixer_utilrBaseFixrrrr rsj,+55555z)55555rPKH13]8o7fixes/__pycache__/fix_methodattrs.cpython-311.opt-1.pycnu[ !A?h^TdZddlmZddlmZddddZGdd ejZd S) z;Fix bound method attributes (method.im_? -> method.__?__). ) fixer_base)Name__func____self__z__self__.__class__)im_funcim_selfim_classceZdZdZdZdZdS)FixMethodattrsTzU power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > c|dd}t|j}|t||jdS)Nattr)prefix)MAPvaluereplacerr)selfnoderesultsr news J/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_methodattrs.py transformzFixMethodattrs.transformsBvq!$*o T#dk22233333N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrr r s/MG44444rr N)__doc__r fixer_utilrrBaseFixr rrrr$s % 4 4 4 4 4Z' 4 4 4 4 4rPKH13]G0fixes/__pycache__/fix_dict.cpython-311.opt-2.pycnu[ !A?h ddlmZddlmZddlmZddlmZmZmZddlmZejdhzZ Gddej Z d S) )pytree)patcomp) fixer_base)NameCallDot) fixer_utilitercjeZdZdZdZdZdZejeZ dZ eje Z dZ dS)FixDictTa power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues'| 'viewkeys'|'viewitems'|'viewvalues') > parens=trailer< '(' ')' > tail=any* > c |d}|dd}|d}|j}|j}|d}|d} |s| r |dd}d|D}d |D}| o|||} |t j|jtt||j g|d  gz} t j|j | } | s+| s)d | _ tt|rdnd | g} |rt j|j | g|z} |j | _ | S)Nheadmethodtailr viewc6g|]}|Sclone.0ns C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_dict.py z%FixDict.transform..A (((a (((c6g|]}|Srrrs rrz%FixDict.transform..Brr)prefixparenslist) symsvalue startswithin_special_contextrNodetrailerrrr rpowerr) selfnoderesultsrrrr$ method_nameisiterisviewspecialargsnews r transformzFixDict.transform6sv"1%vyl ''//''//  *V *%abb/K((4(((((4((((Dt66tVDDv{4<$'EE$(06 %?%?%?$@AAx(..00 22 k$*d++ B6 BCJtf8FF&99C5AAC  8+dj3%$,77C[  rz3power< func=NAME trailer< '(' node=any ')' > any* >zmfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > cH|jdSi}|jj^|j|jj|r9|d|ur/|r|djtvS|djt jvS|sdS|j|j|o |d|uS)NFr,func)parentp1matchr% iter_exemptr consuming_callsp2)r+r,r/r-s rr'zFixDict.in_special_contextZs ; 5 K  *w}}T[/99 +v$&& Kv, ;;v, 0JJJ 5w}}T['22Nwv$7NNrN) __name__ __module__ __qualname__ BM_compatiblePATTERNr4P1rcompile_patternr8P2r<r'rrrr r )swMG8 ?B   $ $B B !  $ $BOOOOOrr N) r"rrrr rrrr;r:BaseFixr rrrrFs6(((((((((((F83 AOAOAOAOAOj AOAOAOAOAOrPKH13]A-fixes/__pycache__/fix_has_key.cpython-311.pycnu[ !A?h| XdZddlmZddlmZddlmZmZGddejZdS)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 parenthesizeceZdZdZdZdZdS) 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 R|sJ|j}|jj|jkr!|j|jrdS|d}|d}|j}d|dD}|d}|d} | r d| D} |j|j |j|j |j |j |j |jfvrt|}t!|dkr |d }nt#j|j|}d |_t)d d } |r-t)d d } t#j|j| | f} t#j|j || |f} | r:t| } t#j|j| ft-| z} |jj|j |j|j|j|j|j|j|j|jf vrt| } || _| S)Nnegationanchorc6g|]}|Sclone.0ns F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_has_key.py z'FixHasKey.transform..Rs 777!''))777beforeargafterc6g|]}|Sr rrs rrz'FixHasKey.transform..Vs ...1QWWYY...r in)prefixnot)symsparenttypenot_testpatternmatchgetrr comparisonand_testor_testtestlambdefargumentrlenrNodepowerrcomp_optupleexprxor_exprand_expr shift_expr arith_exprtermfactor) selfnoderesultsr r r rrrrn_opn_notnews r transformzFixHasKey.transformGs#wy K  - - L  t{ + + .4;;z**"77WX%6777en""$$ G$$  /.....E 8  dit}N N Ns##C v;;!  AYFF[V44F D%%%  <s+++E;t|eT];;Dk$/Cv+>??  As##C+dj3&5<<*?@@C ; DM $ t $ $ TZ 9 9 9s##C  rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr?r rrrr&s/MG<&&&&&rrN) __doc__rr fixer_utilrrBaseFixrr rrrIs:++++++++GGGGG "GGGGGrPKH13]$D D )fixes/__pycache__/fix_zip.cpython-311.pycnu[ !A?h hdZddlmZddlmZddlmZddlm Z m Z m Z Gddej 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 eZdZdZdZdZdZdS)FixZipTzN power< 'zip' args=trailer< '(' [any] ')' > [trailers=trailer*] > zfuture_builtins.zipc||rdSt|rdS|d}d|_g}d|vrd|dD}|D] }d|_ t t jtd|gd}t t jtdt|gg|z}|j|_|S)Nargstrailersc6g|]}|S)clone).0ns B/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_zip.py z$FixZip.transform..'s ???a ???zip)prefixlist) should_skiprrrrsymspowerrr)selfnoderesultsr rrnews r transformzFixZip.transforms   D ! !  F d # # 4v$$&&   ??7:+>???H  4:U T22>>>4:V gsenn=HII[  rN)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr!rrrr r s6MG $Grr N)__doc__r rpytreerpygramrr fixer_utilrrrConditionalFixr rrrr-s++++++::::::::::Z &rPKH13]+{6fixes/__pycache__/fix_xreadlines.cpython-311.opt-2.pycnu[ !A?hF ddlmZddlmZGddejZdS)) fixer_base)NameceZdZdZdZdZdS) FixXreadlinesTz power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | power< any+ trailer< '.' no_call='xreadlines' > > c|d}|r+|td|jdS|d|dDdS)Nno_call__iter__)prefixc6g|]}|S)clone).0xs I/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_xreadlines.py z+FixXreadlines.transform..s ===!''))===call)getreplacerr )selfnoderesultsrs r transformzFixXreadlines.transformsm++i((  ? OODGNCCC D D D D D LL==WV_=== > > > > >rN)__name__ __module__ __qualname__ BM_compatiblePATTERNrr rrrr s/MG ?????rrN)r fixer_utilrBaseFixrr rrr"shD ?????J&?????rPKH13]bq AA-fixes/__pycache__/fix_getcwdu.cpython-311.pycnu[ !A?hHdZddlmZddlmZGddejZdS)z1 Fixer that changes os.getcwdu() to os.getcwd(). ) fixer_base)NameceZdZdZdZdZdS) FixGetcwduTzR power< 'os' trailer< dot='.' name='getcwdu' > any* > ch|d}|td|jdS)Nnamegetcwd)prefix)replacerr )selfnoderesultsrs F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_getcwdu.py transformzFixGetcwdu.transforms2v T(4;77788888N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG99999rrN)__doc__r fixer_utilrBaseFixrrrrrsl  9 9 9 9 9# 9 9 9 9 9rPKH13]W2fixes/__pycache__/fix_filter.cpython-311.opt-1.pycnu[ !A?h pdZddlmZddlmZddlmZddlm Z m Z m Z m Z m Z GddejZdS) 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_context parenthesizec eZdZdZdZdZdZdS) 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.filterc||rdSg}d|vr2|dD])}||*d|vr|d}|jt jkrd|_t|}t|d|d|d|}tt j |g|zd}n d|vrrttd td |d td }tt j |g|zd}nt|rdS|d }tt j td |gd}tt j td t|gg|z}d|_|j|_|S)Nextra_trailers filter_lambdaxpfpit)prefixnone_fseqargsfilterlist) should_skipappendclonegettypesymstestrr rrpowerrr r)selfnoderesultstrailerstrnewrs E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_filter.py transformzFixFilter.transform:s   D ! !  F w & &-. + + **** g % %T""((**Bw$)## !"%%7;;t,,2244";;t,,2244";;t,,2244b::CtzC58#3B???CC w  4::::"5>//11::''CtzC58#3B???CC"$'' t6?((**DtzDNND#9"EEECtzDLL'3%..#AH#LMMCCJ[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr*r+r)r r s6MG<'G$$$$$r+r N)__doc__rrpytreerpygramrr fixer_utilrrrr r ConditionalFixr r2r+r)r8s  ++++++RRRRRRRRRRRRRRGGGGG )GGGGGr+PKH13]ǺJ44/fixes/__pycache__/fix_funcattrs.cpython-311.pycnu[ !A?hHdZddlmZddlmZGddejZdS)z3Fix function attribute names (f.func_x -> f.__x__).) fixer_base)NameceZdZdZdZdZdS) FixFuncattrsTz power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' | 'func_dict') > any* > c|dd}|td|jddz|jdS)Nattrz__%s__)prefix)replacervaluer )selfnoderesultsrs H/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_funcattrs.py transformzFixFuncattrs.transformsWvq! T8djn4!%... / / / / /N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG /////rrN)__doc__r fixer_utilrBaseFixrrrrrsh99 / / / / /:% / / / / /rPKH13]ִ3fixes/__pycache__/fix_getcwdu.cpython-311.opt-2.pycnu[ !A?hF ddlmZddlmZGddejZdS)) fixer_base)NameceZdZdZdZdZdS) FixGetcwduTzR power< 'os' trailer< dot='.' name='getcwdu' > any* > ch|d}|td|jdS)Nnamegetcwd)prefix)replacerr )selfnoderesultsrs F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_getcwdu.py transformzFixGetcwdu.transforms2v T(4;77788888N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG99999rrN)r fixer_utilrBaseFixrrrrrsg  9 9 9 9 9# 9 9 9 9 9rPKH13]VEFF.fixes/__pycache__/fix_ne.cpython-311.opt-2.pycnu[ !A?h;R ddlmZddlmZddlmZGddejZdS))pytree)token) fixer_basec(eZdZejZdZdZdS)FixNec|jdkS)Nz<>)value)selfnodes A/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_ne.pymatchz FixNe.matchszT!!cRtjtjd|j}|S)Nz!=)prefix)rLeafrNOTEQUALr)r r resultsnews r transformzFixNe.transforms!k%.$t{CCC rN)__name__ __module__ __qualname__rr _accept_typer rrr rr s;>L"""rrN)rpgen2rrBaseFixrrrr rsy#     J      rPKH13]CQQ2fixes/__pycache__/fix_reduce.cpython-311.opt-1.pycnu[ !A?hEHdZddlmZddlmZGddejZdS)zqFixer for reduce(). Makes sure reduce() is imported from the functools module if reduce is used in that module. ) fixer_base touch_importc eZdZdZdZdZdZdS) FixReduceTpreai power< 'reduce' trailer< '(' arglist< ( (not(argument) any ',' not(argument > c(tdd|dS)N functoolsreducer)selfnoderesultss E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_reduce.py transformzFixReduce.transform"s[(D11111N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrrs4M E G22222rrN)__doc__lib2to3rlib2to3.fixer_utilrBaseFixrrrrrsl ++++++22222 "22222rPKH13]8o1fixes/__pycache__/fix_methodattrs.cpython-311.pycnu[ !A?h^TdZddlmZddlmZddddZGdd ejZd S) z;Fix bound method attributes (method.im_? -> method.__?__). ) fixer_base)Name__func____self__z__self__.__class__)im_funcim_selfim_classceZdZdZdZdZdS)FixMethodattrsTzU power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > c|dd}t|j}|t||jdS)Nattr)prefix)MAPvaluereplacerr)selfnoderesultsr news J/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_methodattrs.py transformzFixMethodattrs.transformsBvq!$*o T#dk22233333N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrr r s/MG44444rr N)__doc__r fixer_utilrrBaseFixr rrrr$s % 4 4 4 4 4Z' 4 4 4 4 4rPKH13]2ww4fixes/__pycache__/fix_exitfunc.cpython-311.opt-1.pycnu[ !A?h `dZddlmZmZddlmZmZmZmZm Z m Z Gddej Z dS)z7 Convert use of sys.exitfunc to use the atexit module. )pytree fixer_base)NameAttrCallCommaNewlinesymsc:eZdZdZdZdZfdZfdZdZxZ S) FixExitfuncTa ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) cBtt|j|dSN)superr __init__)selfargs __class__s G/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_exitfunc.pyrzFixExitfunc.__init__s#)k4  )40000chtt|||d|_dSr)rr start_tree sys_import)rtreefilenamers rrzFixExitfunc.start_tree!s. k4  ++D(;;;rc d|vr|j |d|_dS|d}d|_tjt jttdtd}t||g|j}| ||j| |ddS|jj d}|j t jkrF|t!|tdddS|jj}|j |j}|j} tjt jtd tddg} tjt j| g} ||dzt-||d z| dS) NrfuncatexitregisterzKCan't find sys import; Please add an atexit import at the top of your file. import)rcloneprefixrNoder powerrrrreplacewarningchildrentypedotted_as_names append_childrparentindex import_name simple_stmt insert_childr ) rnoderesultsrrcallnamescontaining_stmtpositionstmt_container new_importnews r transformzFixExitfunc.transform%s 7 " "&"),"7 Fv$$&& ;tz#DNND4D4DEE!!Htfdk22 T ? " LL ? @ @ @ F(+ :- - -   uww ' ' '   tHc22 3 3 3 3 3"o4O&/55doFFH,3NT%5#H~~tHc/B/BC  J+d. ==C  ( (Awyy A A A  ( (As ; ; ; ; ;r) __name__ __module__ __qualname__keep_line_order BM_compatiblePATTERNrrr< __classcell__)rs@rr r sqOM G11111#<#<#<#<#<#<#rIs '&&&&&&&EEEEEEEEEEEEEEEE=<=<=<=<=<*$=<=<=<=<= > |c# K|] }d|zV dS)z'%s'N).0es F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_sys_exc.py zFixSysExc.s&::AVaZ::::::c|dd}t|j|j}t t d|j}tt d|}|dj|djd_| t|ttj ||jS)N attributeexc_info)prefixsysdot)rrindexvaluerrrrchildrenappendrr r power)selfnoderesultssys_attrr callattrs r transformzFixSysExc.transforms;'*t}**8>::;;D$$X_===DKK&&%,U^%:Q" Ie$$%%%DJT[9999rN)__name__ __module__ __qualname__r BM_compatiblejoinPATTERNr+rrrr r s]999HMHH:::::::;G:::::rr N) r fixer_utilrrrrrr r BaseFixr rrrr5sHHHHHHHHHHHHHHHHHH::::: ":::::rPKH13]]i))5fixes/__pycache__/fix_metaclass.cpython-311.opt-1.pycnu[ !A?h dZddlmZddlmZddlmZmZmZdZ dZ dZ dZ d Z d ZGd d ejZd S)aFixer for __metaclass__ = X -> (metaclass=X) methods. The various forms of classef (inherits nothing, inherits once, inherits 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)symsNodeLeafcP|jD]}|jtjkrt |cS|jtjkr`|jrY|jd}|jtjkr7|jr0|jd}t|tr|j dkrdSdS)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_node left_sides H/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_metaclass.pyrrs     9 " " && & & & Y$* * *t} * a(I~//I4F/%.q1 i.. !?::44 5c |jD]}|jtjkrdSt |jD]\}}|jt jkrntdttjg}|j|dzdr]|j|dz}| | | |j|dzd]| ||}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_nodes rfixup_parse_treer$-s ! 9 " " FF # X.//774 9 # # E $5666 R E  AaCDD !%ac*  9??,,---  AaCDD ! %   DDDrcnt|jD]\}}|jtjkrndS|t tjg}t tj |g}|j|drW|j|}| | ||j|dW| |||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 rSEMIr rrrrrr insert_childprefix) rr" stmt_nodesemi_indrnew_exprnew_stmtr# new_leaf1 old_leaf1s rfixup_simple_stmtr/Gs. $I$677$ 9 " " E # KKMMMDNB''HD$xj11H  XYY '&x0 ioo//000  XYY ' 8$$$!!$-a0I"1%.q1I 'Irc|jrA|jdjtjkr#|jddSdSdS)N)r r rNEWLINEr )rs rremove_trailing_newliner3_sQ }#r*/5=@@ b  """""##@@rc#K|jD]}|jtjkrnt dt t |jD]\}}|jtjkr|jr}|jd}|jtjkr[|jrT|jd}t|tr2|j dkr't|||t||||fVdS)NzNo class suite!r r )r r rr rlistrrrrrrr/r3)r!rr" simple_noder left_nodes r find_metasr8ds!,, 9 " " E #*+++y7788 1 1;  t/ / /K4H /#,Q/I~//I4F/%.q1 i..1!?::%dA{;;;+K888K0000 1 1rcp|jddd}|r,|}|jtjkrn|,|ru|}t |t r%|jtjkr|jrd|_dS| |jddd|sdSdS)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 Nr1) r popr rINDENTrrDEDENTr(extend)r kidsrs r fixup_indentr@{s >$$B$ D xxzz 9 $ $   -xxzz dD ! ! -di5<&?&?{ !  F KK ddd+ , , , -----rceZdZdZdZdZdS) FixMetaclassTz classdef ct|sdSt|d}t|D]\}}}|}||jdj}t |jdkr|jdjtjkr|jd}nN|jd } ttj| g}| d|nt |jdkr1ttjg}| d|nt |jdkrttjg}| dttjd| d|| dttjdnt#d |jdjd} d | _| j} |jr5|ttjd d | _nd | _|jd} d | jd_d | jd_||t-||jso|t|d} | | _|| |ttjddSt |jdkr|jdjtjkrx|jdjtjkrZt|d} | d| | dttjddSdSdSdS)Nr r)(zUnexpected class definition metaclass, r:rpass r1)rr$r8r r r lenrarglistrr set_childr'rrRPARLPARrrr(rCOMMAr@r2r<r=)selfrresultslast_metaclassr r"stmt text_typerQrmeta_txtorig_meta_prefixr pass_leafs r transformzFixMetaclass.transformsT""  F(..  NE1d!N KKMMMMM!$)  t}   " "}Q$ 44-*q)//11t|fX66q'****   1 $ $4<,,G   a ) ) ) )   1 $ $4<,,G   aej#!6!6 7 7 7   a ) ) )   aej#!6!6 7 7 7 7:;; ;"*1-6q9$#?   !  ek3!7!7 8 8 8!HOO HO#+A. ') 1$') 1$^,,,U~ > LLNNNY//I/I    i ( ( (   d5=$77 8 8 8 8 8  1 $ $.$)U\99.$)U\99Y//I   r9 - - -   r4 t#<#< = = = = = % $9999rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr^rrrBrBs4MGL>L>L>L>L>rrBN)__doc__r:rpygramr fixer_utilrrrrr$r/r3r8r@BaseFixrBrdrrris())))))))))&4(((0### 111.---,S>S>S>S>S>:%S>S>S>S>S>rPKH13]K7-fixes/__pycache__/fix_nonzero.cpython-311.pycnu[ !A?hOHdZddlmZddlmZGddejZdS)z*Fixer for __nonzero__ -> __bool__ methods.) fixer_base)NameceZdZdZdZdZdS) FixNonzeroTz classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='__nonzero__' parameters< '(' NAME ')' > any+ > any* > > cl|d}td|j}||dS)Nname__bool__)prefix)rr replace)selfnoderesultsrnews F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_nonzero.py transformzFixNonzero.transforms7v:dk222 SN)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrs/MGrrN)__doc__r fixer_utilrBaseFixrrrrrsh00     #     rPKH13](*fixes/__pycache__/fix_long.cpython-311.pycnu[ !A?hHdZddlmZddlmZGddejZdS)z/Fixer that turns 'long' into 'int' everywhere. ) fixer_base)is_probably_builtinceZdZdZdZdZdS)FixLongTz'long'c^t|rd|_|dSdS)Nint)rvaluechanged)selfnoderesultss C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_long.py transformzFixLong.transforms4 t $ $ DJ LLNNNNN  N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s-MGrrN)__doc__lib2to3rlib2to3.fixer_utilrBaseFixrrrrrsl222222j rPKH13] 2fixes/__pycache__/fix_buffer.cpython-311.opt-2.pycnu[ !A?hNF ddlmZddlmZGddejZdS)) fixer_base)Namec eZdZdZdZdZdZdS) FixBufferTzR power< name='buffer' trailer< '(' [any] ')' > any* > ch|d}|td|jdS)Nname memoryview)prefix)replacerr )selfnoderesultsrs E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_buffer.py transformzFixBuffer.transforms2v T,t{;;;<<<<<N)__name__ __module__ __qualname__ BM_compatibleexplicitPATTERNrrrrr s4MHG=====rrN)r fixer_utilrBaseFixrrrrrsg; = = = = = " = = = = =rPKH13]1QQ6fixes/__pycache__/fix_xreadlines.cpython-311.opt-1.pycnu[ !A?hHdZddlmZddlmZGddejZdS)zpFix "for x in f.xreadlines()" -> "for x in f". This fixer will also convert g(f.xreadlines) into g(f.__iter__).) fixer_base)NameceZdZdZdZdZdS) FixXreadlinesTz power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | power< any+ trailer< '.' no_call='xreadlines' > > c|d}|r+|td|jdS|d|dDdS)Nno_call__iter__)prefixc6g|]}|S)clone).0xs I/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_xreadlines.py z+FixXreadlines.transform..s ===!''))===call)getreplacerr )selfnoderesultsrs r transformzFixXreadlines.transformsm++i((  ? OODGNCCC D D D D D LL==WV_=== > > > > >rN)__name__ __module__ __qualname__ BM_compatiblePATTERNrr rrrr s/MG ?????rrN)__doc__r fixer_utilrBaseFixrr rrr#snDD ?????J&?????rPKH13]~2fixes/__pycache__/fix_import.cpython-311.opt-1.pycnu[ !A?h ndZddlmZddlmZmZmZmZddlm Z m Z m Z dZ Gddej 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) FromImportsymstokenc#K|g}|r|}|jtjkr |jVn|jt jkr'dd|jDVn~|jt j kr!| |jdnH|jt j kr$| |jdddntd|dSdS)zF Walks over all the names imported in a dotted_as_names node. cg|] }|j S)value).0chs E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_import.py z$traverse_imports..s<<<28<<<rNzunknown node type)poptyper NAMErr dotted_namerchildrendotted_as_nameappenddotted_as_namesextendAssertionError)namespendingnodes rtraverse_importsr$s gG  6{{}} 9 " "*     Y$* * *''< | import_name< 'import' imp=any > cvtt|||d|jv|_dS)Nabsolute_import)superr& start_treefuture_featuresskip)selftreename __class__s rr*zFixImport.start_tree/s6 i))$555%)== rc|jrdS|d}|jtjkrnt |ds|jd}t |d||jr%d|jz|_|dSdSd}d}t|D]}||rd}d}|r|r| |ddStd|g}|j |_ |S)Nimprr.FTz#absolute and local imports together) r,rr import_fromhasattrrprobably_a_local_importrchangedr$warningr prefix)r-r#resultsr2 have_local have_absolutemod_namenews r transformzFixImport.transform3s0 9  Fen 9( ( ( c7++ &l1oc7++ &++CI66 #)O    J!M,S11 ) )//99)!%JJ$(MM NLL'LMMMS3%((CCJJrcV|drdS|ddd}t|j}t ||}t t t|dsdSdt ddd d fD]}t ||zrd SdS) Nr3Frz __init__.pyz.pyz.pycz.soz.slz.pydT) startswithsplitrfilenamerrr)r-imp_name base_pathexts rr6z!FixImport.probably_a_local_importUs   s # # 5>>#q))!,DM** H-- d79--}==>> 53uf=  Ci#o&& tt ur) __name__ __module__ __qualname__ BM_compatiblePATTERNr*r?r6 __classcell__)r0s@rr&r&&scMG >>>>>   Drr&N)__doc__r ros.pathrrrr fixer_utilr r r r$BaseFixr&rrrrRs  ............0000000000666&===== "=====rPKH13]}A 1fixes/__pycache__/fix_types.cpython-311.opt-1.pycnu[ !A?hdZddlmZddlmZidddddd d d d d dd ddddddddddddddddddd d!d"d#d$d d%d&d'Zd(eDZGd)d*ejZd+S),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)Name BooleanTypebool BufferType memoryview ClassTypetype ComplexTypecomplexDictTypedictDictionaryType EllipsisTypeztype(Ellipsis) FloatTypefloatIntTypeintListTypelistLongType ObjectTypeobjectNoneTypez type(None)NotImplementedTypeztype(NotImplemented) SliceTypeslice StringTypebytes StringTypesz(str,)tuplestrrange) TupleTypeTypeType UnicodeType XRangeTypecg|]}d|zS)z)power< 'types' trailer< '.' name='%s' > >).0ts D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_types.py r-3sPPPQ 4q 8PPPcBeZdZdZdeZdZdS)FixTypesT|ct|dj}|rt||jSdS)Nname)prefix) _TYPE_MAPPINGgetvaluerr4)selfnoderesults new_values r, transformzFixTypes.transform9s>!%%gfo&;<<  7 $+666 6tr.N)__name__ __module__ __qualname__ BM_compatiblejoin_patsPATTERNr<r)r.r,r0r05s7MhhuooGr.r0N) __doc__r fixer_utilrr5rBBaseFixr0r)r.r,rHsp&| f   F  6  ) W 5 F E x L 5 g!" g#$ %&- 2 QP-PPPz!r.PKH13](0fixes/__pycache__/fix_long.cpython-311.opt-1.pycnu[ !A?hHdZddlmZddlmZGddejZdS)z/Fixer that turns 'long' into 'int' everywhere. ) fixer_base)is_probably_builtinceZdZdZdZdZdS)FixLongTz'long'c^t|rd|_|dSdS)Nint)rvaluechanged)selfnoderesultss C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_long.py transformzFixLong.transforms4 t $ $ DJ LLNNNNN  N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s-MGrrN)__doc__lib2to3rlib2to3.fixer_utilrBaseFixrrrrrsl222222j rPKH13]3ʙp2fixes/__pycache__/fix_xrange.cpython-311.opt-1.pycnu[ !A?h \dZddlmZddlmZmZmZddlmZGddejZ dS)z/Fixer that changes xrange(...) into range(...).) fixer_base)NameCallconsuming_calls)patcompceZdZdZdZfdZdZdZdZdZ dZ e j e Z d Ze j eZd ZxZS) FixXrangeTz power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > ctt|||t|_dSN)superr start_treesettransformed_xranges)selftreefilename __class__s E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_xrange.pyr zFixXrange.start_trees5 i))$999#&55   cd|_dSr )r)rrrs r finish_treezFixXrange.finish_trees#'   rc|d}|jdkr|||S|jdkr|||Stt |)Nnamexrangerange)valuetransform_xrangetransform_range ValueErrorreprrnoderesultsrs r transformzFixXrange.transformsev : ! !((w77 7 Z7 " "''g66 6T$ZZ(( (rc|d}|td|j|jt |dS)Nrrprefix)replacerr'raddidr!s rrzFixXrange.transform_xrange$sOv T'$+666777  $$RXX.....rcZt||jvr||stt d|dg}tt d|g|j}|dD]}|||SdSdS)Nrargslistr&rest)r*rin_special_contextrrcloner' append_child)rr"r# range_call list_callns rrzFixXrange.transform_range*s tHHD4 4 4''-- 5d7mmgfo.C.C.E.E-FGGJT&\\J<$(K111IV_ * *&&q))))  5 4 4 4rz3power< 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*> c |jdSi}|jjC|j|jj|r|d|ur|djtvS|j|j|o |d|uS)NFr"func)parentp1matchrrp2)rr"r#s rr/zFixXrange.in_special_context?s ; 5 K  *w}}T[/99 +v$&&6?(O; ;w}}T['22Nwv$7NNr)__name__ __module__ __qualname__ BM_compatiblePATTERNr rr$rrP1rcompile_patternr8P2r:r/ __classcell__)rs@rr r sMG )))))((()))///    ?B   $ $B B !  $ $B O O O O O O Orr N) __doc__r fixer_utilrrrrBaseFixr rrrIs654444444444=O=O=O=O=O "=O=O=O=O=OrPKH13]=0fixes/__pycache__/fix_repr.cpython-311.opt-1.pycnu[ !A?hePdZddlmZddlmZmZmZGddejZdS)z/Fixer that transforms `xyzzy` into repr(xyzzy).) fixer_base)CallName parenthesizeceZdZdZdZdZdS)FixReprTz7 atom < '`' expr=any '`' > c|d}|j|jjkrt |}t t d|g|jS)Nexprrepr)prefix)clonetypesyms testlist1rrrr )selfnoderesultsr s C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_repr.py transformzFixRepr.transformsUv$$&& 9 + + +%%DDLL4&====N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG>>>>>rrN) __doc__r fixer_utilrrrBaseFixrrrrr!sv651111111111 > > > > >j > > > > >rPKH13]3v] ] 1fixes/__pycache__/fix_raise.cpython-311.opt-2.pycnu[ !A?hn n ddlmZddlmZddlmZddlmZmZmZm Z m Z Gddej Z dS))pytree)token) fixer_base)NameCallAttrArgListis_tupleceZdZdZdZdZdS)FixRaiseTzB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > ch|j}|d}|jtjkrd}|||dSt |rOt |r9|jdjd}t |9d|_d|vr7tj |j td|g}|j|_|S|d}t |rd|jdd D}n d |_|g}d |vr|d } d | _|} |jtj ks |jd krt||} t!| td t#| ggz} tj |jtdg| z}|j|_|Stj |j tdt||g|jS)Nexcz+Python 3 does not support string exceptions valraisec6g|]}|S)clone).0cs D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_raise.py z&FixRaise.transform..Ds :::!AGGII:::tbNonewith_traceback)prefix)symsrtyperSTRINGcannot_convertr childrenr!rNode raise_stmtrNAMEvaluerrr simple_stmt) selfnoderesultsr"rmsgnewrargsrewith_tbs r transformzFixRaise.transform&syen""$$ 8u| # #?C   c * * * F C== 3-- :l1o.q177993-- :CJ   +doW s/CDDCCJJen""$$ C== ::s|AbD'9:::DDCJ5D 7??$$&&BBIAx5:%%f)<)<dOO1d#34455"GG+d.g'0IJJCCJJ;t $W tC?&*k333 3rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr4rrrr r s/MG4343434343rr N) rrpgen2rr fixer_utilrrrr r BaseFixr rrrr=s2<<<<<<<<<<<<<<;3;3;3;3;3z!;3;3;3;3;3rPKH13]:  2fixes/__pycache__/fix_except.cpython-311.opt-2.pycnu[ !A?h x ddlmZddlmZddlmZddlmZmZmZm Z m Z m Z dZ Gddej ZdS) )pytree)token) fixer_base)AssignAttrNameis_tupleis_listsymsc#Kt|D]?\}}|jtjkr%|jdjdkr|||dzfV@dS)Nexceptr) enumeratetyper except_clausechildrenvalue)nodesins E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_except.py find_exceptsrsh%  &&1 6T' ' 'z!}"h..%!*o%%%&&ceZdZdZdZdZdS) 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)]) > c j|j}d|dD}d|dD}t|D]\}}t|jdkr|jdd\}} } | t dd | jtjkrAt | d } | } d | _ | | | } |j} t| D]!\}}t|tjrn"t!| st#| r,t%| t'| t d }nt%| | }t)| d|D]}|d ||||| j d krd| _ d |jddD|z|z}tj|j|S)Nc6g|]}|Sclone).0rs r z'FixExcept.transform..2s 333a 333rtailc6g|]}|Srr)r!chs rr"z'FixExcept.transform..4s ???brxxzz???rcleanupas )prefixargsr c6g|]}|Srr)r!cs rr"z'FixExcept.transform..\s 999!AGGII999r)r rlenrreplacerrrNAMEnew_namer r+r isinstancerNoder r rrreversed insert_child)selfnoderesultsr r# try_cleanupre_suiteEcommaNnew_Ntarget suite_stmtsrstmtassignchildrs r transformzFixExcept.transform/s2y3376?333??GI,>??? &2;&?&?$ #$ # "M7=)**a// - 6qs ; E1 d44445556UZ'' ===EWWYYF$&FMIIe$$$!KKMME #*"2K#,[#9#9""4%dFK88"!E"  {{7gajj7!'UDLL0I0I!J!J!'!6!6"*+bqb/!:!:77,,Q6666((F3333X^^ #AH:9t}RaR'8999KG$N{49h///rN)__name__ __module__ __qualname__ BM_compatiblePATTERNrGrrrrr$s/MG.0.0.0.0.0rrN)r,rpgen2rr fixer_utilrrrr r r rBaseFixrrrrrPs0DDDDDDDDDDDDDDDD&&& 9090909090 "9090909090rPKH13]~,fixes/__pycache__/fix_import.cpython-311.pycnu[ !A?h ndZddlmZddlmZmZmZmZddlm Z m Z m Z dZ Gddej 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) FromImportsymstokenc#K|g}|r|}|jtjkr |jVn|jt jkr'dd|jDVn~|jt j kr!| |jdnH|jt j kr$| |jdddntd|dSdS)zF Walks over all the names imported in a dotted_as_names node. cg|] }|j S)value).0chs E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_import.py z$traverse_imports..s<<<28<<<rNzunknown node type)poptyper NAMErr dotted_namerchildrendotted_as_nameappenddotted_as_namesextendAssertionError)namespendingnodes rtraverse_importsr$s gG  6{{}} 9 " "*     Y$* * *''< | import_name< 'import' imp=any > cvtt|||d|jv|_dS)Nabsolute_import)superr& start_treefuture_featuresskip)selftreename __class__s rr*zFixImport.start_tree/s6 i))$555%)== rc|jrdS|d}|jtjkrnt |ds|jd}t |d||jr%d|jz|_|dSdSd}d}t|D]}||rd}d}|r|r| |ddStd|g}|j |_ |S)Nimprr.FTz#absolute and local imports together) r,rr import_fromhasattrrprobably_a_local_importrchangedr$warningr prefix)r-r#resultsr2 have_local have_absolutemod_namenews r transformzFixImport.transform3s0 9  Fen 9( ( ( c7++ &l1oc7++ &++CI66 #)O    J!M,S11 ) )//99)!%JJ$(MM NLL'LMMMS3%((CCJJrcV|drdS|ddd}t|j}t ||}t t t|dsdSdt ddd d fD]}t ||zrd SdS) Nr3Frz __init__.pyz.pyz.pycz.soz.slz.pydT) startswithsplitrfilenamerrr)r-imp_name base_pathexts rr6z!FixImport.probably_a_local_importUs   s # # 5>>#q))!,DM** H-- d79--}==>> 53uf=  Ci#o&& tt ur) __name__ __module__ __qualname__ BM_compatiblePATTERNr*r?r6 __classcell__)r0s@rr&r&&scMG >>>>>   Drr&N)__doc__r ros.pathrrrr fixer_utilr r r r$BaseFixr&rrrrRs  ............0000000000666&===== "=====rPKH13]}{ DD/fixes/__pycache__/fix_raw_input.cpython-311.pycnu[ !A?hHdZddlmZddlmZGddejZdS)z2Fixer that changes raw_input(...) into input(...).) fixer_base)NameceZdZdZdZdZdS) FixRawInputTzU power< name='raw_input' trailer< '(' [any] ')' > any* > ch|d}|td|jdS)Nnameinput)prefix)replacerr )selfnoderesultsrs H/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_raw_input.py transformzFixRawInput.transforms2v T'$+66677777N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrs/MG88888rrN)__doc__r fixer_utilrBaseFixrrrrrsh88 8 8 8 8 8*$ 8 8 8 8 8rPKH13]v 7fixes/__pycache__/fix_set_literal.cpython-311.opt-2.pycnu[ !A?hN ddlmZmZddlmZmZGddejZdS)) fixer_basepytree)tokensymsc eZdZdZdZdZdZdS) FixSetLiteralTajpower< 'set' trailer< '(' (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) > | single=any) ']' > | atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > ) ')' > > c|d}|rJtjtj|g}|||}n|d}tjtj dg}| d|j D| tjtj d|jj|d_tjtj|}|j|_t#|j dkr8|j d}||j|j d_|S) Nsingleitems{c3>K|]}|VdS)N)clone).0ns J/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_set_literal.py z*FixSetLiteral.transform..'s*99Qqwwyy999999})getrNoder listmakerrreplaceLeafrLBRACEextendchildrenappendRBRACE next_siblingprefix dictsetmakerlenremove) selfnoderesultsr faker literalmakerrs r transformzFixSetLiteral.transforms.X&&  %;t~ /?@@D NN4 EEG$E;u|S11299%.999999v{5<55666"/6  D-w77{  u~  ! # #q!A HHJJJ()EN2  % rN)__name__ __module__ __qualname__ BM_compatibleexplicitPATTERNr-rrrr s4MHGrrN)lib2to3rrlib2to3.fixer_utilrrBaseFixrr4rrr8ss '&&&&&&&********)))))J&)))))rPKH13]=*fixes/__pycache__/fix_repr.cpython-311.pycnu[ !A?hePdZddlmZddlmZmZmZGddejZdS)z/Fixer that transforms `xyzzy` into repr(xyzzy).) fixer_base)CallName parenthesizeceZdZdZdZdZdS)FixReprTz7 atom < '`' expr=any '`' > c|d}|j|jjkrt |}t t d|g|jS)Nexprrepr)prefix)clonetypesyms testlist1rrrr )selfnoderesultsr s C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_repr.py transformzFixRepr.transformsUv$$&& 9 + + +%%DDLL4&====N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG>>>>>rrN) __doc__r fixer_utilrrrBaseFixrrrrr!sv651111111111 > > > > >j > > > > >rPKH13][\\4fixes/__pycache__/fix_imports2.cpython-311.opt-2.pycnu[ !A?h!D ddlmZdddZGddejZdS)) fix_importsdbm)whichdbanydbmceZdZdZeZdS) FixImports2N)__name__ __module__ __qualname__ run_orderMAPPINGmappingG/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_imports2.pyrr sIGGGrrN)rr FixImportsrrrrrsg   +(rPKH13]K73fixes/__pycache__/fix_nonzero.cpython-311.opt-1.pycnu[ !A?hOHdZddlmZddlmZGddejZdS)z*Fixer for __nonzero__ -> __bool__ methods.) fixer_base)NameceZdZdZdZdZdS) FixNonzeroTz classdef< 'class' any+ ':' suite< any* funcdef< 'def' name='__nonzero__' parameters< '(' NAME ')' > any+ > any* > > cl|d}td|j}||dS)Nname__bool__)prefix)rr replace)selfnoderesultsrnews F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_nonzero.py transformzFixNonzero.transforms7v:dk222 SN)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrs/MGrrN)__doc__r fixer_utilrBaseFixrrrrrsh00     #     rPKH13] w 7fixes/__pycache__/fix_itertools_imports.cpython-311.pycnu[ !A?h&PdZddlmZddlmZmZmZGddejZdS)zA Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) ) fixer_base) BlankLinesymstokenc2eZdZdZdezZdZdS)FixItertoolsImportsTzT import_from< 'from' 'itertools' 'import' imports=any > c|d}|jtjks|js|g}n|j}|dddD]}|jtjkr |j}|}n<|jtjkrdS|jtjksJ|jd}|j}|dvrd|_||dvr)| |ddkrdnd |_|jddp|g}d } |D]3}| r*|jtj kr|.| d z} 4|r^|d jtj krC| |r|d jtj kC|jst|d dr|j |j} t}| |_|SdS) Nimportsr)imapizipifilter) ifilterfalse izip_longestf filterfalse zip_longestTvalue)typerimport_as_namechildrenrNAMErSTARremovechangedCOMMApopgetattrparentprefixr) selfnoderesultsr rchildmember name_node member_name remove_commaps P/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_itertools_imports.py transformzFixItertoolsImports.transforms)$ <4. . .g6F .yHH'Hccc] 7 7EzUZ''! uz))zT%88888!N1- #/K999"   @@@ 4?Nc4I4I==(5#AAA&37)  % %E % ek 9 9 $  $8B<, ;; LLNN ! ! # # # $8B<, ;;! WWgt%D%D  N " A;;DDKK # "N)__name__ __module__ __qualname__ BM_compatiblelocalsPATTERNr-r.r,rrs=MFHHG+++++r.rN) __doc__lib2to3rlib2to3.fixer_utilrrrBaseFixrr5r.r,r:stGG555555555511111*,11111r.PKH13]&((2fixes/__pycache__/fix_urllib.cpython-311.opt-1.pycnu[ !A?h dZddlmZmZddlmZmZmZmZm Z m Z m Z dgdfdgdfdd gfgdgd fdd d gfgd Z e d e dddZGddeZdS)zFix 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.request) URLopenerFancyURLopener urlretrieve _urlopenerurlopen urlcleanup pathname2url url2pathname getproxiesz urllib.parse)quote quote_plusunquote unquote_plus urlencode splitattr splithost splitnport splitpasswd splitport splitquerysplittag splittype splituser splitvaluez urllib.errorContentTooShortError)rinstall_opener build_openerRequestOpenerDirector BaseHandlerHTTPDefaultErrorHandlerHTTPRedirectHandlerHTTPCookieProcessor ProxyHandlerHTTPPasswordMgrHTTPPasswordMgrWithDefaultRealmAbstractBasicAuthHandlerHTTPBasicAuthHandlerProxyBasicAuthHandlerAbstractDigestAuthHandlerHTTPDigestAuthHandlerProxyDigestAuthHandler HTTPHandler HTTPSHandler FileHandler FTPHandlerCacheFTPHandlerUnknownHandlerURLError HTTPError)urlliburllib2r?r>c #Kt}tD]P\}}|D]H}|\}}t|}d|d|dVd|d|d|dVd|zVd |zVd |d |d VIQdS) Nzimport_name< 'import' (module=zB | dotted_as_names< any* module=z any* >) > zimport_from< 'from' mod_member=z* 'import' ( member=z | import_as_name< member=z] '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 > > zpower< bare_with_attr=z trailer< '.' member=z > any* > )setMAPPINGitemsr)bare old_modulechangeschange new_modulememberss E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_urllib.py build_patternrL0s 55D&}}.. G . .F"( J ))GG$ZZZ1 1 1 1 1 $WWWggg7 7 7 7"# # # #"# # # # # $WWW. . . . .! ...c,eZdZdZdZdZdZdZdS) FixUrllibcDdtS)N|)joinrL)selfs rKrLzFixUrllib.build_patternIsxx (((rMc|d}|j}g}t|jddD]:}|t |d|t g;|t t|jdd|||dS)zTransform for the basic import case. Replaces the old import name with a comma separated list of its replacements. moduleNrprefix) getrXrCvalueextendrrappendreplace)rSnoderesults import_modprefnamesnames rKtransform_importzFixUrllib.transform_importLs [[**  J,-crc2 @ @D LL$tAwt444egg> ? ? ? ? T'*"23B7:4HHHIII5!!!!!rMc|d}|j}|d}|rt|tr|d}d}t|jD]}|j|dvr |d}n|r&|t||dS||ddSg}i} |d} | D]}|j tj kr%|j d j} |j dj} n |j} d} | d krst|jD]`}| |dvrT|d| vr| |d| |dg |ag} t|}d }d }|D]}| |}g}|dd D]B}||||| t#C|||d |t%||}|r|jj|r||_| |d}| rdg}| dd D]%}||t+g&| | d ||dS||ddS)zTransform for imports of specific module elements. Replaces the module to be imported from with the appropriate new module. mod_membermemberrNr@rW!This is an invalid module elementrJ,TcL|jtjkryt|jdj||jd|jdg}ttj|gSt|j|gS)NrrWr@ri)typer import_as_namerchildrenrZcloner )rcrXkidss rK handle_namez/FixUrllib.transform_member..handle_names9 333 q!1!7GGG M!,2244 M!,22446D!!4d;;<<TZ77788rMrVFzAll module elements are invalid)rYrX isinstancelistrCrZr]rcannot_convertrlr rmrnr\ setdefaultr r[rrparentendswithr)rSr^r_rfrargnew_namerHmodulesmod_dictrJas_name member_name new_nodes indentationfirstrqrUeltsrbeltnewnodesnew_nodes rKtransform_memberzFixUrllib.transform_member\s` [[..  X&& @ M&$'' #H!*"23  <6!9,,%ayHE- O""4#>#>#>?????##D*MNNNNN GHi(G! N N;$"555$oa06G"(/!"4":KK"(,K"G#%%")**:";NN&&)33%ay88 'vay 9 9 9$//q 2>>EEfMMMI*400KE 9 9 9"  '9**CLLS$!7!7888LL)))) [[b488999 //- 2 ; ;K H H-!,CJ  %%% M )#2#88HLL(GII!67777 Yr]+++ U#######D*KLLLLLrMcz|d}|d}d}t|tr|d}t|jD]}|j|dvr |d}n|r+|t ||jdS||ddS)z.Transform for calls to module members in code.bare_with_attrrgNrr@rWrh) rYrrrsrCrZr]rrXrt)rSr^r_ module_dotrgrxrHs rK transform_dotzFixUrllib.transform_dots[[!122 X&& fd # # AYFj./  F|vay((!!9)  K   tH+5+< > > > ? ? ? ? ?   &I J J J J JrMc|dr|||dS|dr|||dS|dr|||dS|dr||ddS|dr||ddSdS)NrUrfr module_starzCannot handle star imports. module_asz#This module is now multiple modules)rYrdrrrt)rSr^r_s rK transformzFixUrllib.transforms ;;x M  ! !$ 0 0 0 0 0 [[ & & M  ! !$ 0 0 0 0 0 [[) * * M   tW - - - - - [[ ' ' M   &C D D D D D [[ % % M   &K L L L L L M MrMN)__name__ __module__ __qualname__rLrdrrrrMrKrOrOGsn)))""" JMJMJMXKKK" M M M M MrMrON)__doc__lib2to3.fixes.fix_importsrrlib2to3.fixer_utilrrrrr r r rCr\rLrOrrMrKrs=<<<<<<<>>>>>>>>>>>>>>>>>>"CCCD ???@  +,. /" ' ' ' ( -/   B '(+A.///....}M}M}M}M}M }M}M}M}M}MrMPKH13]zii1fixes/__pycache__/fix_print.cpython-311.opt-2.pycnu[ !A?h  ddlmZddlmZddlmZddlmZddlmZmZm Z m Z ej dZ Gddej Zd S) )patcomp)pytree)token) fixer_base)NameCallCommaStringz"atom< '(' [atom|STRING|NAME] ')' >c"eZdZdZdZdZdZdS)FixPrintTzP simple_stmt< any* bare='print' any* > | print_stmt c |d}|r9|ttdg|jdS|jdd}t |dkr"t|drdSdx}x}}|r$|dtkr |dd}d}|rM|dtj tj dkr$|d}|d d}d |D}|r d |d_||||1||d t!t#||1||d t!t#||||d|ttd|} |j| _| S)Nbareprint)prefix z>>c6g|]}|S)clone).0args D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_print.py z&FixPrint.transform..?s ...##))++...sependfile)getreplacerrrchildrenlen parend_exprmatchr rLeafr RIGHTSHIFTr add_kwargr repr) selfnoderesults bare_printargsrr r!l_argsn_stmts r transformzFixPrint.transform%s[[((     tDMM2&0&7 9 9 9 : : : F}QRR  t99>>k//Q88> FcD  DH''9DC  DGv{5+;TBBBB7==??D8D.....  "!F1I  ?co1AvufT#YY.?.?@@@vufT#YY.?.?@@@vvt444d7mmV,,   rc*d|_tj|jjt |tjtjd|f}|r(| td|_| |dS)Nr=r) rrNodesymsargumentrr(rEQUALappendr )r,l_nodess_kwdn_expr n_arguments rr*zFixPrint.add_kwargMs [!3"&u++"(+ek3"?"?"("*++   $ NN577 # # # #J z"""""rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr3r*rrrr r s?MG&&&P # # # # #rr N)rrrpgen2rr fixer_utilrrr r compile_patternr&BaseFixr rrrrHs 222222222222&g%6 :#:#:#:#:#z!:#:#:#:#:#rPKH13] PL-fixes/__pycache__/fix_asserts.cpython-311.pycnu[ !A?hpdZddlmZddlmZedddddd d dddddd d ZGddeZdS)z5Fixer that replaces deprecated unittest method names.)BaseFix)Name assertTrue assertEqualassertNotEqualassertAlmostEqualassertNotAlmostEqual assertRegexassertRaisesRegex assertRaises assertFalse)assert_ assertEqualsassertNotEqualsassertAlmostEqualsassertNotAlmostEqualsassertRegexpMatchesassertRaisesRegexpfailUnlessEqual failIfEqualfailUnlessAlmostEqualfailIfAlmostEqual failUnlessfailUnlessRaisesfailIfcXeZdZddeeezZdZdS) FixAssertszH power< any+ trailer< '.' meth=(%s)> any* > |c|dd}|ttt||jdS)Nmeth)prefix)replacerNAMESstrr")selfnoderesultsnames F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_asserts.py transformzFixAsserts.transform sBvq! T%D *4;???@@@@@N) __name__ __module__ __qualname__joinmapreprr$PATTERNr+r,r*rrsOHHSSu--../GAAAAAr,rN)__doc__ fixer_baser fixer_utilrdictr$rr4r,r*r9s;;!   $*0%*! -,#    $AAAAAAAAAAr,PKH13]#7fixes/__pycache__/fix_methodattrs.cpython-311.opt-2.pycnu[ !A?h^R ddlmZddlmZddddZGddejZd S) ) fixer_base)Name__func____self__z__self__.__class__)im_funcim_selfim_classceZdZdZdZdZdS)FixMethodattrsTzU power< any+ trailer< '.' attr=('im_func' | 'im_self' | 'im_class') > any* > c|dd}t|j}|t||jdS)Nattr)prefix)MAPvaluereplacerr)selfnoderesultsr news J/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_methodattrs.py transformzFixMethodattrs.transformsBvq!$*o T#dk22233333N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrr r s/MG44444rr N)r fixer_utilrrBaseFixr rrrr#s~ % 4 4 4 4 4Z' 4 4 4 4 4rPKH13]ap 1fixes/__pycache__/fix_apply.cpython-311.opt-1.pycnu[ !A?h* hdZddlmZddlmZddlmZddlmZmZm Z Gddej Z dS) zIFixer for apply(). This converts apply(func, v, k) into (func)(*v, **k).)pytree)token) fixer_base)CallComma parenthesizeceZdZdZdZdZdS)FixApplyTa. power< 'apply' trailer< '(' arglist< (not argument ')' > > c~|j}|d}|d}|d}|r+|j|jjkr|jdjdvrdS|r-|j|jjkr|jdjdkrdS|j}|}|jtj |j fvr?|j|j ks |jdjtj krt|}d|_|}d|_||}d|_tjtjd |g}|N|t%tjtj d|gd |d_t'||| S) Nfuncargskwds>***rr )prefix)symsgettypeargumentchildrenvaluerclonerNAMEatompower DOUBLESTARrrLeafSTARextendrr) selfnoderesultsrr r rr l_newargss D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_apply.py transformzFixApply.transformsyvv{{6""   TY/// a &+55  TY$)"444]1%+t33 Fzz|| Iej$)4 4 4 Y$* $ $ ]2  #u'7 7 7%%D zz||  ::<r5s99 22222222226464646464z!6464646464r*PKH13]52fixes/__pycache__/fix_future.cpython-311.opt-2.pycnu[ !A?h#F ddlmZddlmZGddejZdS)) fixer_base) BlankLinec eZdZdZdZdZdZdS) FixFutureTz;import_from< 'from' module_name="__future__" 'import' any > c:t}|j|_|S)N)rprefix)selfnoderesultsnews E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_future.py transformzFixFuture.transformskk[  N)__name__ __module__ __qualname__ BM_compatiblePATTERN run_orderrrrrr s4MOGIrrN)r fixer_utilrBaseFixrrrrrsg""""""      "     rPKH13]d3 3 -fixes/__pycache__/fix_renames.cpython-311.pycnu[ !A?hhdZddlmZddlmZmZdddiiZiZdZdZ Gd d ej Z d S) z?Fix incompatible renames Fixes: * sys.maxint -> sys.maxsize ) fixer_base)Name attr_chainsysmaxintmaxsizec^ddtt|zdzS)N(|))joinmaprepr)memberss F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_renames.py alternatesrs( #dG,,-- - 33c #KttD]Q\}}t|D]*\}}|t||f<d|d|d|dVd|d|dV+RdS)Nz3 import_from< 'from' module_name=z, 'import' ( attr_name=z | import_as_name< attr_name=z! 'as' any >) > z& power< module_name=z trailer< '.' attr_name=z > any* > )listMAPPINGitemsLOOKUP)modulereplaceold_attrnew_attrs r build_patternrs 00++"&w}}"7"7 + + Hh)1FFH% & & 8885 5 5 5 5  + + + + + +++rcfeZdZdZdeZdZfdZdZ xZ S) FixRenamesTr prectt|j|}|r-tfdt |dDrdS|SdS)Nc3.K|]}|VdS)N).0objmatchs r z#FixRenames.match..5s+DD#55::DDDDDDrparentF)superrr&anyr)selfnoderesultsr& __class__s @rr&zFixRenames.match1sij$''-%++  DDDDD()C)CDDDDD uNurc|d}|d}|rF|rFt|j|jf}|t ||jdSdSdS)N module_name attr_name)prefix)getrvaluerrr2)r+r,r-mod_namer1rs r transformzFixRenames.transform>s;;}--KK ,,   G  Gx~y?@H   d8I4DEEE F F F F F G G G Gr) __name__ __module__ __qualname__ BM_compatibler rPATTERNorderr&r6 __classcell__)r.s@rrr*soMhh}}''G EGGGGGGGrrN) __doc__r fixer_utilrrrrrrBaseFixrr#rrrBs)))))))) Hy)  444+++*GGGGG#GGGGGrPKH13]\\2fixes/__pycache__/fix_idioms.cpython-311.opt-1.pycnu[ !A?h ddZddlmZddlmZmZmZmZmZm Z dZ dZ Gddej 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 ')' > >c XeZdZdZdedededed ZfdZdZdZ d Z d Z xZ S) FixIdiomsTz isinstance=comparison<  z8 T=any > | isinstance=comparison< T=any aX > | 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* > ctt||}|rd|vr|d|dkr|SdS|S)Nsortedid1id2)superr match)selfnoder __class__s E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_idioms.pyrzFixIdioms.matchOsT )T " " ( ( . .  Qx1U8##4cd|vr|||Sd|vr|||Sd|vr|||Std)N isinstancewhilerz Invalid match)transform_isinstancetransform_whiletransform_sort RuntimeError)rrresultss r transformzFixIdioms.transformZss 7 " ",,T7;; ;   ''g66 6  &&tW55 5// /rcb|d}|d}d|_d|_ttd|t |g}d|vr0d|_t t jtd|g}|j|_|S)NxTr rnnot)cloneprefixrrrrr not_test)rrr r#r$tests rrzFixIdioms.transform_isinstanceds CL    CL   D&&EGGQ88 '>>DK U T':;;Dk  rch|d}|td|jdS)NrTruer))replacerr))rrr ones rrzFixIdioms.transform_whileps3g D 33344444rc|d}|d}|d}|d}|r*|td|jne|rT|}d|_|t td|g|jnt d||j}d |vr|rJ|d d |d jf} d | |d _dSt} |j | |d d | _dSdS) Nsortnextlistexprrr.r%zshould not have reached here ) getr/rr)r(rrremove rpartitionjoinrparent append_child) rrr sort_stmt next_stmt list_call simple_exprnewbtwn prefix_linesend_lines rrzFixIdioms.transform_sorttsFO FO KK'' kk&))  ?   d8I4DEEE F F F F  ?##%%CCJ   T(^^cU,7,>!@!@!@ A A A A=>> > 4<< ;!% 5 5a 8)A,:MN &*ii &=&= ! ### %;; --h777#'//$"7"7":! rRs<AAAAAAAAAAAAAAAA81s;s;s;s;s; "s;s;s;s;s;rPKH13]2ww.fixes/__pycache__/fix_exitfunc.cpython-311.pycnu[ !A?h `dZddlmZmZddlmZmZmZmZm Z m Z Gddej Z dS)z7 Convert use of sys.exitfunc to use the atexit module. )pytree fixer_base)NameAttrCallCommaNewlinesymsc:eZdZdZdZdZfdZfdZdZxZ S) FixExitfuncTa ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) cBtt|j|dSN)superr __init__)selfargs __class__s G/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_exitfunc.pyrzFixExitfunc.__init__s#)k4  )40000chtt|||d|_dSr)rr start_tree sys_import)rtreefilenamers rrzFixExitfunc.start_tree!s. k4  ++D(;;;rc d|vr|j |d|_dS|d}d|_tjt jttdtd}t||g|j}| ||j| |ddS|jj d}|j t jkrF|t!|tdddS|jj}|j |j}|j} tjt jtd tddg} tjt j| g} ||dzt-||d z| dS) NrfuncatexitregisterzKCan't find sys import; Please add an atexit import at the top of your file. import)rcloneprefixrNoder powerrrrreplacewarningchildrentypedotted_as_names append_childrparentindex import_name simple_stmt insert_childr ) rnoderesultsrrcallnamescontaining_stmtpositionstmt_container new_importnews r transformzFixExitfunc.transform%s 7 " "&"),"7 Fv$$&& ;tz#DNND4D4DEE!!Htfdk22 T ? " LL ? @ @ @ F(+ :- - -   uww ' ' '   tHc22 3 3 3 3 3"o4O&/55doFFH,3NT%5#H~~tHc/B/BC  J+d. ==C  ( (Awyy A A A  ( (As ; ; ; ; ;r) __name__ __module__ __qualname__keep_line_order BM_compatiblePATTERNrrr< __classcell__)rs@rr r sqOM G11111#<#<#<#<#<#<#rIs '&&&&&&&EEEEEEEEEEEEEEEE=<=<=<=<=<*$=<=<=<=<=z(FixUnicode.transform.. sF"""IIeV,,44UFCC"""ruU) typerNAMEclone_mappingvalueSTRINGr joinsplit)rnoderesultsnewvals r transformzFixUnicode.transforms 9 " "**,,C ,CIJ Y%, & &*C( SVu__jj"" YYu--"""1v~~!""gdj   **,,CCIJ' &r)__name__ __module__ __qualname__ BM_compatiblePATTERNrr, __classcell__)rs@rr r sVM-GKKKKKrr N)__doc__pgen2rrr#BaseFixr rrr8sy% 0 0#rPKH13]+_EE1fixes/__pycache__/fix_input.cpython-311.opt-2.pycnu[ !A?hv ddlmZddlmZmZddlmZejdZGddejZ dS)) fixer_base)CallName)patcompz&power< 'eval' trailer< '(' any ')' > >ceZdZdZdZdZdS)FixInputTzL power< 'input' args=trailer< '(' [any] ')' > > ct|jjrdS|}d|_t t d|g|jS)Neval)prefix)contextmatchparentcloner rr)selfnoderesultsnews D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_input.py transformzFixInput.transformsS ==+ , ,  Fjjll DLL3% <<<<N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG=====rrN) r r fixer_utilrrrcompile_patternr BaseFixrrrrr!s:######## "' !"J K K = = = = =z! = = = = =rPKH13]s**/fixes/__pycache__/fix_metaclass.cpython-311.pycnu[ !A?h dZddlmZddlmZddlmZmZmZdZ dZ dZ dZ d Z d ZGd d ejZd S)aFixer for __metaclass__ = X -> (metaclass=X) methods. The various forms of classef (inherits nothing, inherits once, inherits 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)symsNodeLeafcP|jD]}|jtjkrt |cS|jtjkr`|jrY|jd}|jtjkr7|jr0|jd}t|tr|j dkrdSdS)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_node left_sides H/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_metaclass.pyrrs     9 " " && & & & Y$* * *t} * a(I~//I4F/%.q1 i.. !?::44 5c |jD]}|jtjkrdSt |jD]\}}|jt jkrntdttjg}|j|dzdr]|j|dz}| | | |j|dzd]| ||}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_nodes rfixup_parse_treer$-s ! 9 " " FF # X.//774 9 # # E $5666 R E  AaCDD !%ac*  9??,,---  AaCDD ! %   DDDrcnt|jD]\}}|jtjkrndS|t tjg}t tj |g}|j|drW|j|}| | ||j|dW| |||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 rSEMIr rrrrrr insert_childprefix) rr" stmt_nodesemi_indrnew_exprnew_stmtr# new_leaf1 old_leaf1s rfixup_simple_stmtr/Gs. $I$677$ 9 " " E # KKMMMDNB''HD$xj11H  XYY '&x0 ioo//000  XYY ' 8$$$!!$-a0I"1%.q1I 'Irc|jrA|jdjtjkr#|jddSdSdS)N)r r rNEWLINEr )rs rremove_trailing_newliner3_sQ }#r*/5=@@ b  """""##@@rc#K|jD]}|jtjkrnt dt t |jD]\}}|jtjkr|jr}|jd}|jtjkr[|jrT|jd}t|tr2|j dkr't|||t||||fVdS)NzNo class suite!r r )r r rr rlistrrrrrrr/r3)r!rr" simple_noder left_nodes r find_metasr8ds!,, 9 " " E #*+++y7788 1 1;  t/ / /K4H /#,Q/I~//I4F/%.q1 i..1!?::%dA{;;;+K888K0000 1 1rcp|jddd}|r,|}|jtjkrn|,|ru|}t |t r%|jtjkr|jrd|_dS| |jddd|sdSdS)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 Nr1) r popr rINDENTrrDEDENTr(extend)r kidsrs r fixup_indentr@{s >$$B$ D xxzz 9 $ $   -xxzz dD ! ! -di5<&?&?{ !  F KK ddd+ , , , -----rceZdZdZdZdZdS) FixMetaclassTz classdef ct|sdSt|d}t|D]\}}}|}||jdj}t |jdkr|jdjtjkr|jd}nN|jd } ttj| g}| d|nt |jdkr1ttjg}| d|nt |jdkrttjg}| dttjd| d|| dttjdnt#d |jdjd} d | _| j} |jr5|ttjd d | _nd | _|jd} | jtjksJd | jd_d | jd_||t/||jso|t|d} | | _|| |ttjddSt |jdkr|jdjtjkrx|jdjtjkrZt|d} | d| | dttjddSdSdSdS)Nr r)(zUnexpected class definition metaclass, r:rpass r1)rr$r8r r r lenrarglistrr set_childr'rrRPARLPARrrr(rCOMMArr@r2r<r=)selfrresultslast_metaclassr r"stmt text_typerQrmeta_txtorig_meta_prefixr pass_leafs r transformzFixMetaclass.transformsT""  F(..  NE1d!N KKMMMMM!$)  t}   " "}Q$ 44-*q)//11t|fX66q'****   1 $ $4<,,G   a ) ) ) )   1 $ $4<,,G   aej#!6!6 7 7 7   a ) ) )   aej#!6!6 7 7 7 7:;; ;"*1-6q9$#?   !  ek3!7!7 8 8 8!HOO HO#+A. ~////') 1$') 1$^,,,U~ > LLNNNY//I/I    i ( ( (   d5=$77 8 8 8 8 8  1 $ $.$)U\99.$)U\99Y//I   r9 - - -   r4 t#<#< = = = = = % $9999rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr^rrrBrBs4MGL>L>L>L>L>rrBN)__doc__r:rpygramr fixer_utilrrrrr$r/r3r8r@BaseFixrBrdrrris())))))))))&4(((0### 111.---,S>S>S>S>S>:%S>S>S>S>S>rPKH13]U,Oc c +fixes/__pycache__/fix_throw.cpython-311.pycnu[ !A?h.pdZddlmZddlmZddlmZddlmZmZm Z m Z m Z Gddej 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_tupleceZdZdZdZdZdS)FixThrowTz power< any trailer< '.' 'throw' > trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > | power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > > c|j}|d}|jtjur||ddS|d}|dS|}t|rd|jddD}n d|_ |g}|d}d |vr|d }d|_ t||} t| td t|ggz} |tj|j| dS|t||dS) Nexcz+Python 3 does not support string exceptionsvalc6g|]}|S)clone).0cs D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_throw.py z&FixThrow.transform..)s :::!AGGII:::argstbwith_traceback)symsrtyperSTRINGcannot_convertgetr childrenprefixrr rrreplacerNodepower) selfnoderesultsrrrr throw_argsrewith_tbs r transformzFixThrow.transforms[yen""$$ 8u| # #   &S T T T Fkk%   ; Fiikk C== ::s|AbD'9:::DDCJ5DV_ 7??$$&&BBIS$A1d#34455"GG   v{4:w?? @ @ @ @ @   tC / / / / /rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr.rrrr r s/MG00000rr N)__doc__rrpgen2rr fixer_utilrrrr r BaseFixr rrrr8s??<<<<<<<<<<<<<<(0(0(0(0(0z!(0(0(0(0(0rPKH13]sChD2fixes/__pycache__/fix_filter.cpython-311.opt-2.pycnu[ !A?h n ddlmZddlmZddlmZddlmZm Z m Z m Z m Z Gddej ZdS)) fixer_base)Node)python_symbols)NameArgListListCompin_special_context parenthesizec eZdZdZdZdZdZdS) 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.filterc||rdSg}d|vr2|dD])}||*d|vr|d}|jt jkrd|_t|}t|d|d|d|}tt j |g|zd}n d|vrrttd td |d td }tt j |g|zd}nt|rdS|d }tt j td |gd}tt j td t|gg|z}d|_|j|_|S)Nextra_trailers filter_lambdaxpfpit)prefixnone_fseqargsfilterlist) should_skipappendclonegettypesymstestrr rrpowerrr r)selfnoderesultstrailerstrnewrs E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_filter.py transformzFixFilter.transform:s   D ! !  F w & &-. + + **** g % %T""((**Bw$)## !"%%7;;t,,2244";;t,,2244";;t,,2244b::CtzC58#3B???CC w  4::::"5>//11::''CtzC58#3B???CC"$'' t6?((**DtzDNND#9"EEECtzDLL'3%..#AH#LMMCCJ[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr*r+r)r r s6MG<'G$$$$$r+r N)rrpytreerpygramrr fixer_utilrrrr r ConditionalFixr r2r+r)r7s ++++++RRRRRRRRRRRRRRGGGGG )GGGGGr+PKH13]ǺJ445fixes/__pycache__/fix_funcattrs.cpython-311.opt-1.pycnu[ !A?hHdZddlmZddlmZGddejZdS)z3Fix function attribute names (f.func_x -> f.__x__).) fixer_base)NameceZdZdZdZdZdS) FixFuncattrsTz power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals' | 'func_name' | 'func_defaults' | 'func_code' | 'func_dict') > any* > c|dd}|td|jddz|jdS)Nattrz__%s__)prefix)replacervaluer )selfnoderesultsrs H/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_funcattrs.py transformzFixFuncattrs.transformsWvq! T8djn4!%... / / / / /N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG /////rrN)__doc__r fixer_utilrBaseFixrrrrrsh99 / / / / /:% / / / / /rPKH13]cc7fixes/__pycache__/fix_numliterals.cpython-311.opt-1.pycnu[ !A?hTdZddlmZddlmZddlmZGddejZdS)z-Fixer that turns 1L into 1, 0755 into 0o755. )token) fixer_base)Numberc(eZdZejZdZdZdS)FixNumliteralscT|jdp|jddvS)N0Ll)value startswith)selfnodes J/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_numliterals.pymatchzFixNumliterals.matchs( %%c**Ddjn.DEc|j}|ddvr |dd}nV|drA|r-tt |dkr d|ddz}t ||jS)Nr r r 0o)prefix)r r isdigitlensetrr)rrresultsvals r transformzFixNumliterals.transformsj r7d??crc(CC ^^C  !S[[]] !s3s88}}q7H7HQRR.Cc$+....rN)__name__ __module__ __qualname__rNUMBER _accept_typerrrrrr s>r(s~ /////Z'/////rPKH13]ù3fixes/__pycache__/fix_standarderror.cpython-311.pycnu[ !A?hHdZddlmZddlmZGddejZdS)z%Fixer for StandardError -> Exception.) fixer_base)NameceZdZdZdZdZdS)FixStandarderrorTz- 'StandardError' c.td|jS)N Exception)prefix)rr )selfnoderesultss L/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_standarderror.py transformzFixStandarderror.transformsK 4444N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrr rr s/MG55555rrN)__doc__r fixer_utilrBaseFixrrrr rsj,+55555z)55555rPKH13]G5fixes/__pycache__/fix_raw_input.cpython-311.opt-2.pycnu[ !A?hF ddlmZddlmZGddejZdS)) fixer_base)NameceZdZdZdZdZdS) FixRawInputTzU power< name='raw_input' trailer< '(' [any] ')' > any* > ch|d}|td|jdS)Nnameinput)prefix)replacerr )selfnoderesultsrs H/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_raw_input.py transformzFixRawInput.transforms2v T'$+66677777N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrs/MG88888rrN)r fixer_utilrBaseFixrrrrrse8 8 8 8 8 8*$ 8 8 8 8 8rPKH13]{oHH0fixes/__pycache__/fix_dict.cpython-311.opt-1.pycnu[ !A?hdZddlmZddlmZddlmZddlmZmZmZddlmZej dhzZ Gdd 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_utilitercjeZdZdZdZdZdZejeZ dZ eje Z dZ dS)FixDictTa power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues'| 'viewkeys'|'viewitems'|'viewvalues') > parens=trailer< '(' ')' > tail=any* > c |d}|dd}|d}|j}|j}|d}|d} |s| r |dd}d|D}d |D}| o|||} |t j|jtt||j g|d  gz} t j|j | } | s+| s)d | _ tt|rdnd | g} |rt j|j | g|z} |j | _ | S)Nheadmethodtailr viewc6g|]}|Sclone.0ns C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_dict.py z%FixDict.transform..A (((a (((c6g|]}|Srrrs rrz%FixDict.transform..Brr)prefixparenslist) symsvalue startswithin_special_contextrNodetrailerrrr rpowerr) selfnoderesultsrrrr$ method_nameisiterisviewspecialargsnews r transformzFixDict.transform6sv"1%vyl ''//''//  *V *%abb/K((4(((((4((((Dt66tVDDv{4<$'EE$(06 %?%?%?$@AAx(..00 22 k$*d++ B6 BCJtf8FF&99C5AAC  8+dj3%$,77C[  rz3power< func=NAME trailer< '(' node=any ')' > any* >zmfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > cH|jdSi}|jj^|j|jj|r9|d|ur/|r|djtvS|djt jvS|sdS|j|j|o |d|uS)NFr,func)parentp1matchr% iter_exemptr consuming_callsp2)r+r,r/r-s rr'zFixDict.in_special_contextZs ; 5 K  *w}}T[/99 +v$&& Kv, ;;v, 0JJJ 5w}}T['22Nwv$7NNrN) __name__ __module__ __qualname__ BM_compatiblePATTERNr4P1rcompile_patternr8P2r<r'rrrr r )swMG8 ?B   $ $B B !  $ $BOOOOOrr N) __doc__r"rrrr rrrr;r:BaseFixr rrrrGs6(((((((((((F83 AOAOAOAOAOj AOAOAOAOAOrPKH13]34fixes/__pycache__/fix_ws_comma.cpython-311.opt-2.pycnu[ !A?hBR ddlmZddlmZddlmZGddejZdS))pytree)token) fixer_basec|eZdZdZdZejejdZejej dZ ee fZ dZ dS) FixWsCommaTzH any<(not(',') any)+ ',' ((not(',') any)+ ',')* [not(',') any]> ,:c|}d}|jD]H}||jvr)|j}|r d|vrd|_d}4|r|j}|sd|_d}I|S)NF T )clonechildrenSEPSprefixisspace)selfnoderesultsnewcommachildrs G/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_ws_comma.py transformzFixWsComma.transformsjjll\  E !!>>##&F(:(:#%EL+"\F!+'*  N) __name__ __module__ __qualname__explicitPATTERNrLeafrCOMMACOLONrrrrrr sdHG FK S ) )E FK S ) )E 5>DrrN)r rpgen2rrBaseFixrr$rrr'sy#rPKH13]-9V773fixes/__pycache__/fix_has_key.cpython-311.opt-2.pycnu[ !A?h| V ddlmZddlmZddlmZmZGddejZdS))pytree) fixer_base)Name parenthesizeceZdZdZdZdZdS) 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 J|j}|jj|jkr!|j|jrdS|d}|d}|j}d|dD}|d}|d} | r d| D} |j|j |j|j |j |j |j |jfvrt|}t!|dkr |d }nt#j|j|}d |_t)d d } |r-t)d d } t#j|j| | f} t#j|j || |f} | r:t| } t#j|j| ft-| z} |jj|j |j|j|j|j|j|j|j|jf vrt| } || _| S)Nnegationanchorc6g|]}|Sclone.0ns F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_has_key.py z'FixHasKey.transform..Rs 777!''))777beforeargafterc6g|]}|Sr rrs rrz'FixHasKey.transform..Vs ...1QWWYY...r in)prefixnot)symsparenttypenot_testpatternmatchgetrr comparisonand_testor_testtestlambdefargumentrlenrNodepowerrcomp_optupleexprxor_exprand_expr shift_expr arith_exprtermfactor) selfnoderesultsr r r rrrrn_opn_notnews r transformzFixHasKey.transformGsy K  - - L  t{ + + .4;;z**"77WX%6777en""$$ G$$  /.....E 8  dit}N N Ns##C v;;!  AYFF[V44F D%%%  <s+++E;t|eT];;Dk$/Cv+>??  As##C+dj3&5<<*?@@C ; DM $ t $ $ TZ 9 9 9s##C  rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr?r rrrr&s/MG<&&&&&rrN)rr fixer_utilrrBaseFixrr rrrHs:++++++++GGGGG "GGGGGrPKH13]U663fixes/__pycache__/fix_imports.cpython-311.opt-1.pycnu[ !A?h4RdZddlmZddlmZmZiddddddd d d d d ddddddddddddddddddddd d!d"id#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdDdEdFdGdHdIdJdJdJdKdLdLdMdNdOZdPZefdQZGdRdSej Z dTS)Uz/Fix incompatible imports and module references.) fixer_base)Name attr_chainStringIOio cStringIOcPicklepickle __builtin__builtinscopy_regcopyregQueuequeue SocketServer socketserver ConfigParser configparserreprreprlib FileDialogztkinter.filedialog tkFileDialog SimpleDialogztkinter.simpledialogtkSimpleDialogtkColorChooserztkinter.colorchoosertkCommonDialogztkinter.commondialogDialogztkinter.dialogTkdndz tkinter.dndtkFontz tkinter.font tkMessageBoxztkinter.messagebox ScrolledTextztkinter.scrolledtext Tkconstantsztkinter.constantsTixz tkinter.tixttkz tkinter.ttkTkintertkinter markupbase _markupbase_winregwinregthread_thread dummy_thread _dummy_threaddbhashzdbm.bsddumbdbmzdbm.dumbdbmzdbm.ndbmgdbmzdbm.gnu xmlrpclibz xmlrpc.clientDocXMLRPCServerz xmlrpc.serverz http.clientz html.entitiesz html.parserz http.cookieszhttp.cookiejarz http.server subprocess collectionsz urllib.parsezurllib.robotparser)SimpleXMLRPCServerhttplibhtmlentitydefs HTMLParserCookie cookielibBaseHTTPServerSimpleHTTPServer CGIHTTPServercommands UserStringUserListurlparse robotparserc^ddtt|zdzS)N(|))joinmapr)memberss F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_imports.py alternatesrM=s( #dG,,-- - 33c#Kdd|D}t|}d|d|dVd|zVd|d|d Vd |zVdS) Nz | cg|]}d|zS)zmodule_name='%s').0keys rL z!build_pattern..BsGGG-3GGGrNz$name_import=import_name< 'import' ((z;) | multiple_imports=dotted_as_names< any* (z) any* >) > zimport_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > z(import_name< 'import' (dotted_as_name< (zg) 'as' any > | multiple_imports=dotted_as_names< any* dotted_as_name< (z!) 'as' any > any* >) > z3power< bare_with_attr=(%s) trailer<'.' any > any* >)rIrMkeys)mappingmod_list bare_namess rL build_patternrYAszzGGwGGGHHHGLLNN++JJ888 %%%%  888 %%%% @* LLLLLLrNcNeZdZdZdZeZdZdZfdZ fdZ fdZ dZ xZ S) FixImportsTcPdt|jS)NrG)rIrYrV)selfs rLrYzFixImports.build_pattern`sxx dl33444rNc||_tt|dSN)rYPATTERNsuperr[compile_pattern)r^ __class__s rLrczFixImports.compile_patterncs:))++  j$//11111rNctt|j|}|r1d|vr+tfdt |dDrdS|SdS)Nbare_with_attrc3.K|]}|VdSr`rQ)rRobjmatchs rL z#FixImports.match..qs+IIsc IIIIIIrNparentF)rbr[rianyr)r^noderesultsrirds @rLrizFixImports.matchjsvj$''-%++   w..IIIIjx.H.HIIIII/uNurNchtt|||i|_dSr`)rbr[ start_treereplace)r^treefilenamerds rLrpzFixImports.start_treevs. j$**4::: rNc|d}|r|j}|j|}|t ||jd|vr ||j|<d|vr/||}|r|||dSdSdS|dd}|j|j}|r+|t ||jdSdS)N module_name)prefix name_importmultiple_importsrf)getvaluerVrqrrvri transform)r^rmrn import_modmod_namenew_name bare_names rLr|zFixImports.transformzs'[[//  K!'H|H-H   tHZ5FGGG H H H''*2 X&!W,, **T**2NN411111-, 22 01!4I|'' 88H K!!$x 8H"I"I"IJJJJJ K KrN)__name__ __module__ __qualname__ BM_compatiblekeep_line_orderMAPPINGrV run_orderrYrcrirpr| __classcell__)rds@rLr[r[UsMOGI55522222     KKKKKKKrNr[N) __doc__r fixer_utilrrrrMrYBaseFixr[rQrNrLrs55))))))))2 :2  2  h2  :2  y 2  G 2  > 2  >2  92  -2  /2  12  32  32  32  %2  M!2 2 " ^#2 $ /%2 & 1'2 ( -)2 * -+2 , --2 . i/2 0 12 2 h32 4 Y52 6 ?72 : Y;2 < j=2 > *?2 @ 9A2 B C2 D oE2 2 F"1#-'#(*,)#'%&/c2 2 2 j444"MMMM(<K<K<K<K<K#<K<K<K<K<KrNPKH13]jrr.fixes/__pycache__/fix_ne.cpython-311.opt-1.pycnu[ !A?h;TdZddlmZddlmZddlmZGddejZdS)zFixer that turns <> into !=.)pytree)token) fixer_basec(eZdZejZdZdZdS)FixNec|jdkS)Nz<>)value)selfnodes A/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_ne.pymatchz FixNe.matchszT!!cRtjtjd|j}|S)Nz!=)prefix)rLeafrNOTEQUALr)r r resultsnews r transformzFixNe.transforms!k%.$t{CCC rN)__name__ __module__ __qualname__rr _accept_typer rrr rr s;>L"""rrN)__doc__rpgen2rrBaseFixrrrr rs|#"     J      rPKH13]#::*fixes/__pycache__/fix_exec.cpython-311.pycnu[ !A?hPdZddlmZddlmZmZmZGddejZdS)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)CommaNameCallceZdZdZdZdZdS)FixExecTzx exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > | exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > c|sJ|j}|d}|d}|d}|g}d|d_|5|t |g|5|t |gt td||jS)Nabcexec)prefix)symsgetclonerextendrrr)selfnoderesultsrr r r argss C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_exec.py transformzFixExec.transformswy CL KK   KK   {Q = KK!'')), - - - = KK!'')), - - -DLL$t{;;;;N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrs/MG < < < < r%sx**********<<<<) any ','> ) rpar=')' > after=any* > c|r5|d}|r+|j|jjkr|jdjdvrdSd}t |||}t dd||S)Nobj>***)sysinternr)typesymsargumentchildrenvaluerr)selfnoderesultsr namesnews E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_intern.py transformzFixIntern.transformsu  %.C H 222LO)[88F!D'511T5$''' N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrr s4M EG     rrN)r fixer_utilrrBaseFixrr#rrr'sm 44444444 "rPKH13]~3fixes/__pycache__/fix_sys_exc.cpython-311.opt-1.pycnu[ !A?h `dZddlmZddlmZmZmZmZmZm Z m Z Gddej 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 SubscriptNodesymscdeZdZgdZdZdddeDzZdZdS) FixSysExc)exc_type exc_value exc_tracebackTzN power< 'sys' trailer< dot='.' attribute=(%s) > > |c# K|] }d|zV dS)z'%s'N).0es F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_sys_exc.py zFixSysExc.s&::AVaZ::::::c|dd}t|j|j}t t d|j}tt d|}|dj|djd_| t|ttj ||jS)N attributeexc_info)prefixsysdot)rrindexvaluerrrrchildrenappendrr r power)selfnoderesultssys_attrr callattrs r transformzFixSysExc.transforms;'*t}**8>::;;D$$X_===DKK&&%,U^%:Q" Ie$$%%%DJT[9999rN)__name__ __module__ __qualname__r BM_compatiblejoinPATTERNr+rrrr r s]999HMHH:::::::;G:::::rr N) __doc__r fixer_utilrrrrrr r BaseFixr rrrr6sHHHHHHHHHHHHHHHHHH::::: ":::::rPKH13]/ن2fixes/__pycache__/fix_import.cpython-311.opt-2.pycnu[ !A?h l ddlmZddlmZmZmZmZddlmZm Z m Z dZ Gddej Z dS) ) fixer_base)dirnamejoinexistssep) FromImportsymstokenc#K |g}|r|}|jtjkr |jVn|jt jkr'dd|jDVn~|jt j kr!| |jdnH|jt j kr$| |jdddntd|dSdS)Ncg|] }|j S)value).0chs E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_import.py z$traverse_imports..s<<<28<<<rzunknown node type)poptyper NAMErr dotted_namerchildrendotted_as_nameappenddotted_as_namesextendAssertionError)namespendingnodes rtraverse_importsr$sgG  6{{}} 9 " "*     Y$* * *''< | import_name< 'import' imp=any > cvtt|||d|jv|_dS)Nabsolute_import)superr& start_treefuture_featuresskip)selftreename __class__s rr*zFixImport.start_tree/s6 i))$555%)== rc|jrdS|d}|jtjkrnt |ds|jd}t |d||jr%d|jz|_|dSdSd}d}t|D]}||rd}d}|r|r| |ddStd|g}|j |_ |S)Nimprr.FTz#absolute and local imports together) r,rr import_fromhasattrrprobably_a_local_importrchangedr$warningr prefix)r-r#resultsr2 have_local have_absolutemod_namenews r transformzFixImport.transform3s0 9  Fen 9( ( ( c7++ &l1oc7++ &++CI66 #)O    J!M,S11 ) )//99)!%JJ$(MM NLL'LMMMS3%((CCJJrcV|drdS|ddd}t|j}t ||}t t t|dsdSdt ddd d fD]}t ||zrd SdS) Nr3Frz __init__.pyz.pyz.pycz.soz.slz.pydT) startswithsplitrfilenamerrr)r-imp_name base_pathexts rr6z!FixImport.probably_a_local_importUs   s # # 5>>#q))!,DM** H-- d79--}==>> 53uf=  Ci#o&& tt ur) __name__ __module__ __qualname__ BM_compatiblePATTERNr*r?r6 __classcell__)r0s@rr&r&&scMG >>>>>   Drr&N)r ros.pathrrrr fixer_utilr r r r$BaseFixr&rrrrQs ............0000000000666&===== "=====rPKH13]} 7fixes/__pycache__/fix_set_literal.cpython-311.opt-1.pycnu[ !A?hPdZddlmZmZddlmZmZGddejZdS)z: Optional fixer to transform set() calls to set literals. ) fixer_basepytree)tokensymsc eZdZdZdZdZdZdS) FixSetLiteralTajpower< 'set' trailer< '(' (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) > | single=any) ']' > | atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' > ) ')' > > c|d}|rJtjtj|g}|||}n|d}tjtj dg}| d|j D| tjtj d|jj|d_tjtj|}|j|_t#|j dkr8|j d}||j|j d_|S) Nsingleitems{c3>K|]}|VdS)N)clone).0ns J/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_set_literal.py z*FixSetLiteral.transform..'s*99Qqwwyy999999})getrNoder listmakerrreplaceLeafrLBRACEextendchildrenappendRBRACE next_siblingprefix dictsetmakerlenremove) selfnoderesultsr faker literalmakerrs r transformzFixSetLiteral.transforms.X&&  %;t~ /?@@D NN4 EEG$E;u|S11299%.999999v{5<55666"/6  D-w77{  u~  ! # #q!A HHJJJ()EN2  % rN)__name__ __module__ __qualname__ BM_compatibleexplicitPATTERNr-rrrr s4MHGrrN) __doc__lib2to3rrlib2to3.fixer_utilrrBaseFixrr4rrr9sx '&&&&&&&********)))))J&)))))rPKH13]4*!!2fixes/__pycache__/fix_tuple_params.cpython-311.pycnu[ !A?hdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z dZ GddejZd Zd Zgd fd Zd Zd S)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 Subscriptsymscvt|tjo|jdjt jkS)N) isinstancerNodechildrentyperSTRING)stmts K/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_tuple_params.py is_docstringrs/ dFK ( ( 1 =  EL 01c&eZdZdZdZdZdZdZdS)FixTupleParamsTa funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > c d|vr||Sg |d}|d}|djdjtjkr)d}|djdj}t n#d}d}tjtjd d fd }|jtj kr ||nU|jtj kr@t|jD]+\}} | jtj kr|| |dk , sdS D]} |d| _ |} |dkrd d_n2t|dj|r| d_|dz} D]} |d| _  |dj| | <t!| dz| t# zdzD]}||dj|_|ddS)Nlambdasuiteargsr rz; Fct}|}d|_t ||}|rd|_||tjtj |gdS)Nr ) rnew_namecloneprefixrreplaceappendrrr simple_stmt) tuple_arg add_prefixnargrend new_linesselfs r handle_tuplez.FixTupleParams.transform..handle_tupleCsT]]__%%A//##CCJ#qwwyy))D    a   V[)9*. )<>> ? ? ? ? ?r)r)r!)F)transform_lambdarrrINDENTvaluerrLeafr tfpdef typedargslist enumerateparentr$rrangelenchanged)r.noderesultsrrstartindentr/ir+lineafterr,r-s` @@r transformzFixTupleParams.transform.sM w  ((w77 7  v 8 Q  $ 4 4E1X&q)/F))CCEF+elB//C ? ? ? ? ? ? ? ? 9 # # L     Y$, , ,#DM22 : :38t{**!L!a%9999  F # #D(DKK A::"%IaL   %(+E2 3 3 "(IaL AIE # #D(DKK)2a%+&uQwc)nn 4Q 677 1 1A*0E!H a ' ' arc|d}|d}t|d}|jtjkr2|}d|_||dSt|}t|}| t|}t|d} || | D]} | jtjkrv| j |vrmd|| j D} tjt j| g| z} | j| _| | dS)Nrbodyinnerr!)r$c6g|]}|S)r#.0cs r z3FixTupleParams.transform_lambda..s CCCAaggiiCCCr) simplify_argsrrNAMEr#r$r% find_params map_to_indexr" tuple_namer post_orderr2rrr power) r.r;r<rrDrEparamsto_indextup_name new_paramr* subscriptsnews rr0zFixTupleParams.transform_lambdans`vvgg.// : # #KKMMEEL LL    FT""''==F!3!344#...  Y__&&'''""  Av##8(;(;CC!'1BCCC k$*#,??#4#4"5 "BDDX  #   rN)__name__ __module__ __qualname__ run_order BM_compatiblePATTERNrBr0rGrrrrsDIMG>>>@rrc|jtjtjfvr|S|jtjkr9|jtjkr"|jd}|jtjk"|Std|z)NrzReceived unexpected node %s)rr vfplistrrMvfpdefr RuntimeErrorr;s rrLrLss yT\5:... dk ! !i4;&&=#Di4;&& 4t; < <.s, K K KqQVu{5J5JKNN5J5J5Jr)rr rarNrrrMr2rcs rrNrNsS yDK4=+,,, ej z K KDM K K KKrNc|i}t|D]_\}}ttt|g}t |t rt |||W||z||<`|S)N)d)r6r r strrlistrO) param_listr$rhr?objtrailers rrOrOsy J''&&3VCFF^^,,- c4  & g + + + + +g%AcFF Hrcg}|D]O}t|tr#|t|:||Pd|S)N_)rrjr&rPjoin)rklrls rrPrPsd A c4   HHZ__ % % % % HHSMMMM 88A;;r)__doc__rrpgen2rr fixer_utilrrrr r r rBaseFixrrLrNrOrPrGrrrvs*GGGGGGGGGGGGGGGG111gggggZ'gggX = = =LLL%'$     rPKH13]Y^, 0fixes/__pycache__/fix_isinstance.cpython-311.pycnu[ !A?hHHdZddlmZddlmZGddejZdS)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 eZdZdZdZdZdZdS) FixIsinstanceTz power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > ct}|d}|j}g}t|}|D]\}} | jtjkrN| j|vrE|t|dz kr.||dzjtjkrt|gh| | | jtjkr| | j|r|djtjkr|d=t|dkr6|j } | j |d_ | |ddS||dd<|dS)Nargs)setchildren enumeratetyperNAMEvaluelenCOMMAnextappendaddparentprefixreplacechanged) selfnoderesultsnames_insertedtestlistr new_argsiteratoridxargatoms I/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_isinstance.py transformzFixIsinstance.transformsO6? T??  2 2HCx5:%%#)~*E*ETQ&&4a=+=+L+LNNN$$$8uz))"&&sy111   )U[88 x==A  ?D!%HQK  LL! % % % % %DG LLNNNNNN)__name__ __module__ __qualname__ BM_compatiblePATTERN run_orderr'r(r&rrs6MGIr(rN)__doc__r fixer_utilrBaseFixrr/r(r&r4sl$$$$$J&$$$$$r(PKH13]BOkk5fixes/__pycache__/fix_itertools.cpython-311.opt-1.pycnu[ !A?h HdZddlmZddlmZGddejZdS)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:eZdZdZdZdezZdZdZdS) 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] ')' > > cfd}|dd}d|vrb|jdvrY|d|d}}|j}|||j||p|j}|t |jdd|dS)Nfuncit) ifilterfalse izip_longestdot)prefix)valuerremoveparentreplacer)selfnoderesultsrr rr s H/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_itertools.py transformzFixItertools.transformsvq! GOO J> > >u~wt}CYF IIKKK JJLLL K   % % %&4; T$*QRR.88899999N) __name__ __module__ __qualname__ BM_compatibleit_funcslocalsPATTERN run_orderrrrrrsKMHH FHH GI:::::rrN)__doc__r fixer_utilrBaseFixrr#rrr(sl::::::%:::::rPKH13] 1 &&2fixes/__pycache__/fix_urllib.cpython-311.opt-2.pycnu[ !A?h  ddlmZmZddlmZmZmZmZmZm Z m Z dgdfdgdfddgfgdgd fdd d gfgd Z e d  e dddZ GddeZdS)) alternates FixImports)NameComma FromImportNewlinefind_indentationNodesymszurllib.request) URLopenerFancyURLopener urlretrieve _urlopenerurlopen urlcleanup pathname2url url2pathname getproxiesz urllib.parse)quote quote_plusunquote unquote_plus urlencode splitattr splithost splitnport splitpasswd splitport splitquerysplittag splittype splituser splitvaluez urllib.errorContentTooShortError)rinstall_opener build_openerRequestOpenerDirector BaseHandlerHTTPDefaultErrorHandlerHTTPRedirectHandlerHTTPCookieProcessor ProxyHandlerHTTPPasswordMgrHTTPPasswordMgrWithDefaultRealmAbstractBasicAuthHandlerHTTPBasicAuthHandlerProxyBasicAuthHandlerAbstractDigestAuthHandlerHTTPDigestAuthHandlerProxyDigestAuthHandler HTTPHandler HTTPSHandler FileHandler FTPHandlerCacheFTPHandlerUnknownHandlerURLError HTTPError)urlliburllib2r?r>c #Kt}tD]P\}}|D]H}|\}}t|}d|d|dVd|d|d|dVd|zVd |zVd |d |d VIQdS) Nzimport_name< 'import' (module=zB | dotted_as_names< any* module=z any* >) > zimport_from< 'from' mod_member=z* 'import' ( member=z | import_as_name< member=z] '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 > > zpower< bare_with_attr=z trailer< '.' member=z > any* > )setMAPPINGitemsr)bare old_modulechangeschange new_modulememberss E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_urllib.py build_patternrL0s 55D&}}.. G . .F"( J ))GG$ZZZ1 1 1 1 1 $WWWggg7 7 7 7"# # # #"# # # # # $WWW. . . . .! ...c,eZdZdZdZdZdZdZdS) FixUrllibcDdtS)N|)joinrL)selfs rKrLzFixUrllib.build_patternIsxx (((rMc |d}|j}g}t|jddD]:}|t |d|t g;|t t|jdd|||dS)Nmodulerprefix) getrXrCvalueextendrrappendreplace)rSnoderesults import_modprefnamesnames rKtransform_importzFixUrllib.transform_importLs [[**  J,-crc2 @ @D LL$tAwt444egg> ? ? ? ? T'*"23B7:4HHHIII5!!!!!rMc |d}|j}|d}|rt|tr|d}d}t|jD]}|j|dvr |d}n|r&|t||dS||ddSg}i} |d} | D]}|j tj kr%|j dj} |j dj} n |j} d} | d krst|jD]`}| |dvrT|d| vr| |d| |dg |ag} t|}d }d }|D]}| |}g}|dd D]B}||||| t#C|||d |t%||}|r|jj|r||_| |d }| rdg}| dd D]%}||t+g&| | d ||dS||ddS)N mod_membermemberrr@rW!This is an invalid module elementrJ,TcL|jtjkryt|jdj||jd|jdg}ttj|gSt|j|gS)NrrWr@ri)typer import_as_namerchildrenrZcloner )rcrXkidss rK handle_namez/FixUrllib.transform_member..handle_names9 333 q!1!7GGG M!,2244 M!,22446D!!4d;;<<TZ77788rMrVFzAll module elements are invalid)rYrX isinstancelistrCrZr]rcannot_convertrlr rmrnr\ setdefaultr r[rrparentendswithr)rSr^r_rfrargnew_namerHmodulesmod_dictrJas_name member_name new_nodes indentationfirstrqrUeltsrbeltnewnodesnew_nodes rKtransform_memberzFixUrllib.transform_member\se [[..  X&& @ M&$'' #H!*"23  <6!9,,%ayHE- O""4#>#>#>?????##D*MNNNNN GHi(G! N N;$"555$oa06G"(/!"4":KK"(,K"G#%%")**:";NN&&)33%ay88 'vay 9 9 9$//q 2>>EEfMMMI*400KE 9 9 9"  '9**CLLS$!7!7888LL)))) [[b488999 //- 2 ; ;K H H-!,CJ  %%% M )#2#88HLL(GII!67777 Yr]+++ U#######D*KLLLLLrMc| |d}|d}d}t|tr|d}t|jD]}|j|dvr |d}n|r+|t ||jdS||ddS)Nbare_with_attrrgrr@rWrh) rYrrrsrCrZr]rrXrt)rSr^r_ module_dotrgrxrHs rK transform_dotzFixUrllib.transform_dots<[[!122 X&& fd # # AYFj./  F|vay((!!9)  K   tH+5+< > > > ? ? ? ? ?   &I J J J J JrMc|dr|||dS|dr|||dS|dr|||dS|dr||ddS|dr||ddSdS)NrUrfr module_starzCannot handle star imports. module_asz#This module is now multiple modules)rYrdrrrt)rSr^r_s rK transformzFixUrllib.transforms ;;x M  ! !$ 0 0 0 0 0 [[ & & M  ! !$ 0 0 0 0 0 [[) * * M   tW - - - - - [[ ' ' M   &C D D D D D [[ % % M   &K L L L L L M MrMN)__name__ __module__ __qualname__rLrdrrrrMrKrOrOGsn)))""" JMJMJMXKKK" M M M M MrMrON)lib2to3.fixes.fix_importsrrlib2to3.fixer_utilrrrrr r r rCr\rLrOrrMrKrs=<<<<<<<>>>>>>>>>>>>>>>>>>"CCCD ???@  +,. /" ' ' ' ( -/   B '(+A.///....}M}M}M}M}M }M}M}M}M}MrMPKH13]Jw5fixes/__pycache__/fix_itertools.cpython-311.opt-2.pycnu[ !A?h F ddlmZddlmZGddejZdS)) fixer_base)Namec:eZdZdZdZdezZdZdZdS) 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] ')' > > cfd}|dd}d|vrb|jdvrY|d|d}}|j}|||j||p|j}|t |jdd|dS)Nfuncit) ifilterfalse izip_longestdot)prefix)valuerremoveparentreplacer)selfnoderesultsrr rr s H/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_itertools.py transformzFixItertools.transformsvq! GOO J> > >u~wt}CYF IIKKK JJLLL K   % % %&4; T$*QRR.88899999N) __name__ __module__ __qualname__ BM_compatibleit_funcslocalsPATTERN run_orderrrrrrsKMHH FHH GI:::::rrN)r fixer_utilrBaseFixrr#rrr'sg::::::%:::::rPKH13]0kk2fixes/__pycache__/fix_idioms.cpython-311.opt-2.pycnu[ !A?h b ddlmZddlmZmZmZmZmZmZdZ dZ Gddej Z dS)) fixer_base)CallCommaNameNode BlankLinesymsz0(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)z(power< 'type' trailer< '(' x=any ')' > >c XeZdZdZdedededed ZfdZdZdZ d Z d Z xZ S) FixIdiomsTz isinstance=comparison<  z8 T=any > | isinstance=comparison< T=any aX > | 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* > ctt||}|rd|vr|d|dkr|SdS|S)Nsortedid1id2)superr match)selfnoder __class__s E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_idioms.pyrzFixIdioms.matchOsT )T " " ( ( . .  Qx1U8##4cd|vr|||Sd|vr|||Sd|vr|||Std)N isinstancewhilerz Invalid match)transform_isinstancetransform_whiletransform_sort RuntimeError)rrresultss r transformzFixIdioms.transformZss 7 " ",,T7;; ;   ''g66 6  &&tW55 5// /rcb|d}|d}d|_d|_ttd|t |g}d|vr0d|_t t jtd|g}|j|_|S)NxTr rnnot)cloneprefixrrrrr not_test)rrr r#r$tests rrzFixIdioms.transform_isinstanceds CL    CL   D&&EGGQ88 '>>DK U T':;;Dk  rch|d}|td|jdS)NrTruer))replacerr))rrr ones rrzFixIdioms.transform_whileps3g D 33344444rc|d}|d}|d}|d}|r*|td|jne|rT|}d|_|t td|g|jnt d||j}d |vr|rJ|d d |d jf} d | |d _dSt} |j | |d d | _dSdS) Nsortnextlistexprrr.r%zshould not have reached here ) getr/rr)r(rrremove rpartitionjoinrparent append_child) rrr sort_stmt next_stmt list_call simple_exprnewbtwn prefix_linesend_lines rrzFixIdioms.transform_sorttsFO FO KK'' kk&))  ?   d8I4DEEE F F F F  ?##%%CCJ   T(^^cU,7,>!@!@!@ A A A A=>> > 4<< ;!% 5 5a 8)A,:MN &*ii &=&= ! ### %;; --h777#'//$"7"7":! rQs<AAAAAAAAAAAAAAAA81s;s;s;s;s; "s;s;s;s;s;rPKH13]fD4fixes/__pycache__/fix_imports2.cpython-311.opt-1.pycnu[ !A?h!FdZddlmZdddZGddejZdS)zTFix incompatible imports and module references that must be fixed after fix_imports.) fix_importsdbm)whichdbanydbmceZdZdZeZdS) FixImports2N)__name__ __module__ __qualname__ run_orderMAPPINGmappingG/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_imports2.pyrr sIGGGrrN)__doc__rr FixImportsrrrrrsl   +(rPKH13] 7PP6fixes/__pycache__/fix_basestring.cpython-311.opt-2.pycnu[ !A?h@F ddlmZddlmZGddejZdS)) fixer_base)NameceZdZdZdZdZdS) FixBasestringTz 'basestring'c.td|jS)Nstr)prefix)rr )selfnoderesultss I/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_basestring.py transformzFixBasestring.transform sE$+....N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrr rrs-MG/////rrN)r fixer_utilrBaseFixrrrr rse"/////J&/////rPKH13]1QQ0fixes/__pycache__/fix_xreadlines.cpython-311.pycnu[ !A?hHdZddlmZddlmZGddejZdS)zpFix "for x in f.xreadlines()" -> "for x in f". This fixer will also convert g(f.xreadlines) into g(f.__iter__).) fixer_base)NameceZdZdZdZdZdS) FixXreadlinesTz power< call=any+ trailer< '.' 'xreadlines' > trailer< '(' ')' > > | power< any+ trailer< '.' no_call='xreadlines' > > c|d}|r+|td|jdS|d|dDdS)Nno_call__iter__)prefixc6g|]}|S)clone).0xs I/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_xreadlines.py z+FixXreadlines.transform..s ===!''))===call)getreplacerr )selfnoderesultsrs r transformzFixXreadlines.transformsm++i((  ? OODGNCCC D D D D D LL==WV_=== > > > > >rN)__name__ __module__ __qualname__ BM_compatiblePATTERNrr rrrr s/MG ?????rrN)__doc__r fixer_utilrBaseFixrr rrr#snDD ?????J&?????rPKH13]\}2fixes/__pycache__/fix_except.cpython-311.opt-1.pycnu[ !A?h zdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z dZ GddejZd 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_listsymsc#Kt|D]?\}}|jtjkr%|jdjdkr|||dzfV@dS)Nexceptr) enumeratetyper except_clausechildrenvalue)nodesins E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_except.py find_exceptsrsh%  &&1 6T' ' 'z!}"h..%!*o%%%&&ceZdZdZdZdZdS) 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)]) > c j|j}d|dD}d|dD}t|D]\}}t|jdkr|jdd\}} } | t dd | jtjkrAt | d } | } d | _ | | | } |j} t| D]!\}}t|tjrn"t!| st#| r,t%| t'| t d }nt%| | }t)| d|D]}|d ||||| j d krd| _ d |jddD|z|z}tj|j|S)Nc6g|]}|Sclone).0rs r z'FixExcept.transform..2s 333a 333rtailc6g|]}|Srr)r!chs rr"z'FixExcept.transform..4s ???brxxzz???rcleanupas )prefixargsr c6g|]}|Srr)r!cs rr"z'FixExcept.transform..\s 999!AGGII999r)r rlenrreplacerrrNAMEnew_namer r+r isinstancerNoder r rrreversed insert_child)selfnoderesultsr r# try_cleanupre_suiteEcommaNnew_Ntarget suite_stmtsrstmtassignchildrs r transformzFixExcept.transform/s2y3376?333??GI,>??? &2;&?&?$ #$ # "M7=)**a// - 6qs ; E1 d44445556UZ'' ===EWWYYF$&FMIIe$$$!KKMME #*"2K#,[#9#9""4%dFK88"!E"  {{7gajj7!'UDLL0I0I!J!J!'!6!6"*+bqb/!:!:77,,Q6666((F3333X^^ #AH:9t}RaR'8999KG$N{49h///rN)__name__ __module__ __qualname__ BM_compatiblePATTERNrGrrrrr$s/MG.0.0.0.0.0rrN)__doc__r,rpgen2rr fixer_utilrrrr r r rBaseFixrrrrrQs0DDDDDDDDDDDDDDDD&&& 9090909090 "9090909090rPKH13]*fixes/__pycache__/fix_next.cpython-311.pycnu[ !A?hf ~dZddlmZddlmZddlmZddlm Z m Z m Z dZ Gddej Zd Zd Zd Zd S) 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 bindingc0eZdZdZdZdZfdZdZxZS)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* > prectt|||td|}|r$||t d|_dSd|_dS)NnextTF)superr start_treerwarning bind_warning shadowed_next)selftreefilenamen __class__s C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_next.pyrzFixNext.start_tree$sj gt''h777  & &  ' LLL ) ) )!%D   !&D   cd|sJ|d}|d}|d}|r|jr+|td|jdSd|D}d|d_|t td |j|dS|r-td|j}||dS|rt |rZ|d }dd |Dd kr| |tdS|tddSd |vr$| |td|_dSdS)Nbaseattrname__next__)prefixc6g|]}|S)clone.0rs r z%FixNext.transform..9s 000a 000rr headc,g|]}t|Sr!)strr#s rr%z%FixNext.transform..Es111qCFF111r __builtin__globalT) getrreplacerrris_assign_targetjoinstriprr)rnoderesultsrrrrr(s r transformzFixNext.transform.sw{{6""{{6""{{6""  &! K T*T[AAABBBBB004000!#Q T$vdk"B"B"BDIIJJJJJ  &Z 444A LLOOOOO  & %% v7711D1112288::mKKLL|444 LLj)) * * * * *  LL| , , ,!%D   ! r) __name__ __module__ __qualname__ BM_compatiblePATTERNorderrr4 __classcell__)rs@rr r sZM G E'''''&&&&&&&rr ct|}|dS|jD]-}|jtjkrdSt ||rdS.dS)NFT) find_assignchildrentyperEQUAL is_subtree)r2assignchilds rr/r/Qsc   F ~u : $ $55 t $ $ 44  5rc|jtjkr|S|jtjks|jdSt |jSN)r?syms expr_stmt simple_stmtparentr=)r2s rr=r=]sB yDN""  yD$$$ (;t t{ # ##rcT|krdStfd|jDS)NTc38K|]}t|VdSrE)rA)r$cr2s r zis_subtree..gs-::qz!T""::::::r)anyr>)rootr2s `rrArAds6 t||t ::::DM::: : ::rN)__doc__pgen2rpygramrrFr&r fixer_utilrrrrBaseFixr r/r=rAr!rrrUs44++++++1111111111L :&:&:&:&:&j :&:&:&@   $$$;;;;;rPKH13]/׺2fixes/__pycache__/fix_future.cpython-311.opt-1.pycnu[ !A?h#HdZddlmZddlmZGddejZdS)zVRemove __future__ imports from __future__ import foo is replaced with an empty line. ) fixer_base) BlankLinec eZdZdZdZdZdZdS) FixFutureTz;import_from< 'from' module_name="__future__" 'import' any > c:t}|j|_|S)N)rprefix)selfnoderesultsnews E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_future.py transformzFixFuture.transformskk[  N)__name__ __module__ __qualname__ BM_compatiblePATTERN run_orderrrrrr s4MOGIrrN)__doc__r fixer_utilrBaseFixrrrrrsl""""""      "     rPKH13]3iA88+fixes/__pycache__/fix_print.cpython-311.pycnu[ !A?h dZddlmZddlmZddlmZddlmZddlmZm Z m Z m Z ej dZ Gdd 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"eZdZdZdZdZdZdS)FixPrintTzP simple_stmt< any* bare='print' any* > | print_stmt c (|sJ|d}|r9|ttdg|jdS|jdtdksJ|jdd}t |dkr"t|drdSdx}x}}|r$|dtkr |dd}d}|rb|dtj tj dkr9t |d ksJ|d}|d d}d |D}|r d |d_||||1||d t!t#||1||dt!t#||||d|ttd|} |j| _| S)Nbareprint)prefix z>>rc6g|]}|S)clone).0args D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_print.py z&FixPrint.transform..?s ...##))++...sependfile)getreplacerrrchildrenlen parend_exprmatchr rLeafr RIGHTSHIFTr add_kwargr repr) selfnoderesults bare_printargsrr r!l_argsn_stmts r transformzFixPrint.transform%sw[[((     tDMM2&0&7 9 9 9 : : : F}Q4==0000}QRR  t99>>k//Q88> FcD  DH''9DC  DGv{5+;TBBBBt99>>>>7==??D8D.....  "!F1I  ?co1AvufT#YY.?.?@@@vufT#YY.?.?@@@vvt444d7mmV,,   rc*d|_tj|jjt |tjtjd|f}|r(| td|_| |dS)Nr=r) rrNodesymsargumentrr(rEQUALappendr )r,l_nodess_kwdn_expr n_arguments rr*zFixPrint.add_kwargMs [!3"&u++"(+ek3"?"?"("*++   $ NN577 # # # #J z"""""rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr3r*rrrr r s?MG&&&P # # # # #rr N)__doc__rrrpgen2rr fixer_utilrrr r compile_patternr&BaseFixr rrrrIs  222222222222&g%6 :#:#:#:#:#z!:#:#:#:#:#rPKH13]fD.fixes/__pycache__/fix_imports2.cpython-311.pycnu[ !A?h!FdZddlmZdddZGddejZdS)zTFix incompatible imports and module references that must be fixed after fix_imports.) fix_importsdbm)whichdbanydbmceZdZdZeZdS) FixImports2N)__name__ __module__ __qualname__ run_orderMAPPINGmappingG/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_imports2.pyrr sIGGGrrN)__doc__rr FixImportsrrrrrsl   +(rPKH13]1fixes/__pycache__/fix_types.cpython-311.opt-2.pycnu[ !A?h ddlmZddlmZiddddddd d d d d d dddddddddddddddddddd d!d"d#dd$d%d&Zd'eDZGd(d)ejZd*S)+) fixer_base)Name BooleanTypebool BufferType memoryview ClassTypetype ComplexTypecomplexDictTypedictDictionaryType EllipsisTypeztype(Ellipsis) FloatTypefloatIntTypeintListTypelistLongType ObjectTypeobjectNoneTypez type(None)NotImplementedTypeztype(NotImplemented) SliceTypeslice StringTypebytes StringTypesz(str,)tuplestrrange) TupleTypeTypeType UnicodeType XRangeTypecg|]}d|zS)z)power< 'types' trailer< '.' name='%s' > >).0ts D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_types.py r-3sPPPQ 4q 8PPPcBeZdZdZdeZdZdS)FixTypesT|ct|dj}|rt||jSdS)Nname)prefix) _TYPE_MAPPINGgetvaluerr4)selfnoderesults new_values r, transformzFixTypes.transform9s>!%%gfo&;<<  7 $+666 6tr.N)__name__ __module__ __qualname__ BM_compatiblejoin_patsPATTERNr<r)r.r,r0r05s7MhhuooGr.r0N)r fixer_utilrr5rBBaseFixr0r)r.r,rGsk&| f   F  6  ) W 5 F E x L 5 g!" g#$ %&- 2 QP-PPPz!r.PKH13]1#1fixes/__pycache__/fix_print.cpython-311.opt-1.pycnu[ !A?h dZddlmZddlmZddlmZddlmZddlmZm Z m Z m Z ej dZ Gdd 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"eZdZdZdZdZdZdS)FixPrintTzP simple_stmt< any* bare='print' any* > | print_stmt c |d}|r9|ttdg|jdS|jdd}t |dkr"t|drdSdx}x}}|r$|dtkr |dd}d}|rM|dtj tj dkr$|d}|d d}d |D}|r d |d_||||1||d t!t#||1||d t!t#||||d|ttd|} |j| _| S)Nbareprint)prefix z>>c6g|]}|S)clone).0args D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_print.py z&FixPrint.transform..?s ...##))++...sependfile)getreplacerrrchildrenlen parend_exprmatchr rLeafr RIGHTSHIFTr add_kwargr repr) selfnoderesults bare_printargsrr r!l_argsn_stmts r transformzFixPrint.transform%s[[((     tDMM2&0&7 9 9 9 : : : F}QRR  t99>>k//Q88> FcD  DH''9DC  DGv{5+;TBBBB7==??D8D.....  "!F1I  ?co1AvufT#YY.?.?@@@vufT#YY.?.?@@@vvt444d7mmV,,   rc*d|_tj|jjt |tjtjd|f}|r(| td|_| |dS)Nr=r) rrNodesymsargumentrr(rEQUALappendr )r,l_nodess_kwdn_expr n_arguments rr*zFixPrint.add_kwargMs [!3"&u++"(+ek3"?"?"("*++   $ NN577 # # # #J z"""""rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr3r*rrrr r s?MG&&&P # # # # #rr N)__doc__rrrpgen2rr fixer_utilrrr r compile_patternr&BaseFixr rrrrIs  222222222222&g%6 :#:#:#:#:#z!:#:#:#:#:#rPKH13]3ʙp,fixes/__pycache__/fix_xrange.cpython-311.pycnu[ !A?h \dZddlmZddlmZmZmZddlmZGddejZ dS)z/Fixer that changes xrange(...) into range(...).) fixer_base)NameCallconsuming_calls)patcompceZdZdZdZfdZdZdZdZdZ dZ e j e Z d Ze j eZd ZxZS) FixXrangeTz power< (name='range'|name='xrange') trailer< '(' args=any ')' > rest=any* > ctt|||t|_dSN)superr start_treesettransformed_xranges)selftreefilename __class__s E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_xrange.pyr zFixXrange.start_trees5 i))$999#&55   cd|_dSr )r)rrrs r finish_treezFixXrange.finish_trees#'   rc|d}|jdkr|||S|jdkr|||Stt |)Nnamexrangerange)valuetransform_xrangetransform_range ValueErrorreprrnoderesultsrs r transformzFixXrange.transformsev : ! !((w77 7 Z7 " "''g66 6T$ZZ(( (rc|d}|td|j|jt |dS)Nrrprefix)replacerr'raddidr!s rrzFixXrange.transform_xrange$sOv T'$+666777  $$RXX.....rcZt||jvr||stt d|dg}tt d|g|j}|dD]}|||SdSdS)Nrargslistr&rest)r*rin_special_contextrrcloner' append_child)rr"r# range_call list_callns rrzFixXrange.transform_range*s tHHD4 4 4''-- 5d7mmgfo.C.C.E.E-FGGJT&\\J<$(K111IV_ * *&&q))))  5 4 4 4rz3power< 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*> c |jdSi}|jjC|j|jj|r|d|ur|djtvS|j|j|o |d|uS)NFr"func)parentp1matchrrp2)rr"r#s rr/zFixXrange.in_special_context?s ; 5 K  *w}}T[/99 +v$&&6?(O; ;w}}T['22Nwv$7NNr)__name__ __module__ __qualname__ BM_compatiblePATTERNr rr$rrP1rcompile_patternr8P2r:r/ __classcell__)rs@rr r sMG )))))((()))///    ?B   $ $B B !  $ $B O O O O O O Orr N) __doc__r fixer_utilrrrrBaseFixr rrrIs654444444444=O=O=O=O=O "=O=O=O=O=OrPKH13]l,fixes/__pycache__/fix_reload.cpython-311.pycnu[ !A?h9LdZddlmZddlmZmZGddejZdS)z5Fixer for reload(). reload(s) -> importlib.reload(s)) fixer_base) ImportAndCall touch_importc eZdZdZdZdZdZdS) FixReloadTprez power< 'reload' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > c|r5|d}|r+|j|jjkr|jdjdvrdSd}t |||}t dd||S)Nobj>***) importlibreloadr)typesymsargumentchildrenvaluerr)selfnoderesultsr namesnews E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_reload.py transformzFixReload.transformsu  %.C H 222LO)[88F'D'511T;--- N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrr s4M EG     rrN)__doc__r fixer_utilrrBaseFixrr#rrr(sr$$ 44444444 "rPKH13]a}$$5fixes/__pycache__/fix_metaclass.cpython-311.opt-2.pycnu[ !A?h ~ ddlmZddlmZddlmZmZmZdZdZ dZ dZ dZ d Z Gd d ejZd S) ) fixer_base)token)symsNodeLeafcR |jD]}|jtjkrt |cS|jtjkr`|jrY|jd}|jtjkr7|jr0|jd}t|tr|j dkrdSdS)N __metaclass__TF) childrentypersuite has_metaclass simple_stmt expr_stmt isinstancervalue)parentnode expr_node left_sides H/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_metaclass.pyrrs     9 " " && & & & Y$* * *t} * a(I~//I4F/%.q1 i.. !?::44 5c  |jD]}|jtjkrdSt |jD]\}}|jt jkrntdttjg}|j|dzdr]|j|dz}| | | |j|dzd]| ||}dS)NzNo class suite and no ':'!) r r rr enumeraterCOLON ValueErrorr append_childcloneremove)cls_noderir move_nodes rfixup_parse_treer$-s%! 9 " " FF # X.//774 9 # # E $5666 R E  AaCDD !%ac*  9??,,---  AaCDD ! %   DDDrcp t|jD]\}}|jtjkrndS|t tjg}t tj |g}|j|drW|j|}| | ||j|dW| |||jdjd}|jdjd} | j |_ dS)Nr )rr r rSEMIr rrrrrr insert_childprefix) rr" stmt_nodesemi_indrnew_exprnew_stmtr# new_leaf1 old_leaf1s rfixup_simple_stmtr/Gs3$I$677$ 9 " " E # KKMMMDNB''HD$xj11H  XYY '&x0 ioo//000  XYY ' 8$$$!!$-a0I"1%.q1I 'Irc|jrA|jdjtjkr#|jddSdSdS)N)r r rNEWLINEr )rs rremove_trailing_newliner3_sQ }#r*/5=@@ b  """""##@@rc#K|jD]}|jtjkrnt dt t |jD]\}}|jtjkr|jr}|jd}|jtjkr[|jrT|jd}t|tr2|j dkr't|||t||||fVdS)NzNo class suite!r r )r r rr rlistrrrrrrr/r3)r!rr" simple_noder left_nodes r find_metasr8ds!,, 9 " " E #*+++y7788 1 1;  t/ / /K4H /#,Q/I~//I4F/%.q1 i..1!?::%dA{;;;+K888K0000 1 1rcr |jddd}|r,|}|jtjkrn|,|ru|}t |t r%|jtjkr|jrd|_dS| |jddd|sdSdS)Nr1) r popr rINDENTrrDEDENTr(extend)r kidsrs r fixup_indentr@{s >$$B$ D xxzz 9 $ $   -xxzz dD ! ! -di5<&?&?{ !  F KK ddd+ , , , -----rceZdZdZdZdZdS) FixMetaclassTz classdef ct|sdSt|d}t|D]\}}}|}||jdj}t |jdkr|jdjtjkr|jd}nN|jd } ttj| g}| d|nt |jdkr1ttjg}| d|nt |jdkrttjg}| dttjd| d|| dttjdnt#d |jdjd} d | _| j} |jr5|ttjd d | _nd | _|jd} d | jd_d | jd_||t-||jso|t|d} | | _|| |ttjddSt |jdkr|jdjtjkrx|jdjtjkrZt|d} | d| | dttjddSdSdSdS)Nr r)(zUnexpected class definition metaclass, r:rpass r1)rr$r8r r r lenrarglistrr set_childr'rrRPARLPARrrr(rCOMMAr@r2r<r=)selfrresultslast_metaclassr r"stmt text_typerQrmeta_txtorig_meta_prefixr pass_leafs r transformzFixMetaclass.transformsT""  F(..  NE1d!N KKMMMMM!$)  t}   " "}Q$ 44-*q)//11t|fX66q'****   1 $ $4<,,G   a ) ) ) )   1 $ $4<,,G   aej#!6!6 7 7 7   a ) ) )   aej#!6!6 7 7 7 7:;; ;"*1-6q9$#?   !  ek3!7!7 8 8 8!HOO HO#+A. ') 1$') 1$^,,,U~ > LLNNNY//I/I    i ( ( (   d5=$77 8 8 8 8 8  1 $ $.$)U\99.$)U\99Y//I   r9 - - -   r4 t#<#< = = = = = % $9999rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr^rrrBrBs4MGL>L>L>L>L>rrBN)r:rpygramr fixer_utilrrrrr$r/r3r8r@BaseFixrBrdrrrhs())))))))))&4(((0### 111.---,S>S>S>S>S>:%S>S>S>S>S>rPKH13]kCP..4fixes/__pycache__/fix_exitfunc.cpython-311.opt-2.pycnu[ !A?h ^ ddlmZmZddlmZmZmZmZmZm Z Gddej Z dS))pytree fixer_base)NameAttrCallCommaNewlinesymsc:eZdZdZdZdZfdZfdZdZxZ S) FixExitfuncTa ( sys_import=import_name<'import' ('sys' | dotted_as_names< (any ',')* 'sys' (',' any)* > ) > | expr_stmt< power< 'sys' trailer< '.' 'exitfunc' > > '=' func=any > ) cBtt|j|dSN)superr __init__)selfargs __class__s G/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_exitfunc.pyrzFixExitfunc.__init__s#)k4  )40000chtt|||d|_dSr)rr start_tree sys_import)rtreefilenamers rrzFixExitfunc.start_tree!s. k4  ++D(;;;rc d|vr|j |d|_dS|d}d|_tjt jttdtd}t||g|j}| ||j| |ddS|jj d}|j t jkrF|t!|tdddS|jj}|j |j}|j} tjt jtd tddg} tjt j| g} ||dzt-||d z| dS) NrfuncatexitregisterzKCan't find sys import; Please add an atexit import at the top of your file. import)rcloneprefixrNoder powerrrrreplacewarningchildrentypedotted_as_names append_childrparentindex import_name simple_stmt insert_childr ) rnoderesultsrrcallnamescontaining_stmtpositionstmt_container new_importnews r transformzFixExitfunc.transform%s 7 " "&"),"7 Fv$$&& ;tz#DNND4D4DEE!!Htfdk22 T ? " LL ? @ @ @ F(+ :- - -   uww ' ' '   tHc22 3 3 3 3 3"o4O&/55doFFH,3NT%5#H~~tHc/B/BC  J+d. ==C  ( (Awyy A A A  ( (As ; ; ; ; ;r) __name__ __module__ __qualname__keep_line_order BM_compatiblePATTERNrrr< __classcell__)rs@rr r sqOM G11111#<#<#<#<#<#<#rHs '&&&&&&&EEEEEEEEEEEEEEEE=<=<=<=<=<*$=<=<=<=<= c j|j}d|dD}d|dD}t|D]\}}t|jdkr|jdd\}} } | t dd | jtjkrAt | d } | } d | _ | | | } |j} t| D]!\}}t|tjrn"t!| st#| r,t%| t'| t d }nt%| | }t)| d|D]}|d ||||| j d krd| _ d |jddD|z|z}tj|j|S)Nc6g|]}|Sclone).0rs r z'FixExcept.transform..2s 333a 333rtailc6g|]}|Srr)r!chs rr"z'FixExcept.transform..4s ???brxxzz???rcleanupas )prefixargsr c6g|]}|Srr)r!cs rr"z'FixExcept.transform..\s 999!AGGII999r)r rlenrreplacerrrNAMEnew_namer r+r isinstancerNoder r rrreversed insert_child)selfnoderesultsr r# try_cleanupre_suiteEcommaNnew_Ntarget suite_stmtsrstmtassignchildrs r transformzFixExcept.transform/s2y3376?333??GI,>??? &2;&?&?$ #$ # "M7=)**a// - 6qs ; E1 d44445556UZ'' ===EWWYYF$&FMIIe$$$!KKMME #*"2K#,[#9#9""4%dFK88"!E"  {{7gajj7!'UDLL0I0I!J!J!'!6!6"*+bqb/!:!:77,,Q6666((F3333X^^ #AH:9t}RaR'8999KG$N{49h///rN)__name__ __module__ __qualname__ BM_compatiblePATTERNrGrrrrr$s/MG.0.0.0.0.0rrN)__doc__r,rpgen2rr fixer_utilrrrr r r rBaseFixrrrrrQs0DDDDDDDDDDDDDDDD&&& 9090909090 "9090909090rPKH13]8ސ*fixes/__pycache__/__init__.cpython-311.pycnu[ !A?h/dS)NrC/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/__init__.pyrsrPKH13]˓9fixes/__pycache__/fix_standarderror.cpython-311.opt-2.pycnu[ !A?hF ddlmZddlmZGddejZdS)) fixer_base)NameceZdZdZdZdZdS)FixStandarderrorTz- 'StandardError' c.td|jS)N Exception)prefix)rr )selfnoderesultss L/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_standarderror.py transformzFixStandarderror.transformsK 4444N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrr rr s/MG55555rrN)r fixer_utilrBaseFixrrrr rsg,55555z)55555rPKH13]bq AA3fixes/__pycache__/fix_getcwdu.cpython-311.opt-1.pycnu[ !A?hHdZddlmZddlmZGddejZdS)z1 Fixer that changes os.getcwdu() to os.getcwd(). ) fixer_base)NameceZdZdZdZdZdS) FixGetcwduTzR power< 'os' trailer< dot='.' name='getcwdu' > any* > ch|d}|td|jdS)Nnamegetcwd)prefix)replacerr )selfnoderesultsrs F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_getcwdu.py transformzFixGetcwdu.transforms2v T(4;77788888N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG99999rrN)__doc__r fixer_utilrBaseFixrrrrrsl  9 9 9 9 9# 9 9 9 9 9rPKH13].f{ { 1fixes/__pycache__/fix_throw.cpython-311.opt-2.pycnu[ !A?h.n ddlmZddlmZddlmZddlmZmZmZm Z m Z Gddej Z dS))pytree)token) fixer_base)NameCallArgListAttris_tupleceZdZdZdZdZdS)FixThrowTz power< any trailer< '.' 'throw' > trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > | power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > > c|j}|d}|jtjur||ddS|d}|dS|}t|rd|jddD}n d|_ |g}|d}d |vr|d }d|_ t||} t| td t|ggz} |tj|j| dS|t||dS) Nexcz+Python 3 does not support string exceptionsvalc6g|]}|S)clone).0cs D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_throw.py z&FixThrow.transform..)s :::!AGGII:::argstbwith_traceback)symsrtyperSTRINGcannot_convertgetr childrenprefixrr rrreplacerNodepower) selfnoderesultsrrrr throw_argsrewith_tbs r transformzFixThrow.transforms[yen""$$ 8u| # #   &S T T T Fkk%   ; Fiikk C== ::s|AbD'9:::DDCJ5DV_ 7??$$&&BBIS$A1d#34455"GG   v{4:w?? @ @ @ @ @   tC / / / / /rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr.rrrr r s/MG00000rr N) rrpgen2rr fixer_utilrrrr r BaseFixr rrrr7s?<<<<<<<<<<<<<<(0(0(0(0(0z!(0(0(0(0(0rPKH13] 雕0fixes/__pycache__/fix_long.cpython-311.opt-2.pycnu[ !A?hF ddlmZddlmZGddejZdS)) fixer_base)is_probably_builtinceZdZdZdZdZdS)FixLongTz'long'c^t|rd|_|dSdS)Nint)rvaluechanged)selfnoderesultss C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_long.py transformzFixLong.transforms4 t $ $ DJ LLNNNNN  N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s-MGrrN)lib2to3rlib2to3.fixer_utilrBaseFixrrrrrsg222222j rPKH13]]? -fixes/__pycache__/fix_unicode.cpython-311.pycnu[ !A?hRdZddlmZddlmZdddZGddejZd 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)unichrunicodec,eZdZdZdZfdZdZxZS) FixUnicodeTzSTRING | 'unicode' | 'unichr'cvtt|||d|jv|_dS)Nunicode_literals)superr start_treefuture_featuresr )selftreefilename __class__s F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_unicode.pyrzFixUnicode.start_trees9 j$**4::: 2d6J Jc|jtjkr-|}t|j|_|S|jtjkr|j}|js@|ddvr6d|vr2dd| dD}|ddvr |dd}||jkr|S|}||_|SdS)Nz'"\z\\cbg|],}|dddd-S)z\uz\\uz\Uz\\U)replace).0vs r z(FixUnicode.transform.. sF"""IIeV,,44UFCC"""ruU) typerNAMEclone_mappingvalueSTRINGr joinsplit)rnoderesultsnewvals r transformzFixUnicode.transforms 9 " "**,,C ,CIJ Y%, & &*C( SVu__jj"" YYu--"""1v~~!""gdj   **,,CCIJ' &r)__name__ __module__ __qualname__ BM_compatiblePATTERNrr, __classcell__)rs@rr r sVM-GKKKKKrr N)__doc__pgen2rrr#BaseFixr rrr8sy% 0 0#rPKH13]zVV,fixes/__pycache__/fix_buffer.cpython-311.pycnu[ !A?hNHdZddlmZddlmZGddejZdS)z4Fixer that changes buffer(...) into memoryview(...).) fixer_base)Namec eZdZdZdZdZdZdS) FixBufferTzR power< name='buffer' trailer< '(' [any] ')' > any* > ch|d}|td|jdS)Nname memoryview)prefix)replacerr )selfnoderesultsrs E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_buffer.py transformzFixBuffer.transforms2v T,t{;;;<<<<<N)__name__ __module__ __qualname__ BM_compatibleexplicitPATTERNrrrrr s4MHG=====rrN)__doc__r fixer_utilrBaseFixrrrrrsj;: = = = = = " = = = = =rPKH13]4*!!8fixes/__pycache__/fix_tuple_params.cpython-311.opt-1.pycnu[ !A?hdZddlmZddlmZddlmZddlmZmZm Z m Z m Z m Z dZ GddejZd Zd Zgd fd Zd Zd S)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 Subscriptsymscvt|tjo|jdjt jkS)N) isinstancerNodechildrentyperSTRING)stmts K/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_tuple_params.py is_docstringrs/ dFK ( ( 1 =  EL 01c&eZdZdZdZdZdZdZdS)FixTupleParamsTa funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > c d|vr||Sg |d}|d}|djdjtjkr)d}|djdj}t n#d}d}tjtjd d fd }|jtj kr ||nU|jtj kr@t|jD]+\}} | jtj kr|| |dk , sdS D]} |d| _ |} |dkrd d_n2t|dj|r| d_|dz} D]} |d| _  |dj| | <t!| dz| t# zdzD]}||dj|_|ddS)Nlambdasuiteargsr rz; Fct}|}d|_t ||}|rd|_||tjtj |gdS)Nr ) rnew_namecloneprefixrreplaceappendrrr simple_stmt) tuple_arg add_prefixnargrend new_linesselfs r handle_tuplez.FixTupleParams.transform..handle_tupleCsT]]__%%A//##CCJ#qwwyy))D    a   V[)9*. )<>> ? ? ? ? ?r)r)r!)F)transform_lambdarrrINDENTvaluerrLeafr tfpdef typedargslist enumerateparentr$rrangelenchanged)r.noderesultsrrstartindentr/ir+lineafterr,r-s` @@r transformzFixTupleParams.transform.sM w  ((w77 7  v 8 Q  $ 4 4E1X&q)/F))CCEF+elB//C ? ? ? ? ? ? ? ? 9 # # L     Y$, , ,#DM22 : :38t{**!L!a%9999  F # #D(DKK A::"%IaL   %(+E2 3 3 "(IaL AIE # #D(DKK)2a%+&uQwc)nn 4Q 677 1 1A*0E!H a ' ' arc|d}|d}t|d}|jtjkr2|}d|_||dSt|}t|}| t|}t|d} || | D]} | jtjkrv| j |vrmd|| j D} tjt j| g| z} | j| _| | dS)Nrbodyinnerr!)r$c6g|]}|S)r#.0cs r z3FixTupleParams.transform_lambda..s CCCAaggiiCCCr) simplify_argsrrNAMEr#r$r% find_params map_to_indexr" tuple_namer post_orderr2rrr power) r.r;r<rrDrEparamsto_indextup_name new_paramr* subscriptsnews rr0zFixTupleParams.transform_lambdans`vvgg.// : # #KKMMEEL LL    FT""''==F!3!344#...  Y__&&'''""  Av##8(;(;CC!'1BCCC k$*#,??#4#4"5 "BDDX  #   rN)__name__ __module__ __qualname__ run_order BM_compatiblePATTERNrBr0rGrrrrsDIMG>>>@rrc|jtjtjfvr|S|jtjkr9|jtjkr"|jd}|jtjk"|Std|z)NrzReceived unexpected node %s)rr vfplistrrMvfpdefr RuntimeErrorr;s rrLrLss yT\5:... dk ! !i4;&&=#Di4;&& 4t; < <.s, K K KqQVu{5J5JKNN5J5J5Jr)rr rarNrrrMr2rcs rrNrNsS yDK4=+,,, ej z K KDM K K KKrNc|i}t|D]_\}}ttt|g}t |t rt |||W||z||<`|S)N)d)r6r r strrlistrO) param_listr$rhr?objtrailers rrOrOsy J''&&3VCFF^^,,- c4  & g + + + + +g%AcFF Hrcg}|D]O}t|tr#|t|:||Pd|S)N_)rrjr&rPjoin)rklrls rrPrPsd A c4   HHZ__ % % % % HHSMMMM 88A;;r)__doc__rrpgen2rr fixer_utilrrrr r r rBaseFixrrLrNrOrPrGrrrvs*GGGGGGGGGGGGGGGG111gggggZ'gggX = = =LLL%'$     rPKH13]}{ DD5fixes/__pycache__/fix_raw_input.cpython-311.opt-1.pycnu[ !A?hHdZddlmZddlmZGddejZdS)z2Fixer that changes raw_input(...) into input(...).) fixer_base)NameceZdZdZdZdZdS) FixRawInputTzU power< name='raw_input' trailer< '(' [any] ')' > any* > ch|d}|td|jdS)Nnameinput)prefix)replacerr )selfnoderesultsrs H/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_raw_input.py transformzFixRawInput.transforms2v T'$+66677777N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrs/MG88888rrN)__doc__r fixer_utilrBaseFixrrrrrsh88 8 8 8 8 8*$ 8 8 8 8 8rPKH13] *fixes/__pycache__/fix_dict.cpython-311.pycnu[ !A?hdZddlmZddlmZddlmZddlmZmZmZddlmZej dhzZ Gdd 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_utilitercjeZdZdZdZdZdZejeZ dZ eje Z dZ dS)FixDictTa power< head=any+ trailer< '.' method=('keys'|'items'|'values'| 'iterkeys'|'iteritems'|'itervalues'| 'viewkeys'|'viewitems'|'viewvalues') > parens=trailer< '(' ')' > tail=any* > c |d}|dd}|d}|j}|j}|d}|d} |s| r |dd}|dvsJt|d |D}d |D}| o|||} |t j|jtt||j g|d  gz} t j|j | } | s+| s)d | _ tt|rdnd| g} |rt j|j | g|z} |j | _ | S)Nheadmethodtailr view)keysitemsvaluesc6g|]}|Sclone.0ns C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_dict.py z%FixDict.transform..A (((a (((c6g|]}|Srrrs rrz%FixDict.transform..Br r!)prefixparenslist)symsvalue startswithreprin_special_contextrNodetrailerrrr#rpowerr) selfnoderesultsrrrr' method_nameisiterisviewspecialargsnews r transformzFixDict.transform6sv"1%vyl ''//''//  *V *%abb/K99994<<999((4(((((4((((Dt66tVDDv{4<$'EE$(06 %?%?%?$@AAx(..00 22 k$*d++ B6 BCJtf8FF&99C5AAC  8+dj3%$,77C[  r!z3power< func=NAME trailer< '(' node=any ')' > any* >zmfor_stmt< 'for' any 'in' node=any ':' any* > | comp_for< 'for' any 'in' node=any any* > cH|jdSi}|jj^|j|jj|r9|d|ur/|r|djtvS|djt jvS|sdS|j|j|o |d|uS)NFr0func)parentp1matchr( iter_exemptr consuming_callsp2)r/r0r3r1s rr+zFixDict.in_special_contextZs ; 5 K  *w}}T[/99 +v$&& Kv, ;;v, 0JJJ 5w}}T['22Nwv$7NNr!N) __name__ __module__ __qualname__ BM_compatiblePATTERNr8P1rcompile_patternr<P2r@r+rr!rr r )swMG8 ?B   $ $B B !  $ $BOOOOOr!r N) __doc__r%rrrr rrrr?r>BaseFixr rr!rrKs6(((((((((((F83 AOAOAOAOAOj AOAOAOAOAOr!PKH13]/׺,fixes/__pycache__/fix_future.cpython-311.pycnu[ !A?h#HdZddlmZddlmZGddejZdS)zVRemove __future__ imports from __future__ import foo is replaced with an empty line. ) fixer_base) BlankLinec eZdZdZdZdZdZdS) FixFutureTz;import_from< 'from' module_name="__future__" 'import' any > c:t}|j|_|S)N)rprefix)selfnoderesultsnews E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_future.py transformzFixFuture.transformskk[  N)__name__ __module__ __qualname__ BM_compatiblePATTERN run_orderrrrrr s4MOGIrrN)__doc__r fixer_utilrBaseFixrrrrrsl""""""      "     rPKH13]zVV2fixes/__pycache__/fix_buffer.cpython-311.opt-1.pycnu[ !A?hNHdZddlmZddlmZGddejZdS)z4Fixer that changes buffer(...) into memoryview(...).) fixer_base)Namec eZdZdZdZdZdZdS) FixBufferTzR power< name='buffer' trailer< '(' [any] ')' > any* > ch|d}|td|jdS)Nname memoryview)prefix)replacerr )selfnoderesultsrs E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_buffer.py transformzFixBuffer.transforms2v T,t{;;;<<<<<N)__name__ __module__ __qualname__ BM_compatibleexplicitPATTERNrrrrr s4MHG=====rrN)__doc__r fixer_utilrBaseFixrrrrrsj;: = = = = = " = = = = =rPKH13]jrr(fixes/__pycache__/fix_ne.cpython-311.pycnu[ !A?h;TdZddlmZddlmZddlmZGddejZdS)zFixer that turns <> into !=.)pytree)token) fixer_basec(eZdZejZdZdZdS)FixNec|jdkS)Nz<>)value)selfnodes A/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_ne.pymatchz FixNe.matchszT!!cRtjtjd|j}|S)Nz!=)prefix)rLeafrNOTEQUALr)r r resultsnews r transformzFixNe.transforms!k%.$t{CCC rN)__name__ __module__ __qualname__rr _accept_typer rrr rr s;>L"""rrN)__doc__rpgen2rrBaseFixrrrr rs|#"     J      rPKH13]Ƣ: .fixes/__pycache__/fix_execfile.cpython-311.pycnu[ !A?hldZddlmZddlmZmZmZmZmZm Z m Z m Z m Z m Z GddejZdS)zoFixer for execfile. This converts usages of the execfile function into calls to the built-in exec() function. ) fixer_base) CommaNameCallLParenRParenDotNodeArgListStringsymsceZdZdZdZdZdS) FixExecfileTz power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > | power< 'execfile' trailer< '(' filename=any ')' > > cp|sJ|d}|d}|d}|jdjd}t|t t ddg|}t tjtd|g}t tj ttd gt tj ttgg} |g| z} |} d| _t d d} | t | t | gz} ttd | d }|g}|5|t |g|5|t |gttd ||jS)Nfilenameglobalslocalsz"rb" )rparenopenreadz'exec'compileexec)prefix)getchildrencloner rr r r powerrtrailerr rrrrextend)selfnoderesultsrrrexecfile_paren open_args open_callr open_expr filename_argexec_str compile_args compile_callargss G/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_execfile.py transformzFixExecfile.transformsw:&++i((X&&r*3B7==??X^^--uwwvs8K8KL#1333 d6llI%>?? T\CEE4<<#899T\FHHfhh#788:K$&  ~~'' ! (C(( EGG\577H#MM DOO\2>> ~   KK'--//2 3 3 3   KK&,,..1 2 2 2DLL$t{;;;;N)__name__ __module__ __qualname__ BM_compatiblePATTERNr0r1r/rrs/MG <<<<r;s 111111111111111111111111&<&<&<&<&<*$&<&<&<&<&rsrPKH13]`&1fixes/__pycache__/fix_input.cpython-311.opt-1.pycnu[ !A?hxdZddlmZddlmZmZddlmZejdZGddej Z dS) z4Fixer that changes input(...) into eval(input(...)).) fixer_base)CallName)patcompz&power< 'eval' trailer< '(' any ')' > >ceZdZdZdZdZdS)FixInputTzL power< 'input' args=trailer< '(' [any] ')' > > ct|jjrdS|}d|_t t d|g|jS)Neval)prefix)contextmatchparentcloner rr)selfnoderesultsnews D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_input.py transformzFixInput.transformsS ==+ , ,  Fjjll DLL3% <<<<N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG=====rrN) __doc__r r fixer_utilrrrcompile_patternr BaseFixrrrrr"s::######## "' !"J K K = = = = =z! = = = = =rPKH13]2))0fixes/__pycache__/fix_exec.cpython-311.opt-1.pycnu[ !A?hPdZddlmZddlmZmZmZGddejZdS)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)CommaNameCallceZdZdZdZdZdS)FixExecTzx exec_stmt< 'exec' a=any 'in' b=any [',' c=any] > | exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any > c|j}|d}|d}|d}|g}d|d_|5|t |g|5|t |gt td||jS)Nabcexec)prefix)symsgetclonerextendrrr)selfnoderesultsrr r r argss C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_exec.py transformzFixExec.transformsy CL KK   KK   {Q = KK!'')), - - - = KK!'')), - - -DLL$t{;;;;N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrrs/MG < < < < r%sx**********<<<< c~|d}|jtjks|js|g}n|j}|dddD]}|jtjkr |j}|}n%|jtjkrdS|jd}|j}|dvrd|_|m|dvr)| |ddkrdnd |_|jddp|g}d } |D]3}| r*|jtj kr|.| d z} 4|r^|d jtj krC| |r|d jtj kC|jst|d dr|j |j} t}| |_|SdS) Nimportsr)imapizipifilter) ifilterfalse izip_longestf filterfalse zip_longestTvalue)typerimport_as_namechildrenrNAMErSTARremovechangedCOMMApopgetattrparentprefixr) selfnoderesultsr rchildmember name_node member_name remove_commaps P/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_itertools_imports.py transformzFixItertoolsImports.transforms)$ <4. . .g6F .yHH'Hccc] 7 7EzUZ''! uz))"N1- #/K999"   @@@ 4?Nc4I4I==(5#AAA&37)  % %E % ek 9 9 $  $8B<, ;; LLNN ! ! # # # $8B<, ;;! WWgt%D%D  N " A;;DDKK # "N)__name__ __module__ __qualname__ BM_compatiblelocalsPATTERNr-r.r,rrs=MFHHG+++++r.rN) __doc__lib2to3rlib2to3.fixer_utilrrrBaseFixrr5r.r,r:stGG555555555511111*,11111r.PKH13]W,fixes/__pycache__/fix_filter.cpython-311.pycnu[ !A?h pdZddlmZddlmZddlmZddlm Z m Z m Z m Z m Z GddejZdS) 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_context parenthesizec eZdZdZdZdZdZdS) 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.filterc||rdSg}d|vr2|dD])}||*d|vr|d}|jt jkrd|_t|}t|d|d|d|}tt j |g|zd}n d|vrrttd td |d td }tt j |g|zd}nt|rdS|d }tt j td |gd}tt j td t|gg|z}d|_|j|_|S)Nextra_trailers filter_lambdaxpfpit)prefixnone_fseqargsfilterlist) should_skipappendclonegettypesymstestrr rrpowerrr r)selfnoderesultstrailerstrnewrs E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_filter.py transformzFixFilter.transform:s   D ! !  F w & &-. + + **** g % %T""((**Bw$)## !"%%7;;t,,2244";;t,,2244";;t,,2244b::CtzC58#3B???CC w  4::::"5>//11::''CtzC58#3B???CC"$'' t6?((**DtzDNND#9"EEECtzDLL'3%..#AH#LMMCCJ[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr*r+r)r r s6MG<'G$$$$$r+r N)__doc__rrpytreerpygramrr fixer_utilrrrr r ConditionalFixr r2r+r)r8s  ++++++RRRRRRRRRRRRRRGGGGG )GGGGGr+PKH13]PV0fixes/__pycache__/fix_repr.cpython-311.opt-2.pycnu[ !A?heN ddlmZddlmZmZmZGddejZdS)) fixer_base)CallName parenthesizeceZdZdZdZdZdS)FixReprTz7 atom < '`' expr=any '`' > c|d}|j|jjkrt |}t t d|g|jS)Nexprrepr)prefix)clonetypesyms testlist1rrrr )selfnoderesultsr s C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_repr.py transformzFixRepr.transformsUv$$&& 9 + + +%%DDLL4&====N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG>>>>>rrN)r fixer_utilrrrBaseFixrrrrr ss61111111111 > > > > >j > > > > >rPKH13]#3)vqq0fixes/__pycache__/fix_next.cpython-311.opt-1.pycnu[ !A?hf ~dZddlmZddlmZddlmZddlm Z m Z m Z dZ Gddej Zd Zd Zd Zd S) 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 bindingc0eZdZdZdZdZfdZdZxZS)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* > prectt|||td|}|r$||t d|_dSd|_dS)NnextTF)superr start_treerwarning bind_warning shadowed_next)selftreefilenamen __class__s C/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_next.pyrzFixNext.start_tree$sj gt''h777  & &  ' LLL ) ) )!%D   !&D   c\|d}|d}|d}|r|jr+|td|jdSd|D}d|d_|t td |j|dS|r-td|j}||dS|rt |rZ|d }dd |Dd kr| |tdS|tddSd |vr$| |td|_dSdS)Nbaseattrname__next__)prefixc6g|]}|S)clone.0rs r z%FixNext.transform..9s 000a 000rr headc,g|]}t|Sr!)strr#s rr%z%FixNext.transform..Es111qCFF111r __builtin__globalT) getrreplacerrris_assign_targetjoinstriprr)rnoderesultsrrrrr(s r transformzFixNext.transform.s{{6""{{6""{{6""  &! K T*T[AAABBBBB004000!#Q T$vdk"B"B"BDIIJJJJJ  &Z 444A LLOOOOO  & %% v7711D1112288::mKKLL|444 LLj)) * * * * *  LL| , , ,!%D   ! r) __name__ __module__ __qualname__ BM_compatiblePATTERNorderrr4 __classcell__)rs@rr r sZM G E'''''&&&&&&&rr ct|}|dS|jD]-}|jtjkrdSt ||rdS.dS)NFT) find_assignchildrentyperEQUAL is_subtree)r2assignchilds rr/r/Qsc   F ~u : $ $55 t $ $ 44  5rc|jtjkr|S|jtjks|jdSt |jSN)r?syms expr_stmt simple_stmtparentr=)r2s rr=r=]sB yDN""  yD$$$ (;t t{ # ##rcT|krdStfd|jDS)NTc38K|]}t|VdSrE)rA)r$cr2s r zis_subtree..gs-::qz!T""::::::r)anyr>)rootr2s `rrArAds6 t||t ::::DM::: : ::rN)__doc__pgen2rpygramrrFr&r fixer_utilrrrrBaseFixr r/r=rAr!rrrUs44++++++1111111111L :&:&:&:&:&j :&:&:&@   $$$;;;;;rPKH13]`&+fixes/__pycache__/fix_input.cpython-311.pycnu[ !A?hxdZddlmZddlmZmZddlmZejdZGddej Z dS) z4Fixer that changes input(...) into eval(input(...)).) fixer_base)CallName)patcompz&power< 'eval' trailer< '(' any ')' > >ceZdZdZdZdZdS)FixInputTzL power< 'input' args=trailer< '(' [any] ')' > > ct|jjrdS|}d|_t t d|g|jS)Neval)prefix)contextmatchparentcloner rr)selfnoderesultsnews D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_input.py transformzFixInput.transformsS ==+ , ,  Fjjll DLL3% <<<<N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG=====rrN) __doc__r r fixer_utilrrrcompile_patternr BaseFixrrrrr"s::######## "' !"J K K = = = = =z! = = = = =rPKH13]z)fixes/__pycache__/fix_map.cpython-311.pycnu[ !A?h8|dZddlmZddlmZddlmZmZmZm Z m Z ddl m Z ddlmZGddejZd 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 eZdZdZdZdZdZdS)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.mapcN||rdSg}d|vr2|dD])}||*|jjt jkrQ||d|}d|_ttd|g}nd|vr{t|d|d|d}tt j |g|zd }n_d |vr"|d }d|_nd |vr|d }|jt jkr|jd jt jkrd|jd jdjt"jkr9|jd jdjdkr||ddStt j td|g}d|_t)|rdStt j tdt+|gg|z}d|_|j|_|S)Nextra_trailerszYou should use a for loop herelist map_lambdaxpfpit)prefixmap_noneargargsNonezjcannot convert map(None, ...) with multiple arguments because map() now truncates to the shortest sequencemap) should_skipappendcloneparenttypesyms simple_stmtwarningrrrrr powertrailerchildrenarglistrNAMEvaluer r)selfnoderesultstrailerstnewrs B/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_map.py transformzFixMap.transform@sn   D ! !  F w & &-. + + **** ; t/ / / LL? @ @ @**,,CCJtF||cU++CC W $ $74=..00"4=..00"4=..0022CtzC58#3B???CCW$$en**,, W$$"6?DyDL00}Q', <<}Q'038EJFF}Q'039VCC T,NOOOtzDKK+FGGC!#CJ%d++ 4tzDLL'3%..#AH#LMMCCJ[  N)__name__ __module__ __qualname__ BM_compatiblePATTERNskip_onr3r4r2r r s6MG:$G.....r4r N)__doc__pgen2rrr fixer_utilrrrrr pygramr r#pytreer ConditionalFixr r;r4r2rBs&JJJJJJJJJJJJJJ++++++PPPPPZ &PPPPPr4PKH13]t$ 4fixes/__pycache__/fix_execfile.cpython-311.opt-1.pycnu[ !A?hldZddlmZddlmZmZmZmZmZm Z m Z m Z m Z m Z GddejZdS)zoFixer for execfile. This converts usages of the execfile function into calls to the built-in exec() function. ) fixer_base) CommaNameCallLParenRParenDotNodeArgListStringsymsceZdZdZdZdZdS) FixExecfileTz power< 'execfile' trailer< '(' arglist< filename=any [',' globals=any [',' locals=any ] ] > ')' > > | power< 'execfile' trailer< '(' filename=any ')' > > ch|d}|d}|d}|jdjd}t|t t ddg|}t tjtd|g}t tj ttd gt tj ttgg} |g| z} |} d| _t d d} | t | t | gz} ttd | d }|g}|5|t |g|5|t |gttd ||jS)Nfilenameglobalslocalsz"rb" )rparenopenreadz'exec'compileexec)prefix)getchildrencloner rr r r powerrtrailerr rrrrextend)selfnoderesultsrrrexecfile_paren open_args open_callr open_expr filename_argexec_str compile_args compile_callargss G/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_execfile.py transformzFixExecfile.transforms:&++i((X&&r*3B7==??X^^--uwwvs8K8KL#1333 d6llI%>?? T\CEE4<<#899T\FHHfhh#788:K$&  ~~'' ! (C(( EGG\577H#MM DOO\2>> ~   KK'--//2 3 3 3   KK&,,..1 2 2 2DLL$t{;;;;N)__name__ __module__ __qualname__ BM_compatiblePATTERNr0r1r/rrs/MG <<<<r;s 111111111111111111111111&<&<&<&<&<*$&<&<&<&<&d?d@dAdBdCdCdDdEdFdGdHdIdIdIdJdKdKdLdMdNZdOZefdPZGdQdRejZ dSS)T) fixer_base)Name attr_chainStringIOio cStringIOcPicklepickle __builtin__builtinscopy_regcopyregQueuequeue SocketServer socketserver ConfigParser configparserreprreprlib FileDialogztkinter.filedialog tkFileDialog SimpleDialogztkinter.simpledialogtkSimpleDialogtkColorChooserztkinter.colorchoosertkCommonDialogztkinter.commondialogDialogztkinter.dialogTkdndz tkinter.dndtkFontz tkinter.font tkMessageBoxztkinter.messagebox ScrolledTextztkinter.scrolledtext Tkconstantsztkinter.constantsTixz tkinter.tixttkz tkinter.ttkTkintertkinter markupbase _markupbase_winregwinregthread_thread dummy_thread _dummy_threaddbhashzdbm.bsddumbdbmzdbm.dumbdbmzdbm.ndbmgdbmzdbm.gnu xmlrpclibz xmlrpc.clientDocXMLRPCServerz xmlrpc.serverz http.clientz html.entitiesz html.parserz http.cookieszhttp.cookiejarz http.server subprocess collectionsz urllib.parsezurllib.robotparser)SimpleXMLRPCServerhttplibhtmlentitydefs HTMLParserCookie cookielibBaseHTTPServerSimpleHTTPServer CGIHTTPServercommands UserStringUserListurlparse robotparserc^ddtt|zdzS)N(|))joinmapr)memberss F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_imports.py alternatesrM=s( #dG,,-- - 33c#Kdd|D}t|}d|d|dVd|zVd|d|d Vd |zVdS) Nz | cg|]}d|zS)zmodule_name='%s').0keys rL z!build_pattern..BsGGG-3GGGrNz$name_import=import_name< 'import' ((z;) | multiple_imports=dotted_as_names< any* (z) any* >) > zimport_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > z(import_name< 'import' (dotted_as_name< (zg) 'as' any > | multiple_imports=dotted_as_names< any* dotted_as_name< (z!) 'as' any > any* >) > z3power< bare_with_attr=(%s) trailer<'.' any > any* >)rIrMkeys)mappingmod_list bare_namess rL build_patternrYAszzGGwGGGHHHGLLNN++JJ888 %%%%  888 %%%% @* LLLLLLrNcNeZdZdZdZeZdZdZfdZ fdZ fdZ dZ xZ S) FixImportsTcPdt|jS)NrG)rIrYrV)selfs rLrYzFixImports.build_pattern`sxx dl33444rNc||_tt|dSN)rYPATTERNsuperr[compile_pattern)r^ __class__s rLrczFixImports.compile_patterncs:))++  j$//11111rNctt|j|}|r1d|vr+tfdt |dDrdS|SdS)Nbare_with_attrc3.K|]}|VdSr`rQ)rRobjmatchs rL z#FixImports.match..qs+IIsc IIIIIIrNparentF)rbr[rianyr)r^noderesultsrirds @rLrizFixImports.matchjsvj$''-%++   w..IIIIjx.H.HIIIII/uNurNchtt|||i|_dSr`)rbr[ start_treereplace)r^treefilenamerds rLrpzFixImports.start_treevs. j$**4::: rNc|d}|r|j}|j|}|t ||jd|vr ||j|<d|vr/||}|r|||dSdSdS|dd}|j|j}|r+|t ||jdSdS)N module_name)prefix name_importmultiple_importsrf)getvaluerVrqrrvri transform)r^rmrn import_modmod_namenew_name bare_names rLr|zFixImports.transformzs'[[//  K!'H|H-H   tHZ5FGGG H H H''*2 X&!W,, **T**2NN411111-, 22 01!4I|'' 88H K!!$x 8H"I"I"IJJJJJ K KrN)__name__ __module__ __qualname__ BM_compatiblekeep_line_orderMAPPINGrV run_orderrYrcrirpr| __classcell__)rds@rLr[r[UsMOGI55522222     KKKKKKKrNr[N) r fixer_utilrrrrMrYBaseFixr[rQrNrLrs5))))))))2 :2  2  h2  :2  y 2  G 2  > 2  >2  92  -2  /2  12  32  32  32  %2  M!2 2 " ^#2 $ /%2 & 1'2 ( -)2 * -+2 , --2 . i/2 0 12 2 h32 4 Y52 6 ?72 : Y;2 < j=2 > *?2 @ 9A2 B C2 D oE2 2 F"1#-'#(*,)#'%&/c2 2 2 j444"MMMM(<K<K<K<K<K#<K<K<K<K<KrNPKH13]}A +fixes/__pycache__/fix_types.cpython-311.pycnu[ !A?hdZddlmZddlmZidddddd d d d d dd ddddddddddddddddddd d!d"d#d$d d%d&d'Zd(eDZGd)d*ejZd+S),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)Name BooleanTypebool BufferType memoryview ClassTypetype ComplexTypecomplexDictTypedictDictionaryType EllipsisTypeztype(Ellipsis) FloatTypefloatIntTypeintListTypelistLongType ObjectTypeobjectNoneTypez type(None)NotImplementedTypeztype(NotImplemented) SliceTypeslice StringTypebytes StringTypesz(str,)tuplestrrange) TupleTypeTypeType UnicodeType XRangeTypecg|]}d|zS)z)power< 'types' trailer< '.' name='%s' > >).0ts D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_types.py r-3sPPPQ 4q 8PPPcBeZdZdZdeZdZdS)FixTypesT|ct|dj}|rt||jSdS)Nname)prefix) _TYPE_MAPPINGgetvaluerr4)selfnoderesults new_values r, transformzFixTypes.transform9s>!%%gfo&;<<  7 $+666 6tr.N)__name__ __module__ __qualname__ BM_compatiblejoin_patsPATTERNr<r)r.r,r0r05s7MhhuooGr.r0N) __doc__r fixer_utilrr5rBBaseFixr0r)r.r,rHsp&| f   F  6  ) W 5 F E x L 5 g!" g#$ %&- 2 QP-PPPz!r.PKH13]t+fixes/__pycache__/fix_paren.cpython-311.pycnu[ !A?hLdZddlmZddlmZmZGddejZdS)ztFixer that adds parentheses where they are required This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``.) fixer_base)LParenRParenceZdZdZdZdZdS)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] > >) (']' | ')') > c|d}t}|j|_d|_|d||t dS)Ntarget)rprefix insert_child append_childr)selfnoderesultsr lparens D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_paren.py transformzFixParen.transform%sY"   Av&&&FHH%%%%%N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrrrr s/MG,&&&&&rrN)__doc__r r fixer_utilrrBaseFixrrrrrstCC'''''''' & & & & &z! & & & & &rPKH13]*||6fixes/__pycache__/fix_basestring.cpython-311.opt-1.pycnu[ !A?h@HdZddlmZddlmZGddejZdS)zFixer for basestring -> str.) fixer_base)NameceZdZdZdZdZdS) FixBasestringTz 'basestring'c.td|jS)Nstr)prefix)rr )selfnoderesultss I/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_basestring.py transformzFixBasestring.transform sE$+....N)__name__ __module__ __qualname__ BM_compatiblePATTERNrrr rrs-MG/////rrN)__doc__r fixer_utilrBaseFixrrrr rsh""/////J&/////rPKH13]zVs2fixes/__pycache__/fix_intern.cpython-311.opt-1.pycnu[ !A?hxLdZddlmZddlmZmZGddejZdS)z/Fixer for intern(). intern(s) -> sys.intern(s)) fixer_base) ImportAndCall touch_importc eZdZdZdZdZdZdS) FixInternTprez power< 'intern' trailer< lpar='(' ( not(arglist | argument) any ','> ) rpar=')' > after=any* > c|r5|d}|r+|j|jjkr|jdjdvrdSd}t |||}t dd||S)Nobj>***)sysinternr)typesymsargumentchildrenvaluerr)selfnoderesultsr namesnews E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_intern.py transformzFixIntern.transformsu  %.C H 222LO)[88F!D'511T5$''' N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrr s4M EG     rrN)__doc__r fixer_utilrrBaseFixrr#rrr(sr 44444444 "rPKH13]U66-fixes/__pycache__/fix_imports.cpython-311.pycnu[ !A?h4RdZddlmZddlmZmZiddddddd d d d d ddddddddddddddddddddd d!d"id#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdDdEdFdGdHdIdJdJdJdKdLdLdMdNdOZdPZefdQZGdRdSej Z dTS)Uz/Fix incompatible imports and module references.) fixer_base)Name attr_chainStringIOio cStringIOcPicklepickle __builtin__builtinscopy_regcopyregQueuequeue SocketServer socketserver ConfigParser configparserreprreprlib FileDialogztkinter.filedialog tkFileDialog SimpleDialogztkinter.simpledialogtkSimpleDialogtkColorChooserztkinter.colorchoosertkCommonDialogztkinter.commondialogDialogztkinter.dialogTkdndz tkinter.dndtkFontz tkinter.font tkMessageBoxztkinter.messagebox ScrolledTextztkinter.scrolledtext Tkconstantsztkinter.constantsTixz tkinter.tixttkz tkinter.ttkTkintertkinter markupbase _markupbase_winregwinregthread_thread dummy_thread _dummy_threaddbhashzdbm.bsddumbdbmzdbm.dumbdbmzdbm.ndbmgdbmzdbm.gnu xmlrpclibz xmlrpc.clientDocXMLRPCServerz xmlrpc.serverz http.clientz html.entitiesz html.parserz http.cookieszhttp.cookiejarz http.server subprocess collectionsz urllib.parsezurllib.robotparser)SimpleXMLRPCServerhttplibhtmlentitydefs HTMLParserCookie cookielibBaseHTTPServerSimpleHTTPServer CGIHTTPServercommands UserStringUserListurlparse robotparserc^ddtt|zdzS)N(|))joinmapr)memberss F/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_imports.py alternatesrM=s( #dG,,-- - 33c#Kdd|D}t|}d|d|dVd|zVd|d|d Vd |zVdS) Nz | cg|]}d|zS)zmodule_name='%s').0keys rL z!build_pattern..BsGGG-3GGGrNz$name_import=import_name< 'import' ((z;) | multiple_imports=dotted_as_names< any* (z) any* >) > zimport_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > z(import_name< 'import' (dotted_as_name< (zg) 'as' any > | multiple_imports=dotted_as_names< any* dotted_as_name< (z!) 'as' any > any* >) > z3power< bare_with_attr=(%s) trailer<'.' any > any* >)rIrMkeys)mappingmod_list bare_namess rL build_patternrYAszzGGwGGGHHHGLLNN++JJ888 %%%%  888 %%%% @* LLLLLLrNcNeZdZdZdZeZdZdZfdZ fdZ fdZ dZ xZ S) FixImportsTcPdt|jS)NrG)rIrYrV)selfs rLrYzFixImports.build_pattern`sxx dl33444rNc||_tt|dSN)rYPATTERNsuperr[compile_pattern)r^ __class__s rLrczFixImports.compile_patterncs:))++  j$//11111rNctt|j|}|r1d|vr+tfdt |dDrdS|SdS)Nbare_with_attrc3.K|]}|VdSr`rQ)rRobjmatchs rL z#FixImports.match..qs+IIsc IIIIIIrNparentF)rbr[rianyr)r^noderesultsrirds @rLrizFixImports.matchjsvj$''-%++   w..IIIIjx.H.HIIIII/uNurNchtt|||i|_dSr`)rbr[ start_treereplace)r^treefilenamerds rLrpzFixImports.start_treevs. j$**4::: rNc|d}|r|j}|j|}|t ||jd|vr ||j|<d|vr/||}|r|||dSdSdS|dd}|j|j}|r+|t ||jdSdS)N module_name)prefix name_importmultiple_importsrf)getvaluerVrqrrvri transform)r^rmrn import_modmod_namenew_name bare_names rLr|zFixImports.transformzs'[[//  K!'H|H-H   tHZ5FGGG H H H''*2 X&!W,, **T**2NN411111-, 22 01!4I|'' 88H K!!$x 8H"I"I"IJJJJJ K KrN)__name__ __module__ __qualname__ BM_compatiblekeep_line_orderMAPPINGrV run_orderrYrcrirpr| __classcell__)rds@rLr[r[UsMOGI55522222     KKKKKKKrNr[N) __doc__r fixer_utilrrrrMrYBaseFixr[rQrNrLrs55))))))))2 :2  2  h2  :2  y 2  G 2  > 2  >2  92  -2  /2  12  32  32  32  %2  M!2 2 " ^#2 $ /%2 & 1'2 ( -)2 * -+2 , --2 . i/2 0 12 2 h32 4 Y52 6 ?72 : Y;2 < j=2 > *?2 @ 9A2 B C2 D oE2 2 F"1#-'#(*,)#'%&/c2 2 2 j444"MMMM(<K<K<K<K<K#<K<K<K<K<KrNPKH13]Qy/+fixes/__pycache__/fix_raise.cpython-311.pycnu[ !A?hn pdZddlmZddlmZddlmZddlmZmZm Z m Z m Z Gddej 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_tupleceZdZdZdZdZdS)FixRaiseTzB raise_stmt< 'raise' exc=any [',' val=any [',' tb=any]] > ch|j}|d}|jtjkrd}|||dSt |rOt |r9|jdjd}t |9d|_d|vr7tj |j td|g}|j|_|S|d}t |rd|jdd D}n d |_|g}d |vr|d } d | _|} |jtj ks |jd krt||} t!| td t#| ggz} tj |jtdg| z}|j|_|Stj |j tdt||g|jS)Nexcz+Python 3 does not support string exceptions valraisec6g|]}|S)clone).0cs D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_raise.py z&FixRaise.transform..Ds :::!AGGII:::tbNonewith_traceback)prefix)symsrtyperSTRINGcannot_convertr childrenr!rNode raise_stmtrNAMEvaluerrr simple_stmt) selfnoderesultsr"rmsgnewrargsrewith_tbs r transformzFixRaise.transform&syen""$$ 8u| # #?C   c * * * F C== 3-- :l1o.q177993-- :CJ   +doW s/CDDCCJJen""$$ C== ::s|AbD'9:::DDCJ5D 7??$$&&BBIAx5:%%f)<)<dOO1d#34455"GG+d.g'0IJJCCJJ;t $W tC?&*k333 3rN)__name__ __module__ __qualname__ BM_compatiblePATTERNr4rrrr r s/MG4343434343rr N)__doc__rrpgen2rr fixer_utilrrrr r BaseFixr rrrr>s2<<<<<<<<<<<<<<;3;3;3;3;3z!;3;3;3;3;3rPKH13]8 N 1fixes/__pycache__/fix_apply.cpython-311.opt-2.pycnu[ !A?h* f ddlmZddlmZddlmZddlmZmZmZGddej Z dS))pytree)token) fixer_base)CallComma parenthesizeceZdZdZdZdZdS)FixApplyTa. power< 'apply' trailer< '(' arglist< (not argument ')' > > c~|j}|d}|d}|d}|r+|j|jjkr|jdjdvrdS|r-|j|jjkr|jdjdkrdS|j}|}|jtj |j fvr?|j|j ks |jdjtj krt|}d|_|}d|_||}d|_tjtjd |g}|N|t%tjtj d|gd |d_t'||| S) Nfuncargskwds>***rr )prefix)symsgettypeargumentchildrenvaluerclonerNAMEatompower DOUBLESTARrrLeafSTARextendrr) selfnoderesultsrr r rr l_newargss D/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_apply.py transformzFixApply.transformsyvv{{6""   TY/// a &+55  TY$)"444]1%+t33 Fzz|| Iej$)4 4 4 Y$* $ $ ]2  #u'7 7 7%%D zz||  ::<r4s9 22222222226464646464z!6464646464r*PKH13]CQQ,fixes/__pycache__/fix_reduce.cpython-311.pycnu[ !A?hEHdZddlmZddlmZGddejZdS)zqFixer for reduce(). Makes sure reduce() is imported from the functools module if reduce is used in that module. ) fixer_base touch_importc eZdZdZdZdZdZdS) FixReduceTpreai power< 'reduce' trailer< '(' arglist< ( (not(argument) any ',' not(argument > c(tdd|dS)N functoolsreducer)selfnoderesultss E/opt/alt/python-internal/lib64/python3.11/lib2to3/fixes/fix_reduce.py transformzFixReduce.transform"s[(D11111N)__name__ __module__ __qualname__ BM_compatibleorderPATTERNrrrrrs4M E G22222rrN)__doc__lib2to3rlib2to3.fixer_utilrBaseFixrrrrrsl ++++++22222 "22222rPKH13]   *pgen2/__pycache__/literals.cpython-311.pycnu[ !A?hc bdZddlZddddddd d d d d ZdZdZdZedkr edSdS)z>$      T " "C   s VQRR u::>>ADHII I TE2AA T T TADHIIt S T VD! AA V V VCdJKKQU U V q66MsB%%CCC6c|ds4|dsJt|dd|d}|dd|dzkr|dz}||s-Jt|t| dt|dt|zksJ|t|t| }t jdt |S)Nr r rrrz)\\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3}))rreprendswithrresubr))sqs r( evalStringr2(s <<  > S 1 1>>4"1";;>> 1 !A!u!|| aC ::a==++$q#a&&{++++= q66Qs1vvX     #a&&#a&&.A 6> J JJctdD]G}t|}t|}t|}||krt ||||HdS)N)ranger!r,r2print)r'cr0es r(testr:2s` 3ZZ FF GG qMM 66 !Q1    r3__main__)__doc__r.rr)r2r:__name__r3r(r?sCB   *KKK zDFFFFFr3PKH13]^qJqJ,pgen2/__pycache__/pgen.cpython-311.opt-1.pycnu[ !A?h6ddlmZmZmZGddejZGddeZGddeZGdd eZ d d Z d S))grammartokentokenizeceZdZdS) PgenGrammarN)__name__ __module__ __qualname__?/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/pgen.pyrrsDr rc~eZdZddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZddZdZdZdS)ParserGeneratorNcNd}|t|d}|j}||_||_t j|j|_|| \|_ |_ | |i|_ | dS)Nzutf-8)encoding)openclosefilenamestreamrgenerate_tokensreadline generatorgettokenparsedfas startsymbolfirst addfirstsets)selfrr close_streams r __init__zParserGenerator.__init__ s >(W555F!%00HOOQ_U%;T$BCCC,2AN5)!M!t44QX%%8F++HOOVTN333'-AHV$!MKKEQx!! "AJ&&:e,,HOOUZ$7888(.AJu%!M!u-QX%%8F++HOOVTN333'-AHV$!Mr ct|j}||D] }||jvr||!dSN)r%rr&r'r calcfirst)rr8r9s r rzParserGenerator.addfirstsetsksaTY^^%%&&  % %D4:%%t$$$ % %r c .|j|}d|j|<|d}i}i}|jD]\}}||jvrh||jvr"|j|}|t d|zn"|||j|}|||||<vd||<|di||<i} |D]4\}} | D],} | | vr!t d|d| d|d| | || | <-5||j|<dS)Nr#zrecursion for rule %rrzrule z is ambiguous; z is in the first sets of z as well as )rrr.r/ ValueErrorrSupdate) rr9r;r<totalset overlapcheckr=r>fsetinverseitsfirstsymbols r rSzParserGenerator.calcfirstssio 4A  :++-- 1 1KE4 !!DJ&&:e,D|()@4)GHHH$NN5))):e,D%%%&* U##"#',aj U##+1133 ( (OE8" ( (W$$$*&*ddFFFEEE76??&LMMM#(  ( $ 4r cti}d}|jtjkr|jtjkr)||jtjk)|tj}|tjd|\}}|tj| ||}t|}| |t|}|||<||}|jtjk||fS)N:) typer ENDMARKERNEWLINErexpectrMOP parse_rhsmake_dfar* simplify_dfa) rrrr9azr;oldlennewlens r rzParserGenerator.parses  i5?**)u},, )u},,;;uz**D KK# & & &>>##DAq KK & & &--1%%CXXF   c " " "XXFDJ"" #i5?**$[  r c  fd} fd t|||g}|D]}i}|jD]1}|jD]'\}} |  | ||i(2t |D]R\}} |D]} | j| krn&t| |} || || |S|S)Nc$i}|||SrRr )r<base addclosures r closurez)ParserGenerator.make_dfa..closuresD Jud # # #Kr cT||vrdSd||<|jD]\}}| ||dSrAr.)r<rmr=r>rns r rnz,ParserGenerator.make_dfa..addclosuresQ}}DK$z + + t=JtT*** + +r )DFAStatenfasetr. setdefaultr-r/r0addarc) rr6finishror4r<r.nfastater=r>rsstrns @r rezParserGenerator.make_dfasM      + + + + +775>>6223 ( (ED!L E E#+=EEKE4(" 4)C)CDDDE"( !5!5 ( ( v &&ByF**+"&&11BMM"%%% R'''' ( r cltd||g}t|D]\}}td|||urdpd|jD]l\}}||vr||} n$t |} |||td| zXtd|| fzmdS)NzDump of NFA for State(final)z -> %d %s -> %d)print enumerater.r2r*r0) rr9r6rvtodor:r<r=r>js r dump_nfazParserGenerator.dump_nfas &&&w!$ 7 7HAu )Q =I C D D D$z 7 7 t4<< 4((AAD AKK%%%=+/****.E1:56666 7 7 7r c *td|t|D]r\}}td||jrdpdt|jD],\}}td|||fz-sdS)NzDump of DFA forrzr{r|r})r~rr3r-r.r/r2)rr9r;r:r<r=r>s r dump_dfazParserGenerator.dump_dfas &&&!# A AHAu )Q ;) Ar B B B%ej&6&6&8&899 A A tnsyy'??@@@@ A A Ar cd}|rnd}t|D]X\}}t|dzt|D]2}||}||kr"||=|D]}|||d}n3Y|ldSdS)NTFr)rranger* unifystate)rr;changesr:state_irstate_jr<s r rfzParserGenerator.simplify_dfas G'nn   7qsCHH--A!!fG'))F%(??E!,,Wg>>>>"& *      r c|\}}|jdkr||fSt}t}|||||jdkr`||\}}|||||jdk`||fS)N|) parse_altrPNFAStaterur)rrgrhaazzs r rdzParserGenerator.parse_rhss~~1 :  a4KBB IIaLLL HHRLLL*## ~~''1 !  *## r6Mr c4|\}}|jdvs|jtjtjfvrV|\}}|||}|jdv7|jtjtjfvV||fS)N)([) parse_itemrPr_rrMSTRINGru)rrgbr7ds r rzParserGenerator.parse_alt s  1zZ''yUZ666??$$DAq HHQKKKA zZ''yUZ666!t r c|jdkrd||\}}|tjd||||fS|\}}|j}|dvr||fS||||dkr||fS||fS)Nr])+*r)rPrrdrbrrcru parse_atom)rrgrhrPs r rzParserGenerator.parse_items :   MMOOO>>##DAq KK# & & & HHQKKKa4K??$$DAqJEJ&&!t MMOOO HHQKKK||!t !t r c|jdkrO||\}}|tjd||fS|jtjtjfvrOt}t}| ||j|||fS| d|j|jdS)Nr)z+expected (...) or NAME or STRING, got %s/%s) rPrrdrbrrcr_rMrrru raise_error)rrgrhs r rzParserGenerator.parse_atom(s :   MMOOO>>##DAq KK# & & &a4K Y5:u|4 4 4 A A HHQ # # # MMOOOa4K   J!Y  4 4 4 4 4r c|j|ks |.|j|kr#|d|||j|j|j}||S)Nzexpected %s/%s, got %s/%s)r_rPrr)rr_rPs r rbzParserGenerator.expect9sd 9  !2tzU7J7J   8!5$)TZ A A A   r ct|j}|dtjtjfvr4t|j}|dtjtjfv4|\|_|_|_|_|_ dSrE) r>rrCOMMENTNLr_rPbeginendline)rtups r rzParserGenerator.gettokenAsr4>""!f)8;777t~&&C!f)8;777AD> 4:tz48TYYYr c |rG ||z}n@#d|gttt|z}YnxYwt ||j|jd|jd|jf)N r#r)joinr%mapstr SyntaxErrorrrr)rmsgargss r rzParserGenerator.raise_errorHs  = =Dj =hhutCTNN';';;<<# tx{ $ TY 899 9s  ;ArR)rr r r!r?r5r1rrSrrerrrfrdrrrrbrrr r r rr s4    2,",","\%%%$$$<!!!0"""H777 AAA*"(444"EEE99999r rceZdZdZddZdS)rcg|_dSrRrq)rs r r!zNFAState.__init__Ss  r Nc>|j||fdSrR)r.r0rr>r=s r ruzNFAState.addarcVs$ %'''''r rR)rr r r!rur r r rrQs7((((((r rc*eZdZdZdZdZdZdZdS)rrc4||_||v|_i|_dSrR)rsr3r.)rrsfinals r r!zDFAState.__init__]s!   r c||j|<dSrRrqrs r ruzDFAState.addarces  %r c`|jD]\}}||ur ||j|<dSrR)r.r/)roldnewr=r>s r rzDFAState.unifystateksA9??,, ' 'KE4s{{#& %  ' 'r c|j|jkrdSt|jt|jkrdS|jD]$\}}||j|urdS%dS)NFT)r3r*r.r/get)rotherr=r>s r __eq__zDFAState.__eq__ps <5= ( (5 ty>>S__ , ,59??,,  KE45:>>%0000uu1tr N)rr r r!rurr__hash__r r r rrrr[sQ   '''   HHHr rr Grammar.txtcHt|}|SrR)rr?)rps r generate_grammarrs!!A >>  r N)r) r|rrrGrammarrobjectrrrrrr r r rs '&&&&&&&&&     '/   E9E9E9E9E9fE9E9E9N (((((v(((#####v###Jr PKH13] "i*NN0pgen2/__pycache__/tokenize.cpython-311.opt-2.pycnu[ !A?hR N dZdZddlZddlZddlmZmZddlTddlm Z de e Dgd zZ [ e n #e $reZ YnwxYwd Zd Zd Zd ZdZdZeedezzeezZdZdZdZdZeddZeeeeeZdZeddeezZdezZeeeZededzZ ee eeZ!dZ"dZ#dZ$d Z%d!Z&ee&d"ze&d#zZ'ee&d$ze&d%zZ(ed&d'd(d)d*d+d,d-d. Z)d/Z*ed0d1d2Z+ee)e*e+Z,ee!e,e(eZ-ee-zZ.ee&d3zed4dze&d5zed6dzZ/edee'Z0eee0e!e,e/ezZ1e2ej3e.e1e$e%f\Z4Z5Z6Z7ed7d8d9d:ed7d8d;d<zhd=zZ8ej3e"ej3e#e6e7d>d?e8Dd@e8DdAe8DZ9d"d#hdBe8DzdCe8DzZ:d4d6hdDe8DzdEe8DzZ;dFZ<GdGdHe=Z>GdIdJe=Z?dKZ@e@fdLZAdMZBGdNdOZCej3dPejDZEej3dQejDZFdRZGdSZHdTZIdUZJeKdVkrUddlLZLeMeLjNdkr&eAeOeLjNdjPdSeAeLjQjPdSdS)WzKa-Ping Yee z@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip MontanaroN)BOM_UTF8lookup)*)tokenc*g|]}|ddk|S)r_).0xs C/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/tokenize.py r%s! 0 0 0AaDCKK1KKK)tokenizegenerate_tokens untokenizec8dd|zdzS)N(|))joinchoicess r groupr0sC#((7"3"33c99rct|dzS)Nrrrs r anyr1s%/C//rct|dzS)N?rrs r mayber 2sE7Oc11rc:tfdDS)Nc3K|];}dzD]3}||k,||zV4z _combinations..4s`!e)qzz||qzz||/K/KA/K/K/K/K/Kr)set)r&s`r _combinationsr)3s;   rz[ \f\t]*z #[^\r\n]*z\\\r?\nz\w+z0[bB]_?[01]+(?:_[01]+)*z(0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?z0[oO]?_?[0-7]+(?:_[0-7]+)*[lL]?z[1-9]\d*(?:_\d+)*[lL]?z0[lL]?z[eE][-+]?\d+(?:_\d+)*z\d+(?:_\d+)*\.(?:\d+(?:_\d+)*)?z\.\d+(?:_\d+)*z \d+(?:_\d+)*z\d+(?:_\d+)*[jJ]z[jJ]z[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'(?:[uUrRbBfF]|[rR][fFbB]|[fFbBuU][rR])?'''"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z<>z!=z//=?z->z[+\-*/%&@|^=<>]=?~z[][(){}]z\r?\nz:=z[:;.,`@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"rRfFbB>UuURUruRur)r-r.r*r+c$i|] }|dtSr*) single3progr prefixs r r@y FFFv&~~~{FFFrc$i|] }|dtSr+) double3progr>s r r@r@zrArci|]}|dSNr r>s r r@r@{s777vt777rch|]}|dSr<r r>s r rH///^^^///rch|]}|dSrCr r>s r rHrHrIrch|]}|dS)r-r r>s r rHrH---f\\\---rch|]}|dS)r.r r>s r rHrHrLrceZdZdS) TokenErrorN__name__ __module__ __qualname__r rr rPrPrrPceZdZdS)StopTokenizingNrQr rr rWrWrUrrWc z|\}}|\}}td||||t|t|fzdS)Nz%d,%d-%d,%d: %s %s)printtok_namerepr) typerxxx_todo_changemexxx_todo_changeme1linesrowscolerowecols r printtokenrdsR$LT4%LT4 tT4$e= >?????rcL t||dS#t$rYdSwxYwrF) tokenize_looprW)readline tokeneaters r rrsD  h +++++      s  ##c4t|D]}||dSrF)r)rgrh token_infos r rfrfs3%h//   J  rc&eZdZdZdZdZdZdS) Untokenizerc0g|_d|_d|_dS)Nrr)tokensprev_rowprev_col)selfs r __init__zUntokenizer.__init__s   rcf|\}}||jz }|r|jd|zdSdS)N )rprnappend)rqstartrowcol col_offsets r add_whitespacezUntokenizer.add_whitespacesJS4=(  1 K  sZ/ 0 0 0 0 0 1 1rcp|D]}t|dkr|||nn|\}}}}}|||j||\|_|_|ttfvr|xjdz c_d|_d |jS)Nrrr#) lencompatrzrnrurorpNEWLINENLr)rqiterablettok_typerrvendr_s r rzUntokenizer.untokenizes " "A1vv{{ Ax(((01 -HeUC    & & & K  u % % %+. (DM4=GR=(( " ! wwt{###rcd}g}|jj}|\}}|ttfvr|dz }|tt fvrd}|D]}|dd\}}|ttt tfvr|dz }|tkr||Q|tkr| q|tt fvrd}n|r|r||dd}||dS)NFrtTr|) rnruNAMENUMBERrrASYNCAWAITINDENTDEDENTpop) rqrr startlineindents toks_appendtoknumtokvaltoks r r~zUntokenizer.compats k(  dF^ # # cMF gr] " "I  C !WNFF$u555# v&&&6!! GR=((  "w " GBK(((! K    #  rN)rRrSrTrrrzrr~r rr rlrlsP 111 $ $ $     rrlz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)c |dddd}|dks|drdS|dvs|drdS|S) N r -utf-8zutf-8-)zlatin-1 iso-8859-1z iso-latin-1)zlatin-1-z iso-8859-1-z iso-latin-1-r)lowerreplace startswith)orig_encencs r _get_normal_namersw2 3B3-     ' 'S 1 1C g~~11~w 666 ~~ABB7| OrcN dd}d}fd}fd}|}|trd|dd}d}|s|gfS||}|r||gfSt|s||gfS|}|s||gfS||}|r|||gfS|||gfS)NFrcV S#t$rtcYSwxYwrF) StopIterationbytes)rgsr read_or_stopz%detect_encoding..read_or_stops< 8::    77NNN s ((c| |d}n#t$rYdSwxYwt|}|sdSt |d} t |}n #t$rtd|zwxYwr|j dkrtd|dz }|S)Nasciirzunknown encoding: rzencoding problem: utf-8z-sig) decodeUnicodeDecodeError cookie_rematchrrr LookupError SyntaxErrorname)r_ line_stringrencodingcodec bom_founds r find_cookiez$detect_encoding..find_cookie s ++g..KK!   44  ,, 4#EKKNN33 ?8$$EE ? ? ?2X=>> > ?  zW$$!";<<<  Hs ''+A;;BTz utf-8-sig)rrblank_rer)rgrdefaultrrfirstsecondrs` @r detect_encodingrs2"IHG , LNNE !! abb  {{5!!H!%  >>%   \^^F  {6""H)%(( UFO ##rcJ t}||SrF)rlr)ruts r rr:s$" B == " ""rc# K dx}x}}d\}}d}dg}d}d} d} d} |} n#t$rd} YnwxYw|dz}dt| }} |r| std||| }|r>|dx} }t || d|z|||f|| zfVd\}}d}nZ|rA| dddkr3| d dd kr%t || z||t| f|fVd}d}|| z}|| z}|dkr|s| sn d}| |krO| | d kr|dz}n2| | d kr|tzdztz}n| | d krd}nn | dz} | |kO| |krn|r|Vd}| | dvr| | dkry| | dd}| t|z}t||| f|| t|zf| fVt| |d||f|t| f| fVn>ttf| | dk| | d|| f|t| f| fV0||dkr/| |t| d| |df|| f| fV||dkrT||vrtdd|| | f|dd}| r| |dkrd} d} d} td|| f|| f| fV||dkT| r| r| |dkrd} d} d} n| std|dfd}| |krt| | }|r|d\}}||f||f|} }}| ||| |}}|t"jvs |dkr|dkrt&|||| fVn|dvr,t(}|dkrt}n| rd} |r|Vd}||||| fVnO|dkr|r|Vd}t|||| fVn1|t*vrpt,|}|| | }|r9|d} | || }|r|Vd}t |||| f| fVn||f}| |d}| }n|t.vs"|ddt.vs|ddt.vrk|ddkrG||f}t,|p%t,|dpt,|d}| |dd}}| }nA|r|Vd}t |||| fVn"|r|dvr| r|dkrt2nt4|||| fVt6|||| f}|dkr|s|}/|dvrW|rU|dt6krD|ddkr8|dkr d} |d} t2|d|d|d|dfVd}|r|Vd}|Vnk|dkr|r|Vd}t|||| f| fVd}nJ|d vr|dz}n |d!vr|dz }|r|Vd}t8|||| fVn t | | || f|| dzf| fV| dz} | |k|r|Vd}|ddD]}td|df|dfdfVt:d|df|dfdfVdS)"Nr)r#rFrr#zEOF in multi-line stringz\ z\ rt  z# #z rz3unindent does not match any outer indentation levelz zEOF in multi-line statement.Tr|r )asyncawaitr)defforr\z([{z)]})rr}rPrrSTRING ERRORTOKENtabsizerstripCOMMENTrrurIndentationErrorr pseudoprogspanstringdigitsrr triple_quotedendprogs single_quoted isidentifierrrrOP ENDMARKER)rglnumparenlev continuedcontstrneedcontcontlinerstashed async_defasync_def_indent async_def_nlr_posmaxstrstartendprogendmatchrcolumn comment_tokennl_pos pseudomatchrvsposeposrinitialnewlinerindents r rrOs #$#D#8iGXHcGGIL} 8::DD   DDD axc$iiS J  G !;XFFF}}T**H $LLOO+cwdsd3$ho????$)! d233i611d233i86K6K!7T>#dCII%6BBBB!D.#d? ]]9] F))9##fqjVV#Y$&&&'/A2Ew1N#Y$&&Ag )) czz5  CyG##9##$(J$5$5f$=$=M 3}#5#55F"M #;sS5G5G/G(H$PPPPtFGG} &>D#d))+'"+.M.M! $ #$  K !>q JJJICii$**455Kg (--a00 s#'-$cCd!%eCi$u+wfm++sNNu||!5$d;;;;;&&%G!||"$",'+ '% "&"E4t<<<<<^^'% "&"E4t<<<<<m++&uoG&}}T377H &ll1oo $U3Y"+")MMM&*G%udT3KFFFFF$(%="&uvv,#' --"1"I.."1"I..RyD(($(%=#+G#4$6q8J$6#+E!H#5 ,0L!#'"+")MMM&*G%udD$?????))++,8 222$%,1W,<,<55%#($d#<<<<$dD9C'''"% ..# +$+AJ$$6$6$+AJ'$9$9$~~,0 3:2; 0#('!*#*1:wqz#*1:#////'+G'% "&IIII__'% "&udT3K>>>> !II%''HqL E))hl8'% "&udD$77777!49 #;s1u t====AgSCiii}~ !""+55rD!9tQi44444 b4)dAY 333333s ) 88__main__)R __author__ __credits__rrecodecsrrlib2to3.pgen2.tokenr#rdir__all__r NameErrorstrrrr r) WhitespaceCommentIgnoreName Binnumber Hexnumber Octnumber Decnumber IntnumberExponent PointfloatExpfloat Floatnumber ImagnumberNumberSingleDoubleSingle3Double3 _litprefixTripleStringOperatorBracketSpecialFunny PlainTokenTokenContStr PseudoExtras PseudoTokenmapcompile tokenprogrr=rD _strprefixesrrrr ExceptionrPrWrdrrfrlASCIIrrrrrrrRsysr}argvopenrgstdinr rr r#s#0* F ########!!!! 0 0cc%jj 0 0 04,4,4, ,  EE EEE :99///111   cc*z122 2UU7^^ C  & 7 . E+X 6 6 E)Y 9 = = # U57H I IEERZOO [ X %eJ)) U& g(= > > z; 2 2 $ # 2 2 7 zE!:#5 6 6 z;;;; = = 5GWeU%%    %% - - h)) U65&$ / /  % ;;c:&&';;c:&&' ( (uZ&11 55vugtLLL 25#J Wg63838/ :{KM#sC%%M#sC%%&&&&' F##*"*V*<*<{ 9 9FFFFF 9GFFFF 987,777  9 EN//,///0//,///0  #J-- ---.-- ---. !!!!!!!!%%%%%Y%%%??? #-    &   6 6 6 6 6 6 6 6 p BJ@"( K K 2:0"( ; ;   G$G$G$R###*`4`4`4D zJJJ s38}}q((44 #4#4#=>>>>> (39% & & & & &s?A A PKH13]:ycf f 0pgen2/__pycache__/literals.cpython-311.opt-2.pycnu[ !A?hc ` ddlZdddddddd d d d Zd ZdZdZedkr edSdS)N     '"\) abfnrtvr r r c|dd\}}t|}||S|drb|dd}t |dkrt d|z t |d}nT#t $rt d|zdwxYw t |d}n!#t $rt d|zdwxYwt|S) Nrxz!invalid hex string escape ('\%s')z#invalid octal string escape ('\%s'))groupsimple_escapesget startswithlen ValueErrorintchr)malltaileschexesis C/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/literals.pyescaper)s1 IC   T " "C   s VQRR u::>>ADHII I TE2AA T T TADHIIt S T VD! AA V V VCdJKKQU U V q66Ms=BB,0CCc|d}|dd|dzkr|dz}|t|t| }tjdt|S)Nrz)\\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3}))rresubr))sqs r( evalStringr0(s\ !A!u!|| aC #a&&#a&&.A 6> J JJctdD]G}t|}t|}t|}||krt ||||HdS)N)ranger!reprr0print)r'cr.es r(testr92s` 3ZZ FF GG qMM 66 !Q1    r1__main__)r,rr)r0r9__name__r1r(r=sC   *KKK zDFFFFFr1PKH13]n:R0pgen2/__pycache__/__init__.cpython-311.opt-2.pycnu[ !A?hdS)NrC/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/__init__.pyrs rPKH13]`33&pgen2/__pycache__/conv.cpython-311.pycnu[ !A?h%HdZddlZddlmZmZGddejZdS)aConvert graminit.[ch] spit out by pgen to Python code. Pgen is the Python parser generator. It is useful to quickly create a parser from a grammar file in Python's grammar notation. But I don't want my parsers to be written in C (yet), so I'm translating the parsing tables to Python data structures and writing a Python parse engine. Note that the token numbers are constants determined by the standard Python tokenizer. The standard token module defines these numbers and their names (the names are not used much). The token numbers are hardcoded into the Python tokenizer and into pgen. A Python implementation of the Python tokenizer is also available, in the standard tokenize module. On the other hand, symbol numbers (representing the grammar's non-terminals) are assigned by pgen based on the actual grammar input. Note: this module is pretty much obsolete; the pgen module generates equivalent grammar tables directly from the Grammar.txt input file without having to invoke the Python pgen C program. N)grammartokenc*eZdZdZdZdZdZdZdS) Convertera2Grammar subclass that reads classic pgen output files. The run() method reads the tables as produced by the pgen parser generator, typically contained in two C files, graminit.h and graminit.c. The other methods are for internal use only. See the base class for more documentation. c|||||dS)z|r*t|d|d |\|\}}t|}||jvsJ||jvsJ||j|<||j|<d S) zParse the .h file written by pgen. (Internal) This file is a sequence of #define statements defining the nonterminals of the grammar as numbers. We build two tables mapping the numbers to names and back. Can't open : NFrz^#define\s+(\w+)\s+(\d+)$(z): can't parse T) openOSErrorprint symbol2number number2symbolrematchstripgroupsint) r filenameferrlinenolinemosymbolnumbers rrzConverter.parse_graminit_h5sU XAA    E337 8 8 855555   4 4D aKF6==B 4$**,, 4(((FFF26**,,,@AAAA"$VT%77777T%77777-3"6*-3"6**ts <7<c @ t|}n-#t$r }td|d|Yd}~dSd}~wwxYwd}|dzt|}}|dks J||f|dzt|}}|dks J||f|dzt|}}i}g}|d r|d rKt jd |}|s J||fttt| \} } } g} t| D]} |dzt|}}t jd |}|s J||fttt| \}}| ||f|dzt|}}|d ks J||f| || | f<|dzt|}}|d Kt jd |}|s J||fttt| \}}|t|ks J||fg}t|D]} |dzt|}}t jd|}|s J||fttt| \} } } || | f} | t| ks J||f| | | ||dzt|}}|d ks J||f|dzt|}}|d ||_i}t jd|}|s J||ft|d}t|D]}|dzt|}}t jd|}|s J||f|d}ttt|dddd\}}}}|j||ks J||f|j||ks J||f|dks J||f||}|t|ks J||f|dzt|}}t jd|}|s J||fi}t%|d}t'|D]9\}}t)|}tdD]}|d|zzr d||dz|z<:||f||<|dzt|}}|d ks J||f||_g}|dzt|}}t jd|}|s J||ft|d}t|D]}|dzt|}}t jd|}|s J||f| \}}t|}|dkrd}nt%|}| ||f|dzt|}}|d ks J||f||_|dzt|}}|dks J||f|dzt|}}t jd|}|s J||ft|d}|t|jksJ|dzt|}}|dks J||f|dzt|}}t jd|}|s J||ft|d}|t|jks J||f|dzt|}}t jd|}|s J||ft|d} | |jvs J||f| |_|dzt|}}|d ks J||f |dzt|}}J||f#t0$rYdSwxYw)aParse the .c file written by pgen. (Internal) The file looks as follows. The first two lines are always this: #include "pgenheaders.h" #include "grammar.h" After that come four blocks: 1) one or more state definitions 2) a table defining dfas 3) a table defining labels 4) a struct defining the grammar A state definition has the following form: - one or more arc arrays, each of the form: static arc arcs__[] = { {, }, ... }; - followed by a state array, of the form: static state states_[] = { {, arcs__}, ... }; rrNFrrz#include "pgenheaders.h" z#include "grammar.h" z static arc z)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$z\s+{(\d+), (\d+)},$z}; z'static state states_(\d+)\[(\d+)\] = {$z\s+{(\d+), arcs_(\d+)_(\d+)},$zstatic dfa dfas\[(\d+)\] = {$z0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$z\s+("(?:\\\d\d\d)*")},$z!static label labels\[(\d+)\] = {$z\s+{(\d+), (0|"\w+")},$0zgrammar _PyParser_Grammar = { z \s+(\d+),$z dfas, z\s+{(\d+), labels},$z \s+(\d+)$)rrrnext startswithrrlistmaprrrangeappendlenstatesgrouprreval enumerateorddfaslabelsstart StopIteration)!r r r!r"r#r$allarcsr6r%nmkarcs_ijststater;ndfasr&r'xyzfirst rawbitsetcbyter<nlabelsr=s! rr zConverter.parse_graminit_cTs 8 XAA    E337 8 8 855555 axa3333fd^333axa////&$///axaoom,,! -//-00 1XJ"$$))FD>))rs3 44551aq((A#)!8T!WWDF"8$??B--~--2C 5 566DAqKKA''''%axav~~~~~~~"&A%axa//-00 1 DdKKB % %~ % %2C--..DAqF ###fd^###E1XX # #%axaX?FF))FD>))rs3 44551aq!t}CII~~~~~~~ T"""" MM% !!8T!WWDF6>>>FD>>>>!!8T!WWDFCoom,,! -D  X6 = =!!FD>!!rBHHQKK  u * *A!!8T!WWDFM  B % %~ % %2XXa[[F"3sBHHQ1a,@,@#A#ABBOFAq!%f-777&$777%f-777&$777666FD>6661IEE ???VTN???!!8T!WWDF4d;;B % %~ % %2ERXXa[[))I!),, + +11vvq++Aq!t}+)*acAg+"5>DLLaxav~~~~~~~ axa X:D A A!!FD>!!rbhhqkk""w " "A!!8T!WWDF4d;;B % %~ % %299;;DAqAACxxGG MM1a& ! ! ! !axav~~~~~~~ axa888864.888axa XmT * *!!FD>!!rBHHQKK  DI&&&&axa{"""VTN"""axa X-t 4 4!!FD>!!rbhhqkk""#dk*****VTN***axa XlD ) )!!FD>!!rBHHQKK  ****VTN*** axav~~~~~~~ %!!8T!WWDF %vtn $ $1    DD s" <7</d ddci|_i|_t|jD]1\}\}}|tjkr | ||j|<%| ||j|<2dS)z1Create additional useful structures. (Internal).N)keywordstokensr9r<rNAME)r ilabeltypevalues rr zConverter.finish_offso  %.t{%;%; + + !FMT5uz!!e&7'- e$$$* D!  + +rN)__name__ __module__ __qualname____doc__rrr r rrrr$s^ >c%c%c%J+++++rr)r]rpgen2rrGrammarrr^rrrast4 ! ]+]+]+]+]+]+]+]+]+]+rPKH13]^qJqJ,pgen2/__pycache__/pgen.cpython-311.opt-2.pycnu[ !A?h6ddlmZmZmZGddejZGddeZGddeZGdd eZ d d Z d S))grammartokentokenizeceZdZdS) PgenGrammarN)__name__ __module__ __qualname__?/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/pgen.pyrrsDr rc~eZdZddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZddZdZdZdS)ParserGeneratorNcNd}|t|d}|j}||_||_t j|j|_|| \|_ |_ | |i|_ | dS)Nzutf-8)encoding)openclosefilenamestreamrgenerate_tokensreadline generatorgettokenparsedfas startsymbolfirst addfirstsets)selfrr close_streams r __init__zParserGenerator.__init__ s >(W555F!%00HOOQ_U%;T$BCCC,2AN5)!M!t44QX%%8F++HOOVTN333'-AHV$!MKKEQx!! "AJ&&:e,,HOOUZ$7888(.AJu%!M!u-QX%%8F++HOOVTN333'-AHV$!Mr ct|j}||D] }||jvr||!dSN)r%rr&r'r calcfirst)rr8r9s r rzParserGenerator.addfirstsetsksaTY^^%%&&  % %D4:%%t$$$ % %r c .|j|}d|j|<|d}i}i}|jD]\}}||jvrh||jvr"|j|}|t d|zn"|||j|}|||||<vd||<|di||<i} |D]4\}} | D],} | | vr!t d|d| d|d| | || | <-5||j|<dS)Nr#zrecursion for rule %rrzrule z is ambiguous; z is in the first sets of z as well as )rrr.r/ ValueErrorrSupdate) rr9r;r<totalset overlapcheckr=r>fsetinverseitsfirstsymbols r rSzParserGenerator.calcfirstssio 4A  :++-- 1 1KE4 !!DJ&&:e,D|()@4)GHHH$NN5))):e,D%%%&* U##"#',aj U##+1133 ( (OE8" ( (W$$$*&*ddFFFEEE76??&LMMM#(  ( $ 4r cti}d}|jtjkr|jtjkr)||jtjk)|tj}|tjd|\}}|tj| ||}t|}| |t|}|||<||}|jtjk||fS)N:) typer ENDMARKERNEWLINErexpectrMOP parse_rhsmake_dfar* simplify_dfa) rrrr9azr;oldlennewlens r rzParserGenerator.parses  i5?**)u},, )u},,;;uz**D KK# & & &>>##DAq KK & & &--1%%CXXF   c " " "XXFDJ"" #i5?**$[  r c  fd} fd t|||g}|D]}i}|jD]1}|jD]'\}} |  | ||i(2t |D]R\}} |D]} | j| krn&t| |} || || |S|S)Nc$i}|||SrRr )r<base addclosures r closurez)ParserGenerator.make_dfa..closuresD Jud # # #Kr cT||vrdSd||<|jD]\}}| ||dSrAr.)r<rmr=r>rns r rnz,ParserGenerator.make_dfa..addclosuresQ}}DK$z + + t=JtT*** + +r )DFAStatenfasetr. setdefaultr-r/r0addarc) rr6finishror4r<r.nfastater=r>rsstrns @r rezParserGenerator.make_dfasM      + + + + +775>>6223 ( (ED!L E E#+=EEKE4(" 4)C)CDDDE"( !5!5 ( ( v &&ByF**+"&&11BMM"%%% R'''' ( r cltd||g}t|D]\}}td|||urdpd|jD]l\}}||vr||} n$t |} |||td| zXtd|| fzmdS)NzDump of NFA for State(final)z -> %d %s -> %d)print enumerater.r2r*r0) rr9r6rvtodor:r<r=r>js r dump_nfazParserGenerator.dump_nfas &&&w!$ 7 7HAu )Q =I C D D D$z 7 7 t4<< 4((AAD AKK%%%=+/****.E1:56666 7 7 7r c *td|t|D]r\}}td||jrdpdt|jD],\}}td|||fz-sdS)NzDump of DFA forrzr{r|r})r~rr3r-r.r/r2)rr9r;r:r<r=r>s r dump_dfazParserGenerator.dump_dfas &&&!# A AHAu )Q ;) Ar B B B%ej&6&6&8&899 A A tnsyy'??@@@@ A A Ar cd}|rnd}t|D]X\}}t|dzt|D]2}||}||kr"||=|D]}|||d}n3Y|ldSdS)NTFr)rranger* unifystate)rr;changesr:state_irstate_jr<s r rfzParserGenerator.simplify_dfas G'nn   7qsCHH--A!!fG'))F%(??E!,,Wg>>>>"& *      r c|\}}|jdkr||fSt}t}|||||jdkr`||\}}|||||jdk`||fS)N|) parse_altrPNFAStaterur)rrgrhaazzs r rdzParserGenerator.parse_rhss~~1 :  a4KBB IIaLLL HHRLLL*## ~~''1 !  *## r6Mr c4|\}}|jdvs|jtjtjfvrV|\}}|||}|jdv7|jtjtjfvV||fS)N)([) parse_itemrPr_rrMSTRINGru)rrgbr7ds r rzParserGenerator.parse_alt s  1zZ''yUZ666??$$DAq HHQKKKA zZ''yUZ666!t r c|jdkrd||\}}|tjd||||fS|\}}|j}|dvr||fS||||dkr||fS||fS)Nr])+*r)rPrrdrbrrcru parse_atom)rrgrhrPs r rzParserGenerator.parse_items :   MMOOO>>##DAq KK# & & & HHQKKKa4K??$$DAqJEJ&&!t MMOOO HHQKKK||!t !t r c|jdkrO||\}}|tjd||fS|jtjtjfvrOt}t}| ||j|||fS| d|j|jdS)Nr)z+expected (...) or NAME or STRING, got %s/%s) rPrrdrbrrcr_rMrrru raise_error)rrgrhs r rzParserGenerator.parse_atom(s :   MMOOO>>##DAq KK# & & &a4K Y5:u|4 4 4 A A HHQ # # # MMOOOa4K   J!Y  4 4 4 4 4r c|j|ks |.|j|kr#|d|||j|j|j}||S)Nzexpected %s/%s, got %s/%s)r_rPrr)rr_rPs r rbzParserGenerator.expect9sd 9  !2tzU7J7J   8!5$)TZ A A A   r ct|j}|dtjtjfvr4t|j}|dtjtjfv4|\|_|_|_|_|_ dSrE) r>rrCOMMENTNLr_rPbeginendline)rtups r rzParserGenerator.gettokenAsr4>""!f)8;777t~&&C!f)8;777AD> 4:tz48TYYYr c |rG ||z}n@#d|gttt|z}YnxYwt ||j|jd|jd|jf)N r#r)joinr%mapstr SyntaxErrorrrr)rmsgargss r rzParserGenerator.raise_errorHs  = =Dj =hhutCTNN';';;<<# tx{ $ TY 899 9s  ;ArR)rr r r!r?r5r1rrSrrerrrfrdrrrrbrrr r r rr s4    2,",","\%%%$$$<!!!0"""H777 AAA*"(444"EEE99999r rceZdZdZddZdS)rcg|_dSrRrq)rs r r!zNFAState.__init__Ss  r Nc>|j||fdSrR)r.r0rr>r=s r ruzNFAState.addarcVs$ %'''''r rR)rr r r!rur r r rrQs7((((((r rc*eZdZdZdZdZdZdZdS)rrc4||_||v|_i|_dSrR)rsr3r.)rrsfinals r r!zDFAState.__init__]s!   r c||j|<dSrRrqrs r ruzDFAState.addarces  %r c`|jD]\}}||ur ||j|<dSrR)r.r/)roldnewr=r>s r rzDFAState.unifystateksA9??,, ' 'KE4s{{#& %  ' 'r c|j|jkrdSt|jt|jkrdS|jD]$\}}||j|urdS%dS)NFT)r3r*r.r/get)rotherr=r>s r __eq__zDFAState.__eq__ps <5= ( (5 ty>>S__ , ,59??,,  KE45:>>%0000uu1tr N)rr r r!rurr__hash__r r r rrrr[sQ   '''   HHHr rr Grammar.txtcHt|}|SrR)rr?)rps r generate_grammarrs!!A >>  r N)r) r|rrrGrammarrobjectrrrrrr r r rs '&&&&&&&&&     '/   E9E9E9E9E9fE9E9E9N (((((v(((#####v###Jr PKH13]|"|"(pgen2/__pycache__/driver.cpython-311.pycnu[ !A?hQdZdZddgZddlZddlZddlZddlZddlZddlm Z m Z m Z m Z m Z GddeZd Z dd ZdZdZdZedkr$ejee dSdS)zZParser driver. This provides a high-level interface to parse a file into a syntax tree. z#Guido van Rossum Driver load_grammarN)grammarparsetokentokenizepgenc>eZdZd dZd dZd dZd dZd dZd dZdS) rNcZ||_|tj}||_||_dS)N)rlogging getLoggerloggerconvert)selfrrrs A/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/driver.py__init__zDriver.__init__s. >&((F  FcXtj|j|j}|d}d}dx}x}x}x} } d} |D]D} | \}}}} } |||fkrE||f|ksJ||f|f|\} }|| kr| d| |z zz } | }d}||kr| | ||z } |}|t jt jfvr'| |z } | \}}|dr|dz }d}|tj krtj |}|r-|j dtj||| |||| |fr|r|j dn>d} | \}}|dr|dz }d}Ftjd||| |f|jS) z4Parse a series of tokens and return the syntax tree.rrN z%s %r (prefix=%r)zStop.zincomplete input)rParserrrsetupr COMMENTNLendswithrOPopmaprdebugtok_nameaddtoken ParseErrorrootnode)rtokensrplinenocolumntypevaluestartend line_textprefix quintuples_linenos_columns r parse_tokenszDriver.parse_tokens&s9 Lt| 4 4  1555u5u5sY$ A$ AI1: .D%Y((('5000FF3CU2K000%*"(H$$dh&788F%FFH$$ix88F%F((+666%!$>>$''aKFFux}U+ G !!"5"'."6vGGGzz$77 /K%%g...F NFF~~d## ! "#5#'AA Azrc`tj|j}|||Sz*Parse a stream and return the syntax tree.)r generate_tokensreadliner1)rstreamrr$s rparse_stream_rawzDriver.parse_stream_rawVs*)&/::  ///rc.|||Sr3)r7)rr6rs r parse_streamzDriver.parse_stream[s$$VU333rctj|d|5}|||cdddS#1swxYwYdS)z(Parse a file and return the syntax tree.r)encodingN)ioopenr9)rfilenamer<rr6s r parse_filezDriver.parse_file_s WXsX 6 6 6 4&$$VU33 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4s ;??ctjtj|j}|||S)z*Parse a string and return the syntax tree.)r r4r=StringIOr5r1)rtextrr$s r parse_stringzDriver.parse_stringds5)"+d*;*;*DEE  ///r)NN)F)NF) __name__ __module__ __qualname__rr1r7r9r@rDrrrrs....`0000 44444444 000000rctj|\}}|dkrd}||zdt t t jzdzS)Nz.txtr.z.pickle)ospathsplitextjoinmapstrsys version_info)gtheadtails r_generate_pickle_namerVjsV!!"%%JD$ v~~ $;#c3+;"<"<== = IIr Grammar.txtTFc|tj}|t|n|}|st||s|d|t j|}|rZ|d| ||nV#t$r }|d|Yd}~n1d}~wwxYwn(tj }| ||S)z'Load the grammar (maybe from a pickle).Nz!Generating grammar tables from %szWriting grammar tables to %szWriting failed: %s) r rrV_newerinfor generate_grammardumpOSErrorrGrammarload)rSgpsaveforcerges rrrqs~"$$&(j r " " "bB F2rNN  7<<<  !" % %  5 KK6 ; ; ; 5r  5 5 5 0!44444444 5  5 O   r Hs>B B>B99B>ctj|sdStj|sdStj|tj|kS)z0Inquire whether file a was written since file b.FT)rKrLexistsgetmtime)abs rrYrYsc 7>>!  u 7>>!  t 7  A  "'"2"21"5"5 55rc4tj|rt|St tj|}t j||}tj }| ||S)aNormally, loads a pickled grammar by doing pkgutil.get_data(package, pickled_grammar) where *pickled_grammar* is computed from *grammar_source* by adding the Python version and using a ``.pickle`` extension. However, if *grammar_source* is an extant file, load_grammar(grammar_source) is called instead. This facilitates using a packaged grammar file when needed but preserves load_grammar's automatic regeneration behavior when possible. ) rKrLisfilerrVbasenamepkgutilget_datarr^loads)packagegrammar_source pickled_namedatarcs rload_packaged_grammarrtsx w~~n%%,N+++()9)9.)I)IJJL  G\ 2 2DAGGDMMM Hrc|stjdd}tjtjtjd|D]}t |dddS)zMain program, when run as a script: produce grammar pickle files. Calls load_grammar for each argument, a path to a grammar text file. rNz %(message)s)levelr6formatT)rarb)rQargvr basicConfigINFOstdoutr)argsrSs rmainr}sl x| gl3:,....00Rd$///// 4r__main__)rWNTFN)__doc__ __author____all__r=rKr rmrQrrrrr r objectrrVrrYrtr}rEexitintrHrrrsF 3 ^ $  43333333333333J0J0J0J0J0VJ0J0J0ZJJJ'+04    *666   (    z CHSSTTVV__rPKH13]\#\#'pgen2/__pycache__/parse.cpython-311.pycnu[ !A?hNdZddlmZGddeZGddeZdS)zParser engine for the grammar tables generated by pgen. The grammar table must be loaded first. See Parser/parser.c in the Python distribution for additional info on how this parsing engine works. )tokenceZdZdZdZdZdS) ParseErrorz(Exception to signal the parser is stuck.c t||d|d|d|||_||_||_||_dS)Nz: type=z, value=z , context=) Exception__init__msgtypevaluecontext)selfr r r r s @/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/parse.pyrzParseError.__init__sX4CCuuugg"7 8 8 8   cTt||j|j|j|jffSN)r r r r )r s r __reduce__zParseError.__reduce__s$DzzDHdiT\JJJrN)__name__ __module__ __qualname____doc__rrrrrrs=22KKKKKrrc@eZdZdZd dZd dZdZdZdZdZ d Z dS) Parsera5Parser engine. The proper usage sequence is: p = Parser(grammar, [converter]) # create instance p.setup([start]) # prepare for parsing : if p.addtoken(...): # parse a token; may raise ParseError break root = p.rootnode # root of abstract syntax tree A Parser instance may be reused by calling setup() repeatedly. A Parser instance contains state pertaining to the current token sequence, and should not be used concurrently by different threads to parse separate token sequences. See driver.py for how to get input tokens by tokenizing a file or string. Parsing is complete when addtoken() returns True; the root of the abstract syntax tree can then be retrieved from the rootnode instance variable. When a syntax error occurs, addtoken() raises the ParseError exception. There is no error recovery; the parser cannot be used after a syntax error was reported (but it can be reinitialized by calling setup()). Nc(||_|pd|_dS)aConstructor. The grammar argument is a grammar.Grammar instance; see the grammar module for more information. The parser is not ready yet for parsing; you must call the setup() method to get it started. The optional convert argument is a function mapping concrete syntax tree nodes to abstract syntax tree nodes. If not given, no conversion is done and the syntax tree produced is the concrete syntax tree. If given, it must be a function of two arguments, the first being the grammar (a grammar.Grammar instance), and the second being the concrete syntax tree node to be converted. The syntax tree is converted from the bottom up. A concrete syntax tree node is a (type, value, context, nodes) tuple, where type is the node type (a token or symbol number), value is None for symbols and a string for tokens, context is None or an opaque value used for error reporting (typically a (lineno, offset) pair), and nodes is a list of children for symbols, and None for tokens. An abstract syntax tree node may be anything; this is entirely up to the converter function. c|Srr)grammarnodes rz!Parser.__init__..ZsrN)rconvert)r rrs rrzParser.__init__<s: >#=#= rc| |jj}|ddgf}|jj|d|f}|g|_d|_t |_dS)aPrepare for parsing. This *must* be called before starting to parse. The optional argument is an alternative start symbol; it defaults to the grammar's start symbol. You can use a Parser instance to parse any number of programs; each time you call setup() the parser is reset to an initial state determined by the (implicit or explicit) start symbol. N)rstartdfasstackrootnodeset used_names)r r"newnode stackentrys rsetupz Parser.setup\sX =L&E$b)l'.7;  \  %%rc||||} |jd\}}}|\}} ||} | D]\} } |jj| \} }|| krw| dksJ|||| || }||d|fgkrC||jsdS|jd\}}}|\}} ||d|fgkCdS| dkrE|jj| }|\}}||vr*|| |jj| | |nGd|f| vr.||jstd|||ntd|||K)z>>$E -QJ<77 #z(#'44+/:b>(UD(+  !-QJ<77!55#XX!\.q1F*0'Ix)) !T\%6q%98WMMMu:%%HHJJJ:?()9)-ug???? %[$wGGGS) Hrc|tjkr=|j||jj|}||S|jj|}|td||||S)z&Turn a token into a label. (Internal)Nz bad token) rNAMEr'addrkeywordsgettokensr)r r r r r3s rr.zParser.classifys~ 5:   O   & & &\*..u55F! $((.. >[$w?? ? rc|jd\}}}|||df}||j|}||d||||f|jd<dS)zShift a token. (Internal)r,N)r$rrappend) r r r r:r r4r5rr(s rr0z Parser.shiftsi:b>UD.,,t|W55   HOOG $ $ $x. 2rc|jd\}}}|d|gf}|||f|jd<|j|d|fdS)zPush a nonterminal. (Internal)r,Nr!)r$rH) r r newdfar:r r4r5rr(s rr2z Parser.pushsW:b>UDw+x. 2 61g./////rc|j\}}}||j|}|O|jr.|jd\}}}|d|dS||_|j|j_dSdS)zPop a nonterminal. (Internal)Nr,)r$r1rrrHr%r')r popdfapopstatepopnoder(r4r5rs rr1z Parser.pops$(JNN$4$4!',,t|W55  z ;#':b> UDR((((( ' +/? (((  rr) rrrrrr*r@r.r0r2r1rrrrrs:????@    0.H.H.H`   ///000 ; ; ; ; ;rrN)rrrrobjectrrrrrQs K K K K K K K Kn;n;n;n;n;Vn;n;n;n;n;rPKH13])pgen2/__pycache__/grammar.cpython-311.pycnu[ !A?hdZddlZddlmZGddeZdZiZeD]*Z e r&e \Z Z e ee ee <+[ [ [ dS)aThis module defines the data structures used to represent a grammar. These are a bit arcane because they are derived from the data structures used by Python's 'pgen' parser generator. There's also a table here mapping operators to their names in the token module; the Python tokenize module reports all operators as the fallback token code OP, but the parser needs the actual token code. N)tokenc6eZdZdZdZdZdZdZdZdZ dS) Grammara Pgen parsing tables conversion class. Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine accesses the instance variables directly. The class here does not provide initialization of the tables; several subclasses exist to do this (see the conv and pgen modules). The load() method reads the tables from a pickle file, which is much faster than the other ways offered by subclasses. The pickle file is written by calling dump() (after loading the grammar tables using a subclass). The report() method prints a readable representation of the tables to stdout, for debugging. The instance variables are as follows: symbol2number -- a dict mapping symbol names to numbers. Symbol numbers are always 256 or higher, to distinguish them from token numbers, which are between 0 and 255 (inclusive). number2symbol -- a dict mapping numbers to symbol names; these two are each other's inverse. states -- a list of DFAs, where each DFA is a list of states, each state is a list of arcs, and each arc is a (i, j) pair where i is a label and j is a state number. The DFA number is the index into this list. (This name is slightly confusing.) Final states are represented by a special arc of the form (0, j) where j is its own state number. dfas -- a dict mapping symbol numbers to (DFA, first) pairs, where DFA is an item from the states list above, and first is a set of tokens that can begin this grammar rule (represented by a dict whose values are always 1). labels -- a list of (x, y) pairs where x is either a token number or a symbol number, and y is either None or a string; the strings are keywords. The label number is the index in this list; label numbers are used to mark state transitions (arcs) in the DFAs. start -- the number of the grammar's start symbol. keywords -- a dict mapping keyword strings to arc labels. tokens -- a dict mapping token numbers to arc labels. ci|_i|_g|_i|_dg|_i|_i|_i|_d|_dS)N)rEMPTY) symbol2number number2symbolstatesdfaslabelskeywordstokens symbol2labelstart)selfs B/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/grammar.py__init__zGrammar.__init__LsJ  #n    ct|d5}tj|j|tjddddS#1swxYwYdS)z)Dump the grammar tables to a pickle file.wbN)openpickledump__dict__HIGHEST_PROTOCOL)rfilenamefs rrz Grammar.dumpWs (D ! ! CQ K q&*A B B B C C C C C C C C C C C C C C C C C Cs&AA Act|d5}tj|}dddn #1swxYwY|j|dS)z+Load the grammar tables from a pickle file.rbN)rrloadrupdate)rrrds rr"z Grammar.load\s (D ! ! Q AA                Qs 266c^|jtj|dS)z3Load the grammar tables from a pickle bytes object.N)rr#rloads)rpkls rr&z Grammar.loadsbs( V\#../////rc |}dD]3}t||t||4|jdd|_|jdd|_|j|_|S)z# Copy the grammar. )r r r rrrN) __class__setattrgetattrcopyrr r)rnew dict_attrs rr,z Grammar.copyfsnn4 E EI CGD)$<$<$A$A$C$C D D D D[^ [^ J  rcrddlm}td||jtd||jtd||jtd||jtd||jtd|jd S) z:Dump the grammar tables to standard output, for debugging.r)pprints2nn2sr r rrN)r0printr r r r rr)rr0s rreportzGrammar.reportss!!!!!! e t!""" e t!""" ht{ f ty ht{ gtz"""""rN) __name__ __module__ __qualname____doc__rrr"r&r,r4rrrrs|33j   CCC    000    # # # # #rra ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW := COLONEQUAL )r8rrobjectr opmap_rawopmap splitlineslinesplitopnamer+r9rrrCs   j#j#j#j#j#fj#j#j#^1  f   " "))D )::<<DGE4((b "dddrPKH13]TmA#A#-pgen2/__pycache__/parse.cpython-311.opt-1.pycnu[ !A?hNdZddlmZGddeZGddeZdS)zParser engine for the grammar tables generated by pgen. The grammar table must be loaded first. See Parser/parser.c in the Python distribution for additional info on how this parsing engine works. )tokenceZdZdZdZdZdS) ParseErrorz(Exception to signal the parser is stuck.c t||d|d|d|||_||_||_||_dS)Nz: type=z, value=z , context=) Exception__init__msgtypevaluecontext)selfr r r r s @/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/parse.pyrzParseError.__init__sX4CCuuugg"7 8 8 8   cTt||j|j|j|jffSN)r r r r )r s r __reduce__zParseError.__reduce__s$DzzDHdiT\JJJrN)__name__ __module__ __qualname____doc__rrrrrrs=22KKKKKrrc@eZdZdZd dZd dZdZdZdZdZ d Z dS) Parsera5Parser engine. The proper usage sequence is: p = Parser(grammar, [converter]) # create instance p.setup([start]) # prepare for parsing : if p.addtoken(...): # parse a token; may raise ParseError break root = p.rootnode # root of abstract syntax tree A Parser instance may be reused by calling setup() repeatedly. A Parser instance contains state pertaining to the current token sequence, and should not be used concurrently by different threads to parse separate token sequences. See driver.py for how to get input tokens by tokenizing a file or string. Parsing is complete when addtoken() returns True; the root of the abstract syntax tree can then be retrieved from the rootnode instance variable. When a syntax error occurs, addtoken() raises the ParseError exception. There is no error recovery; the parser cannot be used after a syntax error was reported (but it can be reinitialized by calling setup()). Nc(||_|pd|_dS)aConstructor. The grammar argument is a grammar.Grammar instance; see the grammar module for more information. The parser is not ready yet for parsing; you must call the setup() method to get it started. The optional convert argument is a function mapping concrete syntax tree nodes to abstract syntax tree nodes. If not given, no conversion is done and the syntax tree produced is the concrete syntax tree. If given, it must be a function of two arguments, the first being the grammar (a grammar.Grammar instance), and the second being the concrete syntax tree node to be converted. The syntax tree is converted from the bottom up. A concrete syntax tree node is a (type, value, context, nodes) tuple, where type is the node type (a token or symbol number), value is None for symbols and a string for tokens, context is None or an opaque value used for error reporting (typically a (lineno, offset) pair), and nodes is a list of children for symbols, and None for tokens. An abstract syntax tree node may be anything; this is entirely up to the converter function. c|Srr)grammarnodes rz!Parser.__init__..ZsrN)rconvert)r rrs rrzParser.__init__<s: >#=#= rc| |jj}|ddgf}|jj|d|f}|g|_d|_t |_dS)aPrepare for parsing. This *must* be called before starting to parse. The optional argument is an alternative start symbol; it defaults to the grammar's start symbol. You can use a Parser instance to parse any number of programs; each time you call setup() the parser is reset to an initial state determined by the (implicit or explicit) start symbol. N)rstartdfasstackrootnodeset used_names)r r"newnode stackentrys rsetupz Parser.setup\sX =L&E$b)l'.7;  \  %%rc||||} |jd\}}}|\}} ||} | D]\} } |jj| \} }|| kro|||| || }||d|fgkrC||jsdS|jd\}}}|\}} ||d|fgkCdS| dkrE|jj| }|\}}||vr*|| |jj| | |nGd|f| vr.||jstd|||ntd|||C)z>>$E -QJ<77 #z(#'44+/:b>(UD(+  !-QJ<77!55#XX!\.q1F*0'Ix)) !T\%6q%98WMMMu:%%HHJJJ:?()9)-ug???? %[$wGGGS) Hrc|tjkr=|j||jj|}||S|jj|}|td||||S)z&Turn a token into a label. (Internal)Nz bad token) rNAMEr'addrkeywordsgettokensr)r r r r r3s rr.zParser.classifys~ 5:   O   & & &\*..u55F! $((.. >[$w?? ? rc|jd\}}}|||df}||j|}||d||||f|jd<dS)zShift a token. (Internal)r,N)r$rrappend) r r r r:r r4r5rr(s rr0z Parser.shiftsi:b>UD.,,t|W55   HOOG $ $ $x. 2rc|jd\}}}|d|gf}|||f|jd<|j|d|fdS)zPush a nonterminal. (Internal)r,Nr!)r$rH) r r newdfar:r r4r5rr(s rr2z Parser.pushsW:b>UDw+x. 2 61g./////rc|j\}}}||j|}|O|jr.|jd\}}}|d|dS||_|j|j_dSdS)zPop a nonterminal. (Internal)Nr,)r$r1rrrHr%r')r popdfapopstatepopnoder(r4r5rs rr1z Parser.pops$(JNN$4$4!',,t|W55  z ;#':b> UDR((((( ' +/? (((  rr) rrrrrr*r@r.r0r2r1rrrrrs:????@    0.H.H.H`   ///000 ; ; ; ; ;rrN)rrrrobjectrrrrrQs K K K K K K K Kn;n;n;n;n;Vn;n;n;n;n;rPKH13]BqQ Q 'pgen2/__pycache__/token.cpython-311.pycnu[ !A?h)dZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;dZ>iZ?e@eABD] \ZCZDeEeDeEdureCe?eD<!d?ZFd@ZGdAZHdBS)Cz!Token constants (from "token.h").  !"#$%&'()*+,-./0123456789:;<c|tkSN NT_OFFSETxs @/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/token.py ISTERMINALrGOs y=c|tkSrArBrDs rF ISNONTERMINALrJR >rHc|tkSrA) ENDMARKERrDs rFISEOFrNUrKrHN)I__doc__rMNAMENUMBERSTRINGNEWLINEINDENTDEDENTLPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENT BACKQUOTELBRACERBRACEEQEQUALNOTEQUAL LESSEQUAL GREATEREQUALTILDE CIRCUMFLEX LEFTSHIFT RIGHTSHIFT DOUBLESTAR PLUSEQUALMINEQUAL STAREQUAL SLASHEQUAL PERCENTEQUAL AMPEREQUAL VBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUAL DOUBLESLASHDOUBLESLASHEQUALATATEQUALOPCOMMENTNLRARROWAWAITASYNC ERRORTOKEN COLONEQUALN_TOKENSrCtok_namelistglobalsitems_name_valuetyperGrJrNrHrFrs('                                                      T''))//++,,!!ME6 tF||ttAww rHPKH13]b("(".pgen2/__pycache__/driver.cpython-311.opt-1.pycnu[ !A?hQdZdZddgZddlZddlZddlZddlZddlZddlm Z m Z m Z m Z m Z GddeZd Z dd ZdZdZdZedkr$ejee dSdS)zZParser driver. This provides a high-level interface to parse a file into a syntax tree. z#Guido van Rossum Driver load_grammarN)grammarparsetokentokenizepgenc>eZdZd dZd dZd dZd dZd dZd dZdS) rNcZ||_|tj}||_||_dS)N)rlogging getLoggerloggerconvert)selfrrrs A/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/driver.py__init__zDriver.__init__s. >&((F  Fc,tj|j|j}|d}d}dx}x}x}x} } d} |D].} | \}}}} } |||fkr/|\} }|| kr| d| |z zz } | }d}||kr| | ||z } |}|t jt jfvr'| |z } | \}}|dr|dz }d}|tj krtj |}|r-|j dtj||| |||| |fr|r|j dn>d} | \}}|dr|dz }d}0tjd||| |f|jS) z4Parse a series of tokens and return the syntax tree.rrN z%s %r (prefix=%r)zStop.zincomplete input)rParserrrsetupr COMMENTNLendswithrOPopmaprdebugtok_nameaddtoken ParseErrorrootnode)rtokensrplinenocolumntypevaluestartend line_textprefix quintuples_linenos_columns r parse_tokenszDriver.parse_tokens&s Lt| 4 4  1555u5u5sY$ A$ AI1: .D%Y(((%*"(H$$dh&788F%FFH$$ix88F%F((+666%!$>>$''aKFFux}U+ G !!"5"'."6vGGGzz$77 /K%%g...F NFF~~d## ! "#5#'AA Azrc`tj|j}|||Sz*Parse a stream and return the syntax tree.)r generate_tokensreadliner1)rstreamrr$s rparse_stream_rawzDriver.parse_stream_rawVs*)&/::  ///rc.|||Sr3)r7)rr6rs r parse_streamzDriver.parse_stream[s$$VU333rctj|d|5}|||cdddS#1swxYwYdS)z(Parse a file and return the syntax tree.r)encodingN)ioopenr9)rfilenamer<rr6s r parse_filezDriver.parse_file_s WXsX 6 6 6 4&$$VU33 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4s ;??ctjtj|j}|||S)z*Parse a string and return the syntax tree.)r r4r=StringIOr5r1)rtextrr$s r parse_stringzDriver.parse_stringds5)"+d*;*;*DEE  ///r)NN)F)NF) __name__ __module__ __qualname__rr1r7r9r@rDrrrrs....`0000 44444444 000000rctj|\}}|dkrd}||zdt t t jzdzS)Nz.txtr.z.pickle)ospathsplitextjoinmapstrsys version_info)gtheadtails r_generate_pickle_namerVjsV!!"%%JD$ v~~ $;#c3+;"<"<== = IIr Grammar.txtTFc|tj}|t|n|}|st||s|d|t j|}|rZ|d| ||nV#t$r }|d|Yd}~n1d}~wwxYwn(tj }| ||S)z'Load the grammar (maybe from a pickle).Nz!Generating grammar tables from %szWriting grammar tables to %szWriting failed: %s) r rrV_newerinfor generate_grammardumpOSErrorrGrammarload)rSgpsaveforcerges rrrqs~"$$&(j r " " "bB F2rNN  7<<<  !" % %  5 KK6 ; ; ; 5r  5 5 5 0!44444444 5  5 O   r Hs>B B>B99B>ctj|sdStj|sdStj|tj|kS)z0Inquire whether file a was written since file b.FT)rKrLexistsgetmtime)abs rrYrYsc 7>>!  u 7>>!  t 7  A  "'"2"21"5"5 55rc4tj|rt|St tj|}t j||}tj }| ||S)aNormally, loads a pickled grammar by doing pkgutil.get_data(package, pickled_grammar) where *pickled_grammar* is computed from *grammar_source* by adding the Python version and using a ``.pickle`` extension. However, if *grammar_source* is an extant file, load_grammar(grammar_source) is called instead. This facilitates using a packaged grammar file when needed but preserves load_grammar's automatic regeneration behavior when possible. ) rKrLisfilerrVbasenamepkgutilget_datarr^loads)packagegrammar_source pickled_namedatarcs rload_packaged_grammarrtsx w~~n%%,N+++()9)9.)I)IJJL  G\ 2 2DAGGDMMM Hrc|stjdd}tjtjtjd|D]}t |dddS)zMain program, when run as a script: produce grammar pickle files. Calls load_grammar for each argument, a path to a grammar text file. rNz %(message)s)levelr6formatT)rarb)rQargvr basicConfigINFOstdoutr)argsrSs rmainr}sl x| gl3:,....00Rd$///// 4r__main__)rWNTFN)__doc__ __author____all__r=rKr rmrQrrrrr r objectrrVrrYrtr}rEexitintrHrrrsF 3 ^ $  43333333333333J0J0J0J0J0VJ0J0J0ZJJJ'+04    *666   (    z CHSSTTVV__rPKH13]9 0pgen2/__pycache__/literals.cpython-311.opt-1.pycnu[ !A?hc bdZddlZddddddd d d d d ZdZdZdZedkr edSdS)z>ADHII I TE2AA T T TADHIIt S T VD! AA V V VCdJKKQU U V q66Ms=BB,0CCc|d}|dd|dzkr|dz}|t|t| }tjdt|S)Nrz)\\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3}))rresubr))sqs r( evalStringr0(s\ !A!u!|| aC #a&&#a&&.A 6> J JJctdD]G}t|}t|}t|}||krt ||||HdS)N)ranger!reprr0print)r'cr.es r(testr92s` 3ZZ FF GG qMM 66 !Q1    r1__main__)__doc__r,rr)r0r9__name__r1r(r>sCB   *KKK zDFFFFFr1PKH13]BqQ Q -pgen2/__pycache__/token.cpython-311.opt-1.pycnu[ !A?h)dZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;dZ>iZ?e@eABD] \ZCZDeEeDeEdureCe?eD<!d?ZFd@ZGdAZHdBS)Cz!Token constants (from "token.h").  !"#$%&'()*+,-./0123456789:;<c|tkSN NT_OFFSETxs @/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/token.py ISTERMINALrGOs y=c|tkSrArBrDs rF ISNONTERMINALrJR >rHc|tkSrA) ENDMARKERrDs rFISEOFrNUrKrHN)I__doc__rMNAMENUMBERSTRINGNEWLINEINDENTDEDENTLPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENT BACKQUOTELBRACERBRACEEQEQUALNOTEQUAL LESSEQUAL GREATEREQUALTILDE CIRCUMFLEX LEFTSHIFT RIGHTSHIFT DOUBLESTAR PLUSEQUALMINEQUAL STAREQUAL SLASHEQUAL PERCENTEQUAL AMPEREQUAL VBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUAL DOUBLESLASHDOUBLESLASHEQUALATATEQUALOPCOMMENTNLRARROWAWAITASYNC ERRORTOKEN COLONEQUALN_TOKENSrCtok_namelistglobalsitems_name_valuetyperGrJrNrHrFrs('                                                      T''))//++,,!!ME6 tF||ttAww rHPKH13]x-pgen2/__pycache__/parse.cpython-311.opt-2.pycnu[ !A?hL ddlmZGddeZGddeZdS))tokenceZdZ dZdZdS) ParseErrorc t||d|d|d|||_||_||_||_dS)Nz: type=z, value=z , context=) Exception__init__msgtypevaluecontext)selfr r r r s @/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/parse.pyrzParseError.__init__sX4CCuuugg"7 8 8 8   cTt||j|j|j|jffSN)r r r r )r s r __reduce__zParseError.__reduce__s$DzzDHdiT\JJJrN)__name__ __module__ __qualname__rrrrrrs:2KKKKKrrc>eZdZ d dZd dZdZdZdZdZdZ dS) ParserNc* ||_|pd|_dS)Nc|Srr)grammarnodes rz!Parser.__init__..Zsr)rconvert)r rrs rrzParser.__init__<s$ 8 >#=#= rc | |jj}|ddgf}|jj|d|f}|g|_d|_t |_dS)N)rstartdfasstackrootnodeset used_names)r r!newnode stackentrys rsetupz Parser.setup\s]  =L&E$b)l'.7;  \  %%rc ||||} |jd\}}}|\}} ||} | D]\} } |jj| \} }|| kro|||| || }||d|fgkrC||jsdS|jd\}}}|\}} ||d|fgkCdS| dkrE|jj| }|\}}||vr*|| |jj| | |nGd|f| vr.||jstd|||ntd|||C)NTr Fztoo much inputz bad input) classifyr#rlabelsshiftpopr"pushr)r r r r ilabeldfastaterstatesfirstarcsinewstatetvitsdfa itsstatesitsfirsts raddtokenzParser.addtokentsJtUG44) H#z"~ CMFE%=D#$ H$ H 8|*1-1Q;;JJtUHg>>>$E -QJ<77 #z(#'44+/:b>(UD(+  !-QJ<77!55#XX!\.q1F*0'Ix)) !T\%6q%98WMMMu:%%HHJJJ:?()9)-ug???? %[$wGGGS) Hrc |tjkr=|j||jj|}||S|jj|}|td||||S)Nz bad token) rNAMEr&addrkeywordsgettokensr)r r r r r2s rr-zParser.classifys4 5:   O   & & &\*..u55F! $((.. >[$w?? ? rc |jd\}}}|||df}||j|}||d||||f|jd<dSNr+)r#rrappend) r r r r9r r3r4rr's rr/z Parser.shiftsl(:b>UD.,,t|W55   HOOG $ $ $x. 2rc |jd\}}}|d|gf}|||f|jd<|j|d|fdS)Nr+r )r#rH) r r newdfar9r r3r4rr's rr1z Parser.pushsZ-:b>UDw+x. 2 61g./////rc |j\}}}||j|}|O|jr.|jd\}}}|d|dS||_|j|j_dSdSrG)r#r0rrrHr$r&)r popdfapopstatepopnoder'r3r4rs rr0z Parser.pops,$(JNN$4$4!',,t|W55  z ;#':b> UDR((((( ' +/? (((  rr) rrrrr)r?r-r/r1r0rrrrrs:????@    0.H.H.H`   ///000 ; ; ; ; ;rrN)rrrobjectrrrrrQs K K K K K K K Kn;n;n;n;n;Vn;n;n;n;n;rPKH13]q]]0pgen2/__pycache__/tokenize.cpython-311.opt-1.pycnu[ !A?hR PdZdZdZddlZddlZddlmZmZddlTddl m Z d e e Dgd zZ [ e n #e$reZ YnwxYwd Zd Zd ZdZdZdZeedezzeezZdZdZdZdZeddZeeeeeZdZeddeezZdezZeeeZ ede dzZ!ee!e eZ"dZ#dZ$d Z%d!Z&d"Z'ee'd#ze'd$zZ(ee'd%ze'd&zZ)ed'd(d)d*d+d,d-d.d/ Z*d0Z+ed1d2d3Z,ee*e+e,Z-ee"e-e)eZ.ee.zZ/ee'd4zed5dze'd6zed7dzZ0edee(Z1eee1e"e-e0ezZ2e3ej4e/e2e%e&f\Z5Z6Z7Z8ed8d9d:d;ed8d9dzZ9ej4e#ej4e$e7e8d?d@e9DdAe9DdBe9DZ:d#d$hdCe9DzdDe9DzZ;d5d7hdEe9DzdFe9DzZZ?GdJdKe>Z@dLZAeAfdMZBdNZCGdOdPZDej4dQejEZFej4dRejEZGdSZHdTZIdUZJdVZKeLdWkrUddlMZMeNeMjOdkr&eBePeMjOdjQdSeBeMjRjQdSdS)XaTokenization help for Python programs. generate_tokens(readline) is a generator that breaks a stream of text into Python tokens. It accepts a readline-like method which is called repeatedly to get the next line of input (or "" for EOF). It generates 5-tuples with these members: the token type (see token.py) the token (a string) the starting (row, column) indices of the token (a 2-tuple of ints) the ending (row, column) indices of the token (a 2-tuple of ints) the original line (string) It is designed to match the working of the Python tokenizer exactly, except that it produces COMMENT tokens for comments and gives type OP for all operators Older entry points tokenize_loop(readline, tokeneater) tokenize(readline, tokeneater=printtoken) are the same, except instead of generating tokens, tokeneater is a callback function to which the 5 fields described above are passed as 5 arguments, each time a new token is found.zKa-Ping Yee z@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip MontanaroN)BOM_UTF8lookup)*)tokenc*g|]}|ddk|S)r_).0xs C/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/tokenize.py r%s! 0 0 0AaDCKK1KKK)tokenizegenerate_tokens untokenizec8dd|zdzS)N(|))joinchoicess r groupr0sC#((7"3"33c99rct|dzS)Nrrrs r anyr1s%/C//rct|dzS)N?rrs r mayber 2sE7Oc11rc:tfdDS)Nc3K|];}dzD]3}||k,||zV4z _combinations..4s`!e)qzz||qzz||/K/KA/K/K/K/K/Kr)set)r&s`r _combinationsr)3s;   rz[ \f\t]*z #[^\r\n]*z\\\r?\nz\w+z0[bB]_?[01]+(?:_[01]+)*z(0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?z0[oO]?_?[0-7]+(?:_[0-7]+)*[lL]?z[1-9]\d*(?:_\d+)*[lL]?z0[lL]?z[eE][-+]?\d+(?:_\d+)*z\d+(?:_\d+)*\.(?:\d+(?:_\d+)*)?z\.\d+(?:_\d+)*z \d+(?:_\d+)*z\d+(?:_\d+)*[jJ]z[jJ]z[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'(?:[uUrRbBfF]|[rR][fFbB]|[fFbBuU][rR])?'''"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z<>z!=z//=?z->z[+\-*/%&@|^=<>]=?~z[][(){}]z\r?\nz:=z[:;.,`@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"rRfFbB>UuURUruRur)r-r.r*r+c$i|] }|dtSr*) single3progr prefixs r r@y FFFv&~~~{FFFrc$i|] }|dtSr+) double3progr>s r r@r@zrArci|]}|dSNr r>s r r@r@{s777vt777rch|]}|dSr<r r>s r rH///^^^///rch|]}|dSrCr r>s r rHrHrIrch|]}|dS)r-r r>s r rHrH---f\\\---rch|]}|dS)r.r r>s r rHrHrLrceZdZdS) TokenErrorN__name__ __module__ __qualname__r rr rPrPrrPceZdZdS)StopTokenizingNrQr rr rWrWrUrrWc z|\}}|\}}td||||t|t|fzdS)Nz%d,%d-%d,%d: %s %s)printtok_namerepr) typerxxx_todo_changemexxx_todo_changeme1linesrowscolerowecols r printtokenrdsR$LT4%LT4 tT4$e= >?????rcJ t||dS#t$rYdSwxYw)a: The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. The second parameter, tokeneater, must also be a callable object. It is called once for each token, with five arguments, corresponding to the tuples generated by generate_tokens(). N) tokenize_looprW)readline tokeneaters r rrs? h +++++      s  ""c4t|D]}||dSrF)r)rgrh token_infos r rfrfs3%h//   J  rc&eZdZdZdZdZdZdS) Untokenizerc0g|_d|_d|_dS)Nrr)tokensprev_rowprev_col)selfs r __init__zUntokenizer.__init__s   rcf|\}}||jz }|r|jd|zdSdS)N )rprnappend)rqstartrowcol col_offsets r add_whitespacezUntokenizer.add_whitespacesJS4=(  1 K  sZ/ 0 0 0 0 0 1 1rcp|D]}t|dkr|||nn|\}}}}}|||j||\|_|_|ttfvr|xjdz c_d|_d |jS)Nrrr#) lencompatrzrnrurorpNEWLINENLr)rqiterablettok_typerrvendr_s r rzUntokenizer.untokenizes " "A1vv{{ Ax(((01 -HeUC    & & & K  u % % %+. (DM4=GR=(( " ! wwt{###rcd}g}|jj}|\}}|ttfvr|dz }|tt fvrd}|D]}|dd\}}|ttt tfvr|dz }|tkr||Q|tkr| q|tt fvrd}n|r|r||dd}||dS)NFrtTr|) rnruNAMENUMBERrrASYNCAWAITINDENTDEDENTpop) rqrr startlineindents toks_appendtoknumtokvaltoks r r~zUntokenizer.compats k(  dF^ # # cMF gr] " "I  C !WNFF$u555# v&&&6!! GR=((  "w " GBK(((! K    #  rN)rRrSrTrrrzrr~r rr rlrlsP 111 $ $ $     rrlz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)c|dddd}|dks|drdS|dvs|drd S|S) z(Imitates get_normal_name in tokenizer.c.N r -utf-8zutf-8-)zlatin-1 iso-8859-1z iso-latin-1)zlatin-1-z iso-8859-1-z iso-latin-1-r)lowerreplace startswith)orig_encencs r _get_normal_namersv 3B3-     ' 'S 1 1C g~~11~w 666 ~~ABB7| OrcLdd}d}fd}fd}|}|trd|dd}d}|s|gfS||}|r||gfSt|s||gfS|}|s||gfS||}|r|||gfS|||gfS) a The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. FNrcV S#t$rtcYSwxYwrF) StopIterationbytes)rgsr read_or_stopz%detect_encoding..read_or_stops< 8::    77NNN s ((c| |d}n#t$rYdSwxYwt|}|sdSt |d} t |}n #t$rtd|zwxYwr|j dkrtd|dz }|S)Nasciirzunknown encoding: rzencoding problem: utf-8z-sig) decodeUnicodeDecodeError cookie_rematchrrr LookupError SyntaxErrorname)r_ line_stringrencodingcodec bom_founds r find_cookiez$detect_encoding..find_cookie s ++g..KK!   44  ,, 4#EKKNN33 ?8$$EE ? ? ?2X=>> > ?  zW$$!";<<<  Hs ''+A;;BTz utf-8-sig)rrblank_rer)rgrdefaultrrfirstsecondrs` @r detect_encodingrs-$IHG , LNNE !! abb  {{5!!H!%  >>%   \^^F  {6""H)%(( UFO ##rcHt}||S)aTransform tokens back into Python source code. Each element returned by the iterable must be a token sequence with at least two elements, a token number and token value. If only two tokens are passed, the resulting output is poor. Round-trip invariant for full input: Untokenized source will match input source exactly Round-trip invariant for limited input: # Output text will tokenize the back to the input t1 = [tok[:2] for tok in generate_tokens(f.readline)] newcode = untokenize(t1) readline = iter(newcode.splitlines(1)).next t2 = [tok[:2] for tokin generate_tokens(readline)] assert t1 == t2 )rlr)ruts r rr:s$ B == " ""rc# Kdx}x}}d\}}d}dg}d}d} d} d} |} n#t$rd} YnwxYw|dz}dt| }} |r| std||| }|r>|dx} }t || d|z|||f|| zfVd\}}d}nZ|rA| ddd kr3| d dd kr%t || z||t| f|fVd}d}|| z}|| z}|dkr|s| sn d}| |krO| | d kr|dz}n2| | d kr|tzdztz}n| | dkrd}nn | dz} | |kO| |krn|r|Vd}| | dvr| | dkry| | dd}| t|z}t||| f|| t|zf| fVt| |d||f|t| f| fVn>ttf| | dk| | d|| f|t| f| fV0||dkr/| |t| d| |df|| f| fV||dkrT||vrtdd|| | f|dd}| r| |dkrd} d} d} td|| f|| f| fV||dkT| r| r| |dkrd} d} d} n| std|dfd}| |krt| | }|r|d\}}||f||f|} }}| ||| |}}|t"jvs |dkr|dkrt&|||| fVn|dvr,t(}|dkrt}n| rd} |r|Vd}||||| fVnO|dkr|r|Vd}t|||| fVn1|t*vrpt,|}|| | }|r9|d} | || }|r|Vd}t |||| f| fVn||f}| |d}| }n|t.vs"|ddt.vs|ddt.vrk|ddkrG||f}t,|p%t,|dpt,|d}| |dd}}| }nA|r|Vd}t |||| fVn"|r|dvr| r|dkrt2nt4|||| fVt6|||| f}|dkr|s|}/|dvrW|rU|dt6krD|ddkr8|dkr d} |d} t2|d|d|d|dfVd}|r|Vd}|Vnk|d kr|r|Vd}t|||| f| fVd}nJ|d!vr|dz}n |d"vr|dz }|r|Vd}t8|||| fVn t | | || f|| dzf| fV| dz} | |k|r|Vd}|ddD]}td|df|dfdfVt:d|df|dfdfVdS)#a4 The generate_tokens() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. Alternately, readline can be a callable function terminating with StopIteration: readline = open(myfile).next # Example of alternate readline The generator produces 5-tuples with these members: the token type; the token string; a 2-tuple (srow, scol) of ints specifying the row and column where the token begins in the source; a 2-tuple (erow, ecol) of ints specifying the row and column where the token ends in the source; and the line on which the token was found. The line passed is the physical line. r)r#rNFrr#zEOF in multi-line stringz\ z\ rt  z# #z rz3unindent does not match any outer indentation levelz zEOF in multi-line statement.Tr|r )asyncawaitr)defforr\z([{z)]})rr}rPrrSTRING ERRORTOKENtabsizerstripCOMMENTrrurIndentationErrorr pseudoprogspanstringdigitsrr triple_quotedendprogs single_quoted isidentifierrrrOP ENDMARKER)rglnumparenlev continuedcontstrneedcontcontlinerstashed async_defasync_def_indent async_def_nlr_posmaxstrstartendprogendmatchrcolumn comment_tokennl_pos pseudomatchrvsposeposrinitialnewlinerindents r rrOs #$#D#8iGXHcGGIL} 8::DD   DDD axc$iiS J  G !;XFFF}}T**H $LLOO+cwdsd3$ho????$)! d233i611d233i86K6K!7T>#dCII%6BBBB!D.#d? ]]9] F))9##fqjVV#Y$&&&'/A2Ew1N#Y$&&Ag )) czz5  CyG##9##$(J$5$5f$=$=M 3}#5#55F"M #;sS5G5G/G(H$PPPPtFGG} &>D#d))+'"+.M.M! $ #$  K !>q JJJICii$**455Kg (--a00 s#'-$cCd!%eCi$u+wfm++sNNu||!5$d;;;;;&&%G!||"$",'+ '% "&"E4t<<<<<^^'% "&"E4t<<<<<m++&uoG&}}T377H &ll1oo $U3Y"+")MMM&*G%udT3KFFFFF$(%="&uvv,#' --"1"I.."1"I..RyD(($(%=#+G#4$6q8J$6#+E!H#5 ,0L!#'"+")MMM&*G%udD$?????))++,8 222$%,1W,<,<55%#($d#<<<<$dD9C'''"% ..# +$+AJ$$6$6$+AJ'$9$9$~~,0 3:2; 0#('!*#*1:wqz#*1:#////'+G'% "&IIII__'% "&udT3K>>>> !II%''HqL E))hl8'% "&udD$77777!49 #;s1u t====AgSCiii}~ !""+55rD!9tQi44444 b4)dAY 333333s ( 77__main__)S__doc__ __author__ __credits__rrecodecsrrlib2to3.pgen2.tokenr#rdir__all__r NameErrorstrrrr r) WhitespaceCommentIgnoreName Binnumber Hexnumber Octnumber Decnumber IntnumberExponent PointfloatExpfloat Floatnumber ImagnumberNumberSingleDoubleSingle3Double3 _litprefixTripleStringOperatorBracketSpecialFunny PlainTokenTokenContStr PseudoExtras PseudoTokenmapcompile tokenprogrr=rD _strprefixesrrrr ExceptionrPrWrdrrfrlASCIIrrrrrrrRsysr}argvopenrgstdinr rr r$s##0* F ########!!!! 0 0cc%jj 0 0 04,4,4, ,  EE EEE :99///111   cc*z122 2UU7^^ C  & 7 . E+X 6 6 E)Y 9 = = # U57H I IEERZOO [ X %eJ)) U& g(= > > z; 2 2 $ # 2 2 7 zE!:#5 6 6 z;;;; = = 5GWeU%%    %% - - h)) U65&$ / /  % ;;c:&&';;c:&&' ( (uZ&11 55vugtLLL 25#J Wg63838/ :{KM#sC%%M#sC%%&&&&' F##*"*V*<*<{ 9 9FFFFF 9GFFFF 987,777  9 EN//,///0//,///0  #J-- ---.-- ---. !!!!!!!!%%%%%Y%%%??? #-    &   6 6 6 6 6 6 6 6 p BJ@"( K K 2:0"( ; ;   G$G$G$R###*`4`4`4D zJJJ s38}}q((44 #4#4#=>>>>> (39% & & & & &sAA  A PKH13]i^i^*pgen2/__pycache__/tokenize.cpython-311.pycnu[ !A?hR PdZdZdZddlZddlZddlmZmZddlTddl m Z d e e Dgd zZ [ e n #e$reZ YnwxYwd Zd Zd ZdZdZdZeedezzeezZdZdZdZdZeddZeeeeeZdZeddeezZdezZeeeZ ede dzZ!ee!e eZ"dZ#dZ$d Z%d!Z&d"Z'ee'd#ze'd$zZ(ee'd%ze'd&zZ)ed'd(d)d*d+d,d-d.d/ Z*d0Z+ed1d2d3Z,ee*e+e,Z-ee"e-e)eZ.ee.zZ/ee'd4zed5dze'd6zed7dzZ0edee(Z1eee1e"e-e0ezZ2e3ej4e/e2e%e&f\Z5Z6Z7Z8ed8d9d:d;ed8d9dzZ9ej4e#ej4e$e7e8d?d@e9DdAe9DdBe9DZ:d#d$hdCe9DzdDe9DzZ;d5d7hdEe9DzdFe9DzZZ?GdJdKe>Z@dLZAeAfdMZBdNZCGdOdPZDej4dQejEZFej4dRejEZGdSZHdTZIdUZJdVZKeLdWkrUddlMZMeNeMjOdkr&eBePeMjOdjQdSeBeMjRjQdSdS)XaTokenization help for Python programs. generate_tokens(readline) is a generator that breaks a stream of text into Python tokens. It accepts a readline-like method which is called repeatedly to get the next line of input (or "" for EOF). It generates 5-tuples with these members: the token type (see token.py) the token (a string) the starting (row, column) indices of the token (a 2-tuple of ints) the ending (row, column) indices of the token (a 2-tuple of ints) the original line (string) It is designed to match the working of the Python tokenizer exactly, except that it produces COMMENT tokens for comments and gives type OP for all operators Older entry points tokenize_loop(readline, tokeneater) tokenize(readline, tokeneater=printtoken) are the same, except instead of generating tokens, tokeneater is a callback function to which the 5 fields described above are passed as 5 arguments, each time a new token is found.zKa-Ping Yee z@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip MontanaroN)BOM_UTF8lookup)*)tokenc*g|]}|ddk|S)r_).0xs C/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/tokenize.py r%s! 0 0 0AaDCKK1KKK)tokenizegenerate_tokens untokenizec8dd|zdzS)N(|))joinchoicess r groupr0sC#((7"3"33c99rct|dzS)Nrrrs r anyr1s%/C//rct|dzS)N?rrs r mayber 2sE7Oc11rc:tfdDS)Nc3K|];}dzD]3}||k,||zV4z _combinations..4s`!e)qzz||qzz||/K/KA/K/K/K/K/Kr)set)r&s`r _combinationsr)3s;   rz[ \f\t]*z #[^\r\n]*z\\\r?\nz\w+z0[bB]_?[01]+(?:_[01]+)*z(0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?z0[oO]?_?[0-7]+(?:_[0-7]+)*[lL]?z[1-9]\d*(?:_\d+)*[lL]?z0[lL]?z[eE][-+]?\d+(?:_\d+)*z\d+(?:_\d+)*\.(?:\d+(?:_\d+)*)?z\.\d+(?:_\d+)*z \d+(?:_\d+)*z\d+(?:_\d+)*[jJ]z[jJ]z[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'(?:[uUrRbBfF]|[rR][fFbB]|[fFbBuU][rR])?'''"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z<>z!=z//=?z->z[+\-*/%&@|^=<>]=?~z[][(){}]z\r?\nz:=z[:;.,`@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"rRfFbB>UuURUruRur)r-r.r*r+c$i|] }|dtSr*) single3progr prefixs r r@y FFFv&~~~{FFFrc$i|] }|dtSr+) double3progr>s r r@r@zrArci|]}|dSNr r>s r r@r@{s777vt777rch|]}|dSr<r r>s r rH///^^^///rch|]}|dSrCr r>s r rHrHrIrch|]}|dS)r-r r>s r rHrH---f\\\---rch|]}|dS)r.r r>s r rHrHrLrceZdZdS) TokenErrorN__name__ __module__ __qualname__r rr rPrPrrPceZdZdS)StopTokenizingNrQr rr rWrWrUrrWc z|\}}|\}}td||||t|t|fzdS)Nz%d,%d-%d,%d: %s %s)printtok_namerepr) typerxxx_todo_changemexxx_todo_changeme1linesrowscolerowecols r printtokenrdsR$LT4%LT4 tT4$e= >?????rcJ t||dS#t$rYdSwxYw)a: The tokenize() function accepts two parameters: one representing the input stream, and one providing an output mechanism for tokenize(). The first parameter, readline, must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. The second parameter, tokeneater, must also be a callable object. It is called once for each token, with five arguments, corresponding to the tuples generated by generate_tokens(). N) tokenize_looprW)readline tokeneaters r rrs? h +++++      s  ""c4t|D]}||dSrF)r)rgrh token_infos r rfrfs3%h//   J  rc&eZdZdZdZdZdZdS) Untokenizerc0g|_d|_d|_dS)Nrr)tokensprev_rowprev_col)selfs r __init__zUntokenizer.__init__s   rc|\}}||jksJ||jz }|r|jd|zdSdS)N )rorprnappend)rqstartrowcol col_offsets r add_whitespacezUntokenizer.add_whitespaces]Sdm####4=(  1 K  sZ/ 0 0 0 0 0 1 1rcp|D]}t|dkr|||nn|\}}}}}|||j||\|_|_|ttfvr|xjdz c_d|_d |jS)Nrrr#) lencompatrzrnrurorpNEWLINENLr)rqiterablettok_typerrvendr_s r rzUntokenizer.untokenizes " "A1vv{{ Ax(((01 -HeUC    & & & K  u % % %+. (DM4=GR=(( " ! wwt{###rcd}g}|jj}|\}}|ttfvr|dz }|tt fvrd}|D]}|dd\}}|ttt tfvr|dz }|tkr||Q|tkr| q|tt fvrd}n|r|r||dd}||dS)NFrtTr|) rnruNAMENUMBERrrASYNCAWAITINDENTDEDENTpop) rqrr startlineindents toks_appendtoknumtokvaltoks r r~zUntokenizer.compats k(  dF^ # # cMF gr] " "I  C !WNFF$u555# v&&&6!! GR=((  "w " GBK(((! K    #  rN)rRrSrTrrrzrr~r rr rlrlsP 111 $ $ $     rrlz&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)c|dddd}|dks|drdS|dvs|drd S|S) z(Imitates get_normal_name in tokenizer.c.N r -utf-8zutf-8-)zlatin-1 iso-8859-1z iso-latin-1)zlatin-1-z iso-8859-1-z iso-latin-1-r)lowerreplace startswith)orig_encencs r _get_normal_namersv 3B3-     ' 'S 1 1C g~~11~w 666 ~~ABB7| OrcLdd}d}fd}fd}|}|trd|dd}d}|s|gfS||}|r||gfSt|s||gfS|}|s||gfS||}|r|||gfS|||gfS) a The detect_encoding() function is used to detect the encoding that should be used to decode a Python source file. It requires one argument, readline, in the same way as the tokenize() generator. It will call readline a maximum of twice, and return the encoding used (as a string) and a list of any lines (left as bytes) it has read in. It detects the encoding from the presence of a utf-8 bom or an encoding cookie as specified in pep-0263. If both a bom and a cookie are present, but disagree, a SyntaxError will be raised. If the encoding cookie is an invalid charset, raise a SyntaxError. Note that if a utf-8 bom is found, 'utf-8-sig' is returned. If no encoding is specified, then the default of 'utf-8' will be returned. FNrcV S#t$rtcYSwxYwrF) StopIterationbytes)rgsr read_or_stopz%detect_encoding..read_or_stops< 8::    77NNN s ((c| |d}n#t$rYdSwxYwt|}|sdSt |d} t |}n #t$rtd|zwxYwr|j dkrtd|dz }|S)Nasciirzunknown encoding: rzencoding problem: utf-8z-sig) decodeUnicodeDecodeError cookie_rematchrrr LookupError SyntaxErrorname)r_ line_stringrencodingcodec bom_founds r find_cookiez$detect_encoding..find_cookie s ++g..KK!   44  ,, 4#EKKNN33 ?8$$EE ? ? ?2X=>> > ?  zW$$!";<<<  Hs ''+A;;BTz utf-8-sig)rrblank_rer)rgrdefaultrrfirstsecondrs` @r detect_encodingrs-$IHG , LNNE !! abb  {{5!!H!%  >>%   \^^F  {6""H)%(( UFO ##rcHt}||S)aTransform tokens back into Python source code. Each element returned by the iterable must be a token sequence with at least two elements, a token number and token value. If only two tokens are passed, the resulting output is poor. Round-trip invariant for full input: Untokenized source will match input source exactly Round-trip invariant for limited input: # Output text will tokenize the back to the input t1 = [tok[:2] for tok in generate_tokens(f.readline)] newcode = untokenize(t1) readline = iter(newcode.splitlines(1)).next t2 = [tok[:2] for tokin generate_tokens(readline)] assert t1 == t2 )rlr)ruts r rr:s$ B == " ""rc# Kdx}x}}d\}}d}dg}d}d} d} d} |} n#t$rd} YnwxYw|dz}dt| }} |r| std||| }|r>|dx} }t || d|z|||f|| zfVd\}}d}nZ|rA| ddd kr3| d dd kr%t || z||t| f|fVd}d}|| z}|| z}|dkr|s| snd}| |krO| | d kr|dz}n2| | d kr|tzdztz}n| | dkrd}nn | dz} | |kO| |krn|r|Vd}| | dvr| | dkry| | dd}| t|z}t||| f|| t|zf| fVt| |d||f|t| f| fVn>ttf| | dk| | d|| f|t| f| fV0||dkr/| |t| d| |df|| f| fV||dkrT||vrtdd|| | f|dd}| r| |dkrd} d} d} td|| f|| f| fV||dkT| r| r| |dkrd} d} d} n| std|dfd}| |krt| | }|r|d\}}||f||f|} }}| ||| |}}|t"jvs |dkr|dkrt&|||| fVn|dvr,t(}|dkrt}n| rd} |r|Vd}||||| fVna|dkr*|jdrJ|r|Vd}t|||| fVn1|t,vrpt.|}|| | }|r9|d} | || }|r|Vd}t |||| f| fVn||f}| |d}| }n|t0vs"|ddt0vs|ddt0vrk|ddkrG||f}t.|p%t.|dpt.|d}| |dd}}| }nA|r|Vd}t |||| fVn"|r|dvr| r|dkrt4nt6|||| fV)t8|||| f}|dkr|s|}A|dvrW|rU|dt8krD|ddkr8|dkr d} |d} t4|d|d|d|dfVd}|r|Vd}|Vnk|d kr|r|Vd}t|||| f| fVd}nJ|d!vr|dz}n |d"vr|dz }|r|Vd}t:|||| fVn t | | || f|| dzf| fV| dz} | |k|r|Vd}|ddD]}td|df|dfdfVt<d|df|dfdfVdS)#a4 The generate_tokens() generator requires one argument, readline, which must be a callable object which provides the same interface as the readline() method of built-in file objects. Each call to the function should return one line of input as a string. Alternately, readline can be a callable function terminating with StopIteration: readline = open(myfile).next # Example of alternate readline The generator produces 5-tuples with these members: the token type; the token string; a 2-tuple (srow, scol) of ints specifying the row and column where the token begins in the source; a 2-tuple (erow, ecol) of ints specifying the row and column where the token ends in the source; and the line on which the token was found. The line passed is the physical line. r)r#rNFrr#zEOF in multi-line stringz\ z\ rt  z# #z rz3unindent does not match any outer indentation levelz zEOF in multi-line statement.T r|r)asyncawaitr)defforr\z([{z)]})rr}rPrrSTRING ERRORTOKENtabsizerstripCOMMENTrrurIndentationErrorr pseudoprogspanstringdigitsrrendswith triple_quotedendprogs single_quoted isidentifierrrrOP ENDMARKER)rglnumparenlev continuedcontstrneedcontcontlinerstashed async_defasync_def_indent async_def_nlr_posmaxstrstartendprogendmatchrcolumn comment_tokennl_pos pseudomatchrvsposeposrinitialnewlinerindents r rrOs #$#D#8iGXHcGGIL} 8::DD   DDD axc$iiS J  G !;XFFF}}T**H $LLOO+cwdsd3$ho????$)! d233i611d233i86K6K!7T>#dCII%6BBBB!D.#d? ]]9] F))9##fqjVV#Y$&&&'/A2Ew1N#Y$&&Ag )) czz5  CyG##9##$(J$5$5f$=$=M 3}#5#55F"M #;sS5G5G/G(H$PPPPtFGG} &>D#d))+'"+.M.M! $ #$  K !>q JJJICii$**455Kg (--a00 s#'-$cCd!%eCi$u+wfm++sNNu||!5$d;;;;;&&%G!||"$",'+ '% "&"E4t<<<<<^^-u~d33333'% "&"E4t<<<<<m++&uoG&}}T377H &ll1oo $U3Y"+")MMM&*G%udT3KFFFFF$(%="&uvv,#' --"1"I.."1"I..RyD(($(%=#+G#4$6q8J$6#+E!H#5 ,0L!#'"+")MMM&*G%udD$?????))++,8 222$%,1W,<,<55%#($d#<<<<$dD9C'''"% ..# +$+AJ$$6$6$+AJ'$9$9$~~,0 3:2; 0#('!*#*1:wqz#*1:#////'+G'% "&IIII__'% "&udT3K>>>> !II%''HqL E))hl8'% "&udD$77777!49 #;s1u t====AgSCiii}~ !""+55rD!9tQi44444 b4)dAY 333333s ( 77__main__)S__doc__ __author__ __credits__rrecodecsrrlib2to3.pgen2.tokenr#rdir__all__r NameErrorstrrrr r) WhitespaceCommentIgnoreName Binnumber Hexnumber Octnumber Decnumber IntnumberExponent PointfloatExpfloat Floatnumber ImagnumberNumberSingleDoubleSingle3Double3 _litprefixTripleStringOperatorBracketSpecialFunny PlainTokenTokenContStr PseudoExtras PseudoTokenmapcompile tokenprogrr=rD _strprefixesrrrr ExceptionrPrWrdrrfrlASCIIrrrrrrrRsysr}argvopenrgstdinr rr r%s##0* F ########!!!! 0 0cc%jj 0 0 04,4,4, ,  EE EEE :99///111   cc*z122 2UU7^^ C  & 7 . E+X 6 6 E)Y 9 = = # U57H I IEERZOO [ X %eJ)) U& g(= > > z; 2 2 $ # 2 2 7 zE!:#5 6 6 z;;;; = = 5GWeU%%    %% - - h)) U65&$ / /  % ;;c:&&';;c:&&' ( (uZ&11 55vugtLLL 25#J Wg63838/ :{KM#sC%%M#sC%%&&&&' F##*"*V*<*<{ 9 9FFFFF 9GFFFF 987,777  9 EN//,///0//,///0  #J-- ---.-- ---. !!!!!!!!%%%%%Y%%%??? #-    &   6 6 6 6 6 6 6 6 p BJ@"( K K 2:0"( ; ;   G$G$G$R###*`4`4`4D zJJJ s38}}q((44 #4#4#=>>>>> (39% & & & & &sAA  A PKH13] }rr.pgen2/__pycache__/driver.cpython-311.opt-2.pycnu[ !A?hQ dZddgZddlZddlZddlZddlZddlZddlmZm Z m Z m Z m Z Gdde ZdZ dd Zd ZdZdZedkr$ejee dSdS)z#Guido van Rossum Driver load_grammarN)grammarparsetokentokenizepgenc>eZdZd dZd dZd dZd dZd dZd dZdS) rNcZ||_|tj}||_||_dSN)rlogging getLoggerloggerconvert)selfrrrs A/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/driver.py__init__zDriver.__init__s. >&((F  Fc. tj|j|j}|d}d}dx}x}x}x} } d} |D].} | \}}}} } |||fkr/|\} }|| kr| d| |z zz } | }d}||kr| | ||z } |}|t jt jfvr'| |z } | \}}|dr|dz }d}|tj krtj |}|r-|j dtj||| |||| |fr|r|j dn>d} | \}}|dr|dz }d}0tjd||| |f|jS)Nrr z%s %r (prefix=%r)zStop.zincomplete input)rParserrrsetupr COMMENTNLendswithrOPopmaprdebugtok_nameaddtoken ParseErrorrootnode)rtokensr plinenocolumntypevaluestartend line_textprefix quintuples_linenos_columns r parse_tokenszDriver.parse_tokens&sB Lt| 4 4  1555u5u5sY$ A$ AI1: .D%Y(((%*"(H$$dh&788F%FFH$$ix88F%F((+666%!$>>$''aKFFux}U+ G !!"5"'."6vGGGzz$77 /K%%g...F NFF~~d## ! "#5#'AA Azrcb tj|j}|||Sr )r generate_tokensreadliner2)rstreamr r%s rparse_stream_rawzDriver.parse_stream_rawVs-8)&/::  ///rc0 |||Sr )r7)rr6r s r parse_streamzDriver.parse_stream[s8$$VU333rc tj|d|5}|||cdddS#1swxYwYdS)Nr)encoding)ioopenr9)rfilenamer<r r6s r parse_filezDriver.parse_file_s6 WXsX 6 6 6 4&$$VU33 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4s<AAc tjtj|j}|||Sr )r r4r=StringIOr5r2)rtextr r%s r parse_stringzDriver.parse_stringds88)"+d*;*;*DEE  ///r)NN)F)NF) __name__ __module__ __qualname__rr2r7r9r@rDrrrrs....`0000 44444444 000000rctj|\}}|dkrd}||zdt t t jzdzS)Nz.txtr.z.pickle)ospathsplitextjoinmapstrsys version_info)gtheadtails r_generate_pickle_namerVjsV!!"%%JD$ v~~ $;#c3+;"<"<== = IIr Grammar.txtTFc |tj}|t|n|}|st||s|d|t j|}|rZ|d| ||nV#t$r }|d|Yd}~n1d}~wwxYwn(tj }| ||S)Nz!Generating grammar tables from %szWriting grammar tables to %szWriting failed: %s) rrrV_newerinfor generate_grammardumpOSErrorrGrammarload)rSgpsaveforcerges rrrqs 1 ~"$$&(j r " " "bB F2rNN  7<<<  !" % %  5 KK6 ; ; ; 5r  5 5 5 0!44444444 5  5 O   r Hs?B B?B::B?c tj|sdStj|sdStj|tj|kS)NFT)rKrLexistsgetmtime)abs rrYrYsf: 7>>!  u 7>>!  t 7  A  "'"2"21"5"5 55rc6 tj|rt|St tj|}t j||}tj }| ||Sr ) rKrLisfilerrVbasenamepkgutilget_datarr^loads)packagegrammar_source pickled_namedatarcs rload_packaged_grammarrts}  w~~n%%,N+++()9)9.)I)IJJL  G\ 2 2DAGGDMMM Hrc |stjdd}tjtjtjd|D]}t |dddS)Nrz %(message)s)levelr6formatT)rarb)rQargvr basicConfigINFOstdoutr)argsrSs rmainr}sq x| gl3:,....00Rd$///// 4r__main__)rWNTFN) __author____all__r=rKrrmrQrrrrr r objectrrVrrYrtr}rEexitintrHrrrsA 3 ^ $  43333333333333J0J0J0J0J0VJ0J0J0ZJJJ'+04    *666   (    z CHSSTTVV__rPKH13] K+K+,pgen2/__pycache__/conv.cpython-311.opt-1.pycnu[ !A?h%HdZddlZddlmZmZGddejZdS)aConvert graminit.[ch] spit out by pgen to Python code. Pgen is the Python parser generator. It is useful to quickly create a parser from a grammar file in Python's grammar notation. But I don't want my parsers to be written in C (yet), so I'm translating the parsing tables to Python data structures and writing a Python parse engine. Note that the token numbers are constants determined by the standard Python tokenizer. The standard token module defines these numbers and their names (the names are not used much). The token numbers are hardcoded into the Python tokenizer and into pgen. A Python implementation of the Python tokenizer is also available, in the standard tokenize module. On the other hand, symbol numbers (representing the grammar's non-terminals) are assigned by pgen based on the actual grammar input. Note: this module is pretty much obsolete; the pgen module generates equivalent grammar tables directly from the Grammar.txt input file without having to invoke the Python pgen C program. N)grammartokenc*eZdZdZdZdZdZdZdS) Convertera2Grammar subclass that reads classic pgen output files. The run() method reads the tables as produced by the pgen parser generator, typically contained in two C files, graminit.h and graminit.c. The other methods are for internal use only. See the base class for more documentation. c|||||dS)z|r*t|d|d |\|\}}t|}||j|<||j|<d S) zParse the .h file written by pgen. (Internal) This file is a sequence of #define statements defining the nonterminals of the grammar as numbers. We build two tables mapping the numbers to names and back. Can't open : NFrz^#define\s+(\w+)\s+(\d+)$(z): can't parse T) openOSErrorprint symbol2number number2symbolrematchstripgroupsint) r filenameferrlinenolinemosymbolnumbers rrzConverter.parse_graminit_h5s/ XAA    E337 8 8 855555   4 4D aKF6==B 4$**,, 4(((FFF26**,,,@AAAA"$V.4"6*-3"6**ts <7<c  t|}n-#t$r }td|d|Yd}~dSd}~wwxYwd}|dzt|}}|dzt|}}|dzt|}}i}g}|drf|drt jd|}ttt| \} } } g} t| D]y} |dzt|}}t jd |}ttt| \}}| ||fz|dzt|}}| || | f<|dzt|}}|dt jd |}ttt| \}}g}t|D]} |dzt|}}t jd |}ttt| \} } } || | f} | | | ||dzt|}}|dzt|}}|df||_ i}t jd |}t|d}t|D]#}|dzt|}}t jd |}|d}ttt|dddd\}}}}||}|dzt|}}t jd|}i}t|d}t!|D]9\}}t#|}tdD]}|d|zzr d||dz|z<:||f||<%|dzt|}}||_g}|dzt|}}t jd|}t|d}t|D]}|dzt|}}t jd|}| \}}t|}|dkrd}nt|}| ||f|dzt|}}||_|dzt|}}|dzt|}}t jd|}t|d}|dzt|}}|dzt|}}t jd|}t|d}|dzt|}}t jd|}t|d} | |_|dzt|}} |dzt|}}dS#t*$rYdSwxYw)aParse the .c file written by pgen. (Internal) The file looks as follows. The first two lines are always this: #include "pgenheaders.h" #include "grammar.h" After that come four blocks: 1) one or more state definitions 2) a table defining dfas 3) a table defining labels 4) a struct defining the grammar A state definition has the following form: - one or more arc arrays, each of the form: static arc arcs__[] = { {, }, ... }; - followed by a state array, of the form: static state states_[] = { {, arcs__}, ... }; rrNFrrz static arc z)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$z\s+{(\d+), (\d+)},$z'static state states_(\d+)\[(\d+)\] = {$z\s+{(\d+), arcs_(\d+)_(\d+)},$zstatic dfa dfas\[(\d+)\] = {$z0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$z\s+("(?:\\\d\d\d)*")},$z!static label labels\[(\d+)\] = {$z\s+{(\d+), (0|"\w+")},$0z \s+(\d+),$z\s+{(\d+), labels},$z \s+(\d+)$)rrrnext startswithrrlistmaprrrangeappendstatesgroupeval enumerateorddfaslabelsstart StopIteration)!r r r!r"r#r$allarcsr5r%nmkarcs_ijststater:ndfasr&r'xyzfirst rawbitsetcbyter;nlabelsr<s! rr zConverter.parse_graminit_cTs8 XAA    E337 8 8 855555 axaaxaaxaoom,,! -//-00 1XJ"$$s3 44551aq((A#)!8T!WWDF"8$??BC 5 566DAqKKA''''%axa"&A%axa//-00 1 DdKKBC--..DAqE1XX # #%axaX?FFs3 44551aq!t} T"""" MM% !!8T!WWDF!!8T!WWDFCoom,,! -D  X6 = =BHHQKK  u * *A!!8T!WWDFM  BXXa[[F"3sBHHQ1a,@,@#A#ABBOFAq!1IE!!8T!WWDF4d;;BERXXa[[))I!),, + +11vvq++Aq!t}+)*acAg+"5>DLLaxa axa X:D A Abhhqkk""w " "A!!8T!WWDF4d;;B99;;DAqAACxxGG MM1a& ! ! ! !axa axaaxa XmT * *BHHQKK  axaaxa X-t 4 4bhhqkk""axa XlD ) )BHHQKK   axa %!!8T!WWDFFF    DD s" <7<)Z?? [  [ ci|_i|_t|jD]1\}\}}|tjkr | ||j|<%| ||j|<2dS)z1Create additional useful structures. (Internal).N)keywordstokensr8r;rNAME)r ilabeltypevalues rr zConverter.finish_offso  %.t{%;%; + + !FMT5uz!!e&7'- e$$$* D!  + +rN)__name__ __module__ __qualname____doc__rrr r rrrr$s^ >c%c%c%J+++++rr)r\rpgen2rrGrammarrr]rrr`st4 ! ]+]+]+]+]+]+]+]+]+]+rPKH13]w!!,pgen2/__pycache__/conv.cpython-311.opt-2.pycnu[ !A?h%F ddlZddlmZmZGddejZdS)N)grammartokenc(eZdZ dZdZdZdZdS) Converterc |||||dSN)parse_graminit_hparse_graminit_c finish_off)self graminit_h graminit_cs ?/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/conv.pyrunz Converter.run/sCJ j))) j))) c  t|}n-#t$r }td|d|Yd}~dSd}~wwxYwi|_i|_d}|D]}|dz }t jd|}|s>|r*t|d|d|\|\}}t|}||j|<||j|<d S) N Can't open : Frz^#define\s+(\w+)\s+(\d+)$(z): can't parse T) openOSErrorprint symbol2number number2symbolrematchstripgroupsint) r filenameferrlinenolinemosymbolnumbers rr zConverter.parse_graminit_h5s4  XAA    E337 8 8 855555   4 4D aKF6==B 4$**,, 4(((FFF26**,,,@AAAA"$V.4"6*-3"6**ts =8=c  t|}n-#t$r }td|d|Yd}~dSd}~wwxYwd}|dzt|}}|dzt|}}|dzt|}}i}g}|drf|drt jd|}ttt| \} } } g} t| D]y} |dzt|}}t jd|}ttt| \}}| ||fz|dzt|}}| || | f<|dzt|}}|dt jd |}ttt| \}}g}t|D]} |dzt|}}t jd |}ttt| \} } } || | f} | | | ||dzt|}}|dzt|}}|df||_ i}t jd |}t|d}t|D]#}|dzt|}}t jd |}|d }ttt|dddd\}}}}||}|dzt|}}t jd|}i}t|d}t!|D]9\}}t#|}tdD]}|d|zzr d||dz|z<:||f||<%|dzt|}}||_g}|dzt|}}t jd|}t|d}t|D]}|dzt|}}t jd|}| \}}t|}|dkrd}nt|}| ||f|dzt|}}||_|dzt|}}|dzt|}}t jd|}t|d}|dzt|}}|dzt|}}t jd|}t|d}|dzt|}}t jd|}t|d} | |_|dzt|}} |dzt|}}dS#t*$rYdSwxYw)NrrFrrz static arc z)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$z\s+{(\d+), (\d+)},$z'static state states_(\d+)\[(\d+)\] = {$z\s+{(\d+), arcs_(\d+)_(\d+)},$zstatic dfa dfas\[(\d+)\] = {$z0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$z\s+("(?:\\\d\d\d)*")},$z!static label labels\[(\d+)\] = {$z\s+{(\d+), (0|"\w+")},$0z \s+(\d+),$z\s+{(\d+), labels},$z \s+(\d+)$)rrrnext startswithrrlistmapr rrangeappendstatesgroupeval enumerateorddfaslabelsstart StopIteration)!r r!r"r#r$r%allarcsr6r&nmkarcs_ijststater;ndfasr'r(xyzfirst rawbitsetcbyter<nlabelsr=s! rr zConverter.parse_graminit_cTs 6 XAA    E337 8 8 855555 axaaxaaxaoom,,! -//-00 1XJ"$$s3 44551aq((A#)!8T!WWDF"8$??BC 5 566DAqKKA''''%axa"&A%axa//-00 1 DdKKBC--..DAqE1XX # #%axaX?FFs3 44551aq!t} T"""" MM% !!8T!WWDF!!8T!WWDFCoom,,! -D  X6 = =BHHQKK  u * *A!!8T!WWDFM  BXXa[[F"3sBHHQ1a,@,@#A#ABBOFAq!1IE!!8T!WWDF4d;;BERXXa[[))I!),, + +11vvq++Aq!t}+)*acAg+"5>DLLaxa axa X:D A Abhhqkk""w " "A!!8T!WWDF4d;;B99;;DAqAACxxGG MM1a& ! ! ! !axa axaaxa XmT * *BHHQKK  axaaxa X-t 4 4bhhqkk""axa XlD ) )BHHQKK   axa %!!8T!WWDFFF    DD s" =8=*[ [ [c i|_i|_t|jD]1\}\}}|tjkr | ||j|<%| ||j|<2dSr)keywordstokensr9r<rNAME)r ilabeltypevalues rr zConverter.finish_offsr?  %.t{%;%; + + !FMT5uz!!e&7'- e$$$* D!  + +rN)__name__ __module__ __qualname__rr r r rrrr$sY >c%c%c%J+++++rr)rpgen2rrGrammarrr]rrr`so4 ! ]+]+]+]+]+]+]+]+]+]+rPKH13]^6*pgen2/__pycache__/__init__.cpython-311.pycnu[ !A?h dZdS)zThe pgen2 package.N)__doc__C/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/__init__.pyrsrPKH13]`m -pgen2/__pycache__/token.cpython-311.opt-2.pycnu[ !A?h) dZdZdZdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Z d!Z!d"Z"d#Z#d$Z$d%Z%d&Z&d'Z'd(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1d2Z2d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;de?e@AD] \ZBZCeDeCeDdureBe>eC<!d>ZEd?ZFd@ZGdAS)B  !"#$%&'()*+,-./0123456789:;<c|tkSN NT_OFFSETxs @/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/token.py ISTERMINALrGOs y=c|tkSrArBrDs rF ISNONTERMINALrJR >rHc|tkSrA) ENDMARKERrDs rFISEOFrNUrKrHN)HrMNAMENUMBERSTRINGNEWLINEINDENTDEDENTLPARRPARLSQBRSQBCOLONCOMMASEMIPLUSMINUSSTARSLASHVBARAMPERLESSGREATEREQUALDOTPERCENT BACKQUOTELBRACERBRACEEQEQUALNOTEQUAL LESSEQUAL GREATEREQUALTILDE CIRCUMFLEX LEFTSHIFT RIGHTSHIFT DOUBLESTAR PLUSEQUALMINEQUAL STAREQUAL SLASHEQUAL PERCENTEQUAL AMPEREQUAL VBAREQUALCIRCUMFLEXEQUALLEFTSHIFTEQUALRIGHTSHIFTEQUALDOUBLESTAREQUAL DOUBLESLASHDOUBLESLASHEQUALATATEQUALOPCOMMENTNLRARROWAWAITASYNC ERRORTOKEN COLONEQUALN_TOKENSrCtok_namelistglobalsitems_name_valuetyperGrJrNrHrFrs(                                                      T''))//++,,!!ME6 tF||ttAww rHPKH13]^60pgen2/__pycache__/__init__.cpython-311.opt-1.pycnu[ !A?h dZdS)zThe pgen2 package.N)__doc__C/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/__init__.pyrsrPKH13]/pgen2/__pycache__/grammar.cpython-311.opt-1.pycnu[ !A?hdZddlZddlmZGddeZdZiZeD]*Z e r&e \Z Z e ee ee <+[ [ [ dS)aThis module defines the data structures used to represent a grammar. These are a bit arcane because they are derived from the data structures used by Python's 'pgen' parser generator. There's also a table here mapping operators to their names in the token module; the Python tokenize module reports all operators as the fallback token code OP, but the parser needs the actual token code. N)tokenc6eZdZdZdZdZdZdZdZdZ dS) Grammara Pgen parsing tables conversion class. Once initialized, this class supplies the grammar tables for the parsing engine implemented by parse.py. The parsing engine accesses the instance variables directly. The class here does not provide initialization of the tables; several subclasses exist to do this (see the conv and pgen modules). The load() method reads the tables from a pickle file, which is much faster than the other ways offered by subclasses. The pickle file is written by calling dump() (after loading the grammar tables using a subclass). The report() method prints a readable representation of the tables to stdout, for debugging. The instance variables are as follows: symbol2number -- a dict mapping symbol names to numbers. Symbol numbers are always 256 or higher, to distinguish them from token numbers, which are between 0 and 255 (inclusive). number2symbol -- a dict mapping numbers to symbol names; these two are each other's inverse. states -- a list of DFAs, where each DFA is a list of states, each state is a list of arcs, and each arc is a (i, j) pair where i is a label and j is a state number. The DFA number is the index into this list. (This name is slightly confusing.) Final states are represented by a special arc of the form (0, j) where j is its own state number. dfas -- a dict mapping symbol numbers to (DFA, first) pairs, where DFA is an item from the states list above, and first is a set of tokens that can begin this grammar rule (represented by a dict whose values are always 1). labels -- a list of (x, y) pairs where x is either a token number or a symbol number, and y is either None or a string; the strings are keywords. The label number is the index in this list; label numbers are used to mark state transitions (arcs) in the DFAs. start -- the number of the grammar's start symbol. keywords -- a dict mapping keyword strings to arc labels. tokens -- a dict mapping token numbers to arc labels. ci|_i|_g|_i|_dg|_i|_i|_i|_d|_dS)N)rEMPTY) symbol2number number2symbolstatesdfaslabelskeywordstokens symbol2labelstart)selfs B/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/grammar.py__init__zGrammar.__init__LsJ  #n    ct|d5}tj|j|tjddddS#1swxYwYdS)z)Dump the grammar tables to a pickle file.wbN)openpickledump__dict__HIGHEST_PROTOCOL)rfilenamefs rrz Grammar.dumpWs (D ! ! CQ K q&*A B B B C C C C C C C C C C C C C C C C C Cs&AA Act|d5}tj|}dddn #1swxYwY|j|dS)z+Load the grammar tables from a pickle file.rbN)rrloadrupdate)rrrds rr"z Grammar.load\s (D ! ! Q AA                Qs 266c^|jtj|dS)z3Load the grammar tables from a pickle bytes object.N)rr#rloads)rpkls rr&z Grammar.loadsbs( V\#../////rc |}dD]3}t||t||4|jdd|_|jdd|_|j|_|S)z# Copy the grammar. )r r r rrrN) __class__setattrgetattrcopyrr r)rnew dict_attrs rr,z Grammar.copyfsnn4 E EI CGD)$<$<$A$A$C$C D D D D[^ [^ J  rcrddlm}td||jtd||jtd||jtd||jtd||jtd|jd S) z:Dump the grammar tables to standard output, for debugging.r)pprints2nn2sr r rrN)r0printr r r r rr)rr0s rreportzGrammar.reportss!!!!!! e t!""" e t!""" ht{ f ty ht{ gtz"""""rN) __name__ __module__ __qualname____doc__rrr"r&r,r4rrrrs|33j   CCC    000    # # # # #rra ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW := COLONEQUAL )r8rrobjectr opmap_rawopmap splitlineslinesplitopnamer+r9rrrCs   j#j#j#j#j#fj#j#j#^1  f   " "))D )::<<DGE4((b "dddrPKH13]3O3O&pgen2/__pycache__/pgen.cpython-311.pycnu[ !A?h6ddlmZmZmZGddejZGddeZGddeZGdd eZ d d Z d S))grammartokentokenizeceZdZdS) PgenGrammarN)__name__ __module__ __qualname__?/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/pgen.pyrrsDr rc~eZdZddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZddZdZdZdS)ParserGeneratorNcNd}|t|d}|j}||_||_t j|j|_|| \|_ |_ | |i|_ | dS)Nzutf-8)encoding)openclosefilenamestreamrgenerate_tokensreadline generatorgettokenparsedfas startsymbolfirst addfirstsets)selfrr close_streams r __init__zParserGenerator.__init__ s >(W555F!%00HOOQ_U%;T$BCCC,2AN5)!M!t44!&#..5555.//////QX%%8F++HOOVTN333'-AHV$!M8z)))5)))KKEQx!! "AJ&&:e,,HOOUZ$7888(.AJu%!M!u-QX%%8F++HOOVTN333'-AHV$!Mr ct|j}||D] }||jvr||!dSN)r%rr&r'r calcfirst)rr8r9s r rzParserGenerator.addfirstsetsksaTY^^%%&&  % %D4:%%t$$$ % %r c .|j|}d|j|<|d}i}i}|jD]\}}||jvrh||jvr"|j|}|t d|zn"|||j|}|||||<vd||<|di||<i} |D]4\}} | D],} | | vr!t d|d| d|d| | || | <-5||j|<dS)Nr#zrecursion for rule %rrzrule z is ambiguous; z is in the first sets of z as well as )rrr.r/ ValueErrorrWupdate) rr9r;r<totalset overlapcheckr=r>fsetinverseitsfirstsymbols r rWzParserGenerator.calcfirstssio 4A  :++-- 1 1KE4 !!DJ&&:e,D|()@4)GHHH$NN5))):e,D%%%&* U##"#',aj U##+1133 ( (OE8" ( (W$$$*&*ddFFFEEE76??&LMMM#(  ( $ 4r cti}d}|jtjkr|jtjkr)||jtjk)|tj}|tjd|\}}|tj| ||}t|}| |t|}|||<||}|jtjk||fS)N:) typer ENDMARKERNEWLINErexpectrQOP parse_rhsmake_dfar* simplify_dfa) rrrr9azr;oldlennewlens r rzParserGenerator.parses  i5?**)u},, )u},,;;uz**D KK# & & &>>##DAq KK & & &--1%%CXXF   c " " "XXFDJ"" #i5?**$[  r c  t|tsJt|tsJ fd} fd t|||g}|D]}i}|jD]1}|jD]'\}} |  | ||i(2t |D]R\}} |D]} | j| krn&t| |} || | | |S|S)Nc$i}|||SrVr )r<base addclosures r closurez)ParserGenerator.make_dfa..closuresD Jud # # #Kr ct|tsJ||vrdSd||<|jD]\}}| ||dSrA)rKNFAStater.)r<rqr=r>rrs r rrz,ParserGenerator.make_dfa..addclosuresgeX.. . ..}}DK$z + + t=JtT*** + +r ) rKruDFAStatenfasetr. setdefaultr-r/r0addarc) rr6finishrsr4r<r.nfastater=r>rwstrrs @r rizParserGenerator.make_dfas{ %*****&(+++++      + + + + +775>>6223 ( (ED!L E E#+=EEKE4(" 4)C)CDDDE"( !5!5 ( ( v &&ByF**+"&&11BMM"%%% R'''' ( r cltd||g}t|D]\}}td|||urdpd|jD]l\}}||vr||} n$t |} |||td| zXtd|| fzmdS)NzDump of NFA for State(final)z -> %d %s -> %d)print enumerater.r2r*r0) rr9r6rztodor:r<r=r>js r dump_nfazParserGenerator.dump_nfas &&&w!$ 7 7HAu )Q =I C D D D$z 7 7 t4<< 4((AAD AKK%%%=+/****.E1:56666 7 7 7r c *td|t|D]r\}}td||jrdpdt|jD],\}}td|||fz-sdS)NzDump of DFA forr~rrr)rrr3r-r.r/r2)rr9r;r:r<r=r>s r dump_dfazParserGenerator.dump_dfas &&&!# A AHAu )Q ;) Ar B B B%ej&6&6&8&899 A A tnsyy'??@@@@ A A Ar cd}|rnd}t|D]X\}}t|dzt|D]2}||}||kr"||=|D]}|||d}n3Y|ldSdS)NTFr)rranger* unifystate)rr;changesr:state_irstate_jr<s r rjzParserGenerator.simplify_dfas G'nn   7qsCHH--A!!fG'))F%(??E!,,Wg>>>>"& *      r c|\}}|jdkr||fSt}t}|||||jdkr`||\}}|||||jdk`||fS)N|) parse_altrTruryr)rrkrlaazzs r rhzParserGenerator.parse_rhss~~1 :  a4KBB IIaLLL HHRLLL*## ~~''1 !  *## r6Mr c4|\}}|jdvs|jtjtjfvrV|\}}|||}|jdv7|jtjtjfvV||fS)N)([) parse_itemrTrcrrQSTRINGry)rrkbr7ds r rzParserGenerator.parse_alt s  1zZ''yUZ666??$$DAq HHQKKKA zZ''yUZ666!t r c|jdkrd||\}}|tjd||||fS|\}}|j}|dvr||fS||||dkr||fS||fS)Nr])+*r)rTrrhrfrrgry parse_atom)rrkrlrTs r rzParserGenerator.parse_items :   MMOOO>>##DAq KK# & & & HHQKKKa4K??$$DAqJEJ&&!t MMOOO HHQKKK||!t !t r c|jdkrO||\}}|tjd||fS|jtjtjfvrOt}t}| ||j|||fS| d|j|jdS)Nr)z+expected (...) or NAME or STRING, got %s/%s) rTrrhrfrrgrcrQrrury raise_error)rrkrls r rzParserGenerator.parse_atom(s :   MMOOO>>##DAq KK# & & &a4K Y5:u|4 4 4 A A HHQ # # # MMOOOa4K   J!Y  4 4 4 4 4r c|j|ks |.|j|kr#|d|||j|j|j}||S)Nzexpected %s/%s, got %s/%s)rcrTrr)rrcrTs r rfzParserGenerator.expect9sd 9  !2tzU7J7J   8!5$)TZ A A A   r ct|j}|dtjtjfvr4t|j}|dtjtjfv4|\|_|_|_|_|_ dS)Nr#) r>rrCOMMENTNLrcrTbeginendline)rtups r rzParserGenerator.gettokenAsr4>""!f)8;777t~&&C!f)8;777AD> 4:tz48TYYYr c |rG ||z}n@#d|gttt|z}YnxYwt ||j|jd|jd|jf)N r#r)joinr%mapstr SyntaxErrorrrr)rmsgargss r rzParserGenerator.raise_errorHs  = =Dj =hhutCTNN';';;<<# tx{ $ TY 899 9s  ;ArV)rr r r!r?r5r1rrWrrirrrjrhrrrrfrrr r r rr s4    2,",","\%%%$$$<!!!0"""H777 AAA*"(444"EEE99999r rceZdZdZddZdS)rucg|_dSrV)r.)rs r r!zNFAState.__init__Ss  r Nc|t|tsJt|tsJ|j||fdSrV)rKrrur.r0rr>r=s r ryzNFAState.addarcVsP} 5# 6 6}}6$))))) %'''''r rV)rr r r!ryr r r ruruQs7((((((r ruc*eZdZdZdZdZdZdZdS)rvct|tsJttt|tsJt|tsJ||_||v|_i|_dSrV)rKdictr>iterrurwr3r.)rrwfinals r r!zDFAState.__init__]so&$'''''$tF||,,h77777%*****   r ct|tsJ||jvsJt|tsJ||j|<dSrV)rKrr.rvrs r ryzDFAState.addarcesS%%%%%%DI%%%%$))))) %r c`|jD]\}}||ur ||j|<dSrV)r.r/)roldnewr=r>s r rzDFAState.unifystateksA9??,, ' 'KE4s{{#& %  ' 'r c,t|tsJ|j|jkrdSt|jt|jkrdS|jD]$\}}||j|urdS%dS)NFT)rKrvr3r*r.r/get)rotherr=r>s r __eq__zDFAState.__eq__ps%***** <5= ( (5 ty>>S__ , ,59??,,  KE45:>>%0000uu1tr N)rr r r!ryrr__hash__r r r rvrv[sQ   '''   HHHr rv Grammar.txtcHt|}|SrV)rr?)rps r generate_grammarrs!!A >>  r N)r) rrrrGrammarrobjectrrurvrr r r rs '&&&&&&&&&     '/   E9E9E9E9E9fE9E9E9N (((((v(((#####v###Jr PKH13]cc/pgen2/__pycache__/grammar.cpython-311.opt-2.pycnu[ !A?h ddlZddlmZGddeZdZiZeD]*Zer&e \Z Z e ee ee <+[[ [ dS)N)tokenc4eZdZ dZdZdZdZdZdZdS)Grammarci|_i|_g|_i|_dg|_i|_i|_i|_d|_dS)N)rEMPTY) symbol2number number2symbolstatesdfaslabelskeywordstokens symbol2labelstart)selfs B/opt/alt/python-internal/lib64/python3.11/lib2to3/pgen2/grammar.py__init__zGrammar.__init__LsJ  #n    c t|d5}tj|j|tjddddS#1swxYwYdS)Nwb)openpickledump__dict__HIGHEST_PROTOCOL)rfilenamefs rrz Grammar.dumpWs7 (D ! ! CQ K q&*A B B B C C C C C C C C C C C C C C C C C Cs&AA  A c t|d5}tj|}dddn #1swxYwY|j|dS)Nrb)rrloadrupdate)rrrds rr"z Grammar.load\s9 (D ! ! Q AA                Qs 377c` |jtj|dS)N)rr#rloads)rpkls rr&z Grammar.loadsbs+A V\#../////rc  |}dD]3}t||t||4|jdd|_|jdd|_|j|_|S)N)r r r rrr) __class__setattrgetattrcopyrr r)rnew dict_attrs rr,z Grammar.copyfs nn4 E EI CGD)$<$<$A$A$C$C D D D D[^ [^ J  rct ddlm}td||jtd||jtd||jtd||jtd||jtd|jdS) Nr)pprints2nn2sr r rr)r0printr r r r rr)rr0s rreportzGrammar.reportssH!!!!!! e t!""" e t!""" ht{ f ty ht{ gtz"""""rN) __name__ __module__ __qualname__rrr"r&r,r4rrrrsw3j   CCC    000    # # # # #rra ( LPAR ) RPAR [ LSQB ] RSQB : COLON , COMMA ; SEMI + PLUS - MINUS * STAR / SLASH | VBAR & AMPER < LESS > GREATER = EQUAL . DOT % PERCENT ` BACKQUOTE { LBRACE } RBRACE @ AT @= ATEQUAL == EQEQUAL != NOTEQUAL <> NOTEQUAL <= LESSEQUAL >= GREATEREQUAL ~ TILDE ^ CIRCUMFLEX << LEFTSHIFT >> RIGHTSHIFT ** DOUBLESTAR += PLUSEQUAL -= MINEQUAL *= STAREQUAL /= SLASHEQUAL %= PERCENTEQUAL &= AMPEREQUAL |= VBAREQUAL ^= CIRCUMFLEXEQUAL <<= LEFTSHIFTEQUAL >>= RIGHTSHIFTEQUAL **= DOUBLESTAREQUAL // DOUBLESLASH //= DOUBLESLASHEQUAL -> RARROW := COLONEQUAL ) rrobjectr opmap_rawopmap splitlineslinesplitopnamer+r8rrrBs  j#j#j#j#j#fj#j#j#^1  f   " "))D )::<<DGE4((b "dddrPKH13] ;;Grammar3.11.13.final.0.picklenu[;}( symbol2number}( file_inputMand_exprMand_testM annassignMarglistMargumentM arith_exprM assert_stmtM async_funcdefM async_stmtM atomM  augassignM  break_stmtM classdefM comp_forMcomp_ifM comp_iterMcomp_opM comparisonM compound_stmtM continue_stmtM decoratedM decoratorM decoratorsMdel_stmtM dictsetmakerMdotted_as_nameMdotted_as_namesM dotted_nameM encoding_declM eval_inputM except_clauseM exec_stmtM exprM! expr_stmtM"exprlistM#factorM$ flow_stmtM%for_stmtM&funcdefM' global_stmtM(if_stmtM)import_as_nameM*import_as_namesM+ import_fromM, import_nameM- import_stmtM.lambdefM/ listmakerM0namedexpr_testM1not_testM2 old_lambdefM3old_testM4or_testM5 parametersM6 pass_stmtM7powerM8 print_stmtM9 raise_stmtM: return_stmtM; shift_exprM< simple_stmtM= single_inputM>sliceopM? small_stmtM@ star_exprMAstmtMB subscriptMC subscriptlistMDsuiteMEtermMFtestMGtestlistMH testlist1MI testlist_gexpMJ testlist_safeMKtestlist_star_exprMLtfpdefMMtfplistMNtnameMOtrailerMPtry_stmtMQ typedargslistMR varargslistMSvfpdefMTvfplistMUvnameMV while_stmtMW with_itemMX with_stmtMYwith_varMZxor_exprM[ yield_argM\ yield_exprM] yield_stmtM^u number2symbol}(MhMhMhMhMhMhMh Mh Mh M h M h M hM hM hMhMhMhMhMhMhMhMhMhMhMhMhMhMhMhMh Mh!Mh"M h#M!h$M"h%M#h&M$h'M%h(M&h)M'h*M(h+M)h,M*h-M+h.M,h/M-h0M.h1M/h2M0h3M1h4M2h5M3h6M4h7M5h8M6h9M7h:M8h;M9hM<h?M=h@M>hAM?hBM@hCMAhDMBhEMChFMDhGMEhHMFhIMGhJMHhKMIhLMJhMMKhNMLhOMMhPMNhQMOhRMPhSMQhTMRhUMShVMThWMUhXMVhYMWhZMXh[MYh\MZh]M[h^M\h_M]h`M^haustates](](](KKKKKKe]KKae](]K*Ka](K+KKKee](]K,Ka](K-KKKee](]K.Ka]K/Ka](K0KKKe]K/Ka]KKae](]K1Ka](K2KKKe](K1KKKee](](KKK3KK/Ke]K/Ka](K4KK0KK5KKKe]KKae](]K6Ka](KKKKKKee](]K Ka]K/Ka](K2KKKe]K/Ka]KKae](]K%Ka]K7Ka]KKae](]K%Ka](K8KK7KK9Ke]KKae](](KKKKK KK KK#KK'KK(KK)Ke](K:KK;KKK e]K?K a](K@KKAK e]KKa](K)KKKe]K:Ka]KKa]K=Ka]K Ka]K@Kae](](KBKKCKKDKKEKKFKKGKKHKKIKKJKKKKKLKKMKKNKe]KKae](]K Ka]KKae](]KKa]K'Ka](KKK.Ke](K:KKOKe]KPKa]K.Ka]K:Ka]KKae](](KKK%Ke]KQKa]KKa]KRKa]KSKa](KTKKKe]KKae](]KKa]KUKa](KTKKKe]KKae](](K5KKVKe]KKae](](KWKKXKKYKKWKKZKK[KK\KKRKK]KKKe]KKa](KKKKe]KRKae](]K^Ka](K_KKKee](](K`KKaKKbKK8KK7KKcKKdKKeKK9Ke]KKae](]KKa]KKae](]KfKa](KgKKaKK7Ke]KKae](]K Ka]KhKa](KKKKe](K:KKOKe]KKa]KKa]K:Kae](]KiKa](KiKKKee](]KKa]KQKa]KKae](](K3KKjKK/Ke]K^Ka](K2KK5KKKe](K2KK.KK5KKKe](K2KK5KKKe](KjK K/K KKe]KKa]K/Ka](K3K K/K KKe](K2KKK e]K^K a]K.K a](K2KKK e]K/K ae](]KhKa](KkKKKe]K'Ka]KKae](]KlKa](K2KKKee](]K'Ka](KKKKee](]K'Ka]KKae](]KmKa](KKKKe]KKae](]KnKa](K/KKKe](K2KKkKKKe]K/Ka]KKae](]KKa]K^Ka](KRKKKe]K/Ka](K2KKKe]K/Ka]KKae](]KoKa](KpKKKee](]KqKa](K0KKrKKsKKKe](KqKKjL}(KKKKKKKKKKK KK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK KK!KK"KK#KK$KK%KK&KK'KKKK(KK)KuM?jU}K.KsM@j]}(KKKKKKKKKKK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKK"KK#KK$KK&KK'KK(KK)KuMAjj}KKsMBjq}(KKKKKKKKKKK KK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK KK!KK"KK#KK$KK%KK&KK'KK(KK)KuMCjw}(KKKKKKKKK.KK KK KKKKKK#KK$KK&KK'KK(KK)KuMDj}(KKKKKKKKK.KK KK KKKKKK#KK$KK&KK'KK(KK)KuMEj}(KKKKKKKKKKK KK KK KK KKKKKKKKKKKKKKKKKKKKKKKKKKKK"KK#KK$KK&KK'KKKK(KK)KuMFj}(KKKKKKKKK KK KK#KK$KK&KK'KK(KK)KuMGj}(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMHj}(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMIj}(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMJj}(KKKKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMKj}(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMLj}(KKKKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMMj}(KKK'KuMNj}(KKK'KuMOj}K'KsMPj }(KKKKK KuMQj}KKsMRj>}(KKKKK3KK'KuMSj}(KKKKK3KK'KuMTj}(KKK'KuMUj}(KKK'KuMVj}K'KsMWj}K KsMXj}(KKKKKKKKK KK KKKKKK#KK$KK&KK'KK(KK)KuMYj}K!KsMZj}KkKsM[j}(KKKKKKKKK KK KK#KK$KK&KK'KK(KK)KuM\j!}(KKKKKKKKKKK KK KKKKKKKK#KK$KK&KK'KK(KK)KuM]j)}K"KsM^j1}K"Ksulabels](KEMPTYKNKNMBNKNKNKNKNKNK2NK NKNKassertKbreakKclassKcontinueKdefKdelKexecKforKfromKglobalKifKimportKlambdaKnonlocalKnotKpassKprintKraiseKreturnKtryKwhileKwithKyieldKNK NK9NK8NKNKNKNM<NKNM2NKandK NMGNKNMNK NK$NK;NMNMFNM'NM&NMYNKNMJNM]NK NM0NMINKNMNK)NK*NK/NK'NK%NK&NK1NK(NK-NK.NK3NK,NK+NMNMENM#NKinMKNMNM4NMNKNKNKNKNKNKNKisM!NMNM NM NMNM)NMQNMWNMNMNMNMNMANKasMNMHNKexceptM[NKNMLNMNM NM8NM$NM NMNM:NM;NM^NKelseM6NK7NM1NKelifM*NM+NMNM,NM-NMSNMNM3NM5NMNKorMRNM NMPNK#NMNK"NM@NK NMNM=NMNMNM NM"NM%NM(NM.NM7NM9NM?NMCNKNKNKNKNK0NM/NMONMNNMMNMDNKfinallyMNMTNMVNMUNMXNMNK!NM\Nekeywords}(jK jK j Kj Kj KjKjKjKjKjKjKjKjKjKj!Kj#Kj%Kj'Kj)Kj+Kj-K j/K!j1K"j=K-jcKRjoK]j~KkjKnjK{jKjKjKutokens}(KKKKKKKKKKKKKKK2K K K KK KK#K K$K9K%K8K&KK'KK(KK)KK+K K.KK0K K2K$K3K;K4KK:K K=KK@K)KBK*KCK/KDK'KEK%KFK&KGK1KHK(KIK-KJK.KKK3KLK,KMK+KNKKWKKXKKYKKZKK[KK\KKpK7K}K#KK"KK KKKKKKKKKK0KK!Ku symbol2label}(stmtK shift_exprK*not_testK,testK/argumentK1comp_forK5termK6funcdefK7for_stmtK8 with_stmtK9 testlist_gexpK; yield_exprK< listmakerK> testlist1K? dictsetmakerKAarglistKOsuiteKPexprlistKQ testlist_safeKS comp_iterKTold_testKUcomp_ifKVexprK^comp_opK_ async_stmtK`classdefKa decoratedKbif_stmtKctry_stmtKd while_stmtKe decoratorsKf async_funcdefKg dotted_nameKh decoratorKi star_exprKjdotted_as_nameKltestlistKmxor_exprKotestlist_star_exprKq annassignKr augassignKspowerKtfactorKu break_stmtKv continue_stmtKw raise_stmtKx return_stmtKy yield_stmtKz parametersK|namedexpr_testK~import_as_nameKimport_as_namesKdotted_as_namesK import_fromK import_nameK varargslistK comparisonK old_lambdefKor_testKand_testK typedargslistKatomKtrailerK arith_exprK small_stmtK compound_stmtK simple_stmtK assert_stmtKdel_stmtK exec_stmtK expr_stmtK flow_stmtK global_stmtK import_stmtK pass_stmtK print_stmtKsliceopK subscriptKlambdefKtnameKtfplistKtfpdefK subscriptlistK except_clauseKvfpdefKvnameKvfplistK with_itemKand_exprK yield_argKustartMu.PK1]+P"" fixer_base.pynu[PK1] =Brr _pytree.pyonu[PK1]%asksk refactor.pynu[PK1]Pц 3__main__.pycnu[PK1]ι ! abtm_utils.pyonu[PK1]-~ )pygram.pynu[PK1]S[9[9{fixer_util.pyonu[PK1]FmFm Wpytree.pynu[PK1]~D>]>] refactor.pyonu[PK1]̽~Th]h]  "refactor.pycnu[PK1]G&&Grammar2.7.18.final.0.picklenu[PK1]"1 #__init__.pycnu[PK1]\ pygram.pyonu[PK1]PHg$fixer_base.pycnu[PK1]\  Apygram.pycnu[PK1]azCC F__main__.pynu[PK1]ڠ bGpatcomp.pycnu[PK1]  fapatcomp.pyonu[PK1]Pц 2z__main__.pyonu[PK1]R,N.N.`{main.pynu[PK1]fP`btm_matcher.pynu[PK1] PatternGrammar.txtnu[PK1]"1 ]__init__.pyonu[PK1]B!! Grammar.txtnu[PK1]kkIf;f; Kfixer_util.pynu[PK1]PHg%fixer_base.pyonu[PK1]!߭>Bbtm_matcher.pycnu[PK1]r$_v_v CYpytree.pycnu[PK1]sg&g&main.pycnu[PK1]!߭{btm_matcher.pyonu[PK1]S[9[9 fixer_util.pycnu[PK1].?&& Gbtm_utils.pynu[PK1]].nfixes/fix_metaclass.pycnu[PK1]6Bfixes/fix_ne.pycnu[PK1]e˺kfixes/fix_dict.pycnu[PK1]\g7''ffixes/fix_basestring.pyonu[PK1]{Wk՞fixes/fix_execfile.pynu[PK1]Pr  fixes/fix_itertools.pycnu[PK1]CTw nfixes/fix_renames.pycnu[PK1]WWZfixes/fix_long.pycnu[PK1]fixes/fix_throw.pyonu[PK1]p2I  fixes/fix_except.pynu[PK1]_;>cfixes/fix_set_literal.pyonu[PK1]d{fixes/fix_raw_input.pyonu[PK1]Z6  }fixes/fix_print.pynu[PK1]d{fixes/fix_raw_input.pycnu[PK1]v fixes/fix_map.pycnu[PK1]!x PPfixes/fix_zip.pycnu[PK1]N2Efixes/fix_xreadlines.pynu[PK1]Jfixes/fix_exec.pycnu[PK1]!x PPjfixes/fix_zip.pyonu[PK1]+&^^ fixes/fix_methodattrs.pynu[PK1]?kfixes/fix_getcwdu.pynu[PK1]5 fixes/fix_exitfunc.pycnu[PK1]=fixes/fix_asserts.pynu[PK1]WW fixes/fix_long.pyonu[PK1]6ng h$fixes/fix_import.pynu[PK1]ܾc1fixes/fix_xreadlines.pyonu[PK1]1Wl96fixes/fix_sys_exc.pyonu[PK1] 7=fixes/fix_urllib.pynu[PK1]?յ )^fixes/fix_import.pycnu[PK1])xx"kfixes/fix_intern.pynu[PK1]8|gofixes/fix_execfile.pyonu[PK1]t>xfixes/fix_asserts.pycnu[PK1]cۛ~fixes/fix_metaclass.pyonu[PK1]?OO~fixes/fix_nonzero.pynu[PK1]a.eefixes/fix_repr.pynu[PK1]tڢfixes/fix_buffer.pyonu[PK1]RRfixes/fix_numliterals.pycnu[PK1]M1  fixes/fix_zip.pynu[PK1]0||Bfixes/fix_input.pyonu[PK1]2ۭfixes/fix_renames.pynu[PK1]fixes/fix_future.pyonu[PK1]>ӵ;&&۽fixes/fix_itertools_imports.pynu[PK1]Ofixes/fix_operator.pyonu[PK1]DIu| | fixes/fix_has_key.pynu[PK1]6usfixes/fix_raw_input.pynu[PK1])EEfixes/fix_reduce.pynu[PK1]ؒfixes/__init__.pycnu[PK1]CTw fixes/fix_renames.pyonu[PK1]\fixes/fix_unicode.pycnu[PK1]_;>fixes/fix_set_literal.pycnu[PK1]_ \  fixes/fix_idioms.pynu[PK1],b /fixes/fix_raise.pyonu[PK1]&B$fixes/fix_unicode.pynu[PK1]Y  n)fixes/fix_metaclass.pynu[PK1]FIfixes/fix_funcattrs.pynu[PK1]:C ttLfixes/fix_ws_comma.pycnu[PK1]=n n =Rfixes/fix_raise.pynu[PK1]Z]fixes/fix_itertools_imports.pyonu[PK1]~&efixes/fix_urllib.pycnu[PK1]ucc9fixes/fix_standarderror.pycnu[PK1]誔* * fixes/fix_apply.pynu[PK1]5 Sfixes/fix_exitfunc.pyonu[PK1]HgHH^fixes/fix_isinstance.pynu[PK1]:C ttfixes/fix_ws_comma.pyonu[PK1]\g7''fixes/fix_basestring.pycnu[PK1]s<<fixes/fix_isinstance.pyonu[PK1]fϡfixes/fix_set_literal.pynu[PK1]Rfixes/fix_imports.pyonu[PK1]cfixes/fix_filter.pycnu[PK1] fixes/fix_except.pyonu[PK1]xA fixes/fix_next.pyonu[PK1]<;;fixes/fix_ne.pynu[PK1]tڢqfixes/fix_buffer.pycnu[PK1]Hmyfixes/fix_itertools_imports.pycnu[PK1]?յ fixes/fix_import.pyonu[PK1]G~Z fixes/fix_repr.pycnu[PK1]ifixes/fix_idioms.pycnu[PK1]ucc"fixes/fix_standarderror.pyonu[PK1]&fixes/fix_operator.pycnu[PK1]mU;fixes/fix_paren.pycnu[PK1]Gg  ^Afixes/fix_itertools.pynu[PK1]Tv˒RRGfixes/fix_tuple_params.pyonu[PK1]L]fixes/fix_future.pycnu[PK1]ĸ&5afixes/fix_methodattrs.pyonu[PK1]tefixes/fix_asserts.pyonu[PK1]mU\lfixes/fix_paren.pyonu[PK1]Ҋ<<rfixes/fix_execfile.pycnu[PK1]ʿ>16{fixes/fix_paren.pynu[PK1]ؒBfixes/__init__.pyonu[PK1]QQ fixes/fix_idioms.pyonu[PK1]Pr  fixes/fix_itertools.pyonu[PK1]҇ fixes/fix_print.pycnu[PK1]ĸ&fixes/fix_methodattrs.pycnu[PK1]&[  fixes/fix_xrange.pycnu[PK1]}ׄLLfixes/fix_nonzero.pycnu[PK1] ] ] fixes/fix_has_key.pyonu[PK1]c;fixes/fix_filter.pyonu[PK1] 2Ϳ ]fixes/fix_exitfunc.pynu[PK1]G~Zafixes/fix_repr.pyonu[PK1]&[  fixes/fix_xrange.pyonu[PK1],V V fixes/fix_print.pyonu[PK1]s<<fixes/fix_isinstance.pycnu[PK1]dsfixes/fix_dict.pynu[PK1]IkNf f  fixes/fix_next.pynu[PK1]k(Pzz fixes/fix_imports2.pycnu[PK1]NNq fixes/fix_buffer.pynu[PK1]sGћ fixes/fix_getcwdu.pyonu[PK1]v ! fixes/fix_map.pyonu[PK1]sGћ". fixes/fix_getcwdu.pycnu[PK1]u 2 fixes/fix_next.pycnu[PK1]68@ fixes/fix_ne.pyonu[PK1]iGaD fixes/fix_long.pynu[PK1]ܾ~F fixes/fix_xreadlines.pycnu[PK1]ܬ'!!TK fixes/fix_imports2.pynu[PK1]JL fixes/fix_types.pyonu[PK1]Tv˒RRU fixes/fix_tuple_params.pycnu[PK1]m)ĥ;k fixes/fix_reduce.pycnu[PK1]4 {p fixes/fix_apply.pyonu[PK1]_}<<x fixes/fix_dict.pyonu[PK1]%TW688? fixes/fix_map.pynu[PK1]: fixes/fix_exec.pynu[PK1]7h##˙ fixes/fix_future.pynu[PK1]k(Pzz1 fixes/fix_imports2.pyonu[PK1] |44 fixes/fix_imports.pynu[PK1]C i fixes/fix_xrange.pynu[PK1]5Y 2 fixes/fix_filter.pynu[PK1] `pwwB fixes/fix_exec.pyonu[PK1]m)ĥ fixes/fix_reduce.pyonu[PK1]޽; fixes/fix_standarderror.pynu[PK1]xWF fixes/fix_intern.pyonu[PK1]|b b  fixes/fix_operator.pynu[PK1]JbBB6 fixes/fix_ws_comma.pynu[PK1]1Wl fixes/fix_sys_exc.pycnu[PK1]J fixes/fix_types.pycnu[PK1]}ׄLL fixes/fix_nonzero.pyonu[PK1]xu..1 fixes/fix_throw.pynu[PK1]RR fixes/fix_numliterals.pyonu[PK1]I   fixes/fix_sys_exc.pynu[PK1]~&) fixes/fix_urllib.pyonu[PK1]q|e2 fixes/fix_input.pynu[PK1]k5 fixes/fix_throw.pycnu[PK1],b = fixes/fix_raise.pycnu[PK1] G fixes/fix_except.pycnu[PK1]E[//S fixes/__init__.pynu[PK1]6zhhT fixes/fix_funcattrs.pyonu[PK1]SX fixes/fix_types.pynu[PK1]R_ fixes/fix_imports.pycnu[PK1]0||8u fixes/fix_input.pycnu[PK1]6zhhy fixes/fix_funcattrs.pycnu[PK1]\~ fixes/fix_unicode.pyonu[PK1]M@@ fixes/fix_basestring.pynu[PK1]lH6 fixes/fix_numliterals.pynu[PK1]xW~ fixes/fix_intern.pycnu[PK1]-$$Ǒ fixes/fix_apply.pycnu[PK1]O+. fixes/fix_tuple_params.pynu[PK1]V%e~ ~ 4 fixes/fix_has_key.pycnu[PK1]&* pgen2/literals.pyonu[PK1]mqcc3 pgen2/literals.pynu[PK1]qC// pgen2/pgen.pycnu[PK1]Ci-i- pgen2/pgen.pyonu[PK1]??( pgen2/driver.pycnu[PK1]( B pgen2/token.pyonu[PK1]ʼnGK pgen2/conv.pycnu[PK1]K%k pgen2/__init__.pycnu[PK1]U rl pgen2/grammar.pycnu[PK1]A'He pgen2/parse.pyonu[PK1]2 pgen2/parse.pynu[PK1]6pDD, pgen2/parse.pycnu[PK1]K% pgen2/__init__.pyonu[PK1]( pgen2/token.pycnu[PK1]U  pgen2/grammar.pyonu[PK1]k3" pgen2/grammar.pynu[PK1]fwc}}" pgen2/conv.pyonu[PK1]%% = pgen2/conv.pynu[PK1] c pgen2/literals.pycnu[PK1]rRRk pgen2/tokenize.pynu[PK1]ф pgen2/driver.pyonu[PK1]lp66  pgen2/pgen.pynu[PK1]r pgen2/__init__.pynu[PK1]%oQQ pgen2/driver.pynu[PK1]>FAA{& pgen2/tokenize.pyonu[PK1]yW ))h pgen2/token.pynuȯPK1]fuKBKBn pgen2/tokenize.pycnu[PK1] # PatternGrammar2.7.18.final.0.picklenu[PK1]y  patcomp.pynu[PK1]  __init__.pynu[PK1]ι !  btm_utils.pycnu[PK1]?0=&=&L main.pyonu[PKm;1]--"PatternGrammar3.6.8.final.0.picklenu[PKm;1]S/ }}@%Grammar3.6.8.final.0.picklenu[PKm;1]WWW%__pycache__/main.cpython-36.opt-2.pycnu[PKm;1]váFAFA)3__pycache__/refactor.cpython-36.opt-2.pycnu[PKm;1]Q__'__pycache__/pytree.cpython-36.opt-1.pycnu[PKm;1]euf"___pycache__/patcomp.cpython-36.pycnu[PKm;1]))]QQ%u__pycache__/fixer_base.cpython-36.pycnu[PKm;1]0'?QQ)__pycache__/refactor.cpython-36.opt-1.pycnu[PKm;1]Zr~#__pycache__/__main__.cpython-36.pycnu[PKm;1]4PT!T!__pycache__/main.cpython-36.pycnu[PKm;1]{K{{)__pycache__/__init__.cpython-36.opt-1.pycnu[PKm;1]\!Y(__pycache__/patcomp.cpython-36.opt-1.pycnu[PKm;1]O'__pycache__/pygram.cpython-36.opt-2.pycnu[PKm;1]7`4$__pycache__/btm_utils.cpython-36.pycnu[PKm;1]" &&+@5__pycache__/fixer_util.cpython-36.opt-2.pycnu[PKm;1]2!2!%)\__pycache__/main.cpython-36.opt-1.pycnu[PKm;1]`l::'}__pycache__/pytree.cpython-36.opt-2.pycnu[PKm;1]/?d//%ָ__pycache__/fixer_util.cpython-36.pycnu[PKm;1]ѝ*1__pycache__/btm_utils.cpython-36.opt-2.pycnu[PKm;1] EFF&__pycache__/btm_matcher.cpython-36.pycnu[PKm;1]ffhh)gfixes/__pycache__/fix_exec.cpython-36.pycnu[PKm;1]6H776(fixes/__pycache__/fix_set_literal.cpython-36.opt-2.pycnu[PKm;1] OO+Ŭfixes/__pycache__/fix_urllib.cpython-36.pycnu[PKm;1] UU+ofixes/__pycache__/fix_reduce.cpython-36.pycnu[PKm;1]tu551fixes/__pycache__/fix_reload.cpython-36.opt-2.pycnu[PKm;1] 'O!.fixes/__pycache__/fix_funcattrs.cpython-36.pycnu[PKm;1]Ndd2fixes/__pycache__/fix_sys_exc.cpython-36.opt-1.pycnu[PKm;1]]fEE0fixes/__pycache__/fix_raise.cpython-36.opt-2.pycnu[PKm;1] ~aNN37fixes/__pycache__/fix_ws_comma.cpython-36.opt-1.pycnu[PKm;1]D.?446fixes/__pycache__/fix_itertools_imports.cpython-36.pycnu[PKm;1]Ѐ2fixes/__pycache__/fix_standarderror.cpython-36.pycnu[PKm;1] ~aNN-fixes/__pycache__/fix_ws_comma.cpython-36.pycnu[PKm;1]sLUU5Jfixes/__pycache__/fix_basestring.cpython-36.opt-2.pycnu[PKm;1]؈]]4fixes/__pycache__/fix_metaclass.cpython-36.opt-2.pycnu[PKm;1]&"<fixes/__pycache__/fix_itertools_imports.cpython-36.opt-2.pycnu[PKm;1]Yٜxx- fixes/__pycache__/fix_operator.cpython-36.pycnu[PKm;1]7-fixes/__pycache__/fix_ne.cpython-36.opt-2.pycnu[PKm;1]j,fixes/__pycache__/fix_unicode.cpython-36.pycnu[PKm;1]Xz..T$fixes/__pycache__/fix_map.cpython-36.opt-2.pycnu[PKm;1]Cpb*-fixes/__pycache__/fix_raise.cpython-36.pycnu[PKm;1]^.6fixes/__pycache__/fix_metaclass.cpython-36.pycnu[PKm;1]Qv /Kfixes/__pycache__/fix_next.cpython-36.opt-2.pycnu[PKm;1]O 1Wfixes/__pycache__/fix_xrange.cpython-36.opt-1.pycnu[PKm;1]Ѐ8bfixes/__pycache__/fix_standarderror.cpython-36.opt-1.pycnu[PKm;1]:\NN/)efixes/__pycache__/fix_exec.cpython-36.opt-1.pycnu[PKm;1]Zļ0ifixes/__pycache__/fix_apply.cpython-36.opt-2.pycnu[PKm;1]̻*Opfixes/__pycache__/fix_apply.cpython-36.pycnu[PKm;1]폏/6wfixes/__pycache__/__init__.cpython-36.opt-1.pycnu[PKm;1].xfixes/__pycache__/fix_raw_input.cpython-36.pycnu[PKm;1]?dd2z{fixes/__pycache__/fix_renames.cpython-36.opt-2.pycnu[PKm;1]!i 1@fixes/__pycache__/fix_idioms.cpython-36.opt-2.pycnu[PKm;1]U3fixes/__pycache__/fix_exitfunc.cpython-36.opt-2.pycnu[PKm;1]Ⱥ,fixes/__pycache__/fix_asserts.cpython-36.pycnu[PKm;1]"^%*͞fixes/__pycache__/fix_throw.cpython-36.pycnu[PKm;1]K.fixes/__pycache__/fix_itertools.cpython-36.pycnu[PKm;1]o>1wfixes/__pycache__/fix_idioms.cpython-36.opt-1.pycnu[PKm;1]ȽHH5fixes/__pycache__/fix_xreadlines.cpython-36.opt-1.pycnu[PKm;1]+8nL 1cfixes/__pycache__/fix_import.cpython-36.opt-2.pycnu[PKm;1]6#3ll/^fixes/__pycache__/fix_long.cpython-36.opt-2.pycnu[PKm;1]نuu1)fixes/__pycache__/fix_intern.cpython-36.opt-1.pycnu[PKm;1]ȽHH/fixes/__pycache__/fix_xreadlines.cpython-36.pycnu[PKm;1]qXF,fixes/__pycache__/fix_renames.cpython-36.pycnu[PKm;1]/Za/fixes/__pycache__/fix_repr.cpython-36.opt-2.pycnu[PKm;1]9ss0 fixes/__pycache__/fix_apply.cpython-36.opt-1.pycnu[PKm;1]l5 5 2fixes/__pycache__/fix_has_key.cpython-36.opt-1.pycnu[PKm;1]^\4wfixes/__pycache__/fix_raw_input.cpython-36.opt-2.pycnu[PKm;1]rD0fixes/__pycache__/fix_methodattrs.cpython-36.pycnu[PKm;1]> +fixes/__pycache__/fix_future.cpython-36.pycnu[PKm;1]&Fam2fixes/__pycache__/fix_getcwdu.cpython-36.opt-1.pycnu[PKm;1]Ȍ +Hfixes/__pycache__/fix_import.cpython-36.pycnu[PKm;1]>GG6t fixes/__pycache__/fix_methodattrs.cpython-36.opt-2.pycnu[PKm;1]5ڍ_ (!fixes/__pycache__/fix_map.cpython-36.pycnu[PKm;1]T|7yfixes/__pycache__/fix_tuple_params.cpython-36.opt-1.pycnu[PKm;1]#0/fixes/__pycache__/fix_numliterals.cpython-36.pycnu[PKm;1]qXF24fixes/__pycache__/fix_renames.cpython-36.opt-1.pycnu[PKm;1]T|1%<fixes/__pycache__/fix_tuple_params.cpython-36.pycnu[PKm;1]*wGV0eNfixes/__pycache__/fix_print.cpython-36.opt-2.pycnu[PKm;1] W@-\Vfixes/__pycache__/fix_imports2.cpython-36.pycnu[PKm;1]g24Xfixes/__pycache__/fix_itertools.cpython-36.opt-2.pycnu[PKn;1]k/0]fixes/__pycache__/fix_types.cpython-36.opt-1.pycnu[PKn;1]8ڒ'1efixes/__pycache__/fix_ne.cpython-36.pycnu[PKn;1]/hfixes/__pycache__/fix_basestring.cpython-36.pycnu[PKn;1]C2{kfixes/__pycache__/fix_sys_exc.cpython-36.opt-2.pycnu[PKn;1]8`6pfixes/__pycache__/fix_set_literal.cpython-36.opt-1.pycnu[PKn;1]w(wfixes/__pycache__/fix_zip.cpython-36.pycnu[PKn;1]8}fixes/__pycache__/fix_standarderror.cpython-36.opt-2.pycnu[PKn;1]{4,݀fixes/__pycache__/fix_nonzero.cpython-36.pycnu[PKn;1]4PXX1fixes/__pycache__/fix_filter.cpython-36.opt-2.pycnu[PKn;1]Yٜxx3xfixes/__pycache__/fix_operator.cpython-36.opt-1.pycnu[PKn;1] 'O!4Sfixes/__pycache__/fix_funcattrs.cpython-36.opt-1.pycnu[PKn;1]8`0pfixes/__pycache__/fix_set_literal.cpython-36.pycnu[PKn;1]ZO#/KK2Rfixes/__pycache__/fix_nonzero.cpython-36.opt-2.pycnu[PKn;1]3\\0fixes/__pycache__/fix_input.cpython-36.opt-2.pycnu[PKn;1]&Fam,fixes/__pycache__/fix_getcwdu.cpython-36.pycnu[PKn;1]A uu+fixes/__pycache__/fix_reload.cpython-36.pycnu[PKn;1] OO1fixes/__pycache__/fix_urllib.cpython-36.opt-1.pycnu[PKn;1]Ⱥ2fixes/__pycache__/fix_asserts.cpython-36.opt-1.pycnu[PKn;1].]551fixes/__pycache__/fix_intern.cpython-36.opt-2.pycnu[PKn;1]Zq /rfixes/__pycache__/fix_dict.cpython-36.opt-1.pycnu[PKn;1] W@3kfixes/__pycache__/fix_imports2.cpython-36.opt-1.pycnu[PKn;1]tҵ02fixes/__pycache__/fix_asserts.cpython-36.opt-2.pycnu[PKn;1]5fixes/__pycache__/fix_basestring.cpython-36.opt-1.pycnu[PKn;1]a;888)fixes/__pycache__/fix_repr.cpython-36.pycnu[PKn;1]y )Ufixes/__pycache__/fix_next.cpython-36.pycnu[PKn;1]O +fixes/__pycache__/fix_xrange.cpython-36.pycnu[PKn;1]A uu1 fixes/__pycache__/fix_reload.cpython-36.opt-1.pycnu[PKn;1]R2P91fixes/__pycache__/fix_future.cpython-36.opt-2.pycnu[PKn;1]j2fixes/__pycache__/fix_unicode.cpython-36.opt-1.pycnu[PKn;1]9z*fixes/__pycache__/fix_input.cpython-36.pycnu[PKn;1]rD6fixes/__pycache__/fix_methodattrs.cpython-36.opt-1.pycnu[PKn;1]Ndd, fixes/__pycache__/fix_sys_exc.cpython-36.pycnu[PKn;1]4&fixes/__pycache__/fix_raw_input.cpython-36.opt-1.pycnu[PKn;1]w2l4)fixes/__pycache__/fix_metaclass.cpython-36.opt-1.pycnu[PKn;1]G$ $ 1 ?fixes/__pycache__/fix_filter.cpython-36.opt-1.pycnu[PKn;1]\<ֶ0Hfixes/__pycache__/fix_print.cpython-36.opt-1.pycnu[PKn;1]dL2Qfixes/__pycache__/fix_imports.cpython-36.opt-2.pycnu[PKn;1]C 1bfixes/__pycache__/fix_xrange.cpython-36.opt-2.pycnu[PKn;1]"*)lfixes/__pycache__/fix_long.cpython-36.pycnu[PKn;1]YY*ofixes/__pycache__/fix_paren.cpython-36.pycnu[PKn;1]9xx3sufixes/__pycache__/fix_execfile.cpython-36.opt-1.pycnu[PKn;1]w.N|fixes/__pycache__/fix_zip.cpython-36.opt-1.pycnu[PKn;1]a;888/Ăfixes/__pycache__/fix_repr.cpython-36.opt-1.pycnu[PKn;1] UU1[fixes/__pycache__/fix_reduce.cpython-36.opt-1.pycnu[PKn;1] `1fixes/__pycache__/fix_reduce.cpython-36.opt-2.pycnu[PKn;1]:~.Efixes/__pycache__/fix_zip.cpython-36.opt-2.pycnu[PKn;1] /pfixes/__pycache__/fix_next.cpython-36.opt-1.pycnu[PKn;1]ݛuu4fixes/__pycache__/fix_funcattrs.cpython-36.opt-2.pycnu[PKn;1]a5kfixes/__pycache__/fix_isinstance.cpython-36.opt-1.pycnu[PKn;1].]  *Ӫfixes/__pycache__/fix_print.cpython-36.pycnu[PKn;1]7N52fixes/__pycache__/fix_xreadlines.cpython-36.opt-2.pycnu[PKn;1]/Ii2^fixes/__pycache__/fix_getcwdu.cpython-36.opt-2.pycnu[PKn;1]^D:<}fixes/__pycache__/fix_itertools_imports.cpython-36.opt-1.pycnu[PKn;1]3fixes/__pycache__/fix_operator.cpython-36.opt-2.pycnu[PKn;1]G**+fixes/__pycache__/fix_idioms.cpython-36.pycnu[PKn;1]"^%0rfixes/__pycache__/fix_throw.cpython-36.opt-1.pycnu[PKn;1]폏/fixes/__pycache__/__init__.cpython-36.opt-2.pycnu[PKn;1]CyF0fixes/__pycache__/fix_paren.cpython-36.opt-2.pycnu[PKn;1]7fixes/__pycache__/fix_tuple_params.cpython-36.opt-2.pycnu[PKn;1]I4-fixes/__pycache__/fix_exitfunc.cpython-36.pycnu[PKn;1]a/fixes/__pycache__/fix_isinstance.cpython-36.pycnu[PKn;1]G$ $ +tfixes/__pycache__/fix_filter.cpython-36.pycnu[PKn;1]E3-fixes/__pycache__/fix_execfile.cpython-36.pycnu[PKn;1]a3fixes/__pycache__/fix_ws_comma.cpython-36.opt-2.pycnu[PKn;1]> 1"fixes/__pycache__/fix_future.cpython-36.opt-1.pycnu[PKn;1]Cpb07&fixes/__pycache__/fix_raise.cpython-36.opt-1.pycnu[PKn;1]hRN/K/fixes/__pycache__/fix_exec.cpython-36.opt-2.pycnu[PKn;1]+??2R3fixes/__pycache__/fix_unicode.cpython-36.opt-2.pycnu[PKn;1]~6608fixes/__pycache__/fix_types.cpython-36.opt-2.pycnu[PKn;1]k/*>fixes/__pycache__/fix_types.cpython-36.pycnu[PKn;1]Ȍ 1Efixes/__pycache__/fix_import.cpython-36.opt-1.pycnu[PKn;1]N )%Qfixes/__pycache__/fix_dict.cpython-36.pycnu[PKn;1]I43l^fixes/__pycache__/fix_exitfunc.cpython-36.opt-1.pycnu[PKn;1]k-O +gfixes/__pycache__/fix_except.cpython-36.pycnu[PKn;1]K4rfixes/__pycache__/fix_itertools.cpython-36.opt-1.pycnu[PKn;1]5ڍ_ .[yfixes/__pycache__/fix_map.cpython-36.opt-1.pycnu[PKn;1]m23fixes/__pycache__/fix_execfile.cpython-36.opt-2.pycnu[PKn;1]9z0fixes/__pycache__/fix_input.cpython-36.opt-1.pycnu[PKn;1]"*/fixes/__pycache__/fix_long.cpython-36.opt-1.pycnu[PKn;1]T6 fixes/__pycache__/fix_numliterals.cpython-36.opt-2.pycnu[PKn;1]Kt!!18fixes/__pycache__/fix_urllib.cpython-36.opt-2.pycnu[PKn;1]k-O 1fixes/__pycache__/fix_except.cpython-36.opt-1.pycnu[PKn;1]911fixes/__pycache__/fix_buffer.cpython-36.opt-2.pycnu[PKn;1]%ځ,7fixes/__pycache__/fix_imports.cpython-36.pycnu[PKn;1]%ځ2{fixes/__pycache__/fix_imports.cpython-36.opt-1.pycnu[PKn;1]2fixes/__pycache__/fix_has_key.cpython-36.opt-2.pycnu[PKn;1]!ZH/ / 1"fixes/__pycache__/fix_except.cpython-36.opt-2.pycnu[PKn;1]oH+Q Q ,fixes/__pycache__/fix_has_key.cpython-36.pycnu[PKn;1]+_fixes/__pycache__/fix_buffer.cpython-36.pycnu[PKn;1]폏)fixes/__pycache__/__init__.cpython-36.pycnu[PKn;1]aI䖪3fixes/__pycache__/fix_imports2.cpython-36.opt-2.pycnu[PKn;1]r399fixes/fix_reload.pynu[PKn;1]8BB/0pgen2/__pycache__/literals.cpython-36.opt-1.pycnu[PKn;1]E& pgen2/__pycache__/parse.cpython-36.pycnu[PKn;1].%pgen2/__pycache__/grammar.cpython-36.opt-1.pycnu[PKn;1]!>-Apgen2/__pycache__/driver.cpython-36.opt-1.pycnu[PKn;1](/Vpgen2/__pycache__/__init__.cpython-36.opt-1.pycnu[PKn;1]S<<,Wpgen2/__pycache__/token.cpython-36.opt-1.pycnu[PKn;1]*u$u$+^pgen2/__pycache__/pgen.cpython-36.opt-1.pycnu[PKn;1].9&9&%jpgen2/__pycache__/pgen.cpython-36.pycnu[PKn;1]mS-pgen2/__pycache__/driver.cpython-36.opt-2.pycnu[PKn;1]qM .pgen2/__pycache__/grammar.cpython-36.opt-2.pycnu[PKn;1] PP+!pgen2/__pycache__/conv.cpython-36.opt-2.pycnu[PKn;1]   ,pgen2/__pycache__/parse.cpython-36.opt-2.pycnu[PKn;1]&w,w,/.pgen2/__pycache__/tokenize.cpython-36.opt-2.pycnu[PKn;1]v];;/pgen2/__pycache__/tokenize.cpython-36.opt-1.pycnu[PKn;1]_Ϩ  ,5Kpgen2/__pycache__/token.cpython-36.opt-2.pycnu[PKn;1]S<<&Rpgen2/__pycache__/token.cpython-36.pycnu[PKn;1]5f,-Zpgen2/__pycache__/parse.cpython-36.opt-1.pycnu[PKn;1]z/$spgen2/__pycache__/__init__.cpython-36.opt-2.pycnu[PKn;1]1)tpgen2/__pycache__/literals.cpython-36.pycnu[PKn;1]*u$u$+]zpgen2/__pycache__/pgen.cpython-36.opt-2.pycnu[PKn;1]6!+-pgen2/__pycache__/conv.cpython-36.opt-1.pycnu[PKn;1]&{/pgen2/__pycache__/literals.cpython-36.opt-2.pycnu[PKn;1]Fxx%pgen2/__pycache__/conv.cpython-36.pycnu[PKn;1](pgen2/__pycache__/grammar.cpython-36.pycnu[PKn;1]()pgen2/__pycache__/__init__.cpython-36.pycnu[PKn;1][-'pgen2/__pycache__/driver.cpython-36.pycnu[PKn;1]Սp<<) pgen2/__pycache__/tokenize.cpython-36.pycnu[PKz1]I*`F__pycache__/__main__.cpython-312.opt-2.pycnu[PKz1]f U U&G__pycache__/fixer_util.cpython-312.pycnu[PKz1]G!ff"E__pycache__/pygram.cpython-312.pycnu[PKz1]qlSS,__pycache__/fixer_base.cpython-312.opt-2.pycnu[PKz1]fZZ$__pycache__/__init__.cpython-312.pycnu[PKz1]z&Z__pycache__/fixer_base.cpython-312.pycnu[PKz1] N+N++o__pycache__/btm_utils.cpython-312.opt-1.pycnu[PKz1]2چԈ"__pycache__/pytree.cpython-312.pycnu[PKz1]I*__pycache__/__main__.cpython-312.opt-1.pycnu[PKz1]V "")a__pycache__/patcomp.cpython-312.opt-2.pycnu[PKz1]1c[$__pycache__/refactor.cpython-312.pycnu[PKz1]))%%+ 9__pycache__/btm_utils.cpython-312.opt-2.pycnu[PKz1]5+HMHM,^__pycache__/fixer_util.cpython-312.opt-2.pycnu[PKz1]p;&&#__pycache__/patcomp.cpython-312.pycnu[PKz1]2'66&__pycache__/main.cpython-312.opt-1.pycnu[PKz1]' __pycache__/btm_matcher.cpython-312.pycnu[PKz1]RUυυ*'__pycache__/refactor.cpython-312.opt-1.pycnu[PKz1]- __pycache__/btm_matcher.cpython-312.opt-1.pycnu[PKz1]f U U,__pycache__/fixer_util.cpython-312.opt-1.pycnu[PKz1] -z __pycache__/btm_matcher.cpython-312.opt-2.pycnu[PKz1]$$)o7__pycache__/patcomp.cpython-312.opt-1.pycnu[PKz1]fZZ*\__pycache__/__init__.cpython-312.opt-1.pycnu[PKz1]fZZ*>^__pycache__/__init__.cpython-312.opt-2.pycnu[PKz1]޶:vv*___pycache__/refactor.cpython-312.opt-2.pycnu[PKz1]G!ff(__pycache__/pygram.cpython-312.opt-1.pycnu[PKz1] N+N+%__pycache__/btm_utils.cpython-312.pycnu[PKz1]Kdaa(E __pycache__/pytree.cpython-312.opt-2.pycnu[PKz1]I$k__pycache__/__main__.cpython-312.pycnu[PKz1]Zӝ(#m__pycache__/pygram.cpython-312.opt-2.pycnu[PKz1]T/(t__pycache__/pytree.cpython-312.opt-1.pycnu[PKz1]z,__pycache__/fixer_base.cpython-312.opt-1.pycnu[PKz1]//&2__pycache__/main.cpython-312.opt-2.pycnu[PKz1]1ɖ66 E__pycache__/main.cpython-312.pycnu[PKz1]>$|PatternGrammar3.12.14.final.0.picklenu[PKz1] ;;݁Grammar3.12.14.final.0.picklenu[PKz1]+##2fixes/__pycache__/fix_urllib.cpython-312.opt-1.pycnu[PKz1]]ž((/fixes/__pycache__/fix_metaclass.cpython-312.pycnu[PKz1] n n 15 fixes/__pycache__/fix_apply.cpython-312.opt-2.pycnu[PKz1]+##, fixes/__pycache__/fix_urllib.cpython-312.pycnu[PKz1]P =: fixes/__pycache__/fix_itertools_imports.cpython-312.opt-2.pycnu[PKz1]*e7 7 +zD fixes/__pycache__/fix_raise.cpython-312.pycnu[PKz1]9D9 R fixes/__pycache__/fix_standarderror.cpython-312.opt-2.pycnu[PKz1]cLL8U fixes/__pycache__/fix_tuple_params.cpython-312.opt-2.pycnu[PKz1]so18s fixes/__pycache__/fix_types.cpython-312.opt-1.pycnu[PKz1]8mm3~| fixes/__pycache__/fix_getcwdu.cpython-312.opt-2.pycnu[PKz1]2N fixes/__pycache__/fix_buffer.cpython-312.opt-1.pycnu[PKz1][56r fixes/__pycache__/fix_basestring.cpython-312.opt-1.pycnu[PKz1]Q>  .܇ fixes/__pycache__/fix_ne.cpython-312.opt-1.pycnu[PKz1]Ziߊ2G fixes/__pycache__/fix_reload.cpython-312.opt-1.pycnu[PKz1]Rb +3 fixes/__pycache__/fix_throw.cpython-312.pycnu[PKz1]O2 fixes/__pycache__/fix_buffer.cpython-312.opt-2.pycnu[PKz1]~A\2 fixes/__pycache__/fix_xrange.cpython-312.opt-1.pycnu[PKz1]G8F fixes/__pycache__/fix_tuple_params.cpython-312.opt-1.pycnu[PKz1]bRR5D fixes/__pycache__/fix_itertools.cpython-312.opt-2.pycnu[PKz1]xr) fixes/__pycache__/fix_zip.cpython-312.pycnu[PKz1]^>50 fixes/__pycache__/fix_dict.cpython-312.opt-1.pycnu[PKz1]~Y3 fixes/__pycache__/fix_sys_exc.cpython-312.opt-1.pycnu[PKz1],4 fixes/__pycache__/fix_buffer.cpython-312.pycnu[PKz1]L-R fixes/__pycache__/fix_getcwdu.cpython-312.pycnu[PKz1])yѐ*Z fixes/__pycache__/__init__.cpython-312.pycnu[PKz1] 7D!fixes/__pycache__/fix_itertools_imports.cpython-312.pycnu[PKz1]EE2? !fixes/__pycache__/fix_reduce.cpython-312.opt-2.pycnu[PKz1]B]4!fixes/__pycache__/fix_operator.cpython-312.opt-1.pycnu[PKz1]+ȳr4;&!fixes/__pycache__/fix_ws_comma.cpython-312.opt-1.pycnu[PKz1]ⷫ2,!fixes/__pycache__/fix_idioms.cpython-312.opt-1.pycnu[PKz1] 1A!fixes/__pycache__/fix_paren.cpython-312.opt-2.pycnu[PKz1]xE4~~2H!fixes/__pycache__/fix_intern.cpython-312.opt-1.pycnu[PKz1]6M!fixes/__pycache__/fix_basestring.cpython-312.opt-2.pycnu[PKz1]t#3'Q!fixes/__pycache__/fix_asserts.cpython-312.opt-1.pycnu[PKz1]K َ3W!fixes/__pycache__/fix_asserts.cpython-312.opt-2.pycnu[PKz1]35]!fixes/__pycache__/fix_funcattrs.cpython-312.opt-1.pycnu[PKz1] /b!fixes/__pycache__/fix_map.cpython-312.opt-1.pycnu[PKz1],t!fixes/__pycache__/fix_future.cpython-312.pycnu[PKz1]x8*lx!fixes/__pycache__/fix_dict.cpython-312.pycnu[PKz1]q6!fixes/__pycache__/fix_xreadlines.cpython-312.opt-2.pycnu[PKz1]vv-!fixes/__pycache__/fix_unicode.cpython-312.pycnu[PKz1]\* .i!fixes/__pycache__/fix_exitfunc.cpython-312.pycnu[PKz1]2!fixes/__pycache__/fix_future.cpython-312.opt-1.pycnu[PKz1]}((0!fixes/__pycache__/fix_repr.cpython-312.opt-2.pycnu[PKz1]_badd03!fixes/__pycache__/fix_repr.cpython-312.opt-1.pycnu[PKz1]`#1!fixes/__pycache__/fix_types.cpython-312.opt-2.pycnu[PKz1]' ' 6g!fixes/__pycache__/fix_isinstance.cpython-312.opt-1.pycnu[PKz1]Smm3!fixes/__pycache__/fix_has_key.cpython-312.opt-1.pycnu[PKz1]o8||-!fixes/__pycache__/fix_has_key.cpython-312.pycnu[PKz1]G2!fixes/__pycache__/fix_tuple_params.cpython-312.pycnu[PKz1]44-"fixes/__pycache__/fix_nonzero.cpython-312.pycnu[PKz1]\61& "fixes/__pycache__/fix_numliterals.cpython-312.pycnu[PKz1]vv3"fixes/__pycache__/fix_unicode.cpython-312.opt-1.pycnu[PKz1]j`0]]7"fixes/__pycache__/fix_numliterals.cpython-312.opt-2.pycnu[PKz1]xE4~~,"fixes/__pycache__/fix_intern.cpython-312.pycnu[PKz1]A5pp2$"fixes/__pycache__/fix_import.cpython-312.opt-2.pycnu[PKz1]4g4"fixes/__pycache__/fix_operator.cpython-312.opt-2.pycnu[PKz1]/oRqq5H"fixes/__pycache__/fix_raw_input.cpython-312.opt-2.pycnu[PKz1]/5V0L"fixes/__pycache__/fix_dict.cpython-312.opt-2.pycnu[PKz1][50 ["fixes/__pycache__/fix_basestring.cpython-312.pycnu[PKz1]J0^"fixes/__pycache__/fix_next.cpython-312.opt-1.pycnu[PKz1]haҰ,,2o"fixes/__pycache__/fix_future.cpython-312.opt-2.pycnu[PKz1]\67rs"fixes/__pycache__/fix_numliterals.cpython-312.opt-1.pycnu[PKz1]443py"fixes/__pycache__/fix_nonzero.cpython-312.opt-1.pycnu[PKz1]f+ + -~"fixes/__pycache__/fix_renames.cpython-312.pycnu[PKz1]܏2"fixes/__pycache__/fix_idioms.cpython-312.opt-2.pycnu[PKz1]DPHH2œ"fixes/__pycache__/fix_reload.cpython-312.opt-2.pycnu[PKz1]^/ +l"fixes/__pycache__/fix_apply.cpython-312.pycnu[PKz1]uOTBB2"fixes/__pycache__/fix_intern.cpython-312.opt-2.pycnu[PKz1]2>"fixes/__pycache__/fix_import.cpython-312.opt-1.pycnu[PKz1]6<"fixes/__pycache__/fix_xreadlines.cpython-312.opt-1.pycnu[PKz1]~1@ @ ="fixes/__pycache__/fix_itertools_imports.cpython-312.opt-1.pycnu[PKz1]o0Q"fixes/__pycache__/fix_exec.cpython-312.opt-2.pycnu[PKz1]DQpE E 7G"fixes/__pycache__/fix_set_literal.cpython-312.opt-1.pycnu[PKz1]v  1"fixes/__pycache__/fix_print.cpython-312.opt-1.pycnu[PKz1],l"fixes/__pycache__/fix_import.cpython-312.pycnu[PKz1]mxAA3d#fixes/__pycache__/fix_standarderror.cpython-312.pycnu[PKz1]Q;5#fixes/__pycache__/fix_raw_input.cpython-312.opt-1.pycnu[PKz1]p 1 #fixes/__pycache__/fix_apply.cpython-312.opt-1.pycnu[PKz1]wʹu,B#fixes/__pycache__/fix_except.cpython-312.pycnu[PKz1]  4S&#fixes/__pycache__/fix_exitfunc.cpython-312.opt-2.pycnu[PKz1]Rb 1f4#fixes/__pycache__/fix_throw.cpython-312.opt-1.pycnu[PKz1]#Z3V>#fixes/__pycache__/fix_imports.cpython-312.opt-2.pycnu[PKz1]+ȳr.WV#fixes/__pycache__/fix_ws_comma.cpython-312.pycnu[PKz1]qWW1\#fixes/__pycache__/fix_paren.cpython-312.opt-1.pycnu[PKz1] _!#!#5~c#fixes/__pycache__/fix_metaclass.cpython-312.opt-2.pycnu[PKz1]ƦVV,#fixes/__pycache__/fix_idioms.cpython-312.pycnu[PKz1])Cn 3#fixes/__pycache__/fix_renames.cpython-312.opt-2.pycnu[PKz1] 3#fixes/__pycache__/fix_unicode.cpython-312.opt-2.pycnu[PKz1][r1"#fixes/__pycache__/fix_input.cpython-312.opt-1.pycnu[PKz1]w!!2r#fixes/__pycache__/fix_urllib.cpython-312.opt-2.pycnu[PKz1]Q;/x#fixes/__pycache__/fix_raw_input.cpython-312.pycnu[PKz1]cdd.#fixes/__pycache__/fix_imports2.cpython-312.pycnu[PKz1]EOw-I#fixes/__pycache__/fix_imports.cpython-312.pycnu[PKz1]rc880#fixes/__pycache__/fix_exec.cpython-312.opt-1.pycnu[PKz1]QQ4#fixes/__pycache__/fix_imports2.cpython-312.opt-2.pycnu[PKz1]~Y-#fixes/__pycache__/fix_sys_exc.cpython-312.pycnu[PKz1]ܷ1$fixes/__pycache__/fix_input.cpython-312.opt-2.pycnu[PKz1]T˿  * $fixes/__pycache__/fix_next.cpython-312.pycnu[PKz1]t#-.$fixes/__pycache__/fix_asserts.cpython-312.pycnu[PKz1]/$$fixes/__pycache__/fix_itertools.cpython-312.pycnu[PKz1] $e(e(5,$fixes/__pycache__/fix_metaclass.cpython-312.opt-1.pycnu[PKz1]֥IL 2`U$fixes/__pycache__/fix_except.cpython-312.opt-2.pycnu[PKz1]2c$fixes/__pycache__/fix_xrange.cpython-312.opt-2.pycnu[PKz1]GL L 2r$fixes/__pycache__/fix_filter.cpython-312.opt-2.pycnu[PKz1]3/u$fixes/__pycache__/fix_funcattrs.cpython-312.pycnu[PKz1]L1b$fixes/__pycache__/fix_throw.cpython-312.opt-2.pycnu[PKz1]\* 4o$fixes/__pycache__/fix_exitfunc.cpython-312.opt-1.pycnu[PKz1]>M 1ƛ$fixes/__pycache__/fix_raise.cpython-312.opt-2.pycnu[PKz1]EOw3$fixes/__pycache__/fix_imports.cpython-312.opt-1.pycnu[PKz1] )0$fixes/__pycache__/fix_map.cpython-312.pycnu[PKz1]5!$fixes/__pycache__/fix_itertools.cpython-312.opt-1.pycnu[PKz1]~A\,<$fixes/__pycache__/fix_xrange.cpython-312.pycnu[PKz1]Dzz7|$fixes/__pycache__/fix_methodattrs.cpython-312.opt-1.pycnu[PKz1]i GG*]$fixes/__pycache__/fix_exec.cpython-312.pycnu[PKz1]xr/$fixes/__pycache__/fix_zip.cpython-312.opt-1.pycnu[PKz1]DQpE E 1$fixes/__pycache__/fix_set_literal.cpython-312.pycnu[PKz1])yѐ0%fixes/__pycache__/__init__.cpython-312.opt-1.pycnu[PKz1])yѐ0%fixes/__pycache__/__init__.cpython-312.opt-2.pycnu[PKz1]773%fixes/__pycache__/fix_has_key.cpython-312.opt-2.pycnu[PKz1] 26%fixes/__pycache__/fix_filter.cpython-312.opt-1.pycnu[PKz1]Q>  (%%fixes/__pycache__/fix_ne.cpython-312.pycnu[PKz1]v/FF**%fixes/__pycache__/fix_long.cpython-312.pycnu[PKz1]ޥ' ' 4-%fixes/__pycache__/fix_execfile.cpython-312.opt-2.pycnu[PKz1]Q}[[4<8%fixes/__pycache__/fix_ws_comma.cpython-312.opt-2.pycnu[PKz1]Ziߊ,=%fixes/__pycache__/fix_reload.cpython-312.pycnu[PKz1] ,C%fixes/__pycache__/fix_filter.cpython-312.pycnu[PKz1]Dzz1QR%fixes/__pycache__/fix_methodattrs.cpython-312.pycnu[PKz1]L3,W%fixes/__pycache__/fix_getcwdu.cpython-312.opt-1.pycnu[PKz1]>D .:[%fixes/__pycache__/fix_execfile.cpython-312.pycnu[PKz1]s0NN5Jf%fixes/__pycache__/fix_funcattrs.cpython-312.opt-2.pycnu[PKz1]5@#2j%fixes/__pycache__/fix_reduce.cpython-312.opt-1.pycnu[PKz1]~ 4"p%fixes/__pycache__/fix_execfile.cpython-312.opt-1.pycnu[PKz1]790){%fixes/__pycache__/fix_next.cpython-312.opt-2.pycnu[PKz1]Oo'j227N%fixes/__pycache__/fix_methodattrs.cpython-312.opt-2.pycnu[PKz1]$N +%fixes/__pycache__/fix_print.cpython-312.pycnu[PKz1]' ' 0%fixes/__pycache__/fix_isinstance.cpython-312.pycnu[PKz1]  0x%fixes/__pycache__/fix_long.cpython-312.opt-2.pycnu[PKz1][r+%fixes/__pycache__/fix_input.cpython-312.pycnu[PKz1]vEÀ/,%fixes/__pycache__/fix_map.cpython-312.opt-2.pycnu[PKz1]g 1 %fixes/__pycache__/fix_print.cpython-312.opt-2.pycnu[PKz1]v/FF0i%fixes/__pycache__/fix_long.cpython-312.opt-1.pycnu[PKz1]B].%fixes/__pycache__/fix_operator.cpython-312.pycnu[PKz1]qWW+^%fixes/__pycache__/fix_paren.cpython-312.pycnu[PKz1]wʹu2%fixes/__pycache__/fix_except.cpython-312.opt-1.pycnu[PKz1]_badd*'%fixes/__pycache__/fix_repr.cpython-312.pycnu[PKz1] 7&fixes/__pycache__/fix_set_literal.cpython-312.opt-2.pycnu[PKz1]^rr/J &fixes/__pycache__/fix_zip.cpython-312.opt-2.pycnu[PKz1]*e7 7 1&fixes/__pycache__/fix_raise.cpython-312.opt-1.pycnu[PKz1]*773 &fixes/__pycache__/fix_sys_exc.cpython-312.opt-2.pycnu[PKz1]5@#,M(&fixes/__pycache__/fix_reduce.cpython-312.pycnu[PKz1]cdd4l-&fixes/__pycache__/fix_imports2.cpython-312.opt-1.pycnu[PKz1]640&fixes/__pycache__/fix_isinstance.cpython-312.opt-2.pycnu[PKz1]f+ + 38&fixes/__pycache__/fix_renames.cpython-312.opt-1.pycnu[PKz1]so+D&fixes/__pycache__/fix_types.cpython-312.pycnu[PKz1]0SM&fixes/__pycache__/fix_xreadlines.cpython-312.pycnu[PKz1]#.R&fixes/__pycache__/fix_ne.cpython-312.opt-2.pycnu[PKz1]73V&fixes/__pycache__/fix_nonzero.cpython-312.opt-2.pycnu[PKz1]mxAA9W[&fixes/__pycache__/fix_standarderror.cpython-312.opt-1.pycnu[PKz1]&)-_&pgen2/__pycache__/token.cpython-312.opt-1.pycnu[PKz1]Vf辳*"h&pgen2/__pycache__/__init__.cpython-312.pycnu[PKz1]a%\\)/i&pgen2/__pycache__/grammar.cpython-312.pycnu[PKz1]&&,&pgen2/__pycache__/conv.cpython-312.opt-1.pycnu[PKz1]&)'&pgen2/__pycache__/token.cpython-312.pycnu[PKz1]""' &pgen2/__pycache__/parse.cpython-312.pycnu[PKz1]$E-w&pgen2/__pycache__/parse.cpython-312.opt-2.pycnu[PKz1][?  0l&pgen2/__pycache__/literals.cpython-312.opt-2.pycnu[PKz1]:JQJQ0&pgen2/__pycache__/tokenize.cpython-312.opt-1.pycnu[PKz1]a%\\/G'pgen2/__pycache__/grammar.cpython-312.opt-1.pycnu[PKz1]?\\.$w0PatternGrammar3.11.13.final.0.picklenu[PKH13]&ww.|0fixes/__pycache__/fix_ws_comma.cpython-311.pycnu[PKH13]'I4Ӄ0fixes/__pycache__/fix_operator.cpython-311.opt-1.pycnu[PKH13]~-0fixes/__pycache__/fix_sys_exc.cpython-311.pycnu[PKH13]} 10fixes/__pycache__/fix_set_literal.cpython-311.pycnu[PKH13]6<^rr30fixes/__pycache__/fix_has_key.cpython-311.opt-1.pycnu[PKH13]֏60fixes/__pycache__/fix_isinstance.cpython-311.opt-2.pycnu[PKH13] PL30fixes/__pycache__/fix_asserts.cpython-311.opt-1.pycnu[PKH13] s4"0fixes/__pycache__/fix_operator.cpython-311.opt-2.pycnu[PKH13]}5#0fixes/__pycache__/fix_funcattrs.cpython-311.opt-2.pycnu[PKH13]~1y0fixes/__pycache__/fix_paren.cpython-311.opt-2.pycnu[PKH13]3[0fixes/__pycache__/fix_nonzero.cpython-311.opt-2.pycnu[PKH13],EE2L0fixes/__pycache__/fix_xrange.cpython-311.opt-2.pycnu[PKH13]Y^, 6 1fixes/__pycache__/fix_isinstance.cpython-311.opt-1.pycnu[PKH13]cc1"1fixes/__pycache__/fix_numliterals.cpython-311.pycnu[PKH13]&((,1fixes/__pycache__/fix_urllib.cpython-311.pycnu[PKH13]zVs, F1fixes/__pycache__/fix_intern.cpython-311.pycnu[PKH13]z/bL1fixes/__pycache__/fix_map.cpython-311.opt-1.pycnu[PKH13]GG0_1fixes/__pycache__/fix_exec.cpython-311.opt-2.pycnu[PKH13],2f1fixes/__pycache__/fix_reload.cpython-311.opt-2.pycnu[PKH13][ [ =l1fixes/__pycache__/fix_itertools_imports.cpython-311.opt-2.pycnu[PKH13]'e330w1fixes/__pycache__/fix_next.cpython-311.opt-2.pycnu[PKH13] 81fixes/__pycache__/fix_tuple_params.cpython-311.opt-2.pycnu[PKH13](c='  +1fixes/__pycache__/fix_apply.cpython-311.pycnu[PKH13]}ϟ<  41fixes/__pycache__/fix_execfile.cpython-311.opt-2.pycnu[PKH13]t11fixes/__pycache__/fix_paren.cpython-311.opt-1.pycnu[PKH13]{/Z1fixes/__pycache__/fix_map.cpython-311.opt-2.pycnu[PKH13]Qy/11fixes/__pycache__/fix_raise.cpython-311.opt-1.pycnu[PKH13]BOkk/1fixes/__pycache__/fix_itertools.cpython-311.pycnu[PKH13]l21fixes/__pycache__/fix_reload.cpython-311.opt-1.pycnu[PKH13]Pe 31fixes/__pycache__/fix_renames.cpython-311.opt-2.pycnu[PKH13]U,Oc c 142fixes/__pycache__/fix_throw.cpython-311.opt-1.pycnu[PKH13]*||02fixes/__pycache__/fix_basestring.cpython-311.pycnu[PKH13]$D D /2fixes/__pycache__/fix_zip.cpython-311.opt-1.pycnu[PKH13]ƒ1/w!2fixes/__pycache__/fix_zip.cpython-311.opt-2.pycnu[PKH13]2F F 3)2fixes/__pycache__/fix_unicode.cpython-311.opt-2.pycnu[PKH13]t$$7w32fixes/__pycache__/fix_numliterals.cpython-311.opt-2.pycnu[PKH13]d3 3 3:2fixes/__pycache__/fix_renames.cpython-311.opt-1.pycnu[PKH13]'I.G2fixes/__pycache__/fix_operator.cpython-311.pycnu[PKH13]&ww4x`2fixes/__pycache__/fix_ws_comma.cpython-311.opt-1.pycnu[PKH13]8ސ0Sg2fixes/__pycache__/__init__.cpython-311.opt-2.pycnu[PKH13]z1k,ch2fixes/__pycache__/fix_idioms.cpython-311.pycnu[PKH13] c32fixes/__pycache__/fix_asserts.cpython-311.opt-2.pycnu[PKH13]@22fixes/__pycache__/fix_reduce.cpython-311.opt-2.pycnu[PKH13]ù9Č2fixes/__pycache__/fix_standarderror.cpython-311.opt-1.pycnu[PKH13]8o72fixes/__pycache__/fix_methodattrs.cpython-311.opt-1.pycnu[PKH13]G0d2fixes/__pycache__/fix_dict.cpython-311.opt-2.pycnu[PKH13]A-2fixes/__pycache__/fix_has_key.cpython-311.pycnu[PKH13]$D D )m2fixes/__pycache__/fix_zip.cpython-311.pycnu[PKH13]+{6 2fixes/__pycache__/fix_xreadlines.cpython-311.opt-2.pycnu[PKH13]bq AA->2fixes/__pycache__/fix_getcwdu.cpython-311.pycnu[PKH13]W22fixes/__pycache__/fix_filter.cpython-311.opt-1.pycnu[PKH13]ǺJ44/'2fixes/__pycache__/fix_funcattrs.cpython-311.pycnu[PKH13]ִ32fixes/__pycache__/fix_getcwdu.cpython-311.opt-2.pycnu[PKH13]VEFF.2fixes/__pycache__/fix_ne.cpython-311.opt-2.pycnu[PKH13]CQQ22fixes/__pycache__/fix_reduce.cpython-311.opt-1.pycnu[PKH13]8o1r2fixes/__pycache__/fix_methodattrs.cpython-311.pycnu[PKH13]2ww42fixes/__pycache__/fix_exitfunc.cpython-311.opt-1.pycnu[PKH13]$$33fixes/__pycache__/fix_sys_exc.cpython-311.opt-2.pycnu[PKH13]]i))5L3fixes/__pycache__/fix_metaclass.cpython-311.opt-1.pycnu[PKH13]K7-93fixes/__pycache__/fix_nonzero.cpython-311.pycnu[PKH13](*>3fixes/__pycache__/fix_long.cpython-311.pycnu[PKH13] 2B3fixes/__pycache__/fix_buffer.cpython-311.opt-2.pycnu[PKH13]1QQ6\G3fixes/__pycache__/fix_xreadlines.cpython-311.opt-1.pycnu[PKH13]~2N3fixes/__pycache__/fix_import.cpython-311.opt-1.pycnu[PKH13]}A 1Ga3fixes/__pycache__/fix_types.cpython-311.opt-1.pycnu[PKH13](0k3fixes/__pycache__/fix_long.cpython-311.opt-1.pycnu[PKH13]3ʙp2o3fixes/__pycache__/fix_xrange.cpython-311.opt-1.pycnu[PKH13]=03fixes/__pycache__/fix_repr.cpython-311.opt-1.pycnu[PKH13]3v] ] 13fixes/__pycache__/fix_raise.cpython-311.opt-2.pycnu[PKH13]:  23fixes/__pycache__/fix_except.cpython-311.opt-2.pycnu[PKH13]~,)3fixes/__pycache__/fix_import.cpython-311.pycnu[PKH13]}{ DD/W3fixes/__pycache__/fix_raw_input.cpython-311.pycnu[PKH13]v 73fixes/__pycache__/fix_set_literal.cpython-311.opt-2.pycnu[PKH13]=*3fixes/__pycache__/fix_repr.cpython-311.pycnu[PKH13][\\4.3fixes/__pycache__/fix_imports2.cpython-311.opt-2.pycnu[PKH13]K733fixes/__pycache__/fix_nonzero.cpython-311.opt-1.pycnu[PKH13] w 73fixes/__pycache__/fix_itertools_imports.cpython-311.pycnu[PKH13]&((2n3fixes/__pycache__/fix_urllib.cpython-311.opt-1.pycnu[PKH13]zii14fixes/__pycache__/fix_print.cpython-311.opt-2.pycnu[PKH13] PL-e4fixes/__pycache__/fix_asserts.cpython-311.pycnu[PKH13]#74fixes/__pycache__/fix_methodattrs.cpython-311.opt-2.pycnu[PKH13]ap 1#4fixes/__pycache__/fix_apply.cpython-311.opt-1.pycnu[PKH13]52D/4fixes/__pycache__/fix_future.cpython-311.opt-2.pycnu[PKH13]d3 3 -C34fixes/__pycache__/fix_renames.cpython-311.pycnu[PKH13]\\2@4fixes/__pycache__/fix_idioms.cpython-311.opt-1.pycnu[PKH13]2ww.X4fixes/__pycache__/fix_exitfunc.cpython-311.pycnu[PKH13]]? 3fh4fixes/__pycache__/fix_unicode.cpython-311.opt-1.pycnu[PKH13]+_EE1r4fixes/__pycache__/fix_input.cpython-311.opt-2.pycnu[PKH13]s**/ix4fixes/__pycache__/fix_metaclass.cpython-311.pycnu[PKH13]U,Oc c +4fixes/__pycache__/fix_throw.cpython-311.pycnu[PKH13]sChD24fixes/__pycache__/fix_filter.cpython-311.opt-2.pycnu[PKH13]ǺJ4454fixes/__pycache__/fix_funcattrs.cpython-311.opt-1.pycnu[PKH13]cc74fixes/__pycache__/fix_numliterals.cpython-311.opt-1.pycnu[PKH13]ù34fixes/__pycache__/fix_standarderror.cpython-311.pycnu[PKH13]G54fixes/__pycache__/fix_raw_input.cpython-311.opt-2.pycnu[PKH13]{oHH04fixes/__pycache__/fix_dict.cpython-311.opt-1.pycnu[PKH13]344fixes/__pycache__/fix_ws_comma.cpython-311.opt-2.pycnu[PKH13]-9V7734fixes/__pycache__/fix_has_key.cpython-311.opt-2.pycnu[PKH13]U663e4fixes/__pycache__/fix_imports.cpython-311.opt-1.pycnu[PKH13]jrr.5fixes/__pycache__/fix_ne.cpython-311.opt-1.pycnu[PKH13]#::*5fixes/__pycache__/fix_exec.cpython-311.pycnu[PKH13]`2b#5fixes/__pycache__/fix_intern.cpython-311.opt-2.pycnu[PKH13]~3|)5fixes/__pycache__/fix_sys_exc.cpython-311.opt-1.pycnu[PKH13]/ن225fixes/__pycache__/fix_import.cpython-311.opt-2.pycnu[PKH13]} 7D5fixes/__pycache__/fix_set_literal.cpython-311.opt-1.pycnu[PKH13]4*!!2O5fixes/__pycache__/fix_tuple_params.cpython-311.pycnu[PKH13]Y^, 02r5fixes/__pycache__/fix_isinstance.cpython-311.pycnu[PKH13]BOkk5[|5fixes/__pycache__/fix_itertools.cpython-311.opt-1.pycnu[PKH13] 1 &&2+5fixes/__pycache__/fix_urllib.cpython-311.opt-2.pycnu[PKH13]Jw5<5fixes/__pycache__/fix_itertools.cpython-311.opt-2.pycnu[PKH13]0kk25fixes/__pycache__/fix_idioms.cpython-311.opt-2.pycnu[PKH13]fD4p5fixes/__pycache__/fix_imports2.cpython-311.opt-1.pycnu[PKH13] 7PP65fixes/__pycache__/fix_basestring.cpython-311.opt-2.pycnu[PKH13]1QQ0L5fixes/__pycache__/fix_xreadlines.cpython-311.pycnu[PKH13]\}25fixes/__pycache__/fix_except.cpython-311.opt-1.pycnu[PKH13]*'5fixes/__pycache__/fix_next.cpython-311.pycnu[PKH13]/׺25fixes/__pycache__/fix_future.cpython-311.opt-1.pycnu[PKH13]3iA88+h6fixes/__pycache__/fix_print.cpython-311.pycnu[PKH13]fD.6fixes/__pycache__/fix_imports2.cpython-311.pycnu[PKH13]16fixes/__pycache__/fix_types.cpython-311.opt-2.pycnu[PKH13]1#16fixes/__pycache__/fix_print.cpython-311.opt-1.pycnu[PKH13]3ʙp,k/6fixes/__pycache__/fix_xrange.cpython-311.pycnu[PKH13]l,K@6fixes/__pycache__/fix_reload.cpython-311.pycnu[PKH13]a}$$5F6fixes/__pycache__/fix_metaclass.cpython-311.opt-2.pycnu[PKH13]kCP..4k6fixes/__pycache__/fix_exitfunc.cpython-311.opt-2.pycnu[PKH13]\},+{6fixes/__pycache__/fix_except.cpython-311.pycnu[PKH13]8ސ*O6fixes/__pycache__/__init__.cpython-311.pycnu[PKH13]˓9Y6fixes/__pycache__/fix_standarderror.cpython-311.opt-2.pycnu[PKH13]bq AA3F6fixes/__pycache__/fix_getcwdu.cpython-311.opt-1.pycnu[PKH13].f{ { 16fixes/__pycache__/fix_throw.cpython-311.opt-2.pycnu[PKH13] 雕0Ƣ6fixes/__pycache__/fix_long.cpython-311.opt-2.pycnu[PKH13]]? -̦6fixes/__pycache__/fix_unicode.cpython-311.pycnu[PKH13]zVV,#6fixes/__pycache__/fix_buffer.cpython-311.pycnu[PKH13]4*!!8յ6fixes/__pycache__/fix_tuple_params.cpython-311.opt-1.pycnu[PKH13]}{ DD5"6fixes/__pycache__/fix_raw_input.cpython-311.opt-1.pycnu[PKH13] *6fixes/__pycache__/fix_dict.cpython-311.pycnu[PKH13]/׺,6fixes/__pycache__/fix_future.cpython-311.pycnu[PKH13]zVV2A6fixes/__pycache__/fix_buffer.cpython-311.opt-1.pycnu[PKH13]jrr(6fixes/__pycache__/fix_ne.cpython-311.pycnu[PKH13]Ƣ: .6fixes/__pycache__/fix_execfile.cpython-311.pycnu[PKH13]8ސ0 7fixes/__pycache__/__init__.cpython-311.opt-1.pycnu[PKH13]`&1 7fixes/__pycache__/fix_input.cpython-311.opt-1.pycnu[PKH13]2))07fixes/__pycache__/fix_exec.cpython-311.opt-1.pycnu[PKH13]kF =:7fixes/__pycache__/fix_itertools_imports.cpython-311.opt-1.pycnu[PKH13]W,S%7fixes/__pycache__/fix_filter.cpython-311.pycnu[PKH13]PV057fixes/__pycache__/fix_repr.cpython-311.opt-2.pycnu[PKH13]#3)vqq0:7fixes/__pycache__/fix_next.cpython-311.opt-1.pycnu[PKH13]`&+uO7fixes/__pycache__/fix_input.cpython-311.pycnu[PKH13]z)YU7fixes/__pycache__/fix_map.cpython-311.pycnu[PKH13]t$ 4h7fixes/__pycache__/fix_execfile.cpython-311.opt-1.pycnu[PKH13]3u7fixes/__pycache__/fix_imports.cpython-311.opt-2.pycnu[PKH13]}A +7fixes/__pycache__/fix_types.cpython-311.pycnu[PKH13]t+$7fixes/__pycache__/fix_paren.cpython-311.pycnu[PKH13]*||67fixes/__pycache__/fix_basestring.cpython-311.opt-1.pycnu[PKH13]zVs2i7fixes/__pycache__/fix_intern.cpython-311.opt-1.pycnu[PKH13]U66-Ĭ7fixes/__pycache__/fix_imports.cpython-311.pycnu[PKH13]Qy/+W7fixes/__pycache__/fix_raise.cpython-311.pycnu[PKH13]8 N 17fixes/__pycache__/fix_apply.cpython-311.opt-2.pycnu[PKH13]CQQ,7fixes/__pycache__/fix_reduce.cpython-311.pycnu[PKH13]   *?7pgen2/__pycache__/literals.cpython-311.pycnu[PKH13]^qJqJ,7pgen2/__pycache__/pgen.cpython-311.opt-1.pycnu[PKH13] "i*NN0~?8pgen2/__pycache__/tokenize.cpython-311.opt-2.pycnu[PKH13]:ycf f 08pgen2/__pycache__/literals.cpython-311.opt-2.pycnu[PKH13]n:R0{8pgen2/__pycache__/__init__.cpython-311.opt-2.pycnu[PKH13]`33&8pgen2/__pycache__/conv.cpython-311.pycnu[PKH13]^qJqJ,8pgen2/__pycache__/pgen.cpython-311.opt-2.pycnu[PKH13]|"|"(9pgen2/__pycache__/driver.cpython-311.pycnu[PKH13]\#\#'S;9pgen2/__pycache__/parse.cpython-311.pycnu[PKH13])_9pgen2/__pycache__/grammar.cpython-311.pycnu[PKH13]TmA#A#-|9pgen2/__pycache__/parse.cpython-311.opt-1.pycnu[PKH13]BqQ Q '9pgen2/__pycache__/token.cpython-311.pycnu[PKH13]b("(".>9pgen2/__pycache__/driver.cpython-311.opt-1.pycnu[PKH13]9 09pgen2/__pycache__/literals.cpython-311.opt-1.pycnu[PKH13]BqQ Q -9pgen2/__pycache__/token.cpython-311.opt-1.pycnu[PKH13]x-9pgen2/__pycache__/parse.cpython-311.opt-2.pycnu[PKH13]q]]09pgen2/__pycache__/tokenize.cpython-311.opt-1.pycnu[PKH13]i^i^*V:pgen2/__pycache__/tokenize.cpython-311.pycnu[PKH13] }rr.ô:pgen2/__pycache__/driver.cpython-311.opt-2.pycnu[PKH13] K+K+,:pgen2/__pycache__/conv.cpython-311.opt-1.pycnu[PKH13]w!!,::pgen2/__pycache__/conv.cpython-311.opt-2.pycnu[PKH13]^6*E!;pgen2/__pycache__/__init__.cpython-311.pycnu[PKH13]`m -q";pgen2/__pycache__/token.cpython-311.opt-2.pycnu[PKH13]^60+;pgen2/__pycache__/__init__.cpython-311.opt-1.pycnu[PKH13]/ -;pgen2/__pycache__/grammar.cpython-311.opt-1.pycnu[PKH13]3O3O&K;pgen2/__pycache__/pgen.cpython-311.pycnu[PKH13]cc/;pgen2/__pycache__/grammar.cpython-311.opt-2.pycnu[PKH13] ;;c;Grammar3.11.13.final.0.picklenu[PKtte;