comparison libervia/backend/core/constants.py @ 4132:8e5333f1b430

core (constants): accept `y` and `t` as `True` values.
author Goffi <goffi@goffi.org>
date Wed, 18 Oct 2023 15:33:34 +0200
parents 10b6ad569157
children a8a0fa678ce2
comparison
equal deleted inserted replaced
4131:c38c33a44171 4132:8e5333f1b430
433 433
434 @classmethod 434 @classmethod
435 def bool(cls, value: str) -> bool: 435 def bool(cls, value: str) -> bool:
436 """@return (bool): bool value for associated constant""" 436 """@return (bool): bool value for associated constant"""
437 assert isinstance(value, str) 437 assert isinstance(value, str)
438 return value.lower() in (cls.BOOL_TRUE, "1", "yes", "on") 438 return value.lower() in (cls.BOOL_TRUE, "1", "yes", "on", "y", "t")
439 439
440 @classmethod 440 @classmethod
441 def bool_const(cls, value: bool) -> str: 441 def bool_const(cls, value: bool) -> str:
442 """@return (str): constant associated to bool value""" 442 """@return (str): constant associated to bool value"""
443 assert isinstance(value, bool) 443 assert isinstance(value, bool)