Skip to content

Commit

Permalink
Address mypy error that only appears in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
glatterf42 committed Nov 20, 2024
1 parent 8190d7a commit e0ee406
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion ixmp4/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ class ProgrammingError(Exception):
# NOTE mypy seems to say Exception has type Any, don't see how we could change that
class RemoteExceptionMeta(ExcMeta): # type: ignore[misc]
def __new__(
cls, name: str, bases: tuple[object], namespace: dict[str, Any], **kwargs: Any
cls,
name: str,
bases: tuple[type, ...],
namespace: dict[str, Any],
**kwargs: Any,
) -> type["IxmpError"]:
http_error_name = namespace.get("http_error_name", None)
if http_error_name is not None:
Expand Down
2 changes: 1 addition & 1 deletion ixmp4/data/abstract/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class BaseMeta(_ProtocolMeta):
def __init__(
self, name: str, bases: tuple[object], namespace: dict[str, Any]
self, name: str, bases: tuple[type, ...], namespace: dict[str, Any]
) -> None:
super().__init__(name, bases, namespace)
self.NotUnique = type(
Expand Down
6 changes: 5 additions & 1 deletion ixmp4/db/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ def _ensure_str_list(any_list: list[Any]) -> list[str]:
# NOTE mypy seems to say PydanticMeta has type Any, don't see how we could change that
class FilterMeta(PydanticMeta): # type: ignore[misc]
def __new__(
cls, name: str, bases: tuple[object], namespace: dict[str, Any], **kwargs: Any
cls,
name: str,
bases: tuple[type, ...],
namespace: dict[str, Any],
**kwargs: Any,
) -> type["BaseFilter"]:
annots = namespace.get("__annotations__", {}).copy()
for name, annot in annots.items():
Expand Down

0 comments on commit e0ee406

Please sign in to comment.