Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Do not use 'is' for numeric literal comparisons #68

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
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
4 changes: 2 additions & 2 deletions labscript/labscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def bitfield(arrays,dtype):
"""converts a list of arrays of ones and zeros into a single
array of unsigned ints of the given datatype."""
n = {uint8:8,uint16:16,uint32:32}
if arrays[0] is 0:
if arrays[0] == 0:
y = zeros(max([len(arr) if iterable(arr) else 1 for arr in arrays]),dtype=dtype)
else:
y = array(arrays[0],dtype=dtype)
Expand Down Expand Up @@ -1120,7 +1120,7 @@ def __init__(self,name,parent_device,connection,limits = None,unit_conversion_cl
# Here we specifically differentiate "None" from False as we will later have a conditional which relies on
# self.limits being either a correct tuple, or "None"
if limits is not None:
if not isinstance(limits,tuple) or len(limits) is not 2:
if not isinstance(limits,tuple) or len(limits) != 2:
raise LabscriptError('The limits for "%s" must be tuple of length 2. Eg. limits=(1,2)'%(self.name))
if limits[0] > limits[1]:
raise LabscriptError('The first element of the tuple must be lower than the second element. Eg limits=(1,2), NOT limits=(2,1)')
Expand Down