From 594d36ac6667138e5ef0f807f448c22c33c137d1 Mon Sep 17 00:00:00 2001 From: Tai Sakuma Date: Wed, 25 Sep 2024 11:35:45 -0400 Subject: [PATCH] Format code with `ruff` --- .../rev_4dc6a93dfed8/strategies/st_script.py | 2 +- .../rev_4dc6a93dfed8/strategies/st_trace.py | 2 +- .../rev_5a08750d6760/strategies/st_trace.py | 2 +- .../rev_f3edea6dbde2/strategies/st_script.py | 2 +- .../rev_f3edea6dbde2/strategies/st_trace.py | 2 +- .../rev_f9a742bb2297/strategies/st_trace.py | 2 +- .../models/strategies/st_script.py | 2 +- .../models/strategies/st_trace.py | 2 +- src/nextline_rdb/schema/nodes/run_node.py | 20 +++++++++---------- .../schema/nodes/trace_call_node.py | 6 +++--- src/nextline_rdb/schema/nodes/trace_node.py | 12 +++++------ src/nextline_rdb/utils/strategies/misc.py | 3 +-- tests/schema/queries/test_run.py | 2 +- 13 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/nextline_rdb/alembic/models/rev_4dc6a93dfed8/strategies/st_script.py b/src/nextline_rdb/alembic/models/rev_4dc6a93dfed8/strategies/st_script.py index 5c516fe..75d7ef5 100644 --- a/src/nextline_rdb/alembic/models/rev_4dc6a93dfed8/strategies/st_script.py +++ b/src/nextline_rdb/alembic/models/rev_4dc6a93dfed8/strategies/st_script.py @@ -2,7 +2,7 @@ from hypothesis import strategies as st -from nextline_rdb.utils.strategies import st_python_scripts, st_none_or +from nextline_rdb.utils.strategies import st_none_or, st_python_scripts from .. import Script diff --git a/src/nextline_rdb/alembic/models/rev_4dc6a93dfed8/strategies/st_trace.py b/src/nextline_rdb/alembic/models/rev_4dc6a93dfed8/strategies/st_trace.py index 0b7d235..00f7646 100644 --- a/src/nextline_rdb/alembic/models/rev_4dc6a93dfed8/strategies/st_trace.py +++ b/src/nextline_rdb/alembic/models/rev_4dc6a93dfed8/strategies/st_trace.py @@ -71,7 +71,7 @@ def st_thread_task_no() -> st.SearchStrategy[tuple[int, int | None]]: def sort_thread_task_nos( - thread_task_nos: Iterable[tuple[int, int | None]] + thread_task_nos: Iterable[tuple[int, int | None]], ) -> list[tuple[int, int | None]]: return sorted(thread_task_nos, key=lambda x: (x[0], x[1] or 0)) diff --git a/src/nextline_rdb/alembic/models/rev_5a08750d6760/strategies/st_trace.py b/src/nextline_rdb/alembic/models/rev_5a08750d6760/strategies/st_trace.py index 0b7d235..00f7646 100644 --- a/src/nextline_rdb/alembic/models/rev_5a08750d6760/strategies/st_trace.py +++ b/src/nextline_rdb/alembic/models/rev_5a08750d6760/strategies/st_trace.py @@ -71,7 +71,7 @@ def st_thread_task_no() -> st.SearchStrategy[tuple[int, int | None]]: def sort_thread_task_nos( - thread_task_nos: Iterable[tuple[int, int | None]] + thread_task_nos: Iterable[tuple[int, int | None]], ) -> list[tuple[int, int | None]]: return sorted(thread_task_nos, key=lambda x: (x[0], x[1] or 0)) diff --git a/src/nextline_rdb/alembic/models/rev_f3edea6dbde2/strategies/st_script.py b/src/nextline_rdb/alembic/models/rev_f3edea6dbde2/strategies/st_script.py index 5c516fe..75d7ef5 100644 --- a/src/nextline_rdb/alembic/models/rev_f3edea6dbde2/strategies/st_script.py +++ b/src/nextline_rdb/alembic/models/rev_f3edea6dbde2/strategies/st_script.py @@ -2,7 +2,7 @@ from hypothesis import strategies as st -from nextline_rdb.utils.strategies import st_python_scripts, st_none_or +from nextline_rdb.utils.strategies import st_none_or, st_python_scripts from .. import Script diff --git a/src/nextline_rdb/alembic/models/rev_f3edea6dbde2/strategies/st_trace.py b/src/nextline_rdb/alembic/models/rev_f3edea6dbde2/strategies/st_trace.py index d404d22..268f062 100644 --- a/src/nextline_rdb/alembic/models/rev_f3edea6dbde2/strategies/st_trace.py +++ b/src/nextline_rdb/alembic/models/rev_f3edea6dbde2/strategies/st_trace.py @@ -70,7 +70,7 @@ def st_thread_task_no() -> st.SearchStrategy[tuple[int, int | None]]: def sort_thread_task_nos( - thread_task_nos: Iterable[tuple[int, int | None]] + thread_task_nos: Iterable[tuple[int, int | None]], ) -> list[tuple[int, int | None]]: return sorted(thread_task_nos, key=lambda x: (x[0], x[1] or 0)) diff --git a/src/nextline_rdb/alembic/models/rev_f9a742bb2297/strategies/st_trace.py b/src/nextline_rdb/alembic/models/rev_f9a742bb2297/strategies/st_trace.py index 0b7d235..00f7646 100644 --- a/src/nextline_rdb/alembic/models/rev_f9a742bb2297/strategies/st_trace.py +++ b/src/nextline_rdb/alembic/models/rev_f9a742bb2297/strategies/st_trace.py @@ -71,7 +71,7 @@ def st_thread_task_no() -> st.SearchStrategy[tuple[int, int | None]]: def sort_thread_task_nos( - thread_task_nos: Iterable[tuple[int, int | None]] + thread_task_nos: Iterable[tuple[int, int | None]], ) -> list[tuple[int, int | None]]: return sorted(thread_task_nos, key=lambda x: (x[0], x[1] or 0)) diff --git a/src/nextline_rdb/models/strategies/st_script.py b/src/nextline_rdb/models/strategies/st_script.py index 5c516fe..75d7ef5 100644 --- a/src/nextline_rdb/models/strategies/st_script.py +++ b/src/nextline_rdb/models/strategies/st_script.py @@ -2,7 +2,7 @@ from hypothesis import strategies as st -from nextline_rdb.utils.strategies import st_python_scripts, st_none_or +from nextline_rdb.utils.strategies import st_none_or, st_python_scripts from .. import Script diff --git a/src/nextline_rdb/models/strategies/st_trace.py b/src/nextline_rdb/models/strategies/st_trace.py index 8d2e485..4efb891 100644 --- a/src/nextline_rdb/models/strategies/st_trace.py +++ b/src/nextline_rdb/models/strategies/st_trace.py @@ -80,7 +80,7 @@ def st_thread_task_no() -> st.SearchStrategy[tuple[int, int | None]]: def sort_thread_task_nos( - thread_task_nos: Iterable[tuple[int, int | None]] + thread_task_nos: Iterable[tuple[int, int | None]], ) -> list[tuple[int, int | None]]: return sorted(thread_task_nos, key=lambda x: (x[0], x[1] or 0)) diff --git a/src/nextline_rdb/schema/nodes/run_node.py b/src/nextline_rdb/schema/nodes/run_node.py index 6123e0e..7fc6547 100644 --- a/src/nextline_rdb/schema/nodes/run_node.py +++ b/src/nextline_rdb/schema/nodes/run_node.py @@ -137,21 +137,21 @@ class RunNode: script: Optional[str] exception: Optional[str] - traces: Connection[ - Annotated['TraceNode', strawberry.lazy('.trace_node')] - ] = strawberry.field(resolver=_resolve_traces) - + traces: Connection[Annotated['TraceNode', strawberry.lazy('.trace_node')]] = ( + strawberry.field(resolver=_resolve_traces) + ) + trace_calls: Connection[ Annotated['TraceCallNode', strawberry.lazy('.trace_call_node')] ] = strawberry.field(resolver=_resolve_trace_calls) - prompts: Connection[ - Annotated['PromptNode', strawberry.lazy('.prompt_node')] - ] = strawberry.field(resolver=_resolve_prompts) + prompts: Connection[Annotated['PromptNode', strawberry.lazy('.prompt_node')]] = ( + strawberry.field(resolver=_resolve_prompts) + ) - stdouts: Connection[ - Annotated['StdoutNode', strawberry.lazy('.stdout_node')] - ] = strawberry.field(resolver=_resolve_stdouts) + stdouts: Connection[Annotated['StdoutNode', strawberry.lazy('.stdout_node')]] = ( + strawberry.field(resolver=_resolve_stdouts) + ) @classmethod def from_model(cls: type['RunNode'], model: Run) -> 'RunNode': diff --git a/src/nextline_rdb/schema/nodes/trace_call_node.py b/src/nextline_rdb/schema/nodes/trace_call_node.py index 6ba1013..7a9d1e8 100644 --- a/src/nextline_rdb/schema/nodes/trace_call_node.py +++ b/src/nextline_rdb/schema/nodes/trace_call_node.py @@ -72,9 +72,9 @@ def trace(self) -> Annotated['TraceNode', strawberry.lazy('.trace_node')]: return TraceNode.from_model(self._model.trace) - prompts: Connection[ - Annotated['PromptNode', strawberry.lazy('.prompt_node')] - ] = strawberry.field(resolver=_resolve_prompts) + prompts: Connection[Annotated['PromptNode', strawberry.lazy('.prompt_node')]] = ( + strawberry.field(resolver=_resolve_prompts) + ) @classmethod def from_model( diff --git a/src/nextline_rdb/schema/nodes/trace_node.py b/src/nextline_rdb/schema/nodes/trace_node.py index 734d59f..df4b561 100644 --- a/src/nextline_rdb/schema/nodes/trace_node.py +++ b/src/nextline_rdb/schema/nodes/trace_node.py @@ -90,13 +90,13 @@ def run(self) -> Annotated['RunNode', strawberry.lazy('.run_node')]: return RunNode.from_model(self._model.run) - prompts: Connection[ - Annotated['PromptNode', strawberry.lazy('.prompt_node')] - ] = strawberry.field(resolver=_resolve_prompts) + prompts: Connection[Annotated['PromptNode', strawberry.lazy('.prompt_node')]] = ( + strawberry.field(resolver=_resolve_prompts) + ) - stdouts: Connection[ - Annotated['StdoutNode', strawberry.lazy('.stdout_node')] - ] = strawberry.field(resolver=_resolve_stdouts) + stdouts: Connection[Annotated['StdoutNode', strawberry.lazy('.stdout_node')]] = ( + strawberry.field(resolver=_resolve_stdouts) + ) @classmethod def from_model(cls: type['TraceNode'], model: db_models.Trace) -> 'TraceNode': diff --git a/src/nextline_rdb/utils/strategies/misc.py b/src/nextline_rdb/utils/strategies/misc.py index db601bc..62aa489 100644 --- a/src/nextline_rdb/utils/strategies/misc.py +++ b/src/nextline_rdb/utils/strategies/misc.py @@ -14,8 +14,7 @@ class StMinMaxValuesFactory(Protocol[T]): def __call__( self, *, min_value: Optional[T] = None, max_value: Optional[T] = None - ) -> st.SearchStrategy[T]: - ... + ) -> st.SearchStrategy[T]: ... def st_none_or(st_: st.SearchStrategy[T]) -> st.SearchStrategy[Optional[T]]: diff --git a/tests/schema/queries/test_run.py b/tests/schema/queries/test_run.py index c82b5e0..e6645d9 100644 --- a/tests/schema/queries/test_run.py +++ b/tests/schema/queries/test_run.py @@ -67,7 +67,7 @@ async def test_run(data: st.DataObject) -> None: QUERY_RDB_RUN, variable_values=variables, context_value={'db': db} ) note(f'resp: {resp}') - + assert isinstance(resp, ExecutionResult) assert resp.data