mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-26 02:08:42 +08:00
Use typing_extensions.Self instead of _typeshed.Self (#9702)
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from _typeshed import Incomplete, Self
|
||||
from _typeshed import Incomplete
|
||||
from asyncio import AbstractEventLoop
|
||||
from collections.abc import Callable
|
||||
from logging import Logger
|
||||
from typing_extensions import Self
|
||||
|
||||
from ..connection import Parameters
|
||||
from .base_connection import BaseConnection
|
||||
@@ -11,7 +12,7 @@ LOGGER: Logger
|
||||
|
||||
class AsyncioConnection(BaseConnection):
|
||||
def __init__(
|
||||
self: Self,
|
||||
self,
|
||||
parameters: Parameters | None = ...,
|
||||
on_open_callback: Callable[[Self], object] | None = ...,
|
||||
on_open_error_callback: Callable[[Self, BaseException], object] | None = ...,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import abc
|
||||
from _typeshed import Incomplete, Self
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from typing_extensions import Self
|
||||
|
||||
from ..adapters.utils import nbio_interface
|
||||
from ..connection import Connection
|
||||
@@ -9,7 +10,7 @@ LOGGER: Incomplete
|
||||
|
||||
class BaseConnection(Connection, metaclass=abc.ABCMeta):
|
||||
def __init__(
|
||||
self: Self,
|
||||
self,
|
||||
parameters,
|
||||
on_open_callback: Callable[[Self], object] | None,
|
||||
on_open_error_callback: Callable[[Self, BaseException], object] | None,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from _typeshed import Incomplete, Self
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Generator, Sequence
|
||||
from typing import NamedTuple
|
||||
from typing_extensions import Self
|
||||
|
||||
from ..connection import Parameters
|
||||
from ..data import _ArgumentMapping
|
||||
@@ -55,7 +56,7 @@ class BlockingConnection:
|
||||
def __init__(
|
||||
self, parameters: Parameters | Sequence[Parameters] | None = ..., _impl_class: Incomplete | None = ...
|
||||
) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(self, exc_type: object, value: object, traceback: object) -> None: ...
|
||||
def add_on_connection_blocked_callback(self, callback) -> None: ...
|
||||
def add_on_connection_unblocked_callback(self, callback) -> None: ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from _typeshed import Incomplete, Self
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from logging import Logger
|
||||
from typing import Any
|
||||
from typing_extensions import Final
|
||||
from typing_extensions import Final, Self
|
||||
|
||||
from .callback import CallbackManager
|
||||
from .connection import Connection
|
||||
@@ -25,7 +25,7 @@ class Channel:
|
||||
connection: Connection
|
||||
flow_active: bool
|
||||
|
||||
def __init__(self: Self, connection: Connection, channel_number: int, on_open_callback: Callable[[Self], object]) -> None: ...
|
||||
def __init__(self, connection: Connection, channel_number: int, on_open_callback: Callable[[Self], object]) -> None: ...
|
||||
def __int__(self) -> int: ...
|
||||
def add_callback(self, callback, replies, one_shot: bool = ...) -> None: ...
|
||||
def add_on_cancel_callback(self, callback) -> None: ...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import abc
|
||||
from _typeshed import Incomplete, Self
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from logging import Logger
|
||||
from typing_extensions import Final
|
||||
from typing_extensions import Final, Self
|
||||
|
||||
from .callback import CallbackManager
|
||||
from .channel import Channel
|
||||
@@ -150,23 +150,21 @@ class Connection(AbstractBase, metaclass=abc.ABCMeta):
|
||||
server_properties: Incomplete
|
||||
known_hosts: Incomplete
|
||||
def __init__(
|
||||
self: Self,
|
||||
self,
|
||||
parameters: Parameters | None = ...,
|
||||
on_open_callback: Callable[[Self], object] | None = ...,
|
||||
on_open_error_callback: Callable[[Self, BaseException], object] | None = ...,
|
||||
on_close_callback: Callable[[Self, BaseException], object] | None = ...,
|
||||
internal_connection_workflow: bool = ...,
|
||||
) -> None: ...
|
||||
def add_on_close_callback(self: Self, callback: Callable[[Self, BaseException], object]) -> None: ...
|
||||
def add_on_connection_blocked_callback(
|
||||
self: Self, callback: Callable[[Self, Method[SpecConnection.Blocked]], object]
|
||||
) -> None: ...
|
||||
def add_on_close_callback(self, callback: Callable[[Self, BaseException], object]) -> None: ...
|
||||
def add_on_connection_blocked_callback(self, callback: Callable[[Self, Method[SpecConnection.Blocked]], object]) -> None: ...
|
||||
def add_on_connection_unblocked_callback(
|
||||
self: Self, callback: Callable[[Self, Method[SpecConnection.Unblocked]], object]
|
||||
self, callback: Callable[[Self, Method[SpecConnection.Unblocked]], object]
|
||||
) -> None: ...
|
||||
def add_on_open_callback(self: Self, callback: Callable[[Self], object]) -> None: ...
|
||||
def add_on_open_callback(self, callback: Callable[[Self], object]) -> None: ...
|
||||
def add_on_open_error_callback(
|
||||
self: Self, callback: Callable[[Self, BaseException], object], remove_default: bool = ...
|
||||
self, callback: Callable[[Self, BaseException], object], remove_default: bool = ...
|
||||
) -> None: ...
|
||||
def channel(
|
||||
self, channel_number: int | None = ..., on_open_callback: Callable[[Channel], object] | None = ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from _typeshed import Incomplete, Self
|
||||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
from typing_extensions import Literal, Self, TypeAlias
|
||||
|
||||
from .amqp_object import Class, Method, Properties
|
||||
|
||||
@@ -339,7 +339,7 @@ class Exchange(Class):
|
||||
def __init__(self) -> None: ...
|
||||
@property
|
||||
def synchronous(self) -> Literal[False]: ...
|
||||
def decode(self: Self, encoded: bytes, offset: int = ...) -> Self: ...
|
||||
def decode(self, encoded: bytes, offset: int = ...) -> Self: ...
|
||||
def encode(self) -> list[bytes]: ...
|
||||
|
||||
class Delete(Method):
|
||||
@@ -450,7 +450,7 @@ class Queue(Class):
|
||||
) -> None: ...
|
||||
@property
|
||||
def synchronous(self) -> Literal[True]: ...
|
||||
def decode(self: Self, encoded: bytes, offset: int = ...) -> Self: ...
|
||||
def decode(self, encoded: bytes, offset: int = ...) -> Self: ...
|
||||
def encode(self) -> list[bytes]: ...
|
||||
|
||||
class DeclareOk(Method):
|
||||
@@ -461,7 +461,7 @@ class Queue(Class):
|
||||
def __init__(self, queue: _str, message_count: int, consumer_count: int) -> None: ...
|
||||
@property
|
||||
def synchronous(self) -> Literal[False]: ...
|
||||
def decode(self: Self, encoded: bytes, offset: int = ...) -> Self: ...
|
||||
def decode(self, encoded: bytes, offset: int = ...) -> Self: ...
|
||||
def encode(self) -> list[bytes]: ...
|
||||
|
||||
class Bind(Method):
|
||||
|
||||
Reference in New Issue
Block a user