Skip to content

Commit

Permalink
spin_device/writeCommand: Add assert, satisfy static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
m-laniakea committed Nov 25, 2019
1 parent 29b0af1 commit b3c288c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion stspin/spin_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@ def _writeCommand(
:payload_size: Payload size in bytes
:return: Response bytes as int
"""
# payload and payload_size must be either both present, or both absent
assert((payload is None) != (payload_size is None))

response = self._write(command)

if payload is None:
# payload_size does not need to be checked here,
# but mypy is not quite that advanced yet
if payload is None or payload_size is None:
return response

return self._writeMultiple(
Expand Down

0 comments on commit b3c288c

Please sign in to comment.