Skip to content

Commit c3dcb03

Browse files
fix: Correct docstring typos in client template (#1347)
## Summary - Fix `with_timeout` docstring to say "timeout configuration" instead of "in seconds" since the method accepts an `httpx.Timeout` object, not a numeric value - Fix `set_async_httpx_client` docstring to include missing verb "set" ## Changes - Updated `openapi_python_client/templates/client.py.jinja:93` to correct the `with_timeout` description - Updated `openapi_python_client/templates/client.py.jinja:136` to fix the grammatical error in `set_async_httpx_client` - Regenerated all golden records to reflect template changes ## Test plan - [x] Regenerated golden records with `pdm regen` - [x] Verified all generated client.py files now have correct docstrings These changes improve the accuracy of the generated client documentation and fix grammatical errors.
1 parent 30b27c2 commit c3dcb03

File tree

6 files changed

+22
-22
lines changed
  • end_to_end_tests
    • docstrings-on-attributes-golden-record/my_test_api_client
    • golden-record/my_test_api_client
    • literal-enums-golden-record/my_enum_api_client
    • test-3-1-golden-record/test_3_1_features_client
  • integration-tests/integration_tests
  • openapi_python_client/templates

6 files changed

+22
-22
lines changed

end_to_end_tests/docstrings-on-attributes-golden-record/my_test_api_client/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client":
5858
return evolve(self, cookies={**self._cookies, **cookies})
5959

6060
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
61-
"""Get a new client matching this one with a new timeout (in seconds)"""
61+
"""Get a new client matching this one with a new timeout configuration"""
6262
if self._client is not None:
6363
self._client.timeout = timeout
6464
if self._async_client is not None:
@@ -97,7 +97,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
9797
self.get_httpx_client().__exit__(*args, **kwargs)
9898

9999
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
100-
"""Manually the underlying httpx.AsyncClient
100+
"""Manually set the underlying httpx.AsyncClient
101101
102102
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
103103
"""
@@ -188,7 +188,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
188188
return evolve(self, cookies={**self._cookies, **cookies})
189189

190190
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
191-
"""Get a new client matching this one with a new timeout (in seconds)"""
191+
"""Get a new client matching this one with a new timeout configuration"""
192192
if self._client is not None:
193193
self._client.timeout = timeout
194194
if self._async_client is not None:
@@ -228,7 +228,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
228228
self.get_httpx_client().__exit__(*args, **kwargs)
229229

230230
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
231-
"""Manually the underlying httpx.AsyncClient
231+
"""Manually set the underlying httpx.AsyncClient
232232
233233
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
234234
"""

end_to_end_tests/golden-record/my_test_api_client/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client":
6262
return evolve(self, cookies={**self._cookies, **cookies})
6363

6464
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
65-
"""Get a new client matching this one with a new timeout (in seconds)"""
65+
"""Get a new client matching this one with a new timeout configuration"""
6666
if self._client is not None:
6767
self._client.timeout = timeout
6868
if self._async_client is not None:
@@ -101,7 +101,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
101101
self.get_httpx_client().__exit__(*args, **kwargs)
102102

103103
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
104-
"""Manually the underlying httpx.AsyncClient
104+
"""Manually set the underlying httpx.AsyncClient
105105
106106
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
107107
"""
@@ -196,7 +196,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
196196
return evolve(self, cookies={**self._cookies, **cookies})
197197

198198
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
199-
"""Get a new client matching this one with a new timeout (in seconds)"""
199+
"""Get a new client matching this one with a new timeout configuration"""
200200
if self._client is not None:
201201
self._client.timeout = timeout
202202
if self._async_client is not None:
@@ -236,7 +236,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
236236
self.get_httpx_client().__exit__(*args, **kwargs)
237237

238238
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
239-
"""Manually the underlying httpx.AsyncClient
239+
"""Manually set the underlying httpx.AsyncClient
240240
241241
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
242242
"""

end_to_end_tests/literal-enums-golden-record/my_enum_api_client/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client":
6262
return evolve(self, cookies={**self._cookies, **cookies})
6363

6464
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
65-
"""Get a new client matching this one with a new timeout (in seconds)"""
65+
"""Get a new client matching this one with a new timeout configuration"""
6666
if self._client is not None:
6767
self._client.timeout = timeout
6868
if self._async_client is not None:
@@ -101,7 +101,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
101101
self.get_httpx_client().__exit__(*args, **kwargs)
102102

103103
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
104-
"""Manually the underlying httpx.AsyncClient
104+
"""Manually set the underlying httpx.AsyncClient
105105
106106
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
107107
"""
@@ -196,7 +196,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
196196
return evolve(self, cookies={**self._cookies, **cookies})
197197

198198
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
199-
"""Get a new client matching this one with a new timeout (in seconds)"""
199+
"""Get a new client matching this one with a new timeout configuration"""
200200
if self._client is not None:
201201
self._client.timeout = timeout
202202
if self._async_client is not None:
@@ -236,7 +236,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
236236
self.get_httpx_client().__exit__(*args, **kwargs)
237237

238238
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
239-
"""Manually the underlying httpx.AsyncClient
239+
"""Manually set the underlying httpx.AsyncClient
240240
241241
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
242242
"""

end_to_end_tests/test-3-1-golden-record/test_3_1_features_client/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client":
6262
return evolve(self, cookies={**self._cookies, **cookies})
6363

6464
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
65-
"""Get a new client matching this one with a new timeout (in seconds)"""
65+
"""Get a new client matching this one with a new timeout configuration"""
6666
if self._client is not None:
6767
self._client.timeout = timeout
6868
if self._async_client is not None:
@@ -101,7 +101,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
101101
self.get_httpx_client().__exit__(*args, **kwargs)
102102

103103
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
104-
"""Manually the underlying httpx.AsyncClient
104+
"""Manually set the underlying httpx.AsyncClient
105105
106106
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
107107
"""
@@ -196,7 +196,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
196196
return evolve(self, cookies={**self._cookies, **cookies})
197197

198198
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
199-
"""Get a new client matching this one with a new timeout (in seconds)"""
199+
"""Get a new client matching this one with a new timeout configuration"""
200200
if self._client is not None:
201201
self._client.timeout = timeout
202202
if self._async_client is not None:
@@ -236,7 +236,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
236236
self.get_httpx_client().__exit__(*args, **kwargs)
237237

238238
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
239-
"""Manually the underlying httpx.AsyncClient
239+
"""Manually set the underlying httpx.AsyncClient
240240
241241
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
242242
"""

integration-tests/integration_tests/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client":
6262
return evolve(self, cookies={**self._cookies, **cookies})
6363

6464
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
65-
"""Get a new client matching this one with a new timeout (in seconds)"""
65+
"""Get a new client matching this one with a new timeout configuration"""
6666
if self._client is not None:
6767
self._client.timeout = timeout
6868
if self._async_client is not None:
@@ -101,7 +101,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
101101
self.get_httpx_client().__exit__(*args, **kwargs)
102102

103103
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
104-
"""Manually the underlying httpx.AsyncClient
104+
"""Manually set the underlying httpx.AsyncClient
105105
106106
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
107107
"""
@@ -196,7 +196,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
196196
return evolve(self, cookies={**self._cookies, **cookies})
197197

198198
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
199-
"""Get a new client matching this one with a new timeout (in seconds)"""
199+
"""Get a new client matching this one with a new timeout configuration"""
200200
if self._client is not None:
201201
self._client.timeout = timeout
202202
if self._async_client is not None:
@@ -236,7 +236,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None:
236236
self.get_httpx_client().__exit__(*args, **kwargs)
237237

238238
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
239-
"""Manually the underlying httpx.AsyncClient
239+
"""Manually set the underlying httpx.AsyncClient
240240
241241
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
242242
"""

openapi_python_client/templates/client.py.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Client:
9090
return evolve(self, cookies={**self._cookies, **cookies})
9191

9292
def with_timeout(self, timeout: httpx.Timeout) -> "{{ self }}":
93-
"""Get a new client matching this one with a new timeout (in seconds)"""
93+
"""Get a new client matching this one with a new timeout configuration"""
9494
if self._client is not None:
9595
self._client.timeout = timeout
9696
if self._async_client is not None:
@@ -133,7 +133,7 @@ class Client:
133133
self.get_httpx_client().__exit__(*args, **kwargs)
134134

135135
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "{{ name }}":
136-
"""Manually the underlying httpx.AsyncClient
136+
"""Manually set the underlying httpx.AsyncClient
137137

138138
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
139139
"""

0 commit comments

Comments
 (0)