ez-a-sync 0.32.29__cp310-cp310-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ez-a-sync might be problematic. Click here for more details.
- a_sync/ENVIRONMENT_VARIABLES.py +42 -0
- a_sync/__init__.pxd +2 -0
- a_sync/__init__.py +145 -0
- a_sync/_smart.c +22803 -0
- a_sync/_smart.cp310-win_amd64.pyd +0 -0
- a_sync/_smart.pxd +2 -0
- a_sync/_smart.pyi +202 -0
- a_sync/_smart.pyx +674 -0
- a_sync/_typing.py +258 -0
- a_sync/a_sync/__init__.py +60 -0
- a_sync/a_sync/_descriptor.c +20528 -0
- a_sync/a_sync/_descriptor.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/_descriptor.pyi +33 -0
- a_sync/a_sync/_descriptor.pyx +422 -0
- a_sync/a_sync/_flags.c +6074 -0
- a_sync/a_sync/_flags.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/_flags.pxd +3 -0
- a_sync/a_sync/_flags.pyx +92 -0
- a_sync/a_sync/_helpers.c +14521 -0
- a_sync/a_sync/_helpers.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/_helpers.pxd +3 -0
- a_sync/a_sync/_helpers.pyi +10 -0
- a_sync/a_sync/_helpers.pyx +167 -0
- a_sync/a_sync/_kwargs.c +12194 -0
- a_sync/a_sync/_kwargs.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/_kwargs.pxd +2 -0
- a_sync/a_sync/_kwargs.pyx +64 -0
- a_sync/a_sync/_meta.py +210 -0
- a_sync/a_sync/abstract.c +12411 -0
- a_sync/a_sync/abstract.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/abstract.pyi +141 -0
- a_sync/a_sync/abstract.pyx +221 -0
- a_sync/a_sync/base.c +14932 -0
- a_sync/a_sync/base.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/base.pyi +60 -0
- a_sync/a_sync/base.pyx +271 -0
- a_sync/a_sync/config.py +168 -0
- a_sync/a_sync/decorator.py +651 -0
- a_sync/a_sync/flags.c +5272 -0
- a_sync/a_sync/flags.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/flags.pxd +72 -0
- a_sync/a_sync/flags.pyi +74 -0
- a_sync/a_sync/flags.pyx +72 -0
- a_sync/a_sync/function.c +37846 -0
- a_sync/a_sync/function.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/function.pxd +28 -0
- a_sync/a_sync/function.pyi +571 -0
- a_sync/a_sync/function.pyx +1381 -0
- a_sync/a_sync/method.c +29774 -0
- a_sync/a_sync/method.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/method.pxd +9 -0
- a_sync/a_sync/method.pyi +525 -0
- a_sync/a_sync/method.pyx +1023 -0
- a_sync/a_sync/modifiers/__init__.pxd +1 -0
- a_sync/a_sync/modifiers/__init__.py +101 -0
- a_sync/a_sync/modifiers/cache/__init__.py +160 -0
- a_sync/a_sync/modifiers/cache/memory.py +165 -0
- a_sync/a_sync/modifiers/limiter.py +132 -0
- a_sync/a_sync/modifiers/manager.c +16149 -0
- a_sync/a_sync/modifiers/manager.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/modifiers/manager.pxd +5 -0
- a_sync/a_sync/modifiers/manager.pyi +219 -0
- a_sync/a_sync/modifiers/manager.pyx +299 -0
- a_sync/a_sync/modifiers/semaphores.py +173 -0
- a_sync/a_sync/property.c +27260 -0
- a_sync/a_sync/property.cp310-win_amd64.pyd +0 -0
- a_sync/a_sync/property.pyi +376 -0
- a_sync/a_sync/property.pyx +819 -0
- a_sync/a_sync/singleton.py +63 -0
- a_sync/aliases.py +3 -0
- a_sync/async_property/__init__.pxd +1 -0
- a_sync/async_property/__init__.py +1 -0
- a_sync/async_property/cached.c +20386 -0
- a_sync/async_property/cached.cp310-win_amd64.pyd +0 -0
- a_sync/async_property/cached.pxd +10 -0
- a_sync/async_property/cached.pyi +45 -0
- a_sync/async_property/cached.pyx +178 -0
- a_sync/async_property/proxy.c +34654 -0
- a_sync/async_property/proxy.cp310-win_amd64.pyd +0 -0
- a_sync/async_property/proxy.pxd +2 -0
- a_sync/async_property/proxy.pyi +124 -0
- a_sync/async_property/proxy.pyx +474 -0
- a_sync/asyncio/__init__.pxd +6 -0
- a_sync/asyncio/__init__.py +164 -0
- a_sync/asyncio/as_completed.c +18841 -0
- a_sync/asyncio/as_completed.cp310-win_amd64.pyd +0 -0
- a_sync/asyncio/as_completed.pxd +8 -0
- a_sync/asyncio/as_completed.pyi +109 -0
- a_sync/asyncio/as_completed.pyx +269 -0
- a_sync/asyncio/create_task.c +15902 -0
- a_sync/asyncio/create_task.cp310-win_amd64.pyd +0 -0
- a_sync/asyncio/create_task.pxd +2 -0
- a_sync/asyncio/create_task.pyi +51 -0
- a_sync/asyncio/create_task.pyx +271 -0
- a_sync/asyncio/gather.c +16679 -0
- a_sync/asyncio/gather.cp310-win_amd64.pyd +0 -0
- a_sync/asyncio/gather.pyi +107 -0
- a_sync/asyncio/gather.pyx +218 -0
- a_sync/asyncio/igather.c +12676 -0
- a_sync/asyncio/igather.cp310-win_amd64.pyd +0 -0
- a_sync/asyncio/igather.pxd +1 -0
- a_sync/asyncio/igather.pyi +7 -0
- a_sync/asyncio/igather.pyx +182 -0
- a_sync/asyncio/sleep.c +9593 -0
- a_sync/asyncio/sleep.cp310-win_amd64.pyd +0 -0
- a_sync/asyncio/sleep.pyi +14 -0
- a_sync/asyncio/sleep.pyx +49 -0
- a_sync/debugging.c +15362 -0
- a_sync/debugging.cp310-win_amd64.pyd +0 -0
- a_sync/debugging.pyi +76 -0
- a_sync/debugging.pyx +107 -0
- a_sync/exceptions.c +13312 -0
- a_sync/exceptions.cp310-win_amd64.pyd +0 -0
- a_sync/exceptions.pyi +376 -0
- a_sync/exceptions.pyx +446 -0
- a_sync/executor.py +619 -0
- a_sync/functools.c +12738 -0
- a_sync/functools.cp310-win_amd64.pyd +0 -0
- a_sync/functools.pxd +7 -0
- a_sync/functools.pyi +33 -0
- a_sync/functools.pyx +139 -0
- a_sync/future.py +1497 -0
- a_sync/iter.c +37271 -0
- a_sync/iter.cp310-win_amd64.pyd +0 -0
- a_sync/iter.pxd +11 -0
- a_sync/iter.pyi +370 -0
- a_sync/iter.pyx +981 -0
- a_sync/primitives/__init__.pxd +1 -0
- a_sync/primitives/__init__.py +53 -0
- a_sync/primitives/_debug.c +15757 -0
- a_sync/primitives/_debug.cp310-win_amd64.pyd +0 -0
- a_sync/primitives/_debug.pxd +12 -0
- a_sync/primitives/_debug.pyi +52 -0
- a_sync/primitives/_debug.pyx +223 -0
- a_sync/primitives/_loggable.c +11529 -0
- a_sync/primitives/_loggable.cp310-win_amd64.pyd +0 -0
- a_sync/primitives/_loggable.pxd +4 -0
- a_sync/primitives/_loggable.pyi +66 -0
- a_sync/primitives/_loggable.pyx +102 -0
- a_sync/primitives/locks/__init__.pxd +8 -0
- a_sync/primitives/locks/__init__.py +17 -0
- a_sync/primitives/locks/counter.c +17679 -0
- a_sync/primitives/locks/counter.cp310-win_amd64.pyd +0 -0
- a_sync/primitives/locks/counter.pxd +12 -0
- a_sync/primitives/locks/counter.pyi +151 -0
- a_sync/primitives/locks/counter.pyx +260 -0
- a_sync/primitives/locks/event.c +17063 -0
- a_sync/primitives/locks/event.cp310-win_amd64.pyd +0 -0
- a_sync/primitives/locks/event.pxd +22 -0
- a_sync/primitives/locks/event.pyi +43 -0
- a_sync/primitives/locks/event.pyx +185 -0
- a_sync/primitives/locks/prio_semaphore.c +25590 -0
- a_sync/primitives/locks/prio_semaphore.cp310-win_amd64.pyd +0 -0
- a_sync/primitives/locks/prio_semaphore.pxd +25 -0
- a_sync/primitives/locks/prio_semaphore.pyi +217 -0
- a_sync/primitives/locks/prio_semaphore.pyx +597 -0
- a_sync/primitives/locks/semaphore.c +26509 -0
- a_sync/primitives/locks/semaphore.cp310-win_amd64.pyd +0 -0
- a_sync/primitives/locks/semaphore.pxd +21 -0
- a_sync/primitives/locks/semaphore.pyi +197 -0
- a_sync/primitives/locks/semaphore.pyx +454 -0
- a_sync/primitives/queue.py +1022 -0
- a_sync/py.typed +0 -0
- a_sync/sphinx/__init__.py +3 -0
- a_sync/sphinx/ext.py +289 -0
- a_sync/task.py +932 -0
- a_sync/utils/__init__.py +105 -0
- a_sync/utils/iterators.py +297 -0
- a_sync/utils/repr.c +15799 -0
- a_sync/utils/repr.cp310-win_amd64.pyd +0 -0
- a_sync/utils/repr.pyi +2 -0
- a_sync/utils/repr.pyx +73 -0
- ez_a_sync-0.32.29.dist-info/METADATA +367 -0
- ez_a_sync-0.32.29.dist-info/RECORD +177 -0
- ez_a_sync-0.32.29.dist-info/WHEEL +5 -0
- ez_a_sync-0.32.29.dist-info/licenses/LICENSE.txt +17 -0
- ez_a_sync-0.32.29.dist-info/top_level.txt +1 -0
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from a_sync.primitives._loggable cimport _LoggerMixin
|
|
2
|
+
|
|
3
|
+
cdef class _LoopBoundMixin(_LoggerMixin):
|
|
4
|
+
cdef object __loop
|
|
5
|
+
cpdef object _get_loop(self)
|
|
6
|
+
cdef object _c_get_loop(self)
|
|
7
|
+
|
|
8
|
+
cdef class _DebugDaemonMixin(_LoopBoundMixin):
|
|
9
|
+
cdef object _daemon
|
|
10
|
+
cdef bint _has_daemon
|
|
11
|
+
cdef void _c_ensure_debug_daemon(self, tuple[object] args, dict[str, object] kwargs)
|
|
12
|
+
cdef object _c_start_debug_daemon(self, tuple[object] args, dict[str, object] kwargs)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides a mixin class used to facilitate the creation of debugging daemons in subclasses.
|
|
3
|
+
|
|
4
|
+
The mixin provides a framework for managing a debug daemon task, which can be used to emit rich debug logs from subclass instances whenever debug logging is enabled. Subclasses must implement the specific logging behavior.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from asyncio import AbstractEventLoop, Future
|
|
8
|
+
|
|
9
|
+
from a_sync.primitives._loggable import _LoggerMixin
|
|
10
|
+
|
|
11
|
+
class _LoopBoundMixin(_LoggerMixin):
|
|
12
|
+
def __init__(self, *, loop=None): ...
|
|
13
|
+
@property
|
|
14
|
+
def _loop(self) -> AbstractEventLoop: ...
|
|
15
|
+
def _get_loop(self) -> AbstractEventLoop: ...
|
|
16
|
+
|
|
17
|
+
class _DebugDaemonMixin(_LoopBoundMixin):
|
|
18
|
+
"""
|
|
19
|
+
A mixin class that provides a framework for debugging capabilities using a daemon task.
|
|
20
|
+
|
|
21
|
+
This mixin sets up the structure for managing a debug daemon task. Subclasses are responsible for implementing the specific behavior of the daemon, including any logging functionality.
|
|
22
|
+
|
|
23
|
+
See Also:
|
|
24
|
+
:class:`_LoggerMixin` for logging capabilities.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
async def _debug_daemon(self, fut: Future, fn, *args, **kwargs) -> None:
|
|
28
|
+
"""
|
|
29
|
+
Abstract method to define the debug daemon's behavior.
|
|
30
|
+
|
|
31
|
+
Subclasses must implement this method to specify what the debug daemon should do, including any logging or monitoring tasks.
|
|
32
|
+
|
|
33
|
+
This code will only run if `self.logger.isEnabledFor(logging.DEBUG)` is True. You do not need to include any level checks in your custom implementations.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
fut: The future associated with the daemon.
|
|
37
|
+
fn: The function to be debugged.
|
|
38
|
+
*args: Positional arguments for the function.
|
|
39
|
+
**kwargs: Keyword arguments for the function.
|
|
40
|
+
|
|
41
|
+
Examples:
|
|
42
|
+
Implementing a simple debug daemon in a subclass:
|
|
43
|
+
|
|
44
|
+
.. code-block:: python
|
|
45
|
+
|
|
46
|
+
class MyDebugClass(_DebugDaemonMixin):
|
|
47
|
+
async def _debug_daemon(self, fut, fn, *args, **kwargs):
|
|
48
|
+
while not fut.done():
|
|
49
|
+
self.logger.debug("Debugging...")
|
|
50
|
+
await asyncio.sleep(1)
|
|
51
|
+
"""
|
|
52
|
+
raise NotImplementedError
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides a mixin class used to facilitate the creation of debugging daemons in subclasses.
|
|
3
|
+
|
|
4
|
+
The mixin provides a framework for managing a debug daemon task, which can be used to emit rich debug logs from subclass instances whenever debug logging is enabled. Subclasses must implement the specific logging behavior.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import asyncio
|
|
8
|
+
import os
|
|
9
|
+
import threading
|
|
10
|
+
import typing
|
|
11
|
+
|
|
12
|
+
from a_sync.a_sync._helpers cimport get_event_loop
|
|
13
|
+
from a_sync.asyncio.create_task cimport ccreate_task_simple
|
|
14
|
+
from a_sync.primitives._loggable cimport _LoggerMixin
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# cdef asyncio
|
|
18
|
+
cdef object AbstractEventLoop = asyncio.AbstractEventLoop
|
|
19
|
+
cdef object Future = asyncio.Future
|
|
20
|
+
cdef object Task = asyncio.Task
|
|
21
|
+
cdef object _running_loop = asyncio.events._running_loop
|
|
22
|
+
del asyncio
|
|
23
|
+
|
|
24
|
+
# cdef os
|
|
25
|
+
cdef object getpid = os.getpid
|
|
26
|
+
del os
|
|
27
|
+
|
|
28
|
+
# cdef typing
|
|
29
|
+
cdef object Optional = typing.Optional
|
|
30
|
+
del typing
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
cdef public object _global_lock = threading.Lock()
|
|
34
|
+
del threading
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
cdef object _get_running_loop():
|
|
38
|
+
"""Return the running event loop or None.
|
|
39
|
+
|
|
40
|
+
This is a low-level function intended to be used by event loops.
|
|
41
|
+
This function is thread-specific.
|
|
42
|
+
"""
|
|
43
|
+
cdef object running_loop, pid
|
|
44
|
+
running_loop, pid = _running_loop.loop_pid
|
|
45
|
+
if running_loop is not None and <int>pid == <int>getpid():
|
|
46
|
+
return running_loop
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
cdef class _LoopBoundMixin(_LoggerMixin):
|
|
50
|
+
def __cinit__(self):
|
|
51
|
+
self._LoopBoundMixin__loop = None
|
|
52
|
+
def __init__(self, *, loop=None):
|
|
53
|
+
if loop is not None:
|
|
54
|
+
raise TypeError(
|
|
55
|
+
'The loop parameter is not supported. '
|
|
56
|
+
'As of 3.10, the *loop* parameter was removed'
|
|
57
|
+
'{}() since it is no longer necessary.'.format(type(self).__name__)
|
|
58
|
+
)
|
|
59
|
+
@property
|
|
60
|
+
def _loop(self) -> AbstractEventLoop:
|
|
61
|
+
return self._LoopBoundMixin__loop
|
|
62
|
+
@_loop.setter
|
|
63
|
+
def _loop(self, loop: AbstractEventLoop):
|
|
64
|
+
self._LoopBoundMixin__loop = loop
|
|
65
|
+
cpdef object _get_loop(self):
|
|
66
|
+
return self._c_get_loop()
|
|
67
|
+
cdef object _c_get_loop(self):
|
|
68
|
+
cdef object loop = _get_running_loop()
|
|
69
|
+
if self._LoopBoundMixin__loop is None:
|
|
70
|
+
with _global_lock:
|
|
71
|
+
if self._LoopBoundMixin__loop is None:
|
|
72
|
+
self._LoopBoundMixin__loop = loop
|
|
73
|
+
if loop is None:
|
|
74
|
+
return get_event_loop()
|
|
75
|
+
elif loop is not self._LoopBoundMixin__loop:
|
|
76
|
+
raise RuntimeError(
|
|
77
|
+
f'{self!r} is bound to a different event loop',
|
|
78
|
+
"running loop: ".format(loop),
|
|
79
|
+
"bound to: ".format(self._LoopBoundMixin__loop),
|
|
80
|
+
)
|
|
81
|
+
return loop
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
cdef class _DebugDaemonMixin(_LoopBoundMixin):
|
|
85
|
+
"""
|
|
86
|
+
A mixin class that provides a framework for debugging capabilities using a daemon task.
|
|
87
|
+
|
|
88
|
+
This mixin sets up the structure for managing a debug daemon task. Subclasses are responsible for implementing the specific behavior of the daemon, including any logging functionality.
|
|
89
|
+
|
|
90
|
+
See Also:
|
|
91
|
+
:class:`_LoggerMixin` for logging capabilities.
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
def __cinit__(self):
|
|
95
|
+
self._has_daemon = False
|
|
96
|
+
self._LoopBoundMixin__loop = None
|
|
97
|
+
|
|
98
|
+
async def _debug_daemon(self, fut: Future, fn, *args, **kwargs) -> None:
|
|
99
|
+
"""
|
|
100
|
+
Abstract method to define the debug daemon's behavior.
|
|
101
|
+
|
|
102
|
+
Subclasses must implement this method to specify what the debug daemon should do, including any logging or monitoring tasks.
|
|
103
|
+
|
|
104
|
+
This code will only run if `self.logger.isEnabledFor(logging.DEBUG)` is True. You do not need to include any level checks in your custom implementations.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
fut: The future associated with the daemon.
|
|
108
|
+
fn: The function to be debugged.
|
|
109
|
+
*args: Positional arguments for the function.
|
|
110
|
+
**kwargs: Keyword arguments for the function.
|
|
111
|
+
|
|
112
|
+
Examples:
|
|
113
|
+
Implementing a simple debug daemon in a subclass:
|
|
114
|
+
|
|
115
|
+
.. code-block:: python
|
|
116
|
+
|
|
117
|
+
class MyDebugClass(_DebugDaemonMixin):
|
|
118
|
+
async def _debug_daemon(self, fut, fn, *args, **kwargs):
|
|
119
|
+
while not fut.done():
|
|
120
|
+
self.logger.debug("Debugging...")
|
|
121
|
+
await asyncio.sleep(1)
|
|
122
|
+
"""
|
|
123
|
+
raise NotImplementedError
|
|
124
|
+
|
|
125
|
+
def _start_debug_daemon(self, *args, **kwargs) -> "Future[None]":
|
|
126
|
+
"""
|
|
127
|
+
Starts the debug daemon task if debug logging is enabled and the event loop is running.
|
|
128
|
+
|
|
129
|
+
This method checks if debug logging is enabled and if the event loop is running. If both conditions are met, it starts the debug daemon task.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
*args: Positional arguments for the debug daemon.
|
|
133
|
+
**kwargs: Keyword arguments for the debug daemon.
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
The debug daemon task as an asyncio.Task, or a dummy future if debug logs are not enabled or if the daemon cannot be created.
|
|
137
|
+
|
|
138
|
+
Examples:
|
|
139
|
+
Starting the debug daemon:
|
|
140
|
+
|
|
141
|
+
.. code-block:: python
|
|
142
|
+
|
|
143
|
+
my_instance = MyDebugClass()
|
|
144
|
+
my_instance._start_debug_daemon()
|
|
145
|
+
|
|
146
|
+
See Also:
|
|
147
|
+
:meth:`_ensure_debug_daemon` for ensuring the daemon is running.
|
|
148
|
+
"""
|
|
149
|
+
return self._c_start_debug_daemon(args, kwargs)
|
|
150
|
+
|
|
151
|
+
cdef object _c_start_debug_daemon(self, tuple[object] args, dict[str, object] kwargs):
|
|
152
|
+
cdef object loop = self._c_get_loop()
|
|
153
|
+
if self.check_debug_logs_enabled() and loop.is_running():
|
|
154
|
+
return ccreate_task_simple(self._debug_daemon(*args, **kwargs))
|
|
155
|
+
return loop.create_future()
|
|
156
|
+
|
|
157
|
+
def _ensure_debug_daemon(self, *args, **kwargs) -> None:
|
|
158
|
+
"""
|
|
159
|
+
Ensures that the debug daemon task is running.
|
|
160
|
+
|
|
161
|
+
This method checks if the debug daemon is already running and starts it if necessary. If debug logging is not enabled, it sets the daemon to a dummy future.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
*args: Positional arguments for the debug daemon.
|
|
165
|
+
**kwargs: Keyword arguments for the debug daemon.
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
Either the debug daemon task or a dummy future if debug logging is not enabled.
|
|
169
|
+
|
|
170
|
+
Examples:
|
|
171
|
+
Ensuring the debug daemon is running:
|
|
172
|
+
|
|
173
|
+
.. code-block:: python
|
|
174
|
+
|
|
175
|
+
my_instance = MyDebugClass()
|
|
176
|
+
my_instance._ensure_debug_daemon()
|
|
177
|
+
|
|
178
|
+
See Also:
|
|
179
|
+
:meth:`_start_debug_daemon` for starting the daemon.
|
|
180
|
+
"""
|
|
181
|
+
self._c_ensure_debug_daemon(args, kwargs)
|
|
182
|
+
|
|
183
|
+
cdef void _c_ensure_debug_daemon(self, tuple[object] args, dict[str, object] kwargs):
|
|
184
|
+
if self._has_daemon:
|
|
185
|
+
return
|
|
186
|
+
|
|
187
|
+
if self.check_debug_logs_enabled():
|
|
188
|
+
daemon = self._c_start_debug_daemon(args, kwargs)
|
|
189
|
+
daemon.add_done_callback(self._stop_debug_daemon)
|
|
190
|
+
self._daemon = daemon
|
|
191
|
+
else:
|
|
192
|
+
self._daemon = self._c_get_loop().create_future()
|
|
193
|
+
|
|
194
|
+
self._has_daemon = True
|
|
195
|
+
|
|
196
|
+
def _stop_debug_daemon(self, t: Optional[Task] = None) -> None:
|
|
197
|
+
"""
|
|
198
|
+
Stops the debug daemon task.
|
|
199
|
+
|
|
200
|
+
This method cancels the debug daemon task if it is running. Raises a ValueError if the task to be stopped is not the current daemon.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
t (optional): The task to be stopped, if any.
|
|
204
|
+
|
|
205
|
+
Raises:
|
|
206
|
+
ValueError: If `t` is not the current daemon.
|
|
207
|
+
|
|
208
|
+
Examples:
|
|
209
|
+
Stopping the debug daemon:
|
|
210
|
+
|
|
211
|
+
.. code-block:: python
|
|
212
|
+
|
|
213
|
+
my_instance = MyDebugClass()
|
|
214
|
+
my_instance._stop_debug_daemon()
|
|
215
|
+
|
|
216
|
+
See Also:
|
|
217
|
+
:meth:`_ensure_debug_daemon` for ensuring the daemon is running.
|
|
218
|
+
"""
|
|
219
|
+
if t and t != self._daemon:
|
|
220
|
+
raise ValueError(f"{t} is not {self._daemon}")
|
|
221
|
+
t.cancel()
|
|
222
|
+
self._daemon = None
|
|
223
|
+
self._has_daemon = False
|