Skip to content

Commit 01da6d2

Browse files
committed
docs: add TODO(py3.10) markers for fromisoformat workaround
Make the .replace("Z", "+00:00") workaround discoverable by both `rg TODO` and `rg "3.10|py3.10"` so it can be cleanly removed when the project drops Python 3.10 support.
1 parent 6c43b97 commit 01da6d2

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

openapi_python_client/parser/properties/datetime.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def convert_value(cls, value: Any) -> Value | None | PropertyError:
5555
if value is None or isinstance(value, Value):
5656
return value
5757
if isinstance(value, str):
58+
# TODO(py3.10): fromisoformat() rejects "Z". Remove when 3.10 support ends.
5859
normalized = value.replace("Z", "+00:00")
5960
try:
6061
datetime.datetime.fromisoformat(normalized) # make sure it's a valid value

openapi_python_client/templates/property_templates/datetime_property.py.jinja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{% macro construct_function(property, source) %}
2+
{# TODO(py3.10): fromisoformat() rejects "Z". Remove when 3.10 support ends. #}
23
datetime.datetime.fromisoformat({{ source }}.replace("Z", "+00:00"))
34
{% endmacro %}
45

0 commit comments

Comments
 (0)