JelleZijlstra / stubdefaulter

Add default values to stubs
Other
10 stars 4 forks source link

Add defaults to pos-only parameters in the stub, even if the parameter name is incorrect in the stub #56

Closed AlexWaygood closed 1 year ago

AlexWaygood commented 1 year ago

If the number of parameters in the stub matches the number of parameters at runtime, and there are no variadic parameters at runtime, it should be safe to add defaults to the stub even if the stub has an incorrect name for the parameter

JelleZijlstra commented 1 year ago

Shouldn't we fix the parameter name in the stub instead in this case?

github-actions[bot] commented 1 year ago

⚠ Diff showing the effect of this PR on how stubdefaulter would alter typeshed's stdlib:

```diff diff --git a/stdlib/_decimal.pyi b/stdlib/_decimal.pyi index b8208fe..dbd29f9 100644 --- a/stdlib/_decimal.pyi +++ b/stdlib/_decimal.pyi @@ -89,7 +89,7 @@ class Decimal: def __mul__(self, __other: _Decimal) -> Decimal: ... def __neg__(self) -> Decimal: ... def __pos__(self) -> Decimal: ... - def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = ...) -> Decimal: ... + def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = None) -> Decimal: ... def __radd__(self, __other: _Decimal) -> Decimal: ... def __rdivmod__(self, __other: _Decimal) -> tuple[Decimal, Decimal]: ... def __rfloordiv__(self, __other: _Decimal) -> Decimal: ... @@ -116,7 +116,7 @@ class Decimal: def __floor__(self) -> int: ... def __ceil__(self) -> int: ... def fma(self, other: _Decimal, third: _Decimal, context: Context | None = None) -> Decimal: ... - def __rpow__(self, __other: _Decimal, __context: Context | None = ...) -> Decimal: ... + def __rpow__(self, __other: _Decimal, __context: Context | None = None) -> Decimal: ... def normalize(self, context: Context | None = None) -> Decimal: ... def quantize(self, exp: _Decimal, rounding: str | None = None, context: Context | None = None) -> Decimal: ... def same_quantum(self, other: _Decimal, context: Context | None = None) -> bool: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index a8bedc8..e340cbe 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -117,7 +117,7 @@ class staticmethod(Generic[_R_co]): @property def __isabstractmethod__(self) -> bool: ... def __init__(self: staticmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... - def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... + def __get__(self, __obj: _T, __type: type[_T] | None = None) -> Callable[..., _R_co]: ... if sys.version_info >= (3, 10): __name__: str __qualname__: str @@ -131,7 +131,7 @@ class classmethod(Generic[_R_co]): @property def __isabstractmethod__(self) -> bool: ... def __init__(self: classmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... - def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... + def __get__(self, __obj: _T, __type: type[_T] | None = None) -> Callable[..., _R_co]: ... if sys.version_info >= (3, 10): __name__: str __qualname__: str @@ -1185,7 +1185,7 @@ class property: def getter(self, __fget: Callable[[Any], Any]) -> property: ... def setter(self, __fset: Callable[[Any, Any], None]) -> property: ... def deleter(self, __fdel: Callable[[Any], None]) -> property: ... - def __get__(self, __obj: Any, __type: type | None = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type | None = None) -> Any: ... def __set__(self, __obj: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... diff --git a/stdlib/select.pyi b/stdlib/select.pyi index 6ee1348..32bd272 100644 --- a/stdlib/select.pyi +++ b/stdlib/select.pyi @@ -110,7 +110,7 @@ if sys.platform == "linux": def __exit__( self, __exc_type: type[BaseException] | None = None, - __exc_val: BaseException | None = ..., + __exc_val: BaseException | None = None, __exc_tb: TracebackType | None = None, ) -> None: ... def close(self) -> None: ... diff --git a/stdlib/types.pyi b/stdlib/types.pyi index d529b3d..68181c5 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -105,7 +105,7 @@ class FunctionType: @overload def __get__(self, obj: None, type: type) -> FunctionType: ... @overload - def __get__(self, obj: object, type: type | None = ...) -> MethodType: ... + def __get__(self, obj: object, type: type | None = None) -> MethodType: ... LambdaType = FunctionType @@ -454,7 +454,7 @@ class WrapperDescriptorType: @property def __objclass__(self) -> type: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... @final class MethodWrapperType: @@ -479,7 +479,7 @@ class MethodDescriptorType: @property def __objclass__(self) -> type: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, obj: Any, type: type = ...) -> Any: ... + def __get__(self, obj: Any, type: type = None) -> Any: ... @final class ClassMethodDescriptorType: @@ -490,7 +490,7 @@ class ClassMethodDescriptorType: @property def __objclass__(self) -> type: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, obj: Any, type: type = ...) -> Any: ... + def __get__(self, obj: Any, type: type = None) -> Any: ... @final class TracebackType: @@ -536,7 +536,7 @@ class GetSetDescriptorType: def __qualname__(self) -> str: ... @property def __objclass__(self) -> type: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... def __set__(self, __instance: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... @@ -548,7 +548,7 @@ class MemberDescriptorType: def __qualname__(self) -> str: ... @property def __objclass__(self) -> type: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... def __set__(self, __instance: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... ```
AlexWaygood commented 1 year ago

