Skip to content

Commit 8bded75

Browse files
committed
fix formating and pyright
1 parent 2625f1a commit 8bded75

6 files changed

Lines changed: 24 additions & 20 deletions

File tree

are/simulation/gui/server/graphql/mutation.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import json
99

1010
import strawberry
11-
from strawberry.scalars import JSON
1211

1312
from are.simulation.gui.server.graphql.common import make_async
1413
from are.simulation.gui.server.graphql.subscription import clear_graphql_cache
@@ -18,6 +17,7 @@
1817
)
1918
from are.simulation.types import EventTimeComparator, EventType
2019
from are.simulation.utils import make_serializable
20+
from strawberry.scalars import JSON
2121

2222

2323
@strawberry.type
@@ -53,7 +53,9 @@ def set_scenario(
5353

5454
@strawberry.mutation
5555
@make_async
56-
def set_agent_name(self, agent_id: str | None, session_id: str) -> JSON | None:
56+
def set_agent_name(
57+
self, agent_id: str | None, session_id: str # type: ignore
58+
) -> JSON | None: # type: ignore
5759
"""Set the agent name for a simulation session.
5860
5961
:param agent_id: The unique identifier of the agent to set, or None to clear
@@ -72,8 +74,8 @@ def set_agent_name(self, agent_id: str | None, session_id: str) -> JSON | None:
7274
@strawberry.mutation
7375
@make_async
7476
def set_agent_config(
75-
self, agent_config: JSON | None, session_id: str
76-
) -> JSON | None:
77+
self, agent_config: JSON | None, session_id: str # type: ignore
78+
) -> JSON | None: # type: ignore
7779
"""Set the agent configuration for a simulation session.
7880
7981
:param agent_config: The agent configuration as JSON, or None to clear

are/simulation/gui/server/graphql/query.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import os
99

1010
import strawberry
11-
from strawberry.scalars import JSON
1211

1312
from are.simulation.gui.server.graphql.common import make_async
1413
from are.simulation.gui.server.graphql.types import (
@@ -19,6 +18,7 @@
1918
)
2019
from are.simulation.gui.server.scenarios import GUI_SCENARIOS
2120
from are.simulation.types import CapabilityTag
21+
from strawberry.scalars import JSON
2222

2323

2424
@strawberry.type
@@ -47,15 +47,15 @@ def all_agents(self) -> list[str]:
4747

4848
@strawberry.field
4949
@make_async
50-
def agent_name(self, session_id: str) -> str | None:
50+
def agent_name(self, session_id: str) -> str | None: # type: ignore
5151
if Query.server is None:
5252
raise ValueError("Query.server is not initialized.")
5353
are_simulation_instance = Query.server.get_or_create_are_simulation(session_id)
5454
return are_simulation_instance.agent_name
5555

5656
@strawberry.field
5757
@make_async
58-
def agent_config(self, session_id: str) -> JSON | None:
58+
def agent_config(self, session_id: str) -> JSON | None: # type: ignore
5959
if Query.server is None:
6060
raise ValueError("Query.server is not initialized.")
6161
are_simulation_instance = Query.server.get_or_create_are_simulation(session_id)
@@ -291,7 +291,7 @@ def save_annotated_trace_to_db(
291291

292292
@strawberry.field
293293
@make_async
294-
def get_interactive_scenarios_tree(self) -> JSON | None:
294+
def get_interactive_scenarios_tree(self) -> JSON | None: # type: ignore
295295
"""
296296
Get the interactive scenarios tree from a JSON file if INTERACTIVE_SCENARIOS_TREE environment variable is set.
297297

are/simulation/tests/streaming_utils_test.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
from are.simulation.utils.streaming_utils import (
1515
SequentialExecutor,
16-
stream_pool,
1716
TerminableProcessPoolExecutor,
17+
stream_pool,
1818
)
1919

2020

@@ -303,9 +303,9 @@ def process_with_variable_delay(x):
303303
last_large_pos = max(results.index(x) for x in range(5, 10) if x in results)
304304

305305
# The last large number should come before the first small number
306-
assert (
307-
last_large_pos < first_small_pos
308-
), f"Expected all large numbers to come before small numbers, but got: {results}"
306+
assert last_large_pos < first_small_pos, (
307+
f"Expected all large numbers to come before small numbers, but got: {results}"
308+
)
309309

310310

311311
def test_stream_process_with_kwargs():
@@ -440,7 +440,6 @@ def test_sequential_executor_context_manager():
440440
def test_terminable_process_pool_executor_basic():
441441
"""Test TerminableProcessPoolExecutor basic functionality."""
442442
with TerminableProcessPoolExecutor(max_workers=2) as executor:
443-
444443
future = executor.submit(square, 5)
445444
result = future.result()
446445
assert result == 25
@@ -450,7 +449,6 @@ def test_terminable_process_pool_executor_basic():
450449
def test_terminable_process_pool_executor_termination():
451450
"""Test TerminableProcessPoolExecutor can terminate long-running processes."""
452451
with TerminableProcessPoolExecutor(max_workers=1) as executor:
453-
454452
future = executor.submit(long_running_task, 5)
455453

456454
# Let it start, then terminate

are/simulation/utils/streaming_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
66

7+
from __future__ import annotations
78

89
import concurrent.futures
910
import logging
1011
import multiprocessing
12+
import multiprocessing.context
1113
import os
1214
import signal
1315
import threading
@@ -125,7 +127,9 @@ class TerminableFuture(concurrent.futures.Future):
125127
"""A future that allows termination of the underlying process."""
126128

127129
def __init__(
128-
self, process: multiprocessing.Process, result_queue: multiprocessing.Queue
130+
self,
131+
process: multiprocessing.Process | multiprocessing.context.ForkProcess,
132+
result_queue: multiprocessing.Queue,
129133
):
130134
super().__init__()
131135
self._process = process

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ flake8-tidy-imports==4.11.0
66
flake8==7.1.1
77
hatchling==1.21.1
88
pre-commit==2.21.0
9-
pyright==1.1.399
9+
pyright==1.1.406
1010
pytest==8.3.4
1111
ruff==0.11.5
1212
twine==5.0.0

uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)