From 7d9a760e590da29deb7a92e95a71b3e960fa29cf Mon Sep 17 00:00:00 2001 From: elroy-bot Date: Sat, 7 Mar 2026 15:34:30 -0800 Subject: [PATCH] linter --- elroy/api/main.py | 2 +- elroy/llm/stream_parser.py | 4 ++-- elroy/repository/context_messages/operations.py | 2 +- elroy/repository/recall/queries.py | 2 +- elroy/utils/utils.py | 2 +- pyproject.toml | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/elroy/api/main.py b/elroy/api/main.py index 7002a845..99421b5d 100644 --- a/elroy/api/main.py +++ b/elroy/api/main.py @@ -53,7 +53,7 @@ P = ParamSpec("P") -def db(f: Callable[P, T]) -> Callable[P, T]: +def db[**P, T](f: Callable[P, T]) -> Callable[P, T]: """Decorator to wrap non-generator function calls with database session context""" @wraps(f) diff --git a/elroy/llm/stream_parser.py b/elroy/llm/stream_parser.py index 1b7a53af..43c9d372 100644 --- a/elroy/llm/stream_parser.py +++ b/elroy/llm/stream_parser.py @@ -3,7 +3,7 @@ from abc import ABC, abstractmethod from collections.abc import Generator, Iterator from dataclasses import dataclass -from typing import Generic, TypeVar +from typing import TypeVar from litellm.types.utils import Delta, ModelResponse from pydantic import BaseModel @@ -84,7 +84,7 @@ class TagSet: T = TypeVar("T", bound=BaseModel) -class TextProcessor(ABC, Generic[T]): +class TextProcessor[T: BaseModel](ABC): tags: list[TagSet] def __init__(self): diff --git a/elroy/repository/context_messages/operations.py b/elroy/repository/context_messages/operations.py index 462dde2a..e9c632ca 100644 --- a/elroy/repository/context_messages/operations.py +++ b/elroy/repository/context_messages/operations.py @@ -86,7 +86,7 @@ def replace_context_messages(ctx: ElroyContext, messages: Iterable[ContextMessag T = TypeVar("T") -def retry_on_integrity_error(fn: Callable[..., T]) -> Callable[..., T]: +def retry_on_integrity_error[T](fn: Callable[..., T]) -> Callable[..., T]: @wraps(fn) def wrapper(ctx: ElroyContext, *args: Any, **kwargs: Any) -> T: max_retries = 3 diff --git a/elroy/repository/recall/queries.py b/elroy/repository/recall/queries.py index 273b0906..970d9ca2 100644 --- a/elroy/repository/recall/queries.py +++ b/elroy/repository/recall/queries.py @@ -42,7 +42,7 @@ def is_in_context(context_messages: Iterable[ContextMessage], memory: Embeddable @tracer.chain -def query_vector( +def query_vector[T: EmbeddableSqlModel]( table: type[T], ctx: ElroyContext, query: list[float], diff --git a/elroy/utils/utils.py b/elroy/utils/utils.py index 1e3996d8..26aad741 100644 --- a/elroy/utils/utils.py +++ b/elroy/utils/utils.py @@ -42,7 +42,7 @@ def first_or_none(x: Union[Iterator[T], Iterable[T]]) -> Optional[T]: # noqa raise ValueError(f"Expected an iterable or iterator, got {x}") -def last_or_none(iterable: Iterator[T]) -> T | None: +def last_or_none[T](iterable: Iterator[T]) -> T | None: return next(reversed(list(iterable)), None) diff --git a/pyproject.toml b/pyproject.toml index b9f6588e..d5d4b001 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,7 +75,7 @@ elroy = "elroy.cli.main:app" [tool.ruff] line-length = 140 -target-version = "py311" +target-version = "py312" [tool.ruff.lint] select = [ @@ -100,7 +100,7 @@ quote-style = "double" indent-style = "space" [tool.ty.environment] -python-version = "3.11" +python-version = "3.12" [tool.ty.src] include = ["elroy/**/*.py", "tests/**/*.py"]