Shouldn't we fix the parameter name in the stub instead in this case?

We should do that as well, yes.

The underlying issue here is that stubtest doesn't precisely verify parameter names for positional-only parameters -- it uses a heuristic instead: https://github.com/python/mypy/blob/c03e979ca06c3bf082a4cd07458a1bc3205dc5e5/mypy/stubtest.py#L571-L574. But that doesn't feel like the responsibility of stubdefaulter?

I don't feel too strongly though, we can close this if you like :) If you look at the primer diff, the patch was pretty good at exposing that we for some reason have quite a few __get__ methods with incorrect parameter names in typeshed, so it's been useful in any case!

AlexWaygood commented 1 year ago

I guess we could possibly have this patch autofix the parameter names as well...

JelleZijlstra commented 1 year ago

I guess stubtest works that way because pos-only parameter names are often inconsistent across versions (e.g., when AC is applied to a function) or across the C and Python versions of a function. For those cases, it's reasonable for stubdefaulter to also pick up the default.

Could you limit this patch to only positional-only parameters? That feels safer.

github-actions[bot] commented 1 year ago

⚠ Diff showing the effect of this PR on how stubdefaulter would alter typeshed's stdlib:

```diff diff --git a/stdlib/_decimal.pyi b/stdlib/_decimal.pyi index b8208fe..dbd29f9 100644 --- a/stdlib/_decimal.pyi +++ b/stdlib/_decimal.pyi @@ -89,7 +89,7 @@ class Decimal: def __mul__(self, __other: _Decimal) -> Decimal: ... def __neg__(self) -> Decimal: ... def __pos__(self) -> Decimal: ... - def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = ...) -> Decimal: ... + def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = None) -> Decimal: ... def __radd__(self, __other: _Decimal) -> Decimal: ... def __rdivmod__(self, __other: _Decimal) -> tuple[Decimal, Decimal]: ... def __rfloordiv__(self, __other: _Decimal) -> Decimal: ... @@ -116,7 +116,7 @@ class Decimal: def __floor__(self) -> int: ... def __ceil__(self) -> int: ... def fma(self, other: _Decimal, third: _Decimal, context: Context | None = None) -> Decimal: ... - def __rpow__(self, __other: _Decimal, __context: Context | None = ...) -> Decimal: ... + def __rpow__(self, __other: _Decimal, __context: Context | None = None) -> Decimal: ... def normalize(self, context: Context | None = None) -> Decimal: ... def quantize(self, exp: _Decimal, rounding: str | None = None, context: Context | None = None) -> Decimal: ... def same_quantum(self, other: _Decimal, context: Context | None = None) -> bool: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index a8bedc8..e340cbe 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -117,7 +117,7 @@ class staticmethod(Generic[_R_co]): @property def __isabstractmethod__(self) -> bool: ... def __init__(self: staticmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... - def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... + def __get__(self, __obj: _T, __type: type[_T] | None = None) -> Callable[..., _R_co]: ... if sys.version_info >= (3, 10): __name__: str __qualname__: str @@ -131,7 +131,7 @@ class classmethod(Generic[_R_co]): @property def __isabstractmethod__(self) -> bool: ... def __init__(self: classmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... - def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... + def __get__(self, __obj: _T, __type: type[_T] | None = None) -> Callable[..., _R_co]: ... if sys.version_info >= (3, 10): __name__: str __qualname__: str @@ -1185,7 +1185,7 @@ class property: def getter(self, __fget: Callable[[Any], Any]) -> property: ... def setter(self, __fset: Callable[[Any, Any], None]) -> property: ... def deleter(self, __fdel: Callable[[Any], None]) -> property: ... - def __get__(self, __obj: Any, __type: type | None = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type | None = None) -> Any: ... def __set__(self, __obj: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... diff --git a/stdlib/select.pyi b/stdlib/select.pyi index 6ee1348..32bd272 100644 --- a/stdlib/select.pyi +++ b/stdlib/select.pyi @@ -110,7 +110,7 @@ if sys.platform == "linux": def __exit__( self, __exc_type: type[BaseException] | None = None, - __exc_val: BaseException | None = ..., + __exc_val: BaseException | None = None, __exc_tb: TracebackType | None = None, ) -> None: ... def close(self) -> None: ... diff --git a/stdlib/types.pyi b/stdlib/types.pyi index d529b3d..526a484 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -454,7 +454,7 @@ class WrapperDescriptorType: @property def __objclass__(self) -> type: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... @final class MethodWrapperType: @@ -536,7 +536,7 @@ class GetSetDescriptorType: def __qualname__(self) -> str: ... @property def __objclass__(self) -> type: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... def __set__(self, __instance: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... @@ -548,7 +548,7 @@ class MemberDescriptorType: def __qualname__(self) -> str: ... @property def __objclass__(self) -> type: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... def __set__(self, __instance: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... ```
github-actions[bot] commented 1 year ago

