Skip to content

Commit 854f2b7

Browse files
committed
fix: fix complains on PYI034
1 parent 3d83b0f commit 854f2b7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

openapi_python_client/templates/client.py.jinja

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import ssl
2-
from typing import Any
2+
from typing import Any, Self
33

44
from attrs import define, field, evolve
55
import httpx
@@ -98,7 +98,7 @@ class Client:
9898
return evolve(self, timeout=timeout)
9999
{% endmacro %}{{ builders("Client") }}
100100
{% macro httpx_stuff(name, custom_constructor=None) %}
101-
def set_httpx_client(self, client: httpx.Client) -> "{{ name }}":
101+
def set_httpx_client(self, client: httpx.Client) -> Self:
102102
"""Manually set the underlying httpx.Client
103103

104104
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
@@ -123,7 +123,7 @@ class Client:
123123
)
124124
return self._client
125125

126-
def __enter__(self) -> "{{ name }}":
126+
def __enter__(self) -> Self:
127127
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
128128
self.get_httpx_client().__enter__()
129129
return self
@@ -132,7 +132,7 @@ class Client:
132132
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
133133
self.get_httpx_client().__exit__(*args, **kwargs)
134134

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

138138
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
@@ -157,7 +157,7 @@ class Client:
157157
)
158158
return self._async_client
159159

160-
async def __aenter__(self) -> "{{ name }}":
160+
async def __aenter__(self) -> Self:
161161
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
162162
await self.get_async_httpx_client().__aenter__()
163163
return self

0 commit comments

Comments
 (0)