commit FunctionSetting changes i forgot to commit yesterday

This commit is contained in:
jesopo 2019-10-08 11:38:56 +01:00
parent 6a0d41f069
commit 68aa89f16f

View file

@ -356,16 +356,21 @@ class OptionsSetting(Setting):
class FunctionSetting(Setting):
def __init__(self, func: typing.Callable[[str], bool], name: str,
help: str=None, example: str=None):
help: str=None, example: str=None, format=None):
self._func = func
Setting.__init__(self, name, help, example)
if not format == None:
self.format = format
def parse(self, value: str) -> typing.Any:
return self._func(value)
def sensitive_format(value: typing.Any):
return "*"*16
class SensitiveSetting(Setting):
def format(self, value: typing.Any):
return "*"*16
return sensitive_format(value)
class DeadlineExceededException(Exception):
pass