mirror of
https://github.com/enpaul/kodak.git
synced 2024-11-23 15:07:13 +00:00
Fix enum typing on config helper funcs
This commit is contained in:
parent
f46168e29d
commit
1b7856c590
@ -8,6 +8,7 @@ from typing import Any
|
|||||||
from typing import Dict
|
from typing import Dict
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from typing import Set
|
from typing import Set
|
||||||
|
from typing import Type
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from kodak import constants
|
from kodak import constants
|
||||||
@ -23,13 +24,13 @@ def _get_float(var: str, default: Optional[float]) -> Optional[float]:
|
|||||||
|
|
||||||
|
|
||||||
def _get_enum_by_name(
|
def _get_enum_by_name(
|
||||||
var: str, enumeration: enum.Enum, default: enum.Enum
|
var: str, enumeration: Type[enum.Enum], default: enum.Enum
|
||||||
) -> enum.Enum:
|
) -> enum.Enum:
|
||||||
return enumeration[os.environ[var].upper()] if var in os.environ else default
|
return enumeration[os.environ[var].upper()] if var in os.environ else default
|
||||||
|
|
||||||
|
|
||||||
def _get_enum_by_value(
|
def _get_enum_by_value(
|
||||||
var: str, enumeration: enum.Enum, default: enum.Enum
|
var: str, enumeration: Type[enum.Enum], default: enum.Enum
|
||||||
) -> enum.Enum:
|
) -> enum.Enum:
|
||||||
return enumeration(os.environ[var].lower()) if var in os.environ else default
|
return enumeration(os.environ[var].lower()) if var in os.environ else default
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user