Trite hacks for use with typing.
Latest release 20250428: New is_optional(annotation) function to recognise Optional[type] annotations, returning type if true, None otherwise.
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 20250428: New is_optional(annotation) function to recognise Optional[type] annotations, returning type if true, None otherwise.
Release 20230331: Initial release.
Release files for cs-typingutils 20250428
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cs_typingutils-20250428.tar.gz | 1.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cs_typingutils-20250428-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 4.0 kB
Release files / cs_typingutils-20250428.tar.gz
| Download URL | cs_typingutils-20250428.tar.gz |
|---|---|
| Size | 1.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca28e53bdbada52055ab68b5bb1dbcbff3a48a5e5da89355bc3cfa068ff0aea0
|
|
BLAKE2b-256 checksum How to use checksums |
816c5909798f65193fec662be593acb1377e6006f017be40257ac80736040540
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Release files / cs_typingutils-20250428-py2.py3-none-any.whl
| Download URL | cs_typingutils-20250428-py2.py3-none-any.whl |
|---|---|
| Size | 2.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
9bc8748c5230ab4b39455ef12d15dd8b379dfd090ff32840305d898b01cf433b
|
|
BLAKE2b-256 checksum How to use checksums |
5adffd5453ece516800afeeeac11f97f15d04e07afe18519c9d934c672b53f0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|