style
style
Style resolution utilities.
style.resolve_style
resolve_style(value: Any, cls: type) -> Any
Convert a dict to a style dataclass instance, or return as-is.
Supports nested dicts for composite styles like CircleStyle.
Parameters:
-
value(Any) –None, a style dataclass instance, or adictof keyword arguments. -
cls(type) –The target style dataclass (e.g.
StrokeStyle,CircleStyle).
Returns:
-
Any–Noneif value isNone, the original instance if already the correct type, or a newly constructedcls(**value)from a dict.
Source code in mapyta/style.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |