Skip to main content

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 if annotation is an Optional[type]. Return type if so, None otherwise.
  • subtype: Construct a TypeVar for subtypes of the type t.

Module contents:

  • is_optional(annotation): Check if annotation is an Optional[type]. Return type if so, None otherwise.

  • subtype(t, name=None): Construct a TypeVar for subtypes of the type t.

    Parameters:

    • t: the type which bounds the TypeVar
    • name: optional name for the TypeVar, default t.__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)

Source distribution for cs-typingutils 20250428
File Size Uploaded
cs_typingutils-20250428.tar.gz 1.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cs-typingutils 20250428
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

20250428 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page