mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
MOre cleanup of helper function.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
from enum import Enum
|
||||||
import itertools
|
import itertools
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ def filter_null_value_fields(obj):
|
|||||||
return dict(filter(lambda x: x[1] is not None, obj.items()))
|
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.
|
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
|
uses string values, a callable such as lambda x: [e.value for e in x] is
|
||||||
sufficient.
|
sufficient.
|
||||||
"""
|
"""
|
||||||
return [i.value for i in enum_type]
|
return [i.value for i in enum] # type: ignore[attr-defined]
|
||||||
|
|
||||||
|
|
||||||
class HistoryModel:
|
class HistoryModel:
|
||||||
|
|||||||
Reference in New Issue
Block a user