Skip to content

Commit 51f2f2d

Browse files
committed
samples: workflow_streams: fix lint failures (ruff isort + format)
CI's `poe lint` step was failing on three small things across four files: * `run_external_publisher.py`, `ticker_workflow.py`: ruff isort (`I001`) wanted the `workflow_streams.shared` imports re-sorted and a stray blank line removed. Apply the auto-fix. * `run_external_publisher.py`, `run_reconnecting_subscriber.py`, `run_truncating_ticker.py`: ruff format wanted three line-wrapped function calls collapsed back to single lines. Apply the formatter. * `run_truncating_ticker.py`: the formatter joined an adjacent pair of f-strings into an awkward `f"..." f"..."` one-liner. Consolidate them into a single f-string for readability — the resulting line is comfortably under the 88-char limit. `poe lint` (ruff isort + ruff format --check + mypy --all-groups --check-untyped-defs) now passes locally.
1 parent 7a5065e commit 51f2f2d

4 files changed

Lines changed: 5 additions & 13 deletions

File tree

workflow_streams/run_external_publisher.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
)
3636
from workflow_streams.workflows.hub_workflow import HubWorkflow
3737

38-
3938
HEADLINES = [
4039
"rates held",
4140
"merger announced",
@@ -85,9 +84,7 @@ async def publish_news() -> None:
8584

8685
async def consume_news() -> None:
8786
consumer = WorkflowStreamClient.create(client, workflow_id)
88-
async for item in consumer.subscribe(
89-
[TOPIC_NEWS], result_type=NewsEvent
90-
):
87+
async for item in consumer.subscribe([TOPIC_NEWS], result_type=NewsEvent):
9188
if item.data.headline == DONE_HEADLINE:
9289
return
9390
print(f"[subscriber] offset={item.offset}: {item.data.headline}")

workflow_streams/run_reconnecting_subscriber.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ async def poller() -> None:
109109
emit(state, "·")
110110
last_emit = now
111111
try:
112-
await asyncio.wait_for(
113-
stop.wait(), timeout=POLL_INTERVAL_SECONDS
114-
)
112+
await asyncio.wait_for(stop.wait(), timeout=POLL_INTERVAL_SECONDS)
115113
except asyncio.TimeoutError:
116114
pass
117115

@@ -120,9 +118,7 @@ async def poller() -> None:
120118
# ---- Phase 1: connect, read a couple of events, "disconnect".
121119
emit(state, "[phase 1] connecting")
122120
seen = 0
123-
async for item in stream.subscribe(
124-
[TOPIC_STATUS], result_type=StageEvent
125-
):
121+
async for item in stream.subscribe([TOPIC_STATUS], result_type=StageEvent):
126122
# Remember *one past* the offset just consumed: on resume we
127123
# want the next unseen event, not the one we already showed.
128124
state.processed = item.offset + 1

workflow_streams/run_truncating_ticker.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ async def slow_subscriber() -> None:
110110
if last_offset >= 0 and item.offset > last_offset + 1:
111111
gap = item.offset - last_offset - 1
112112
emit_slow(
113-
f"↪ jumped offset={last_offset}{item.offset} "
114-
f"({gap} dropped)"
113+
f"↪ jumped offset={last_offset}{item.offset} ({gap} dropped)"
115114
)
116115
emit_slow(f"offset={item.offset:>3} n={item.data.n}")
117116
last_offset = item.offset

workflow_streams/workflows/ticker_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
from workflow_streams.shared import (
99
TOPIC_TICK,
10-
TickEvent,
1110
TickerInput,
11+
TickEvent,
1212
)
1313

1414

0 commit comments

Comments
 (0)