Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/nipyPublic

Commitc3c3452

Browse files
Apply ruff/refurb preview rule FURB145
FURB145 Prefer `copy` method over slicing
1 parent2c1cf76 commitc3c3452

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎nipy/algorithms/utils/tests/test_pca_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def test_other_axes(data_dict):
302302
assert_almost_equal(pos_dp['basis_vectors'],pos_p[bv_key])
303303
assert_almost_equal(pos_dp['basis_projections'],img_bps.get_fdata())
304304
# And we've replaced the expected axis
305-
exp_coords=in_coords[:]
305+
exp_coords=in_coords.copy()
306306
exp_coords[exp_coords.index(axis_name)]='PCA components'
307307
assertimg_bps.axes.coord_names==tuple(exp_coords)
308308
# If the affine is not diagonal, we'll get an error
@@ -323,6 +323,6 @@ def test_other_axes(data_dict):
323323
pytest.raises(AxisError,pca_image,nd_img,axis_name)
324324
foraxis_namein'kt':
325325
p=pca_image(img,axis_name,ncomp=ncomp)
326-
exp_coords=in_coords[:]
326+
exp_coords=in_coords.copy()
327327
exp_coords[exp_coords.index(axis_name)]='PCA components'
328328
assertp['basis_projections'].axes.coord_names==tuple(exp_coords)

‎nipy/core/utils/generators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def slice_generator(data, axis=0):
182182
slice_template= [slice(0,s)forsindata.shape]
183183

184184
forninrange(nmax):
185-
slices=slice_template[:]
185+
slices=slice_template.copy()
186186
for (a,div,mod)inzip(axis,divs,mods):
187187
x=int(n/div%mod)
188188
slices[a]=x

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp