Skip to main content

Trite hacks for use with typing.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cs_typingutils-20250428.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cs_typingutils-20250428-py2.py3-none-any.whl (2.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cs_typingutils-20250428.tar.gz.

File metadata

  • Download URL: cs_typingutils-20250428.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

Hashes for cs_typingutils-20250428.tar.gz
Algorithm Hash digest
SHA256 ca28e53bdbada52055ab68b5bb1dbcbff3a48a5e5da89355bc3cfa068ff0aea0
MD5 fb22ba7613eb5a46be64bf3e02982b4c
BLAKE2b-256 816c5909798f65193fec662be593acb1377e6006f017be40257ac80736040540

See more details on using hashes here.

File details

Details for the file cs_typingutils-20250428-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for cs_typingutils-20250428-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9bc8748c5230ab4b39455ef12d15dd8b379dfd090ff32840305d898b01cf433b
MD5 7d25dd6961df70664bbab5623e00e81f
BLAKE2b-256 5adffd5453ece516800afeeeac11f97f15d04e07afe18519c9d934c672b53f0c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page