[Bf-extensions-cvs] [9d54d44e] master: SVG: Cleanup, add comments to functions
Sergey Sharybin
noreply at git.blender.org
Thu Sep 19 15:34:21 CEST 2019
Commit: 9d54d44eb9a326e1f57be396a2825f0712a35fda
Author: Sergey Sharybin
Date: Thu Sep 19 12:27:02 2019 +0200
Branches: master
https://developer.blender.org/rBA9d54d44eb9a326e1f57be396a2825f0712a35fda
SVG: Cleanup, add comments to functions
===================================================================
M io_curve_svg/svg_util.py
===================================================================
diff --git a/io_curve_svg/svg_util.py b/io_curve_svg/svg_util.py
index bacd6917..0aeb2018 100644
--- a/io_curve_svg/svg_util.py
+++ b/io_curve_svg/svg_util.py
@@ -40,10 +40,18 @@ array_of_floats_pattern = f"({match_number})|{match_first_comma}|{match_comma_pa
re_array_of_floats_pattern = re.compile(array_of_floats_pattern)
def parse_array_of_floats(text):
+ """
+ Accepts comma or space separated list of floats (without units) and returns an array
+ of floating point values.
+ """
elements = re_array_of_floats_pattern.findall(text)
return [value_to_float(v[0]) for v in elements]
+
def value_to_float(value_encoded: str):
+ """
+ A simple wrapper around float() which supports empty strings (which are converted to 0).
+ """
if len(value_encoded) == 0:
return 0
return float(value_encoded)
More information about the Bf-extensions-cvs
mailing list