Skip to content

Commit 9bf4330

Browse files
fix docstrings
1 parent d79a4f9 commit 9bf4330

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

cardinal_pythonlib/excel.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,21 @@ def convert_for_openpyxl(x: Any) -> Any:
8080
the same thing, or a more suitable value!
8181
8282
2025-03-06 update: We were doing this:
83+
84+
.. code-block:: python
85+
8386
if isinstance(x, DateTime):
8487
return pendulum_to_datetime(x)
88+
8589
However, conversion of pendulum.datetime.Datetime to datetime.datetime is
8690
insufficient, because with openpyxl==3.0.7 you can still end up with this
8791
error from openpyxl/utils/datetime.py, line 97, in to_excel:
88-
days = (dt - epoch).days
89-
TypeError: can't subtract offset-naive and offset-aware datetimes
92+
93+
.. code-block:: python
94+
95+
days = (dt - epoch).days
96+
# TypeError: can't subtract offset-naive and offset-aware datetimes
97+
9098
The "epoch" variable does NOT have a timezone attribute. So we need to
9199
ensure that what we produce here doesn't, either. In principle, there are
92100
three alternatives: (a) convert to a standard timezone (UTC), making things
@@ -129,7 +137,11 @@ def convert_for_pyexcel_ods3(x: Any) -> Any:
129137
130138
2025-03-06 update: With pyexcel-ods3==0.6.0, we were getting a KeyError
131139
from pyexcel_ods3/odsw.py, in ODSSheetWriter.write_row. It does this:
140+
141+
.. code-block:: python
142+
132143
value_type = service.ODS_WRITE_FORMAT_COVERSION[type(cell)]
144+
133145
and we had a cell that looked like 'aq' but had the type <class
134146
'sqlalchemy.sql.elements.quoted_name'>, a subclass of str.
135147
"""

0 commit comments

Comments
 (0)