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`.
This commit is contained in:
parent
188c2c97ba
commit
0ee6a64e3b
1 changed files with 5 additions and 2 deletions
|
|
@ -35,6 +35,9 @@ else:
|
|||
logged_user = getuser()
|
||||
|
||||
|
||||
bool_type = bool
|
||||
|
||||
|
||||
class Const(object):
|
||||
|
||||
## Application ##
|
||||
|
|
@ -455,13 +458,13 @@ class Const(object):
|
|||
)
|
||||
|
||||
@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
|
||||
|
|
|
|||
Loading…
Reference in a new issue