diff options
Diffstat (limited to 'mesonbuild/optinterpreter.py')
-rw-r--r-- | mesonbuild/optinterpreter.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py index a6fd503..75011e7 100644 --- a/mesonbuild/optinterpreter.py +++ b/mesonbuild/optinterpreter.py @@ -62,7 +62,6 @@ optname_regex = re.compile('[^a-zA-Z0-9_-]') def StringParser(description, kwargs): return coredata.UserStringOption(description, kwargs.get('value', ''), - kwargs.get('choices', []), kwargs.get('yield', coredata.default_yielding)) @permitted_kwargs({'value', 'yield'}) @@ -134,11 +133,11 @@ option_types = {'string': StringParser, } # type: T.Dict[str, T.Callable[[str, T.Dict], coredata.UserOption]] class OptionInterpreter: - def __init__(self, subproject): + def __init__(self, subproject: str) -> None: self.options = {} self.subproject = subproject - def process(self, option_file): + def process(self, option_file: str) -> None: try: with open(option_file, 'r', encoding='utf8') as f: ast = mparser.Parser(f.read(), option_file).parse() @@ -159,7 +158,7 @@ class OptionInterpreter: e.file = option_file raise e - def reduce_single(self, arg): + def reduce_single(self, arg: T.Union[str, mparser.BaseNode]) -> T.Union[str, int, bool]: if isinstance(arg, str): return arg elif isinstance(arg, (mparser.StringNode, mparser.BooleanNode, @@ -189,7 +188,7 @@ class OptionInterpreter: else: raise OptionException('Arguments may only be string, int, bool, or array of those.') - def reduce_arguments(self, args): + def reduce_arguments(self, args: mparser.ArgumentNode) -> T.Tuple[T.List[T.Union[str, int, bool]], T.Dict[str, T.Union[str, int, bool]]]: assert(isinstance(args, mparser.ArgumentNode)) if args.incorrect_order(): raise OptionException('All keyword arguments must be after positional arguments.') @@ -202,7 +201,7 @@ class OptionInterpreter: reduced_kw[key.value] = self.reduce_single(a) return reduced_pos, reduced_kw - def evaluate_statement(self, node): + def evaluate_statement(self, node: mparser.BaseNode) -> None: if not isinstance(node, mparser.FunctionNode): raise OptionException('Option file may only contain option definitions') func_name = node.func_name |