mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-29 07:14:20 +00:00
chore: fix ruff errors generated by new pre-commit hook
Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
This commit is contained in:
parent
562e4e54fb
commit
261362799b
2 changed files with 3 additions and 8 deletions
|
@ -6,12 +6,9 @@
|
||||||
|
|
||||||
from collections.abc import AsyncGenerator
|
from collections.abc import AsyncGenerator
|
||||||
from contextvars import ContextVar
|
from contextvars import ContextVar
|
||||||
from typing import TypeVar
|
|
||||||
|
|
||||||
T = TypeVar("T")
|
|
||||||
|
|
||||||
|
|
||||||
def preserve_contexts_async_generator(
|
def preserve_contexts_async_generator[T](
|
||||||
gen: AsyncGenerator[T, None], context_vars: list[ContextVar]
|
gen: AsyncGenerator[T, None], context_vars: list[ContextVar]
|
||||||
) -> AsyncGenerator[T, None]:
|
) -> AsyncGenerator[T, None]:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -9,14 +9,12 @@ import inspect
|
||||||
import json
|
import json
|
||||||
from collections.abc import AsyncGenerator, Callable
|
from collections.abc import AsyncGenerator, Callable
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Any, TypeVar
|
from typing import Any
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from llama_stack.models.llama.datatypes import Primitive
|
from llama_stack.models.llama.datatypes import Primitive
|
||||||
|
|
||||||
T = TypeVar("T")
|
|
||||||
|
|
||||||
|
|
||||||
def serialize_value(value: Any) -> Primitive:
|
def serialize_value(value: Any) -> Primitive:
|
||||||
return str(_prepare_for_json(value))
|
return str(_prepare_for_json(value))
|
||||||
|
@ -44,7 +42,7 @@ def _prepare_for_json(value: Any) -> str:
|
||||||
return str(value)
|
return str(value)
|
||||||
|
|
||||||
|
|
||||||
def trace_protocol(cls: type[T]) -> type[T]:
|
def trace_protocol[T](cls: type[T]) -> type[T]:
|
||||||
"""
|
"""
|
||||||
A class decorator that automatically traces all methods in a protocol/base class
|
A class decorator that automatically traces all methods in a protocol/base class
|
||||||
and its inheriting classes.
|
and its inheriting classes.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue