Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Add mypy CI #42

Merged
merged 3 commits into from
Oct 14, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
test-definitions:
# sailbot_workspace: use locally-defined file
# other repositories: set to UBCSailbot/sailbot_workspace/.github/workflows/test_definitions.yml@<release>
uses: UBCSailbot/sailbot_workspace/.github/workflows/test_definitions.yml@v1.3.1
uses: UBCSailbot/sailbot_workspace/.github/workflows/test_definitions.yml@v1.4.0
# see https://github.com/UBCSailbot/sailbot_workspace/blob/main/.github/workflows/test_definitions.yml
# for documentation on the inputs and secrets below
with:
Expand Down
19 changes: 10 additions & 9 deletions launch/main_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

import os
from importlib.util import module_from_spec, spec_from_file_location
from typing import List
from typing import List, Tuple

from launch_ros.actions import Node

from launch import LaunchDescription, LaunchDescriptionEntity
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, OpaqueFunction
from launch.launch_context import LaunchContext
from launch.some_substitutions_type import SomeSubstitutionsType
from launch.substitutions import LaunchConfiguration

# Local launch arguments and constants
Expand Down Expand Up @@ -36,11 +37,11 @@ def generate_launch_description() -> LaunchDescription:
)


def get_global_launch_arguments() -> List[LaunchDescriptionEntity]:
"""Gets the global launch arguments defined in the global launch file.
def get_global_launch_arguments() -> Tuple:
"""Gets the global launch arguments and environment variables from the global launch file.

Returns:
List[LaunchDescriptionEntity]: List of global launch argument objects.
Tuple: The global launch arguments and environment variables.
"""
ros_workspace = os.getenv("ROS_WORKSPACE", default="/workspaces/sailbot_workspace")
global_main_launch = os.path.join(ros_workspace, "src", "global_launch", "main_launch.py")
Expand All @@ -51,18 +52,18 @@ def get_global_launch_arguments() -> List[LaunchDescriptionEntity]:
spec.loader.exec_module(module) # type: ignore[union-attr] # spec is not None
global_launch_arguments = module.GLOBAL_LAUNCH_ARGUMENTS
global_environment_vars = module.ENVIRONMENT_VARIABLES
return global_launch_arguments, global_environment_vars # type: ignore[return-value] # no type
return global_launch_arguments, global_environment_vars


def setup_launch(context: LaunchContext) -> List[LaunchDescriptionEntity]:
def setup_launch(context: LaunchContext) -> List[Node]:
"""Collects launch descriptions that describe the system behavior in the `network_systems`
package.

Args:
context (LaunchContext): The current launch context.

Returns:
List[LaunchDescriptionEntity]: Launch descriptions.
List[Nodes]: Nodes to launch.
"""
launch_description_entities = list()
launch_description_entities.append(get_cached_fib_description(context))
Expand All @@ -80,7 +81,7 @@ def get_cached_fib_description(context: LaunchContext) -> Node:
"""
node_name = "cached_fib"
ros_parameters = [LaunchConfiguration("config").perform(context)]
ros_arguments = [
ros_arguments: List[SomeSubstitutionsType] = [
"--log-level",
[f"{node_name}:=", LaunchConfiguration("log_level")],
]
Expand Down