Skip to content

Commit

Permalink
black .
Browse files Browse the repository at this point in the history
remove seconds empty line at EOF
  • Loading branch information
hf-kklein committed May 5, 2024
1 parent 2237ac8 commit 7e45d75
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 8 deletions.
4 changes: 3 additions & 1 deletion aiostream/aiter_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ async def __aexit__(
await self._aiterator.athrow(value)
else:
await self._aiterator.athrow(typ, value, traceback)
raise RuntimeError("Async iterator didn't stop after athrow()")
raise RuntimeError(
"Async iterator didn't stop after athrow()"
)

# Exception has been (most probably) silenced
except StopAsyncIteration as exc:
Expand Down
4 changes: 3 additions & 1 deletion aiostream/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ def _run_once(self) -> None:
super()._run_once()
# Update internals
self.busy_count += 1
self._timers = sorted(when for when in self._timers if when > self.time())
self._timers = sorted(
when for when in self._timers if when > self.time()
)
# Time advance
if self.time_to_go:
when = self._timers.pop(0)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ ignore = ["aiostream/test_utils.py"]
[tool.black]
line-length = 80
target_version = ["py38", "py39", "py310", "py311", "py312"]

6 changes: 5 additions & 1 deletion tests/test_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ def target2(x: int, *_) -> Stream[int]:
return stream.range(x, x + 4, interval=1)

def target3(x: int, *_) -> Stream[int]:
return stream.range(0, 3, interval=1) if x else stream.throw(ZeroDivisionError)
return (
stream.range(0, 3, interval=1)
if x
else stream.throw(ZeroDivisionError)
)

# Concurrent run
with assert_cleanup() as loop:
Expand Down
18 changes: 15 additions & 3 deletions tests/test_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ async def afunc(x):
@pytest.mark.asyncio
async def test_until(assert_run, assert_cleanup):
with assert_cleanup():
xs = stream.range(1, 10) | add_resource.pipe(1) | pipe.until(lambda x: x == 3)
xs = (
stream.range(1, 10)
| add_resource.pipe(1)
| pipe.until(lambda x: x == 3)
)
await assert_run(xs, [1, 2, 3])

async def afunc(x):
Expand All @@ -178,7 +182,11 @@ def less_than_4(x: int) -> bool:
return x < 4

with assert_cleanup():
xs = stream.range(1, 10) | add_resource.pipe(1) | pipe.takewhile(less_than_4)
xs = (
stream.range(1, 10)
| add_resource.pipe(1)
| pipe.takewhile(less_than_4)
)
await assert_run(xs, [1, 2, 3])

async def afunc(x):
Expand All @@ -197,7 +205,11 @@ def less_than_7(x: int) -> bool:
return x < 7

with assert_cleanup():
xs = stream.range(1, 10) | add_resource.pipe(1) | pipe.dropwhile(less_than_7)
xs = (
stream.range(1, 10)
| add_resource.pipe(1)
| pipe.dropwhile(less_than_7)
)
await assert_run(xs, [7, 8, 9])

async def afunc(x):
Expand Down
7 changes: 6 additions & 1 deletion tests/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ async def test_cycle(assert_run, assert_cleanup):
await assert_run(xs, [], asyncio.TimeoutError())

with assert_cleanup():
xs = stream.empty() | add_resource.pipe(1) | pipe.cycle() | pipe.timeout(1)
xs = (
stream.empty()
| add_resource.pipe(1)
| pipe.cycle()
| pipe.timeout(1)
)
await assert_run(xs, [], asyncio.TimeoutError())

with assert_cleanup() as loop:
Expand Down

0 comments on commit 7e45d75

Please sign in to comment.