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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
| """
| This namespace represents the core functionality that has to be built-in
| and deal with private internal data structures. Things in this namespace
| are publicly available in either trio, trio.lowlevel, or trio.testing.
| """
|
| import sys
|
| from ._exceptions import (
| TrioInternalError,
| RunFinishedError,
| WouldBlock,
| Cancelled,
| BusyResourceError,
| ClosedResourceError,
| BrokenResourceError,
| EndOfChannel,
| )
|
| from ._ki import (
| enable_ki_protection,
| disable_ki_protection,
| currently_ki_protected,
| )
|
| # Imports that always exist
| from ._run import (
| Task,
| CancelScope,
| run,
| open_nursery,
| checkpoint,
| current_task,
| current_effective_deadline,
| checkpoint_if_cancelled,
| TASK_STATUS_IGNORED,
| current_statistics,
| current_trio_token,
| reschedule,
| remove_instrument,
| add_instrument,
| current_clock,
| current_root_task,
| spawn_system_task,
| current_time,
| wait_all_tasks_blocked,
| wait_readable,
| wait_writable,
| notify_closing,
| Nursery,
| start_guest_run,
| )
|
| # Has to come after _run to resolve a circular import
| from ._traps import (
| cancel_shielded_checkpoint,
| Abort,
| wait_task_rescheduled,
| temporarily_detach_coroutine_object,
| permanently_detach_coroutine_object,
| reattach_detached_coroutine_object,
| )
|
| from ._entry_queue import TrioToken
|
| from ._parking_lot import ParkingLot
|
| from ._unbounded_queue import UnboundedQueue
|
| from ._local import RunVar
|
| from ._thread_cache import start_thread_soon
|
| from ._mock_clock import MockClock
|
| # Windows imports
| if sys.platform == "win32":
| from ._run import (
| monitor_completion_key,
| current_iocp,
| register_with_iocp,
| wait_overlapped,
| write_overlapped,
| readinto_overlapped,
| )
| # Kqueue imports
| elif sys.platform != "linux" and sys.platform != "win32":
| from ._run import current_kqueue, monitor_kevent, wait_kevent
|
| del sys # It would be better to import sys as _sys, but mypy does not understand it
|
|