ruff format

This commit is contained in:
Tim 2025-09-11 16:22:33 -04:00
parent b92af01b38
commit 42c6db81a7

View File

@ -215,7 +215,6 @@ class MemryXDetector(DetectionApi):
self._acquire_file_lock(lock_path) self._acquire_file_lock(lock_path)
try: try:
# ---------- CASE 1: user provided a custom model path ---------- # ---------- CASE 1: user provided a custom model path ----------
if self.memx_model_path: if self.memx_model_path:
if not self.memx_model_path.endswith(".zip"): if not self.memx_model_path.endswith(".zip"):
@ -273,7 +272,9 @@ class MemryXDetector(DetectionApi):
self.memx_post_model = None self.memx_post_model = None
else: else:
# Future model types can optionally use post if present # Future model types can optionally use post if present
self.memx_post_model = post_candidates[0] if post_candidates else None self.memx_post_model = (
post_candidates[0] if post_candidates else None
)
logger.info(f"Using custom model: {self.memx_model_path}") logger.info(f"Using custom model: {self.memx_model_path}")
return return
@ -315,7 +316,9 @@ class MemryXDetector(DetectionApi):
logger.info(f"Model extracted to {self.cache_dir}.") logger.info(f"Model extracted to {self.cache_dir}.")
# Re-assign model paths after extraction # Re-assign model paths after extraction
self.memx_model_path = os.path.join(model_subdir, self.expected_dfp_model) self.memx_model_path = os.path.join(
model_subdir, self.expected_dfp_model
)
self.memx_post_model = ( self.memx_post_model = (
os.path.join(model_subdir, self.expected_post_model) os.path.join(model_subdir, self.expected_post_model)
if self.expected_post_model if self.expected_post_model
@ -331,7 +334,9 @@ class MemryXDetector(DetectionApi):
os.remove(zip_path) os.remove(zip_path)
logger.info("Cleaned up ZIP file after extraction.") logger.info("Cleaned up ZIP file after extraction.")
except Exception as e: except Exception as e:
logger.warning(f"Failed to remove downloaded zip {zip_path}: {e}") logger.warning(
f"Failed to remove downloaded zip {zip_path}: {e}"
)
finally: finally:
self._release_file_lock(lock_path) self._release_file_lock(lock_path)
@ -759,4 +764,4 @@ class MemryXDetector(DetectionApi):
def detect_raw(self, tensor_input: np.ndarray): def detect_raw(self, tensor_input: np.ndarray):
"""Removed synchronous detect_raw() function so that we only use async""" """Removed synchronous detect_raw() function so that we only use async"""
return 0 return 0