Skip to content

Commit 89c9252

Browse files
committed
Change union declaration to be compatible with Python 3.10
1 parent 9f902f7 commit 89c9252

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/tools/hash.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Union
2+
13
import numpy as np
24
from redis.exceptions import RedisError
35

@@ -7,7 +9,7 @@
79

810
@mcp.tool()
911
async def hset(
10-
name: str, key: str, value: str | int | float, expire_seconds: int = None
12+
name: str, key: str, value: Union[str, int, float], expire_seconds: int = None
1113
) -> str:
1214
"""Set a field in a hash stored at key with an optional expiration time.
1315

tests/test_integration.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def _create_server_process(project_root):
3535
stdout=subprocess.PIPE,
3636
stderr=subprocess.PIPE,
3737
text=True,
38-
encoding='utf-8',
39-
errors='replace', # Replace invalid characters instead of failing
38+
encoding="utf-8",
39+
errors="replace", # Replace invalid characters instead of failing
4040
env={"REDIS_HOST": "localhost", "REDIS_PORT": "6379", **dict(os.environ)},
4141
)
4242

@@ -102,13 +102,15 @@ def test_server_handles_unicode_on_windows(self, server_process):
102102
# If there's output available, try to read it
103103
if ready:
104104
try:
105-
output = server_process.stdout.read(1) # Read just one character
105+
output = server_process.stdout.read(
106+
1
107+
) # Read just one character
106108
# If we get here, Unicode handling is working
107109
assert True
108110
except UnicodeDecodeError:
109111
pytest.fail("Unicode decode error occurred")
110112

111-
except Exception as e:
113+
except Exception:
112114
# If any other error occurs, that's fine - we're just testing Unicode handling
113115
pass
114116

0 commit comments

Comments
 (0)