From 1b7856c5902ad1d450e237134cd137ed9c592768 Mon Sep 17 00:00:00 2001 From: Ethan Paul <24588726+enpaul@users.noreply.github.com> Date: Fri, 29 Oct 2021 22:14:29 -0400 Subject: [PATCH] Fix enum typing on config helper funcs --- kodak/configuration.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kodak/configuration.py b/kodak/configuration.py index 1e74a9e..87031f2 100644 --- a/kodak/configuration.py +++ b/kodak/configuration.py @@ -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