Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pre-commit hooks to latest versions #1197

Merged
merged 3 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions NaviGator/utils/navigator_tools/nodes/navigator_status_tui
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -218,7 +218,7 @@ class nav_tui:
self.window.addstr(
5 + n,
self.x / 2 - 7,
"%s" % fault,
str(fault),
curses.color_pair(1),
)

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

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

Expand Down
7 changes: 3 additions & 4 deletions mil_common/drivers/mil_passive_sonar/scripts/triggering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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]
Expand All @@ -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",
)


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

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