-
-
Notifications
You must be signed in to change notification settings - Fork 346
/
hazmat.py
59 lines (51 loc) · 1.69 KB
/
hazmat.py
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
"""
This namespace represents low-level functionality not intended for daily use,
but useful for extending Trio's functionality.
"""
import os
import sys
# This is the union of a subset of trio/_core/ and some things from trio/*.py.
# See comments in trio/__init__.py for details. To make static analysis easier,
# this lists all possible symbols from trio._core, and then we prune those that
# aren't available on this system. After that we add some symbols from trio/*.py.
# Generally available symbols
from ._core import (
cancel_shielded_checkpoint, Abort, wait_task_rescheduled,
enable_ki_protection, disable_ki_protection, currently_ki_protected, Task,
checkpoint, current_task, ParkingLot, UnboundedQueue, RunVar, TrioToken,
current_trio_token, temporarily_detach_coroutine_object,
permanently_detach_coroutine_object, reattach_detached_coroutine_object,
current_statistics, reschedule, remove_instrument, add_instrument,
current_clock, current_root_task, checkpoint_if_cancelled,
spawn_system_task, wait_readable, wait_writable, notify_closing
)
# Unix-specific symbols
try:
from ._unix_pipes import FdStream
except ImportError:
pass
# Kqueue-specific symbols
try:
from ._core import (
current_kqueue,
monitor_kevent,
wait_kevent,
)
except ImportError:
pass
# Windows symbols
try:
from ._core import (
current_iocp,
register_with_iocp,
wait_overlapped,
monitor_completion_key,
readinto_overlapped,
write_overlapped,
)
except ImportError:
pass
from . import _core
# Import bits from trio/*.py
if sys.platform.startswith("win"):
from ._wait_for_object import WaitForSingleObject