A type wrapper for the standard library `datetime` that supplies stricter checks, such as making 'datetime' not substitutable for 'date', and separating out Naive and Aware datetimes into separate, mutually-incompatible types.
Project description
DateType
A Workaround
DateType is a workaround for this
bug to demonstrate that we could
have a type-checking-time wrapper for datetime
that doesn't change (or almost
doesn't change) the implementation, but fixes up two very annoying behaviors of
the stdlib datetime
module:
-
a
datetime
now won't type-check as adate
- it still inherits at runtime (the implementation is, after all, not changed) but it doesn't inherit at type-time. -
there are separate types for naive and aware
datetime
s.
There's a very small bit of implementation glue (concrete @classmethod
s for
construction on the Naive
and Aware
types, and a few functions that do
runtime checks to convert to/from stdlib types).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for datetype-2023.11.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97900d54e47903c7b545d1045f07c3da0b711ab8ecd3b8a288c9d0a89fe665cd |
|
MD5 | 1b738354fe0c5ec9d69cb23d34e2c94a |
|
BLAKE2b-256 | 010b23c249bcf2cbcd4eaa9940b237b6c53e700c1d13af5e6e28f29d44d252a3 |