Skip to content

Commit 61a814c

Browse files
committed
Use one-liner to fetch dict key
Gabe suggested using a nice one-liner to get the CalibratedAxis from the dict instead of the if/else statement.
1 parent 0f175dd commit 61a814c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/imagej/metadata.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ def _cal_axis_to_str(cls, axis: "jc.CalibratedAxis") -> str:
2929
if not isinstance(axis, JClass):
3030
axis = axis.__class__
3131

32-
if axis in cls._calibrated_axis_types.keys():
33-
return cls._calibrated_axis_types[axis]
34-
else:
35-
return "unknown"
32+
return cls._calibrated_axis_types.get(axis, "unknown")
3633

3734
@classmethod
3835
def _str_to_cal_axis(cls, axis: str) -> "jc.CalibratedAxis":

0 commit comments

Comments
 (0)