#NEWLINE# def custom_mangling( filename ) : #NEWLINE# #INDENT# import_mangling = [ os . path . join ( 'core' , '__init__.py' ) , os . path . join ( 'core' , 'numeric.py' ) , os . path . join ( 'core' , '_internal.py' ) , os . path . join ( 'core' , 'arrayprint.py' ) , os . path . join ( 'core' , 'fromnumeric.py' ) , os . path . join ( 'numpy' , '__init__.py' ) , os . path . join ( 'lib' , 'npyio.py' ) , os . path . join ( 'lib' , 'function_base.py' ) , os . path . join ( 'fft' , 'fftpack.py' ) , os . path . join ( 'random' , '__init__.py' ) ] #NEWLINE# if any ( ( filename . endswith ( x ) for x in import_mangling ) ) : #NEWLINE# #INDENT# f = open ( filename , 'r' ) #NEWLINE# text = f . read ( ) #NEWLINE# f . close ( ) #NEWLINE# for mod in [ 'multiarray' , 'scalarmath' , 'umath' , '_sort' , '_compiled_base' , 'core' , 'lib' , 'testing' , 'fft' , 'polynomial' , 'random' , 'ma' , 'linalg' , 'compat' , 'mtrand' , '_dotblas' ] : #NEWLINE# #INDENT# text = re . sub ( ( '^(\\s*)import %s' % mod ) , ( '\\1from . import %s' % mod ) , text , flags = re . M ) #NEWLINE# text = re . sub ( ( '^(\\s*)from %s import' % mod ) , ( '\\1from .%s import' % mod ) , text , flags = re . M ) #NEWLINE# #UNINDENT# text = text . replace ( 'from matrixlib' , 'from .matrixlib' ) #NEWLINE# f = open ( filename , 'w' ) #NEWLINE# f . write ( text ) #NEWLINE# f . close ( )