refactor: unify env var helpers and remove magic slice in cache
- Add _getenv_num as shared core for _getenv_int/_getenv_float
- Add _getenv_optional_float for FRIGATE_SCORE_CEILING (replaces 9-line inline block)
- Add _getenv_bool; replace 11 inline .lower()-in-("true","1","yes") sites
across config.py, jobs.py, and cli.py with single call site
- _resolve_strategy no-embedding branch: inline try/except → _getenv_int("LIMIT", 30)
- cache.py: final[:-4] → final.removesuffix(".npy") — assumption is now explicit
This commit is contained in:
+1
-1
@@ -85,7 +85,7 @@ class EmbeddingCache:
|
||||
final = self._path(asset_id, model)
|
||||
# Insert .tmp before .npy so np.save doesn't auto-append another .npy extension
|
||||
# (np.save appends .npy to paths that don't already end in .npy).
|
||||
tmp = final[:-4] + ".tmp.npy"
|
||||
tmp = final.removesuffix(".npy") + ".tmp.npy"
|
||||
try:
|
||||
np.save(tmp, embedding)
|
||||
os.replace(tmp, final)
|
||||
|
||||
Reference in New Issue
Block a user