Skip to content

Commit 474b778

Browse files
committed
lint
1 parent 3b3e9c0 commit 474b778

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

openevolve/database.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ def save(self, path: Optional[str] = None, iteration: int = 0) -> None:
307307
logger.warning("No database path specified, skipping save")
308308
return
309309

310-
lock_name = os.path.basename(save_path) + '.lock'
311-
lock_path = os.path.join('tmp/locks', lock_name)
310+
lock_name = os.path.basename(save_path) + ".lock"
311+
lock_path = os.path.join("tmp/locks", lock_name)
312312
try:
313313
with FileLock(lock_path, timeout=10):
314314
# Create directory and remove old path if it exists
@@ -372,8 +372,8 @@ def load(self, path: str) -> None:
372372
logger.info(f"Loaded database metadata with last_iteration={self.last_iteration}")
373373

374374
# Load programs
375-
lock_name = os.path.basename(path) + '.lock'
376-
lock_path = os.path.join('tmp/locks', lock_name)
375+
lock_name = os.path.basename(path) + ".lock"
376+
lock_path = os.path.join("tmp/locks", lock_name)
377377
programs_dir = os.path.join(path, "programs")
378378
try:
379379
with FileLock(lock_path, timeout=10):
@@ -452,7 +452,7 @@ def _calculate_feature_coords(self, program: Program) -> List[int]:
452452
bin_idx = 0
453453
else:
454454
avg_score = safe_numeric_average(program.metrics)
455-
bin_idx = min(int(avg_score * self.feature_bins), self.feature_bins - 1)
455+
bin_idx = max(0, min(int(avg_score * self.feature_bins), self.feature_bins - 1))
456456
coords.append(bin_idx)
457457
elif dim in program.metrics:
458458
# Use specific metric

0 commit comments

Comments
 (0)