Skip to content

Eliminate "is True" and "is False" #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions wfdb/io/_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,9 @@ def convert_dtype(self, physical, return_res, smooth_frames):
N/A

"""
if physical is True:
if physical:
return_dtype = 'float'+str(return_res)
if smooth_frames is True:
if smooth_frames:
current_dtype = self.p_signal.dtype
if current_dtype != return_dtype:
self.p_signal = self.p_signal.astype(return_dtype, copy=False)
Expand All @@ -715,7 +715,7 @@ def convert_dtype(self, physical, return_res, smooth_frames):
self.p_signal[ch] = self.p_signal[ch].astype(return_dtype, copy=False)
else:
return_dtype = 'int'+str(return_res)
if smooth_frames is True:
if smooth_frames:
current_dtype = self.d_signal.dtype
if current_dtype != return_dtype:
# Do not allow changing integer dtype to lower value due to over/underflow
Expand Down Expand Up @@ -1891,7 +1891,7 @@ def _np_dtype(bit_res, discrete):
if bit_res <= np_res:
break

if discrete is True:
if discrete:
return 'int' + str(np_res)
else:
# No float8 dtype
Expand Down
4 changes: 2 additions & 2 deletions wfdb/io/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,12 @@ def check_read_inputs(self, sampfrom, sampto, channels, physical,

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

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


Expand Down