Skip to content

Commit a14ddea

Browse files
committed
refactor: Enhance code readability and formatting across multiple files
- Improved the formatting of the Docker image retrieval logic in the `Settings` class in `__init__.py`. - Streamlined dictionary comprehension in the `ApiKeyRecord` class in `api_key.py`. - Refined the formatting of memory total calculation in the `HealthCheckService` class in `health.py`. - Enhanced the structure of the `ExecutionContext` class in `orchestrator.py` for better clarity.
1 parent 090f564 commit a14ddea

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/config/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,11 @@ def _set_supported_languages(cls, v, values):
404404
tag = values.get("docker_image_tag", "latest")
405405
return {
406406
code: {
407-
"image": f"{registry}/{lang.image.rsplit(':', 1)[0]}:{tag}"
408-
if registry
409-
else f"{lang.image.rsplit(':', 1)[0]}:{tag}",
407+
"image": (
408+
f"{registry}/{lang.image.rsplit(':', 1)[0]}:{tag}"
409+
if registry
410+
else f"{lang.image.rsplit(':', 1)[0]}:{tag}"
411+
),
410412
"timeout_multiplier": lang.timeout_multiplier,
411413
"memory_multiplier": lang.memory_multiplier,
412414
}

src/models/api_key.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ def from_redis_hash(cls, data: Dict[bytes, bytes]) -> "ApiKeyRecord":
111111
"""Create from Redis hash data (bytes keys/values)."""
112112
# Decode bytes to strings
113113
decoded = {
114-
k.decode()
115-
if isinstance(k, bytes)
116-
else k: (v.decode() if isinstance(v, bytes) else v)
114+
k.decode() if isinstance(k, bytes) else k: (
115+
v.decode() if isinstance(v, bytes) else v
116+
)
117117
for k, v in data.items()
118118
}
119119

src/services/health.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,7 @@ async def check_docker(self) -> HealthCheckResult:
404404
"running_containers": running_containers,
405405
"registry_accessible": registry_accessible,
406406
"server_version": system_info.get("ServerVersion", "unknown"),
407-
"memory_total_gb": round(
408-
system_info.get("MemTotal", 0) / (1024**3), 2
409-
),
407+
"memory_total_gb": round(system_info.get("MemTotal", 0) / (1024**3), 2),
410408
"cpu_count": system_info.get("NCPU", 0),
411409
}
412410

src/services/orchestrator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ class ExecutionContext:
6262
generated_files: Optional[List[FileRef]] = None
6363
stdout: str = ""
6464
stderr: str = ""
65-
container: Optional[
66-
Any
67-
] = None # Container used for execution (avoids session lookup)
65+
container: Optional[Any] = (
66+
None # Container used for execution (avoids session lookup)
67+
)
6868
# State persistence fields
6969
initial_state: Optional[str] = None
7070
new_state: Optional[str] = None

0 commit comments

Comments
 (0)