aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreterbase
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-12-05 01:28:21 -0500
committerEli Schwartz <eschwartz@archlinux.org>2021-12-05 11:39:20 -0500
commit4b2c54569df780e36fc5bf1905ae6b60d1393fba (patch)
tree2b9181948490a8a34eba6be672ca939ef9ac51e9 /mesonbuild/interpreterbase
parent4f0c5af3908241228f042184cdbd2b8fc286712e (diff)
downloadmeson-4b2c54569df780e36fc5bf1905ae6b60d1393fba.zip
meson-4b2c54569df780e36fc5bf1905ae6b60d1393fba.tar.gz
meson-4b2c54569df780e36fc5bf1905ae6b60d1393fba.tar.bz2
clean up function signatures in preparation for dataclasses
FeatureCheck always immediately sets extra_message to '' if it isn't explicitly passed, so there is really no point in using None as a sentinel that is never used. Names used in init functions are sometimes pointlessly different from the class instance attributes they are immediately assigned to. They would make more sense if defined properly.
Diffstat (limited to 'mesonbuild/interpreterbase')
-rw-r--r--mesonbuild/interpreterbase/decorators.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/interpreterbase/decorators.py b/mesonbuild/interpreterbase/decorators.py
index 8832d29..f88b1fd 100644
--- a/mesonbuild/interpreterbase/decorators.py
+++ b/mesonbuild/interpreterbase/decorators.py
@@ -569,10 +569,10 @@ class FeatureCheckBase(metaclass=abc.ABCMeta):
feature_registry: T.ClassVar[T.Dict[str, T.Dict[str, T.Set[T.Tuple[str, T.Optional['mparser.BaseNode']]]]]]
emit_notice = False
- def __init__(self, feature_name: str, version: str, extra_message: T.Optional[str] = None, location: T.Optional['mparser.BaseNode'] = None):
+ def __init__(self, feature_name: str, feature_version: str, extra_message: str = '', location: T.Optional['mparser.BaseNode'] = None):
self.feature_name = feature_name # type: str
- self.feature_version = version # type: str
- self.extra_message = extra_message or '' # type: str
+ self.feature_version = feature_version # type: str
+ self.extra_message = extra_message # type: str
self.location = location
@staticmethod
@@ -656,7 +656,7 @@ class FeatureCheckBase(metaclass=abc.ABCMeta):
@classmethod
def single_use(cls, feature_name: str, version: str, subproject: str,
- extra_message: T.Optional[str] = None, location: T.Optional['mparser.BaseNode'] = None) -> None:
+ extra_message: str = '', location: T.Optional['mparser.BaseNode'] = None) -> None:
"""Oneline version that instantiates and calls use()."""
cls(feature_name, version, extra_message, location).use(subproject)