Skip to content

Support @overload in export-functions #1874

@nathanjmcdougall

Description

@nathanjmcdougall

Came up in #1762.

Example:

        if _is_overload(node):
            continue
        docstring = ast.get_docstring(node)
        if docstring is not None:
            first_line = docstring.split("\n")[0].strip()
    return results


def _is_overload(node: ast.FunctionDef | ast.AsyncFunctionDef) -> bool:
    """Return True if the function is decorated with `@overload`."""
    return any(
        (isinstance(d, ast.Name) and d.id == "overload")
        or (isinstance(d, ast.Attribute) and d.attr == "overload")
        for d in node.decorator_list
    )

Metadata

Metadata

Labels

bugSomething isn't workinghooksConfiguration for git hooks used for development

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions