ez-a-sync 0.23.5__tar.gz → 0.23.6__tar.gz
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.
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/PKG-INFO +1 -1
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/method.py +17 -20
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/property.py +1 -1
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/ez_a_sync.egg-info/PKG-INFO +1 -1
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.coverage +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.github/workflows/black.yaml +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.github/workflows/codeql.yaml +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.github/workflows/docs.yaml +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.github/workflows/mypy.yaml +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.github/workflows/pytest.yaml +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.github/workflows/release.yaml +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.gitignore +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.sourcery.yaml +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/LICENSE.txt +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/Makefile +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/README.md +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/TODO +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/ENVIRONMENT_VARIABLES.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/__init__.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/_smart.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/_typing.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/__init__.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_descriptor.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_flags.c +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_flags.pyi +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_flags.pyx +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_helpers.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_kwargs.c +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_kwargs.pyi +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_kwargs.pyx +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_meta.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/abstract.c +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/abstract.pyi +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/abstract.pyx +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/base.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/config.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/decorator.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/function.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/__init__.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/cache/__init__.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/cache/memory.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/limiter.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/manager.c +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/manager.pyi +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/manager.pyx +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/semaphores.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/singleton.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/aliases.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/asyncio/__init__.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/asyncio/as_completed.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/asyncio/create_task.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/asyncio/gather.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/asyncio/utils.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/exceptions.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/executor.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/future.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/iter.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/__init__.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/_debug.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/_loggable.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/locks/__init__.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/locks/counter.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/locks/event.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/locks/prio_semaphore.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/locks/semaphore.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/queue.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/py.typed +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/sphinx/__init__.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/sphinx/ext.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/task.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/utils/__init__.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/utils/iterators.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/Makefile +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/alabaster.css +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/basic.css +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/custom.css +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/doctools.js +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/documentation_options.js +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/file.png +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/language_data.js +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/minus.png +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/plus.png +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/pygments.css +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/searchtools.js +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/sphinx_highlight.js +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/conf.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/index.rst +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/make.bat +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/ez_a_sync.egg-info/SOURCES.txt +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/ez_a_sync.egg-info/dependency_links.txt +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/ez_a_sync.egg-info/not-zip-safe +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/ez_a_sync.egg-info/requires.txt +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/ez_a_sync.egg-info/top_level.txt +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/pyproject.yaml +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/requirements-dev.txt +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/requirements.txt +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/setup.cfg +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/setup.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/__init__.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/conftest.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/executor.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/fixtures.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_abstract.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_as_completed.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_base.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_cache.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_decorator.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_executor.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_future.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_gather.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_helpers.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_iter.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_limiter.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_meta.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_modified.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_semaphore.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_singleton.py +0 -0
- {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_task.py +0 -0
|
@@ -9,6 +9,7 @@ asynchronously based on various conditions and configurations.
|
|
|
9
9
|
# mypy: disable-error-code=valid-type
|
|
10
10
|
# mypy: disable-error-code=misc
|
|
11
11
|
import functools
|
|
12
|
+
import heapq
|
|
12
13
|
import logging
|
|
13
14
|
import weakref
|
|
14
15
|
from inspect import isawaitable
|
|
@@ -156,8 +157,7 @@ class ASyncMethodDescriptor(ASyncDescriptor[I, P, T]):
|
|
|
156
157
|
)
|
|
157
158
|
instance.__dict__[self.field_name] = bound
|
|
158
159
|
logger.debug("new bound method: %s", bound)
|
|
159
|
-
|
|
160
|
-
bound._cache_handle = self._get_cache_handle(instance)
|
|
160
|
+
self._update_cache_handle(instance, bound)
|
|
161
161
|
return bound
|
|
162
162
|
|
|
163
163
|
def __set__(self, instance, value):
|
|
@@ -211,24 +211,23 @@ class ASyncMethodDescriptor(ASyncDescriptor[I, P, T]):
|
|
|
211
211
|
"""
|
|
212
212
|
return asyncio.iscoroutinefunction(self.__wrapped__)
|
|
213
213
|
|
|
214
|
-
def
|
|
214
|
+
def _update_cache_handle(self, instance, bound: "ASyncBoundMethod") -> None:
|
|
215
215
|
"""
|
|
216
|
-
|
|
216
|
+
Update the TTL for the cache handle for the instance.
|
|
217
217
|
|
|
218
218
|
Args:
|
|
219
219
|
instance: The instance to create a cache handle for.
|
|
220
|
-
|
|
221
|
-
Returns:
|
|
222
|
-
A timer handle for cache management.
|
|
223
|
-
|
|
224
|
-
Examples:
|
|
225
|
-
>>> descriptor = ASyncMethodDescriptor(my_function)
|
|
226
|
-
>>> cache_handle = descriptor._get_cache_handle(instance)
|
|
220
|
+
bound: The bound method we are caching.
|
|
227
221
|
"""
|
|
228
|
-
#
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
222
|
+
# Handler for popping unused bound methods from bound method cache
|
|
223
|
+
loop = asyncio.get_event_loop()
|
|
224
|
+
if handle := bound._cache_handle:
|
|
225
|
+
handle._when = loop.time() + 300
|
|
226
|
+
else:
|
|
227
|
+
# NOTE: use `instance.__dict__.pop` instead of `delattr` so we don't create a strong ref to `instance`
|
|
228
|
+
bound._cache_handle = loop.call_at(
|
|
229
|
+
loop.time() + 300, instance.__dict__.pop, self.field_name
|
|
230
|
+
)
|
|
232
231
|
|
|
233
232
|
|
|
234
233
|
@final
|
|
@@ -314,8 +313,7 @@ class ASyncMethodDescriptorSyncDefault(ASyncMethodDescriptor[I, P, T]):
|
|
|
314
313
|
)
|
|
315
314
|
instance.__dict__[self.field_name] = bound
|
|
316
315
|
logger.debug("new bound method: %s", bound)
|
|
317
|
-
|
|
318
|
-
bound._cache_handle = self._get_cache_handle(instance)
|
|
316
|
+
self._update_cache_handle(instance, bound)
|
|
319
317
|
return bound
|
|
320
318
|
|
|
321
319
|
|
|
@@ -399,8 +397,7 @@ class ASyncMethodDescriptorAsyncDefault(ASyncMethodDescriptor[I, P, T]):
|
|
|
399
397
|
)
|
|
400
398
|
instance.__dict__[self.field_name] = bound
|
|
401
399
|
logger.debug("new bound method: %s", bound)
|
|
402
|
-
|
|
403
|
-
bound._cache_handle = self._get_cache_handle(instance)
|
|
400
|
+
self._update_cache_handle(instance, bound)
|
|
404
401
|
return bound
|
|
405
402
|
|
|
406
403
|
|
|
@@ -435,7 +432,7 @@ class ASyncBoundMethod(ASyncFunction[P, T], Generic[I, P, T]):
|
|
|
435
432
|
|
|
436
433
|
# NOTE: this is created by the Descriptor
|
|
437
434
|
|
|
438
|
-
_cache_handle: asyncio.TimerHandle
|
|
435
|
+
_cache_handle: asyncio.TimerHandle = None
|
|
439
436
|
"""An asyncio handle used to pop the bound method from `instance.__dict__` 5 minutes after its last use."""
|
|
440
437
|
|
|
441
438
|
__weakself__: "weakref.ref[I]"
|
|
@@ -730,7 +730,7 @@ class HiddenMethodDescriptor(ASyncMethodDescriptorAsyncDefault[I, Tuple[()], T])
|
|
|
730
730
|
)
|
|
731
731
|
instance.__dict__[self.field_name] = bound
|
|
732
732
|
logger.debug("new hidden method: %s", bound)
|
|
733
|
-
|
|
733
|
+
self._update_cache_handle(instance, bound)
|
|
734
734
|
return bound
|
|
735
735
|
|
|
736
736
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|