Skip to content

Commit

Permalink
Update pre-commit hooks to latest versions (#1215)
Browse files Browse the repository at this point in the history
* Update pre-commit hooks to latest versions

updates:
- [github.com/pre-commit/mirrors-clang-format: v18.1.5 → v18.1.8](pre-commit/mirrors-clang-format@v18.1.5...v18.1.8)
- [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.5.0](astral-sh/ruff-pre-commit@v0.4.7...v0.5.0)

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

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

* Changes for pre-commit

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Cameron Brown <me@cbrxyz.com>
  • Loading branch information
pre-commit-ci[bot] and cbrxyz authored Jul 18, 2024
1 parent e60fdef commit 5123c64
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.5
rev: v18.1.8
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.4.7'
rev: 'v0.5.0'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,7 @@ async def valid(self):
if not exists:
return False
value = await self.nh.get_param(self.param)
if not self._valid(value):
return False
return True
return self._valid(value)

async def reset(self):
if await self.exists():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ def _object_in_frame(self, object_point):

px = np.array(self.camera_model.project3dToPixel(object_point))
resolution = self.camera_model.fullResolution()
return not (np.any([0, 0] > px) or np.any(px > resolution))
return not (np.any(px < [0, 0]) or np.any(px > resolution))


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,7 @@ def sanity_check(self, coordinate, timestamp):
return False

linear_velocity = rosmsg_to_numpy(self.last_odom.twist.twist.linear)
if np.linalg.norm(linear_velocity) > self.max_velocity:
return False

return True
return np.linalg.norm(linear_velocity) > self.max_velocity


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,7 @@ def _is_valid_contour(self, contour):
return False
self.last2d = self.rect_model.get_pose_2D(corners)
self.last_found_time_2D = self.image_sub.last_image_time
if self.do_3D and not self._get_pose_3D(corners):
return False
return True
return self.do_3D and not self._get_pose_3D(corners)

def _get_edges(self):
"""
Expand Down
13 changes: 6 additions & 7 deletions SubjuGator/simulation/subjugator_gazebo/src/subjugator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ class WorldPluginTutorial : public WorldPlugin
// Make sure the ROS node for Gazebo has already been initialized
if (!ros::isInitialized())
{
ROS_FATAL_STREAM("A ROS node for Gazebo has not been initialized, unable to load plugin. "
<< "Load the Gazebo "
"system plugin "
"'libgazebo_ros_"
"api_plugin.so' in "
"the gazebo_ros "
"package)");
ROS_FATAL_STREAM("A ROS node for Gazebo has not been initialized, unable to load plugin. " << "Load the Gazebo "
"system plugin "
"'libgazebo_ros_"
"api_plugin.so' in "
"the gazebo_ros "
"package)");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,9 @@ def seth(x):

def out_range(self, bbox):
h, w, r = self.image.shape
if bbox[0] < 0 or bbox[0] + bbox[2] > w:
return True
if bbox[1] < 0 or bbox[1] + bbox[3] > h:
return True
return False
return (bbox[0] < 0 or bbox[0] + bbox[2] > w) or (
bbox[1] < 0 or bbox[1] + bbox[3] > h
)

def go(self):
while self.x is None:
Expand Down

0 comments on commit 5123c64

Please sign in to comment.