Open YnkDK opened 5 years ago
Using multi-line strings with textwrap.dedent
might help somewhat,
from textwrap import dedent
class CatResource(MethodResource):
@marshal_with(PetSchema)
@doc(summary='Gets the cat with the given id',
description=dedent(
"""
Lorem ipsum dolor sit amet, ea aeque commodo lucilius nam. Est tation
libris periculis eu, tale oporteat efficiantur eu quo. Choro integre has
cu. Et mea mutat habemus vulputate, iudico prompta facilisis pro te,
porro fugit labore ut cum. Has audiam alienum apeirian in, mel ut vero
porro option, aliquip mediocrem accusamus mea an. In his iisque laboramus
efficiendi.
Inermis volutpat ne his, an populo debitis complectitur vix. Eros
bonorum feugait no has. Eu duis autem per, eu his paulo neglegentur
necessitatibus. Zril voluptaria mel at, saperet dissentiet in duo.
""")
def get(self, pet_id):
return Pet('calici', 'cat')
Is it possible to extract documentation from the docstring, e.g.
This would be equivalent to what I am doing at the moment:
The docstring itself is easy to extract, e.g.
CatResource.get.__doc__
. Is this already possible? When the description becomes very descriptive (e.g. more than 72 characters which results in a new line according to PEP 8) it becomes harder to read and format, than if it has been in the docstring of the method.