From 3c64f651414820f1a9bf2375776431cae529149e Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Sat, 1 Jun 2024 23:17:40 +0000
Subject: [PATCH] Update pre-commit hooks to latest versions (#1197)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* Update pre-commit hooks to latest versions

updates:
- [github.com/psf/black: 24.3.0 → 24.4.2](https://github.com/psf/black/compare/24.3.0...24.4.2)
- [github.com/pre-commit/mirrors-clang-format: v18.1.2 → v18.1.4](https://github.com/pre-commit/mirrors-clang-format/compare/v18.1.2...v18.1.4)
- [github.com/astral-sh/ruff-pre-commit: v0.3.4 → v0.4.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.4...v0.4.3)
- [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix pre-commit changes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Cameron Brown <me@cbrxyz.com>
---
 .pre-commit-config.yaml                       |  8 +++----
 .../nodes/navigator_status_tui                | 22 +++++++++----------
 .../machine_learning/generate_rbm_kernels.py  | 10 ++++-----
 .../mil_passive_sonar/scripts/ping_locator.py |  2 +-
 .../mil_passive_sonar/scripts/triggering.py   |  7 +++---
 .../src/mil_passive_sonar/algorithms.py       |  2 +-
 .../src/mil_passive_sonar/util.py             |  2 +-
 .../mil_vision_lib/point_cloud_algorithms.hpp |  4 ++--
 8 files changed, 27 insertions(+), 30 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index df2bc5bc9..aa1314177 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -15,11 +15,11 @@ repos:
     hooks:
       - id: yamllint
   - repo: https://github.com/psf/black
-    rev: 24.3.0
+    rev: 24.4.2
     hooks:
       - id: black
   - repo: https://github.com/pre-commit/mirrors-clang-format
-    rev: v18.1.2
+    rev: v18.1.4
     hooks:
       - id: clang-format
   - repo: https://github.com/PyCQA/autoflake
@@ -40,7 +40,7 @@ repos:
         exclude: ^docker|deprecated|NaviGator/simulation/VRX
   - repo: https://github.com/astral-sh/ruff-pre-commit
     # Ruff version.
-    rev: 'v0.3.4'
+    rev: 'v0.4.3'
     hooks:
       - id: ruff
         args: [--fix, --exit-non-zero-on-fix]
@@ -73,7 +73,7 @@ repos:
       - id: prettier-package-xml
       - id: sort-package-xml
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.5.0
+    rev: v4.6.0
     hooks:
       - id: check-added-large-files
       - id: check-case-conflict
diff --git a/NaviGator/utils/navigator_tools/nodes/navigator_status_tui b/NaviGator/utils/navigator_tools/nodes/navigator_status_tui
index 0fc39eb3b..d0e95d9f1 100755
--- a/NaviGator/utils/navigator_tools/nodes/navigator_status_tui
+++ b/NaviGator/utils/navigator_tools/nodes/navigator_status_tui
@@ -154,16 +154,16 @@ class nav_tui:
             Variable value -> string literal formatting statements
             """
 
-            wrench_mode = "%s" % self.wrench
+            wrench_mode = str(self.wrench)
 
-            kill_name = "Alarm name: %s" % self.Alarm_name
-            kill_raised = "Raised: %s" % self.raised
+            kill_name = f"Alarm name: {self.Alarm_name}"
+            kill_raised = f"Raised: {self.raised}"
 
-            battery_voltage = "Voltage: %s" % self.voltage
+            battery_voltage = f"Voltage: {self.voltage}"
 
-            LLA_Lat = "Latitude: %s" % self.LAT
-            LLA_Lon = "Longitude: %s" % self.LON
-            LLA_Alt = "Altitude: %s" % self.ALT
+            LLA_Lat = f"Latitude: {self.LAT}"
+            LLA_Lon = f"Longitude: {self.LON}"
+            LLA_Alt = f"Altitude: {self.ALT}"
 
             """
             Print(Statements for diagnostics)
@@ -218,7 +218,7 @@ class nav_tui:
                     self.window.addstr(
                         5 + n,
                         self.x / 2 - 7,
-                        "%s" % fault,
+                        str(fault),
                         curses.color_pair(1),
                     )
 
@@ -236,7 +236,7 @@ class nav_tui:
                     self.window.addstr(
                         15 + n,
                         self.x / 2 - 7,
-                        "%s" % fault,
+                        str(fault),
                         curses.color_pair(1),
                     )
                     n += 1
@@ -255,7 +255,7 @@ class nav_tui:
                     self.window.addstr(
                         5 + n,
                         self.x / 2 + 16,
-                        "%s" % fault,
+                        str(fault),
                         curses.color_pair(1),
                     )
                     n += 1
@@ -274,7 +274,7 @@ class nav_tui:
                     self.window.addstr(
                         15 + n,
                         self.x / 2 + 16,
-                        "%s" % fault,
+                        str(fault),
                         curses.color_pair(1),
                     )
                     n += 1
diff --git a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/machine_learning/generate_rbm_kernels.py b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/machine_learning/generate_rbm_kernels.py
index 6041d2ba4..8dd906fb6 100644
--- a/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/machine_learning/generate_rbm_kernels.py
+++ b/SubjuGator/perception/subjugator_perception/subjugator_vision_tools/machine_learning/generate_rbm_kernels.py
@@ -100,14 +100,12 @@ def shift(x, w):
 # Evaluation
 
 print()
-print(
-    "Logistic regression using RBM features:\n%s\n"
-    % (metrics.classification_report(Y_test, classifier.predict(X_test))),
-)
+rep = metrics.classification_report(Y_test, logistic_classifier.predict(X_test))
+print(f"Logistic regression using RBM features:\n{rep}\n")
 
+rep = metrics.classification_report(Y_test, logistic_classifier.predict(X_test))
 print(
-    "Logistic regression using raw pixel features:\n%s\n"
-    % (metrics.classification_report(Y_test, logistic_classifier.predict(X_test))),
+    f"Logistic regression using raw pixel features:\n{rep}\n",
 )
 
 #
diff --git a/mil_common/drivers/mil_passive_sonar/scripts/ping_locator.py b/mil_common/drivers/mil_passive_sonar/scripts/ping_locator.py
index c4eadf2e6..07671fc33 100755
--- a/mil_common/drivers/mil_passive_sonar/scripts/ping_locator.py
+++ b/mil_common/drivers/mil_passive_sonar/scripts/ping_locator.py
@@ -100,7 +100,7 @@ def ping_cb(self, msg) -> None:
             vec = util.calculate_dir_pinger(deltas, self.dist_h, self.v_sound)
         except Exception as e:
             rospy.logwarn(
-                "/hydrophones/ping_locator could not calculate pinger direction %s" % e,
+                f"/hydrophones/ping_locator could not calculate pinger direction {e}",
             )
             return
 
diff --git a/mil_common/drivers/mil_passive_sonar/scripts/triggering.py b/mil_common/drivers/mil_passive_sonar/scripts/triggering.py
index 321a20411..bf2e32f5f 100755
--- a/mil_common/drivers/mil_passive_sonar/scripts/triggering.py
+++ b/mil_common/drivers/mil_passive_sonar/scripts/triggering.py
@@ -274,7 +274,7 @@ def hydrophones_cb(self, msg: Union[Ping, HydrophoneSamplesStamped]) -> None:
                 try:
                     freq = util.find_freq(ping_samples, self.rate)
                 except Exception as e:
-                    rospy.logwarn("/hydrophone/triggering in find_freq %s" % e)
+                    rospy.logwarn(f"/hydrophone/triggering in find_freq {e}")
                     freq = self.target
                 rospy.loginfo(f"triggered at {trigger_time:f} on {freq:f} Hz")
 
@@ -306,7 +306,7 @@ def hydrophones_cb(self, msg: Union[Ping, HydrophoneSamplesStamped]) -> None:
                     plot_data = data[:, 0]
                     titles = [
                         "time vs Gradient of Max convolve",
-                        "time vs max_convolve (Window = %s sec)" % self.window_time,
+                        f"time vs max_convolve (Window = {self.window_time} sec)",
                         "time vs hydrophone0 data",
                     ]
                     vlines = [trigger_time, trigger_time, trigger_time_samples]
@@ -330,8 +330,7 @@ def hydrophones_cb(self, msg: Union[Ping, HydrophoneSamplesStamped]) -> None:
 
         if spare_time < 0:
             rospy.logwarn(
-                "Spare Time After Callback: %f, Running slower than real time"
-                % spare_time,
+                f"Spare Time After Callback: {spare_time}, Running slower than real time",
             )
 
 
diff --git a/mil_common/drivers/mil_passive_sonar/src/mil_passive_sonar/algorithms.py b/mil_common/drivers/mil_passive_sonar/src/mil_passive_sonar/algorithms.py
index 90a4c8bf3..0272b0ed4 100644
--- a/mil_common/drivers/mil_passive_sonar/src/mil_passive_sonar/algorithms.py
+++ b/mil_common/drivers/mil_passive_sonar/src/mil_passive_sonar/algorithms.py
@@ -68,7 +68,7 @@ def run(
     if template_pos is None:
         errors.append("Failed to find template")
     elif numpy.max(delta_errors) > 1e-3:
-        errors.append("High template match error (%s)" % str(delta_errors))
+        errors.append(f"High template match error ({delta_errors!s})")
 
     return {
         "errors": errors,
diff --git a/mil_common/drivers/mil_passive_sonar/src/mil_passive_sonar/util.py b/mil_common/drivers/mil_passive_sonar/src/mil_passive_sonar/util.py
index b8f26f974..c8bcadf60 100644
--- a/mil_common/drivers/mil_passive_sonar/src/mil_passive_sonar/util.py
+++ b/mil_common/drivers/mil_passive_sonar/src/mil_passive_sonar/util.py
@@ -184,7 +184,7 @@ def calculate_dir_pinger(deltas, h_dist, v_sound):
     """
     if numpy.max(deltas) > h_dist / float(v_sound):
         raise Exception(
-            "an impossible time delay was detected ( > %f)" % float(h_dist / v_sound),
+            f"an impossible time delay was detected ( > {float(h_dist / v_sound)})",
         )
     x = numpy.zeros((3,))
 
diff --git a/mil_common/perception/mil_vision/include/mil_vision_lib/point_cloud_algorithms.hpp b/mil_common/perception/mil_vision/include/mil_vision_lib/point_cloud_algorithms.hpp
index 1559e7a98..049d1e11b 100644
--- a/mil_common/perception/mil_vision/include/mil_vision_lib/point_cloud_algorithms.hpp
+++ b/mil_common/perception/mil_vision/include/mil_vision_lib/point_cloud_algorithms.hpp
@@ -19,8 +19,8 @@ class PcdSubPubAlgorithm
   typedef sensor_msgs::PointCloud2 PCD;
 
 public:
-  PcdSubPubAlgorithm(){};
-  ~PcdSubPubAlgorithm(){};
+  PcdSubPubAlgorithm() {};
+  ~PcdSubPubAlgorithm() {};
 
 protected:
   virtual void cloud_cb(const PCD &cloud_msg) = 0;  // runs algorithm pipeline when a msg is received