⚠ Diff showing the effect of this PR on how stubdefaulter would alter typeshed's stdlib:

```diff diff --git a/stdlib/_decimal.pyi b/stdlib/_decimal.pyi index b8208fe..dbd29f9 100644 --- a/stdlib/_decimal.pyi +++ b/stdlib/_decimal.pyi @@ -89,7 +89,7 @@ class Decimal: def __mul__(self, __other: _Decimal) -> Decimal: ... def __neg__(self) -> Decimal: ... def __pos__(self) -> Decimal: ... - def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = ...) -> Decimal: ... + def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = None) -> Decimal: ... def __radd__(self, __other: _Decimal) -> Decimal: ... def __rdivmod__(self, __other: _Decimal) -> tuple[Decimal, Decimal]: ... def __rfloordiv__(self, __other: _Decimal) -> Decimal: ... @@ -116,7 +116,7 @@ class Decimal: def __floor__(self) -> int: ... def __ceil__(self) -> int: ... def fma(self, other: _Decimal, third: _Decimal, context: Context | None = None) -> Decimal: ... - def __rpow__(self, __other: _Decimal, __context: Context | None = ...) -> Decimal: ... + def __rpow__(self, __other: _Decimal, __context: Context | None = None) -> Decimal: ... def normalize(self, context: Context | None = None) -> Decimal: ... def quantize(self, exp: _Decimal, rounding: str | None = None, context: Context | None = None) -> Decimal: ... def same_quantum(self, other: _Decimal, context: Context | None = None) -> bool: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index a8bedc8..e340cbe 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -117,7 +117,7 @@ class staticmethod(Generic[_R_co]): @property def __isabstractmethod__(self) -> bool: ... def __init__(self: staticmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... - def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... + def __get__(self, __obj: _T, __type: type[_T] | None = None) -> Callable[..., _R_co]: ... if sys.version_info >= (3, 10): __name__: str __qualname__: str @@ -131,7 +131,7 @@ class classmethod(Generic[_R_co]): @property def __isabstractmethod__(self) -> bool: ... def __init__(self: classmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... - def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... + def __get__(self, __obj: _T, __type: type[_T] | None = None) -> Callable[..., _R_co]: ... if sys.version_info >= (3, 10): __name__: str __qualname__: str @@ -1185,7 +1185,7 @@ class property: def getter(self, __fget: Callable[[Any], Any]) -> property: ... def setter(self, __fset: Callable[[Any, Any], None]) -> property: ... def deleter(self, __fdel: Callable[[Any], None]) -> property: ... - def __get__(self, __obj: Any, __type: type | None = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type | None = None) -> Any: ... def __set__(self, __obj: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... diff --git a/stdlib/select.pyi b/stdlib/select.pyi index 6ee1348..32bd272 100644 --- a/stdlib/select.pyi +++ b/stdlib/select.pyi @@ -110,7 +110,7 @@ if sys.platform == "linux": def __exit__( self, __exc_type: type[BaseException] | None = None, - __exc_val: BaseException | None = ..., + __exc_val: BaseException | None = None, __exc_tb: TracebackType | None = None, ) -> None: ... def close(self) -> None: ... diff --git a/stdlib/types.pyi b/stdlib/types.pyi index d529b3d..526a484 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -454,7 +454,7 @@ class WrapperDescriptorType: @property def __objclass__(self) -> type: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... @final class MethodWrapperType: @@ -536,7 +536,7 @@ class GetSetDescriptorType: def __qualname__(self) -> str: ... @property def __objclass__(self) -> type: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... def __set__(self, __instance: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... @@ -548,7 +548,7 @@ class MemberDescriptorType: def __qualname__(self) -> str: ... @property def __objclass__(self) -> type: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... def __set__(self, __instance: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... ```
github-actions[bot] commented 1 year ago

