Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and style #425

Merged
merged 3 commits into from
May 26, 2024
Merged

Conversation

juancarlospaco
Copy link
Contributor

What kind of change does this PR introduce?

  • Tiny fixes and proper code style.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @juancarlospaco - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 5 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@@ -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"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Improved readability with 'not in' for membership test.

Suggested change
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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Removal of unused exception variable 'e' is a good practice.

Suggested change
except JSONDecodeError as e:
except JSONDecodeError:
raise APIError(generate_default_error_message(r))

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Good removal of the unused variable 'e' in exception handling.

@@ -196,7 +196,7 @@ def from_http_request_response(
) -> Self:
try:
data = request_response.json()
except JSONDecodeError as e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Efficient use of exception handling by removing unused variable 'e'.

Suggested change
except JSONDecodeError as e:
except JSONDecodeError:
raise APIError(generate_default_error_message(r))

@@ -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"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code_refinement): Consistency in using 'not in' for membership checks enhances code readability.

Suggested change
if not "+json" in self.headers.get("Accept"):
if "+json" not in self.headers.get("Accept"):

Copy link

codecov bot commented May 5, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 95.91%. Comparing base (b858685) to head (e2267b9).
Report is 28 commits behind head on master.

Files Patch % Lines
postgrest/_async/request_builder.py 66.66% 1 Missing ⚠️
postgrest/base_request_builder.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #425      +/-   ##
==========================================
+ Coverage   95.72%   95.91%   +0.18%     
==========================================
  Files          28       28              
  Lines        1639     1715      +76     
==========================================
+ Hits         1569     1645      +76     
  Misses         70       70              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@silentworks silentworks merged commit 11076da into supabase-community:master May 26, 2024
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants