diff --git a/lib/galaxy/managers/history_audit_monitor.py b/lib/galaxy/managers/history_audit_monitor.py index e8f3fadd08e..ec76cf94a2f 100644 --- a/lib/galaxy/managers/history_audit_monitor.py +++ b/lib/galaxy/managers/history_audit_monitor.py @@ -15,13 +15,13 @@ from collections import ( defaultdict, OrderedDict, ) +from collections.abc import Iterator from datetime import ( datetime, timedelta, ) from typing import ( Any, - Iterator, Optional, ) @@ -120,7 +120,7 @@ class HistoryAuditMonitor: self._thread: Optional[threading.Thread] = None self._active = False # Bounded LRU cache: history_id -> user_id, refreshed on miss. - self._history_owner_cache: "OrderedDict[int, int]" = OrderedDict() + self._history_owner_cache: OrderedDict[int, int] = OrderedDict() def start(self) -> None: if self._active: diff --git a/lib/galaxy/managers/sse.py b/lib/galaxy/managers/sse.py index 78da7ede854..2c83a549e08 100644 --- a/lib/galaxy/managers/sse.py +++ b/lib/galaxy/managers/sse.py @@ -8,12 +8,14 @@ to async SSE endpoint handlers running in the uvicorn event loop. import asyncio import logging from collections import defaultdict -from dataclasses import dataclass -from datetime import datetime -from typing import ( +from collections.abc import ( AsyncIterator, Awaitable, Callable, +) +from dataclasses import dataclass +from datetime import datetime +from typing import ( Optional, ) diff --git a/lib/galaxy/webapps/galaxy/services/events.py b/lib/galaxy/webapps/galaxy/services/events.py index cddc9b7478e..aea3998ac25 100644 --- a/lib/galaxy/webapps/galaxy/services/events.py +++ b/lib/galaxy/webapps/galaxy/services/events.py @@ -7,8 +7,8 @@ configuration. When notifications are disabled the catch-up event is simply skipped; the stream still delivers other push events. """ +from collections.abc import AsyncIterator from typing import ( - AsyncIterator, Optional, ) diff --git a/lib/galaxy/webapps/galaxy/services/notifications.py b/lib/galaxy/webapps/galaxy/services/notifications.py index 74df0ffa691..b040e2b908e 100644 --- a/lib/galaxy/webapps/galaxy/services/notifications.py +++ b/lib/galaxy/webapps/galaxy/services/notifications.py @@ -1,6 +1,6 @@ +from collections.abc import AsyncIterator from datetime import datetime from typing import ( - AsyncIterator, NoReturn, Optional, Union, diff --git a/lib/galaxy_test/base/sse.py b/lib/galaxy_test/base/sse.py index 47ee4172be4..be7b3052bf1 100644 --- a/lib/galaxy_test/base/sse.py +++ b/lib/galaxy_test/base/sse.py @@ -71,7 +71,7 @@ class SSELineListener: self._collected: list[str] = [] self._stop = threading.Event() self._ready = threading.Event() - self._errors: "queue.Queue[BaseException]" = queue.Queue() + self._errors: queue.Queue[BaseException] = queue.Queue() self._thread = threading.Thread(target=self._listen, daemon=True) def start(self) -> None: @@ -130,7 +130,7 @@ class SSELineListener: if self._stop.is_set(): break resp.close() - except BaseException as exc: + except Exception as exc: self._errors.put(exc) # Ensure start() doesn't hang forever on connection failure. self._ready.set() diff --git a/test/integration_selenium/test_notification_sse.py b/test/integration_selenium/test_notification_sse.py index bb39e655bc0..70ad646c0ca 100644 --- a/test/integration_selenium/test_notification_sse.py +++ b/test/integration_selenium/test_notification_sse.py @@ -129,5 +129,7 @@ class TestNotificationSSESeleniumIntegration(SeleniumIntegrationTestCase): self._wait_for_sse_event_after(baseline_ts) # The indicator dot should appear on the bell (within the #activity-notifications element) - self.driver.wait_for_selector_visible("#activity-notifications .indicator", timeout=SSE_EVENT_TIMEOUT_SECONDS * 1000) + self.driver.wait_for_selector_visible( + "#activity-notifications .indicator", timeout=SSE_EVENT_TIMEOUT_SECONDS * 1000 + ) self.screenshot("notification_bell_indicator")