Skip to content

Commit ae8e5b5

Browse files
STY: Apply ruff/flake8-bugbear rule B009
B009 Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
1 parent 83eaf0b commit ae8e5b5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

nibabel/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Generate dynamic fixtures
77
def pytest_generate_tests(metafunc):
88
if 'supported_dtype' in metafunc.fixturenames:
9-
if metafunc.cls is None or not getattr(metafunc.cls, 'image_class'):
9+
if metafunc.cls is None or not metafunc.cls.image_class:
1010
raise pytest.UsageError(
1111
'Attempting to use supported_dtype fixture outside an image test case'
1212
)

nibabel/viewers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ def _set_position(self, x, y, z, notify=True):
447447
# Matplotlib handlers ####################################################
448448
def _in_axis(self, event):
449449
"""Return axis index if within one of our axes, else None"""
450-
if getattr(event, 'inaxes') is None:
450+
if event.inaxes is None:
451451
return None
452452
for ii, ax in enumerate(self._axes):
453453
if event.inaxes is ax:

0 commit comments

Comments
 (0)