|
7 | 7 | from itertools import cycle |
8 | 8 | from pathlib import Path |
9 | 9 | from textwrap import dedent |
10 | | -from typing import Any, Dict, List, Optional, Union |
| 10 | +from typing import Annotated, Any, Optional, Union |
11 | 11 |
|
12 | 12 | import fastar |
13 | 13 | import rignore |
|
17 | 17 | from rich.text import Text |
18 | 18 | from rich_toolkit import RichToolkit |
19 | 19 | from rich_toolkit.menu import Option |
20 | | -from typing_extensions import Annotated |
21 | 20 |
|
22 | 21 | from fastapi_cloud_cli.commands.login import login |
23 | 22 | from fastapi_cloud_cli.utils.api import APIClient, BuildLogError, TooManyRetriesError |
@@ -102,7 +101,7 @@ class Team(BaseModel): |
102 | 101 | name: str |
103 | 102 |
|
104 | 103 |
|
105 | | -def _get_teams() -> List[Team]: |
| 104 | +def _get_teams() -> list[Team]: |
106 | 105 | with APIClient() as client: |
107 | 106 | response = client.get("/teams/") |
108 | 107 | response.raise_for_status() |
@@ -184,7 +183,7 @@ def _create_deployment(app_id: str) -> CreateDeploymentResponse: |
184 | 183 |
|
185 | 184 | class RequestUploadResponse(BaseModel): |
186 | 185 | url: str |
187 | | - fields: Dict[str, str] |
| 186 | + fields: dict[str, str] |
188 | 187 |
|
189 | 188 |
|
190 | 189 | def _upload_deployment(deployment_id: str, archive_path: Path) -> None: |
@@ -242,7 +241,7 @@ def _get_app(app_slug: str) -> Optional[AppResponse]: |
242 | 241 | return model_validate(AppResponse, data) |
243 | 242 |
|
244 | 243 |
|
245 | | -def _get_apps(team_id: str) -> List[AppResponse]: |
| 244 | +def _get_apps(team_id: str) -> list[AppResponse]: |
246 | 245 | with APIClient() as client: |
247 | 246 | response = client.get("/apps/", params={"team_id": team_id}) |
248 | 247 | response.raise_for_status() |
@@ -363,9 +362,12 @@ def _wait_for_deployment( |
363 | 362 |
|
364 | 363 | last_message_changed_at = time.monotonic() |
365 | 364 |
|
366 | | - with toolkit.progress( |
367 | | - next(messages), inline_logs=True, lines_to_show=20 |
368 | | - ) as progress, APIClient() as client: |
| 365 | + with ( |
| 366 | + toolkit.progress( |
| 367 | + next(messages), inline_logs=True, lines_to_show=20 |
| 368 | + ) as progress, |
| 369 | + APIClient() as client, |
| 370 | + ): |
369 | 371 | try: |
370 | 372 | for log in client.stream_build_logs(deployment.id): |
371 | 373 | time_elapsed = time.monotonic() - started_at |
@@ -609,9 +611,10 @@ def deploy( |
609 | 611 | archive_path = Path(temp_dir) / "archive.tar" |
610 | 612 | archive(path or Path.cwd(), archive_path) |
611 | 613 |
|
612 | | - with toolkit.progress( |
613 | | - title="Creating deployment" |
614 | | - ) as progress, handle_http_errors(progress): |
| 614 | + with ( |
| 615 | + toolkit.progress(title="Creating deployment") as progress, |
| 616 | + handle_http_errors(progress), |
| 617 | + ): |
615 | 618 | logger.debug("Creating deployment for app: %s", app.id) |
616 | 619 | deployment = _create_deployment(app.id) |
617 | 620 |
|
|
0 commit comments