svg-ultralight 0.25.0__py3-none-any.whl → 0.26.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of svg-ultralight might be problematic. Click here for more details.
- svg_ultralight/bounding_boxes/type_bounding_box.py +0 -7
- svg_ultralight/string_conversion.py +9 -6
- {svg_ultralight-0.25.0.dist-info → svg_ultralight-0.26.0.dist-info}/METADATA +1 -1
- {svg_ultralight-0.25.0.dist-info → svg_ultralight-0.26.0.dist-info}/RECORD +6 -6
- {svg_ultralight-0.25.0.dist-info → svg_ultralight-0.26.0.dist-info}/WHEEL +0 -0
- {svg_ultralight-0.25.0.dist-info → svg_ultralight-0.26.0.dist-info}/top_level.txt +0 -0
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
|
-
import warnings
|
|
10
9
|
from dataclasses import dataclass
|
|
11
10
|
|
|
12
11
|
from svg_ultralight.bounding_boxes.supports_bounds import SupportsBounds
|
|
@@ -286,12 +285,6 @@ class BoundingBox(SupportsBounds):
|
|
|
286
285
|
:return: a bounding box around self and other bounding boxes
|
|
287
286
|
:raises DeprecationWarning:
|
|
288
287
|
"""
|
|
289
|
-
warnings.warn(
|
|
290
|
-
"Method a.merge(b, c) is deprecated. "
|
|
291
|
-
+ "Use classmethod BoundingBox.merged(a, b, c) instead.",
|
|
292
|
-
category=DeprecationWarning,
|
|
293
|
-
stacklevel=1,
|
|
294
|
-
)
|
|
295
288
|
return BoundingBox.merged(self, *others)
|
|
296
289
|
|
|
297
290
|
@classmethod
|
|
@@ -79,15 +79,18 @@ def format_numbers_in_string(data: float | str) -> str:
|
|
|
79
79
|
:return: string with floats formatted to limited precision
|
|
80
80
|
|
|
81
81
|
Works as a more robust version of format_number. Will correctly handle input
|
|
82
|
-
floats in exponential notation. This should work for
|
|
83
|
-
svg except 'text'
|
|
84
|
-
'ice3.14bucket', because 'e3.14' will
|
|
85
|
-
will not have such strings, but the
|
|
86
|
-
not handle that case. Do not attempt
|
|
82
|
+
floats in exponential notation. This should work for any parameter value in an
|
|
83
|
+
svg except 'text', 'id' and for any other value except hex color codes. The
|
|
84
|
+
function will fail with input strings like 'ice3.14bucket', because 'e3.14' will
|
|
85
|
+
be identified as a float. SVG param values will not have such strings, but the
|
|
86
|
+
'text' attribute could. This function will not handle that case. Do not attempt
|
|
87
|
+
to reformat 'text' attribute values.
|
|
87
88
|
"""
|
|
88
89
|
with suppress(ValueError):
|
|
89
90
|
# try as a regular number to strip spaces from simple float strings
|
|
90
91
|
return format_number(data)
|
|
92
|
+
if str(data).startswith("#"):
|
|
93
|
+
return str(data)
|
|
91
94
|
words = re.split(r"([^\d.eE-]+)", str(data))
|
|
92
95
|
words = [format_number(w) if _is_float_or_float_str(w) else w for w in words]
|
|
93
96
|
return "".join(words)
|
|
@@ -123,7 +126,7 @@ def _fix_key_and_format_val(key: str, val: str | float) -> tuple[str, str]:
|
|
|
123
126
|
else:
|
|
124
127
|
key_ = key.rstrip("_").replace("_", "-")
|
|
125
128
|
|
|
126
|
-
if key_
|
|
129
|
+
if key_ in {"id", "text"}:
|
|
127
130
|
return key_, str(val)
|
|
128
131
|
|
|
129
132
|
return key_, format_numbers_in_string(val)
|
|
@@ -8,18 +8,18 @@ svg_ultralight/nsmap.py,sha256=y63upO78Rr-JJT56RWWZuyrsILh6HPoY4GhbYnK1A0g,1244
|
|
|
8
8
|
svg_ultralight/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
svg_ultralight/query.py,sha256=PFyhR9v60JkuksRb0LVkml67nmOxfZW9eCtL-JoH52Y,7270
|
|
10
10
|
svg_ultralight/root_elements.py,sha256=rUc26ec-FLAUgO5iOF3aOeKZC7CjiTw7TGyGAj33yNU,3219
|
|
11
|
-
svg_ultralight/string_conversion.py,sha256=
|
|
11
|
+
svg_ultralight/string_conversion.py,sha256=WEmpf75RJmJ2lfJluagAz2wPsz6wM8XvTEwkq4U0vEc,7353
|
|
12
12
|
svg_ultralight/unit_conversion.py,sha256=g07nhzXdjPvGcJmkhLdFbeDLrSmbI8uFoVgPo7G62Bg,9258
|
|
13
13
|
svg_ultralight/bounding_boxes/__init__.py,sha256=qUEn3r4s-1QNHaguhWhhaNfdP4tl_B6YEqxtiTFuzhQ,78
|
|
14
14
|
svg_ultralight/bounding_boxes/supports_bounds.py,sha256=1yqmZ7PH1bBH-LTIUDzSvKFXkPLXfJM7jJNz0bXurZ4,3926
|
|
15
15
|
svg_ultralight/bounding_boxes/type_bound_element.py,sha256=VKiN4UnC2XlPKapWRHxgtqhO4BuVoe6YkLrirlEP09w,5714
|
|
16
|
-
svg_ultralight/bounding_boxes/type_bounding_box.py,sha256=
|
|
16
|
+
svg_ultralight/bounding_boxes/type_bounding_box.py,sha256=OqvS6LhfMwnoE4PUwAmHlY0tjY-2YQZQiLY6O2U3vfs,10378
|
|
17
17
|
svg_ultralight/bounding_boxes/type_padded_text.py,sha256=FnwHD54qPMlyOB0yhRgZShQWA_riaaTS9GwD9HnbPm4,14119
|
|
18
18
|
svg_ultralight/constructors/__init__.py,sha256=YcnO0iBQc19aL8Iemw0Y452MBMBIT2AN5nZCnoGxpn0,327
|
|
19
19
|
svg_ultralight/constructors/new_element.py,sha256=VtMz9sPn9rMk6rui5Poysy3vezlOaS-tGIcGbu-SXmY,3406
|
|
20
20
|
svg_ultralight/strings/__init__.py,sha256=Zalrf-ThFz7b7xKELx5lb2gOlBgV-6jk_k_EeSdVCVk,295
|
|
21
21
|
svg_ultralight/strings/svg_strings.py,sha256=RYKMxOHq9abbZyGcFqsElBGLrBX-EjjNxln3s_ibi30,1296
|
|
22
|
-
svg_ultralight-0.
|
|
23
|
-
svg_ultralight-0.
|
|
24
|
-
svg_ultralight-0.
|
|
25
|
-
svg_ultralight-0.
|
|
22
|
+
svg_ultralight-0.26.0.dist-info/METADATA,sha256=5SIJniz8QdUQVaARRpewHQv6lkmLnetygXSSnVCNmUg,8871
|
|
23
|
+
svg_ultralight-0.26.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
24
|
+
svg_ultralight-0.26.0.dist-info/top_level.txt,sha256=se-6yqM_0Yg5orJKvKWdjQZ4iR4G_EjhL7oRgju-fdY,15
|
|
25
|
+
svg_ultralight-0.26.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|