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
File details
Details for the file datetype-2022.6.6.tar.gz
.
File metadata
- Download URL: datetype-2022.6.6.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c05619919fd09237277b8cd0430e51ef09e0b8119cb00fe044941083c493c64e |
|
MD5 | b1cf504f0d5d5a2d7774f3942451b359 |
|
BLAKE2b-256 | 277d38829bc16aea1cb37f166425617c13d67689b870216f063ed1a6be71f39f |
File details
Details for the file datetype-2022.6.6-py3-none-any.whl
.
File metadata
- Download URL: datetype-2022.6.6-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f5e2b0dabad76c108e636cf1d11d98f11636dab8906d5bf2bbdf213ce343469 |
|
MD5 | e4c234e1a44321ba9f6033fbfc17cabf |
|
BLAKE2b-256 | e3cd1ac909b6faf130ad558fe370b3e3666000613d5fda5f68d53af9734f8189 |