£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>

fm  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   keyiT(   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       
         sj  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 | |  rft |  j d d
  } | d | d  | | d d  }	 } | d j d  s| d d 7<n     j | j d  g } | rf|    f d d	   | D 7} qf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>Tii(   u   parse_blocku	   Exceptionu   loggeru   isEnabledForu   loggingu   DEBUGu	   log_debugu   rstripu	   log_erroru	   __class__u   __name__u   refactor_treeu   stru
   splitlinesu   Trueu   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   	(  