diff --git a/ros2service/ros2service/api/__init__.py b/ros2service/ros2service/api/__init__.py index ad8162f01..e5bd70ee4 100644 --- a/ros2service/ros2service/api/__init__.py +++ b/ros2service/ros2service/api/__init__.py @@ -44,7 +44,7 @@ def get_service_class(node: Node, service_name: str, include_hidden_services: bo :param service_name: The fully-qualified name of the service. :param include_hidden_services: Whether to include hidden services while finding the list of currently running services. - :return: + :return: the service class or None """ service_names_and_types = get_service_names_and_types( node=node, @@ -67,16 +67,16 @@ def get_service_class(node: Node, service_name: str, include_hidden_services: bo if len(matched_names_and_types) < 1: raise RuntimeError(f"Cannot find type for '{service_name}'") if len(matched_names_and_types) > 1: - raise RuntimeError("Unexpectedly saw more than one entry for service'{service_name}'") + raise RuntimeError(f"Unexpectedly saw more than one entry for service '{service_name}'") # Now check whether there are multiple types associated with this service, which is unsupported service_name_and_types = matched_names_and_types[0] types = service_name_and_types[1] if len(types) < 1: - raise RuntimeError("No types associated with '{service_name}'") + raise RuntimeError(f"No types associated with '{service_name}'") if len(types) > 1: - raise RuntimeError("More than one type associated with service '{service_name}'") + raise RuntimeError(f"More than one type associated with service '{service_name}'") service_type = types[0] diff --git a/ros2service/ros2service/verb/echo.py b/ros2service/ros2service/verb/echo.py index 54af5b290..be801ec35 100644 --- a/ros2service/ros2service/verb/echo.py +++ b/ros2service/ros2service/verb/echo.py @@ -78,7 +78,7 @@ def main(self, *, args): srv_module = get_service_class( node, args.service_name, include_hidden_services=True) except (AttributeError, ModuleNotFoundError, ValueError): - raise RuntimeError("The service name '%s' is invalid" % args.service_name) + raise RuntimeError(f"The service name '{args.service_name}' is invalid") else: try: srv_module = get_service(args.service_type)