Skip to content

Commit ebd9d40

Browse files
author
Benjamin Moody
committed
convert_dtype: eliminate "is True" and "is False".
Writing "if X is True" is almost always a mistake. This change allows rdrecord to be called with "physical=1" ("physical=0" would work previously, but "physical=1" wouldn't) or with "smooth_frames=0" ("smooth_frames=1" would work previously, but "smooth_frames=0" wouldn't.)
1 parent e2ce76b commit ebd9d40

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

wfdb/io/_signal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -698,9 +698,9 @@ def convert_dtype(self, physical, return_res, smooth_frames):
698698
N/A
699699
700700
"""
701-
if physical is True:
701+
if physical:
702702
return_dtype = 'float'+str(return_res)
703-
if smooth_frames is True:
703+
if smooth_frames:
704704
current_dtype = self.p_signal.dtype
705705
if current_dtype != return_dtype:
706706
self.p_signal = self.p_signal.astype(return_dtype, copy=False)
@@ -715,7 +715,7 @@ def convert_dtype(self, physical, return_res, smooth_frames):
715715
self.p_signal[ch] = self.p_signal[ch].astype(return_dtype, copy=False)
716716
else:
717717
return_dtype = 'int'+str(return_res)
718-
if smooth_frames is True:
718+
if smooth_frames:
719719
current_dtype = self.d_signal.dtype
720720
if current_dtype != return_dtype:
721721
# Do not allow changing integer dtype to lower value due to over/underflow

0 commit comments

Comments
 (0)