You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the following code pylance recognizes wrapped_function_definition as a variable/constant. I'd love a way to force pylance to treat this as a function. (Unless there is another way I should be using to provide both a wrapped and unwrapped implementation of the same function without having to keep the parameter list/typehints up to date?) See the screenshot, wrapped_function_definition is blue and listed as a constant as opposed to yellow and listed as a function.
from collections.abc import Callable
from typing import Final, ParamSpec, TypeVar
T = TypeVar("T")
P = ParamSpec("P")
def wrap_function(func: Callable[P, T]) -> Callable[P, T]:
def wrapper(*args: P.args, **kwargs: P.kwargs) -> T:
return func(*args, **kwargs)
return wrapper
def function_to_wrap(i: int) -> int:
return i
wrapped_function_definition: Final = wrap_function(function_to_wrap)
The text was updated successfully, but these errors were encountered:
With the following code pylance recognizes wrapped_function_definition as a variable/constant. I'd love a way to force pylance to treat this as a function. (Unless there is another way I should be using to provide both a wrapped and unwrapped implementation of the same function without having to keep the parameter list/typehints up to date?) See the screenshot, wrapped_function_definition is blue and listed as a constant as opposed to yellow and listed as a function.
The text was updated successfully, but these errors were encountered: