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
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
File details
Details for the file docstring_type_tag_checker-1.0-py3-none-any.whl
.
File metadata
- Download URL: docstring_type_tag_checker-1.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40365a85af4ed6943cbe7f2874a10fd326527f59a4d76bfe06f77d13eab6b6db |
|
MD5 | 66dedeff5037d460d99afb842ffa06dc |
|
BLAKE2b-256 | 88b479deb9f3f56c6ee59eda4df54c5a37a4269bdd19f908bae4511703143a0e |