File: types.py

package info (click to toggle)
python-pykka 4.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 520 kB
  • sloc: python: 2,817; makefile: 113
file content (37 lines) | stat: -rw-r--r-- 784 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# noqa: A005

from __future__ import annotations

from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Callable, Optional, Protocol

if TYPE_CHECKING:
    from pykka import Actor, Future


class Event(Protocol):
    def clear(self) -> None: ...

    def is_set(self) -> bool: ...

    def set(self) -> None: ...

    def wait(self, timeout: Optional[float] = None) -> bool: ...


@dataclass
class Events:
    on_start_was_called: Event
    on_stop_was_called: Event
    on_failure_was_called: Event
    greetings_was_received: Event
    actor_registered_before_on_start_was_called: Event


@dataclass
class Runtime:
    name: str
    actor_class: type[Actor]
    event_class: type[Event]
    future_class: type[Future[Any]]
    sleep_func: Callable[[float], None]