Used isort to sort imports. Also added to the git pre-commit hook.
[python_utils.git] / camera_utils.py
index 03ac621a52eb4d855ec3ac5458f59712e7eea657..9e7efd6dfccbd7df2d1eb8bd13eb8075a6bfe4f1 100644 (file)
@@ -5,8 +5,8 @@
 import logging
 import platform
 import subprocess
-from typing import NamedTuple, Optional
 import warnings
+from typing import NamedTuple, Optional
 
 import cv2  # type: ignore
 import numpy as np
@@ -74,9 +74,7 @@ def fetch_camera_image_from_video_server(
         response = requests.get(url, stream=False, timeout=10.0)
         if response.ok:
             raw = response.content
-            logger.debug(
-                f'Read {len(response.content)} byte image from HTTP server'
-            )
+            logger.debug(f'Read {len(response.content)} byte image from HTTP server')
             tmp = np.frombuffer(raw, dtype="uint8")
             logger.debug(
                 f'Translated raw content into {tmp.shape} {type(tmp)} with element type {type(tmp[0])}.'
@@ -172,9 +170,7 @@ def _fetch_camera_image(
         camera_name, width=width, quality=quality
     )
     if raw is None:
-        logger.debug(
-            "Reading from video server failed; trying direct RTSP stream"
-        )
+        logger.debug("Reading from video server failed; trying direct RTSP stream")
         raw = fetch_camera_image_from_rtsp_stream(camera_name, width=width)
     if raw is not None and len(raw) > 0:
         tmp = np.frombuffer(raw, dtype="uint8")
@@ -185,9 +181,7 @@ def _fetch_camera_image(
             jpg=jpg,
             hsv=hsv,
         )
-    msg = (
-        "Failed to retieve image from both video server and direct RTSP stream"
-    )
+    msg = "Failed to retieve image from both video server and direct RTSP stream"
     logger.warning(msg)
     warnings.warn(msg, stacklevel=2)
     return RawJpgHsv(None, None, None)