Skip to content

Commit 1654bac

Browse files
committed
fix: add type ignore comments for redis-py Union type compatibility
1 parent 257c962 commit 1654bac

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/agents/extensions/memory/redis_session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ async def ping(self) -> bool:
255255
True if Redis is reachable, False otherwise.
256256
"""
257257
try:
258-
await self._redis.ping()
258+
await self._redis.ping() # type: ignore[misc] # Redis library returns Union[Awaitable[T], T] in async context
259259
return True
260260
except Exception:
261261
return False

tests/extensions/memory/test_redis_session.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,14 +492,14 @@ async def test_external_client_not_closed():
492492
assert len(items) == 1
493493

494494
# Verify client is working before close
495-
assert await shared_client.ping() is True
495+
assert await shared_client.ping() is True # type: ignore[misc] # Redis library returns Union[Awaitable[T], T] in async context
496496

497497
# Close the session
498498
await session.close()
499499

500500
# Verify the shared client is still usable after session.close()
501501
# This would fail if we incorrectly closed the external client
502-
assert await shared_client.ping() is True
502+
assert await shared_client.ping() is True # type: ignore[misc] # Redis library returns Union[Awaitable[T], T] in async context
503503

504504
# Should still be able to use the client for other operations
505505
await shared_client.set("test_key", "test_value")
@@ -781,7 +781,7 @@ async def test_close_method_coverage():
781781
await session1.close()
782782

783783
# Verify external client is still usable
784-
assert await external_client.ping() is True
784+
assert await external_client.ping() is True # type: ignore[misc] # Redis library returns Union[Awaitable[T], T] in async context
785785

786786
# Test 2: Internal client (should be closed)
787787
# Create a session that owns its client

0 commit comments

Comments
 (0)