From 1746073b8c052169de402f741c2ecd7d7c523d44 Mon Sep 17 00:00:00 2001 From: Nikhil Garuda <34582615+Nikhil0504@users.noreply.github.com> Date: Fri, 7 May 2021 10:56:10 +0530 Subject: [PATCH] Added entry for typestring parser check tool (#1402) * Added typestring parser checker * Updated some errors * Update * Checking if installation wokrs * Trying again * Updates * Another Update * Update pyproject.toml * Update documentation.rst * Update requirements.txt * Update * syntax highlighting should work? * Update * Reverted back * Will this work? * Update * Still trying * Update * Update again * Fixed the indentation issues * Update * updated code block * Update again * Update * Update again with blackendocs * Update documentation.rst * Added skip option to doctests * Added the link * Update link --- docs/source/contributing/documentation.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/source/contributing/documentation.rst b/docs/source/contributing/documentation.rst index 135d839c3c..6322002c15 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 + `_ + 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") + + >>> 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 ---------------------------------------------