Linux server.edchosting.com 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
LiteSpeed
Server IP : 75.98.162.185 & Your IP : 216.73.216.163
Domains :
Cant Read [ /etc/named.conf ]
User : goons4good
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
lib64 /
python2.7 /
site-packages /
numpy /
oldnumeric /
Delete
Unzip
Name
Size
Permission
Date
Action
tests
[ DIR ]
drwxr-xr-x
2021-09-16 10:54
__init__.py
827
B
-rw-r--r--
2013-04-07 01:04
__init__.pyc
1022
B
-rw-r--r--
2018-04-10 19:40
__init__.pyo
1022
B
-rw-r--r--
2018-04-10 19:40
alter_code1.py
8.3
KB
-rw-r--r--
2013-04-07 01:04
alter_code1.pyc
9.49
KB
-rw-r--r--
2018-04-10 19:40
alter_code1.pyo
9.49
KB
-rw-r--r--
2018-04-10 19:40
alter_code2.py
4.53
KB
-rw-r--r--
2013-04-07 01:04
alter_code2.pyc
5.96
KB
-rw-r--r--
2018-04-10 19:40
alter_code2.pyo
5.96
KB
-rw-r--r--
2018-04-10 19:40
array_printer.py
456
B
-rw-r--r--
2013-04-07 01:04
array_printer.pyc
667
B
-rw-r--r--
2018-04-10 19:40
array_printer.pyo
667
B
-rw-r--r--
2018-04-10 19:40
arrayfns.py
2.47
KB
-rw-r--r--
2013-04-07 01:04
arrayfns.pyc
4.32
KB
-rw-r--r--
2018-04-10 19:40
arrayfns.pyo
4.32
KB
-rw-r--r--
2018-04-10 19:40
compat.py
3.11
KB
-rw-r--r--
2013-04-07 01:04
compat.pyc
4.88
KB
-rw-r--r--
2018-04-10 19:40
compat.pyo
4.88
KB
-rw-r--r--
2018-04-10 19:40
fft.py
869
B
-rw-r--r--
2013-04-07 01:04
fft.pyc
1.03
KB
-rw-r--r--
2018-04-10 19:40
fft.pyo
1.03
KB
-rw-r--r--
2018-04-10 19:40
fix_default_axis.py
7.85
KB
-rw-r--r--
2013-04-07 01:04
fix_default_axis.pyc
7.68
KB
-rw-r--r--
2018-04-10 19:40
fix_default_axis.pyo
7.68
KB
-rw-r--r--
2018-04-10 19:40
functions.py
3.55
KB
-rw-r--r--
2013-04-07 01:04
functions.pyc
7.31
KB
-rw-r--r--
2018-04-10 19:40
functions.pyo
7.31
KB
-rw-r--r--
2018-04-10 19:40
linear_algebra.py
2.13
KB
-rw-r--r--
2013-04-07 01:04
linear_algebra.pyc
3.34
KB
-rw-r--r--
2018-04-10 19:40
linear_algebra.pyo
3.34
KB
-rw-r--r--
2018-04-10 19:40
ma.py
73.96
KB
-rw-r--r--
2013-04-07 01:04
ma.pyc
83.81
KB
-rw-r--r--
2018-04-10 19:40
ma.pyo
83.81
KB
-rw-r--r--
2018-04-10 19:40
matrix.py
1.57
KB
-rw-r--r--
2013-04-07 01:04
matrix.pyc
2.31
KB
-rw-r--r--
2018-04-10 19:40
matrix.pyo
2.31
KB
-rw-r--r--
2018-04-10 19:40
misc.py
1.14
KB
-rw-r--r--
2013-04-07 01:04
misc.pyc
1.53
KB
-rw-r--r--
2018-04-10 19:40
misc.pyo
1.53
KB
-rw-r--r--
2018-04-10 19:40
mlab.py
3.36
KB
-rw-r--r--
2013-04-07 01:04
mlab.pyc
5.32
KB
-rw-r--r--
2018-04-10 19:40
mlab.pyo
5.32
KB
-rw-r--r--
2018-04-10 19:40
precision.py
4.16
KB
-rw-r--r--
2013-04-07 01:04
precision.pyc
3.85
KB
-rw-r--r--
2018-04-10 19:40
precision.pyo
3.85
KB
-rw-r--r--
2018-04-10 19:40
random_array.py
11.18
KB
-rw-r--r--
2013-04-07 01:04
random_array.pyc
13.89
KB
-rw-r--r--
2018-04-10 19:40
random_array.pyo
13.89
KB
-rw-r--r--
2018-04-10 19:40
rng.py
3.67
KB
-rw-r--r--
2013-04-07 01:04
rng.pyc
6.74
KB
-rw-r--r--
2018-04-10 19:40
rng.pyo
6.74
KB
-rw-r--r--
2018-04-10 19:40
rng_stats.py
1.31
KB
-rw-r--r--
2013-04-07 01:04
rng_stats.pyc
1.83
KB
-rw-r--r--
2018-04-10 19:40
rng_stats.pyo
1.83
KB
-rw-r--r--
2018-04-10 19:40
setup.py
335
B
-rw-r--r--
2013-04-07 01:04
setup.pyc
664
B
-rw-r--r--
2018-04-10 19:40
setup.pyo
664
B
-rw-r--r--
2018-04-10 19:40
setupscons.py
282
B
-rw-r--r--
2013-04-07 01:04
setupscons.pyc
613
B
-rw-r--r--
2018-04-10 19:40
setupscons.pyo
613
B
-rw-r--r--
2018-04-10 19:40
typeconv.py
1.58
KB
-rw-r--r--
2013-04-07 01:04
typeconv.pyc
1.59
KB
-rw-r--r--
2018-04-10 19:40
typeconv.pyo
1.59
KB
-rw-r--r--
2018-04-10 19:40
ufuncs.py
1.2
KB
-rw-r--r--
2013-04-07 01:04
ufuncs.pyc
1.79
KB
-rw-r--r--
2018-04-10 19:40
ufuncs.pyo
1.79
KB
-rw-r--r--
2018-04-10 19:40
user_array.py
182
B
-rw-r--r--
2013-04-07 01:04
user_array.pyc
370
B
-rw-r--r--
2018-04-10 19:40
user_array.pyo
370
B
-rw-r--r--
2018-04-10 19:40
Save
Rename
""" This module adds the default axis argument to code which did not specify it for the functions where the default was changed in NumPy. The functions changed are add -1 ( all second argument) ====== nansum nanmax nanmin nanargmax nanargmin argmax argmin compress 3 add 0 ====== take 3 repeat 3 sum # might cause problems with builtin. product sometrue alltrue cumsum cumproduct average ptp cumprod prod std mean """ __all__ = ['convertfile', 'convertall', 'converttree'] import sys import os import re import glob _args3 = ['compress', 'take', 'repeat'] _funcm1 = ['nansum', 'nanmax', 'nanmin', 'nanargmax', 'nanargmin', 'argmax', 'argmin', 'compress'] _func0 = ['take', 'repeat', 'sum', 'product', 'sometrue', 'alltrue', 'cumsum', 'cumproduct', 'average', 'ptp', 'cumprod', 'prod', 'std', 'mean'] _all = _func0 + _funcm1 func_re = {} for name in _all: _astr = r"""%s\s*[(]"""%name func_re[name] = re.compile(_astr) import string disallowed = '_' + string.uppercase + string.lowercase + string.digits def _add_axis(fstr, name, repl): alter = 0 if name in _args3: allowed_comma = 1 else: allowed_comma = 0 newcode = "" last = 0 for obj in func_re[name].finditer(fstr): nochange = 0 start, end = obj.span() if fstr[start-1] in disallowed: continue if fstr[start-1] == '.' \ and fstr[start-6:start-1] != 'numpy' \ and fstr[start-2:start-1] != 'N' \ and fstr[start-9:start-1] != 'numarray' \ and fstr[start-8:start-1] != 'numerix' \ and fstr[start-8:start-1] != 'Numeric': continue if fstr[start-1] in ['\t',' ']: k = start-2 while fstr[k] in ['\t',' ']: k -= 1 if fstr[k-2:k+1] == 'def' or \ fstr[k-4:k+1] == 'class': continue k = end stack = 1 ncommas = 0 N = len(fstr) while stack: if k>=N: nochange =1 break if fstr[k] == ')': stack -= 1 elif fstr[k] == '(': stack += 1 elif stack == 1 and fstr[k] == ',': ncommas += 1 if ncommas > allowed_comma: nochange = 1 break k += 1 if nochange: continue alter += 1 newcode = "%s%s,%s)" % (newcode, fstr[last:k-1], repl) last = k if not alter: newcode = fstr else: newcode = "%s%s" % (newcode, fstr[last:]) return newcode, alter def _import_change(fstr, names): # Four possibilities # 1.) import numpy with subsequent use of numpy.<name> # change this to import numpy.oldnumeric as numpy # 2.) import numpy as XXXX with subsequent use of # XXXX.<name> ==> import numpy.oldnumeric as XXXX # 3.) from numpy import * # with subsequent use of one of the names # 4.) from numpy import ..., <name>, ... (could span multiple # lines. ==> remove all names from list and # add from numpy.oldnumeric import <name> num = 0 # case 1 importstr = "import numpy" ind = fstr.find(importstr) if (ind > 0): found = 0 for name in names: ind2 = fstr.find("numpy.%s" % name, ind) if (ind2 > 0): found = 1 break if found: fstr = "%s%s%s" % (fstr[:ind], "import numpy.oldnumeric as numpy", fstr[ind+len(importstr):]) num += 1 # case 2 importre = re.compile("""import numpy as ([A-Za-z0-9_]+)""") modules = importre.findall(fstr) if len(modules) > 0: for module in modules: found = 0 for name in names: ind2 = fstr.find("%s.%s" % (module, name)) if (ind2 > 0): found = 1 break if found: importstr = "import numpy as %s" % module ind = fstr.find(importstr) fstr = "%s%s%s" % (fstr[:ind], "import numpy.oldnumeric as %s" % module, fstr[ind+len(importstr):]) num += 1 # case 3 importstr = "from numpy import *" ind = fstr.find(importstr) if (ind > 0): found = 0 for name in names: ind2 = fstr.find(name, ind) if (ind2 > 0) and fstr[ind2-1] not in disallowed: found = 1 break if found: fstr = "%s%s%s" % (fstr[:ind], "from numpy.oldnumeric import *", fstr[ind+len(importstr):]) num += 1 # case 4 ind = 0 importstr = "from numpy import" N = len(importstr) while 1: ind = fstr.find(importstr, ind) if (ind < 0): break ind += N ptr = ind+1 stack = 1 while stack: if fstr[ptr] == '\\': stack += 1 elif fstr[ptr] == '\n': stack -= 1 ptr += 1 substr = fstr[ind:ptr] found = 0 substr = substr.replace('\n',' ') substr = substr.replace('\\','') importnames = [x.strip() for x in substr.split(',')] # determine if any of names are in importnames addnames = [] for name in names: if name in importnames: importnames.remove(name) addnames.append(name) if len(addnames) > 0: fstr = "%s%s\n%s\n%s" % \ (fstr[:ind], "from numpy import %s" % \ ", ".join(importnames), "from numpy.oldnumeric import %s" % \ ", ".join(addnames), fstr[ptr:]) num += 1 return fstr, num def add_axis(fstr, import_change=False): total = 0 if not import_change: for name in _funcm1: fstr, num = _add_axis(fstr, name, 'axis=-1') total += num for name in _func0: fstr, num = _add_axis(fstr, name, 'axis=0') total += num return fstr, total else: fstr, num = _import_change(fstr, _funcm1+_func0) return fstr, num def makenewfile(name, filestr): fid = file(name, 'w') fid.write(filestr) fid.close() def getfile(name): fid = file(name) filestr = fid.read() fid.close() return filestr def copyfile(name, fstr): base, ext = os.path.splitext(name) makenewfile(base+'.orig', fstr) return def convertfile(filename, import_change=False): """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 """ filestr = getfile(filename) newstr, total = add_axis(filestr, import_change) if total > 0: print "Changing ", filename copyfile(filename, filestr) makenewfile(filename, newstr) sys.stdout.flush() def fromargs(args): filename = args[1] convertfile(filename) def convertall(direc=os.path.curdir, import_change=False): """Convert all .py files 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. """ files = glob.glob(os.path.join(direc,'*.py')) for afile in files: convertfile(afile, import_change) def _func(arg, dirname, fnames): convertall(dirname, import_change=arg) def converttree(direc=os.path.curdir, import_change=False): """Convert all .py files in the tree given """ os.path.walk(direc, _func, import_change) if __name__ == '__main__': fromargs(sys.argv)