summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2020-01-23 14:40:18 +1100
committerGitHub <noreply@github.com>2020-01-23 14:40:18 +1100
commit883de8fab38766992501bf73dd6f59eb2e0b123f (patch)
tree5cfe31e3805957c54a50b8af51eae021acfab4c7
parent61c5c5d2c4ad91a1c5507162c822bfb1426ea405 (diff)
parent81e770685baa85e72d69f5f8224e53d8193611fa (diff)
downloadnumpy-883de8fab38766992501bf73dd6f59eb2e0b123f.tar.gz
Merge pull request #15362 from mwtoews/def23
MAINT: remove internal functions required to handle Python2/3 logic
-rw-r--r--numpy/core/setup_common.py35
-rw-r--r--numpy/distutils/misc_util.py14
2 files changed, 11 insertions, 38 deletions
diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py
index 6d8e603a7..08337a81e 100644
--- a/numpy/core/setup_common.py
+++ b/numpy/core/setup_common.py
@@ -311,32 +311,15 @@ def pyod(filename):
We only implement enough to get the necessary information for long double
representation, this is not intended as a compatible replacement for od.
"""
- def _pyod2():
- out = []
-
- with open(filename, 'rb') as fid:
- yo = [int(oct(int(binascii.b2a_hex(o), 16))) for o in fid.read()]
- for i in range(0, len(yo), 16):
- line = ['%07d' % int(oct(i))]
- line.extend(['%03d' % c for c in yo[i:i+16]])
- out.append(" ".join(line))
- return out
-
- def _pyod3():
- out = []
-
- with open(filename, 'rb') as fid:
- yo2 = [oct(o)[2:] for o in fid.read()]
- for i in range(0, len(yo2), 16):
- line = ['%07d' % int(oct(i)[2:])]
- line.extend(['%03d' % int(c) for c in yo2[i:i+16]])
- out.append(" ".join(line))
- return out
-
- if sys.version_info[0] < 3:
- return _pyod2()
- else:
- return _pyod3()
+ out = []
+ with open(filename, 'rb') as fid:
+ yo2 = [oct(o)[2:] for o in fid.read()]
+ for i in range(0, len(yo2), 16):
+ line = ['%07d' % int(oct(i)[2:])]
+ line.extend(['%03d' % int(c) for c in yo2[i:i+16]])
+ out.append(" ".join(line))
+ return out
+
_BEFORE_SEQ = ['000', '000', '000', '000', '000', '000', '000', '000',
'001', '043', '105', '147', '211', '253', '315', '357']
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index f9d2be716..68fd9ea36 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -923,18 +923,8 @@ class Configuration:
else:
pn = dot_join(*([parent_name] + subpackage_name.split('.')[:-1]))
args = (pn,)
- def fix_args_py2(args):
- if setup_module.configuration.__code__.co_argcount > 1:
- args = args + (self.top_path,)
- return args
- def fix_args_py3(args):
- if setup_module.configuration.__code__.co_argcount > 1:
- args = args + (self.top_path,)
- return args
- if sys.version_info[0] < 3:
- args = fix_args_py2(args)
- else:
- args = fix_args_py3(args)
+ if setup_module.configuration.__code__.co_argcount > 1:
+ args = args + (self.top_path,)
config = setup_module.configuration(*args)
if config.name!=dot_join(parent_name, subpackage_name):
self.warn('Subpackage %r configuration returned as %r' % \