Skip to content

Commit 055faf0

Browse files
authored
Merge pull request #78 from anomaly/alpha-11
Alpha 11 - Event refactor
2 parents 78bdc99 + cb5b29e commit 055faf0

File tree

7 files changed

+21
-26
lines changed

7 files changed

+21
-26
lines changed

docs/docs/python-sdk.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ async def main():
298298

299299
# Used to control the event loop
300300
asyncio_event = asyncio.Event()
301-
asyncio_event.set()
302301

303302
async for updates in Alarms.follow(
304303
asyncio_event=asyncio_event,
@@ -310,7 +309,7 @@ async def main():
310309
# Examples of stopping the loop if
311310
# we got no updates
312311
if len(updates.updates) == 0:
313-
asyncio_event.clear()
312+
asyncio_event.set()
314313

315314
if __name__ == "__main__":
316315
asyncio.run(main())

examples/alarm.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ async def main():
1515
cc.api_key = api_key
1616

1717
event = asyncio.Event()
18-
event.set()
1918

2019
async for updates in Alarms.follow(
2120
asyncio_event=event,
@@ -25,7 +24,7 @@ async def main():
2524
print(update)
2625

2726
if len(updates.updates) == 0:
28-
event.clear()
27+
event.set()
2928

3029

3130

examples/events.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ async def main():
4646
cc.api_key = api_key
4747

4848
event = asyncio.Event()
49-
event.set()
5049

5150
async for updates in Event.follow(
5251
asyncio_event=event,

gallagher/cc/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ async def follow(
520520
verify=cls._ssl_context(),
521521
) as _httpx_async:
522522

523-
while asyncio_event.is_set():
523+
while not asyncio_event.is_set():
524524
try:
525525
response = await _httpx_async.get(
526526
f"{url}", # required to turn pydantic object to str

poetry.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "gallagher"
3-
version = "0.1.0-alpha.10"
3+
version = "0.1.0-alpha.11"
44
description = "The missing developer toolkit for Gallagher Command Centre"
55
authors = ["Dev Mukherjee <[email protected]>"]
66
readme = "README.md"
@@ -32,7 +32,7 @@ typing-extensions = "^4.11.0"
3232
annotated-types = "^0.7.0"
3333
certifi = "^2025.1.31"
3434
idna = "^3.7"
35-
packaging = "^24.1"
35+
packaging = "^25.0"
3636
pluggy = "^1.3.0"
3737
anyio = "^4.3.0"
3838
aiohttp = "^3.9.4"

tests/test_events.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ async def test_event_updates():
6565
# Make an asyncio Event, this is used to signal the event to stop
6666
# use this to cancel the loop
6767
event = asyncio.Event()
68-
event.set()
6968
count = 0
7069

7170
async for updates in Event.follow(
@@ -75,5 +74,4 @@ async def test_event_updates():
7574
assert type(update_event) is EventSummary
7675
count += 1
7776
if count > 3:
78-
event.clear()
79-
break
77+
event.set()

0 commit comments

Comments
 (0)