File
sdks/python/pmxt/ws_client.py
Missing Return Types
- Line 23:
def __init__(self, request_id: str, method: str, symbols: List[str]): → should be -> None
- Line 39:
def __init__(self, host: str, access_token: Optional[str] = None, api_key: Optional[str] = None): → should be -> None
Both are __init__ methods — PEP 484 and mypy require them to be explicitly annotated -> None. Without it, disallow_untyped_defs = true (tracked in issue #246) will reject them when enforced.
Impact
- HIGH:
SidecarWsClient (line 39) is instantiated by every call to Exchange.watch_order_book() and Exchange.watch_order_books(). IDEs that read annotations to provide hover-docs for __init__ will show incomplete information.
- HIGH:
_WsSubscription (line 23) is an internal helper, but its constructor is called in every subscribe path.
Suggested Fix
# Line 23
class _WsSubscription:
def __init__(self, request_id: str, method: str, symbols: List[str]) -> None:
...
# Line 39
class SidecarWsClient:
def __init__(self, host: str, access_token: Optional[str] = None, api_key: Optional[str] = None) -> None:
...
Found by automated Python type hints audit
File
sdks/python/pmxt/ws_client.pyMissing Return Types
def __init__(self, request_id: str, method: str, symbols: List[str]):→ should be-> Nonedef __init__(self, host: str, access_token: Optional[str] = None, api_key: Optional[str] = None):→ should be-> NoneBoth are
__init__methods — PEP 484 and mypy require them to be explicitly annotated-> None. Without it,disallow_untyped_defs = true(tracked in issue #246) will reject them when enforced.Impact
SidecarWsClient(line 39) is instantiated by every call toExchange.watch_order_book()andExchange.watch_order_books(). IDEs that read annotations to provide hover-docs for__init__will show incomplete information._WsSubscription(line 23) is an internal helper, but its constructor is called in every subscribe path.Suggested Fix
Found by automated Python type hints audit