From c87432a5fe38a1dc21ceb89a84c550adfe784d81 Mon Sep 17 00:00:00 2001 From: Tucker Date: Thu, 21 Dec 2023 14:07:02 -0500 Subject: [PATCH] Make format. --- envision/__init__.py | 2 +- envision/client.py | 2 +- smarts/benchmark/entrypoints/benchmark_runner_v0.py | 2 +- smarts/core/argoverse_map.py | 2 +- smarts/core/controllers/lane_following_controller.py | 6 +++++- smarts/core/local_traffic_provider.py | 6 +++++- smarts/core/opendrive_road_network.py | 2 +- smarts/core/scenario.py | 4 ++-- smarts/core/sensors/local_sensor_resolver.py | 2 +- smarts/core/sensors/parallel_sensor_resolver.py | 2 +- smarts/core/smarts.py | 2 +- smarts/core/sumo_road_network.py | 2 +- smarts/core/trap_manager.py | 2 +- smarts/core/utils/__init__.py | 6 +++--- smarts/core/utils/adapters/ego_centric_adapters.py | 2 +- smarts/core/vehicle.py | 2 +- smarts/core/waymo_map.py | 6 +++--- smarts/env/tests/test_determinism.py | 2 +- smarts/ray/sensors/ray_sensor_resolver.py | 2 +- smarts/sstudio/__init__.py | 2 +- smarts/sstudio/generators.py | 2 +- smarts/sstudio/genhistories.py | 2 +- smarts/sstudio/genscenario.py | 2 +- 23 files changed, 36 insertions(+), 28 deletions(-) diff --git a/envision/__init__.py b/envision/__init__.py index c27aeffa42..ecd80fe7ac 100644 --- a/envision/__init__.py +++ b/envision/__init__.py @@ -22,4 +22,4 @@ from . import etypes as types -sys.modules[f"{__name__}.{types=}".partition('=')[0]] = types +sys.modules[f"{__name__}.{types=}".partition("=")[0]] = types diff --git a/envision/client.py b/envision/client.py index 37b388adfa..9546271c1e 100644 --- a/envision/client.py +++ b/envision/client.py @@ -35,8 +35,8 @@ from envision import etypes from envision.client_config import EnvisionStateFilter from envision.data_formatter import EnvisionDataFormatter, EnvisionDataFormatterArgs -from smarts.core.utils.file import unpack from smarts.core.utils.core_logging import suppress_websocket +from smarts.core.utils.file import unpack @dataclass diff --git a/smarts/benchmark/entrypoints/benchmark_runner_v0.py b/smarts/benchmark/entrypoints/benchmark_runner_v0.py index 1bf7c05c84..0068a80c2e 100644 --- a/smarts/benchmark/entrypoints/benchmark_runner_v0.py +++ b/smarts/benchmark/entrypoints/benchmark_runner_v0.py @@ -31,8 +31,8 @@ from smarts.benchmark.driving_smarts import load_config from smarts.core import config -from smarts.core.utils.import_utils import import_module_from_file from smarts.core.utils.core_logging import suppress_output +from smarts.core.utils.import_utils import import_module_from_file from smarts.env.gymnasium.wrappers.metric.formula import FormulaBase, Score from smarts.env.gymnasium.wrappers.metric.metrics import Metrics from smarts.env.gymnasium.wrappers.metric.types import Record diff --git a/smarts/core/argoverse_map.py b/smarts/core/argoverse_map.py index 60b1dcd751..12eb039e16 100644 --- a/smarts/core/argoverse_map.py +++ b/smarts/core/argoverse_map.py @@ -33,13 +33,13 @@ from smarts.core.lanepoints import LanePoint, LanePoints, LinkedLanePoint from smarts.core.road_map import RoadMap, RoadMapWithCaches, Waypoint from smarts.core.route_cache import RouteWithCache -from smarts.core.utils.glb import make_map_glb, make_road_line_glb from smarts.core.utils.core_math import ( inplace_unwrap, line_intersect_vectorized, radians_to_vec, vec_2d, ) +from smarts.core.utils.glb import make_map_glb, make_road_line_glb from smarts.sstudio.sstypes import MapSpec try: diff --git a/smarts/core/controllers/lane_following_controller.py b/smarts/core/controllers/lane_following_controller.py index 80ea026cf5..bf2983c0c8 100644 --- a/smarts/core/controllers/lane_following_controller.py +++ b/smarts/core/controllers/lane_following_controller.py @@ -25,7 +25,11 @@ from smarts.core.controllers.trajectory_tracking_controller import ( TrajectoryTrackingController, ) -from smarts.core.utils.core_math import lerp, low_pass_filter, min_angles_difference_signed +from smarts.core.utils.core_math import ( + lerp, + low_pass_filter, + min_angles_difference_signed, +) METER_PER_SECOND_TO_KM_PER_HR = 3.6 diff --git a/smarts/core/local_traffic_provider.py b/smarts/core/local_traffic_provider.py index 4e9e47bd15..751dd91eb2 100644 --- a/smarts/core/local_traffic_provider.py +++ b/smarts/core/local_traffic_provider.py @@ -44,13 +44,17 @@ from .scenario import Scenario from .signals import SignalLightState, SignalState from .traffic_provider import TrafficProvider +from .utils.core_math import ( + min_angles_difference_signed, + radians_to_vec, + vec_to_radians, +) from .utils.kinematics import ( distance_covered, stopping_distance, stopping_time, time_to_cover, ) -from .utils.core_math import min_angles_difference_signed, radians_to_vec, vec_to_radians from .vehicle import VEHICLE_CONFIGS, VehicleState MAX_IMPATIENCE = 3.0 diff --git a/smarts/core/opendrive_road_network.py b/smarts/core/opendrive_road_network.py index 2c355afcf4..35b74f3413 100644 --- a/smarts/core/opendrive_road_network.py +++ b/smarts/core/opendrive_road_network.py @@ -75,7 +75,6 @@ from smarts.core.road_map import RoadMap, RoadMapWithCaches, Waypoint from smarts.core.route_cache import RouteWithCache -from smarts.core.utils.key_wrapper import KeyWrapper from smarts.core.utils.core_math import ( CubicPolynomial, constrain_angle, @@ -85,6 +84,7 @@ radians_to_vec, vec_2d, ) +from smarts.core.utils.key_wrapper import KeyWrapper from smarts.sstudio.sstypes import MapSpec from .coordinates import BoundingBox, Heading, Point, Pose, RefLinePoint diff --git a/smarts/core/scenario.py b/smarts/core/scenario.py index f46fa6dfa0..4fc06296c6 100644 --- a/smarts/core/scenario.py +++ b/smarts/core/scenario.py @@ -59,13 +59,13 @@ ) from smarts.core.road_map import RoadMap from smarts.core.traffic_history import TrafficHistory -from smarts.core.utils.file import make_dir_in_smarts_log_dir, path2hash -from smarts.core.utils.id import SocialAgentId from smarts.core.utils.core_math import ( combination_pairs_with_unique_indices, radians_to_vec, vec_to_radians, ) +from smarts.core.utils.file import make_dir_in_smarts_log_dir, path2hash +from smarts.core.utils.id import SocialAgentId from smarts.sstudio import sstypes as sstudio_types from smarts.sstudio.sstypes import EntryTactic, MapSpec from smarts.sstudio.sstypes import Via as SSVia diff --git a/smarts/core/sensors/local_sensor_resolver.py b/smarts/core/sensors/local_sensor_resolver.py index c654f61372..7b4e678254 100644 --- a/smarts/core/sensors/local_sensor_resolver.py +++ b/smarts/core/sensors/local_sensor_resolver.py @@ -25,8 +25,8 @@ from smarts.core.sensors import SensorResolver, Sensors from smarts.core.simulation_frame import SimulationFrame from smarts.core.simulation_local_constants import SimulationLocalConstants -from smarts.core.utils.file import replace from smarts.core.utils.core_logging import timeit +from smarts.core.utils.file import replace logger = logging.getLogger(__name__) diff --git a/smarts/core/sensors/parallel_sensor_resolver.py b/smarts/core/sensors/parallel_sensor_resolver.py index ba76ecc711..39e51c20f0 100644 --- a/smarts/core/sensors/parallel_sensor_resolver.py +++ b/smarts/core/sensors/parallel_sensor_resolver.py @@ -33,8 +33,8 @@ from smarts.core.sensors import SensorResolver, Sensors from smarts.core.simulation_frame import SimulationFrame from smarts.core.simulation_local_constants import SimulationLocalConstants -from smarts.core.utils.file import replace from smarts.core.utils.core_logging import timeit +from smarts.core.utils.file import replace logger = logging.getLogger(__name__) diff --git a/smarts/core/smarts.py b/smarts/core/smarts.py index eda23490c3..a6eaffbbc5 100644 --- a/smarts/core/smarts.py +++ b/smarts/core/smarts.py @@ -82,8 +82,8 @@ from .traffic_provider import TrafficProvider from .trap_manager import TrapManager from .utils import pybullet -from .utils.id import Id from .utils.core_math import rounder_for_dt +from .utils.id import Id from .utils.pybullet import bullet_client as bc from .vehicle import Vehicle from .vehicle_index import VehicleIndex diff --git a/smarts/core/sumo_road_network.py b/smarts/core/sumo_road_network.py index 25a7d5e9f2..d79df24cc2 100644 --- a/smarts/core/sumo_road_network.py +++ b/smarts/core/sumo_road_network.py @@ -36,9 +36,9 @@ from .lanepoints import LanePoint, LanePoints, LinkedLanePoint from .road_map import RoadMap, Waypoint from .route_cache import RouteWithCache +from .utils.core_math import inplace_unwrap, radians_to_vec, vec_2d from .utils.geometry import buffered_shape from .utils.glb import make_map_glb, make_road_line_glb -from .utils.core_math import inplace_unwrap, radians_to_vec, vec_2d from smarts.core.utils.sumo import sumolib # isort:skip from sumolib.net.edge import Edge # isort:skip diff --git a/smarts/core/trap_manager.py b/smarts/core/trap_manager.py index 0295a64bd9..0a00799ff9 100644 --- a/smarts/core/trap_manager.py +++ b/smarts/core/trap_manager.py @@ -29,8 +29,8 @@ from smarts.core.condition_state import ConditionState from smarts.core.coordinates import Point as MapPoint from smarts.core.plan import Mission, Plan, Start, default_entry_tactic -from smarts.core.utils.file import replace from smarts.core.utils.core_math import clip, squared_dist +from smarts.core.utils.file import replace from smarts.core.vehicle import Vehicle from smarts.sstudio.sstypes import MapZone, PositionalZone, TrapEntryTactic diff --git a/smarts/core/utils/__init__.py b/smarts/core/utils/__init__.py index 27407629d0..087eb556ff 100644 --- a/smarts/core/utils/__init__.py +++ b/smarts/core/utils/__init__.py @@ -20,8 +20,8 @@ import sys -from . import core_math as math from . import core_logging as logging +from . import core_math as math -sys.modules[f"{__name__}.{math=}".partition('=')[0]] = math -sys.modules[f"{__name__}.{logging=}".partition('=')[0]] = logging \ No newline at end of file +sys.modules[f"{__name__}.{math=}".partition("=")[0]] = math +sys.modules[f"{__name__}.{logging=}".partition("=")[0]] = logging diff --git a/smarts/core/utils/adapters/ego_centric_adapters.py b/smarts/core/utils/adapters/ego_centric_adapters.py index a0d7316128..f10b0bc1d1 100644 --- a/smarts/core/utils/adapters/ego_centric_adapters.py +++ b/smarts/core/utils/adapters/ego_centric_adapters.py @@ -28,12 +28,12 @@ from smarts.core.coordinates import Heading from smarts.core.observations import Observation, ViaPoint from smarts.core.plan import PositionalGoal, Via -from smarts.core.utils.file import replace as _replace from smarts.core.utils.core_math import ( position_to_ego_frame, world_position_from_ego_frame, wrap_value, ) +from smarts.core.utils.file import replace as _replace def ego_centric_observation_adapter(obs: Observation, *args: Any, **kwargs: Any) -> Any: diff --git a/smarts/core/vehicle.py b/smarts/core/vehicle.py index 94658b964c..9aca717f4b 100644 --- a/smarts/core/vehicle.py +++ b/smarts/core/vehicle.py @@ -50,8 +50,8 @@ ViaSensor, WaypointsSensor, ) -from .utils.custom_exceptions import RendererException from .utils.core_math import rotate_cw_around_point +from .utils.custom_exceptions import RendererException from .vehicle_state import VEHICLE_CONFIGS, VehicleConfig, VehicleState diff --git a/smarts/core/waymo_map.py b/smarts/core/waymo_map.py index 080a3e9220..0ef3e34168 100644 --- a/smarts/core/waymo_map.py +++ b/smarts/core/waymo_map.py @@ -38,9 +38,6 @@ from smarts.core.lanepoints import LanePoints, LinkedLanePoint from smarts.core.road_map import RoadMap, RoadMapWithCaches, Waypoint from smarts.core.route_cache import RouteWithCache -from smarts.core.utils.file import read_tfrecord_file -from smarts.core.utils.geometry import buffered_shape -from smarts.core.utils.glb import make_map_glb, make_road_line_glb from smarts.core.utils.core_math import ( inplace_unwrap, line_intersect_vectorized, @@ -48,6 +45,9 @@ ray_boundary_intersect, vec_2d, ) +from smarts.core.utils.file import read_tfrecord_file +from smarts.core.utils.geometry import buffered_shape +from smarts.core.utils.glb import make_map_glb, make_road_line_glb from smarts.sstudio.sstypes import MapSpec from smarts.waymo.exceptions import WaymoDatasetError from smarts.waymo.waymo_open_dataset.protos import scenario_pb2 diff --git a/smarts/env/tests/test_determinism.py b/smarts/env/tests/test_determinism.py index d8f014204a..13a85e1e9b 100644 --- a/smarts/env/tests/test_determinism.py +++ b/smarts/env/tests/test_determinism.py @@ -30,8 +30,8 @@ from smarts.core.agent import Agent from smarts.core.agent_interface import AgentInterface from smarts.core.controllers import ActionSpaceType -from smarts.core.utils.episodes import episodes from smarts.core.utils.core_logging import diff_unpackable +from smarts.core.utils.episodes import episodes from smarts.zoo.agent_spec import AgentSpec diff --git a/smarts/ray/sensors/ray_sensor_resolver.py b/smarts/ray/sensors/ray_sensor_resolver.py index 8a8b9d2db3..333cc59198 100644 --- a/smarts/ray/sensors/ray_sensor_resolver.py +++ b/smarts/ray/sensors/ray_sensor_resolver.py @@ -32,8 +32,8 @@ from smarts.core.serialization.default import dumps, loads from smarts.core.simulation_frame import SimulationFrame from smarts.core.simulation_local_constants import SimulationLocalConstants -from smarts.core.utils.file import replace from smarts.core.utils.core_logging import timeit +from smarts.core.utils.file import replace logger = logging.getLogger(__name__) diff --git a/smarts/sstudio/__init__.py b/smarts/sstudio/__init__.py index 00e3aa290a..fd4e7560e4 100644 --- a/smarts/sstudio/__init__.py +++ b/smarts/sstudio/__init__.py @@ -38,4 +38,4 @@ from . import sstypes as types -sys.modules[f"{__name__}.{types=}".partition('=')[0]] = types +sys.modules[f"{__name__}.{types=}".partition("=")[0]] = types diff --git a/smarts/sstudio/generators.py b/smarts/sstudio/generators.py index afe09a5f24..8adbe21269 100644 --- a/smarts/sstudio/generators.py +++ b/smarts/sstudio/generators.py @@ -34,8 +34,8 @@ from yattag import Doc, indent from smarts.core.road_map import RoadMap -from smarts.core.utils.file import make_dir_in_smarts_log_dir, replace from smarts.core.utils.core_math import wrap_value +from smarts.core.utils.file import make_dir_in_smarts_log_dir, replace from . import sstypes diff --git a/smarts/sstudio/genhistories.py b/smarts/sstudio/genhistories.py index 7b5ba0999f..53974432ee 100644 --- a/smarts/sstudio/genhistories.py +++ b/smarts/sstudio/genhistories.py @@ -34,13 +34,13 @@ from smarts.core.coordinates import BoundingBox, Point from smarts.core.signal_provider import SignalLightState -from smarts.core.utils.file import read_tfrecord_file from smarts.core.utils.core_math import ( circular_mean, constrain_angle, min_angles_difference_signed, vec_to_radians, ) +from smarts.core.utils.file import read_tfrecord_file from smarts.sstudio import sstypes from smarts.waymo.exceptions import WaymoDatasetError diff --git a/smarts/sstudio/genscenario.py b/smarts/sstudio/genscenario.py index 5bc94e412d..523af61f2a 100644 --- a/smarts/sstudio/genscenario.py +++ b/smarts/sstudio/genscenario.py @@ -37,8 +37,8 @@ import smarts.core from smarts.core.default_map_builder import find_mapfile_in_dir -from smarts.core.utils.file import file_md5_hash, path2hash, pickle_hash from smarts.core.utils.core_logging import timeit +from smarts.core.utils.file import file_md5_hash, path2hash, pickle_hash from . import sstypes from .generators import TrafficGenerator