File
sdks/python/pmxt/errors.py
Missing Return Types
Three exception constructors are missing -> None. PEP 484 requires __init__ to carry an explicit return type.
Line 16 — PmxtError.__init__ (HIGH — base class for all SDK errors)
def __init__(self, message: str, code: str = "UNKNOWN_ERROR", retryable: bool = False, exchange: str | None = None):
PmxtError is the root exception that users catch with except PmxtError. Missing -> None on the base class propagates the gap to every subclass that does not define its own __init__.
Line 70 — RateLimitExceeded.__init__ (HIGH — public exception)
def __init__(self, message: str, retry_after: int | None = None, **kwargs):
- Missing
-> None
**kwargs is entirely untyped — it is forwarded to super().__init__(**kwargs), where it accepts code, retryable, exchange. A TypedDict or explicit keyword parameters would allow static validation of callers.
Line 88 — ValidationError.__init__ (HIGH — public exception)
def __init__(self, message: str, field: str | None = None, **kwargs):
- Missing
-> None
- Same untyped
**kwargs concern as RateLimitExceeded.
Impact
Suggested Fix
# Line 16
def __init__(self, message: str, code: str = "UNKNOWN_ERROR", retryable: bool = False, exchange: Optional[str] = None) -> None:
# Line 70
def __init__(self, message: str, retry_after: Optional[int] = None, code: str = "UNKNOWN_ERROR", retryable: bool = False, exchange: Optional[str] = None) -> None:
# Line 88
def __init__(self, message: str, field: Optional[str] = None, code: str = "UNKNOWN_ERROR", retryable: bool = False, exchange: Optional[str] = None) -> None:
Explicit keyword parameters instead of **kwargs also eliminate the untyped kwargs concern.
Found by automated Python type hints audit
File
sdks/python/pmxt/errors.pyMissing Return Types
Three exception constructors are missing
-> None. PEP 484 requires__init__to carry an explicit return type.Line 16 —
PmxtError.__init__(HIGH — base class for all SDK errors)PmxtErroris the root exception that users catch withexcept PmxtError. Missing-> Noneon the base class propagates the gap to every subclass that does not define its own__init__.Line 70 —
RateLimitExceeded.__init__(HIGH — public exception)-> None**kwargsis entirely untyped — it is forwarded tosuper().__init__(**kwargs), where it acceptscode,retryable,exchange. ATypedDictor explicit keyword parameters would allow static validation of callers.Line 88 —
ValidationError.__init__(HIGH — public exception)-> None**kwargsconcern asRateLimitExceeded.Impact
pmxt.__all__and are the exceptions users are expected toexcept. Static analysers cannot verify constructor call-sites without-> None.disallow_untyped_defs = true([python-types] pyproject.toml: disallow_untyped_defs = false allows all type gaps to silently pass #246) will reject all three at CI.**kwargsinRateLimitExceededandValidationErrormeans callers can silently pass unknown keyword arguments with no type error.Suggested Fix
Explicit keyword parameters instead of
**kwargsalso eliminate the untyped kwargs concern.Found by automated Python type hints audit