refactor(misc): join short multi-line statements (AST-identical)

This commit is contained in:
Teknium
2026-09-02 18:55:16 -07:00
parent 9bbe578aca
commit 8cd56917b6
3 changed files with 5 additions and 21 deletions
+2 -10
View File
@@ -298,10 +298,7 @@ def _process_batch_worker(args: Tuple) -> Dict[str, Any]:
output_dir = Path(output_dir)
print(f"\n🔄 Batch {batch_num}: Starting ({len(batch_data)} prompts)")
batch_output_file = output_dir / f"batch_{batch_num}.jsonl"
prompts_to_process = [
(idx, data) for idx, data in batch_data
if idx not in completed_prompts_set
]
prompts_to_process = [(idx, data) for idx, data in batch_data if idx not in completed_prompts_set]
if not prompts_to_process:
print(f"✅ Batch {batch_num}: Already completed (skipping)")
@@ -497,12 +494,7 @@ class BatchRunner:
return _chunk(list(enumerate(self.dataset)), self.batch_size)
def _empty_checkpoint(self) -> Dict[str, Any]:
return {
"run_name": self.run_name,
"completed_prompts": [],
"batch_stats": {},
"last_updated": None
}
return {"run_name": self.run_name, "completed_prompts": [], "batch_stats": {}, "last_updated": None}
def _load_checkpoint(self) -> Dict[str, Any]:
"""Checkpoint data (completed prompt indices), or an empty one if missing/unreadable."""
+2 -6
View File
@@ -1039,9 +1039,7 @@ def resolve_reasoning_config(cfg: dict | None, model: str = "") -> dict | None:
result = parse_reasoning_effort(effort)
if effort and str(effort).strip() and result is None:
import logging
logging.getLogger(__name__).warning(
"Unknown reasoning_effort '%s', using default (medium)", effort
)
logging.getLogger(__name__).warning("Unknown reasoning_effort '%s', using default (medium)", effort)
return result
@@ -1178,9 +1176,7 @@ def apply_ipv4_preference(force: bool = False) -> None:
def _ipv4_getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
if family == 0: # AF_UNSPEC — caller didn't request a specific family
try:
return _original_getaddrinfo(
host, port, socket.AF_INET, type, proto, flags
)
return _original_getaddrinfo(host, port, socket.AF_INET, type, proto, flags)
except socket.gaierror: # no A record — pure-IPv6 host
return _original_getaddrinfo(host, port, family, type, proto, flags)
return _original_getaddrinfo(host, port, family, type, proto, flags)
+1 -5
View File
@@ -434,11 +434,7 @@ class StartupWatchdogHandle:
return
def _start(self) -> bool:
thread = threading.Thread(
target=self._run,
daemon=True,
name="gateway-startup-watchdog",
)
thread = threading.Thread(target=self._run, daemon=True, name="gateway-startup-watchdog")
try:
thread.start()
except Exception: