Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Mar 7, 2017
1 parent 6bfcf92 commit cb5a61f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions luma/core/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, bus=None, port=1, address=0x3C):
# FileNotFoundError
raise luma.core.error.DeviceNotFoundError(
'I2C device not found: {}'.format(e.filename))
elif e.errno == errno.EPERM or e.errno == errno.EACCES:
elif e.errno in [errno.EPERM, errno.EACCES]:
# PermissionError
raise luma.core.error.DevicePermissionError(
'I2C device permission denied: {}'.format(e.filename))
Expand All @@ -81,7 +81,7 @@ def command(self, *cmd):
self._bus.write_i2c_block_data(self._addr, self._cmd_mode,
list(cmd))
except OSError as e:
if e.errno == errno.EREMOTEIO or e.errno == errno.EIO:
if e.errno in [errno.EREMOTEIO, errno.EIO]:
# I/O error
raise luma.core.error.DeviceNotFoundError(
'I2C device not found on address: {}'.format(self._addr))
Expand Down

0 comments on commit cb5a61f

Please sign in to comment.