Hiya, mypy has been telling me that the first overloaded function signature here is not covered by the implementation. Am I missing something, as I believe it is. Is this just a current shortcoming of the type-checking that mypy is able to do, or is it my mistake?
from collections.abc import Sequence
from typing import overload
class Foo:
@overload
def __init__(self, *, pragma_type: str) -> None: ...
@overload
def __init__(
self, raw_rule_codes: Sequence[int], /, pragma_type: str
) -> None: ...
@override
def __init__(
self,
raw_rule_codes: Sequence[int] = (),
/,
pragma_type: str | None = None, # NOTE: Needs a default because comes after another default
) -> None:
if pragma_type is None:
raise RuntimeError
...
Surely the pragma_type argument being keyword-only in the first overload is handled by the positional-or-keyword-only version in the implementation?
I’ve resorted to unfortunately using a #type: ignore[misc] comment on the @override line for now.
Any support would be appreciated!