From b4baae591f2a589196f021ba67c78b932c862b3e Mon Sep 17 00:00:00 2001 From: jsh9 <25124332+jsh9@users.noreply.github.com> Date: Wed, 26 Jun 2024 01:29:57 -0700 Subject: [PATCH] Use pprint to show Docstring objects --- CHANGELOG.md | 4 ++++ docstring_parser/common.py | 3 ++- pyproject.toml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff40c44..29a811d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# (Fork) 0.0.9 (2024-06-26) + +- Switched to pprint to show details of a `Docstring` object + # (Fork) 0.0.8 (2024-06-23) - Added support for parsing attributes from Sphinx-style docstrings diff --git a/docstring_parser/common.py b/docstring_parser/common.py index 2fe14b3..45ddd13 100644 --- a/docstring_parser/common.py +++ b/docstring_parser/common.py @@ -1,5 +1,6 @@ """Common methods for parsing.""" import enum +import pprint import typing as T ATTR_KEYWORDS = { @@ -206,7 +207,7 @@ def __init__( self.style = style # type: T.Optional[DocstringStyle] def __repr__(self) -> str: - return str(self.__dict__) + return pprint.pformat(self.__dict__, indent=2) @property def description(self) -> T.Optional[str]: diff --git a/pyproject.toml b/pyproject.toml index d15103a..a2d8ce8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "docstring_parser_fork" -version = "0.0.8" +version = "0.0.9" description = "Parse Python docstrings in reST, Google and Numpydoc format" authors = ["Marcin Kurczewski "] license = "MIT"