-
-
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
io.open → open #1421
io.open → open #1421
Conversation
988511d
to
8c7b83f
Compare
That's disturbing. Despite |
Got it. File zarr-python/zarr/convenience.py Line 34 in 4132f36
Not really convenient if you ask me. |
This should probably be fixed by changing the name of the local function Then change: Lines 3 to 5 in 4132f36
to: from zarr.convenience import (consolidate_metadata, copy, copy_all, copy_store,
load, open_consolidated, save, save_array,
save_group, tree)
from zarr.convenience import zarr_open as open Thoughts? |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1421 +/- ##
========================================
Coverage 99.99% 100.00%
========================================
Files 37 37
Lines 14740 14735 -5
========================================
- Hits 14739 14735 -4
+ Misses 1 0 -1
|
I have no objection to this strategy. Do you want to pursue that in this PR, or elsewhere? |
Probably another PR. After thinking more about it, nothing's wrong with an open function, it should just be used as |
688e785
to
5babf6f
Compare
In Python 3, io.open() is an alias for the builtin open() function: https://docs.python.org/3/library/io.html#io.open
5babf6f
to
5085bde
Compare
@@ -491,7 +492,7 @@ def __init__(self, log): | |||
elif callable(log): | |||
self.log_func = log | |||
elif isinstance(log, str): | |||
self.log_file = io.open(log, mode="w") | |||
self.log_file = _builtin_open(log, mode="w") |
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.
Are we certain this is the only use of io.open
?
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.
I think so. A grep of io.open
yields:
$ fgrep -R io.open --exclude-dir=.git
zarr/convenience.py: self.log_file = io.open(log, mode="w")
build/lib/zarr/convenience.py: self.log_file = io.open(log, mode='w')
$
And a grep of open(
in zarr/convenience.py
yields:
$ grep -R 'open(' zarr/convenience.py
def open(store: StoreLike = None, mode: str = "a", *, zarr_version=None, path=None, **kwargs):
>>> zw = zarr.open(store, mode='w', shape=100, dtype='i4') # open new array
>>> za = zarr.open(store, mode='a') # open existing array for reading and writing
>>> zr = zarr.open(store, mode='r') # open existing array read-only
>>> gw = zarr.open(store, mode='w') # open new group, overwriting previous data
>>> ga = zarr.open(store, mode='a') # open existing group for reading and writing
>>> gr = zarr.open(store, mode='r') # open existing group read-only
self.log_file = io.open(log, mode="w")
return open(store=meta_store, chunk_store=chunk_store, mode=mode, path=path, **kwargs)
$
Do you have a specific concern, anything I may have overlooked?
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.
No not really. Just wanted to make sure we only have to do this once.
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 a lot for this PR!
In Python 3, io.open() is an alias for the builtin open() function: https://docs.python.org/3/library/io.html#io.open Co-authored-by: Davis Bennett <[email protected]> Co-authored-by: Josh Moore <[email protected]>
In Python 3,
io.open()
is an alias for the builtinopen()
function:https://docs.python.org/3/library/io.html#io.open
TODO: