Current File : //usr/lib64/python2.7/site-packages/numpy/numarray/alter_code2.pyo |
�
E�`Qc @ s� d Z g Z d d l Z e j d � d d l Z d d l Z d d l Z d � Z d � Z d � Z d � Z
e j j d � Z
d � Z e j j d
� Z e d k r� e
e j � n d S( s`
This module converts code written for numpy.numarray to work
with numpy
FIXME: finish this.
i����Ns. numpy.numarray.alter_code2 is not working yet.c C s* t | d � } | j | � | j � d S( Nt w( t filet writet close( t namet filestrt fid( ( s@ /usr/lib64/python2.7/site-packages/numpy/numarray/alter_code2.pyt makenewfile s
c C sO t | � } | j � } | j � t j j | � \ } } t | d | � | S( Ns .orig( R t readR t ost patht splitextR ( R R R t baset ext( ( s@ /usr/lib64/python2.7/site-packages/numpy/numarray/alter_code2.pyt
getandcopy s
c C s) t | � } t | � } t | | � d S( s� Convert the filename given from using Numeric to using NumPy
Copies the file to filename.orig and then over-writes the file
with the updated code
N( R t fromstrR ( t filenameR ( ( s@ /usr/lib64/python2.7/site-packages/numpy/numarray/alter_code2.pyt convertfile s c C s | d } t | � d S( Ni ( R ( t argsR ( ( s@ /usr/lib64/python2.7/site-packages/numpy/numarray/alter_code2.pyt fromargs) s
c C s= t j t j j | d � � } x | D] } t | � q% Wd S( s� Convert all .py files to use NumPy (from Numeric) in the directory given
For each file, a backup of <usesnumeric>.py is made as
<usesnumeric>.py.orig. A new file named <usesnumeric>.py
is then written with the updated code.
s *.pyN( t globR R
t joinR ( t direct filest afile( ( s@ /usr/lib64/python2.7/site-packages/numpy/numarray/alter_code2.pyt
convertall- s
c C s t | � d S( N( R ( t argt dirnamet fnames( ( s@ /usr/lib64/python2.7/site-packages/numpy/numarray/alter_code2.pyt _func8 s c C s t j j | t d � d S( s- Convert all .py files in the tree given
N( R R
t walkR t None( R ( ( s@ /usr/lib64/python2.7/site-packages/numpy/numarray/alter_code2.pyt converttree; s t __main__( t __doc__t __all__t warningst warnt sysR R R R R R R
t curdirR R R t __name__t argv( ( ( s@ /usr/lib64/python2.7/site-packages/numpy/numarray/alter_code2.pyt <module> s