ez-a-sync 0.32.29__cp310-cp310-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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-win32.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,376 @@
|
|
|
1
|
+
from a_sync._typing import *
|
|
2
|
+
import async_property as ap
|
|
3
|
+
from _typeshed import Incomplete
|
|
4
|
+
from a_sync import exceptions as exceptions
|
|
5
|
+
from a_sync.a_sync import config as config
|
|
6
|
+
from a_sync.a_sync._descriptor import ASyncDescriptor as ASyncDescriptor
|
|
7
|
+
from a_sync.a_sync.function import (
|
|
8
|
+
ASyncFunction as ASyncFunction,
|
|
9
|
+
ASyncFunctionAsyncDefault as ASyncFunctionAsyncDefault,
|
|
10
|
+
ASyncFunctionSyncDefault as ASyncFunctionSyncDefault,
|
|
11
|
+
)
|
|
12
|
+
from a_sync.a_sync.method import (
|
|
13
|
+
ASyncBoundMethodAsyncDefault as ASyncBoundMethodAsyncDefault,
|
|
14
|
+
ASyncMethodDescriptorAsyncDefault as ASyncMethodDescriptorAsyncDefault,
|
|
15
|
+
)
|
|
16
|
+
from a_sync.task import TaskMapping as TaskMapping
|
|
17
|
+
from collections.abc import Generator
|
|
18
|
+
from typing import Any, final
|
|
19
|
+
from typing_extensions import Unpack
|
|
20
|
+
|
|
21
|
+
logger: Incomplete
|
|
22
|
+
|
|
23
|
+
class _ASyncPropertyDescriptorBase(ASyncDescriptor[I, Tuple[()], T]):
|
|
24
|
+
"""Base class for creating asynchronous properties.
|
|
25
|
+
|
|
26
|
+
This class provides the foundation for defining properties that can be accessed
|
|
27
|
+
both synchronously and asynchronously. It includes utility methods for common
|
|
28
|
+
operations such as `any`, `all`, `min`, `max`, and `sum`.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
any: ASyncFunction[AnyIterable[I], bool]
|
|
32
|
+
all: ASyncFunction[AnyIterable[I], bool]
|
|
33
|
+
min: ASyncFunction[AnyIterable[I], T]
|
|
34
|
+
max: ASyncFunction[AnyIterable[I], T]
|
|
35
|
+
sum: ASyncFunction[AnyIterable[I], T]
|
|
36
|
+
hidden_method_descriptor: HiddenMethodDescriptor[T]
|
|
37
|
+
__wrapped__: Callable[[I], T]
|
|
38
|
+
hidden_method_name: Incomplete
|
|
39
|
+
def __init__(
|
|
40
|
+
self,
|
|
41
|
+
_fget: AsyncGetterFunction[I, T],
|
|
42
|
+
field_name: Optional[str] = None,
|
|
43
|
+
**modifiers: Unpack[ModifierKwargs]
|
|
44
|
+
) -> None:
|
|
45
|
+
"""Initializes the _ASyncPropertyDescriptorBase.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
_fget: The function to be wrapped.
|
|
49
|
+
field_name: Optional name for the field. If not provided, the function's name will be used.
|
|
50
|
+
**modifiers: Additional modifier arguments.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
@overload
|
|
54
|
+
def __get__(self, instance: None, owner: Type[I]) -> Self: ...
|
|
55
|
+
@overload
|
|
56
|
+
def __get__(self, instance: I, owner: Type[I]) -> Awaitable[T]: ...
|
|
57
|
+
async def get(self, instance: I, owner: Optional[Type[I]] = None) -> T:
|
|
58
|
+
"""Asynchronously retrieves the property value.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
instance: The instance from which the property is accessed.
|
|
62
|
+
owner: The owner class of the property.
|
|
63
|
+
|
|
64
|
+
Returns:
|
|
65
|
+
The property value.
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
def map(
|
|
69
|
+
self,
|
|
70
|
+
instances: AnyIterable[I],
|
|
71
|
+
owner: Optional[Type[I]] = None,
|
|
72
|
+
concurrency: Optional[int] = None,
|
|
73
|
+
name: str = "",
|
|
74
|
+
) -> TaskMapping[I, T]:
|
|
75
|
+
"""Maps the property across multiple instances.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
instances: An iterable of instances.
|
|
79
|
+
owner: The owner class of the property.
|
|
80
|
+
concurrency: Optional concurrency limit.
|
|
81
|
+
name: Optional name for the task mapping.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
A TaskMapping object.
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
class ASyncPropertyDescriptor(_ASyncPropertyDescriptorBase[I, T], ap.base.AsyncPropertyDescriptor):
|
|
88
|
+
"""Descriptor class for asynchronous properties."""
|
|
89
|
+
|
|
90
|
+
@final
|
|
91
|
+
class ASyncPropertyDescriptorSyncDefault(ASyncPropertyDescriptor[I, T]):
|
|
92
|
+
"""
|
|
93
|
+
A variant of :class:`~ASyncPropertyDescriptor` that defaults to synchronous behavior.
|
|
94
|
+
|
|
95
|
+
This class is used when the property is primarily intended to be accessed
|
|
96
|
+
synchronously but can also be used asynchronously if needed.
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
default: str
|
|
100
|
+
any: ASyncFunctionSyncDefault[AnyIterable[I], bool]
|
|
101
|
+
all: ASyncFunctionSyncDefault[AnyIterable[I], bool]
|
|
102
|
+
min: ASyncFunctionSyncDefault[AnyIterable[I], T]
|
|
103
|
+
max: ASyncFunctionSyncDefault[AnyIterable[I], T]
|
|
104
|
+
sum: ASyncFunctionSyncDefault[AnyIterable[I], T]
|
|
105
|
+
@overload
|
|
106
|
+
def __get__(self, instance: None, owner: Type[I]) -> Self: ...
|
|
107
|
+
@overload
|
|
108
|
+
def __get__(self, instance: I, owner: Type[I]) -> T: ...
|
|
109
|
+
__get__: Incomplete
|
|
110
|
+
|
|
111
|
+
@final
|
|
112
|
+
class ASyncPropertyDescriptorAsyncDefault(ASyncPropertyDescriptor[I, T]):
|
|
113
|
+
"""
|
|
114
|
+
A variant of :class:`~ASyncPropertyDescriptor` that defaults to asynchronous behavior.
|
|
115
|
+
|
|
116
|
+
This class is used when the property is primarily intended to be accessed
|
|
117
|
+
asynchronously but can also be used synchronously if needed.
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
default: str
|
|
121
|
+
any: ASyncFunctionAsyncDefault[AnyIterable[I], bool]
|
|
122
|
+
all: ASyncFunctionAsyncDefault[AnyIterable[I], bool]
|
|
123
|
+
min: ASyncFunctionAsyncDefault[AnyIterable[I], T]
|
|
124
|
+
max: ASyncFunctionAsyncDefault[AnyIterable[I], T]
|
|
125
|
+
sum: ASyncFunctionAsyncDefault[AnyIterable[I], T]
|
|
126
|
+
|
|
127
|
+
ASyncPropertyDecorator = Callable[[AnyGetterFunction[I, T]], ASyncPropertyDescriptor[I, T]]
|
|
128
|
+
ASyncPropertyDecoratorSyncDefault = Callable[
|
|
129
|
+
[AnyGetterFunction[I, T]], ASyncPropertyDescriptorSyncDefault[I, T]
|
|
130
|
+
]
|
|
131
|
+
ASyncPropertyDecoratorAsyncDefault = Callable[
|
|
132
|
+
[AnyGetterFunction[I, T]], ASyncPropertyDescriptorAsyncDefault[I, T]
|
|
133
|
+
]
|
|
134
|
+
|
|
135
|
+
@overload
|
|
136
|
+
def a_sync_property(
|
|
137
|
+
func: Literal[None] = None, **modifiers: Unpack[ModifierKwargs]
|
|
138
|
+
) -> ASyncPropertyDecorator[I, T]: ...
|
|
139
|
+
@overload
|
|
140
|
+
def a_sync_property(
|
|
141
|
+
func: AnyGetterFunction[I, T], **modifiers: Unpack[ModifierKwargs]
|
|
142
|
+
) -> ASyncPropertyDescriptor[I, T]: ...
|
|
143
|
+
@overload
|
|
144
|
+
def a_sync_property(
|
|
145
|
+
func: Literal[None], default: Literal["sync"], **modifiers: Unpack[ModifierKwargs]
|
|
146
|
+
) -> ASyncPropertyDecoratorSyncDefault[I, T]: ...
|
|
147
|
+
@overload
|
|
148
|
+
def a_sync_property(
|
|
149
|
+
func: Literal[None], default: Literal["sync"], **modifiers: Unpack[ModifierKwargs]
|
|
150
|
+
) -> ASyncPropertyDecoratorSyncDefault[I, T]: ...
|
|
151
|
+
@overload
|
|
152
|
+
def a_sync_property(
|
|
153
|
+
func: Literal[None], default: Literal["async"], **modifiers: Unpack[ModifierKwargs]
|
|
154
|
+
) -> ASyncPropertyDecoratorAsyncDefault[I, T]: ...
|
|
155
|
+
@overload
|
|
156
|
+
def a_sync_property(
|
|
157
|
+
func: Literal[None], default: DefaultMode = ..., **modifiers: Unpack[ModifierKwargs]
|
|
158
|
+
) -> ASyncPropertyDecorator[I, T]: ...
|
|
159
|
+
@overload
|
|
160
|
+
def a_sync_property(
|
|
161
|
+
default: Literal["sync"], **modifiers: Unpack[ModifierKwargs]
|
|
162
|
+
) -> ASyncPropertyDecoratorSyncDefault[I, T]: ...
|
|
163
|
+
@overload
|
|
164
|
+
def a_sync_property(
|
|
165
|
+
default: Literal["async"], **modifiers: Unpack[ModifierKwargs]
|
|
166
|
+
) -> ASyncPropertyDecoratorAsyncDefault[I, T]: ...
|
|
167
|
+
@overload
|
|
168
|
+
def a_sync_property(
|
|
169
|
+
func: AnyGetterFunction[I, T], default: Literal["sync"], **modifiers: Unpack[ModifierKwargs]
|
|
170
|
+
) -> ASyncPropertyDescriptorSyncDefault[I, T]: ...
|
|
171
|
+
@overload
|
|
172
|
+
def a_sync_property(
|
|
173
|
+
func: AnyGetterFunction[I, T], default: Literal["async"], **modifiers: Unpack[ModifierKwargs]
|
|
174
|
+
) -> ASyncPropertyDescriptorAsyncDefault[I, T]: ...
|
|
175
|
+
@overload
|
|
176
|
+
def a_sync_property(
|
|
177
|
+
func: AnyGetterFunction[I, T], default: DefaultMode = ..., **modifiers: Unpack[ModifierKwargs]
|
|
178
|
+
) -> ASyncPropertyDescriptor[I, T]: ...
|
|
179
|
+
|
|
180
|
+
class ASyncCachedPropertyDescriptor(
|
|
181
|
+
_ASyncPropertyDescriptorBase[I, T], ap.cached.AsyncCachedPropertyDescriptor
|
|
182
|
+
):
|
|
183
|
+
"""
|
|
184
|
+
A descriptor class for dual-function sync/async cached properties.
|
|
185
|
+
|
|
186
|
+
This class extends the API of ASyncPropertyDescriptor to provide
|
|
187
|
+
caching functionality, storing the computed value after the first access.
|
|
188
|
+
"""
|
|
189
|
+
|
|
190
|
+
def __init__(
|
|
191
|
+
self,
|
|
192
|
+
_fget: AsyncGetterFunction[I, T],
|
|
193
|
+
_fset: Incomplete | None = None,
|
|
194
|
+
_fdel: Incomplete | None = None,
|
|
195
|
+
field_name: Incomplete | None = None,
|
|
196
|
+
**modifiers: Unpack[ModifierKwargs]
|
|
197
|
+
) -> None:
|
|
198
|
+
"""Initializes the ASyncCachedPropertyDescriptor.
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
_fget: The function to be wrapped.
|
|
202
|
+
_fset: Optional setter function for the property.
|
|
203
|
+
_fdel: Optional deleter function for the property.
|
|
204
|
+
field_name: Optional name for the field. If not provided, the function's name will be used.
|
|
205
|
+
**modifiers: Additional modifier arguments.
|
|
206
|
+
"""
|
|
207
|
+
|
|
208
|
+
def get_lock(self, instance: I) -> asyncio.Task[T]:
|
|
209
|
+
"""Retrieves the lock for the property.
|
|
210
|
+
|
|
211
|
+
Args:
|
|
212
|
+
instance: The instance from which the property is accessed.
|
|
213
|
+
|
|
214
|
+
Returns:
|
|
215
|
+
An asyncio Task representing the lock.
|
|
216
|
+
"""
|
|
217
|
+
|
|
218
|
+
def pop_lock(self, instance: I) -> None:
|
|
219
|
+
"""Removes the lock for the property.
|
|
220
|
+
|
|
221
|
+
Args:
|
|
222
|
+
instance: The instance from which the property is accessed.
|
|
223
|
+
"""
|
|
224
|
+
|
|
225
|
+
def get_loader(self, instance: I) -> Callable[[], T]:
|
|
226
|
+
"""Retrieves the loader function for the property.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
instance: The instance from which the property is accessed.
|
|
230
|
+
|
|
231
|
+
Returns:
|
|
232
|
+
A callable that loads the property value.
|
|
233
|
+
"""
|
|
234
|
+
|
|
235
|
+
@final
|
|
236
|
+
class ASyncCachedPropertyDescriptorSyncDefault(ASyncCachedPropertyDescriptor[I, T]):
|
|
237
|
+
"""
|
|
238
|
+
A variant of :class:`~ASyncCachedPropertyDescriptor` that defaults to synchronous behavior.
|
|
239
|
+
|
|
240
|
+
This class is used for cached properties that are primarily intended to be
|
|
241
|
+
accessed synchronously but can also be used asynchronously if needed.
|
|
242
|
+
"""
|
|
243
|
+
|
|
244
|
+
default: Literal["sync"]
|
|
245
|
+
@overload
|
|
246
|
+
def __get__(self, instance: None, owner: Type[I]) -> Self: ...
|
|
247
|
+
@overload
|
|
248
|
+
def __get__(self, instance: I, owner: Type[I]) -> T: ...
|
|
249
|
+
__get__: Incomplete
|
|
250
|
+
|
|
251
|
+
class ASyncCachedPropertyDescriptorAsyncDefault(ASyncCachedPropertyDescriptor[I, T]):
|
|
252
|
+
"""
|
|
253
|
+
A variant of :class:`~ASyncCachedPropertyDescriptor` that defaults to asynchronous behavior.
|
|
254
|
+
|
|
255
|
+
This class is used for cached properties that are primarily intended to be
|
|
256
|
+
accessed asynchronously but can also be used synchronously if needed.
|
|
257
|
+
"""
|
|
258
|
+
|
|
259
|
+
default: Literal["async"]
|
|
260
|
+
|
|
261
|
+
ASyncCachedPropertyDecorator = Callable[
|
|
262
|
+
[AnyGetterFunction[I, T]], ASyncCachedPropertyDescriptor[I, T]
|
|
263
|
+
]
|
|
264
|
+
ASyncCachedPropertyDecoratorSyncDefault = Callable[
|
|
265
|
+
[AnyGetterFunction[I, T]], ASyncCachedPropertyDescriptorSyncDefault[I, T]
|
|
266
|
+
]
|
|
267
|
+
ASyncCachedPropertyDecoratorAsyncDefault = Callable[
|
|
268
|
+
[AnyGetterFunction[I, T]], ASyncCachedPropertyDescriptorAsyncDefault[I, T]
|
|
269
|
+
]
|
|
270
|
+
|
|
271
|
+
@overload
|
|
272
|
+
def a_sync_cached_property(
|
|
273
|
+
func: Literal[None] = None, **modifiers: Unpack[ModifierKwargs]
|
|
274
|
+
) -> ASyncCachedPropertyDecorator[I, T]: ...
|
|
275
|
+
@overload
|
|
276
|
+
def a_sync_cached_property(
|
|
277
|
+
func: AnyGetterFunction[I, T], **modifiers: Unpack[ModifierKwargs]
|
|
278
|
+
) -> ASyncCachedPropertyDescriptor[I, T]: ...
|
|
279
|
+
@overload
|
|
280
|
+
def a_sync_cached_property(
|
|
281
|
+
func: Literal[None], default: Literal["sync"], **modifiers: Unpack[ModifierKwargs]
|
|
282
|
+
) -> ASyncCachedPropertyDecoratorSyncDefault[I, T]: ...
|
|
283
|
+
@overload
|
|
284
|
+
def a_sync_cached_property(
|
|
285
|
+
func: Literal[None], default: Literal["async"], **modifiers: Unpack[ModifierKwargs]
|
|
286
|
+
) -> ASyncCachedPropertyDecoratorAsyncDefault[I, T]: ...
|
|
287
|
+
@overload
|
|
288
|
+
def a_sync_cached_property(
|
|
289
|
+
func: Literal[None], default: DefaultMode, **modifiers: Unpack[ModifierKwargs]
|
|
290
|
+
) -> ASyncCachedPropertyDecorator[I, T]: ...
|
|
291
|
+
@overload
|
|
292
|
+
def a_sync_cached_property(
|
|
293
|
+
default: Literal["sync"], **modifiers: Unpack[ModifierKwargs]
|
|
294
|
+
) -> ASyncCachedPropertyDecoratorSyncDefault[I, T]: ...
|
|
295
|
+
@overload
|
|
296
|
+
def a_sync_cached_property(
|
|
297
|
+
default: Literal["async"], **modifiers: Unpack[ModifierKwargs]
|
|
298
|
+
) -> ASyncCachedPropertyDecoratorAsyncDefault[I, T]: ...
|
|
299
|
+
@overload
|
|
300
|
+
def a_sync_cached_property(
|
|
301
|
+
func: AnyGetterFunction[I, T], default: Literal["sync"], **modifiers: Unpack[ModifierKwargs]
|
|
302
|
+
) -> ASyncCachedPropertyDescriptorSyncDefault[I, T]: ...
|
|
303
|
+
@overload
|
|
304
|
+
def a_sync_cached_property(
|
|
305
|
+
func: AnyGetterFunction[I, T], default: Literal["async"], **modifiers: Unpack[ModifierKwargs]
|
|
306
|
+
) -> ASyncCachedPropertyDescriptorAsyncDefault[I, T]: ...
|
|
307
|
+
@overload
|
|
308
|
+
def a_sync_cached_property(
|
|
309
|
+
func: AnyGetterFunction[I, T], default: DefaultMode = ..., **modifiers: Unpack[ModifierKwargs]
|
|
310
|
+
) -> ASyncCachedPropertyDescriptor[I, T]: ...
|
|
311
|
+
@final
|
|
312
|
+
class HiddenMethod(ASyncBoundMethodAsyncDefault[I, Tuple[()], T]):
|
|
313
|
+
"""Represents a hidden method for asynchronous properties.
|
|
314
|
+
|
|
315
|
+
This class is used internally to manage hidden methods associated with
|
|
316
|
+
asynchronous properties.
|
|
317
|
+
"""
|
|
318
|
+
|
|
319
|
+
def __init__(
|
|
320
|
+
self,
|
|
321
|
+
instance: I,
|
|
322
|
+
unbound: AnyFn[Concatenate[I, P], T],
|
|
323
|
+
async_def: bool,
|
|
324
|
+
field_name: str,
|
|
325
|
+
**modifiers: Unpack[ModifierKwargs]
|
|
326
|
+
) -> None:
|
|
327
|
+
"""Initializes the HiddenMethod.
|
|
328
|
+
|
|
329
|
+
Args:
|
|
330
|
+
instance: The instance to which the method is bound.
|
|
331
|
+
unbound: The unbound function to be wrapped.
|
|
332
|
+
async_def: Indicates if the method is asynchronous.
|
|
333
|
+
field_name: The name of the field associated with the method.
|
|
334
|
+
**modifiers: Additional modifier arguments.
|
|
335
|
+
"""
|
|
336
|
+
|
|
337
|
+
def __await__(self) -> Generator[Any, None, T]:
|
|
338
|
+
"""Returns an awaitable for the method."""
|
|
339
|
+
|
|
340
|
+
@final
|
|
341
|
+
class HiddenMethodDescriptor(ASyncMethodDescriptorAsyncDefault[I, Tuple[()], T]):
|
|
342
|
+
"""Descriptor for hidden methods associated with asynchronous properties.
|
|
343
|
+
|
|
344
|
+
This class is used internally to manage hidden methods associated with
|
|
345
|
+
asynchronous properties.
|
|
346
|
+
"""
|
|
347
|
+
|
|
348
|
+
__doc__: Incomplete
|
|
349
|
+
def __init__(
|
|
350
|
+
self,
|
|
351
|
+
_fget: AnyFn[Concatenate[I, P], Awaitable[T]],
|
|
352
|
+
field_name: Optional[str] = None,
|
|
353
|
+
**modifiers: Unpack[ModifierKwargs]
|
|
354
|
+
) -> None:
|
|
355
|
+
"""
|
|
356
|
+
Initialize the HiddenMethodDescriptor.
|
|
357
|
+
|
|
358
|
+
Args:
|
|
359
|
+
_fget: The function to be wrapped.
|
|
360
|
+
field_name: Optional name for the field. If not provided, the function's name will be used.
|
|
361
|
+
**modifiers: Additional modifier arguments.
|
|
362
|
+
|
|
363
|
+
Raises:
|
|
364
|
+
ValueError: If _fget is not callable.
|
|
365
|
+
"""
|
|
366
|
+
|
|
367
|
+
def __get__(self, instance: I, owner: Type[I]) -> HiddenMethod[I, T]:
|
|
368
|
+
"""Retrieves the hidden method for the property.
|
|
369
|
+
|
|
370
|
+
Args:
|
|
371
|
+
instance: The instance from which the method is accessed.
|
|
372
|
+
owner: The owner class of the method.
|
|
373
|
+
|
|
374
|
+
Returns:
|
|
375
|
+
The hidden method.
|
|
376
|
+
"""
|