from typing import Any

from kombu.exceptions import LimitExceeded

class Resource:
    LimitExceeded: type[LimitExceeded]
    close_after_fork: bool

    def __init__(
        self,
        limit: int | None = ...,
        preload: int | None = ...,
        close_after_fork: bool | None = ...,
    ) -> None: ...
    def setup(self) -> None: ...
    def acquire(self, block: bool = ..., timeout: float | None = ...) -> Any: ...
    def prepare(self, resource: Any) -> Any: ...
    def close_resource(self, resource: Any) -> None: ...
    def release_resource(self, resource: Any) -> None: ...
    def release(self, resource: Any) -> None: ...
    def collect_resource(self, resource: Any) -> None: ...
    def replace(self, resource: Any) -> None: ...
    def force_close_all(self, close_pool: bool = ...) -> None: ...
    def resize(
        self,
        limit: int,
        force: bool = ...,
        ignore_errors: bool = ...,
        reset: bool = ...,
    ) -> None: ...
    @property
    def limit(self) -> int | None: ...
