Skip to content

Commit 25a003e

Browse files
Simplify if/else statement (#1227)
1 parent 13b7737 commit 25a003e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

docs/release.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Unreleased
1717
Maintenance
1818
~~~~~~~~~~~
1919

20+
* Simplify if/else statement.
21+
By :user:`Dimitri Papadopoulos Orfanos <DimitriPapadopoulos>` :issue:`1227`.
22+
2023
* Migrate to ``pyproject.toml`` and remove redundant infrastructure.
2124
By :user:`Saransh Chopra <Saransh-cpp>` :issue:`1158`.
2225

zarr/convenience.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,12 +487,11 @@ def __init__(self, log):
487487
elif isinstance(log, str):
488488
self.log_file = io.open(log, mode='w')
489489
self.needs_closing = True
490-
else:
491-
if not hasattr(log, 'write'):
492-
raise TypeError('log must be a callable function, file path or '
493-
'file-like object, found %r' % log)
490+
elif hasattr(log, 'write'):
494491
self.log_file = log
495-
self.needs_closing = False
492+
else:
493+
raise TypeError('log must be a callable function, file path or '
494+
'file-like object, found %r' % log)
496495

497496
def __enter__(self):
498497
return self

0 commit comments

Comments
 (0)