mirror of
https://github.com/stoatchat/python-client-sdk.git
synced 2026-07-25 00:15:23 -04:00
reword typeguard comment to be updated
This commit is contained in:
+3
-3
@@ -26,9 +26,9 @@ def copy_doc(from_t: T) -> Callable[[T], T]:
|
||||
R_T = TypeVar("R_T")
|
||||
P = ParamSpec("P")
|
||||
|
||||
# it is impossible to type this function correctly for a couple reasons:
|
||||
# 1. isawaitable does not narrow while keeping typevars - there is an open PR for this (typeshed#5658) but it cannot be merged because mypy does not support the feature fully
|
||||
# 2. typeguard does not narrow for the negative case which is dumb in my opinion, so `value` would stay being a union even after the if statement (PEP 647 - "The type is not narrowed in the negative case")
|
||||
# it is impossible to type this function correctly as typeguard does not narrow for the negative case,
|
||||
# so `value` would stay being a union even after the if statement (PEP 647 - "The type is not narrowed in the negative case")
|
||||
# see typing#926, typing#930, typing#996
|
||||
|
||||
async def maybe_coroutine(func: Callable[P, Union[R_T, Coroutine[Any, Any, R_T]]], *args: P.args, **kwargs: P.kwargs) -> R_T:
|
||||
value = func(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user