⚠ Diff showing the effect of this PR on how stubdefaulter would alter typeshed's stdlib:

```diff diff --git a/stdlib/_decimal.pyi b/stdlib/_decimal.pyi index b8208fe..dbd29f9 100644 --- a/stdlib/_decimal.pyi +++ b/stdlib/_decimal.pyi @@ -89,7 +89,7 @@ class Decimal: def __mul__(self, __other: _Decimal) -> Decimal: ... def __neg__(self) -> Decimal: ... def __pos__(self) -> Decimal: ... - def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = ...) -> Decimal: ... + def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = None) -> Decimal: ... def __radd__(self, __other: _Decimal) -> Decimal: ... def __rdivmod__(self, __other: _Decimal) -> tuple[Decimal, Decimal]: ... def __rfloordiv__(self, __other: _Decimal) -> Decimal: ... @@ -116,7 +116,7 @@ class Decimal: def __floor__(self) -> int: ... def __ceil__(self) -> int: ... def fma(self, other: _Decimal, third: _Decimal, context: Context | None = None) -> Decimal: ... - def __rpow__(self, __other: _Decimal, __context: Context | None = ...) -> Decimal: ... + def __rpow__(self, __other: _Decimal, __context: Context | None = None) -> Decimal: ... def normalize(self, context: Context | None = None) -> Decimal: ... def quantize(self, exp: _Decimal, rounding: str | None = None, context: Context | None = None) -> Decimal: ... def same_quantum(self, other: _Decimal, context: Context | None = None) -> bool: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index a8bedc8..e340cbe 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -117,7 +117,7 @@ class staticmethod(Generic[_R_co]): @property def __isabstractmethod__(self) -> bool: ... def __init__(self: staticmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... - def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... + def __get__(self, __obj: _T, __type: type[_T] | None = None) -> Callable[..., _R_co]: ... if sys.version_info >= (3, 10): __name__: str __qualname__: str @@ -131,7 +131,7 @@ class classmethod(Generic[_R_co]): @property def __isabstractmethod__(self) -> bool: ... def __init__(self: classmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... - def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... + def __get__(self, __obj: _T, __type: type[_T] | None = None) -> Callable[..., _R_co]: ... if sys.version_info >= (3, 10): __name__: str __qualname__: str @@ -1185,7 +1185,7 @@ class property: def getter(self, __fget: Callable[[Any], Any]) -> property: ... def setter(self, __fset: Callable[[Any, Any], None]) -> property: ... def deleter(self, __fdel: Callable[[Any], None]) -> property: ... - def __get__(self, __obj: Any, __type: type | None = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type | None = None) -> Any: ... def __set__(self, __obj: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... diff --git a/stdlib/select.pyi b/stdlib/select.pyi index 6ee1348..32bd272 100644 --- a/stdlib/select.pyi +++ b/stdlib/select.pyi @@ -110,7 +110,7 @@ if sys.platform == "linux": def __exit__( self, __exc_type: type[BaseException] | None = None, - __exc_val: BaseException | None = ..., + __exc_val: BaseException | None = None, __exc_tb: TracebackType | None = None, ) -> None: ... def close(self) -> None: ... diff --git a/stdlib/types.pyi b/stdlib/types.pyi index d529b3d..526a484 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -454,7 +454,7 @@ class WrapperDescriptorType: @property def __objclass__(self) -> type: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... @final class MethodWrapperType: @@ -536,7 +536,7 @@ class GetSetDescriptorType: def __qualname__(self) -> str: ... @property def __objclass__(self) -> type: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... def __set__(self, __instance: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... @@ -548,7 +548,7 @@ class MemberDescriptorType: def __qualname__(self) -> str: ... @property def __objclass__(self) -> type: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... def __set__(self, __instance: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... ```
github-actions[bot] commented 1 year ago

This change has no effect on how stubdefaulter would alter typeshed's stdlib. 🤖🎉

github-actions[bot] commented 1 year ago

This change has no effect on how stubdefaulter would alter typeshed's stdlib. 🤖🎉

AlexWaygood commented 1 year ago

If I run this patch on https://github.com/python/typeshed/commit/74112dc18919084093d7aed3f26456ccf4598cf8, it produces this diff:

```diff diff --git a/stdlib/_decimal.pyi b/stdlib/_decimal.pyi index b8208fe18..dbd29f935 100644 --- a/stdlib/_decimal.pyi +++ b/stdlib/_decimal.pyi @@ -89,7 +89,7 @@ class Decimal: def __mul__(self, __other: _Decimal) -> Decimal: ... def __neg__(self) -> Decimal: ... def __pos__(self) -> Decimal: ... - def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = ...) -> Decimal: ... + def __pow__(self, __other: _Decimal, __modulo: _Decimal | None = None) -> Decimal: ... def __radd__(self, __other: _Decimal) -> Decimal: ... def __rdivmod__(self, __other: _Decimal) -> tuple[Decimal, Decimal]: ... def __rfloordiv__(self, __other: _Decimal) -> Decimal: ... @@ -116,7 +116,7 @@ class Decimal: def __floor__(self) -> int: ... def __ceil__(self) -> int: ... def fma(self, other: _Decimal, third: _Decimal, context: Context | None = None) -> Decimal: ... - def __rpow__(self, __other: _Decimal, __context: Context | None = ...) -> Decimal: ... + def __rpow__(self, __other: _Decimal, __context: Context | None = None) -> Decimal: ... def normalize(self, context: Context | None = None) -> Decimal: ... def quantize(self, exp: _Decimal, rounding: str | None = None, context: Context | None = None) -> Decimal: ... def same_quantum(self, other: _Decimal, context: Context | None = None) -> bool: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index a8bedc837..e340cbe62 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -117,7 +117,7 @@ class staticmethod(Generic[_R_co]): @property def __isabstractmethod__(self) -> bool: ... def __init__(self: staticmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... - def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... + def __get__(self, __obj: _T, __type: type[_T] | None = None) -> Callable[..., _R_co]: ... if sys.version_info >= (3, 10): __name__: str __qualname__: str @@ -131,7 +131,7 @@ class classmethod(Generic[_R_co]): @property def __isabstractmethod__(self) -> bool: ... def __init__(self: classmethod[_R_co], __f: Callable[..., _R_co]) -> None: ... - def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R_co]: ... + def __get__(self, __obj: _T, __type: type[_T] | None = None) -> Callable[..., _R_co]: ... if sys.version_info >= (3, 10): __name__: str __qualname__: str @@ -1185,7 +1185,7 @@ class property: def getter(self, __fget: Callable[[Any], Any]) -> property: ... def setter(self, __fset: Callable[[Any, Any], None]) -> property: ... def deleter(self, __fdel: Callable[[Any], None]) -> property: ... - def __get__(self, __obj: Any, __type: type | None = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type | None = None) -> Any: ... def __set__(self, __obj: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... diff --git a/stdlib/types.pyi b/stdlib/types.pyi index d529b3d9a..526a4845e 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -454,7 +454,7 @@ class WrapperDescriptorType: @property def __objclass__(self) -> type: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... @final class MethodWrapperType: @@ -536,7 +536,7 @@ class GetSetDescriptorType: def __qualname__(self) -> str: ... @property def __objclass__(self) -> type: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... def __set__(self, __instance: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... @@ -548,7 +548,7 @@ class MemberDescriptorType: def __qualname__(self) -> str: ... @property def __objclass__(self) -> type: ... - def __get__(self, __obj: Any, __type: type = ...) -> Any: ... + def __get__(self, __obj: Any, __type: type = None) -> Any: ... def __set__(self, __instance: Any, __value: Any) -> None: ... def __delete__(self, __obj: Any) -> None: ... ```