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.

Files changed (118) hide show
  1. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/PKG-INFO +1 -1
  2. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/method.py +17 -20
  3. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/property.py +1 -1
  4. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/ez_a_sync.egg-info/PKG-INFO +1 -1
  5. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.coverage +0 -0
  6. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.github/workflows/black.yaml +0 -0
  7. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.github/workflows/codeql.yaml +0 -0
  8. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.github/workflows/docs.yaml +0 -0
  9. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.github/workflows/mypy.yaml +0 -0
  10. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.github/workflows/pytest.yaml +0 -0
  11. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.github/workflows/release.yaml +0 -0
  12. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.gitignore +0 -0
  13. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/.sourcery.yaml +0 -0
  14. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/LICENSE.txt +0 -0
  15. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/Makefile +0 -0
  16. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/README.md +0 -0
  17. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/TODO +0 -0
  18. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/ENVIRONMENT_VARIABLES.py +0 -0
  19. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/__init__.py +0 -0
  20. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/_smart.py +0 -0
  21. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/_typing.py +0 -0
  22. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/__init__.py +0 -0
  23. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_descriptor.py +0 -0
  24. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_flags.c +0 -0
  25. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_flags.pyi +0 -0
  26. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_flags.pyx +0 -0
  27. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_helpers.py +0 -0
  28. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_kwargs.c +0 -0
  29. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_kwargs.pyi +0 -0
  30. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_kwargs.pyx +0 -0
  31. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/_meta.py +0 -0
  32. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/abstract.c +0 -0
  33. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/abstract.pyi +0 -0
  34. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/abstract.pyx +0 -0
  35. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/base.py +0 -0
  36. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/config.py +0 -0
  37. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/decorator.py +0 -0
  38. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/function.py +0 -0
  39. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/__init__.py +0 -0
  40. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/cache/__init__.py +0 -0
  41. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/cache/memory.py +0 -0
  42. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/limiter.py +0 -0
  43. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/manager.c +0 -0
  44. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/manager.pyi +0 -0
  45. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/manager.pyx +0 -0
  46. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/modifiers/semaphores.py +0 -0
  47. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/a_sync/singleton.py +0 -0
  48. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/aliases.py +0 -0
  49. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/asyncio/__init__.py +0 -0
  50. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/asyncio/as_completed.py +0 -0
  51. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/asyncio/create_task.py +0 -0
  52. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/asyncio/gather.py +0 -0
  53. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/asyncio/utils.py +0 -0
  54. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/exceptions.py +0 -0
  55. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/executor.py +0 -0
  56. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/future.py +0 -0
  57. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/iter.py +0 -0
  58. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/__init__.py +0 -0
  59. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/_debug.py +0 -0
  60. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/_loggable.py +0 -0
  61. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/locks/__init__.py +0 -0
  62. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/locks/counter.py +0 -0
  63. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/locks/event.py +0 -0
  64. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/locks/prio_semaphore.py +0 -0
  65. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/locks/semaphore.py +0 -0
  66. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/primitives/queue.py +0 -0
  67. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/py.typed +0 -0
  68. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/sphinx/__init__.py +0 -0
  69. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/sphinx/ext.py +0 -0
  70. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/task.py +0 -0
  71. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/utils/__init__.py +0 -0
  72. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/a_sync/utils/iterators.py +0 -0
  73. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/Makefile +0 -0
  74. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/alabaster.css +0 -0
  75. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/basic.css +0 -0
  76. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/custom.css +0 -0
  77. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/doctools.js +0 -0
  78. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/documentation_options.js +0 -0
  79. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/file.png +0 -0
  80. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/language_data.js +0 -0
  81. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/minus.png +0 -0
  82. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/plus.png +0 -0
  83. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/pygments.css +0 -0
  84. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/searchtools.js +0 -0
  85. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/_build/html/_static/sphinx_highlight.js +0 -0
  86. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/conf.py +0 -0
  87. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/index.rst +0 -0
  88. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/docs/make.bat +0 -0
  89. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/ez_a_sync.egg-info/SOURCES.txt +0 -0
  90. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/ez_a_sync.egg-info/dependency_links.txt +0 -0
  91. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/ez_a_sync.egg-info/not-zip-safe +0 -0
  92. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/ez_a_sync.egg-info/requires.txt +0 -0
  93. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/ez_a_sync.egg-info/top_level.txt +0 -0
  94. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/pyproject.yaml +0 -0
  95. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/requirements-dev.txt +0 -0
  96. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/requirements.txt +0 -0
  97. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/setup.cfg +0 -0
  98. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/setup.py +0 -0
  99. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/__init__.py +0 -0
  100. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/conftest.py +0 -0
  101. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/executor.py +0 -0
  102. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/fixtures.py +0 -0
  103. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_abstract.py +0 -0
  104. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_as_completed.py +0 -0
  105. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_base.py +0 -0
  106. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_cache.py +0 -0
  107. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_decorator.py +0 -0
  108. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_executor.py +0 -0
  109. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_future.py +0 -0
  110. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_gather.py +0 -0
  111. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_helpers.py +0 -0
  112. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_iter.py +0 -0
  113. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_limiter.py +0 -0
  114. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_meta.py +0 -0
  115. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_modified.py +0 -0
  116. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_semaphore.py +0 -0
  117. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_singleton.py +0 -0
  118. {ez_a_sync-0.23.5 → ez_a_sync-0.23.6}/tests/test_task.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ez-a-sync
3
- Version: 0.23.5
3
+ Version: 0.23.6
4
4
  Summary: A library that makes it easy to define objects that can be used for both sync and async use cases.
5
5
  Home-page: https://github.com/BobTheBuidler/a-sync
6
6
  Author: BobTheBuidler
@@ -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
- # Handler for popping unused bound methods from bound method cache
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 _get_cache_handle(self, instance: I) -> asyncio.TimerHandle:
214
+ def _update_cache_handle(self, instance, bound: "ASyncBoundMethod") -> None:
215
215
  """
216
- Get a cache handle for the instance.
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
- # NOTE: use `instance.__dict__.pop` instead of `delattr` so we don't create a strong ref to `instance`
229
- return asyncio.get_event_loop().call_later(
230
- 300, instance.__dict__.pop, self.field_name
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
- # Handler for popping unused bound methods from bound method cache
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
- # Handler for popping unused bound methods from bound method cache
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
- bound._cache_handle = self._get_cache_handle(instance)
733
+ self._update_cache_handle(instance, bound)
734
734
  return bound
735
735
 
736
736
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ez-a-sync
3
- Version: 0.23.5
3
+ Version: 0.23.6
4
4
  Summary: A library that makes it easy to define objects that can be used for both sync and async use cases.
5
5
  Home-page: https://github.com/BobTheBuidler/a-sync
6
6
  Author: BobTheBuidler
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