Skip to content

[python-types] _exchanges.py: 16 exchange __init__ methods missing -> None return type #729

@realfishsam

Description

@realfishsam

File

sdks/python/pmxt/_exchanges.py

Note: This supplements #564, which covers signature_type: Optional[Any] in Polymarket.__init__. The gap below is distinct: all 16 exchange constructors in this file are missing -> None.

Missing Return Types (CRITICAL — all public constructors)

PEP 484 requires __init__ to be annotated -> None. Every generated exchange class constructor is missing this annotation. When disallow_untyped_defs = true is enabled (#246), mypy will reject all 16 at once.

Line Class
13 Polymarket.__init__
70 Limitless.__init__
116 Kalshi.__init__
147 KalshiDemo.__init__
178 Probable.__init__
224 Baozi.__init__
252 Myriad.__init__
283 Opinion.__init__
317 Metaculus.__init__
345 Smarkets.__init__
376 PolymarketUS.__init__
407 Hyperliquid.__init__
438 GeminiTitan.__init__
476 SuiBets.__init__
510 Mock.__init__
536 Router.__init__ (generated alias)

Generator Note

This file is auto-generated by core/scripts/generate-python-exchanges.js. The fix must be applied to the generator template, not the generated file directly, or it will be overwritten on the next npm run generate:sdk:all.

Impact

  • CRITICAL: These are the primary user-facing constructors — Polymarket(...), Kalshi(...), etc. All 16 will fail mypy with disallow_untyped_defs = true enabled.
  • IDEs that read __init__ annotations to populate hover documentation will show incomplete type information for every exchange class.

Suggested Fix

In the generator template, add -> None to each __init__ signature:

def __init__(
    self,
    api_key: Optional[str] = None,
    ...
) -> None:

Found by automated Python type hints audit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions