<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
ž
¬ÿfŠm  c               @   sê  d  Z  d d l m Z d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 m Z d d l m Z m Z m Z d d l m Z d d	 l m Z m Z d d
 l m Z d d l m Z e d d „ Z Gd d „  d e ƒ Z d d „  Z d d „  Z d d „  Z d d „  Z  e j! d d f k  rpd d l" Z" e" j# Z$ d d „  Z% d d „  Z& n e# Z$ e  Z% e  Z& d d „  Z' Gd d  „  d  e ƒ Z( Gd! d" „  d" e) ƒ Z* Gd# d$ „  d$ e ƒ Z+ Gd% d& „  d& e* ƒ Z, d S('   uÛ   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.
i    (   u   with_statementu#   Guido van Rossum <guido@python.org>N(   u   chaini   (   u   driveru   tokenizeu   token(   u	   find_root(   u   pytreeu   pygram(   u	   btm_utils(   u   btm_matcherc             C   s¨   t  |  g  g  d g ƒ } t j j | j ƒ } g  } xn t t j | ƒ ƒ D]W } | j d ƒ rI | j d ƒ rI | r† | d d … } n  | j	 | d d … ƒ qI qI W| S(   uE   Return a sorted list of all available fix names in the given package.u   *u   fix_u   .pyi   Ni   iýÿÿÿ(
   u
   __import__u   osu   pathu   dirnameu   __file__u   sortedu   listdiru
   startswithu   endswithu   append(   u	   fixer_pkgu   remove_prefixu   pkgu	   fixer_diru	   fix_namesu   name(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   get_all_fix_names!   s    u   get_all_fix_namesc             B   s   |  Ee  Z d  Z d S(   u
   _EveryNodeN(   u   __name__u
   __module__u   __qualname__(   u
   __locals__(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu
   _EveryNode.   s   u
   _EveryNodec             C   sß   t  |  t j t j f ƒ rC |  j d k r3 t ‚ n  t |  j g ƒ St  |  t j ƒ rt |  j	 rk t
 |  j	 ƒ St ‚ n  t  |  t j ƒ rË t ƒ  } x5 |  j	 D]* } x! | D] } | j t
 | ƒ ƒ q¦ Wq™ W| St d |  ƒ ‚ d S(   uf    Accepts a pytree Pattern Node and returns a set
        of the pattern types which will match first. u$   Oh no! I don't understand pattern %sN(   u
   isinstanceu   pytreeu   NodePatternu   LeafPatternu   typeu   Noneu
   _EveryNodeu   setu   NegatedPatternu   contentu   _get_head_typesu   WildcardPatternu   updateu	   Exception(   u   patu   ru   pu   x(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   _get_head_types2   s    				u   _get_head_typesc             C   s  t  j t ƒ } g  } x¤ |  D]œ } | j r… y t | j ƒ } Wn t k
 r_ | j | ƒ Yq¸ XxU | D] } | | j | ƒ qg Wq | j d k	 r« | | j j | ƒ q | j | ƒ q Wx: t	 t
 j j j ƒ  t
 j j ƒ D] } | | j | ƒ qÞ Wt | ƒ S(   u^    Accepts a list of fixers and returns a dictionary
        of head node type --> fixer list.  N(   u   collectionsu   defaultdictu   listu   patternu   _get_head_typesu
   _EveryNodeu   appendu   _accept_typeu   Noneu   chainu   pygramu   python_grammaru   symbol2numberu   valuesu   tokensu   extendu   dict(   u
   fixer_listu
   head_nodesu   everyu   fixeru   headsu	   node_type(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   _get_headnode_dictN   s"    	u   _get_headnode_dictc                s    ‡  f d d †  t  ˆ  d ƒ Dƒ S(   uN   
    Return the fully qualified names for fixers in the package pkg_name.
    c                s   g  |  ] } ˆ  d  | ‘ q S(   u   .(    (   u   .0u   fix_name(   u   pkg_name(    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu
   <listcomp>k   s   	u+   get_fixers_from_package.<locals>.<listcomp>F(   u   get_all_fix_namesu   False(   u   pkg_name(    (   u   pkg_nameu5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   get_fixers_from_packageg   s    u   get_fixers_from_packagec             C   s   |  S(   N(    (   u   obj(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu	   _identityn   s    u	   _identityi   c             C   s   |  j  d d ƒ S(   Nu   
u   
(   u   replace(   u   input(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   _from_system_newlinesu   s    u   _from_system_newlinesc             C   s*   t  j d k r" |  j d t  j ƒ S|  Sd  S(   Nu   
(   u   osu   linesepu   replace(   u   input(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   _to_system_newlinesw   s    u   _to_system_newlinesc                sÝ  d } t j t j |  ƒ j ƒ ‰  ‡  f d d †  } t t j t j	 t j
 f ƒ } t ƒ  } ydx]| ƒ  \ } } | | k r q` q` | t j k r£ | rš Pn  d	 } q` | t j k r¹| d k r¹| ƒ  \ } } | t j k sè | d k rì Pn  | ƒ  \ } } | t j k s| d k rPn  | ƒ  \ } } | t j k rV| d k rV| ƒ  \ } } n  xa | t j k rµ| j | ƒ | ƒ  \ } } | t j k sŸ| d k r£Pn  | ƒ  \ } } qYWq` Pq` Wn t k
 rÒYn Xt | ƒ S(
   Nc                 s   t  ˆ  ƒ }  |  d |  d f S(   Ni    i   (   u   next(   u   tok(   u   gen(    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   advance…   s    u(   _detect_future_features.<locals>.advanceu   fromu
   __future__u   importu   (u   ,FT(   u   Falseu   tokenizeu   generate_tokensu   iou   StringIOu   readlineu	   frozensetu   tokenu   NEWLINEu   NLu   COMMENTu   setu   STRINGu   Trueu   NAMEu   OPu   addu   StopIteration(   u   sourceu   have_docstringu   advanceu   ignoreu   featuresu   tpu   value(    (   u   genu5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   _detect_future_features‚   sD    		u   _detect_future_featuresc             B   s   |  Ee  Z d  Z d Z d S(   u
   FixerErroru   A fixer could not be loaded.N(   u   __name__u
   __module__u   __qualname__u   __doc__(   u
   __locals__(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu
   FixerErrorª   s   u
   FixerErrorc             B   so  |  Ee  Z d  Z i d4 d 6d4 d 6Z d Z d Z d3 d3 d d „ Z d d „  Z	 d	 d
 „  Z
 d d „  Z d d „  Z d d „  Z d4 d4 d d „ Z d4 d4 d d „ Z d d „  Z d4 d4 d d „ Z d d „  Z d4 d d „ Z d d „  Z d d  „  Z d3 d4 d3 d! d" „ Z d3 d# d$ „ Z d% Z d& Z d' d( „  Z d) d* „  Z d+ d, „  Z d- d. „  Z d/ d0 „  Z d1 d2 „  Z d3 S(5   u   RefactoringToolu   print_functionu   write_unchanged_filesu   Fixu   fix_c             C   sÄ  | |  _  | p g  |  _ |  j j ƒ  |  _ | d k	 rI |  j j | ƒ n  |  j d re t j |  _	 n t j
 |  _	 |  j j d ƒ |  _ g  |  _ t j d ƒ |  _ g  |  _ d |  _ t j |  j	 d t j d |  j ƒ|  _ |  j ƒ  \ |  _ |  _ g  |  _ t j ƒ  |  _ g  |  _ g  |  _  x} t! |  j |  j ƒ D]f } | j" rT|  j j# | ƒ q2| |  j k rv|  j j$ | ƒ q2| |  j k r2|  j  j$ | ƒ q2q2Wt% |  j ƒ |  _& t% |  j  ƒ |  _' d S(   uÒ   Initializer.

        Args:
            fixer_names: a list of fixers to import
            options: an dict with configuration.
            explicit: a list of fixers to run even if they are explicit.
        u   print_functionu   write_unchanged_filesu   RefactoringToolu   convertu   loggerNF((   u   fixersu   explicitu   _default_optionsu   copyu   optionsu   Noneu   updateu   pygramu!   python_grammar_no_print_statementu   grammaru   python_grammaru   getu   write_unchanged_filesu   errorsu   loggingu	   getLoggeru   loggeru	   fixer_logu   Falseu   wroteu   driveru   Driveru   pytreeu   convertu
   get_fixersu	   pre_orderu
   post_orderu   filesu   bmu   BottomMatcheru   BMu   bmi_pre_orderu   bmi_post_orderu   chainu   BM_compatibleu	   add_fixeru   appendu   _get_headnode_dictu   bmi_pre_order_headsu   bmi_post_order_heads(   u   selfu   fixer_namesu   optionsu   explicitu   fixer(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   __init__¶   s<    									u   RefactoringTool.__init__c             C   sØ  g  } g  } x|  j  D]…} t | i  i  d g ƒ } | j d d ƒ d } | j |  j ƒ rx | t |  j ƒ d … } n  | j d ƒ } |  j d j d d „  | Dƒ ƒ } y t	 | | ƒ } Wn( t
 k
 rç t d	 | | f ƒ ‚ Yn X| |  j |  j ƒ }	 |	 j r:|  j d k	 r:| |  j k r:|  j d
 | ƒ q n  |  j d | ƒ |	 j d k ri| j |	 ƒ q |	 j d k rˆ| j |	 ƒ q t d |	 j ƒ ‚ q Wt j d ƒ }
 | j d |
 ƒ | j d |
 ƒ | | f S(   u  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.
        u   *u   .i   Nu   _u    c             S   s   g  |  ] } | j  ƒ  ‘ q S(    (   u   title(   u   .0u   p(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu
   <listcomp>ú   s   	 u.   RefactoringTool.get_fixers.<locals>.<listcomp>u   Can't find %s.%su   Skipping implicit fixer: %su   Adding transformation: %su   preu   postu   Illegal fixer order: %ru	   run_orderu   keyiÿÿÿÿT(   u   fixersu
   __import__u   rsplitu
   startswithu   FILE_PREFIXu   lenu   splitu   CLASS_PREFIXu   joinu   getattru   AttributeErroru
   FixerErroru   optionsu	   fixer_logu   explicitu   Trueu   log_messageu	   log_debugu   orderu   appendu   operatoru
   attrgetteru   sort(   u   selfu   pre_order_fixersu   post_order_fixersu   fix_mod_pathu   modu   fix_nameu   partsu
   class_nameu	   fix_classu   fixeru   key_func(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu
   get_fixersê   s8    #u   RefactoringTool.get_fixersc             O   s   ‚  d S(   u   Called when an error occurs.N(    (   u   selfu   msgu   argsu   kwds(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu	   log_error  s    u   RefactoringTool.log_errorc             G   s'   | r | | } n  |  j  j | ƒ d S(   u   Hook to log a message.N(   u   loggeru   info(   u   selfu   msgu   args(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   log_message  s    u   RefactoringTool.log_messagec             G   s'   | r | | } n  |  j  j | ƒ d  S(   N(   u   loggeru   debug(   u   selfu   msgu   args(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu	   log_debug  s    u   RefactoringTool.log_debugc             C   s   d S(   uT   Called with the old version, new version, and filename of a
        refactored file.N(    (   u   selfu   old_textu   new_textu   filenameu   equal(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   print_output!  s    u   RefactoringTool.print_outputc             C   sP   xI | D]A } t  j j | ƒ r5 |  j | | | ƒ q |  j | | | ƒ q Wd S(   u)   Refactor a list of files and directories.N(   u   osu   pathu   isdiru   refactor_diru   refactor_file(   u   selfu   itemsu   writeu   doctests_onlyu   dir_or_file(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   refactor&  s    u   RefactoringTool.refactorc       
      C   sÝ   t  j d } xÉ t  j | ƒ D]¸ \ } } } |  j d | ƒ | j ƒ  | j ƒ  xe | D]] } | j d ƒ rW t  j j | ƒ d | k rW t  j j | | ƒ }	 |  j	 |	 | | ƒ qW qW Wd d „  | Dƒ | d d … <q Wd S(   uÄ   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.
        u   pyu   Descending into %su   .i   c             S   s%   g  |  ] } | j  d  ƒ s | ‘ q S(   u   .(   u
   startswith(   u   .0u   dn(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu
   <listcomp>A  s   	 u0   RefactoringTool.refactor_dir.<locals>.<listcomp>N(
   u   osu   extsepu   walku	   log_debugu   sortu
   startswithu   pathu   splitextu   joinu   refactor_file(
   u   selfu   dir_nameu   writeu   doctests_onlyu   py_extu   dirpathu   dirnamesu	   filenamesu   nameu   fullname(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   refactor_dir/  s    

u   RefactoringTool.refactor_dirc             C   s²   y t  | d ƒ } Wn< t k
 rQ } z |  j d | | ƒ d SWYd d } ~ Xn Xz t j | j ƒ d } Wd | j ƒ  Xt | d d | ƒ } t	 | j
 ƒ  ƒ | f SWd QXd S(   uG   
        Do our best to decode a Python source file correctly.
        u   rbu   Can't open %s: %sNi    u   ru   encoding(   NN(   u   openu   IOErroru	   log_erroru   Noneu   tokenizeu   detect_encodingu   readlineu   closeu   _open_with_encodingu   _from_system_newlinesu   read(   u   selfu   filenameu   fu   erru   encoding(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   _read_python_sourceC  s    u#   RefactoringTool._read_python_sourcec          	   C   s  |  j  | ƒ \ } } | d k r% d S| d 7} | r› |  j d | ƒ |  j | | ƒ } |  j sl | | k rˆ |  j | | | | | ƒ q|  j d | ƒ ni |  j | | ƒ } |  j sÅ | rô | j rô |  j t | ƒ d d	 … | d | d | ƒn |  j d | ƒ d S(
   u   Refactors a file.Nu   
u   Refactoring doctests in %su   No doctest changes in %si   u   writeu   encodingu   No changes in %siÿÿÿÿ(	   u   _read_python_sourceu   Noneu	   log_debugu   refactor_docstringu   write_unchanged_filesu   processed_fileu   refactor_stringu   was_changedu   str(   u   selfu   filenameu   writeu   doctests_onlyu   inputu   encodingu   outputu   tree(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   refactor_fileS  s    
u   RefactoringTool.refactor_filec             C   sÌ   t  | ƒ } d | k r* t j |  j _ n  zb y |  j j | ƒ } WnE t k
 rŠ } z% |  j d | | j j	 | ƒ d SWYd d } ~ Xn XWd |  j |  j _ X| | _
 |  j d | ƒ |  j | | ƒ | S(   uF  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.
        u   print_functionu   Can't parse %s: %s: %sNu   Refactoring %s(   u   _detect_future_featuresu   pygramu!   python_grammar_no_print_statementu   driveru   grammaru   parse_stringu	   Exceptionu	   log_erroru	   __class__u   __name__u   future_featuresu	   log_debugu   refactor_tree(   u   selfu   datau   nameu   featuresu   treeu   err(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   refactor_stringj  s    		u   RefactoringTool.refactor_stringc             C   sÆ   t  j j ƒ  } | ro |  j d ƒ |  j | d ƒ } |  j sI | | k r_ |  j | d | ƒ qÂ |  j d ƒ nS |  j | d ƒ } |  j s™ | rµ | j rµ |  j t	 | ƒ d | ƒ n |  j d ƒ d  S(   Nu   Refactoring doctests in stdinu   <stdin>u   No doctest changes in stdinu   No changes in stdin(
   u   sysu   stdinu   readu	   log_debugu   refactor_docstringu   write_unchanged_filesu   processed_fileu   refactor_stringu   was_changedu   str(   u   selfu   doctests_onlyu   inputu   outputu   tree(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   refactor_stdin…  s    u   RefactoringTool.refactor_stdinc       
      C   sœ  x- t  |  j |  j ƒ D] } | j | | ƒ q W|  j |  j | j ƒ  ƒ |  j |  j | j ƒ  ƒ |  j j | j	 ƒ  ƒ } xèt
 | j ƒ  ƒ rdxÏ|  j j D]Á} | | k rœ | | rœ | | j d t j j d d ƒ | j rþ | | j d t j j ƒ n  x\t | | ƒ D]G} | | | k r9| | j | ƒ n  y t | ƒ Wn t k
 r^wYn X| j r}| | j k r}qn  | j | ƒ } | r| j | | ƒ } | d k	 rV| j | ƒ x9 | j ƒ  D]+ } | j såg  | _ n  | j j | ƒ qÊW|  j j | j	 ƒ  ƒ } x? | D]4 }	 |	 | k r7g  | |	 <n  | |	 j | |	 ƒ qWqVqqWqœ qœ Wq} Wx- t  |  j |  j ƒ D] } | j | | ƒ q{W| j  S(   uÏ  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.
        u   keyu   reverseTN(!   u   chainu	   pre_orderu
   post_orderu
   start_treeu   traverse_byu   bmi_pre_order_headsu   bmi_post_order_headsu   BMu   runu   leavesu   anyu   valuesu   fixersu   sortu   pytreeu   Baseu   depthu   Trueu   keep_line_orderu
   get_linenou   listu   removeu	   find_rootu
   ValueErroru   fixers_appliedu   matchu	   transformu   Noneu   replaceu   appendu   extendu   finish_treeu   was_changed(
   u   selfu   treeu   nameu   fixeru	   match_setu   nodeu   resultsu   newu   new_matchesu   fxr(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   refactor_tree•  sJ     		.u   RefactoringTool.refactor_treec             C   sƒ   | s
 d Sxr | D]j } xa | | j  D]R } | j | ƒ } | r% | j | | ƒ } | d k	 rw | j | ƒ | } qw q% q% Wq Wd S(   u  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
        N(   u   typeu   matchu	   transformu   Noneu   replace(   u   selfu   fixersu	   traversalu   nodeu   fixeru   resultsu   new(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   traverse_byä  s    u   RefactoringTool.traverse_byc             C   s½   |  j  j | ƒ | d k rB |  j | ƒ d } | d k rB d Sn  | | k } |  j | | | | ƒ | rŠ |  j d | ƒ |  j sŠ d Sn  | r© |  j | | | | ƒ n |  j d | ƒ d S(   uR   
        Called when a file has been refactored and there may be changes.
        i    Nu   No changes to %su   Not writing changes to %s(   u   filesu   appendu   Noneu   _read_python_sourceu   print_outputu	   log_debugu   write_unchanged_filesu
   write_file(   u   selfu   new_textu   filenameu   old_textu   writeu   encodingu   equal(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   processed_fileû  s    	u   RefactoringTool.processed_filec          %   C   sß   y t  | d d | ƒ} Wn? t j k
 rZ } z |  j d | | ƒ d SWYd d } ~ Xn XzY y | j t | ƒ ƒ Wn; t j k
 r² } z |  j d | | ƒ WYd d } ~ Xn XWd | j ƒ  X|  j d | ƒ d |  _	 d S(   uÑ   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.
        u   wu   encodingu   Can't create %s: %sNu   Can't write %s: %su   Wrote changes to %sT(
   u   _open_with_encodingu   osu   erroru	   log_erroru   writeu   _to_system_newlinesu   closeu	   log_debugu   Trueu   wrote(   u   selfu   new_textu   filenameu   old_textu   encodingu   fu   err(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu
   write_file  s    *u   RefactoringTool.write_fileu   >>> u   ... c       
   	   C   s  g  } d } d } d } d } x4| j d d ƒ D] } | d 7} | j ƒ  j |  j ƒ r» | d k	 r‡ | j |  j | | | | ƒ ƒ n  | } | g } | j |  j ƒ }	 | d |	 … } q1 | d k	 r
| j | |  j	 ƒ sú | | |  j	 j
 ƒ  d k r
| j | ƒ q1 | d k	 r8| j |  j | | | | ƒ ƒ n  d } d } | j | ƒ q1 W| d k	 rƒ| j |  j | | | | ƒ ƒ n  d j | ƒ S(   uË  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.)
        i    u   keependsi   Nu   
u    T(   u   Noneu
   splitlinesu   Trueu   lstripu
   startswithu   PS1u   extendu   refactor_doctestu   findu   PS2u   rstripu   appendu   join(
   u   selfu   inputu   filenameu   resultu   blocku   block_linenou   indentu   linenou   lineu   i(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   refactor_docstring(  s:    
	u"   RefactoringTool.refactor_docstringc       
         s  y ˆ j  | | ˆ  ƒ } WnŠ t k
 r¥ } zj ˆ j j t j ƒ rp x* | D] } ˆ j d | j d ƒ ƒ qJ Wn  ˆ j d | | | j	 j
 | ƒ | SWYd d } ~ Xn Xˆ j | | ƒ r‰t | ƒ j d d
 ƒ } | d | d … | | d d … }	 } |	 d g | d k st |	 ƒ ‚ | d j d ƒ s@| d d 7<n  ˆ  ˆ j | j d ƒ g } | r‰| ‡  ‡ f d d	 †  | Dƒ 7} q‰n  | S(   uÞ   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).

        u
   Source: %su   
u+   Can't parse docstring in %s line %s: %s: %sNu   keependsi   i    c                s!   g  |  ] } ˆ  ˆ j  | ‘ q S(    (   u   PS2(   u   .0u   line(   u   indentu   self(    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu
   <listcomp>m  s   	 u4   RefactoringTool.refactor_doctest.<locals>.<listcomp>Tiÿÿÿÿiÿÿÿÿ(   u   parse_blocku	   Exceptionu   loggeru   isEnabledForu   loggingu   DEBUGu	   log_debugu   rstripu	   log_erroru	   __class__u   __name__u   refactor_treeu   stru
   splitlinesu   Trueu   AssertionErroru   endswithu   PS1u   pop(
   u   selfu   blocku   linenou   indentu   filenameu   treeu   erru   lineu   newu   clipped(    (   u   indentu   selfu5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   refactor_doctestS  s&     	)#&u    RefactoringTool.refactor_doctestc             C   s  |  j  r d } n d } |  j s4 |  j d | ƒ n1 |  j d | ƒ x |  j D] } |  j | ƒ qN W|  j rŸ |  j d ƒ x! |  j D] } |  j | ƒ q… Wn  |  j rt |  j ƒ d k rÍ |  j d ƒ n |  j d t |  j ƒ ƒ x0 |  j D]" \ } } } |  j | | | Ž qð Wn  d  S(	   Nu   wereu
   need to beu   No files %s modified.u   Files that %s modified:u$   Warnings/messages while refactoring:i   u   There was 1 error:u   There were %d errors:(   u   wroteu   filesu   log_messageu	   fixer_logu   errorsu   len(   u   selfu   wereu   fileu   messageu   msgu   argsu   kwds(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu	   summarizep  s$    					u   RefactoringTool.summarizec             C   s1   |  j  j |  j | | | ƒ ƒ } t ƒ  | _ | S(   u³   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.
        (   u   driveru   parse_tokensu	   wrap_toksu	   frozensetu   future_features(   u   selfu   blocku   linenou   indentu   tree(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   parse_block‡  s    !u   RefactoringTool.parse_blockc             c   sŠ   t  j |  j | | ƒ j ƒ } xe | D]] \ } } \ } } \ }	 }
 } | | d 7} |	 | d 7}	 | | | | f |	 |
 f | f Vq% Wd S(   u;   Wraps a tokenize stream to systematically modify start/end.i   N(   u   tokenizeu   generate_tokensu	   gen_linesu   __next__(   u   selfu   blocku   linenou   indentu   tokensu   typeu   valueu   line0u   col0u   line1u   col1u	   line_text(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu	   wrap_toks‘  s
    (u   RefactoringTool.wrap_toksc             c   s¡   | |  j  } | |  j } | } xo | D]g } | j | ƒ rT | t | ƒ d … Vn4 | | j ƒ  d k rr d Vn t d | | f ƒ ‚ | } q' Wx d Vq• d S(   u–   Generates lines as expected by tokenize from a list of lines.

        This strips the first len(indent + self.PS1) characters off each line.
        Nu   
u   line=%r, prefix=%ru    (   u   PS1u   PS2u
   startswithu   lenu   rstripu   AssertionError(   u   selfu   blocku   indentu   prefix1u   prefix2u   prefixu   line(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu	   gen_linesŸ  s    
u   RefactoringTool.gen_linesNF(    u   __name__u
   __module__u   __qualname__u   Falseu   _default_optionsu   CLASS_PREFIXu   FILE_PREFIXu   Noneu   __init__u
   get_fixersu	   log_erroru   log_messageu	   log_debugu   print_outputu   refactoru   refactor_diru   _read_python_sourceu   refactor_fileu   refactor_stringu   refactor_stdinu   refactor_treeu   traverse_byu   processed_fileu
   write_fileu   PS1u   PS2u   refactor_docstringu   refactor_doctestu	   summarizeu   parse_blocku	   wrap_toksu	   gen_lines(   u
   __locals__(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   RefactoringTool®   s:   

4(	O+
u   RefactoringToolc             B   s   |  Ee  Z d  Z d S(   u   MultiprocessingUnsupportedN(   u   __name__u
   __module__u   __qualname__(   u
   __locals__(    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   MultiprocessingUnsupported³  s   u   MultiprocessingUnsupportedc                se   |  Ee  Z d  Z ‡  f d d †  Z d
 d
 d ‡  f d d † Z ‡  f d d †  Z ‡  f d d	 †  Z ‡  S(   u   MultiprocessRefactoringToolc                s/   t  t |  ƒ j | | Ž  d  |  _ d  |  _ d  S(   N(   u   superu   MultiprocessRefactoringToolu   __init__u   Noneu   queueu   output_lock(   u   selfu   argsu   kwargs(   u	   __class__(    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   __init__¹  s    	u$   MultiprocessRefactoringTool.__init__i   c                s[  | d k r( t  t ˆ ƒ j | | | ƒ Sy d d  l ‰  Wn t k
 rR t ‚ Yn Xˆ j d  k	 rq t d ƒ ‚ n  ˆ  j	 ƒ  ˆ _ ˆ  j
 ƒ  ˆ _ ‡  ‡ f d d †  t | ƒ Dƒ } z; x | D] } | j ƒ  q» Wt  t ˆ ƒ j | | | ƒ Wd  ˆ j j ƒ  x$ t | ƒ D] } ˆ j j d  ƒ q	Wx' | D] } | j ƒ  r*| j ƒ  q*q*Wd  ˆ _ Xd  S(   Ni   i    u    already doing multiple processesc                s%   g  |  ] } ˆ  j  d  ˆ j ƒ ‘ q S(   u   target(   u   Processu   _child(   u   .0u   i(   u   multiprocessingu   self(    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu
   <listcomp>Ë  s   	u8   MultiprocessRefactoringTool.refactor.<locals>.<listcomp>(   u   superu   MultiprocessRefactoringToolu   refactoru   multiprocessingu   ImportErroru   MultiprocessingUnsupportedu   queueu   Noneu   RuntimeErroru   JoinableQueueu   Locku   output_locku   rangeu   startu   joinu   putu   is_alive(   u   selfu   itemsu   writeu   doctests_onlyu   num_processesu	   processesu   pu   i(   u	   __class__(   u   multiprocessingu   selfu5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   refactor¾  s2    u$   MultiprocessRefactoringTool.refactorc          
      so   |  j  j ƒ  } xY | d  k	 rj | \ } } z t t |  ƒ j | | Ž  Wd  |  j  j ƒ  X|  j  j ƒ  } q Wd  S(   N(   u   queueu   getu   Noneu   superu   MultiprocessRefactoringToolu   refactor_fileu	   task_done(   u   selfu   tasku   argsu   kwargs(   u	   __class__(    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   _childÛ  s    u"   MultiprocessRefactoringTool._childc                sE   |  j  d  k	 r( |  j  j | | f ƒ n t t |  ƒ j | | Ž  Sd  S(   N(   u   queueu   Noneu   putu   superu   MultiprocessRefactoringToolu   refactor_file(   u   selfu   argsu   kwargs(   u	   __class__(    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   refactor_fileæ  s    u)   MultiprocessRefactoringTool.refactor_fileF(   u   __name__u
   __module__u   __qualname__u   __init__u   Falseu   refactoru   _childu   refactor_file(   u
   __locals__(    (   u	   __class__u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   MultiprocessRefactoringTool·  s
   u   MultiprocessRefactoringTool(-   u   __doc__u
   __future__u   with_statementu
   __author__u   osu   sysu   loggingu   operatoru   collectionsu   iou	   itertoolsu   chainu   pgen2u   driveru   tokenizeu   tokenu
   fixer_utilu	   find_rootu    u   pytreeu   pygramu	   btm_utilsu   buu   btm_matcheru   bmu   Trueu   get_all_fix_namesu	   Exceptionu
   _EveryNodeu   _get_head_typesu   _get_headnode_dictu   get_fixers_from_packageu	   _identityu   version_infou   codecsu   openu   _open_with_encodingu   _from_system_newlinesu   _to_system_newlinesu   _detect_future_featuresu
   FixerErroru   objectu   RefactoringToolu   MultiprocessingUnsupportedu   MultiprocessRefactoringTool(    (    (    u5   /opt/alt/python33/lib64/python3.3/lib2to3/refactor.pyu   <module>	   sF   	(ÿ ÿ 