mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-17 07:14:12 +08:00
Use ConvertibleToInt/ConvertibleToFloat in many third-party stubs (#11022)
Note: this may make the latest version of certain stubs packages incompatible with older versions of mypy and pyright.
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import datetime as dt
|
||||
from _typeshed import Incomplete, ReadableBuffer, SupportsRead, SupportsReadline, SupportsTrunc, SupportsWrite, Unused
|
||||
from _typeshed import ConvertibleToInt, Incomplete, SupportsRead, SupportsReadline, SupportsWrite, Unused
|
||||
from collections.abc import Callable, Iterable, Mapping, Sequence
|
||||
from types import TracebackType
|
||||
from typing import Any, NoReturn, Protocol, SupportsInt, TypeVar, overload, type_check_only
|
||||
from typing_extensions import Literal, Self, SupportsIndex, TypeAlias
|
||||
from typing import Any, NoReturn, Protocol, TypeVar, overload, type_check_only
|
||||
from typing_extensions import Literal, Self, TypeAlias
|
||||
|
||||
from psycopg2.sql import Composable
|
||||
|
||||
_Vars: TypeAlias = Sequence[Any] | Mapping[str, Any] | None
|
||||
_AcceptedByInt: TypeAlias = str | ReadableBuffer | SupportsInt | SupportsIndex | SupportsTrunc
|
||||
|
||||
@type_check_only
|
||||
class _type:
|
||||
@@ -321,7 +320,7 @@ class Float:
|
||||
def __conform__(self, __proto) -> Self | None: ...
|
||||
|
||||
class Int:
|
||||
def __init__(self, __value: _AcceptedByInt, **kwargs: Unused) -> None: ...
|
||||
def __init__(self, __value: ConvertibleToInt, **kwargs: Unused) -> None: ...
|
||||
@property
|
||||
def adapted(self) -> Any: ...
|
||||
def getquoted(self) -> bytes: ...
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from _typeshed import Incomplete
|
||||
from _typeshed import ConvertibleToInt, Incomplete
|
||||
from collections.abc import Hashable
|
||||
|
||||
import psycopg2
|
||||
from psycopg2._psycopg import _AcceptedByInt
|
||||
|
||||
class PoolError(psycopg2.Error): ...
|
||||
|
||||
@@ -10,7 +9,7 @@ class AbstractConnectionPool:
|
||||
minconn: int
|
||||
maxconn: int
|
||||
closed: bool
|
||||
def __init__(self, minconn: _AcceptedByInt, maxconn: _AcceptedByInt, *args, **kwargs) -> None: ...
|
||||
def __init__(self, minconn: ConvertibleToInt, maxconn: ConvertibleToInt, *args, **kwargs) -> None: ...
|
||||
# getconn, putconn and closeall are officially documented as methods of the
|
||||
# abstract base class, but in reality, they only exist on the children classes
|
||||
def getconn(self, key: Hashable | None = None) -> Incomplete: ...
|
||||
|
||||
Reference in New Issue
Block a user