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

Refactor create_client functions to call constructor directly #805

Merged
merged 1 commit into from
May 22, 2024

Conversation

Dartt0n
Copy link
Contributor

@Dartt0n Dartt0n commented May 22, 2024

What kind of change does this PR introduce?

Refactor changes discussed in #798

What is the current behavior?

Right now, acreate_client is a re-import of the _async.client.create_client function. This function, in its body, calls the AsyncClient.create asynchronous class method (see source code). This method itself calls AsyncClient.__init__ (see source code). This chain of function calls, passing the same arguments with the same names three times until it reaches the destination constructor, seems to introduce some unnecessary abstractions.

What is the new behavior?

Both _async.client.create_client and _sync.client.create_client directly call the corresponding class's constructors (AsyncClient.__init__ and SyncClient.__init__).

Meta

Closes #798

@Dartt0n Dartt0n requested a review from a team as a code owner May 22, 2024 11:13
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.

We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.

Copy link

codecov bot commented May 22, 2024

Codecov Report

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

Project coverage is 64.44%. Comparing base (819ba63) to head (0553563).
Report is 58 commits behind head on main.

Files Patch % Lines
supabase/_async/client.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #805       +/-   ##
===========================================
+ Coverage   43.97%   64.44%   +20.46%     
===========================================
  Files          13       13               
  Lines         332      315       -17     
===========================================
+ Hits          146      203       +57     
+ Misses        186      112       -74     

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

@silentworks silentworks merged commit 46c201f into supabase-community:main May 22, 2024
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.

async create client function should not be marked as async
2 participants