Ñò
•à"Ic           @   so   d  Z  d d k Z d d k Z d d k Z d d k Z d d k l Z d e i f d „  ƒ  YZ d d „ Z
 d S(   s   
Main program for 2to3.
iÿÿÿÿNi   (   t   refactort   StdoutRefactoringToolc           B   s    e  Z d  Z d „  Z d „  Z RS(   s"   
    Prints output to stdout.
    c         O   s3   |  i  i | | | f ƒ |  i i | | | Ž d  S(   N(   t   errorst   appendt   loggert   error(   t   selft   msgt   argst   kwargs(    (    s)   /mit/python/lib/python2.6/lib2to3/main.pyt	   log_error   s    c         C   s   x | D] } | GHq Wd  S(   N(    (   R   t   linest   line(    (    s)   /mit/python/lib/python2.6/lib2to3/main.pyt   print_output   s     (   t   __name__t
   __module__t   __doc__R
   R   (    (    (    s)   /mit/python/lib/python2.6/lib2to3/main.pyR      s   	c      	   C   s¦  t  i d d ƒ } | i d d d d d d ƒ| i d	 d
 d d d g  d d ƒ| i d d d d d d ƒ| i d d d d d d ƒ| i d d d d d d ƒ| i d d d d d d ƒt } | i | ƒ \ } } | i o4 d GHx t i |  ƒ D] } | GHqú W| p d Sn | p t i	 d IJt i	 d IJd Sd | j o& t
 } | i o t i	 d  IJd Sn | i o
 t i n t i } t i d! d" d# | ƒ h | i d$ 6} t i |  ƒ } g  }	 | i o^ g  }
 | i D]& } | d% j o |
 |  d& | qâqâ~
 }	 d% | i j o | n |	 } n | } t | | d' |	 ƒ} | i p< | o | i ƒ  n | i | | i | i ƒ | i ƒ  n t t | i ƒ ƒ S((   sþ   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).
    t   usages"   refactor.py [options] file|dir ...s   -ds   --doctests_onlyt   actiont
   store_truet   helps   Fix up doctests onlys   -fs   --fixR   t   defaults0   Each FIX specifies a transformation; default alls   -ls   --list-fixess/   List available transformations (fixes/fix_*.py)s   -ps   --print-functions0   Modify the grammar so that print() is a functions   -vs	   --verboses   More verbose loggings   -ws   --writes   Write back modified filess2   Available transformations for the -f/--fix option:i    s1   At least one file or directory argument required.s   Use --help to show usage.i   t   -s   Can't write to stdin.t   formats   %(name)s: %(message)st   levelt   print_functiont   alls   .fix_t   explicit(   t   optparset   OptionParsert
   add_optiont   Falset
   parse_argst
   list_fixesR    t   get_all_fix_namest   syst   stderrt   Truet   writet   verboset   loggingt   DEBUGt   INFOt   basicConfigR   t   get_fixers_from_packaget   fixR   R   t   refactor_stdint   doctests_onlyt	   summarizet   intt   bool(   t	   fixer_pkgR   t   parserR.   t   optionst   fixnameR   t   rt_optst   avail_namesR   t   _[1]R-   t   fixer_namest   rt(    (    s)   /mit/python/lib/python2.6/lib2to3/main.pyt   main   s`    
 		
	
6!
(   R   R#   t   osR(   R   t    R    t   RefactoringToolR   t   NoneR<   (    (    (    s)   /mit/python/lib/python2.6/lib2to3/main.pyt   <module>   s   