Skip to content

Commit

Permalink
finish linting
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Macenski <[email protected]>
  • Loading branch information
SteveMacenski committed Feb 12, 2025
1 parent 16f92e2 commit 07c6627
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion launch_ros/launch_ros/descriptions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

"""descriptions Module."""

from .composable_node import ComposableNode
from .composable_lifecycle_node import ComposableLifecycleNode
from .composable_node import ComposableNode
from ..parameter_descriptions import Parameter
from ..parameter_descriptions import ParameterFile
from ..parameter_descriptions import ParameterValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@
from typing import Optional

import launch
from launch.condition import Condition
from launch.some_substitutions_type import SomeSubstitutionsType
from launch.substitution import Substitution
# from launch.utilities import ensure_argument_type
from launch.utilities import perform_substitutions
from launch_ros.parameters_type import Parameters
from launch_ros.parameters_type import SomeParameters
from launch_ros.remap_rule_type import RemapRules
from launch_ros.remap_rule_type import SomeRemapRules
from launch_ros.utilities import LifecycleEventManager

from .composable_node import ComposableNode


class ComposableLifecycleNode(ComposableNode):
"""Describes a lifecycle node that can be loaded into a container with other nodes."""

def __init__(
self, *,
autostart: bool = False,
Expand Down
12 changes: 6 additions & 6 deletions launch_ros/launch_ros/event_handlers/on_state_transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
self,
*,
entities: SomeEntitiesType,
target_lifecycle_node: Optional['LifecycleNode'] = None,
target_lifecycle_node: Optional['LifecycleNode'] = None, # noqa: F821
transition: Optional[SomeSubstitutionsType] = None,
start_state: Optional[SomeSubstitutionsType] = None,
goal_state: Optional[SomeSubstitutionsType] = None,
Expand All @@ -51,17 +51,17 @@ def __init__(
If matcher is given, the other conditions are not considered.
"""
lifecycle_property = type(target_lifecycle_node).__dict__.get('is_lifecycle_node', None)
if not isinstance(lifecycle_property, (property, type(None))):
raise RuntimeError('OnStateTransition requires a "LifecycleNode" action as the target,'
' target_lifecycle_node is not a node type.')
if target_lifecycle_node and not isinstance(lifecycle_property, (property)):
raise RuntimeError('OnStateTransition requires a lifecycle enabled node as the target,'
' target_lifecycle_node is not a lifecycle-enabled node type.')

if (
target_lifecycle_node and
hasattr(target_lifecycle_node, 'is_lifecycle_node') and
not target_lifecycle_node.is_lifecycle_node
):
raise RuntimeError('OnStateTransition requires a "LifecycleNode" action as the target,'
' target_lifecycle_node is not a lifecycle-enabled node.')
raise RuntimeError('OnStateTransition requires a lifecycle enabled node as the target,'
' target_lifecycle_node is not lifecycle-enabled.')

# Handle optional matcher argument.
self.__custom_matcher = matcher
Expand Down

0 comments on commit 07c6627

Please sign in to comment.