From 5595d35d35e490a7f33289410a0aedb87db1ff8e Mon Sep 17 00:00:00 2001 From: Ali Hamdi Ali Fadel Date: Sat, 2 Sep 2023 17:48:48 +0300 Subject: [PATCH] Fix 2 simple sonar code smells --- tafrigh/recognizers/wit_calling_throttle.py | 2 +- tafrigh/recognizers/wit_recognizer.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tafrigh/recognizers/wit_calling_throttle.py b/tafrigh/recognizers/wit_calling_throttle.py index 0e83304..18dde0c 100644 --- a/tafrigh/recognizers/wit_calling_throttle.py +++ b/tafrigh/recognizers/wit_calling_throttle.py @@ -19,7 +19,7 @@ def throttle(self, wit_client_access_token_index: int) -> None: self.call_timestamps[wit_client_access_token_index] = list( filter( - lambda x: now - x < self.expired_time, + lambda call_timestamp, now=now: now - call_timestamp < self.expired_time, self.call_timestamps[wit_client_access_token_index], ) ) diff --git a/tafrigh/recognizers/wit_recognizer.py b/tafrigh/recognizers/wit_recognizer.py index 3c9b51a..3128d5e 100644 --- a/tafrigh/recognizers/wit_recognizer.py +++ b/tafrigh/recognizers/wit_recognizer.py @@ -139,7 +139,7 @@ def _process_segment( else: retries -= 1 time.sleep(self.processes_per_wit_client_access_token + 1) - except: + except Exception: retries -= 1 time.sleep(self.processes_per_wit_client_access_token + 1)