From 7a4bff392b411b3ee536c6722d2ebb8c762cd86f Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Sun, 5 May 2024 16:42:00 -0300 Subject: [PATCH 1/3] Fixes and style --- postgrest/_async/request_builder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/postgrest/_async/request_builder.py b/postgrest/_async/request_builder.py index 6349ce91..13df7715 100644 --- a/postgrest/_async/request_builder.py +++ b/postgrest/_async/request_builder.py @@ -71,14 +71,14 @@ async def execute(self) -> APIResponse[_ReturnT]: if self.headers.get( "Accept" ) and "application/vnd.pgrst.plan" in self.headers.get("Accept"): - if not "+json" in self.headers.get("Accept"): + if "+json" not in self.headers.get("Accept"): return body return APIResponse[_ReturnT].from_http_request_response(r) else: raise APIError(r.json()) except ValidationError as e: raise APIError(r.json()) from e - except JSONDecodeError as e: + except JSONDecodeError: raise APIError(generate_default_error_message(r)) @@ -127,7 +127,7 @@ async def execute(self) -> SingleAPIResponse[_ReturnT]: raise APIError(r.json()) except ValidationError as e: raise APIError(r.json()) from e - except JSONDecodeError as e: + except JSONDecodeError: raise APIError(generate_default_error_message(r)) From 8049248853d84cf95f92e25188bf3cebe114507d Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Sun, 5 May 2024 16:42:29 -0300 Subject: [PATCH 2/3] Fixes and style --- postgrest/_sync/request_builder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/postgrest/_sync/request_builder.py b/postgrest/_sync/request_builder.py index fccff0c4..f713e7d2 100644 --- a/postgrest/_sync/request_builder.py +++ b/postgrest/_sync/request_builder.py @@ -71,14 +71,14 @@ def execute(self) -> APIResponse[_ReturnT]: if self.headers.get( "Accept" ) and "application/vnd.pgrst.plan" in self.headers.get("Accept"): - if not "+json" in self.headers.get("Accept"): + if "+json" not in self.headers.get("Accept"): return body return APIResponse[_ReturnT].from_http_request_response(r) else: raise APIError(r.json()) except ValidationError as e: raise APIError(r.json()) from e - except JSONDecodeError as e: + except JSONDecodeError: raise APIError(generate_default_error_message(r)) @@ -127,7 +127,7 @@ def execute(self) -> SingleAPIResponse[_ReturnT]: raise APIError(r.json()) except ValidationError as e: raise APIError(r.json()) from e - except JSONDecodeError as e: + except JSONDecodeError: raise APIError(generate_default_error_message(r)) From e2267b9d525d3abd163294f394d44d5a8b75b8c2 Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Sun, 5 May 2024 16:42:49 -0300 Subject: [PATCH 3/3] Fixes and style --- postgrest/base_request_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgrest/base_request_builder.py b/postgrest/base_request_builder.py index 3f6b0ff4..8ee7b20f 100644 --- a/postgrest/base_request_builder.py +++ b/postgrest/base_request_builder.py @@ -196,7 +196,7 @@ def from_http_request_response( ) -> Self: try: data = request_response.json() - except JSONDecodeError as e: + except JSONDecodeError: return cls(data=[], count=0) count = cls._get_count_from_http_request_response(request_response) # the type-ignore here is as pydantic needs us to pass the type parameter