from typing import Any, TypeVar

from kombu.connection import Connection
from kombu.transport.base import StdChannel
from typing_extensions import Self, override

__all__ = ("MaybeChannelBound", "Object")

_T = TypeVar("_T")
_ObjectT = TypeVar("_ObjectT", bound=Object)

def _any(v: _T) -> _T: ...
def unpickle_dict(cls: type[_ObjectT], kwargs: dict[str, Any]) -> _ObjectT: ...

class Object:
    attrs: tuple[tuple[str, Any], ...]

    def __init__(self, *args: Any, **kwargs: Any) -> None: ...
    def __copy__(self) -> Self: ...
    @override
    def __reduce__(self) -> tuple[Any, ...]: ...
    def as_dict(self, recurse: bool = ...) -> dict[str, Any]: ...

class MaybeChannelBound(Object):
    @property
    def can_cache_declaration(self) -> bool: ...
    def __call__(self, channel: StdChannel | Connection) -> Self: ...
    def bind(self, channel: StdChannel | Connection) -> Self: ...
    def maybe_bind(self, channel: StdChannel | Connection) -> Self: ...
    def revive(self, channel: StdChannel) -> None: ...
    def when_bound(self) -> None: ...
    def _repr_entity(self, item: str = ...) -> str: ...
    @property
    def channel(self) -> StdChannel: ...
    @property
    def is_bound(self) -> bool: ...
