Skip to content

Recognise a few special functions #280

@oliversheridanmethven

Description

@oliversheridanmethven

There are a few "special" functions which are known to return, no-return, raise, yield, warn, etc., and it would be good to have pydoclint acknowledge these.

For example, sys.exit, as per the docs:

sys.exit([arg])
Raise a SystemExit exception, signaling an intention to exit the interpreter.

So I would like to be able to write:

import sys

def panic() -> None:
    """
    ...

    Raises
    ------
    SystemExit
        Unable to deal with the situation.
    """
    sys.exit(1)

Other examples include e.g. warnings.warn.

I appreciate that this starts to encroach on "should our documentation be transitive" and do we have to re-describe all the exceptions that the dependencies could themselves raise, but I think these few special cases merit specific handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions