1
0
mirror of https://github.com/enpaul/kodak.git synced 2024-11-14 10:36:55 +00:00

Fix enum typing on config helper funcs

This commit is contained in:
Ethan Paul 2021-10-29 22:14:29 -04:00
parent f46168e29d
commit 1b7856c590
No known key found for this signature in database
GPG Key ID: D0E2CBF1245E92BF

View File

@ -8,6 +8,7 @@ from typing import Any
from typing import Dict
from typing import Optional
from typing import Set
from typing import Type
from typing import Union
from kodak import constants
@ -23,13 +24,13 @@ def _get_float(var: str, default: Optional[float]) -> Optional[float]:
def _get_enum_by_name(
var: str, enumeration: enum.Enum, default: enum.Enum
var: str, enumeration: Type[enum.Enum], default: enum.Enum
) -> enum.Enum:
return enumeration[os.environ[var].upper()] if var in os.environ else default
def _get_enum_by_value(
var: str, enumeration: enum.Enum, default: enum.Enum
var: str, enumeration: Type[enum.Enum], default: enum.Enum
) -> enum.Enum:
return enumeration(os.environ[var].lower()) if var in os.environ else default