Skip to content

Commit 475a5c4

Browse files
committed
formatting changes ruff formatting
1 parent 53e45d5 commit 475a5c4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ai_diffusion/text.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22
import re
33
from pathlib import Path
4-
from typing import Tuple, List, NamedTuple
4+
from typing import Tuple, List, NamedTuple, Optional
5+
56

67
from .api import LoraInput
78
from .files import FileCollection, FileSource
@@ -230,6 +231,7 @@ def edit_attention(text: str, positive: bool) -> str:
230231
else f"{open_bracket}{attention_string}:{weight:.1f}{close_bracket}"
231232
)
232233

234+
233235
# in case a custom sampler is used then it may show steps and cfg in there
234236
def _parse_sampler_embeds(sampler: str) -> Tuple[str, Optional[int], Optional[float]]:
235237
"""
@@ -266,6 +268,7 @@ def _parse_sampler_embeds(sampler: str) -> Tuple[str, Optional[int], Optional[fl
266268

267269
return base, steps_in, cfg_in
268270

271+
269272
# creates the img text metadata for embedding in PNG files in style like Automatic1111
270273
def create_img_metadata(params: JobParams):
271274
meta = params.metadata

tests/test_text.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
select_on_cursor_pos,
66
create_img_metadata,
77
strip_prompt_comments,
8-
_parse_sampler_embeds
8+
_parse_sampler_embeds,
99
)
1010
from ai_diffusion.api import LoraInput
1111
from ai_diffusion.files import File, FileCollection
@@ -222,6 +222,7 @@ def test_create_img_metadata_missing_metadata_fields():
222222
assert "Size: 100x200" in result
223223
assert "Model: Unknown" in result
224224

225+
225226
def test_create_img_metadata_sampler_embedded():
226227
bounds = Bounds(0, 0, 832, 1216)
227228
metadata = {
@@ -247,6 +248,7 @@ def test_create_img_metadata_sampler_embedded():
247248
assert "Size: 832x1216" in result
248249
assert "Denoising strength" not in result
249250

251+
250252
def test_parse_sampler_embeds():
251253
assert _parse_sampler_embeds("") == ("", None, None)
252254
assert _parse_sampler_embeds("Euler") == ("Euler", None, None)
@@ -255,6 +257,7 @@ def test_parse_sampler_embeds():
255257
assert _parse_sampler_embeds("LCM (13)") == ("LCM", 13, None)
256258
assert _parse_sampler_embeds("LCM (13,1.1)") == ("LCM", 13, 1.1)
257259

260+
258261
class TestEditAttention:
259262
def test_empty_selection(self):
260263
assert edit_attention("", positive=True) == ""

0 commit comments

Comments
 (0)