Skip to main content

type-annotations-generator provides a function for generating type annotations for a object

Project description

type-annotations-generator

type-annotations-generator provides a function for generating type annotations. That can be useful if you work with a API which has a complex data structure. It supports PEP 585 and PEP 604.

import type_annotations_generator

data = {
    "elements": [
        {
            "name": "foo",
            "age": 42
        }
    ],
    "count": 1
}

print(type_annotations_generator.generate_annotations(data))
# Dict[str, Union[List[Dict[str, Union[str, int]]], int]]

print(type_annotations_generator.generate_annotations(data, pep_585=True))
# dict[str, Union[list[dict[str, Union[str, int]]], int]]

print(type_annotations_generator.generate_annotations(data, pep_585=True, pep_604=True))
# dict[str, list[dict[str, str | int]] | int]

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

type-annotations-generator-1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file type-annotations-generator-1.0.tar.gz.

File metadata

  • Download URL: type-annotations-generator-1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for type-annotations-generator-1.0.tar.gz
Algorithm Hash digest
SHA256 7d99158b92127586587becaff97129c9f2ab9c44676c429945275c3fd2cdfcc6
MD5 95ed89fe46ce64e5d6e39c9974ec9900
BLAKE2b-256 ccb5119d76de6d3e106563f0c3c5a751eca8fc6276eebf2a1b5542749c320149

See more details on using hashes here.

File details

Details for the file type_annotations_generator-1.0-py3-none-any.whl.

File metadata

  • Download URL: type_annotations_generator-1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for type_annotations_generator-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1cceb7888c2673f35be89b5c38d87646c908a0fe54a048924110257f6058a1f1
MD5 2e409baac263ace7912c90ddb36cf83a
BLAKE2b-256 248d550d7e2fe81871b8c6d627a2971f137e900f87cd57e3c7ed21916cf7e0ef

See more details on using hashes here.

Supported by

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