Make ProxyType and CallableProxyType Generic (#5166)

This commit is contained in:
hatal175
2021-04-08 05:52:22 +03:00
committed by GitHub
parent 7d2427bc52
commit 6c01c6afdc

View File

@@ -7,10 +7,10 @@ if sys.version_info >= (3, 9):
_C = TypeVar("_C", bound=Callable[..., Any])
_T = TypeVar("_T")
class CallableProxyType(object): # "weakcallableproxy"
class CallableProxyType(Generic[_C]): # "weakcallableproxy"
def __getattr__(self, attr: str) -> Any: ...
class ProxyType(object): # "weakproxy"
class ProxyType(Generic[_T]): # "weakproxy"
def __getattr__(self, attr: str) -> Any: ...
class ReferenceType(Generic[_T]):
@@ -27,7 +27,7 @@ ref = ReferenceType
def getweakrefcount(__object: Any) -> int: ...
def getweakrefs(object: Any) -> List[Any]: ...
@overload
def proxy(object: _C, callback: Optional[Callable[[_C], Any]] = ...) -> CallableProxyType: ...
def proxy(object: _C, callback: Optional[Callable[[_C], Any]] = ...) -> CallableProxyType[_C]: ...
# Return CallableProxyType if object is callable, ProxyType otherwise
@overload