Skip to content

Commit c6bd16f

Browse files
committed
Fix issues after applying AbstractBaseClass
- abstractproperty is deprecated - _validate is optional, so we can't use @AbstractMethod - improve docstrings
1 parent 9eb95fa commit c6bd16f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

pygmt/params/base.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
Base class for common parameters shared in PyGMT.
33
"""
44

5-
6-
from abc import ABC, abstractmethod, abstractproperty
5+
from abc import ABC, abstractmethod
76

87

98
class BaseParam(ABC):
@@ -61,25 +60,22 @@ def __post_init__(self):
6160
"""
6261
self._validate()
6362

64-
@abstractmethod
65-
def _validate(self):
63+
def _validate(self): # noqa: B027
6664
"""
6765
Validate the parameters of the object.
6866
69-
This method should be overridden in subclasses to perform any necessary
67+
Optional method but can be overridden in subclasses to perform any necessary
7068
validation on the parameters.
7169
"""
7270

73-
@abstractproperty
71+
@property
72+
@abstractmethod
7473
def _aliases(self):
7574
"""
7675
List of Alias objects representing the parameters of this class.
7776
78-
This property must be implemented in subclasses to define the parameters
79-
and their aliases.
77+
Must be implemented in subclasses to define the parameters and their aliases.
8078
"""
81-
msg = "The _aliases property must be implemented in subclasses."
82-
raise NotImplementedError(msg)
8379

8480
def __str__(self):
8581
"""

0 commit comments

Comments
 (0)