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

External resource updates #257

Merged
merged 4 commits into from
Dec 6, 2023
Merged

External resource updates #257

merged 4 commits into from
Dec 6, 2023

Conversation

dwhswenson
Copy link
Member

Two things here:

  1. Add equality checks for ExternalResources
  2. Fix a potential problem when storing a path for FileStorage into a nested directory.

These were part of the overall work I've been doing on StagingPaths and the bigger storage tasks, but this is a small, self-contained PR that can be reviewed pretty easily. I thought it might be easier to review this first.

Also fixes file copying when copying to a nested directory
Copy link

codecov bot commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d8bc04e) 99.20% compared to head (4e286b2) 99.20%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #257   +/-   ##
=======================================
  Coverage   99.20%   99.20%           
=======================================
  Files          36       36           
  Lines        1893     1898    +5     
=======================================
+ Hits         1878     1883    +5     
  Misses         15       15           

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

@@ -20,6 +20,12 @@ def __init__(self, root_dir: Union[pathlib.Path, str]):
def _exists(self, location):
return self._as_path(location).exists()

def __eq__(self, other):
return (
isinstance(other, FileStorage)
Copy link
Contributor

Choose a reason for hiding this comment

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

a bit nickpicky, but technically objects are meant to return NotImplemented in this case, so that the other object can have a shot at defining __eq__, see https://stackoverflow.com/a/42588737

@@ -26,6 +26,9 @@ def _delete(self, location):
f"Unable to delete '{location}': key does not exist"
)

def __eq__(self, other):
return self is other
Copy link
Contributor

Choose a reason for hiding this comment

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

iirc this is the default object behaviour, but I guess it isn't harming anyone having it here

@richardjgowers richardjgowers merged commit ae96d30 into main Dec 6, 2023
9 checks passed
@richardjgowers richardjgowers deleted the ext-resource-cleanup branch December 6, 2023 12:56
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.

2 participants