Skip to main content

package to check syntax of type tags in docstring

Project description

docstring_type_tag_checker - package to check the validity of docstrings type

This package contains the 'BaseDocstringType' class that helps analyse a type docstring. It is able to check if your type docstring format is correct and get the types used in the docstring.

Basic Use

You simply have to import the class and pass the docstring to it :

from docstring_type_tag_checker import BaseDocstringType

type_string = "dict[str, numpy.ndarray[int | float] | list[int | float]]"
the_instance = BaseDocstringType.get_type_object(type_string)

from this step, you can now check if the format is valid:

the_instance.is_valid()
>>> True

You can also get the string of the different types used in the docstring (primitve types are ignored)

the_instance.get_type_strings()
>>> {'numpy.ndarray'}

You can also get a representation of the structure of the docstring with the str function

str(the_instance)
>>> GENERIC[dict]
        STRING str
        UNION
            GENERIC[numpy.ndarray]
                UNION
                    STRING int
                    STRING float
            GENERIC[list]
                UNION
                    STRING int
                    STRING float

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

docstring_type_tag_checker-1.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for docstring_type_tag_checker-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40365a85af4ed6943cbe7f2874a10fd326527f59a4d76bfe06f77d13eab6b6db
MD5 66dedeff5037d460d99afb842ffa06dc
BLAKE2b-256 88b479deb9f3f56c6ee59eda4df54c5a37a4269bdd19f908bae4511703143a0e

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