%PDF- %PDF-
Direktori : /proc/thread-self/root/lib64/python2.7/Tools/scripts/ |
Current File : //proc/thread-self/root/lib64/python2.7/Tools/scripts/cleanfuture.pyc |
� �fc @ s� d Z d d l Z d d l Z d d l Z d d l Z d a d a d a d � Z d � Z d � Z d d d � � YZ e d k r� e � n d S( s� cleanfuture [-d][-r][-v] path ... -d Dry run. Analyze, but don't make any changes to, files. -r Recurse. Search for all .py files in subdirectories too. -v Verbose. Print informative msgs. Search Python (.py) files for future statements, and remove the features from such statements that are already mandatory in the version of Python you're using. Pass one or more file and/or directory paths. When a directory path, all .py files within the directory will be examined, and, if the -r option is given, likewise recursively for subdirectories. Overwrites files in place, renaming the originals with a .bak extension. If cleanfuture finds nothing to change, the file is left alone. If cleanfuture does change a file, the changed file is a fixed-point (i.e., running cleanfuture on the resulting .py file won't change it again, at least not until you try it again with a later Python release). Limitations: You can do these things, but this tool won't help you then: + A future statement cannot be mixed with any other statement on the same physical line (separated by semicolon). + A future statement cannot contain an "as" clause. Example: Assuming you're using Python 2.2, if a file containing from __future__ import nested_scopes, generators is analyzed by cleanfuture, the line is rewritten to from __future__ import generators because nested_scopes is no longer optional in 2.2 but generators is. i����Ni c G sO t t | � } d j | � } | d d k r; | d 7} n t j j | � d S( Nt i����s ( t mapt strt joint syst stderrt write( t argst stringst msg( ( s1 /usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt errprint2 s c C s� d d l } y# | j t j d d � \ } } Wn! | j k rR } t | � d SXx_ | D]W \ } } | d k r t d 7a qZ | d k r� t d 7a qZ | d k rZ t d 7a qZ qZ W| s� t d t � d Sx | D] } t | � q� Wd S( Ni����i t drvs -ds -rs -vs Usage:( t getoptR t argvt errorR t dryrunt recurset verboset __doc__t check( R t optsR R t ot at arg( ( s1 /usr/lib64/python2.7/Tools/scripts/cleanfuture.pyt main9 s$ # c C s� t j j | � r� t j j | � r� t r7 d G| GHn t j | � } xp | D]h } t j j | | � } t r� t j j | � r� t j j | � s� | j � j d � rM t | � qM qM Wd St r� d G| Gd Gn y t | � } Wn. t k r} t d | t | � f � d SXt | | � } | j � } | rA| j � n | j � | r�t rmd GHt rmd GHqmn xw | D]o \ } } } d | | d | d f GHx&