Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added entry for typestring parser check tool (#1402)

Nikhil Garuda1746073b8c05
diff --git a/docs/source/contributing/documentation.rst b/docs/source/contributing/documentation.rst
index 135d839c3..6322002c1 100644
--- a/docs/source/contributing/documentation.rst
+++ b/docs/source/contributing/documentation.rst
@@ -400,6 +400,25 @@ elements that are either a ``str`` or ``None``;
``(str, int)``; ``Tuple[:class:`int`, ...]`` for a tuple of variable
length with only integers.
+.. note::
+ As a helper for tool for typesets, you can use `typestring-parser
+ <https://github.com/Dominik1123/typestring-parser>`_
+ which can be accessed by first installing it via ``pip`` - ``pip install typestring-parser`` and
+ then using ``from typestring_parser import parse``.
+
+.. doctest::
+ :options: +SKIP
+
+ >>> from typestring_parser import parse
+ >>> parse("int")
+ <class 'int'>
+ >>> parse("int or str")
+ typing.Union[int, str]
+ >>> parse("list of str or str")
+ typing.Union[typing.List[str], str]
+ >>> parse("list of (int, str)")
+ typing.List[typing.Tuple[int, str]]
+
Adding type hints to functions and parameters
---------------------------------------------