Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
yozik04 committed Apr 17, 2020
1 parent 7adf6d8 commit 231de5b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions nextion/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(
baudrate: int = None,
event_handler: typing.Callable[[EventType, any], None] = None,
loop=asyncio.get_event_loop(),
reconnect_attempts:int = 3
reconnect_attempts: int = 3,
):
self._loop = loop

Expand Down Expand Up @@ -108,7 +108,9 @@ async def connect(self) -> None:
)
except OSError as e:
if e.errno == 2:
raise ConnectionFailed("Failed to open serial connection: %s" % e)
raise ConnectionFailed(
"Failed to open serial connection: %s" % e
)
else:
logger.warning("Baud %s not supported: %s", baud, e)
continue
Expand All @@ -130,7 +132,9 @@ async def connect(self) -> None:
)
self._connection.close()
except asyncio.TimeoutError as e:
logger.warning("Time outed connection attempt. Closing connection")
logger.warning(
"Time outed connection attempt. Closing connection"
)
self._connection.close()

await asyncio.sleep(IO_TIMEOUT)
Expand Down Expand Up @@ -193,7 +197,7 @@ async def _command(self, command, timeout=IO_TIMEOUT, attempts=None):
attempts_remained -= 1
if isinstance(last_exception, CommandTimeout):
try:
logger.info('Reconnecting')
logger.info("Reconnecting")
await self.connect()
except ConnectionFailed:
logger.error("Reconnect failed")
Expand Down

0 comments on commit 231de5b

Please sign in to comment.