Skip to content

Commit 7d30c20

Browse files
authored
Merge pull request MIT-LCP#342 from MIT-LCP/booleans
Eliminate "is True" and "is False"
2 parents f4423d7 + ebd9d40 commit 7d30c20

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

wfdb/io/_signal.py

Lines changed: 4 additions & 4 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
@@ -1891,7 +1891,7 @@ def _np_dtype(bit_res, discrete):
18911891
if bit_res <= np_res:
18921892
break
18931893

1894-
if discrete is True:
1894+
if discrete:
18951895
return 'int' + str(np_res)
18961896
else:
18971897
# No float8 dtype

wfdb/io/record.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,12 @@ def check_read_inputs(self, sampfrom, sampto, channels, physical,
409409

410410
if return_res not in [64, 32, 16, 8]:
411411
raise ValueError("return_res must be one of the following: 64, 32, 16, 8")
412-
if physical is True and return_res == 8:
412+
if physical and return_res == 8:
413413
raise ValueError("return_res must be one of the following when physical is True: 64, 32, 16")
414414

415415
# Cannot expand multiple samples/frame for multi-segment records
416416
if isinstance(self, MultiRecord):
417-
if smooth_frames is False:
417+
if not smooth_frames:
418418
raise ValueError('This package version cannot expand all samples when reading multi-segment records. Must enable frame smoothing.')
419419

420420

0 commit comments

Comments
 (0)