mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
stdlib: fix signatures for some functions with unrepresentable defaults (#11000)
Found with python/mypy#16433 Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -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
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]: ...
|
||||
|
||||
@@ -8,7 +8,6 @@ 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,
|
||||
)
|
||||
@@ -16,7 +15,7 @@ from _locale import (
|
||||
# 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
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -970,9 +970,9 @@ else:
|
||||
def WTERMSIG(status: int) -> int: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def posix_spawn(
|
||||
path: StrOrBytesPath,
|
||||
argv: _ExecVArgs,
|
||||
env: _ExecEnv,
|
||||
__path: StrOrBytesPath,
|
||||
__argv: _ExecVArgs,
|
||||
__env: _ExecEnv,
|
||||
*,
|
||||
file_actions: Sequence[tuple[Any, ...]] | None = ...,
|
||||
setpgroup: int | None = ...,
|
||||
@@ -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 = ...,
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user