lebrice / SimpleParsing

Simple, Elegant, Typed Argument Parsing with argparse
MIT License
399 stars 49 forks source link

Fix bug in docstring parsing, docstrings inherit from bases #164

Closed lebrice closed 1 year ago

lebrice commented 1 year ago

@dataclass class Foo(Base):

Above

bar: int = 123  # The bar property

assert get_attribute_docstring(Foo, "bar") == AttributeDocString( comment_inline="The bar property", comment_above="Above", docstring_below="field docstring from base class", )


--help text:

usage: pytest [-h] [--bar int]

optional arguments: -h, --help show this help message and exit

Foo ['foo']: Foo(bar: int = 123)

--bar int field docstring from base class (default: 123)