Skip to content

@log obscured wrapped function's signature in VS Code #2677

@ushuz

Description

@ushuz

Steps to reproduce

Expected behaviour

Hover on referenced function, its actual signature pops up

Actual behaviour

Instead, decorator's signature was prompted, as in screenshot above

Configuration

Operating System: macOS 11.4
Version of Python, python-telegram-bot & dependencies: Python 3.6.9 (pyenv), PTB 13.6


I first reported this to pylance (microsoft/pylance-release#1470), and was pointed out that @log()'s annotation is to blame (microsoft/pylance-release#1470 (comment)):

... in func: Callable[..., RT] throws away parameter definition, and should use ParamSpec instead.

def log( # skipcq: PY-D0003
func: Callable[..., RT], *args: object, **kwargs: object # pylint: disable=W0613
) -> Callable[..., RT]:

However, ParamSpec is pretty new (landed in Python 3.10) thus requires typing_extension package with older Python.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions