# HG changeset patch # User Goffi # Date 1712398450 -7200 # Node ID dd9bc7d791d7bb1416e51dc2c547c74ac9a4a1f5 # Parent 79a4870cfbdf78c1366a599609ac281ce08598fa core (constants): use `bool_type`: Using `bool` for type hint in `Const.bool_const` if conflicting with `Const.bool` method. To avoid this, `bool_type` is used as an alias to `bool`. diff -r 79a4870cfbdf -r dd9bc7d791d7 libervia/backend/core/constants.py --- a/libervia/backend/core/constants.py Sat Mar 09 15:13:14 2024 +0100 +++ b/libervia/backend/core/constants.py Sat Apr 06 12:14:10 2024 +0200 @@ -35,6 +35,9 @@ logged_user = getuser() +bool_type = bool + + class Const(object): ## Application ## @@ -455,13 +458,13 @@ ) @classmethod - def bool(cls, value: str) -> bool: + def bool(cls, value: str) -> bool_type: """@return (bool): bool value for associated constant""" assert isinstance(value, str) return value.lower() in (cls.BOOL_TRUE, "1", "yes", "on", "y", "t") @classmethod - def bool_const(cls, value: bool) -> str: + def bool_const(cls, value: bool_type) -> str: """@return (str): constant associated to bool value""" assert isinstance(value, bool) return cls.BOOL_TRUE if value else cls.BOOL_FALSE