chore: bump ruff (#1085)

This commit is contained in:
Marcelo Trylesinski 2025-07-04 10:01:17 +02:00 • committed by GitHub
commit 9301924f44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 56 additions and 57 deletions

View file

@ -81,7 +81,7 @@ class CallbackHandler(BaseHTTPRequestHandler):
<html>
<body>
<h1>Authorization Failed</h1>
<p>Error: {query_params['error'][0]}</p>
<p>Error: {query_params["error"][0]}</p>
<p>You can close this window and return to the terminal.</p>
</body>
</html>

View file

@ -16,7 +16,7 @@ import os
from dataclasses import dataclass
from datetime import datetime, timezone
from pathlib import Path
from typing import Annotated, Self
from typing import Annotated, Self, TypeVar
import asyncpg
import numpy as np
@ -35,6 +35,8 @@ REINFORCEMENT_FACTOR = 1.1
DEFAULT_LLM_MODEL = "openai:gpt-4o"
DEFAULT_EMBEDDING_MODEL = "text-embedding-3-small"
T = TypeVar("T")
mcp = FastMCP(
"memory",
dependencies=[
@ -57,7 +59,7 @@ def cosine_similarity(a: list[float], b: list[float]) -> float:
return np.dot(a_array, b_array) / (np.linalg.norm(a_array) * np.linalg.norm(b_array))
async def do_ai[T](
async def do_ai(
user_prompt: str,
system_prompt: str,
result_type: type[T] | Annotated,

View file

@ -8,7 +8,7 @@ from mcp.server.fastmcp import FastMCP
mcp = FastMCP()
@mcp.tool(description="🌟 A tool that uses various Unicode characters in its description: " "á é í ó ú ñ 漢字 🎉")
@mcp.tool(description="🌟 A tool that uses various Unicode characters in its description: á é í ó ú ñ 漢字 🎉")
def hello_unicode(name: str = "世界", greeting: str = "¡Hola") -> str:
"""
A simple tool that demonstrates Unicode handling in:

View file

@ -89,7 +89,7 @@ class SimpleOAuthProvider(OAuthAuthorizationServerProvider):
}
# Build simple login URL that points to login page
auth_url = f"{self.auth_callback_url}" f"?state={state}" f"&client_id={client.client_id}"
auth_url = f"{self.auth_callback_url}?state={state}&client_id={client.client_id}"
return auth_url
@ -117,7 +117,7 @@ class SimpleOAuthProvider(OAuthAuthorizationServerProvider):
<p><strong>Username:</strong> demo_user<br>
<strong>Password:</strong> demo_password</p>
<form action="{self.server_url.rstrip('/')}/login/callback" method="post">
<form action="{self.server_url.rstrip("/")}/login/callback" method="post">
<input type="hidden" name="state" value="{state}">
<div class="form-group">
<label>Username:</label>

View file

@ -51,7 +51,7 @@ def main(
for i in range(count):
await ctx.session.send_log_message(
level="info",
data=f"Notification {i+1}/{count} from caller: {caller}",
data=f"Notification {i + 1}/{count} from caller: {caller}",
logger="notification_stream",
related_request_id=ctx.request_id,
)

View file

@ -55,7 +55,7 @@ def main(
for i in range(count):
# Include more detailed message for resumability demonstration
notification_msg = (
f"[{i+1}/{count}] Event from '{caller}' - "
f"[{i + 1}/{count}] Event from '{caller}' - "
f"Use Last-Event-ID to resume if disconnected"
)
await ctx.session.send_log_message(
@ -69,7 +69,7 @@ def main(
# - nowhere (if GET request isn't supported)
related_request_id=ctx.request_id,
)
logger.debug(f"Sent notification {i+1}/{count} for caller: {caller}")
logger.debug(f"Sent notification {i + 1}/{count} for caller: {caller}")
if i < count - 1: # Don't wait after the last notification
await anyio.sleep(interval)