Skip to content

More tolerant docstring parser #31

Description

@PicoCentauri

Our current docstring parser located at

def parse_docs(klass):

returns a dictionary of the the docstring. It works but it is not as flexible and tolerant as the sphinx/napoleon implementation. Especially we have problems with the separator between a parameter name and its type; usually denoted by name : type. A different notation can not be parsed since we use a hardcoded split

mdacli/src/mdacli/utils.py

Lines 230 to 232 in 78fa3f2

for line in doc_lines[par_i: end_param_line][::-1]:
if ' : ' in line:
par_name, others_ = line.split(' : ')

Improvements with using a regex did also not succeed. If possible we should incorporate the sphinx parser or at least get some ideas from their implementation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions