mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-24 17:28:40 +08:00
Use PEP 570 syntax in third party stubs (#11554)
This commit is contained in:
@@ -15,7 +15,7 @@ class _type:
|
||||
# The class doesn't exist at runtime but following attributes have type "psycopg2._psycopg.type"
|
||||
name: str
|
||||
values: tuple[int, ...]
|
||||
def __call__(self, __value: str | bytes | None, __cur: cursor | None) -> Any: ...
|
||||
def __call__(self, value: str | bytes | None, cur: cursor | None, /) -> Any: ...
|
||||
|
||||
BINARY: _type
|
||||
BINARYARRAY: _type
|
||||
@@ -116,8 +116,8 @@ class cursor:
|
||||
def statusmessage(self) -> str | None: ...
|
||||
@property
|
||||
def pgresult_ptr(self) -> int | None: ...
|
||||
def callproc(self, __procname: str | bytes, __parameters: _Vars = None) -> None: ...
|
||||
def cast(self, __oid: int, __s: str | bytes) -> Any: ...
|
||||
def callproc(self, procname: str | bytes, parameters: _Vars = None, /) -> None: ...
|
||||
def cast(self, oid: int, s: str | bytes, /) -> Any: ...
|
||||
def close(self) -> None: ...
|
||||
def copy_expert(
|
||||
self, sql: str | bytes | Composable, file: _SupportsReadAndReadline | SupportsWrite[str], size: int = 8192
|
||||
@@ -143,7 +143,7 @@ class cursor:
|
||||
def nextset(self) -> NoReturn: ... # not supported
|
||||
def scroll(self, value: int, mode: Literal["absolute", "relative"] = "relative") -> None: ...
|
||||
def setinputsizes(self, sizes: Unused) -> None: ...
|
||||
def setoutputsize(self, __size: int, __column: int = ...) -> None: ...
|
||||
def setoutputsize(self, size: int, column: int = ..., /) -> None: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(
|
||||
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
|
||||
@@ -154,28 +154,28 @@ class cursor:
|
||||
_Cursor: TypeAlias = cursor
|
||||
|
||||
class AsIs:
|
||||
def __init__(self, __obj: object, **kwargs: Unused) -> None: ...
|
||||
def __init__(self, obj: object, /, **kwargs: Unused) -> None: ...
|
||||
@property
|
||||
def adapted(self) -> Any: ...
|
||||
def getquoted(self) -> bytes: ...
|
||||
def __conform__(self, __proto) -> Self | None: ...
|
||||
def __conform__(self, proto, /) -> Self | None: ...
|
||||
|
||||
class Binary:
|
||||
def __init__(self, __str: object, **kwargs: Unused) -> None: ...
|
||||
def __init__(self, str: object, /, **kwargs: Unused) -> None: ...
|
||||
@property
|
||||
def adapted(self) -> Any: ...
|
||||
@property
|
||||
def buffer(self) -> Any: ...
|
||||
def getquoted(self) -> bytes: ...
|
||||
def prepare(self, __conn: connection) -> None: ...
|
||||
def __conform__(self, __proto) -> Self | None: ...
|
||||
def prepare(self, conn: connection, /) -> None: ...
|
||||
def __conform__(self, proto, /) -> Self | None: ...
|
||||
|
||||
class Boolean:
|
||||
def __init__(self, __obj: object, **kwargs: Unused) -> None: ...
|
||||
def __init__(self, obj: object, /, **kwargs: Unused) -> None: ...
|
||||
@property
|
||||
def adapted(self) -> Any: ...
|
||||
def getquoted(self) -> bytes: ...
|
||||
def __conform__(self, __proto) -> Self | None: ...
|
||||
def __conform__(self, proto, /) -> Self | None: ...
|
||||
|
||||
class Column:
|
||||
display_size: Any
|
||||
@@ -188,15 +188,15 @@ class Column:
|
||||
table_oid: Any
|
||||
type_code: Any
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def __eq__(self, __other): ...
|
||||
def __ge__(self, __other): ...
|
||||
def __getitem__(self, __index): ...
|
||||
def __eq__(self, other, /): ...
|
||||
def __ge__(self, other, /): ...
|
||||
def __getitem__(self, index, /): ...
|
||||
def __getstate__(self): ...
|
||||
def __gt__(self, __other): ...
|
||||
def __le__(self, __other): ...
|
||||
def __gt__(self, other, /): ...
|
||||
def __le__(self, other, /): ...
|
||||
def __len__(self) -> int: ...
|
||||
def __lt__(self, __other): ...
|
||||
def __ne__(self, __other): ...
|
||||
def __lt__(self, other, /): ...
|
||||
def __ne__(self, other, /): ...
|
||||
def __setstate__(self, state): ...
|
||||
|
||||
class ConnectionInfo:
|
||||
@@ -281,17 +281,17 @@ class Warning(Exception): ...
|
||||
|
||||
class ISQLQuote:
|
||||
_wrapped: Any
|
||||
def __init__(self, __wrapped: object, **kwargs) -> None: ...
|
||||
def __init__(self, wrapped: object, /, **kwargs) -> None: ...
|
||||
def getbinary(self) -> Incomplete: ...
|
||||
def getbuffer(self) -> Incomplete: ...
|
||||
def getquoted(self) -> bytes: ...
|
||||
|
||||
class Decimal:
|
||||
def __init__(self, __value: object, **kwargs: Unused) -> None: ...
|
||||
def __init__(self, value: object, /, **kwargs: Unused) -> None: ...
|
||||
@property
|
||||
def adapted(self) -> Any: ...
|
||||
def getquoted(self) -> bytes: ...
|
||||
def __conform__(self, __proto) -> Self | None: ...
|
||||
def __conform__(self, proto, /) -> Self | None: ...
|
||||
|
||||
class Diagnostics:
|
||||
column_name: str | None
|
||||
@@ -312,55 +312,55 @@ class Diagnostics:
|
||||
sqlstate: str | None
|
||||
statement_position: str | None
|
||||
table_name: str | None
|
||||
def __init__(self, __err: Error) -> None: ...
|
||||
def __init__(self, err: Error, /) -> None: ...
|
||||
|
||||
class Float:
|
||||
def __init__(self, __value: float, **kwargs: Unused) -> None: ...
|
||||
def __init__(self, value: float, /, **kwargs: Unused) -> None: ...
|
||||
@property
|
||||
def adapted(self) -> float: ...
|
||||
def getquoted(self) -> bytes: ...
|
||||
def __conform__(self, __proto) -> Self | None: ...
|
||||
def __conform__(self, proto, /) -> Self | None: ...
|
||||
|
||||
class Int:
|
||||
def __init__(self, __value: ConvertibleToInt, **kwargs: Unused) -> None: ...
|
||||
def __init__(self, value: ConvertibleToInt, /, **kwargs: Unused) -> None: ...
|
||||
@property
|
||||
def adapted(self) -> Any: ...
|
||||
def getquoted(self) -> bytes: ...
|
||||
def __conform__(self, __proto) -> Self | None: ...
|
||||
def __conform__(self, proto, /) -> Self | None: ...
|
||||
|
||||
class List:
|
||||
def __init__(self, __objs: list[object], **kwargs: Unused) -> None: ...
|
||||
def __init__(self, objs: list[object], /, **kwargs: Unused) -> None: ...
|
||||
@property
|
||||
def adapted(self) -> list[Any]: ...
|
||||
def getquoted(self) -> bytes: ...
|
||||
def prepare(self, __conn: connection) -> None: ...
|
||||
def __conform__(self, __proto) -> Self | None: ...
|
||||
def prepare(self, conn: connection, /) -> None: ...
|
||||
def __conform__(self, proto, /) -> Self | None: ...
|
||||
|
||||
class Notify:
|
||||
channel: Any
|
||||
payload: Any
|
||||
pid: Any
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def __eq__(self, __other): ...
|
||||
def __ge__(self, __other): ...
|
||||
def __getitem__(self, __index): ...
|
||||
def __gt__(self, __other): ...
|
||||
def __eq__(self, other, /): ...
|
||||
def __ge__(self, other, /): ...
|
||||
def __getitem__(self, index, /): ...
|
||||
def __gt__(self, other, /): ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __le__(self, __other): ...
|
||||
def __le__(self, other, /): ...
|
||||
def __len__(self) -> int: ...
|
||||
def __lt__(self, __other): ...
|
||||
def __ne__(self, __other): ...
|
||||
def __lt__(self, other, /): ...
|
||||
def __ne__(self, other, /): ...
|
||||
|
||||
class QuotedString:
|
||||
encoding: str
|
||||
def __init__(self, __str: object, **kwargs: Unused) -> None: ...
|
||||
def __init__(self, str: object, /, **kwargs: Unused) -> None: ...
|
||||
@property
|
||||
def adapted(self) -> Any: ...
|
||||
@property
|
||||
def buffer(self) -> Any: ...
|
||||
def getquoted(self) -> bytes: ...
|
||||
def prepare(self, __conn: connection) -> None: ...
|
||||
def __conform__(self, __proto) -> Self | None: ...
|
||||
def prepare(self, conn: connection, /) -> None: ...
|
||||
def __conform__(self, proto, /) -> Self | None: ...
|
||||
|
||||
class ReplicationCursor(cursor):
|
||||
feedback_timestamp: Any
|
||||
@@ -390,7 +390,7 @@ class Xid:
|
||||
prepared: Any
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def from_string(self, *args, **kwargs): ...
|
||||
def __getitem__(self, __index): ...
|
||||
def __getitem__(self, index, /): ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
_T_cur = TypeVar("_T_cur", bound=cursor)
|
||||
@@ -423,7 +423,7 @@ class connection:
|
||||
@property
|
||||
def isolation_level(self) -> int | None: ...
|
||||
@isolation_level.setter
|
||||
def isolation_level(self, __value: str | bytes | int | None) -> None: ...
|
||||
def isolation_level(self, value: str | bytes | int | None, /) -> None: ...
|
||||
notices: list[str]
|
||||
notifies: list[Notify]
|
||||
@property
|
||||
@@ -433,11 +433,11 @@ class connection:
|
||||
@property
|
||||
def deferrable(self) -> bool | None: ...
|
||||
@deferrable.setter
|
||||
def deferrable(self, __value: Literal["default"] | bool | None) -> None: ...
|
||||
def deferrable(self, value: Literal["default"] | bool | None, /) -> None: ...
|
||||
@property
|
||||
def readonly(self) -> bool | None: ...
|
||||
@readonly.setter
|
||||
def readonly(self, __value: Literal["default"] | bool | None) -> None: ...
|
||||
def readonly(self, value: Literal["default"] | bool | None, /) -> None: ...
|
||||
@property
|
||||
def server_version(self) -> int: ...
|
||||
@property
|
||||
@@ -499,13 +499,13 @@ class connection:
|
||||
autocommit: bool = ...,
|
||||
) -> None: ...
|
||||
def tpc_begin(self, xid: str | bytes | Xid) -> None: ...
|
||||
def tpc_commit(self, __xid: str | bytes | Xid = ...) -> None: ...
|
||||
def tpc_commit(self, xid: str | bytes | Xid = ..., /) -> None: ...
|
||||
def tpc_prepare(self) -> None: ...
|
||||
def tpc_recover(self) -> list[Xid]: ...
|
||||
def tpc_rollback(self, __xid: str | bytes | Xid = ...) -> None: ...
|
||||
def tpc_rollback(self, xid: str | bytes | Xid = ..., /) -> None: ...
|
||||
def xid(self, format_id, gtrid, bqual) -> Xid: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(self, __type: type[BaseException] | None, __name: BaseException | None, __tb: TracebackType | None) -> None: ...
|
||||
def __exit__(self, type: type[BaseException] | None, name: BaseException | None, tb: TracebackType | None, /) -> None: ...
|
||||
|
||||
_Connection: TypeAlias = connection
|
||||
|
||||
@@ -561,34 +561,28 @@ class _datetime:
|
||||
# The class doesn't exist at runtime but functions below return "psycopg2._psycopg.datetime" objects
|
||||
# XXX: This and other classes that implement the `ISQLQuote` protocol could be made generic
|
||||
# in the return type of their `adapted` property if someone asks for it.
|
||||
def __init__(self, __obj: object, __type: int = -1, **kwargs: Unused) -> None: ...
|
||||
def __init__(self, obj: object, type: int = -1, /, **kwargs: Unused) -> None: ...
|
||||
@property
|
||||
def adapted(self) -> Any: ...
|
||||
@property
|
||||
def type(self) -> int: ...
|
||||
def getquoted(self) -> bytes: ...
|
||||
def __conform__(self, __proto) -> Self | None: ...
|
||||
def __conform__(self, proto, /) -> Self | None: ...
|
||||
|
||||
def Date(__year: int, __month: int, __day: int) -> _datetime: ...
|
||||
def DateFromPy(__date: dt.date) -> _datetime: ...
|
||||
def DateFromTicks(__ticks: float) -> _datetime: ...
|
||||
def IntervalFromPy(__interval: dt.timedelta) -> _datetime: ...
|
||||
def Time(__hour: int, __minutes: int, __seconds: float, __tzinfo: dt.tzinfo | None = None) -> _datetime: ...
|
||||
def TimeFromPy(__time: dt.time) -> _datetime: ...
|
||||
def TimeFromTicks(__ticks: float) -> _datetime: ...
|
||||
def Date(year: int, month: int, day: int, /) -> _datetime: ...
|
||||
def DateFromPy(date: dt.date, /) -> _datetime: ...
|
||||
def DateFromTicks(ticks: float, /) -> _datetime: ...
|
||||
def IntervalFromPy(interval: dt.timedelta, /) -> _datetime: ...
|
||||
def Time(hour: int, minutes: int, seconds: float, tzinfo: dt.tzinfo | None = None, /) -> _datetime: ...
|
||||
def TimeFromPy(time: dt.time, /) -> _datetime: ...
|
||||
def TimeFromTicks(ticks: float, /) -> _datetime: ...
|
||||
def Timestamp(
|
||||
__year: int,
|
||||
__month: int,
|
||||
__day: int,
|
||||
__hour: int = 0,
|
||||
__minutes: int = 0,
|
||||
__seconds: float = 0,
|
||||
__tzinfo: dt.tzinfo | None = None,
|
||||
year: int, month: int, day: int, hour: int = 0, minutes: int = 0, seconds: float = 0, tzinfo: dt.tzinfo | None = None, /
|
||||
) -> _datetime: ...
|
||||
def TimestampFromPy(__datetime: dt.datetime) -> _datetime: ...
|
||||
def TimestampFromTicks(__ticks: float) -> _datetime: ...
|
||||
def TimestampFromPy(datetime: dt.datetime, /) -> _datetime: ...
|
||||
def TimestampFromTicks(ticks: float, /) -> _datetime: ...
|
||||
def _connect(*args, **kwargs): ...
|
||||
def adapt(__obj: object, __protocol: Incomplete = ..., __alternate: Incomplete = ...) -> Any: ...
|
||||
def adapt(obj: object, protocol: Incomplete = ..., alternate: Incomplete = ..., /) -> Any: ...
|
||||
def encrypt_password(
|
||||
password: str | bytes, user: str | bytes, scope: connection | cursor | None = None, algorithm: str | None = None
|
||||
) -> str: ...
|
||||
@@ -603,5 +597,5 @@ def new_type(
|
||||
) -> _type: ...
|
||||
def parse_dsn(dsn: str | bytes) -> dict[str, Any]: ...
|
||||
def quote_ident(ident: str | bytes, scope) -> str: ...
|
||||
def register_type(__obj: _type, __conn_or_curs: connection | cursor | None = None) -> None: ...
|
||||
def set_wait_callback(__none: Callable[..., Incomplete] | None) -> None: ...
|
||||
def register_type(obj: _type, conn_or_curs: connection | cursor | None = None, /) -> None: ...
|
||||
def set_wait_callback(none: Callable[..., Incomplete] | None, /) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user