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

Add urls to results #146

Merged
merged 1 commit into from
Apr 8, 2024
Merged

Conversation

samaloney
Copy link
Contributor

@samaloney samaloney commented Mar 27, 2024

Trying to fix #71 specifically and as a baby step for sunpy/sunpy/issues/7140

Currently modified the return values from _get_http and _get_ftp and added a new urls property to the Result object. Not sure if it might be better to create a new object or named tuple to hold the url and str(path) and pass that around?

@samaloney

This comment was marked as outdated.

Copy link

codecov bot commented Mar 28, 2024

Codecov Report

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

Project coverage is 90.63%. Comparing base (3b049c5) to head (60bb7d9).
Report is 11 commits behind head on main.

Files Patch % Lines
parfive/downloader.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #146      +/-   ##
==========================================
+ Coverage   90.23%   90.63%   +0.39%     
==========================================
  Files           5        5              
  Lines         635      662      +27     
==========================================
+ Hits          573      600      +27     
  Misses         62       62              

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

@samaloney samaloney marked this pull request as ready for review April 2, 2024 15:00
@samaloney
Copy link
Contributor Author

I'm not sure about the test fail it passes with py37 on my Mac which is running Sonoma

@Cadair
Copy link
Owner

Cadair commented Apr 4, 2024

@samaloney can you rebase? I pulled your documentation fixes into #149

@Cadair
Copy link
Owner

Cadair commented Apr 4, 2024

oh no more conflicts, sorry!

Copy link
Owner

@Cadair Cadair left a comment

Choose a reason for hiding this comment

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

My only real thought here is the lack of firm enforcement that filepaths have URLs associated with them in the results object.

If it makes it easier, I don't see why we can't enforce that the Results object always has a urls list be populated.

parfive/downloader.py Show resolved Hide resolved
super().__init__(*args)
self._errors = errors or list()
self._urls = urls or list()
Copy link
Owner

Choose a reason for hiding this comment

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

Do we want some kind of assertion that urls is the same length as the list? Or maybe something even more restrictive where we have to pair them up?

Comment on lines 323 to 324
results.append(filepath)
results.urls.append(requested_url)
Copy link
Owner

Choose a reason for hiding this comment

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

Perhaps we should have an append method on results which takes both a filepath and a url?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems reasonable but I think a larger refactor of the Results object will be needed soon as res = res1 + res2 works for the path but not the error and now the urls either same for other operation supported by UserList but not the results object

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I've implemented a basic version here and created new issue around the limitations #152

@Cadair Cadair merged commit b1a09bb into Cadair:main Apr 8, 2024
14 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.

Propagate the URL which is associated with each file path through to the Results object
2 participants