8000 `extend-select` and additional ruff rules by DimitriPapadopoulos · Pull Request #587 · nipy/nipy · GitHub
[go: up one dir, main page]

Skip to content

extend-select and additional ruff rules #587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
Prev Previous commit
Next Next commit
Apply ruff/pycodestyle rule E714
E714 Test for object identity should be `is not`
  • Loading branch information
DimitriPapadopoulos committed Dec 25, 2024
commit 62031744ef3dbf59df5dc157717640d87de4561f
2 changes: 1 addition & 1 deletion nipy/core/image/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def test_from_image():
assert_array_equal(img.get_fdata(), img2.get_fdata())
assert img.coordmap == img2.coordmap
assert img.metadata == img2.metadata
assert not img.metadata is img2.metadata
assert img.metadata is not img2.metadata
# optional inputs - data
arr2 = arr + 10
new = Image.from_image(img, arr2)
Expand Down
4 changes: 2 additions & 2 deletions nipy/core/image/tests/test_image_spaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ def test_image_as_xyz_image():
for tmap in (img_ro_out, img_ro_in, img_ro_both):
assert not is_xyz_affable(tmap)
img_r = as_xyz_image(tmap)
assert not tmap is img_r
assert tmap is not img_r
assert img == img_r
assert_array_equal(img.get_fdata(), img_r.get_fdata())
img_t0 = rollimg(img, 't')
assert not is_xyz_affable(img_t0)
img_t0_r = as_xyz_image(img_t0)
assert not img_t0 is img_t0_r
assert img_t0 is not img_t0_r
assert_array_equal(img.get_fdata(), img_t0_r.get_fdata())
assert img.coordmap == img_t0_r.coordmap
# Test against nibabel image
Expand Down
2 changes: 1 addition & 1 deletion nipy/io/tests/test_nifti_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_basic_nipy2nifti():
ni_img = nipy2nifti(fimg)
new_hdr = get_header(ni_img)
# header copied on the way through
assert not hdr is new_hdr
assert hdr is not new_hdr
# Check information preserved
assert hdr['slice_duration'] == new_hdr['slice_duration']
assert_array_equal(data, ni_img.get_fdata())
Expand Down
2 changes: 1 addition & 1 deletion nipy/labs/viz_tools/maps_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def plot_map_3d(map, affine, cut_coords=None, anat=None, anat_affine=None,
else:
module = None

if not anat is False:
if anat is not False:
plot_anat_3d(anat=anat, anat_affine=anat_affine, scale=1.05,
outline_color=(.9, .9, .9),
gyri_opacity=.2)
Expand Down
4 changes: 2 additions & 2 deletions nipy/modalities/fmri/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def test_step_function():
lam = lambdify(t, s)
assert_array_equal(lam(tval), [0, 4, 4, 2, 2, 1])
# Name default
assert not re.match(r'step\d+\(t\)$', str(s)) is None
assert re.match(r'step\d+\(t\)$', str(s)) is not None
# Name reloaded
s = step_function([0,4,5],[4,2,1], name='goodie_goodie_yum_yum')
assert str(s) == 'goodie_goodie_yum_yum(t)'
Expand All @@ -147,7 +147,7 @@ def test_blocks():
assert_array_equal(lam(tval), [0, 3, 0, 5])
# Check what happens with names
# Default is from step function
assert not re.match(r'step\d+\(t\)$', str(b)) is None
assert re.match(r'step\d+\(t\)$', str(b)) is not None
# Can pass in another
b = blocks(on_off, name='funky_chicken')
assert str(b) == 'funky_chicken(t)'
Expand Down
2 changes: 1 addition & 1 deletion nipy/testing/tests/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def test_dims():
assert_array_equal(fimg.coordmap.affine[3, 3], 2.0)
# should follow, but also make sure affine is invertible
ainv = fimg.coordmap.inverse
assert not ainv is None
assert ainv is not None
8 changes: 4 additions & 4 deletions tools/gitwash_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def make_link_targets(proj_name,
"""
with open(known_link_fname) as link_fh:
link_contents = link_fh.readlines()
have_url = not url is None
have_ml_url = not ml_url is None
have_url = url is not None
have_ml_url = ml_url is not None
have_gh_url = None
for line in link_contents:
if not have_url:
Expand All @@ -140,12 +140,12 @@ def make_link_targets(proj_name,
raise RuntimeError('Need command line or known project '
'and / or mailing list URLs')
lines = []
if not url is None:
if url is not None:
lines.append(f'.. _`{proj_name}`: {url}\n')
if not have_gh_url:
gh_url = f'https://github.com/{user_name}/{repo_name}\n'
lines.append(f'.. _`{proj_name} github`: {gh_url}\n')
if not ml_url is None:
if ml_url is not None:
lines.append(f'.. _`{proj_name} mailing list`: {ml_url}\n')
if len(lines) == 0:
# Nothing to do
Expand Down
0