From 5c525b9bac19e01f770127cfe9c43f6f3b2f3edf Mon Sep 17 00:00:00 2001 From: xjules Date: Fri, 20 Dec 2024 09:59:36 +0100 Subject: [PATCH] Mypy ... --- src/_ert/forward_model_runner/client.py | 4 ++-- src/_ert/forward_model_runner/reporting/event.py | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/_ert/forward_model_runner/client.py b/src/_ert/forward_model_runner/client.py index 9e16e7b42b2..513e685718c 100644 --- a/src/_ert/forward_model_runner/client.py +++ b/src/_ert/forward_model_runner/client.py @@ -126,7 +126,7 @@ async def send(self, message: str | bytes, retries: int | None = None) -> None: return except TimeoutError: logger.warning( - f"{self.dealer_id} failed to get acknowledgment on the {message}. Resending." + f"{self.dealer_id} failed to get acknowledgment on the {message!r}. Resending." ) except zmq.ZMQError as exc: logger.debug( @@ -144,5 +144,5 @@ async def send(self, message: str | bytes, retries: int | None = None) -> None: self.socket.connect(self.url) backoff = min(backoff * 2, 10) # Exponential backoff raise ClientConnectionError( - f"{self.dealer_id} Failed to send {message=} after {retries=}" + f"{self.dealer_id} Failed to send {message!r} after retries!" ) diff --git a/src/_ert/forward_model_runner/reporting/event.py b/src/_ert/forward_model_runner/reporting/event.py index 2915406ed27..337a5050061 100644 --- a/src/_ert/forward_model_runner/reporting/event.py +++ b/src/_ert/forward_model_runner/reporting/event.py @@ -3,6 +3,7 @@ import asyncio import logging import queue +import threading from pathlib import Path from typing import Final @@ -27,7 +28,7 @@ Start, ) from _ert.forward_model_runner.reporting.statemachine import StateMachine -from _ert.threading import ErtThread, threading +from _ert.threading import ErtThread logger = logging.getLogger(__name__) @@ -56,11 +57,11 @@ class Event(Reporter): def __init__( self, - evaluator_url, - token=None, - ack_timeout=None, - max_retries=None, - finished_event_timeout=None, + evaluator_url: str, + token: str | None = None, + ack_timeout: float | None = None, + max_retries: int | None = None, + finished_event_timeout: float | None = None, ): self._evaluator_url = evaluator_url self._token = token