File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ Unreleased
17
17
Maintenance
18
18
~~~~~~~~~~~
19
19
20
+ * Simplify if/else statement.
21
+ By :user: `Dimitri Papadopoulos Orfanos <DimitriPapadopoulos> ` :issue: `1227 `.
22
+
20
23
* Migrate to ``pyproject.toml `` and remove redundant infrastructure.
21
24
By :user: `Saransh Chopra <Saransh-cpp> ` :issue: `1158 `.
22
25
Original file line number Diff line number Diff line change @@ -487,12 +487,11 @@ def __init__(self, log):
487
487
elif isinstance (log , str ):
488
488
self .log_file = io .open (log , mode = 'w' )
489
489
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' ):
494
491
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 )
496
495
497
496
def __enter__ (self ):
498
497
return self
You can’t perform that action at this time.
0 commit comments