Skip to content

Commit 6bfa0f3

Browse files
committed
pre-commit is the new black
1 parent f62cd13 commit 6bfa0f3

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

adafruit_wiznet5k/adafruit_wiznet5k.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -841,17 +841,13 @@ def socket_write(self, socket_num, buffer, timeout=0):
841841
while (
842842
self._read_socket(socket_num, REG_SNIR)[0] & SNIR_SEND_OK
843843
) != SNIR_SEND_OK:
844-
if (
845-
self.socket_status(socket_num)[0]
846-
in (
847-
SNSR_SOCK_CLOSED,
848-
SNSR_SOCK_TIME_WAIT,
849-
SNSR_SOCK_FIN_WAIT,
850-
SNSR_SOCK_CLOSE_WAIT,
851-
SNSR_SOCK_CLOSING,
852-
)
853-
or (timeout and time.monotonic() - stamp > timeout)
854-
):
844+
if self.socket_status(socket_num)[0] in (
845+
SNSR_SOCK_CLOSED,
846+
SNSR_SOCK_TIME_WAIT,
847+
SNSR_SOCK_FIN_WAIT,
848+
SNSR_SOCK_CLOSE_WAIT,
849+
SNSR_SOCK_CLOSING,
850+
) or (timeout and time.monotonic() - stamp > timeout):
855851
# self.socket_close(socket_num)
856852
return 0
857853
time.sleep(0.01)

adafruit_wiznet5k/adafruit_wiznet5k_dhcp.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -472,14 +472,10 @@ def _dhcp_state_machine(self):
472472
if self._debug:
473473
print("* DHCP: Time to renew lease")
474474

475-
if (
476-
self._dhcp_state
477-
in (
478-
STATE_DHCP_DISCOVER,
479-
STATE_DHCP_REQUEST,
480-
)
481-
and time.monotonic() > (self._start_time + self._response_timeout)
482-
):
475+
if self._dhcp_state in (
476+
STATE_DHCP_DISCOVER,
477+
STATE_DHCP_REQUEST,
478+
) and time.monotonic() > (self._start_time + self._response_timeout):
483479
self._dhcp_state = STATE_DHCP_WAIT
484480
if self._sock is not None:
485481
self._sock.close()

0 commit comments

Comments
 (0)