Skip to content

Commit f2c07bc

Browse files
committed
Remove compatibility codes for Python<3.12
1 parent 4d5fb26 commit f2c07bc

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

pygmt/src/_common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ def __init__(
190190
191191
Doesn't apply to the conventions ``"aki"``, ``"gcmt"``, and ``"partial"``.
192192
"""
193-
# TODO(Python>=3.12): Simplify to "convention in _FocalMechanismConventionCode".
194-
if convention in _FocalMechanismConventionCode.__members__.values():
193+
if convention in _FocalMechanismConventionCode:
195194
# Convention is specified via the actual single-letter convention code.
196195
self.code = _FocalMechanismConventionCode(convention)
197196
# Parse the convention from the convention code name.

pygmt/xarray/accessor.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ def registration(self) -> GridRegistration:
209209

210210
@registration.setter
211211
def registration(self, value: GridRegistration | int):
212-
# TODO(Python>=3.12): Simplify to `if value not in GridRegistration`.
213-
if value not in GridRegistration.__members__.values():
212+
if value not in GridRegistration:
214213
raise GMTValueError(
215214
value, description="grid registration", choices=GridRegistration
216215
)
@@ -225,8 +224,7 @@ def gtype(self) -> GridType:
225224

226225
@gtype.setter
227226
def gtype(self, value: GridType | int):
228-
# TODO(Python>=3.12): Simplify to `if value not in GridType`.
229-
if value not in GridType.__members__.values():
227+
if value not in GridType:
230228
raise GMTValueError(
231229
value, description="grid coordinate system type", choices=GridType
232230
)

0 commit comments

Comments
 (0)