Skip to content

Commit

Permalink
Format code with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiSakuma committed Sep 25, 2024
1 parent d575f36 commit 594d36a
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion src/nextline_rdb/models/strategies/st_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/nextline_rdb/models/strategies/st_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
20 changes: 10 additions & 10 deletions src/nextline_rdb/schema/nodes/run_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
6 changes: 3 additions & 3 deletions src/nextline_rdb/schema/nodes/trace_call_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
12 changes: 6 additions & 6 deletions src/nextline_rdb/schema/nodes/trace_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
3 changes: 1 addition & 2 deletions src/nextline_rdb/utils/strategies/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]:
Expand Down
2 changes: 1 addition & 1 deletion tests/schema/queries/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 594d36a

Please sign in to comment.