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-2024.2.28.tar.gz
.
File metadata
- Download URL: datetype-2024.2.28.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9840ab907099a4e0ecd9418464bc4b68d525dd0e588a35f9b9bec5a5cda27b69 |
|
MD5 | 131f745203cad2d3f4d5177dcc14761c |
|
BLAKE2b-256 | 0ce0e4ee94db22d50564974f9438fa8e9f0d9b3b87084331e5011de9a0b4c347 |
File details
Details for the file datetype-2024.2.28-py3-none-any.whl
.
File metadata
- Download URL: datetype-2024.2.28-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f07e26f70ec51f8eadc62178697739d53a1473772aed47d8b65cd44222028a2d |
|
MD5 | 2cddd5fcb724307261a889ff9c0729dd |
|
BLAKE2b-256 | 9565735286e9d00545a971d401d709a3e5a6c1fbe78ca5a543c55df6130ebae4 |