streamable 2.1.0b2__tar.gz → 2.1.0rc1__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.
Files changed (39) hide show
  1. {streamable-2.1.0b2/streamable.egg-info → streamable-2.1.0rc1}/PKG-INFO +1 -1
  2. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/__init__.py +1 -1
  3. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_aiterators.py +4 -2
  4. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_iterators.py +2 -0
  5. streamable-2.1.0rc1/streamable/_tools/_async.py +39 -0
  6. {streamable-2.1.0b2 → streamable-2.1.0rc1/streamable.egg-info}/PKG-INFO +1 -1
  7. streamable-2.1.0b2/streamable/_tools/_async.py +0 -14
  8. {streamable-2.1.0b2 → streamable-2.1.0rc1}/LICENSE +0 -0
  9. {streamable-2.1.0b2 → streamable-2.1.0rc1}/MANIFEST.in +0 -0
  10. {streamable-2.1.0b2 → streamable-2.1.0rc1}/README.md +0 -0
  11. {streamable-2.1.0b2 → streamable-2.1.0rc1}/pyproject.toml +0 -0
  12. {streamable-2.1.0b2 → streamable-2.1.0rc1}/setup.cfg +0 -0
  13. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_afunctions.py +0 -0
  14. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_functions.py +0 -0
  15. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_stream.py +0 -0
  16. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_tools/__init__.py +0 -0
  17. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_tools/_afuture.py +0 -0
  18. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_tools/_context.py +0 -0
  19. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_tools/_error.py +0 -0
  20. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_tools/_func.py +0 -0
  21. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_tools/_future.py +0 -0
  22. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_tools/_iter.py +0 -0
  23. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_tools/_logging.py +0 -0
  24. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_tools/_observation.py +0 -0
  25. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_tools/_sentinel.py +0 -0
  26. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_tools/_star.py +0 -0
  27. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/_tools/_validation.py +0 -0
  28. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/py.typed +0 -0
  29. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/visitors/__init__.py +0 -0
  30. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/visitors/_aiter.py +0 -0
  31. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/visitors/_base.py +0 -0
  32. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/visitors/_eq.py +0 -0
  33. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/visitors/_involves_async.py +0 -0
  34. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/visitors/_iter.py +0 -0
  35. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable/visitors/_repr.py +0 -0
  36. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable.egg-info/SOURCES.txt +0 -0
  37. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable.egg-info/dependency_links.txt +0 -0
  38. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable.egg-info/requires.txt +0 -0
  39. {streamable-2.1.0b2 → streamable-2.1.0rc1}/streamable.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamable
3
- Version: 2.1.0b2
3
+ Version: 2.1.0rc1
4
4
  Summary: sync/async iterable streams for Python
5
5
  Author-email: ebonnal <bonnal.enzo.dev@gmail.com>
6
6
  License: Apache-2.0
@@ -12,4 +12,4 @@ ClosableAsyncIterator.__module__ = __name__
12
12
 
13
13
  __all__ = ["stream", "star", "Observation", "ClosableAsyncIterator"]
14
14
 
15
- __version__ = "2.1.0b2"
15
+ __version__ = "2.1.0rc1"
@@ -36,7 +36,7 @@ from streamable._tools._afuture import (
36
36
  FIFOFutureResults,
37
37
  FutureResults,
38
38
  )
39
- from streamable._tools._async import AsyncFunction, anext
39
+ from streamable._tools._async import AsyncFunction, anext, wait_for
40
40
  from streamable._tools._context import (
41
41
  ExecutorAsyncContextManager,
42
42
  NoopAsyncContextManager,
@@ -211,6 +211,7 @@ class _BufferAsyncIterable(AsyncIterable[Union[T, ExceptionContainer]]):
211
211
  try:
212
212
  await asyncio.gather(task, return_exceptions=True)
213
213
  finally:
214
+ base_exception.clear()
214
215
  while not buffer.empty():
215
216
  buffer.get_nowait()
216
217
 
@@ -438,7 +439,7 @@ class _GroupByWithinAsyncIterable(
438
439
  try:
439
440
  while True:
440
441
  try:
441
- elem = await asyncio.wait_for(
442
+ elem = await wait_for(
442
443
  next_elem.get(), timeout=self._timeout(groups)
443
444
  )
444
445
  except asyncio.TimeoutError:
@@ -485,6 +486,7 @@ class _GroupByWithinAsyncIterable(
485
486
  try:
486
487
  await asyncio.gather(task, return_exceptions=True)
487
488
  finally:
489
+ base_exception.clear()
488
490
  while not next_elem.empty():
489
491
  next_elem.get_nowait()
490
492
 
@@ -130,6 +130,7 @@ class _BufferIterable(Iterable[Union[T, ExceptionContainer]]):
130
130
  stopped.set()
131
131
  limit.release()
132
132
  thread.join()
133
+ base_exception.clear()
133
134
  buffer.queue.clear()
134
135
 
135
136
 
@@ -377,6 +378,7 @@ class _GroupByWithinIterable(Iterable[Union[ExceptionContainer, Tuple[U, List[T]
377
378
  stopped.set()
378
379
  limit.release()
379
380
  thread.join()
381
+ base_exception.clear()
380
382
  next_elem.queue.clear()
381
383
 
382
384
 
@@ -0,0 +1,39 @@
1
+ import asyncio
2
+ import sys
3
+ from typing import AsyncIterator, Awaitable, Callable, Coroutine, Optional, TypeVar
4
+
5
+ T = TypeVar("T")
6
+ R = TypeVar("R")
7
+
8
+ AsyncFunction = Callable[[T], Coroutine[object, object, R]]
9
+
10
+
11
+ # `builtins.anext` for pre 3.10
12
+ async def anext(aiterator: AsyncIterator[T], default: T) -> T:
13
+ try:
14
+ return await aiterator.__anext__()
15
+ except StopAsyncIteration:
16
+ return default
17
+
18
+
19
+ # before 3.12, `asyncio.wait_for` swallowed cancellations when the result was available.
20
+ if sys.version_info >= (3, 12):
21
+ from asyncio import wait_for
22
+ else: # pragma: no cover
23
+
24
+ async def wait_for(awaitable: Awaitable[T], timeout: Optional[float]) -> T:
25
+ if timeout is None:
26
+ return await awaitable
27
+ task = asyncio.ensure_future(awaitable)
28
+ try:
29
+ await asyncio.wait((task,), timeout=timeout)
30
+ except BaseException:
31
+ task.cancel()
32
+ await asyncio.wait((task,))
33
+ raise
34
+ if not task.done():
35
+ task.cancel()
36
+ await asyncio.wait((task,))
37
+ if task.cancelled():
38
+ raise asyncio.TimeoutError
39
+ return task.result()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamable
3
- Version: 2.1.0b2
3
+ Version: 2.1.0rc1
4
4
  Summary: sync/async iterable streams for Python
5
5
  Author-email: ebonnal <bonnal.enzo.dev@gmail.com>
6
6
  License: Apache-2.0
@@ -1,14 +0,0 @@
1
- from typing import AsyncIterator, Callable, Coroutine, TypeVar
2
-
3
- T = TypeVar("T")
4
- R = TypeVar("R")
5
-
6
- AsyncFunction = Callable[[T], Coroutine[object, object, R]]
7
-
8
-
9
- # `builtins.anext` for pre 3.10
10
- async def anext(aiterator: AsyncIterator[T], default: T) -> T:
11
- try:
12
- return await aiterator.__anext__()
13
- except StopAsyncIteration:
14
- return default
File without changes
File without changes
File without changes
File without changes