chore: lint
This commit is contained in:
@@ -410,7 +410,7 @@ def register_tools(mcp: FastMCP, credentials: Any = None) -> None:
|
||||
# Include any x-amz-meta-* custom metadata
|
||||
for header, value in resp.headers.items():
|
||||
if header.lower().startswith("x-amz-meta-"):
|
||||
meta_key = header[len("x-amz-meta-"):]
|
||||
meta_key = header[len("x-amz-meta-") :]
|
||||
metadata[f"meta_{meta_key}"] = value
|
||||
return metadata
|
||||
|
||||
@@ -462,9 +462,7 @@ def register_tools(mcp: FastMCP, credentials: Any = None) -> None:
|
||||
for k, v in sorted_params
|
||||
)
|
||||
|
||||
canonical_request = (
|
||||
f"GET\n{path}\n{canonical_qs}\nhost:{host}\n\nhost\nUNSIGNED-PAYLOAD"
|
||||
)
|
||||
canonical_request = f"GET\n{path}\n{canonical_qs}\nhost:{host}\n\nhost\nUNSIGNED-PAYLOAD"
|
||||
|
||||
string_to_sign = (
|
||||
f"AWS4-HMAC-SHA256\n{amz_date}\n{credential_scope}\n"
|
||||
@@ -476,10 +474,7 @@ def register_tools(mcp: FastMCP, credentials: Any = None) -> None:
|
||||
signing_key, string_to_sign.encode("utf-8"), hashlib.sha256
|
||||
).hexdigest()
|
||||
|
||||
presigned_url = (
|
||||
f"https://{host}{path}?{canonical_qs}"
|
||||
f"&X-Amz-Signature={signature}"
|
||||
)
|
||||
presigned_url = f"https://{host}{path}?{canonical_qs}&X-Amz-Signature={signature}"
|
||||
|
||||
return {
|
||||
"url": presigned_url,
|
||||
|
||||
@@ -53,9 +53,7 @@ def _get(endpoint: str, token: str, params: dict | None = None) -> dict[str, Any
|
||||
|
||||
def _delete(endpoint: str, token: str) -> dict[str, Any]:
|
||||
try:
|
||||
resp = httpx.delete(
|
||||
f"{HUB_API}/{endpoint}", headers=_headers(token), timeout=30.0
|
||||
)
|
||||
resp = httpx.delete(f"{HUB_API}/{endpoint}", headers=_headers(token), timeout=30.0)
|
||||
if resp.status_code == 401:
|
||||
return {"error": "Unauthorized. Check your DOCKER_HUB_TOKEN."}
|
||||
if resp.status_code == 404:
|
||||
|
||||
@@ -14,6 +14,7 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
import time
|
||||
from datetime import UTC
|
||||
from typing import TYPE_CHECKING, Literal
|
||||
|
||||
import httpx
|
||||
@@ -425,9 +426,9 @@ def register_tools(
|
||||
if not query or len(query) > 500:
|
||||
return {"error": "Query must be 1-500 characters"}
|
||||
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
start_date = (datetime.now(timezone.utc) - timedelta(days=days_back)).strftime(
|
||||
start_date = (datetime.now(UTC) - timedelta(days=days_back)).strftime(
|
||||
"%Y-%m-%dT00:00:00.000Z"
|
||||
)
|
||||
|
||||
|
||||
@@ -505,9 +505,7 @@ def register_tools(
|
||||
|
||||
body: dict[str, Any] = {"transition": {"id": transition_id}}
|
||||
if comment:
|
||||
body["update"] = {
|
||||
"comment": [{"add": {"body": _text_to_adf(comment)}}]
|
||||
}
|
||||
body["update"] = {"comment": [{"add": {"body": _text_to_adf(comment)}}]}
|
||||
|
||||
url = f"{_base_url(domain)}/issue/{issue_key}/transitions"
|
||||
data = _request("post", url, email, token, json=body)
|
||||
|
||||
@@ -450,9 +450,15 @@ def register_tools(
|
||||
return {"error": "page_id and content are required"}
|
||||
|
||||
valid_types = {
|
||||
"paragraph", "heading_1", "heading_2", "heading_3",
|
||||
"bulleted_list_item", "numbered_list_item", "to_do",
|
||||
"quote", "callout",
|
||||
"paragraph",
|
||||
"heading_1",
|
||||
"heading_2",
|
||||
"heading_3",
|
||||
"bulleted_list_item",
|
||||
"numbered_list_item",
|
||||
"to_do",
|
||||
"quote",
|
||||
"callout",
|
||||
}
|
||||
if block_type not in valid_types:
|
||||
return {
|
||||
|
||||
@@ -135,9 +135,7 @@ class _SerpAPIClient:
|
||||
"""Get details for a specific patent by searching its ID."""
|
||||
return self._request({"engine": "google_patents", "q": patent_id})
|
||||
|
||||
def scholar_cited_by(
|
||||
self, cites_id: str, num: int = 10, start: int = 0
|
||||
) -> dict[str, Any]:
|
||||
def scholar_cited_by(self, cites_id: str, num: int = 10, start: int = 0) -> dict[str, Any]:
|
||||
"""Get papers that cite a given paper using its cites_id."""
|
||||
return self._request(
|
||||
{
|
||||
@@ -148,9 +146,7 @@ class _SerpAPIClient:
|
||||
}
|
||||
)
|
||||
|
||||
def scholar_profiles(
|
||||
self, query: str, num: int = 10
|
||||
) -> dict[str, Any]:
|
||||
def scholar_profiles(self, query: str, num: int = 10) -> dict[str, Any]:
|
||||
"""Search for Google Scholar author profiles."""
|
||||
return self._request(
|
||||
{
|
||||
@@ -160,9 +156,7 @@ class _SerpAPIClient:
|
||||
}
|
||||
)
|
||||
|
||||
def google_search(
|
||||
self, query: str, num: int = 10, gl: str | None = None
|
||||
) -> dict[str, Any]:
|
||||
def google_search(self, query: str, num: int = 10, gl: str | None = None) -> dict[str, Any]:
|
||||
"""Run a standard Google web search."""
|
||||
params: dict[str, Any] = {
|
||||
"engine": "google",
|
||||
@@ -650,9 +644,7 @@ def register_tools(
|
||||
"affiliations": p.get("affiliations", ""),
|
||||
"email": p.get("email", ""),
|
||||
"cited_by": p.get("cited_by", 0),
|
||||
"interests": [
|
||||
i.get("title", "") for i in p.get("interests", [])
|
||||
],
|
||||
"interests": [i.get("title", "") for i in p.get("interests", [])],
|
||||
"thumbnail": p.get("thumbnail", ""),
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user