mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
modernize typing
This commit is contained in:
+4
-5
@@ -2,7 +2,6 @@ import base64
|
||||
import os
|
||||
import io
|
||||
import time
|
||||
from typing import Union
|
||||
from pydantic import BaseModel, Field # pylint: disable=no-name-in-module
|
||||
import modules.shared as shared
|
||||
|
||||
@@ -48,7 +47,7 @@ class ProgressRequest(BaseModel):
|
||||
|
||||
class InternalProgressResponse(BaseModel):
|
||||
job: str = Field(default=None, title="Job name", description="Internal job name")
|
||||
textinfo: Union[str|None] = Field(default=None, title="Info text", description="Info text used by WebUI.")
|
||||
textinfo: str|None = Field(default=None, title="Info text", description="Info text used by WebUI.")
|
||||
# status fields
|
||||
active: bool = Field(title="Whether the task is being worked on right now")
|
||||
queued: bool = Field(title="Whether the task is in queue")
|
||||
@@ -62,10 +61,10 @@ class InternalProgressResponse(BaseModel):
|
||||
batch_count: int = Field(default=None, title="Total batches", description="Total number of batches")
|
||||
# calculated fields
|
||||
progress: float = Field(default=None, title="Progress", description="The progress with a range of 0 to 1")
|
||||
eta: Union[float|None] = Field(default=None, title="ETA in secs")
|
||||
eta: float|None = Field(default=None, title="ETA in secs")
|
||||
# image fields
|
||||
live_preview: Union[str|None] = Field(default=None, title="Live preview image", description="Current live preview; a data: uri")
|
||||
id_live_preview: Union[int|None] = Field(default=None, title="Live preview image ID", description="Send this together with next request to prevent receiving same image")
|
||||
live_preview: str|None = Field(default=None, title="Live preview image", description="Current live preview; a data: uri")
|
||||
id_live_preview: int|None = Field(default=None, title="Live preview image ID", description="Send this together with next request to prevent receiving same image")
|
||||
|
||||
|
||||
def api_progress(req: ProgressRequest):
|
||||
|
||||
Reference in New Issue
Block a user