Skip to content

Commit 9cc5325

Browse files
MAINT: Apply ruff/flake8-pie rule PIE810
PIE810 Call `startswith` once with a `tuple`
1 parent 6a6a08e commit 9cc5325

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

doc/postprocess.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ def process_tex(lines):
3434
"""
3535
new_lines = []
3636
for line in lines:
37-
if (line.startswith(r'\section{numpy.')
38-
or line.startswith(r'\subsection{numpy.')
39-
or line.startswith(r'\subsubsection{numpy.')
40-
or line.startswith(r'\paragraph{numpy.')
41-
or line.startswith(r'\subparagraph{numpy.')
42-
):
43-
pass # skip!
37+
if line.startswith(("\\section{numpy.",
38+
"\\subsection{numpy.",
39+
"\\subsubsection{numpy.",
40+
"\\paragraph{numpy.",
41+
"\\subparagraph{numpy.",
42+
)):
43+
pass
4444
else:
4545
new_lines.append(line)
4646
return new_lines

numpy/f2py/symbolic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ def restore(r):
14251425
return result
14261426

14271427
# referencing/dereferencing
1428-
if r.startswith('*') or r.startswith('&'):
1428+
if r.startswith(('*', '&')):
14291429
op = {'*': Op.DEREF, '&': Op.REF}[r[0]]
14301430
operand = self.process(restore(r[1:]))
14311431
return Expr(op, operand)

numpy/lib/_npyio_impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def load(file, mmap_mode=None, allow_pickle=False, fix_imports=True,
469469
# If the file size is less than N, we need to make sure not
470470
# to seek past the beginning of the file
471471
fid.seek(-min(N, len(magic)), 1) # back-up
472-
if magic.startswith(_ZIP_PREFIX) or magic.startswith(_ZIP_SUFFIX):
472+
if magic.startswith((_ZIP_PREFIX, _ZIP_SUFFIX)):
473473
# zip-file (assume .npz)
474474
# Potentially transfer file ownership to NpzFile
475475
stack.pop_all()

0 commit comments

Comments
 (0)