summaryrefslogtreecommitdiff
path: root/doc
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 /doc
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 'doc')
-rwxr-xr-xdoc/postprocess.py6
-rwxr-xr-xdoc/preprocess.py4
-rw-r--r--doc/source/reference/simd/gen_features.py4
3 files changed, 7 insertions, 7 deletions
diff --git a/doc/postprocess.py b/doc/postprocess.py
index 3e066d22e..4b48fa443 100755
--- a/doc/postprocess.py
+++ b/doc/postprocess.py
@@ -2,7 +2,7 @@
"""
Post-processes HTML and Latex files output by Sphinx.
"""
-import io
+
def main():
import argparse
@@ -15,13 +15,13 @@ def main():
mode = args.mode
for fn in args.file:
- with io.open(fn, 'r', encoding="utf-8") as f:
+ with open(fn, encoding="utf-8") as f:
if mode == 'html':
lines = process_html(fn, f.readlines())
elif mode == 'tex':
lines = process_tex(f.readlines())
- with io.open(fn, 'w', encoding="utf-8") as f:
+ with open(fn, 'w', encoding="utf-8") as f:
f.write("".join(lines))
def process_html(fn, lines):
diff --git a/doc/preprocess.py b/doc/preprocess.py
index 870d3e123..83980bb2f 100755
--- a/doc/preprocess.py
+++ b/doc/preprocess.py
@@ -32,7 +32,7 @@ def doxy_config(root_path):
confs = []
dsrc_path = os.path.join(root_path, "doc", "source")
sub = dict(ROOT_DIR=root_path)
- with open(os.path.join(dsrc_path, "doxyfile"), "r") as fd:
+ with open(os.path.join(dsrc_path, "doxyfile")) as fd:
conf = DoxyTpl(fd.read())
confs.append(conf.substitute(CUR_DIR=dsrc_path, **sub))
@@ -40,7 +40,7 @@ def doxy_config(root_path):
if ".doxyfile" not in files:
continue
conf_path = os.path.join(dpath, ".doxyfile")
- with open(conf_path, "r") as fd:
+ with open(conf_path) as fd:
conf = DoxyTpl(fd.read())
confs.append(conf.substitute(CUR_DIR=dpath, **sub))
return confs
diff --git a/doc/source/reference/simd/gen_features.py b/doc/source/reference/simd/gen_features.py
index 9a38ef5c9..b141e23d0 100644
--- a/doc/source/reference/simd/gen_features.py
+++ b/doc/source/reference/simd/gen_features.py
@@ -168,7 +168,7 @@ if __name__ == '__main__':
gen_path = path.join(
path.dirname(path.realpath(__file__)), "generated_tables"
)
- with open(path.join(gen_path, 'cpu_features.inc'), 'wt') as fd:
+ with open(path.join(gen_path, 'cpu_features.inc'), 'w') as fd:
fd.write(f'.. generated via {__file__}\n\n')
for arch in (
("x86", "PPC64", "PPC64LE", "ARMHF", "AARCH64", "S390X")
@@ -177,7 +177,7 @@ if __name__ == '__main__':
table = Features(arch, 'gcc').table()
fd.write(wrapper_section(title, table))
- with open(path.join(gen_path, 'compilers-diff.inc'), 'wt') as fd:
+ with open(path.join(gen_path, 'compilers-diff.inc'), 'w') as fd:
fd.write(f'.. generated via {__file__}\n\n')
for arch, cc_names in (
("x86", ("clang", "ICC", "MSVC")),