From a4c61da10970a20e1ee7aa12cff1e19676886aa7 Mon Sep 17 00:00:00 2001 From: Benedikt Mersch Date: Wed, 16 Oct 2024 15:27:05 +0200 Subject: [PATCH 1/3] Add black and isort --- .pre-commit-config.yaml | 8 ++++++++ ros/launch/offline_node.launch.py | 8 +++----- ros/launch/online_node.launch.py | 12 +++++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37cfe77..214858f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,15 @@ repos: rev: v14.0.0 hooks: - id: clang-format +- repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black - repo: https://github.com/ahans/cmake-format-precommit rev: 8e52fb6506f169dddfaa87f88600d765fca48386 hooks: - id: cmake-format +- repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort diff --git a/ros/launch/offline_node.launch.py b/ros/launch/offline_node.launch.py index 371d8bb..193b7b1 100644 --- a/ros/launch/offline_node.launch.py +++ b/ros/launch/offline_node.launch.py @@ -4,14 +4,12 @@ import launch from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import OpaqueFunction +from launch.actions import DeclareLaunchArgument, OpaqueFunction from launch.conditions import IfCondition -from launch.launch_description_sources import ( - get_launch_description_from_python_launch_file, -) +from launch.launch_description_sources import \ + get_launch_description_from_python_launch_file from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node -from launch.actions import DeclareLaunchArgument def _generate_launch_description(context: launch.LaunchContext, *args, **kwargs): diff --git a/ros/launch/online_node.launch.py b/ros/launch/online_node.launch.py index 01c0a2a..ca51b0c 100644 --- a/ros/launch/online_node.launch.py +++ b/ros/launch/online_node.launch.py @@ -2,16 +2,17 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.launch_description_sources import ( - get_launch_description_from_python_launch_file, -) +from launch.launch_description_sources import \ + get_launch_description_from_python_launch_file from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node from launch_ros.substitutions.find_package import get_package_share_directory def generate_launch_description(): - use_sim_time = LaunchConfiguration("use_sim_time", default=(os.getenv("SIMULATION") == "true")) + use_sim_time = LaunchConfiguration( + "use_sim_time", default=(os.getenv("SIMULATION") == "true") + ) tf_timeout = LaunchConfiguration( "tf_timeout", default=PythonExpression(["'0.1' if ", use_sim_time, " else '0.0'"]), @@ -31,7 +32,8 @@ def generate_launch_description(): ], parameters=[ # KISS-ICP configuration - get_package_share_directory("kinematic_icp") + "/config/kinematic_icp_ros.yaml", + get_package_share_directory("kinematic_icp") + + "/config/kinematic_icp_ros.yaml", { # Input topic, is not a remap to marry API with offline node "input": LaunchConfiguration("lidar_topic"), From c27e8e38c39a83c47a7d1b9cc656f653efe97914 Mon Sep 17 00:00:00 2001 From: Benedikt Mersch Date: Wed, 16 Oct 2024 15:27:23 +0200 Subject: [PATCH 2/3] Format --- ros/launch/offline_node.launch.py | 5 +++-- ros/launch/online_node.launch.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ros/launch/offline_node.launch.py b/ros/launch/offline_node.launch.py index 193b7b1..bd66551 100644 --- a/ros/launch/offline_node.launch.py +++ b/ros/launch/offline_node.launch.py @@ -6,8 +6,9 @@ from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, OpaqueFunction from launch.conditions import IfCondition -from launch.launch_description_sources import \ - get_launch_description_from_python_launch_file +from launch.launch_description_sources import ( + get_launch_description_from_python_launch_file, +) from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node diff --git a/ros/launch/online_node.launch.py b/ros/launch/online_node.launch.py index ca51b0c..d0323b1 100644 --- a/ros/launch/online_node.launch.py +++ b/ros/launch/online_node.launch.py @@ -2,8 +2,9 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.launch_description_sources import \ - get_launch_description_from_python_launch_file +from launch.launch_description_sources import ( + get_launch_description_from_python_launch_file, +) from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node from launch_ros.substitutions.find_package import get_package_share_directory From a99d361cd2b5429de8609e4d1e0b250f3343fa2c Mon Sep 17 00:00:00 2001 From: Benedikt Mersch Date: Wed, 16 Oct 2024 15:31:01 +0200 Subject: [PATCH 3/3] use black for isort --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 214858f..304ae26 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,3 +24,4 @@ repos: rev: 5.12.0 hooks: - id: isort + args: ["--profile", "black", "--filter-files"]