about summary refs log tree commit diff
path: root/.venv/lib/python3.12/site-packages/openpyxl/compat/strings.py
diff options
context:
space:
mode:
authorS. Solomon Darnell2025-03-28 21:52:21 -0500
committerS. Solomon Darnell2025-03-28 21:52:21 -0500
commit4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch)
treeee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/openpyxl/compat/strings.py
parentcc961e04ba734dd72309fb548a2f97d67d578813 (diff)
downloadgn-ai-4a52a71956a8d46fcb7294ac71734504bb09bcc2.tar.gz
two version of R2R are here HEAD master
Diffstat (limited to '.venv/lib/python3.12/site-packages/openpyxl/compat/strings.py')
-rw-r--r--.venv/lib/python3.12/site-packages/openpyxl/compat/strings.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/openpyxl/compat/strings.py b/.venv/lib/python3.12/site-packages/openpyxl/compat/strings.py
new file mode 100644
index 00000000..2cc9d60e
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/openpyxl/compat/strings.py
@@ -0,0 +1,25 @@
+# Copyright (c) 2010-2024 openpyxl
+
+from datetime import datetime
+from math import isnan, isinf
+import sys
+
+VER = sys.version_info
+
+from .numbers import NUMERIC_TYPES
+
+
+def safe_string(value):
+    """Safely and consistently format numeric values"""
+    if isinstance(value, NUMERIC_TYPES):
+        if isnan(value) or isinf(value):
+            value = ""
+        else:
+            value = "%.16g" % value
+    elif value is None:
+        value = "none"
+    elif isinstance(value, datetime):
+        value = value.isoformat()
+    elif not isinstance(value, str):
+        value = str(value)
+    return value