Commit 3d7421b
committed
STYLE: Call
Call `write` once instead of looping by concatenating all strings that
need to be written.
Avoid using `writelines` as `ImageOpener` objects do not have that
attribute.
Fixes:
```
- for val in bvals:
- fid.write(f'{val} ')
+ fid.writelines(f'{val} ' for val in bvals)
```
and other similar errors raised for example in:
https://github.com/nipy/nibabel/actions/runs/16092302666/job/45410655457?pr=1422#step:7:23
Documentation:
https://docs.astral.sh/ruff/rules/for-loop-writes/write once instead of looping1 parent b5ecf48 commit 3d7421b
1 file changed
+3
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | | - | |
362 | | - | |
| 361 | + | |
363 | 362 | | |
364 | 363 | | |
365 | 364 | | |
| |||
369 | 368 | | |
370 | 369 | | |
371 | 370 | | |
372 | | - | |
373 | | - | |
| 371 | + | |
374 | 372 | | |
375 | 373 | | |
376 | 374 | | |
377 | | - | |
378 | | - | |
| 375 | + | |
379 | 376 | | |
380 | 377 | | |
381 | 378 | | |
| |||
0 commit comments