alecthomas / voluptuous

CONTRIBUTIONS ONLY: Voluptuous, despite the name, is a Python data validation library.
https://pypi.org/project/voluptuous
BSD 3-Clause "New" or "Revised" License
1.81k stars 219 forks source link

Improve validator typing to allow non-number formats for min and max #516

Closed cdce8p closed 2 months ago

cdce8p commented 2 months ago

NullableNumber is defined as int | float | None. This prevents the use of other values for min / max in Range, Clamp and Length which also support rich comparisons. E.g. timedelta.

Use SupportsAllComparisons from _typeshed instead.

Refs https://github.com/home-assistant/core/pull/120268 /CC @bdraco