[chore] Minor cleanup

This commit is contained in:
Ferdinand Thiessen 2021-03-18 13:03:34 +01:00
parent 85f83f46d5
commit fb8371afb9
1 changed files with 3 additions and 4 deletions

View File

@ -15,10 +15,9 @@ class ModelSerializeMixin:
import typing
if (
typing.get_origin(self.__class__.__annotations__[param]) is typing.Union
and isinstance(typing.get_args(self.__class__.__annotations__[param])[1], type(None))
):
if typing.get_origin(self.__class__.__annotations__[param]) is typing.Union and typing.get_args(
self.__class__.__annotations__[param]
)[1] is type(None):
return getattr(self, param) is None
def serialize(self):