[Bf-blender-cvs] [47b0ca85cd9] blender-v3.2-release: Fix float representation for Python API docs
Campbell Barton
noreply at git.blender.org
Mon May 23 04:36:05 CEST 2022
Commit: 47b0ca85cd9596bc4948b15a77b45cbd7812554c
Author: Campbell Barton
Date: Mon May 23 12:05:42 2022 +1000
Branches: blender-v3.2-release
https://developer.blender.org/rB47b0ca85cd9596bc4948b15a77b45cbd7812554c
Fix float representation for Python API docs
float_as_string(1000000) resulted in 1e+06.0 which isn't valid notation.
===================================================================
M release/scripts/modules/rna_info.py
===================================================================
diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py
index 687f3c95d0b..76b59e4e816 100644
--- a/release/scripts/modules/rna_info.py
+++ b/release/scripts/modules/rna_info.py
@@ -61,7 +61,8 @@ def range_str(val):
def float_as_string(f):
val_str = "%g" % f
- if '.' not in val_str and '-' not in val_str: # value could be 1e-05
+ # Ensure a `.0` suffix for whole numbers, excluding scientific notation such as `1e-05` or `1e+5`.
+ if '.' not in val_str and 'e' not in val_str:
val_str += '.0'
return val_str
More information about the Bf-blender-cvs
mailing list