mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-02 09:33:25 +08:00
Make ProxyType and CallableProxyType Generic (#5166)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user