Trite hacks for use with typing.
Project description
Trite hacks for use with typing.
Latest release 20250503: is_optional: bugfix: Optional[T] has a get_args of (T,), not (T,None).
Short summary:
is_optional: Check ifannotationis anOptional[type]. Returntypeif so,Noneotherwise.subtype: Construct aTypeVarfor subtypes of the typet.
Module contents:
-
is_optional(annotation): Check ifannotationis anOptional[type]. Returntypeif so,Noneotherwise. -
subtype(t, name=None): Construct aTypeVarfor subtypes of the typet.Parameters:
t: the type which bounds theTypeVarname: optional name for theTypeVar, defaultt.__name__ + 'SubType'
Release Log
Release 20250503: is_optional: bugfix: Optional[T] has a get_args of (T,), not (T,None).
Release 20250428: New is_optional(annotation) function to recognise Optional[type] annotations, returning type if true, None otherwise.
Release 20230331: Initial release.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cs_typingutils-20250503.tar.gz.
File metadata
- Download URL: cs_typingutils-20250503.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9c402f83bb467a654b5e83c70e74bd356ca332aca2f30b413b45e48f31c4bc8
|
|
| MD5 |
4c64ac809c1dd3a3c84b394e20c779cd
|
|
| BLAKE2b-256 |
597a29271ce15cdaa2974a63092a399846de0b99063f23297ef83b1be98252a7
|
File details
Details for the file cs_typingutils-20250503-py2.py3-none-any.whl.
File metadata
- Download URL: cs_typingutils-20250503-py2.py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26962aa0aed9dd5899ec83b2be788840c5eb1fe0ac72118dfdcc879b4f8d88f0
|
|
| MD5 |
4e2af2892d4afaf0a8e7585055ad6967
|
|
| BLAKE2b-256 |
cc77fbc5d4893758d2fc53324a420b0a9d53cc2913472113e225a9ec8e2b8515
|