Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Parse docstrings for type information #1236

Open
@jakebailey

Description

@jakebailey

Some docstrings contain type info (as opposed to stubs or type annotations). This info should be parsed and used best-effort.

There are many different possible formats; numpy, google, epydoc, etc.

See also: https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html

With examples that look like:

:param path: The path of the file to wrap
:type path: str
:param field_storage: The :class:`FileStorage` instance to wrap
:type field_storage: FileStorage
:param temporary: Whether or not to delete the file when the File
   instance is destructed
:type temporary: bool
:returns: A buffered writable file descriptor
:rtype: BufferedFileStorage

But also:

Args:
    path (str): The path of the file to wrap
    field_storage (FileStorage): The :class:`FileStorage` instance to wrap
    temporary (bool): Whether or not to delete the file when the File
       instance is destructed

Returns:
    BufferedFileStorage: A buffered writable file descriptor

Types are often not qualified, though, so may require some heuristic to figure out what type we actually think is being used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions