Skip to content

Commit

Permalink
Sync typeshed for 1.6 (#15918)
Browse files Browse the repository at this point in the history
Use the sync-typeshed script to sync the latest typeshed before the 1.6
release.

---------

Co-authored-by: Shantanu <[email protected]>
Co-authored-by: AlexWaygood <[email protected]>
  • Loading branch information
3 people authored Aug 21, 2023
1 parent 5af7671 commit 5d909f1
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
13 changes: 13 additions & 0 deletions mypy/typeshed/stdlib/_typeshed/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ Incomplete: TypeAlias = Any
# To describe a function parameter that is unused and will work with anything.
Unused: TypeAlias = object

# Used to mark arguments that default to a sentinel value. This prevents
# stubtest from complaining about the default value not matching.
#
# def foo(x: int | None = sentinel) -> None: ...
#
# In cases where the sentinel object is exported and can be used by user code,
# a construct like this is better:
#
# _SentinelType = NewType("_SentinelType", object)
# sentinel: _SentinelType
# def foo(x: int | None | _SentinelType = ...) -> None: ...
sentinel = Any # noqa: Y026

# stable
class IdentityFunction(Protocol):
def __call__(self, __x: _T) -> _T: ...
Expand Down
17 changes: 16 additions & 1 deletion mypy/typeshed/stdlib/argparse.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
from _typeshed import sentinel
from collections.abc import Callable, Generator, Iterable, Sequence
from re import Pattern
from typing import IO, Any, Generic, NewType, NoReturn, Protocol, TypeVar, overload
Expand Down Expand Up @@ -334,7 +335,21 @@ class Action(_AttributeHolder):
if sys.version_info >= (3, 9):
def format_usage(self) -> str: ...

if sys.version_info >= (3, 9):
if sys.version_info >= (3, 12):
class BooleanOptionalAction(Action):
def __init__(
self,
option_strings: Sequence[str],
dest: str,
default: _T | str | None = None,
type: Callable[[str], _T] | FileType | None = sentinel, # noqa: Y011
choices: Iterable[_T] | None = sentinel, # noqa: Y011
required: bool = False,
help: str | None = None,
metavar: str | tuple[str, ...] | None = sentinel, # noqa: Y011
) -> None: ...

elif sys.version_info >= (3, 9):
class BooleanOptionalAction(Action):
def __init__(
self,
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ else:
@property
def si_code(self) -> int: ...

def waitid(__idtype: int, __ident: int, __options: int) -> waitid_result: ...
def waitid(__idtype: int, __ident: int, __options: int) -> waitid_result | None: ...

def wait3(options: int) -> tuple[int, int, Any]: ...
def wait4(pid: int, options: int) -> tuple[int, int, Any]: ...
Expand Down
4 changes: 2 additions & 2 deletions mypy/typeshed/stdlib/ssl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -436,15 +436,15 @@ class SSLContext:
server_side: bool = False,
do_handshake_on_connect: bool = True,
suppress_ragged_eofs: bool = True,
server_hostname: str | None = None,
server_hostname: str | bytes | None = None,
session: SSLSession | None = None,
) -> SSLSocket: ...
def wrap_bio(
self,
incoming: MemoryBIO,
outgoing: MemoryBIO,
server_side: bool = False,
server_hostname: str | None = None,
server_hostname: str | bytes | None = None,
session: SSLSession | None = None,
) -> SSLObject: ...
def session_stats(self) -> dict[str, int]: ...
Expand Down

0 comments on commit 5d909f1

Please sign in to comment.