Add "High Value" Ruff Rules (#2255)

* Safe Fixes from ruff

* Fix remaining issues

* lint/check

* Fix mysterious ty check errors

* small cleanup

* pr fixes
This commit is contained in:
William Easton 2025-10-26 09:20:31 -05:00 committed by GitHub
commit 9d4c378e1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 340 additions and 333 deletions

View file

@ -7,14 +7,14 @@ from ._read import fetch_notifications, fetch_timeline, search_for_posts
from ._social import follow_user_by_handle, like_post_by_uri, repost_by_uri
__all__ = [
"get_client",
"get_profile_info",
"create_post",
"create_thread",
"fetch_timeline",
"search_for_posts",
"fetch_notifications",
"fetch_timeline",
"follow_user_by_handle",
"get_client",
"get_profile_info",
"like_post_by_uri",
"repost_by_uri",
"search_for_posts",
]

View file

@ -1,3 +1,9 @@
# /// script
# dependencies = ["aiohttp", "fastmcp"]
# ///
# uv pip install aiohttp fastmcp
import aiohttp
from fastmcp.server import FastMCP

View file

@ -19,7 +19,7 @@ from typing import Annotated, Any, Self
import asyncpg
import numpy as np
from openai import AsyncOpenAI
from pgvector.asyncpg import register_vector # Import register_vector
from pgvector.asyncpg import register_vector
from pydantic import BaseModel, Field
from pydantic_ai import Agent
@ -149,7 +149,9 @@ class MemoryNode(BaseModel):
)
self.importance += other.importance
self.access_count += other.access_count
self.embedding = [(a + b) / 2 for a, b in zip(self.embedding, other.embedding)]
self.embedding = [
(a + b) / 2 for a, b in zip(self.embedding, other.embedding, strict=True)
]
self.summary = await do_ai(
self.content, "Summarize the following text concisely.", str, deps
)
@ -281,9 +283,9 @@ async def display_memory_tree(deps: Deps) -> str:
@mcp.tool
async def remember(
contents: list[str] = Field(
description="List of observations or memories to store"
),
contents: Annotated[
list[str], Field(description="List of observations or memories to store")
],
):
deps = Deps(openai=AsyncOpenAI(), pool=await get_db_pool())
try: