diff --git a/src/blueapi/cli/cli.py b/src/blueapi/cli/cli.py index dc4dbcde5..fb1c81533 100644 --- a/src/blueapi/cli/cli.py +++ b/src/blueapi/cli/cli.py @@ -1,5 +1,4 @@ import json -from pydantic import ValidationError, parse_obj_as import logging from collections import deque from functools import wraps @@ -8,6 +7,7 @@ from typing import Optional, Tuple, Union import click +from pydantic import ValidationError, parse_obj_as from requests.exceptions import ConnectionError from blueapi import __version__ @@ -191,10 +191,11 @@ def store_finished_event(event: WorkerEvent) -> None: print(text) validated_data = parse_obj_as(type(schema), parameters) print("Plan params validation successful:", validated_data) - except ValidationError as e: + except ValidationError: # Handle the case where the parameters are invalid according to the PlanModel print( - f"failed to run the {name} plan, supplied params {parameters} do not match the expected params: {schema}" + f"""failed to run the {name} plan, + supplied params {parameters} do not match the expected params: {schema}""" ) return diff --git a/src/blueapi/cli/rest.py b/src/blueapi/cli/rest.py index 3c79fa9da..465959caa 100644 --- a/src/blueapi/cli/rest.py +++ b/src/blueapi/cli/rest.py @@ -1,6 +1,5 @@ -from typing import Any, Callable, Literal, Mapping, Optional, Type, TypeVar - from http import HTTPStatus +from typing import Any, Callable, Literal, Mapping, Optional, Type, TypeVar import requests from pydantic import parse_obj_as @@ -119,7 +118,9 @@ def _request_and_deserialize( if raise_if(response): message = get_status_message(response.status_code) t = response.text - error_message = f"Response failed with text: {t}, with error code: {response.status_code} which corresponds to {message}" + error_message = f"""Response failed with text: {t}, + with error code: {response.status_code} + which corresponds to {message}""" raise BlueskyRemoteError(error_message) deserialized = parse_obj_as(target_type, response.json()) return deserialized