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 Client.parse_url() #435

Merged
merged 4 commits into from
Sep 13, 2024
Merged

Conversation

ilongin
Copy link
Contributor

@ilongin ilongin commented Sep 12, 2024

Refactoring Client.parse_url() into two methods:

  1. def parse_url(source: str) -> tuple[StorageURI, str]: -> just splits source into storage uri and relative path and doesn't return Client instance any more.
  2. def get_client(source: str, cache: DataChainCache, **kwargs) -> "Client": -> returns Client instance

This is done because in most of the places we were using old .parse_url() to split URL and didn't care about Client instance, but because Client instance was returned, some additional args like cache were needed.

Now we can use simpler merhod .parse_url() where we just need storage uri and path and .get_client() where actual Client instance is needed

@ilongin ilongin mentioned this pull request Sep 12, 2024
Copy link

cloudflare-workers-and-pages bot commented Sep 12, 2024

Deploying datachain-documentation with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8b4c994
Status: ✅  Deploy successful!
Preview URL: https://15f6c83d.datachain-documentation.pages.dev
Branch Preview URL: https://ilongin-434-refactor-client.datachain-documentation.pages.dev

View logs

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 97.14286% with 1 line in your changes missing coverage. Please review.

Project coverage is 87.27%. Comparing base (944defc) to head (8b4c994).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/datachain/catalog/catalog.py 94.11% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #435   +/-   ##
=======================================
  Coverage   87.27%   87.27%           
=======================================
  Files          92       92           
  Lines        9954     9955    +1     
  Branches     2048     2049    +1     
=======================================
+ Hits         8687     8688    +1     
  Misses        913      913           
  Partials      354      354           
Flag Coverage Δ
datachain 87.22% <97.14%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@ilongin ilongin linked an issue Sep 12, 2024 that may be closed by this pull request
@ilongin ilongin requested review from dreadatour and rlamy September 12, 2024 11:58
@ilongin ilongin assigned amritghimire and unassigned amritghimire Sep 12, 2024
@ilongin ilongin merged commit 1ef7556 into main Sep 13, 2024
38 checks passed
@ilongin ilongin deleted the ilongin/434-refactor-client-parse-url branch September 13, 2024 05:31
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.

Refactor Client.parse_url()
2 participants