diff --git a/gvm/_enum.py b/gvm/_enum.py index 2f883da1d..45783cc9c 100644 --- a/gvm/_enum.py +++ b/gvm/_enum.py @@ -4,7 +4,7 @@ # from enum import Enum as PythonEnum -from typing import Optional +from typing import Any, Optional from typing_extensions import Self @@ -16,6 +16,10 @@ class Enum(PythonEnum): Base class for Enums in python-gvm """ + @classmethod + def _missing_(cls, value: Any) -> Optional[Self]: + return cls.from_string(str(value) if value else None) + @classmethod def from_string( cls,