Skip to content

Commit 3408c3d

Browse files
DimitriPapadopoulosd-v-bjoshmoore
authored andcommitted
io.open → open (zarr-developers#1421)
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]>
1 parent dbab5c6 commit 3408c3d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

docs/release.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Unreleased
2121
Maintenance
2222
~~~~~~~~~~~
2323

24+
* Change occurrence of ``io.open()`` into ``open()``.
25+
By :user:`Dimitri Papadopoulos Orfanos <DimitriPapadopoulos>` :issue:`1421`.
26+
2427
* Preserve ``dimension_separator`` when resizing arrays.
2528
By :user:`Ziwen Liu <ziw-liu>` :issue:`1533`.
2629

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
@@ -29,6 +28,8 @@
2928

3029
StoreLike = Union[BaseStore, MutableMapping, str, None]
3130

31+
_builtin_open = open # builtin open is later shadowed by a local open function
32+
3233

3334
def _check_and_update_path(store: BaseStore, path):
3435
if getattr(store, "_store_version", 2) > 2 and not path:
@@ -491,7 +492,7 @@ def __init__(self, log):
491492
elif callable(log):
492493
self.log_func = log
493494
elif isinstance(log, str):
494-
self.log_file = io.open(log, mode="w")
495+
self.log_file = _builtin_open(log, mode="w")
495496
self.needs_closing = True
496497
elif hasattr(log, "write"):
497498
self.log_file = log

0 commit comments

Comments
 (0)