diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5ebddef09..79a11871a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: hooks: - id: yamllint - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.1.1 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-clang-format @@ -40,7 +40,7 @@ repos: exclude: ^docker|deprecated|NaviGator/simulation/VRX - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: 'v0.1.9' + rev: 'v0.2.0' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/NaviGator/hardware_drivers/navigator_kill_board/navigator_kill_board/constants.py b/NaviGator/hardware_drivers/navigator_kill_board/navigator_kill_board/constants.py index 83663e034..d5eaef7e4 100644 --- a/NaviGator/hardware_drivers/navigator_kill_board/navigator_kill_board/constants.py +++ b/NaviGator/hardware_drivers/navigator_kill_board/navigator_kill_board/constants.py @@ -17,6 +17,7 @@ The computer can also command a kill (for example, if ROS notices a criticaly low battery) by sending the COMPUTER.KILL.REQUEST and undone with COMPUTER.CLEAR.REQUEST """ + constants = { "TIMEOUT_SECONDS": 8.0, # How often board must be pinged to not set HEARTBERAT_REMOTE True # Note: not official documented, this is just a guess diff --git a/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/battery_voltage.py b/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/battery_voltage.py index 6c25b9169..c10b13c91 100644 --- a/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/battery_voltage.py +++ b/NaviGator/mission_control/navigator_alarm/navigator_alarm_handlers/battery_voltage.py @@ -27,9 +27,9 @@ def _check_voltage(self, msg): if not self._raised or self._severity != severity: self.broadcaster.raise_alarm( severity=severity, - problem_description="battery critcaly low" - if severity == 2 - else "battery low", + problem_description=( + "battery critcaly low" if severity == 2 else "battery low" + ), parameters={"voltage": voltage}, ) diff --git a/NaviGator/mission_control/navigator_missions/navigator_missions/move.py b/NaviGator/mission_control/navigator_missions/navigator_missions/move.py index 8ae428057..a9debd213 100755 --- a/NaviGator/mission_control/navigator_missions/navigator_missions/move.py +++ b/NaviGator/mission_control/navigator_missions/navigator_missions/move.py @@ -149,7 +149,7 @@ async def run(self, args): "yl": "yaw_left", "yr": "yaw_right", } - command = command if command not in shorthand else shorthand[command] + command = shorthand.get(command, command) movement = getattr(self.move, command) trans_move = command[:3] != "yaw" diff --git a/NaviGator/utils/navigator_tools/nodes/navigator_status_tui b/NaviGator/utils/navigator_tools/nodes/navigator_status_tui index 55645a95e..0fc39eb3b 100755 --- a/NaviGator/utils/navigator_tools/nodes/navigator_status_tui +++ b/NaviGator/utils/navigator_tools/nodes/navigator_status_tui @@ -214,15 +214,13 @@ class nav_tui: if len(self.decode_fault_status(self.FL_fault)) == 0: self.window.addstr(5, self.x / 2 - 7, "No faults", curses.color_pair(3)) else: - n = 0 - for fault in self.decode_fault_status(self.FL_fault): + for n, fault in enumerate(self.decode_fault_status(self.FL_fault)): self.window.addstr( 5 + n, self.x / 2 - 7, "%s" % fault, curses.color_pair(1), ) - n += 1 self.window.addstr(14, self.x / 2 - 7, "Back Left", color) if len(self.decode_fault_status(self.BL_fault)) == 0: diff --git a/SubjuGator/drivers/magnetic_compensation/sub8_magnetic_hardsoft_compensation/scripts/generate_config b/SubjuGator/drivers/magnetic_compensation/sub8_magnetic_hardsoft_compensation/scripts/generate_config index 4b65395af..342292350 100755 --- a/SubjuGator/drivers/magnetic_compensation/sub8_magnetic_hardsoft_compensation/scripts/generate_config +++ b/SubjuGator/drivers/magnetic_compensation/sub8_magnetic_hardsoft_compensation/scripts/generate_config @@ -132,9 +132,11 @@ if __name__ == "__main__": with rosbag.Bag(sys.argv[1]) as bag: points = numpy.array( [ - mil_ros_tools.rosmsg_to_numpy(msg.magnetic_field) - if hasattr(msg, "magnetic_field") - else mil_ros_tools.rosmsg_to_numpy(msg.vector) + ( + mil_ros_tools.rosmsg_to_numpy(msg.magnetic_field) + if hasattr(msg, "magnetic_field") + else mil_ros_tools.rosmsg_to_numpy(msg.vector) + ) for topic, msg, t in bag.read_messages(topics=["/imu/mag_raw"]) ], ) diff --git a/SubjuGator/perception/subjugator_perception/nodes/hsv_calibration.py b/SubjuGator/perception/subjugator_perception/nodes/hsv_calibration.py index 4a67f4bb7..433133431 100755 --- a/SubjuGator/perception/subjugator_perception/nodes/hsv_calibration.py +++ b/SubjuGator/perception/subjugator_perception/nodes/hsv_calibration.py @@ -36,13 +36,17 @@ def parse_string(threshes): def reconfigure(self, config, level): try: self.lower = np.array(self.parse_string(config["dyn_lower"])) - rospy.logwarn("HSV lower bound below minimum value") if ( - self.lower < 0 - ).any() else None + ( + rospy.logwarn("HSV lower bound below minimum value") + if (self.lower < 0).any() + else None + ) self.upper = np.array(self.parse_string(config["dyn_upper"])) - rospy.logwarn("HSV upper bound above maximum values") if ( - self.upper[0] > 179 - ).any() or (self.upper[1:] > 255).any() else None + ( + rospy.logwarn("HSV upper bound above maximum values") + if (self.upper[0] > 179).any() or (self.upper[1:] > 255).any() + else None + ) except ValueError as e: rospy.logwarn(f"Invalid dynamic reconfigure: {e}") diff --git a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/HOG/HOG_SVM_trainer.py b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/HOG/HOG_SVM_trainer.py index bbdb7aefb..01e85b3a2 100644 --- a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/HOG/HOG_SVM_trainer.py +++ b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/HOG/HOG_SVM_trainer.py @@ -16,8 +16,7 @@ class_list = np.array(0) # loop through the training images -count = 0 -for i in os.listdir(os.path.abspath(folder)): +for count, i in enumerate(os.listdir(os.path.abspath(folder))): # get the roi from the file path = folder + "/" + i roi_str = f.readline() @@ -72,7 +71,6 @@ class_temp = np.empty(len_myinvhog / 9) class_temp.fill(-1) class_list = np.append(class_list, class_temp) - count += 1 # hack class_list = np.delete(class_list, [0]) diff --git a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/machine_learning/boost_auto.py b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/machine_learning/boost_auto.py index c9027ff60..c1cf17e1a 100644 --- a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/machine_learning/boost_auto.py +++ b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/machine_learning/boost_auto.py @@ -100,10 +100,11 @@ def train_on_data(observation_list, label_list, split_factor=4): s_time = time.time() process_round = 0 # Split this into multiple passes in an attempt to free RAM (no idea if this works). - for x, y in zip(all_observations_split, all_labels_split): + for process_round, (x, y) in enumerate( + zip(all_observations_split, all_labels_split), + ): print(f"Training subset {process_round + 1}/{split_factor}.") boost.train(x, cv2.CV_ROW_SAMPLE, y, params=parameters) - process_round += 1 print(f"Time to complete: {time.time() - s_time}") print("Done! Saving...") diff --git a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/marker_occ_grid.py b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/marker_occ_grid.py index 2a278a4f4..c547f7847 100644 --- a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/marker_occ_grid.py +++ b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/marker_occ_grid.py @@ -249,7 +249,6 @@ def polygon_generator(self, n=12): class MarkerOccGrid(OccGridUtils): - """ Handles updating occupancy grid when new data comes in. TODO: Upon call can return some path to go to in order to find them. diff --git a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/rviz.py b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/rviz.py index c46dd18ea..e6af8929a 100644 --- a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/rviz.py +++ b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/rviz.py @@ -9,7 +9,6 @@ class RvizVisualizer: - """Cute tool for drawing both depth and height-from-bottom in RVIZ""" def __init__(self, topic="visualization/markers"): diff --git a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/visual_threshold_tools.py b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/visual_threshold_tools.py index 7ec7d04c9..f30275cfc 100644 --- a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/visual_threshold_tools.py +++ b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/visual_threshold_tools.py @@ -63,7 +63,6 @@ def denormalize(val, _min, _max): class ExtentDialog(traits.api.HasTraits): - """A dialog to graphically adjust the extents of a threshold range""" # Data extents diff --git a/SubjuGator/perception/subjugator_perception/test/test_path_marker.py b/SubjuGator/perception/subjugator_perception/test/test_path_marker.py index 4f3a621cc..5674ddf5a 100755 --- a/SubjuGator/perception/subjugator_perception/test/test_path_marker.py +++ b/SubjuGator/perception/subjugator_perception/test/test_path_marker.py @@ -17,7 +17,6 @@ class TestPathMarker(unittest.TestCase): - """ Unit test for perception service finding orange path markers Plays several bags with known pixel coordinates of path marker, diff --git a/SubjuGator/simulation/subjugator_gazebo/diagnostics/gazebo_tests/common.py b/SubjuGator/simulation/subjugator_gazebo/diagnostics/gazebo_tests/common.py index de7bc39f0..38a5baf41 100644 --- a/SubjuGator/simulation/subjugator_gazebo/diagnostics/gazebo_tests/common.py +++ b/SubjuGator/simulation/subjugator_gazebo/diagnostics/gazebo_tests/common.py @@ -8,7 +8,6 @@ class Job: - """Inherit from this!""" _job_name = "generic job" diff --git a/SubjuGator/simulation/subjugator_simulation/subjugator_sim_tools/shaders/shader_manager.py b/SubjuGator/simulation/subjugator_simulation/subjugator_sim_tools/shaders/shader_manager.py index edfb7d12f..192755207 100644 --- a/SubjuGator/simulation/subjugator_simulation/subjugator_sim_tools/shaders/shader_manager.py +++ b/SubjuGator/simulation/subjugator_simulation/subjugator_sim_tools/shaders/shader_manager.py @@ -36,7 +36,6 @@ def add_item(self, position, intensity): class ShaderManager: - """ This class is used when you want to have an entity switch out shaders at a specific time. If you want to add another rule for when to switch out shaders: diff --git a/SubjuGator/simulation/subjugator_simulation/subjugator_sim_tools/shaders/shaders.py b/SubjuGator/simulation/subjugator_simulation/subjugator_sim_tools/shaders/shaders.py index d4a2e1f62..210a68e8e 100644 --- a/SubjuGator/simulation/subjugator_simulation/subjugator_sim_tools/shaders/shaders.py +++ b/SubjuGator/simulation/subjugator_simulation/subjugator_sim_tools/shaders/shaders.py @@ -65,7 +65,6 @@ def recursive_dictionary(self, path, text): class Shaders: - """A Shaders class, which automatically contains all of the shaders in the shaders folder WTF? diff --git a/SubjuGator/simulation/subjugator_simulation/subjugator_sim_tools/widgets/sub.py b/SubjuGator/simulation/subjugator_simulation/subjugator_sim_tools/widgets/sub.py index cbb628bad..144ec195d 100644 --- a/SubjuGator/simulation/subjugator_simulation/subjugator_sim_tools/widgets/sub.py +++ b/SubjuGator/simulation/subjugator_simulation/subjugator_sim_tools/widgets/sub.py @@ -83,7 +83,6 @@ def make_visual(self, physical, position, thrust_indicators=False): ) class ThrustGetter: - """This is a pretty garbage thing, and will be replaced by the scenegraph system""" def __init__(self, thruster_name, rdir): diff --git a/SubjuGator/utils/subjugator_diagnostics/scripts/self_check.py b/SubjuGator/utils/subjugator_diagnostics/scripts/self_check.py index 2552541cc..4db32b96c 100755 --- a/SubjuGator/utils/subjugator_diagnostics/scripts/self_check.py +++ b/SubjuGator/utils/subjugator_diagnostics/scripts/self_check.py @@ -18,7 +18,6 @@ class TemplateChecker: - """Template for how each checker class should look. This provides interface functions for the main function to use. You don't have to implement them all in each checker. diff --git a/docs/extensions/attributetable.py b/docs/extensions/attributetable.py index bfee064d7..53372cb61 100644 --- a/docs/extensions/attributetable.py +++ b/docs/extensions/attributetable.py @@ -2,6 +2,7 @@ Credit goes to discord.py and its creators for creating most of this file: https://github.com/Rapptz/discord.py/blob/master/docs/extensions/attributetable.py """ + import importlib import inspect import re diff --git a/docs/extensions/builder.py b/docs/extensions/builder.py index 84de6d59d..881417afc 100644 --- a/docs/extensions/builder.py +++ b/docs/extensions/builder.py @@ -2,6 +2,7 @@ Credit goes to discord.py and its creators for creating most of this file: https://github.com/Rapptz/discord.py/blob/master/docs/extensions/attributetable.py """ + from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.environment.adapters.indexentries import IndexEntries from sphinx.writers.html5 import HTML5Translator diff --git a/mil_common/drivers/mil_pneumatic_actuator/nodes/pneumatic_actuator_node b/mil_common/drivers/mil_pneumatic_actuator/nodes/pneumatic_actuator_node index bf8261177..920fb5a92 100755 --- a/mil_common/drivers/mil_pneumatic_actuator/nodes/pneumatic_actuator_node +++ b/mil_common/drivers/mil_pneumatic_actuator/nodes/pneumatic_actuator_node @@ -37,7 +37,7 @@ class Actuator: if isinstance(config, int): return cls.from_int(config) type_str = config["type"] - pulse_time = config["pulse_time"] if "pulse_time" in config else None + pulse_time = config.get("pulse_time") open_id = config["ports"]["open_port"]["id"] open_default = config["ports"]["open_port"]["default"] if "close_port" in config["ports"]: diff --git a/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub8/utils.py b/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub8/utils.py index 0ef0cf9a1..7524e6dfe 100644 --- a/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub8/utils.py +++ b/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub8/utils.py @@ -114,13 +114,11 @@ def __bytes__(self) -> bytes: @overload @classmethod - def _unpack_payload(cls, data: Literal[b""]) -> None: - ... + def _unpack_payload(cls, data: Literal[b""]) -> None: ... @overload @classmethod - def _unpack_payload(cls, data: bytes) -> bytes: - ... + def _unpack_payload(cls, data: bytes) -> bytes: ... @classmethod def _unpack_payload(cls, data: bytes) -> bytes | None: @@ -455,13 +453,11 @@ def calculate_checksum(self, data: bytes) -> int: @overload @classmethod - def from_bytes(cls, data: Literal[b""]) -> None: - ... + def from_bytes(cls, data: Literal[b""]) -> None: ... @overload @classmethod - def from_bytes(cls: type[T], data: bytes) -> T: - ... + def from_bytes(cls: type[T], data: bytes) -> T: ... @classmethod def from_bytes(cls: type[T], data: bytes) -> T | None: diff --git a/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub9/sub9_driver.py b/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub9/sub9_driver.py index 59db73c99..90928ff8d 100755 --- a/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub9/sub9_driver.py +++ b/mil_common/drivers/mil_usb_to_can/mil_usb_to_can/sub9/sub9_driver.py @@ -31,8 +31,9 @@ class SimulatedUSBtoCANStream(SimulatedSerial): def __init__( self, - devices: list[tuple[type[SimulatedCANDeviceHandle], list[type[Packet]]]] - | None = None, + devices: ( + list[tuple[type[SimulatedCANDeviceHandle], list[type[Packet]]]] | None + ) = None, ): """ Args: @@ -214,16 +215,14 @@ def read_devices( self, *, simulated: Literal[True], - ) -> list[tuple[type[SimulatedCANDeviceHandle], list[type[Packet]]]]: - ... + ) -> list[tuple[type[SimulatedCANDeviceHandle], list[type[Packet]]]]: ... @overload def read_devices( self, *, simulated: Literal[False], - ) -> list[tuple[type[CANDeviceHandle], list[type[Packet]]]]: - ... + ) -> list[tuple[type[CANDeviceHandle], list[type[Packet]]]]: ... def read_devices( self, diff --git a/mil_common/gnc/rawgps_common/src/rawgps_common/gps.py b/mil_common/gnc/rawgps_common/src/rawgps_common/gps.py index 81393bb3f..d8fb03d5b 100644 --- a/mil_common/gnc/rawgps_common/src/rawgps_common/gps.py +++ b/mil_common/gnc/rawgps_common/src/rawgps_common/gps.py @@ -649,9 +649,7 @@ def generate_satellite_message( for i in range(2): dt = t - eph.t_oc assert abs(dt) < week_length / 2 - deltat_SV_L1 = ( - eph.a_f0 + eph.a_f1 * dt + eph.a_f2 * dt**2 + deltat_r - eph.T_GD - ) + deltat_SV_L1 = eph.a_f0 + eph.a_f1 * dt + eph.a_f2 * dt**2 + deltat_r - eph.T_GD t = t_SV - deltat_SV_L1 if i == 1: sat_pos, deltat_r, sat_vel = eph.predict(t) @@ -691,14 +689,16 @@ def generate_satellite_message( time=-pseudo_range / c - deltat_SV_L1, T_iono=T_iono, T_tropo=T_tropo, - carrier_distance=carrier_cycles * c / L1_f0 - if carrier_cycles is not None - else nan, + carrier_distance=( + carrier_cycles * c / L1_f0 if carrier_cycles is not None else nan + ), doppler_velocity=doppler_freq * c / L1_f0, direction_enu=Vector3(*direction_enu), - velocity_plus_drift=doppler_freq * c / L1_f0 + direction.dot(sat_vel) - if doppler_freq is not None - else nan, + velocity_plus_drift=( + doppler_freq * c / L1_f0 + direction.dot(sat_vel) + if doppler_freq is not None + else nan + ), ) diff --git a/mil_common/mil_missions/mil_missions_core/__init__.py b/mil_common/mil_missions/mil_missions_core/__init__.py index f4244279d..e603f4026 100644 --- a/mil_common/mil_missions/mil_missions_core/__init__.py +++ b/mil_common/mil_missions/mil_missions_core/__init__.py @@ -4,6 +4,7 @@ from to create robot-specific mission tasks. These mission classes can be imported by the mission runner and then run. """ + from .base_mission import BaseMission from .chain_with_timeout import MakeChainWithTimeout from .exceptions import ( diff --git a/mil_common/perception/mil_vision/mil_vision_tools/shape_finder.py b/mil_common/perception/mil_vision/mil_vision_tools/shape_finder.py index 05d50cc8f..33479a753 100644 --- a/mil_common/perception/mil_vision/mil_vision_tools/shape_finder.py +++ b/mil_common/perception/mil_vision/mil_vision_tools/shape_finder.py @@ -304,12 +304,12 @@ def __init__(self, length=1.0, width=1.0): self.model_2D = np.zeros((50, 1, 2), dtype=np.int) # Approximate an ellipse with 50 points, so that verify_contour is reasonable fast still for idx, theta in enumerate(np.linspace(0.0, 2.0 * np.pi, num=50)): - self.model_2D[idx][0][ - 0 - ] = self.length * 0.5 * scale + self.length * 0.5 * scale * np.cos(theta) - self.model_2D[idx][0][ - 1 - ] = self.width * 0.5 * scale + self.width * 0.5 * scale * np.sin(theta) + self.model_2D[idx][0][0] = ( + self.length * 0.5 * scale + self.length * 0.5 * scale * np.cos(theta) + ) + self.model_2D[idx][0][1] = ( + self.width * 0.5 * scale + self.width * 0.5 * scale * np.sin(theta) + ) def get_corners(self, contour, debug_image=None): """ diff --git a/mil_common/perception/mil_vision/ros_tools/on_the_fly_thresholder.py b/mil_common/perception/mil_vision/ros_tools/on_the_fly_thresholder.py index 74fbc58dd..e70de289e 100755 --- a/mil_common/perception/mil_vision/ros_tools/on_the_fly_thresholder.py +++ b/mil_common/perception/mil_vision/ros_tools/on_the_fly_thresholder.py @@ -78,9 +78,11 @@ def __init__(self, img, thresh_type="bgr"): def update_mask(self): self.lower, self.upper = self.trackbars.get_bounds() self.mask = cv2.inRange( - self.image - if self.thresh_type == "bgr" - else cv2.cvtColor(self.image, cv2.COLOR_BGR2HSV), + ( + self.image + if self.thresh_type == "bgr" + else cv2.cvtColor(self.image, cv2.COLOR_BGR2HSV) + ), self.lower, self.upper, ) diff --git a/mil_common/ros_alarms/nodes/alarm_server.py b/mil_common/ros_alarms/nodes/alarm_server.py index bb602304c..b3a023778 100755 --- a/mil_common/ros_alarms/nodes/alarm_server.py +++ b/mil_common/ros_alarms/nodes/alarm_server.py @@ -178,9 +178,9 @@ def _create_alarm_handlers(self): if alarm_name in self.alarms: self.alarms[alarm_name].update(h.initial_alarm) else: - self.alarms[ - alarm_name - ] = h.initial_alarm # Update even if already added to server + self.alarms[alarm_name] = ( + h.initial_alarm + ) # Update even if already added to server elif ( alarm_name not in self.alarms ): # Add default initial if not there already diff --git a/mil_common/ros_alarms/ros_alarms/__init__.py b/mil_common/ros_alarms/ros_alarms/__init__.py index 600cc75c8..9f257faae 100644 --- a/mil_common/ros_alarms/ros_alarms/__init__.py +++ b/mil_common/ros_alarms/ros_alarms/__init__.py @@ -39,6 +39,7 @@ Topic publishing any getting/setting updates that occur on alarms. """ + from .alarms import ( Alarm, AlarmBroadcaster, diff --git a/mil_common/utils/mil_tools/mil_misc_tools/download.py b/mil_common/utils/mil_tools/mil_misc_tools/download.py index 85001f69a..fbf3fe61d 100644 --- a/mil_common/utils/mil_tools/mil_misc_tools/download.py +++ b/mil_common/utils/mil_tools/mil_misc_tools/download.py @@ -11,6 +11,7 @@ [3] Download a file via http http://stackoverflow.com/questions/22676 """ + import io as StringIO import os import urllib.request diff --git a/mil_common/utils/mil_tools/mil_ros_tools/cv_debug.py b/mil_common/utils/mil_tools/mil_ros_tools/cv_debug.py index 275abf969..b5695ded9 100644 --- a/mil_common/utils/mil_tools/mil_ros_tools/cv_debug.py +++ b/mil_common/utils/mil_tools/mil_ros_tools/cv_debug.py @@ -1,6 +1,7 @@ """ Shows images for debugging purposes. """ + import sys from typing import Optional diff --git a/mil_common/utils/mil_tools/mil_ros_tools/init_helpers.py b/mil_common/utils/mil_tools/mil_ros_tools/init_helpers.py index 0a8541fd6..789b36153 100644 --- a/mil_common/utils/mil_tools/mil_ros_tools/init_helpers.py +++ b/mil_common/utils/mil_tools/mil_ros_tools/init_helpers.py @@ -2,6 +2,7 @@ This module provides functions which help to ensure that resources are available when needed. """ + import time from typing import Any, Optional diff --git a/mil_common/utils/mil_tools/mil_ros_tools/label_me_bag.py b/mil_common/utils/mil_tools/mil_ros_tools/label_me_bag.py index 4e6c7231c..aa7f91142 100755 --- a/mil_common/utils/mil_tools/mil_ros_tools/label_me_bag.py +++ b/mil_common/utils/mil_tools/mil_ros_tools/label_me_bag.py @@ -53,13 +53,13 @@ def __init__(self, config): self.topics = config["topics"] if not isinstance(self.topics, list): self.topics = [self.topics] - self.start = config["start"] if "start" in config else None - self.stop = config["stop"] if "stop" in config else None - self.freq = config["freq"] if "freq" in config else None + self.start = config.get("start") + self.stop = config.get("stop") + self.freq = config.get("freq") self.name = ( config["name"] if "name" in config else self.default_name(self.filename) ) - self.outfile = config["outfile"] if "outfile" in config else self.filename + self.outfile = config.get("outfile", self.filename) class BagToLabelMe: diff --git a/ruff.toml b/ruff.toml index 0ec9c21f1..56794e48d 100644 --- a/ruff.toml +++ b/ruff.toml @@ -28,6 +28,7 @@ extend-exclude = [ target-version = "py38" +[lint] ignore = [ "E501", # Line length "F405", # Unknown import