Skip to content

Commit 3a0ca73

Browse files
[fix] ensure Python 3.9 compatibility - use typing imports instead of built-in generics
1 parent 6dd0a36 commit 3a0ca73

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

comfy_cli/command/launch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import sys
77
import threading
88
import uuid
9+
from typing import List, Optional # noqa: UP035
910

1011
import typer
1112
from rich import print
@@ -120,8 +121,8 @@ def redirector_stdout():
120121

121122
def launch(
122123
background: bool = False,
123-
extra: list[str] | None = None,
124-
frontend_pr: str | None = None,
124+
extra: Optional[List[str]] = None, # noqa: UP006, UP045
125+
frontend_pr: Optional[str] = None, # noqa: UP045
125126
):
126127
check_for_updates()
127128
resolved_workspace = workspace_manager.workspace_path

comfy_cli/pr_cache.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import shutil
99
from datetime import datetime, timedelta
1010
from pathlib import Path
11-
from typing import Optional
11+
from typing import Dict, List, Optional # noqa: UP035
1212

1313
from rich import print as rprint
1414

@@ -153,7 +153,7 @@ def _get_cache_info_with_metadata(self, cache_dir: Path) -> Optional[dict]:
153153
info["size_mb"] = self._calculate_cache_size_mb(cache_dir)
154154
return info
155155

156-
def list_cached_frontends(self) -> list[dict]:
156+
def list_cached_frontends(self) -> List[Dict]: # noqa: UP006
157157
"""List all cached frontend PRs."""
158158
frontend_cache = self.cache_dir / "frontend"
159159
if not frontend_cache.exists():
@@ -177,7 +177,7 @@ def _is_cache_expired(self, cached_at: str) -> bool:
177177
except (ValueError, TypeError):
178178
return True # Consider invalid timestamps as expired
179179

180-
def _get_expired_items(self, cached_items: list[dict]) -> list[dict]:
180+
def _get_expired_items(self, cached_items: List[Dict]) -> List[Dict]: # noqa: UP006
181181
"""Get list of expired cache items."""
182182
expired = []
183183
for item in cached_items:
@@ -186,7 +186,7 @@ def _get_expired_items(self, cached_items: list[dict]) -> list[dict]:
186186
expired.append(item)
187187
return expired
188188

189-
def _get_excess_items(self, cached_items: list[dict], expired_items: list[dict]) -> list[dict]:
189+
def _get_excess_items(self, cached_items: List[Dict], expired_items: List[Dict]) -> List[Dict]: # noqa: UP006
190190
"""Get list of items that exceed the maximum cache limit."""
191191
remaining_items = [item for item in cached_items if item not in expired_items]
192192
if len(remaining_items) > self.max_cache_items:

0 commit comments

Comments
 (0)