summaryrefslogtreecommitdiff
path: root/numpy/distutils/command
diff options
context:
space:
mode:
authorSebastian Berg <sebastianb@nvidia.com>2023-04-28 10:04:53 +0200
committerGitHub <noreply@github.com>2023-04-28 10:04:53 +0200
commit1c9532bb8857551d163517bf0028441c7cd544c8 (patch)
tree328461db08a78ff0db667e7135dd9d8e2f2e1ff5 /numpy/distutils/command
parent7fe3ffadbbe9114cbc561c27d7a6d285f84fc129 (diff)
parent080cf82ebc5858ec47eff0d49bdf48b74f955274 (diff)
downloadnumpy-1c9532bb8857551d163517bf0028441c7cd544c8.tar.gz
Merge pull request #22493 from mwtoews/maint-open
MAINT: remove redundant open() modes and io.open() alias
Diffstat (limited to 'numpy/distutils/command')
-rw-r--r--numpy/distutils/command/build_ext.py4
-rw-r--r--numpy/distutils/command/build_src.py4
-rw-r--r--numpy/distutils/command/install.py2
3 files changed, 5 insertions, 5 deletions
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py
index 871aa1099..68b13c0dd 100644
--- a/numpy/distutils/command/build_ext.py
+++ b/numpy/distutils/command/build_ext.py
@@ -642,12 +642,12 @@ class build_ext (old_build_ext):
if os.path.isfile(fake_lib):
# Replace fake static library
libraries.remove(lib)
- with open(fake_lib, 'r') as f:
+ with open(fake_lib) as f:
unlinkable_fobjects.extend(f.read().splitlines())
# Expand C objects
c_lib = os.path.join(libdir, lib + '.cobjects')
- with open(c_lib, 'r') as f:
+ with open(c_lib) as f:
objects.extend(f.read().splitlines())
# Wrap unlinkable objects to a linkable one
diff --git a/numpy/distutils/command/build_src.py b/numpy/distutils/command/build_src.py
index 5581011f6..bf3d03c70 100644
--- a/numpy/distutils/command/build_src.py
+++ b/numpy/distutils/command/build_src.py
@@ -725,7 +725,7 @@ _has_c_header = re.compile(r'-\*-\s*c\s*-\*-', re.I).search
_has_cpp_header = re.compile(r'-\*-\s*c\+\+\s*-\*-', re.I).search
def get_swig_target(source):
- with open(source, 'r') as f:
+ with open(source) as f:
result = None
line = f.readline()
if _has_cpp_header(line):
@@ -735,7 +735,7 @@ def get_swig_target(source):
return result
def get_swig_modulename(source):
- with open(source, 'r') as f:
+ with open(source) as f:
name = None
for line in f:
m = _swig_module_name_match(line)
diff --git a/numpy/distutils/command/install.py b/numpy/distutils/command/install.py
index 2eff2d145..efa9b4740 100644
--- a/numpy/distutils/command/install.py
+++ b/numpy/distutils/command/install.py
@@ -62,7 +62,7 @@ class install(old_install):
# bdist_rpm fails when INSTALLED_FILES contains
# paths with spaces. Such paths must be enclosed
# with double-quotes.
- with open(self.record, 'r') as f:
+ with open(self.record) as f:
lines = []
need_rewrite = False
for l in f: