-
-
Notifications
You must be signed in to change notification settings - Fork 282
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
zipstore delitems via override #1184
zipstore delitems via override #1184
Conversation
I want to know if this is actually expected of me to do. Please if it is not give me a details explanation of what to do. |
This pull request introduces 1 alert when merging 96d1183 into eb6d143 - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Emmanuel! 🙏
Generally this seems like the right approach. Thanks for diving in 😄
Had a couple comments below on improvements we might want to make.
The next thing would be to start updating some tests that currently are not running (like this one), but should now be able to with this change.
Please let us know if you have any questions 🙂
That's incredible. I'm not sure whether that is what is expected of me. I'll continue with the testing. Thanks |
I think it should be doable and believe you are up to the task. I hope I've given enough info. As always though, please feel free to ask questions. Any question that occurs to you is worth asking 🙂 |
Oh, just seeing this. I'm on it.
…On Fri, Oct 14, 2022 at 1:55 AM jakirkham ***@***.***> wrote:
I think it should be doable and believe you are up to the task. I hope
I've given enough info. As always though, please feel free to ask
questions. Any question that occurs to you is worth asking 🙂
—
Reply to this email directly, view it on GitHub
<#1184 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZBHSCVU5GTYMR62UFVAZBTWDCVQLANCNFSM6AAAAAAREQIMUY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This pull request introduces 1 alert when merging a83bff2 into 2c52b17 - view on LGTM.com new alerts:
|
Something is perplexing me as I prepare to participate to the test. I see the test is checking for the pop item rather than the del item, therefore I rewrite a test for the previously worked-on function del_item. To minimize confusion, I also included a function for pop_items in the storeitem class. |
…into i-am-emmanuel-zipstore-delitem
This pull request introduces 1 alert when merging 0144f95 into 2c52b17 - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposing a few changes below to fix lints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since value
is only used once, suggesting we inline it.
|
||
store.pop(self.root + 'foo') | ||
|
||
assert store[self.root + 'foo'] == b"" | ||
|
||
def test_popitem(self): | ||
# override because not implemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would also update this test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay.
Thanks Emmanuel! 🙏 Looks like many things are done. So marked them resolved above. The linter raised a few stylistic issues. Went ahead and just added these to the PR for simplicity. There is one more test remaining that I've commented on above. There is a test failure we need to look at. Will give it some thought. |
…into i-am-emmanuel-zipstore-delitem
…-am-Emmanuel/zarr-python into i-am-emmanuel-zipstore-delitem
Think we need to tweak a few of |
Waiting for this work to be reviewed. |
Thanks @I-am-Emmanuel! 🙏 That's a good start. Think we still need similar changes to |
…into i-am-emmanuel-zipstore-delitem
@I-am-Emmanuel, would you like to finish this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry had some review comments that didn't post. So completing to get those out
if data: | ||
return data | ||
else: | ||
raise KeyError("Key not found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise KeyError("Key not found") | |
raise KeyError(key) |
@@ -1789,7 +1810,8 @@ def __eq__(self, other): | |||
|
|||
def keylist(self): | |||
with self.mutex: | |||
return sorted(self.zf.namelist()) | |||
namelist = [key for key in self.zf.namelist() if self.zf.getinfo(key) != b""] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would suggest passing namelist
through a set
since there may be duplicated keys (thanks to overwrites).
Also with getinfo
, this provides metadata about the file. Think we can just check the file size is non-zero (so no need to read the file).
Otherwise this seems reasonable.
namelist = [key for key in self.zf.namelist() if self.zf.getinfo(key) != b""] | |
namelist = [key for key in set(self.zf.namelist()) if self.zf.getinfo(key).file_size] |
value = self.zf.getinfo(key) | ||
|
||
if value == b"": | ||
raise KeyError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise KeyError | |
raise KeyError(key) |
I'm going to close this as stale. Folks should feel free to reopen if there is interest in continuing this work. Note there is a new implementation of the Zip store in v3 that could use the same patch for whoever is interested. |
Fixes #828
TODO: