8000 stdlib: fix signatures for some functions with unrepresentable defaults by JelleZijlstra · Pull Request #11000 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

stdlib: fix signatures for some functions with unrepresentable defaults #11000

New issue 8000

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stdlib/_locale.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from _typeshed import StrPath
from collections.abc import Iterable, Mapping
from collections.abc import Mapping

LC_CTYPE: int
LC_COLLATE: int
Expand All @@ -10,7 +10,7 @@ LC_NUMERIC: int
LC_ALL: int
CHAR_MAX: int

def setlocale(category: int, locale: str | Iterable[str | None] | None = None) -> str: ...
def setlocale(__category: int, __locale: str | None = None) -> str: ...
def localeconv() -> Mapping[str, int | str | list[int]]: ...

if sys.version_info >= (3, 11):
Expand Down
2 changes: 1 addition & 1 deletion stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ if sys.version_info >= (3, 10):
# See discussion in #7491 and pure-Python implementation of `anext` at https://github.com/python/cpython/blob/ea786a882b9ed4261eafabad6011bc7ef3b5bf94/Lib/test/test_asyncgen.py#L52-L80
def anext(__i: _SupportsSynchronousAnext[_AwaitableT]) -> _AwaitableT: ...
@overload
async def anext(__i: SupportsAnext[_T], default: _VT) -> _T | _VT: ...
async def anext(__i: SupportsAnext[_T], __default: _VT) -> _T | _VT: ...

# compile() returns a CodeType, unless the flags argument includes PyCF_ONLY_AST (=1024),
# in which case it returns ast.AST. We have overloads for flag 0 (the default) and for
Expand Down
2 changes: 1 addition & 1 deletion stdlib/cmath.pyi
10000
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def exp(__z: _C) -> complex: ...
def isclose(a: _C, b: _C, *, rel_tol: SupportsFloat = 1e-09, abs_tol: SupportsFloat = 0.0) -> bool: ...
def isinf(__z: _C) -> bool: ...
def isnan(__z: _C) -> bool: ...
def log(__x: _C, __y_obj: _C = ...) -> complex: ...
def log(__x: _C, __base: _C = ...) -> complex: ...
def log10(__z: _C) -> complex: ...
def phase(__z: _C) -> float: ...
def polar(__z: _C) -> tuple[float, float]: ...
Expand Down
4 changes: 2 additions & 2 deletions stdlib/locale.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ from _locale import (
LC_NUMERIC as LC_NUMERIC,
LC_TIME as LC_TIME,
localeconv as localeconv,
setlocale as setlocale,
strcoll as strcoll,
strxfrm as strxfrm,
)

# This module defines a function "str()", which is why "str" can't be used
# as a type annotation or type alias.
from builtins import str as _str
from collections.abc import Callable
from collections.abc import Callable, Iterable
from decimal import Decimal
from typing import Any

Expand Down Expand Up @@ -131,6 +130,7 @@ def getdefaultlocale(
envvars: tuple[_str, ...] = ("LC_ALL", "LC_CTYPE", "LANG", "LANGUAGE")
) -> tuple[_str | None, _str | None]: ...
def getlocale(category: int = ...) -> tuple[_str | None, _str | None]: ...
def setlocale(category: int, locale: _str | Iterable[_str | None] | None = None) -> _str: ...
def getpreferredencoding(do_setlocale: bool = True) -> _str: ...
def normalize(localename: _str) -> _str: ...
def resetlocale(category: int = ...) -> None: ...
Expand Down
12 changes: 6 additions & 6 deletions stdlib/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -970,9 +970,9 @@ else:
def WTERMSIG(status: int) -> int: ...
if sys.version_info >= (3, 8):
D545 def posix_spawn(
path: StrOrBytesPath,
argv: _ExecVArgs,
env: _ExecEnv,
__path: StrOrBytesPath,
__argv: _ExecVArgs,
__env: _ExecEnv,
*,
file_actions: Sequence[tuple[Any, ...]] | None = ...,
setpgroup: int | None = ...,
Expand All @@ -983,9 +983,9 @@ else:
scheduler: tuple[Any, sched_param] | None = ...,
) -> int: ...
def posix_spawnp(
path: StrOrBytesPath,
argv: _ExecVArgs,
env: _ExecEnv,
__path: StrOrBytesPath,
__argv: _ExecVArgs,
__env: _ExecEnv,
*,
file_actions: Sequence[tuple[Any, ...]] | None = ...,
setpgroup: int | None = ...,
Expand Down
2 changes: 1 addition & 1 deletion stdlib/sqlite3/dbapi2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class Connection:
def cursor(self, cursorClass: None = None) -> Cursor: ...
@overload
def cursor(self, cursorClass: Callable[[Connection], _CursorT]) -> _CursorT: ...
def execute(self, sql: str, parameters: _Parameters = ...) -> Cursor: ...
def execute(self, __sql: str, __parameters: _Parameters = ...) -> Cursor: ...
def executemany(self, __sql: str, __parameters: Iterable[_Parameters]) -> Cursor: ...
def executescript(self, __sql_script: str) -> Cursor: ...
def interrupt(self) -> None: ...
Expand Down
0