Skip to content

Commit

Permalink
Revert changes to stubs/pika to workaround the pyright bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Feb 9, 2023
1 parent 2166801 commit 7fc50c6
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 25 deletions.
5 changes: 2 additions & 3 deletions stubs/pika/pika/adapters/asyncio_connection.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, Self
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
Expand All @@ -12,7 +11,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 = ...,
Expand Down
5 changes: 2 additions & 3 deletions stubs/pika/pika/adapters/base_connection.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import abc
from _typeshed import Incomplete
from _typeshed import Incomplete, Self
from collections.abc import Callable
from typing_extensions import Self

from ..adapters.utils import nbio_interface
from ..connection import Connection
Expand All @@ -10,7 +9,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,
Expand Down
5 changes: 2 additions & 3 deletions stubs/pika/pika/adapters/blocking_connection.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, Self
from collections.abc import Generator, Sequence
from typing import NamedTuple
from typing_extensions import Self

from ..connection import Parameters
from ..data import _ArgumentMapping
Expand Down Expand Up @@ -56,7 +55,7 @@ class BlockingConnection:
def __init__(
self, parameters: Parameters | Sequence[Parameters] | None = ..., _impl_class: Incomplete | None = ...
) -> None: ...
def __enter__(self) -> Self: ...
def __enter__(self: 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: ...
Expand Down
6 changes: 3 additions & 3 deletions stubs/pika/pika/channel.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, Self
from collections.abc import Callable
from logging import Logger
from typing import Any
from typing_extensions import Final, Self
from typing_extensions import Final

from .callback import CallbackManager
from .connection import Connection
Expand All @@ -25,7 +25,7 @@ class Channel:
connection: Connection
flow_active: bool

def __init__(self, connection: Connection, channel_number: int, on_open_callback: Callable[[Self], object]) -> None: ...
def __init__(self: 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: ...
Expand Down
18 changes: 10 additions & 8 deletions stubs/pika/pika/connection.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import abc
from _typeshed import Incomplete
from _typeshed import Incomplete, Self
from collections.abc import Callable
from logging import Logger
from typing_extensions import Final, Self
from typing_extensions import Final

from .callback import CallbackManager
from .channel import Channel
Expand Down Expand Up @@ -150,21 +150,23 @@ 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, callback: Callable[[Self, BaseException], object]) -> None: ...
def add_on_connection_blocked_callback(self, callback: Callable[[Self, Method[SpecConnection.Blocked]], object]) -> 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_connection_unblocked_callback(
self, callback: Callable[[Self, Method[SpecConnection.Unblocked]], object]
self: Self, callback: Callable[[Self, Method[SpecConnection.Unblocked]], object]
) -> None: ...
def add_on_open_callback(self, callback: Callable[[Self], object]) -> None: ...
def add_on_open_callback(self: Self, callback: Callable[[Self], object]) -> None: ...
def add_on_open_error_callback(
self, callback: Callable[[Self, BaseException], object], remove_default: bool = ...
self: Self, callback: Callable[[Self, BaseException], object], remove_default: bool = ...
) -> None: ...
def channel(
self, channel_number: int | None = ..., on_open_callback: Callable[[Channel], object] | None = ...
Expand Down
10 changes: 5 additions & 5 deletions stubs/pika/pika/spec.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, Self
from typing import ClassVar
from typing_extensions import Literal, Self, TypeAlias
from typing_extensions import Literal, TypeAlias

from .amqp_object import Class, Method, Properties

Expand Down Expand Up @@ -339,7 +339,7 @@ class Exchange(Class):
def __init__(self) -> None: ...
@property
def synchronous(self) -> Literal[False]: ...
def decode(self, encoded: bytes, offset: int = ...) -> Self: ...
def decode(self: Self, encoded: bytes, offset: int = ...) -> Self: ...
def encode(self) -> list[bytes]: ...

class Delete(Method):
Expand Down Expand Up @@ -450,7 +450,7 @@ class Queue(Class):
) -> None: ...
@property
def synchronous(self) -> Literal[True]: ...
def decode(self, encoded: bytes, offset: int = ...) -> Self: ...
def decode(self: Self, encoded: bytes, offset: int = ...) -> Self: ...
def encode(self) -> list[bytes]: ...

class DeclareOk(Method):
Expand All @@ -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, encoded: bytes, offset: int = ...) -> Self: ...
def decode(self: Self, encoded: bytes, offset: int = ...) -> Self: ...
def encode(self) -> list[bytes]: ...

class Bind(Method):
Expand Down

0 comments on commit 7fc50c6

Please sign in to comment.