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 hashes)

Uploaded Python 3

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