diff --git a/lib/matplotlib/testing/jpl_units/Duration.py b/lib/matplotlib/testing/jpl_units/Duration.py index 052c5a47c0fd..84ef2b020c3c 100644 --- a/lib/matplotlib/testing/jpl_units/Duration.py +++ b/lib/matplotlib/testing/jpl_units/Duration.py @@ -22,7 +22,9 @@ def __init__(self, frame, seconds): - frame The frame of the duration. Must be 'ET' or 'UTC' - seconds The number of seconds in the Duration. """ - _api.check_in_list(self.allowed, frame=frame) + # Use local variable to eliminate attribute lookup in check_in_list + allowed = Duration.allowed + _api.check_in_list(allowed, frame=frame) self._frame = frame self._seconds = seconds @@ -135,4 +137,5 @@ def checkSameFrame(self, rhs, func): raise ValueError( f"Cannot {func} Durations with different frames.\n" f"LHS: {self._frame}\n" - f"RHS: {rhs._frame}") + f"RHS: {rhs._frame}" + )