Skip to content

Commit

Permalink
io.open → open
Browse files Browse the repository at this point in the history
In Python 3, io.open() is an alias for the builtin open() function:
https://docs.python.org/3/library/io.html#io.open
  • Loading branch information
DimitriPapadopoulos committed May 31, 2023
1 parent 4132f36 commit f497fae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Release notes
Unreleased
----------

Maintenance
~~~~~~~~~~~

* Change occurrence of io.open() into open().
By :user:`Dimitri Papadopoulos Orfanos <DimitriPapadopoulos>` :issue:`1421`.

.. _release_2.15.0:

2.15.0
Expand Down
5 changes: 3 additions & 2 deletions zarr/convenience.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Convenience functions for storing and loading data."""
import io
import itertools
import os
import re
Expand All @@ -23,6 +22,8 @@

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

_builtin_open = open # builtin open is shadowed by a local open function 🤯


def _check_and_update_path(store: BaseStore, path):
if getattr(store, '_store_version', 2) > 2 and not path:
Expand Down Expand Up @@ -485,7 +486,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')
self.needs_closing = True
elif hasattr(log, 'write'):
self.log_file = log
Expand Down

0 comments on commit f497fae

Please sign in to comment.