From 02186d8c2b17ea36218e4126b5855de565bab9b6 Mon Sep 17 00:00:00 2001 From: Semyon Proshev Date: Wed, 26 Jul 2017 17:24:09 +0300 Subject: [PATCH 1/2] Add __init__ to types.MethodType --- stdlib/2/types.pyi | 3 ++- stdlib/3/types.pyi | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/2/types.pyi b/stdlib/2/types.pyi index e4df50d8eec0..284dcece442c 100644 --- a/stdlib/2/types.pyi +++ b/stdlib/2/types.pyi @@ -81,10 +81,11 @@ class ClassType: ... class UnboundMethodType: im_class = ... # type: type im_func = ... # type: FunctionType - im_self = ... # type: Optional[object] + im_self = ... # type: object __name__ = ... # type: str __func__ = im_func __self__ = im_self + def __init__(self, func: FunctionType, obj: object) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... class InstanceType: diff --git a/stdlib/3/types.pyi b/stdlib/3/types.pyi index 9894742a3047..6c536eb59d75 100644 --- a/stdlib/3/types.pyi +++ b/stdlib/3/types.pyi @@ -140,6 +140,7 @@ class MethodType: __func__ = ... # type: _StaticFunctionType __self__ = ... # type: object __name__ = ... # type: str + def __init__(self, func: FunctionType, obj: object) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... class BuiltinFunctionType: __self__ = ... # type: Union[object, ModuleType] From f427d80f1f87258771919e2ff510ea5925dd5c6d Mon Sep 17 00:00:00 2001 From: Semyon Proshev Date: Wed, 26 Jul 2017 18:30:43 +0300 Subject: [PATCH 2/2] Review fix: FunctionType -> Callable --- stdlib/2/types.pyi | 2 +- stdlib/3/types.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/2/types.pyi b/stdlib/2/types.pyi index 284dcece442c..87380b32478d 100644 --- a/stdlib/2/types.pyi +++ b/stdlib/2/types.pyi @@ -85,7 +85,7 @@ class UnboundMethodType: __name__ = ... # type: str __func__ = im_func __self__ = im_self - def __init__(self, func: FunctionType, obj: object) -> None: ... + def __init__(self, func: Callable, obj: object) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... class InstanceType: diff --git a/stdlib/3/types.pyi b/stdlib/3/types.pyi index 6c536eb59d75..f9f46c5fdf91 100644 --- a/stdlib/3/types.pyi +++ b/stdlib/3/types.pyi @@ -140,7 +140,7 @@ class MethodType: __func__ = ... # type: _StaticFunctionType __self__ = ... # type: object __name__ = ... # type: str - def __init__(self, func: FunctionType, obj: object) -> None: ... + def __init__(self, func: Callable, obj: object) -> None: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... class BuiltinFunctionType: __self__ = ... # type: Union[object, ModuleType]