Skip to content

Fix implicit-Optional in resource signatures (param: str = None) #153

Description

@martinkersner

Summary

Many caller-facing signatures annotate a parameter as non-Optional but default it to None (implicit-Optional), which PEP 484 disallows and which mypy flags by default (implicit-optional off since mypy 0.990).

Examples

  • datamaxi/resources/cex_candle.py:37-38from_unix: str = None, to_unix: str = None
  • datamaxi/resources/cex_ticker.py:30-31
  • datamaxi/resources/funding_rate.py:33-34,110-111
  • datamaxi/resources/premium.py:29-49
  • Inconsistent even within one signature — cex_candle.py:111: exchange: str = None, market: Optional[Market] = None

Fix

Sweep resource (and async mirror) signatures: param: str = Noneparam: Optional[str] = None. Purely a typing correctness change, no runtime behavior change. Pairs naturally with shipping py.typed (#<py.typed issue>) so the corrected hints are actually consumed.


Surfaced during a pythonic-idiom review of the SDK.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

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