Skip to content

Commit f497fae

Browse files
io.open → open
In Python 3, io.open() is an alias for the builtin open() function: https://docs.python.org/3/library/io.html#io.open
1 parent 4132f36 commit f497fae

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

docs/release.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ Release notes
1111
Unreleased
1212
----------
1313

14+
Maintenance
15+
~~~~~~~~~~~
16+
17+
* Change occurrence of io.open() into open().
18+
By :user:`Dimitri Papadopoulos Orfanos <DimitriPapadopoulos>` :issue:`1421`.
19+
1420
.. _release_2.15.0:
1521

1622
2.15.0

zarr/convenience.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Convenience functions for storing and loading data."""
2-
import io
32
import itertools
43
import os
54
import re
@@ -23,6 +22,8 @@
2322

2423
StoreLike = Union[BaseStore, MutableMapping, str, None]
2524

25+
_builtin_open = open # builtin open is shadowed by a local open function 🤯
26+
2627

2728
def _check_and_update_path(store: BaseStore, path):
2829
if getattr(store, '_store_version', 2) > 2 and not path:
@@ -485,7 +486,7 @@ def __init__(self, log):
485486
elif callable(log):
486487
self.log_func = log
487488
elif isinstance(log, str):
488-
self.log_file = io.open(log, mode='w')
489+
self.log_file = _builtin_open(log, mode='w')
489490
self.needs_closing = True
490491
elif hasattr(log, 'write'):
491492
self.log_file = log

0 commit comments

Comments
 (0)