Skip to content

Commit 0ae8180

Browse files
MAINT: apply ruff/Pycodestyle rule E713
E713 Test for membership should be `not in`
1 parent bb87341 commit 0ae8180

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

.spin/cmds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def test(ctx, pytest_args, markexpr, n_jobs, tests, verbose, *args, **kwargs):
261261
if (n_jobs != "1") and ('-n' not in pytest_args):
262262
pytest_args = ('-n', str(n_jobs)) + pytest_args
263263

264-
if tests and not ('--pyargs' in pytest_args):
264+
if tests and '--pyargs' not in pytest_args:
265265
pytest_args = ('--pyargs', tests) + pytest_args
266266

267267
if verbose:

doc/neps/tools/build_index.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def render(tpl_path, context):
1919
def nep_metadata():
2020
ignore = ('nep-template.rst')
2121
sources = sorted(glob.glob(r'nep-*.rst'))
22-
sources = [s for s in sources if not s in ignore]
22+
sources = [s for s in sources if s not in ignore]
2323

2424
meta_re = r':([a-zA-Z\-]*): (.*)'
2525

@@ -55,7 +55,7 @@ def nep_metadata():
5555
f' {tags["Title"]!r}')
5656

5757
if tags['Status'] in ('Accepted', 'Rejected', 'Withdrawn'):
58-
if not 'Resolution' in tags:
58+
if 'Resolution' not in tags:
5959
raise RuntimeError(
6060
f'NEP {nr} is Accepted/Rejected/Withdrawn but '
6161
'has no Resolution tag'
@@ -70,15 +70,15 @@ def nep_metadata():
7070

7171
for nr, tags in neps.items():
7272
if tags['Status'] == 'Superseded':
73-
if not 'Replaced-By' in tags:
73+
if 'Replaced-By' not in tags:
7474
raise RuntimeError(
7575
f'NEP {nr} has been Superseded, but has no Replaced-By tag'
7676
)
7777

7878
replaced_by = int(re.findall(r'\d+', tags['Replaced-By'])[0])
7979
replacement_nep = neps[replaced_by]
8080

81-
if not 'Replaces' in replacement_nep:
81+
if 'Replaces' not in replacement_nep:
8282
raise RuntimeError(
8383
f'NEP {nr} is superseded by {replaced_by}, but that NEP has '
8484
f"no Replaces tag."

numpy/_core/tests/test_umath_accuracy.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ def test_validate_transcendentals(self):
5353
for filename in files:
5454
filepath = path.join(data_dir, filename)
5555
with open(filepath) as fid:
56-
file_without_comments = (r for r in fid if not r[0] in ('$', '#'))
56+
file_without_comments = (
57+
r for r in fid if r[0] not in ('$', '#')
58+
)
5759
data = np.genfromtxt(file_without_comments,
5860
dtype=('|S39','|S39','|S39',int),
5961
names=('type','input','output','ulperr'),

numpy/f2py/crackfortran.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def readfortrancode(ffile, dowithline=show, istop=1):
455455
elif strictf77:
456456
if len(l) > 72:
457457
l = l[:72]
458-
if not (l[0] in spacedigits):
458+
if l[0] not in spacedigits:
459459
raise Exception('readfortrancode: Found non-(space,digit) char '
460460
'in the first column.\n\tAre you sure that '
461461
'this code is in fix form?\n\tline=%s' % repr(l))
@@ -2951,7 +2951,7 @@ def compute_deps(v, deps):
29512951
else:
29522952
outmess(
29532953
'analyzevars: prefix (%s) were not used\n' % repr(block['prefix']))
2954-
if not block['block'] in ['module', 'pythonmodule', 'python module', 'block data']:
2954+
if block['block'] not in ['module', 'pythonmodule', 'python module', 'block data']:
29552955
if 'commonvars' in block:
29562956
neededvars = copy.copy(block['args'] + block['commonvars'])
29572957
else:

tools/check_installed_files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def get_files(dir_to_check, kind='test'):
117117

118118
for key in targets.keys():
119119
for values in list(targets[key].values()):
120-
if not values['tag'] in all_tags:
120+
if values['tag'] not in all_tags:
121121
all_tags.add(values['tag'])
122122

123123
if all_tags != set(['runtime', 'python-runtime', 'devel', 'tests']):

0 commit comments

Comments
 (0)