# -*- coding: utf-8 -*-

from typing import Any, Callable, Generator, Iterable, Optional, Union


AnyCallable = Union[Callable[..., Any], Callable[..., None]]


class EventsException(Exception):
    pass


class Events:
    def __init__(self, events: Optional[Iterable[str]] = None) -> None: ...

    def __getattr__(self, name: str) -> Any: ...

    def __repr__(self) -> str: ...

    __str__ = __repr__

    def __len__(self) -> int: ...

    def __iter__(self) -> Generator["_EventSlot", None, None]: ...


class _EventSlot:
    def __init__(self, name: str) -> None: ...

    def __repr__(self) -> str: ...

    def __call__(self, *a: Any, **kw: Any) -> None: ...

    def __iadd__(self, f: AnyCallable) -> "_EventSlot": ...

    def __isub__(self, f: Optional[AnyCallable]) -> "_EventSlot": ...

    def __len__(self) -> int: ...

    def __iter__(self) -> Generator[AnyCallable, None, None]: ...

    def __getitem__(self, key: str) -> AnyCallable: ...
