Skip to content

Commit bb621b3

Browse files
authored
Fix svg_to_bytes() typing (#75)
Fixes typing of `svg_to_bytes()`: - fixed return type - fixed `Literal` usage - unified boolean flags
1 parent f00d66b commit bb621b3

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

resvg_py.pyi

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,30 @@ def svg_to_bytes(
88
svg_path: str | None = None,
99
background: str | None = None,
1010
skip_system_fonts: bool | None = False,
11-
log_information: bool = False,
11+
log_information: bool | None = False,
1212
width: int | None = None,
1313
height: int | None = None,
1414
zoom: int | None = None,
1515
dpi: int | None = 0,
1616
resources_dir: str | None = None,
1717
languages: list[str] | None = [],
1818
font_size: int | None = 16,
19-
font_family: str | None = Literal["Times New Roman"],
20-
serif_family: str | None = Literal["Times New Roman"],
21-
sans_serif_family: str | None = Literal["Arial"],
22-
cursive_family: str | None = Literal["Comic Sans MS"],
23-
fantasy_family: str | None = ["Impact"],
24-
monospace_family: str | None = Literal["Courier New"],
19+
font_family: str | None = "Times New Roman",
20+
serif_family: str | None = "Times New Roman",
21+
sans_serif_family: str | None = "Arial",
22+
cursive_family: str | None = "Comic Sans MS",
23+
fantasy_family: str | None = "Impact",
24+
monospace_family: str | None = "Courier New",
2525
font_files: list[str] | None = None,
2626
font_dirs: list[str] | None = None,
2727
shape_rendering: Literal[
2828
"optimize_speed", "crisp_edges", "geometric_precision"
29-
] = Literal["geometric_precision"],
29+
] = "geometric_precision",
3030
text_rendering: Literal[
3131
"optimize_speed", "optimize_legibility", "optimize_legibility"
32-
] = Literal["optimize_legibility"],
33-
image_rendering: Literal["optimize_quality", "optimize_speed"] = Literal[
34-
"optimize_quality"
35-
],
36-
) -> list[bytes]:
32+
] = "optimize_legibility",
33+
image_rendering: Literal["optimize_quality", "optimize_speed"] = "optimize_quality"
34+
) -> bytes:
3735
"""
3836
:param svg_str: A string containing valid svg.
3937
:param svg_path: A path to a valid svg.

0 commit comments

Comments
 (0)