From 4868793c482ea6a1563541d30bfdf7e037c4daec Mon Sep 17 00:00:00 2001 From: Acly Date: Sun, 7 Jan 2024 22:11:57 +0100 Subject: [PATCH] Fix typing --- ai_diffusion/workflow.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ai_diffusion/workflow.py b/ai_diffusion/workflow.py index aeabbc2f4..6bb4f8ff8 100644 --- a/ai_diffusion/workflow.py +++ b/ai_diffusion/workflow.py @@ -6,7 +6,7 @@ import re from itertools import chain from pathlib import Path -from typing import Any, List, NamedTuple, Optional +from typing import Any, List, NamedTuple, Optional, overload from .image import Bounds, Extent, Image, Mask, multiple_of from .client import Client, resolve_sd_version @@ -81,6 +81,12 @@ class ScaledExtent(NamedTuple): desired: Extent # resolution for high res refinement pass target: Extent # target resolution in canvas (may not be multiple of 8) + @overload + def convert(self, extent: Extent, src: str, dst: str) -> Extent: ... + + @overload + def convert(self, extent: Bounds, src: str, dst: str) -> Bounds: ... + def convert(self, extent: Extent | Bounds, src: str, dst: str): """Converts an extent or bounds between two "resolution spaces" by scaling with the respective ratio."""