From f2c07bcc0b89a8b66046a3b31b3a274f88637bba Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Mon, 29 Dec 2025 11:36:18 +0800 Subject: [PATCH] Remove compatibility codes for Python<3.12 --- pygmt/src/_common.py | 3 +-- pygmt/xarray/accessor.py | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pygmt/src/_common.py b/pygmt/src/_common.py index b448cf2c039..32a01bc0a80 100644 --- a/pygmt/src/_common.py +++ b/pygmt/src/_common.py @@ -190,8 +190,7 @@ def __init__( Doesn't apply to the conventions ``"aki"``, ``"gcmt"``, and ``"partial"``. """ - # TODO(Python>=3.12): Simplify to "convention in _FocalMechanismConventionCode". - if convention in _FocalMechanismConventionCode.__members__.values(): + if convention in _FocalMechanismConventionCode: # Convention is specified via the actual single-letter convention code. self.code = _FocalMechanismConventionCode(convention) # Parse the convention from the convention code name. diff --git a/pygmt/xarray/accessor.py b/pygmt/xarray/accessor.py index 05e162ed78f..7d5ecca97e2 100644 --- a/pygmt/xarray/accessor.py +++ b/pygmt/xarray/accessor.py @@ -209,8 +209,7 @@ def registration(self) -> GridRegistration: @registration.setter def registration(self, value: GridRegistration | int): - # TODO(Python>=3.12): Simplify to `if value not in GridRegistration`. - if value not in GridRegistration.__members__.values(): + if value not in GridRegistration: raise GMTValueError( value, description="grid registration", choices=GridRegistration ) @@ -225,8 +224,7 @@ def gtype(self) -> GridType: @gtype.setter def gtype(self, value: GridType | int): - # TODO(Python>=3.12): Simplify to `if value not in GridType`. - if value not in GridType.__members__.values(): + if value not in GridType: raise GMTValueError( value, description="grid coordinate system type", choices=GridType )