aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreterobjects.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-12-06 15:00:22 -0800
committerEli Schwartz <eschwartz93@gmail.com>2022-01-18 17:53:29 -0500
commitf7cbe89a1381daa3b347ba91cd7f43e0c761829e (patch)
treed1821be655eb984030d6e6837593665adcc1ab42 /mesonbuild/interpreter/interpreterobjects.py
parentbaa9ecb1c465b5b081a4a2ab9861beda5030fddf (diff)
downloadmeson-f7cbe89a1381daa3b347ba91cd7f43e0c761829e.zip
meson-f7cbe89a1381daa3b347ba91cd7f43e0c761829e.tar.gz
meson-f7cbe89a1381daa3b347ba91cd7f43e0c761829e.tar.bz2
interpreterobjects: use typed_* with configuration_data.get_unquoted
Diffstat (limited to 'mesonbuild/interpreter/interpreterobjects.py')
-rw-r--r--mesonbuild/interpreter/interpreterobjects.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/mesonbuild/interpreter/interpreterobjects.py b/mesonbuild/interpreter/interpreterobjects.py
index a1bbd39..b275050 100644
--- a/mesonbuild/interpreter/interpreterobjects.py
+++ b/mesonbuild/interpreter/interpreterobjects.py
@@ -367,16 +367,14 @@ class ConfigurationDataObject(MutableInterpreterObject, MesonInterpreterObject):
raise InterpreterException(f'Entry {name} not in configuration data.')
@FeatureNew('configuration_data.get_unquoted()', '0.44.0')
- def get_unquoted_method(self, args: T.List[TYPE_var], kwargs: TYPE_kwargs) -> T.Union[str, int, bool]:
- if len(args) < 1 or len(args) > 2:
- raise InterpreterException('Get method takes one or two arguments.')
- if not isinstance(args[0], str):
- raise InterpreterException('The variable name must be a string.')
+ @typed_pos_args('configuration_data.get_unquoted', str, optargs=[(str, int, bool)])
+ @noKwargs
+ def get_unquoted_method(self, args: T.Tuple[str, T.Optional[T.Union[str, int, bool]]],
+ kwargs: TYPE_kwargs) -> T.Union[str, int, bool]:
name = args[0]
if name in self.conf_data:
val = self.conf_data.get(name)[0]
- elif len(args) > 1:
- assert isinstance(args[1], (str, int, bool))
+ elif args[1] is not None:
val = args[1]
else:
raise InterpreterException(f'Entry {name} not in configuration data.')