Skip to content

Commit 5542b7c

Browse files
authored
[Core] Update for next-mypy (#44557)
This updates azure-core and corehttp to pass the next-mypy checks. Signed-off-by: Paul Van Eck <[email protected]>
1 parent 235f188 commit 5542b7c

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

sdk/core/azure-core/azure/core/pipeline/transport/_requests_asyncio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ async def send( # pylint:disable=invalid-overridden-method
163163
response = await loop.run_in_executor(
164164
None,
165165
functools.partial(
166-
self.session.request,
166+
self.session.request, # type: ignore
167167
request.method,
168168
request.url,
169169
headers=request.headers,

sdk/core/azure-core/azure/core/pipeline/transport/_requests_trio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ async def send(
236236
try:
237237
response = await trio.to_thread.run_sync(
238238
functools.partial(
239-
self.session.request,
239+
self.session.request, # type: ignore
240240
request.method,
241241
request.url,
242242
headers=request.headers,
@@ -254,7 +254,7 @@ async def send(
254254
except AttributeError: # trio < 0.12.1
255255
response = await trio.run_sync_in_worker_thread( # type: ignore # pylint:disable=no-member
256256
functools.partial(
257-
self.session.request,
257+
self.session.request, # type: ignore
258258
request.method,
259259
request.url,
260260
headers=request.headers,

sdk/core/azure-core/azure/core/rest/_http_response_impl.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class _HttpResponseBaseImpl(
182182
:type request: ~azure.core.rest.HttpRequest
183183
:keyword any internal_response: The response we get directly from the transport. For example, for our requests
184184
transport, this will be a requests.Response.
185-
:keyword optional[int] block_size: The block size we are using in our transport
185+
:keyword Optional[int] block_size: The block size we are using in our transport
186186
:keyword int status_code: The status code of the response
187187
:keyword str reason: The HTTP reason
188188
:keyword str content_type: The content type of the response
@@ -264,7 +264,7 @@ def headers(self) -> MutableMapping[str, str]:
264264
def content_type(self) -> Optional[str]:
265265
"""The content type of the response.
266266
267-
:rtype: optional[str]
267+
:rtype: Optional[str]
268268
:return: The content type of the response.
269269
"""
270270
return self._content_type
@@ -285,7 +285,7 @@ def encoding(self) -> Optional[str]:
285285
:return: The response encoding. We either return the encoding set by the user,
286286
or try extracting the encoding from the response's content type. If all fails,
287287
we return `None`.
288-
:rtype: optional[str]
288+
:rtype: Optional[str]
289289
"""
290290
try:
291291
return self._encoding
@@ -294,10 +294,10 @@ def encoding(self) -> Optional[str]:
294294
return self._encoding
295295

296296
@encoding.setter
297-
def encoding(self, value: str) -> None:
297+
def encoding(self, value: Optional[str]) -> None:
298298
"""Sets the response encoding.
299299
300-
:param str value: Sets the response encoding.
300+
:param Optional[str] value: Sets the response encoding.
301301
"""
302302
self._encoding = value
303303
self._text = None # clear text cache
@@ -306,7 +306,7 @@ def encoding(self, value: str) -> None:
306306
def text(self, encoding: Optional[str] = None) -> str:
307307
"""Returns the response body as a string
308308
309-
:param optional[str] encoding: The encoding you want to decode the text with. Can
309+
:param Optional[str] encoding: The encoding you want to decode the text with. Can
310310
also be set independently through our encoding property
311311
:return: The response's content decoded as a string.
312312
:rtype: str
@@ -374,7 +374,7 @@ class HttpResponseImpl(_HttpResponseBaseImpl, _HttpResponse, HttpResponseBackcom
374374
:type request: ~azure.core.rest.HttpRequest
375375
:keyword any internal_response: The response we get directly from the transport. For example, for our requests
376376
transport, this will be a requests.Response.
377-
:keyword optional[int] block_size: The block size we are using in our transport
377+
:keyword Optional[int] block_size: The block size we are using in our transport
378378
:keyword int status_code: The status code of the response
379379
:keyword str reason: The HTTP reason
380380
:keyword str content_type: The content type of the response

sdk/core/corehttp/corehttp/rest/_http_response_impl.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class _HttpResponseBaseImpl(_HttpResponseBase): # pylint: disable=too-many-inst
5454
:type request: ~corehttp.rest.HttpRequest
5555
:keyword any internal_response: The response we get directly from the transport. For example, for our requests
5656
transport, this will be a requests.Response.
57-
:keyword optional[int] block_size: The block size we are using in our transport
57+
:keyword Optional[int] block_size: The block size we are using in our transport
5858
:keyword int status_code: The status code of the response
5959
:keyword str reason: The HTTP reason
6060
:keyword str content_type: The content type of the response
@@ -136,7 +136,7 @@ def headers(self) -> MutableMapping[str, str]:
136136
def content_type(self) -> Optional[str]:
137137
"""The content type of the response.
138138
139-
:rtype: optional[str]
139+
:rtype: Optional[str]
140140
:return: The content type of the response.
141141
"""
142142
return self._content_type
@@ -157,7 +157,7 @@ def encoding(self) -> Optional[str]:
157157
:return: The response encoding. We either return the encoding set by the user,
158158
or try extracting the encoding from the response's content type. If all fails,
159159
we return `None`.
160-
:rtype: optional[str]
160+
:rtype: Optional[str]
161161
"""
162162
try:
163163
return self._encoding
@@ -166,10 +166,10 @@ def encoding(self) -> Optional[str]:
166166
return self._encoding
167167

168168
@encoding.setter
169-
def encoding(self, value: str) -> None:
169+
def encoding(self, value: Optional[str]) -> None:
170170
"""Sets the response encoding.
171171
172-
:param str value: Sets the response encoding.
172+
:param Optional[str] value: Sets the response encoding.
173173
"""
174174
self._encoding = value
175175
self._text = None # clear text cache
@@ -178,7 +178,7 @@ def encoding(self, value: str) -> None:
178178
def text(self, encoding: Optional[str] = None) -> str:
179179
"""Returns the response body as a string
180180
181-
:param optional[str] encoding: The encoding you want to decode the text with. Can
181+
:param Optional[str] encoding: The encoding you want to decode the text with. Can
182182
also be set independently through our encoding property
183183
:return: The response's content decoded as a string.
184184
:rtype: str
@@ -246,7 +246,7 @@ class HttpResponseImpl(_HttpResponseBaseImpl, _HttpResponse):
246246
:type request: ~corehttp.rest.HttpRequest
247247
:keyword any internal_response: The response we get directly from the transport. For example, for our requests
248248
transport, this will be a requests.Response.
249-
:keyword optional[int] block_size: The block size we are using in our transport
249+
:keyword Optional[int] block_size: The block size we are using in our transport
250250
:keyword int status_code: The status code of the response
251251
:keyword str reason: The HTTP reason
252252
:keyword str content_type: The content type of the response

0 commit comments

Comments
 (0)