From 22c4866d213d57c2ecc6e9a7288829c91ccf03c6 Mon Sep 17 00:00:00 2001 From: Cliff Hill Date: Thu, 18 Jan 2024 10:13:37 -0500 Subject: [PATCH] MOre cleanup of helper function. Signed-off-by: Cliff Hill --- app/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models.py b/app/models.py index 97043908b..751b63eab 100644 --- a/app/models.py +++ b/app/models.py @@ -1,4 +1,5 @@ import datetime +from enum import Enum import itertools import uuid @@ -52,7 +53,7 @@ def filter_null_value_fields(obj): return dict(filter(lambda x: x[1] is not None, obj.items())) -def enum_values(enum_type): +def enum_values(enum: Enum) -> list[str]: """ Helper function used to persist enum values to the database rather than names. @@ -67,7 +68,7 @@ def enum_values(enum_type): uses string values, a callable such as lambda x: [e.value for e in x] is sufficient. """ - return [i.value for i in enum_type] + return [i.value for i in enum] # type: ignore[attr-defined] class HistoryModel: