Skip to content

Commit 1709777

Browse files
committed
Merge branch 'main' into fpdf2-2.8.5
2 parents 50b0e48 + e389c7b commit 1709777

File tree

27 files changed

+200
-125
lines changed

27 files changed

+200
-125
lines changed

stdlib/contextlib.pyi

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from _typeshed import FileDescriptorOrPath, Unused
44
from abc import ABC, abstractmethod
55
from collections.abc import AsyncGenerator, AsyncIterator, Awaitable, Callable, Generator, Iterator
66
from types import TracebackType
7-
from typing import IO, Any, Generic, Protocol, TypeVar, overload, runtime_checkable, type_check_only
7+
from typing import Any, Generic, Protocol, TypeVar, overload, runtime_checkable, type_check_only
88
from typing_extensions import ParamSpec, Self, TypeAlias
99

1010
__all__ = [
@@ -30,7 +30,6 @@ if sys.version_info >= (3, 11):
3030

3131
_T = TypeVar("_T")
3232
_T_co = TypeVar("_T_co", covariant=True)
33-
_T_io = TypeVar("_T_io", bound=IO[str] | None)
3433
_ExitT_co = TypeVar("_ExitT_co", covariant=True, bound=bool | None, default=bool | None)
3534
_F = TypeVar("_F", bound=Callable[..., Any])
3635
_G_co = TypeVar("_G_co", bound=Generator[Any, Any, Any] | AsyncGenerator[Any, Any], covariant=True)
@@ -141,14 +140,24 @@ class suppress(AbstractContextManager[None, bool]):
141140
self, exctype: type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None
142141
) -> bool: ...
143142

144-
class _RedirectStream(AbstractContextManager[_T_io, None]):
145-
def __init__(self, new_target: _T_io) -> None: ...
143+
# This is trying to describe what is needed for (most?) uses
144+
# of `redirect_stdout` and `redirect_stderr`.
145+
# https://github.com/python/typeshed/issues/14903
146+
@type_check_only
147+
class _SupportsRedirect(Protocol):
148+
def write(self, s: str, /) -> int: ...
149+
def flush(self) -> None: ...
150+
151+
_SupportsRedirectT = TypeVar("_SupportsRedirectT", bound=_SupportsRedirect | None)
152+
153+
class _RedirectStream(AbstractContextManager[_SupportsRedirectT, None]):
154+
def __init__(self, new_target: _SupportsRedirectT) -> None: ...
146155
def __exit__(
147156
self, exctype: type[BaseException] | None, excinst: BaseException | None, exctb: TracebackType | None
148157
) -> None: ...
149158

150-
class redirect_stdout(_RedirectStream[_T_io]): ...
151-
class redirect_stderr(_RedirectStream[_T_io]): ...
159+
class redirect_stdout(_RedirectStream[_SupportsRedirectT]): ...
160+
class redirect_stderr(_RedirectStream[_SupportsRedirectT]): ...
152161

153162
class _BaseExitStack(Generic[_ExitT_co]):
154163
def enter_context(self, cm: AbstractContextManager[_T, _ExitT_co]) -> _T: ...

stubs/Deprecated/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version = "~=1.2.15"
1+
version = "~=1.3.1"
22
upstream_repository = "https://github.com/tantale/deprecated"
33
requires = []
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
from typing import Final
2+
13
from .classic import deprecated as deprecated
4+
from .params import deprecated_params as deprecated_params
25

3-
__credits__: str
4-
__date__: str
6+
__version__: Final[str]
7+
__author__: Final[str]
8+
__date__: Final[str]
9+
__credits__: Final[str]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from collections.abc import Callable, Iterable
2+
from inspect import Signature
3+
from typing import Any, TypeVar
4+
from typing_extensions import ParamSpec
5+
6+
_P = ParamSpec("_P")
7+
_R = TypeVar("_R")
8+
9+
class DeprecatedParams:
10+
messages: dict[str, str]
11+
category: type[Warning]
12+
def __init__(self, param: str | dict[str, str], reason: str = "", category: type[Warning] = ...) -> None: ...
13+
def populate_messages(self, param: str | dict[str, str], reason: str = "") -> None: ...
14+
def check_params(
15+
self, signature: Signature, *args: Any, **kwargs: Any # args and kwargs passing to Signature.bind method
16+
) -> list[str]: ...
17+
def warn_messages(self, messages: Iterable[str]) -> None: ...
18+
def __call__(self, f: Callable[_P, _R]) -> Callable[_P, _R]: ...
19+
20+
deprecated_params = DeprecatedParams

stubs/aws-xray-sdk/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version = "2.14.*"
1+
version = "2.15.*"
22
upstream_repository = "https://github.com/aws/aws-xray-sdk-python"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .patch import patch as patch
2+
3+
__all__ = ["patch"]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def patch() -> None: ...

stubs/braintree/braintree/address.pyi

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from _typeshed import Incomplete
22
from typing import Final
33

4+
from braintree.error_result import ErrorResult
45
from braintree.resource import Resource
6+
from braintree.successful_result import SuccessfulResult
57

68
class Address(Resource):
79
class ShippingMethod:
@@ -14,13 +16,15 @@ class Address(Resource):
1416
PickupInStore: Final = "pickup_in_store"
1517

1618
@staticmethod
17-
def create(params: dict[str, Incomplete] | None = None): ...
19+
def create(params: dict[str, Incomplete] | None = None) -> SuccessfulResult | ErrorResult | None: ...
1820
@staticmethod
19-
def delete(customer_id: str, address_id: str): ...
21+
def delete(customer_id: str, address_id: str) -> SuccessfulResult: ...
2022
@staticmethod
21-
def find(customer_id: str, address_id: str): ...
23+
def find(customer_id: str, address_id: str) -> Address: ...
2224
@staticmethod
23-
def update(customer_id: str, address_id: str, params: dict[str, Incomplete] | None = None): ...
25+
def update(
26+
customer_id: str, address_id: str, params: dict[str, Incomplete] | None = None
27+
) -> SuccessfulResult | ErrorResult | None: ...
2428
@staticmethod
2529
def create_signature() -> list[str | dict[str, list[str]]]: ...
2630
@staticmethod

stubs/braintree/braintree/address_gateway.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from _typeshed import Incomplete
22

33
from braintree.address import Address
4+
from braintree.braintree_gateway import BraintreeGateway
45
from braintree.error_result import ErrorResult
56
from braintree.successful_result import SuccessfulResult
67

78
class AddressGateway:
8-
gateway: Incomplete
9+
gateway: BraintreeGateway
910
config: Incomplete
10-
def __init__(self, gateway) -> None: ...
11+
def __init__(self, gateway: BraintreeGateway) -> None: ...
1112
def create(self, params: dict[str, Incomplete] | None = None) -> SuccessfulResult | ErrorResult | None: ...
1213
def delete(self, customer_id: str, address_id: str) -> SuccessfulResult: ...
1314
def find(self, customer_id: str, address_id: str) -> Address: ...
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
from _typeshed import Incomplete
2+
3+
from braintree.braintree_gateway import BraintreeGateway
4+
15
class ClientToken:
26
@staticmethod
3-
def generate(params=None, gateway=None): ...
7+
def generate(params: dict[str, Incomplete] | None = None, gateway: BraintreeGateway | None = None) -> str: ...
48
@staticmethod
59
def generate_signature() -> list[str | dict[str, list[str]]]: ...

0 commit comments

Comments
 (0)