Skip to content

Commit a88e815

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 6cb3cf1 commit a88e815

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
@@ -50,6 +50,12 @@ Maintenance
5050
* Style the codebase with ``ruff`` and ``black``.
5151
By :user:`Davis Bennett` <d-v-b> :issue:`1459`
5252

53+
Maintenance
54+
~~~~~~~~~~~
55+
56+
* Change occurrence of io.open() into open().
57+
By :user:`Dimitri Papadopoulos Orfanos <DimitriPapadopoulos>` :issue:`1421`.
58+
5359
.. _release_2.15.0:
5460

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

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

31+
_builtin_open = open # builtin open is 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)