Skip to content

Commit 503da96

Browse files
Fix deptry issue: Remove dateutil dependency and use built-in datetime methods
1 parent e092ce4 commit 503da96

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/codegen/agents/client/openapi_client/api_client.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from typing import Optional, Union
2020
from urllib.parse import quote
2121

22-
from dateutil.parser import parse
2322
from pydantic import SecretStr
2423

2524
import codegen.agents.client.openapi_client as openapi_client
@@ -42,8 +41,8 @@ class ApiClient:
4241
4342
:param configuration: .Configuration object for this client
4443
:param header_name: a header to pass when making calls to the API.
45-
:param header_value: a header value to pass when making calls to
46-
the API.
44+
:param header_value: a header value to pass when making calls
45+
to the API.
4746
:param cookie: a cookie to include in the header when making calls
4847
to the API
4948
"""
@@ -618,9 +617,7 @@ def __deserialize_date(self, string):
618617
:return: date.
619618
"""
620619
try:
621-
return parse(string).date()
622-
except ImportError:
623-
return string
620+
return datetime.datetime.strptime(string, "%Y-%m-%d").date()
624621
except ValueError:
625622
raise rest.ApiException(status=0, reason=f"Failed to parse `{string}` as date object")
626623

@@ -633,9 +630,7 @@ def __deserialize_datetime(self, string):
633630
:return: datetime.
634631
"""
635632
try:
636-
return parse(string)
637-
except ImportError:
638-
return string
633+
return datetime.datetime.fromisoformat(string.replace('Z', '+00:00'))
639634
except ValueError:
640635
raise rest.ApiException(status=0, reason=(f"Failed to parse `{string}` as datetime object"))
641636

0 commit comments

Comments
 (0)