optinterpreter: use PEP8 compliant names

pull/8010/head
Dylan Baker 4 years ago
parent 49f8ff8410
commit 226945bbc7
  1. 20
      mesonbuild/optinterpreter.py

@ -62,19 +62,19 @@ def permitted_kwargs(permitted: T.Set[str]) -> T.Callable[..., T.Any]:
optname_regex = re.compile('[^a-zA-Z0-9_-]') optname_regex = re.compile('[^a-zA-Z0-9_-]')
@permitted_kwargs({'value', 'yield'}) @permitted_kwargs({'value', 'yield'})
def StringParser(description: str, kwargs: T.Dict[str, T.Any]) -> coredata.UserStringOption: def string_parser(description: str, kwargs: T.Dict[str, T.Any]) -> coredata.UserStringOption:
return coredata.UserStringOption(description, return coredata.UserStringOption(description,
kwargs.get('value', ''), kwargs.get('value', ''),
kwargs.get('yield', coredata.default_yielding)) kwargs.get('yield', coredata.default_yielding))
@permitted_kwargs({'value', 'yield'}) @permitted_kwargs({'value', 'yield'})
def BooleanParser(description: str, kwargs: T.Dict[str, T.Any]) -> coredata.UserBooleanOption: def boolean_parser(description: str, kwargs: T.Dict[str, T.Any]) -> coredata.UserBooleanOption:
return coredata.UserBooleanOption(description, return coredata.UserBooleanOption(description,
kwargs.get('value', True), kwargs.get('value', True),
kwargs.get('yield', coredata.default_yielding)) kwargs.get('yield', coredata.default_yielding))
@permitted_kwargs({'value', 'yield', 'choices'}) @permitted_kwargs({'value', 'yield', 'choices'})
def ComboParser(description: str, kwargs: T.Dict[str, T.Any]) -> coredata.UserComboOption: def combo_parser(description: str, kwargs: T.Dict[str, T.Any]) -> coredata.UserComboOption:
if 'choices' not in kwargs: if 'choices' not in kwargs:
raise OptionException('Combo option missing "choices" keyword.') raise OptionException('Combo option missing "choices" keyword.')
choices = kwargs['choices'] choices = kwargs['choices']
@ -90,7 +90,7 @@ def ComboParser(description: str, kwargs: T.Dict[str, T.Any]) -> coredata.UserCo
@permitted_kwargs({'value', 'min', 'max', 'yield'}) @permitted_kwargs({'value', 'min', 'max', 'yield'})
def IntegerParser(description: str, kwargs: T.Dict[str, T.Any]) -> coredata.UserIntegerOption: def integer_parser(description: str, kwargs: T.Dict[str, T.Any]) -> coredata.UserIntegerOption:
if 'value' not in kwargs: if 'value' not in kwargs:
raise OptionException('Integer option must contain value argument.') raise OptionException('Integer option must contain value argument.')
inttuple = (kwargs.get('min', None), kwargs.get('max', None), kwargs['value']) inttuple = (kwargs.get('min', None), kwargs.get('max', None), kwargs['value'])
@ -122,17 +122,17 @@ def string_array_parser(description: str, kwargs: T.Dict[str, T.Any]) -> coredat
yielding=kwargs.get('yield', coredata.default_yielding)) yielding=kwargs.get('yield', coredata.default_yielding))
@permitted_kwargs({'value', 'yield'}) @permitted_kwargs({'value', 'yield'})
def FeatureParser(description: str, kwargs: T.Dict[str, T.Any]) -> coredata.UserFeatureOption: def feature_parser(description: str, kwargs: T.Dict[str, T.Any]) -> coredata.UserFeatureOption:
return coredata.UserFeatureOption(description, return coredata.UserFeatureOption(description,
kwargs.get('value', 'auto'), kwargs.get('value', 'auto'),
yielding=kwargs.get('yield', coredata.default_yielding)) yielding=kwargs.get('yield', coredata.default_yielding))
option_types = {'string': StringParser, option_types = {'string': string_parser,
'boolean': BooleanParser, 'boolean': boolean_parser,
'combo': ComboParser, 'combo': combo_parser,
'integer': IntegerParser, 'integer': integer_parser,
'array': string_array_parser, 'array': string_array_parser,
'feature': FeatureParser, 'feature': feature_parser,
} # type: T.Dict[str, T.Callable[[str, str, T.Dict[str, T.Any]], coredata.UserOption]] } # type: T.Dict[str, T.Callable[[str, str, T.Dict[str, T.Any]], coredata.UserOption]]
class OptionInterpreter: class OptionInterpreter:

Loading…
Cancel
Save