1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 09:13:23 +00:00

Use ruff as linter

This commit is contained in:
Jair Henrique
2023-06-26 14:43:45 -03:00
parent 34d5384318
commit a77173c002
31 changed files with 188 additions and 114 deletions

View File

@@ -261,7 +261,8 @@ class VCRConnection:
else:
if self.cassette.write_protected and self.cassette.filter_request(self._vcr_request):
raise CannotOverwriteExistingCassetteException(
cassette=self.cassette, failed_request=self._vcr_request
cassette=self.cassette,
failed_request=self._vcr_request,
)
# Otherwise, we should send the request, then get the response

View File

@@ -35,7 +35,7 @@ class MockClientResponse(ClientResponse):
session=None,
)
async def json(self, *, encoding="utf-8", loads=json.loads, **kwargs): # NOQA: E999
async def json(self, *, encoding="utf-8", loads=json.loads, **kwargs):
stripped = self._body.strip()
if not stripped:
return None
@@ -162,7 +162,7 @@ async def record_response(cassette, vcr_request, response):
vcr_response = {
"status": {"code": response.status, "message": response.reason},
"headers": _serialize_headers(response.headers),
"body": body, # NOQA: E999
"body": body,
"url": str(response.url),
}
@@ -273,7 +273,7 @@ def vcr_request(cassette, real_request):
log.info("%s not in cassette, sending to real server", vcr_request)
response = await real_request(self, method, url, **kwargs) # NOQA: E999
response = await real_request(self, method, url, **kwargs)
await record_responses(cassette, vcr_request, response)
return response

View File

@@ -31,7 +31,7 @@ def vcr_fetch_impl(cassette, real_fetch_impl):
error=Exception(
"The request (%s) uses AsyncHTTPClient functionality "
"that is not yet supported by VCR.py. Please make the "
"request outside a VCR.py context." % repr(request)
"request outside a VCR.py context." % repr(request),
),
request_time=self.io_loop.time() - request.start_time,
)
@@ -65,7 +65,8 @@ def vcr_fetch_impl(cassette, real_fetch_impl):
request,
599,
error=CannotOverwriteExistingCassetteException(
cassette=cassette, failed_request=vcr_request
cassette=cassette,
failed_request=vcr_request,
),
request_time=self.io_loop.time() - request.start_time,
)