Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions stubs/pika/pika/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Final

from pika import adapters as adapters
from pika.adapters import (
BaseConnection as BaseConnection,
Expand All @@ -9,3 +11,5 @@ from pika.connection import ConnectionParameters as ConnectionParameters, SSLOpt
from pika.credentials import PlainCredentials as PlainCredentials
from pika.delivery_mode import DeliveryMode as DeliveryMode
from pika.spec import BasicProperties as BasicProperties

__version__: Final[str]
11 changes: 7 additions & 4 deletions stubs/pika/pika/adapters/asyncio_connection.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
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
from .utils import io_services_utils, nbio_interface
from .utils import connection_workflow, io_services_utils, nbio_interface

LOGGER: Logger

Expand All @@ -22,7 +21,11 @@ class AsyncioConnection(BaseConnection):
) -> None: ...
@classmethod
def create_connection(
cls, connection_configs, on_done, custom_ioloop: AbstractEventLoop | None = None, workflow: Incomplete | None = None
cls,
connection_configs,
on_done,
custom_ioloop: AbstractEventLoop | None = None,
workflow: connection_workflow.AbstractAMQPConnectionWorkflow | None = None,
): ...

class _AsyncioIOServicesAdapter(
Expand All @@ -31,7 +34,7 @@ class _AsyncioIOServicesAdapter(
nbio_interface.AbstractIOServices,
nbio_interface.AbstractFileDescriptorServices,
):
def __init__(self, loop: Incomplete | None = None) -> None: ...
def __init__(self, loop: AbstractEventLoop | None = None) -> None: ...
def get_native_ioloop(self): ...
def close(self) -> None: ...
def run(self) -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/pika/pika/adapters/base_connection.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import abc
from _typeshed import Incomplete
from collections.abc import Callable
from logging import Logger
from typing_extensions import Self

from ..adapters.utils import nbio_interface
from ..connection import Connection

LOGGER: Incomplete
LOGGER: Logger

class BaseConnection(Connection, metaclass=abc.ABCMeta):
def __init__(
Expand Down
3 changes: 2 additions & 1 deletion stubs/pika/pika/adapters/blocking_connection.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from _typeshed import Incomplete, Unused
from collections.abc import Generator, Sequence
from logging import Logger
from types import TracebackType
from typing import NamedTuple
from typing_extensions import Self
Expand All @@ -9,7 +10,7 @@ from ..data import _ArgumentMapping
from ..exchange_type import ExchangeType
from ..spec import BasicProperties

LOGGER: Incomplete
LOGGER: Logger

class _CallbackResult:
def __init__(self, value_class: Incomplete | None = None) -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/pika/pika/adapters/gevent_connection.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from _typeshed import Incomplete
from logging import Logger

from pika.adapters.base_connection import BaseConnection
from pika.adapters.utils.nbio_interface import AbstractIOReference
from pika.adapters.utils.selector_ioloop_adapter import AbstractSelectorIOLoop, SelectorIOServicesAdapter

LOGGER: Incomplete
LOGGER: Logger

class GeventConnection(BaseConnection):
def __init__(
Expand Down
3 changes: 2 additions & 1 deletion stubs/pika/pika/adapters/select_connection.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import abc
from _typeshed import Incomplete
from logging import Logger

import pika.compat
from pika.adapters.base_connection import BaseConnection
from pika.adapters.utils.selector_ioloop_adapter import AbstractSelectorIOLoop

LOGGER: Incomplete
LOGGER: Logger
SELECT_TYPE: Incomplete

class SelectConnection(BaseConnection):
Expand Down
3 changes: 2 additions & 1 deletion stubs/pika/pika/adapters/tornado_connection.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from _typeshed import Incomplete
from logging import Logger

from pika.adapters import base_connection

LOGGER: Incomplete
LOGGER: Logger

class TornadoConnection(base_connection.BaseConnection):
def __init__(
Expand Down
3 changes: 2 additions & 1 deletion stubs/pika/pika/adapters/twisted_connection.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# We don't want to force it as a dependency but that means we also can't test it with type-checkers given the current setup.

from _typeshed import Incomplete
from logging import Logger
from typing import Generic, NamedTuple, TypeVar

import pika.connection
Expand All @@ -17,7 +18,7 @@ from twisted.python.failure import Failure # type: ignore[import-not-found] #

_T = TypeVar("_T")

LOGGER: Incomplete
LOGGER: Logger

class ClosableDeferredQueue(DeferredQueue[_T], Generic[_T]): # pyright: ignore[reportUntypedBaseClass] # noqa: Y060
closed: Failure | BaseException | None
Expand Down
3 changes: 2 additions & 1 deletion stubs/pika/pika/adapters/utils/selector_ioloop_adapter.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import abc
from _typeshed import Incomplete
from logging import Logger

from pika.adapters.utils import io_services_utils, nbio_interface

LOGGER: Incomplete
LOGGER: Logger

class AbstractSelectorIOLoop(metaclass=abc.ABCMeta):
@property
Expand Down
35 changes: 23 additions & 12 deletions stubs/pika/pika/callback.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
from _typeshed import Incomplete
from collections.abc import Callable
from logging import Logger
from typing import Literal

LOGGER: Incomplete
from pika import amqp_object, frame

def name_or_value(value): ...
LOGGER: Logger

def name_or_value(value: amqp_object.AMQPObject | frame.Frame | int | str) -> str: ...
def sanitize_prefix(function): ...
def check_for_prefix_and_key(function): ...

Expand All @@ -16,16 +21,22 @@ class CallbackManager:
def __init__(self) -> None: ...
def add(
self,
prefix,
key,
callback,
prefix: str | int,
key: str | object,
callback: Callable[[Incomplete], Incomplete],
one_shot: bool = True,
only_caller: Incomplete | None = None,
only_caller: object | None = None,
arguments: Incomplete | None = None,
): ...
) -> tuple[str | int, str | object]: ...
def clear(self) -> None: ...
def cleanup(self, prefix): ...
def pending(self, prefix, key): ...
def process(self, prefix, key, caller, *args, **keywords): ...
def remove(self, prefix, key, callback_value: Incomplete | None = None, arguments: Incomplete | None = None): ...
def remove_all(self, prefix, key) -> None: ...
def cleanup(self, prefix: str | int) -> bool: ...
def pending(self, prefix: str | int, key: str | object) -> int | None: ...
def process(self, prefix: str | int, key: str | object, caller, *args, **keywords) -> bool: ...
def remove(
self,
prefix: str | int,
key: str | object,
callback_value: Callable[[Incomplete], Incomplete] | None = None,
arguments: Incomplete | None = None,
) -> Literal[True]: ...
def remove_all(self, prefix: str | int, key: str | object) -> None: ...
21 changes: 11 additions & 10 deletions stubs/pika/pika/connection.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import abc
import ssl
from _typeshed import Incomplete
from collections.abc import Callable
from logging import Logger
Expand All @@ -18,24 +19,24 @@ LOGGER: Logger
class Parameters:
DEFAULT_USERNAME: str
DEFAULT_PASSWORD: str
DEFAULT_BLOCKED_CONNECTION_TIMEOUT: Incomplete
DEFAULT_CHANNEL_MAX: Incomplete
DEFAULT_CLIENT_PROPERTIES: Incomplete
DEFAULT_BLOCKED_CONNECTION_TIMEOUT: None
DEFAULT_CHANNEL_MAX: int
DEFAULT_CLIENT_PROPERTIES: None
DEFAULT_CREDENTIALS: Incomplete
DEFAULT_CONNECTION_ATTEMPTS: int
DEFAULT_FRAME_MAX: Incomplete
DEFAULT_HEARTBEAT_TIMEOUT: Incomplete
DEFAULT_FRAME_MAX: int
DEFAULT_HEARTBEAT_TIMEOUT: None
DEFAULT_HOST: str
DEFAULT_LOCALE: str
DEFAULT_PORT: int
DEFAULT_RETRY_DELAY: float
DEFAULT_SOCKET_TIMEOUT: float
DEFAULT_STACK_TIMEOUT: float
DEFAULT_SSL: bool
DEFAULT_SSL_OPTIONS: Incomplete
DEFAULT_SSL_OPTIONS: None
DEFAULT_SSL_PORT: int
DEFAULT_VIRTUAL_HOST: str
DEFAULT_TCP_OPTIONS: Incomplete
DEFAULT_TCP_OPTIONS: None
def __init__(self) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
Expand Down Expand Up @@ -129,9 +130,9 @@ class URLParameters(Parameters):
def __init__(self, url: str) -> None: ...

class SSLOptions:
context: Incomplete
server_hostname: Incomplete
def __init__(self, context, server_hostname: Incomplete | None = None) -> None: ...
context: ssl.SSLContext
server_hostname: str | None
def __init__(self, context: ssl.SSLContext, server_hostname: str | None = None) -> None: ...

class Connection(AbstractBase, metaclass=abc.ABCMeta):
ON_CONNECTION_CLOSED: Final[str]
Expand Down
8 changes: 7 additions & 1 deletion stubs/pika/pika/diagnostic_utils.pyi
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
def create_log_exception_decorator(logger): ...
from collections.abc import Callable
from logging import Logger
from typing import Any, TypeVar

_F = TypeVar("_F", bound=Callable[..., Any])

def create_log_exception_decorator(logger: Logger) -> Callable[[_F], _F]: ...
24 changes: 13 additions & 11 deletions stubs/pika/pika/exceptions.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Sequence

from pika.adapters.blocking_connection import ReturnedMessage

class AMQPError(Exception): ...
class AMQPConnectionError(AMQPError): ...
Expand All @@ -12,11 +14,11 @@ class NoFreeChannels(AMQPConnectionError): ...
class ConnectionWrongStateError(AMQPConnectionError): ...

class ConnectionClosed(AMQPConnectionError):
def __init__(self, reply_code, reply_text) -> None: ...
def __init__(self, reply_code: int, reply_text: str) -> None: ...
@property
def reply_code(self): ...
def reply_code(self) -> int: ...
@property
def reply_text(self): ...
def reply_text(self) -> str: ...

class ConnectionClosedByBroker(ConnectionClosed): ...
class ConnectionClosedByClient(ConnectionClosed): ...
Expand All @@ -26,24 +28,24 @@ class AMQPChannelError(AMQPError): ...
class ChannelWrongStateError(AMQPChannelError): ...

class ChannelClosed(AMQPChannelError):
def __init__(self, reply_code, reply_text) -> None: ...
def __init__(self, reply_code: int, reply_text: str) -> None: ...
@property
def reply_code(self): ...
def reply_code(self) -> int: ...
@property
def reply_text(self): ...
def reply_text(self) -> str: ...

class ChannelClosedByBroker(ChannelClosed): ...
class ChannelClosedByClient(ChannelClosed): ...
class DuplicateConsumerTag(AMQPChannelError): ...
class ConsumerCancelled(AMQPChannelError): ...

class UnroutableError(AMQPChannelError):
messages: Incomplete
def __init__(self, messages) -> None: ...
messages: Sequence[ReturnedMessage]
def __init__(self, messages: Sequence[ReturnedMessage]) -> None: ...

class NackError(AMQPChannelError):
messages: Incomplete
def __init__(self, messages) -> None: ...
messages: Sequence[ReturnedMessage]
def __init__(self, messages: Sequence[ReturnedMessage]) -> None: ...

class InvalidChannelNumber(AMQPError): ...
class ProtocolSyntaxError(AMQPError): ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/pika/pika/heartbeat.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from _typeshed import Incomplete
from logging import Logger

LOGGER: Incomplete
LOGGER: Logger

class HeartbeatChecker:
def __init__(self, connection, timeout) -> None: ...
Expand Down
Loading