Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pyoverkiz/enums/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import logging
from typing import Any, Self, cast
from typing import Self, cast


class UnknownEnumMixin:
Expand All @@ -16,8 +16,11 @@ class UnknownEnumMixin:
__missing_message__ = "Unsupported value %s has been returned for %s"

@classmethod
def _missing_(cls, value: object) -> Self:
"""Return `UNKNOWN` and log unrecognized values."""
def _missing_(cls, value: object) -> Self: # type: ignore[override]
"""Return `UNKNOWN` and log unrecognized values.

Intentionally overrides the Enum base `_missing_` to provide an UNKNOWN fallback.
"""
message = cls.__missing_message__
logging.getLogger(cls.__module__).warning(message, value, cls)
# Type checker cannot infer UNKNOWN exists on Self, but all subclasses define it
Expand Down