fixes mypy error

This commit is contained in:
Mose Müller
2024-02-15 08:43:08 +01:00
parent fd3338f99f
commit 6b1227fcbb

View File

@@ -66,12 +66,14 @@ class Serializer:
@staticmethod @staticmethod
def _serialize_enum(obj: Enum) -> dict[str, Any]: def _serialize_enum(obj: Enum) -> dict[str, Any]:
import pydase.components.coloured_enum
value = obj.name value = obj.name
readonly = False readonly = False
doc = obj.__doc__ doc = obj.__doc__
if sys.version_info < (3, 11) and doc == "An enumeration.": if sys.version_info < (3, 11) and doc == "An enumeration.":
doc = None doc = None
if type(obj).__base__.__name__ == "ColouredEnum": if isinstance(obj, pydase.components.coloured_enum.ColouredEnum):
obj_type = "ColouredEnum" obj_type = "ColouredEnum"
else: else:
obj_type = "Enum" obj_type = "Enum"