Skip to content

Commit 0411aac

Browse files
committed
Fix formatting with black
1 parent c5a051d commit 0411aac

File tree

3 files changed

+34
-22
lines changed

3 files changed

+34
-22
lines changed

adafruit_wiznet5k/adafruit_wiznet5k.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,15 @@ class WIZNET5K: # pylint: disable=too-many-public-methods
156156

157157
# pylint: disable=too-many-arguments
158158
def __init__(
159-
self, spi_bus, cs, reset=None, is_dhcp=True, mac=DEFAULT_MAC,
160-
hostname=None, dhcp_timeout=3, debug=False
159+
self,
160+
spi_bus,
161+
cs,
162+
reset=None,
163+
is_dhcp=True,
164+
mac=DEFAULT_MAC,
165+
hostname=None,
166+
dhcp_timeout=3,
167+
debug=False,
161168
):
162169
self._debug = debug
163170
self._chip_type = None

adafruit_wiznet5k/adafruit_wiznet5k_dhcp.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ class DHCP:
102102
"""
103103

104104
# pylint: disable=too-many-arguments, too-many-instance-attributes, invalid-name
105-
def __init__(self, eth, mac_address, hostname=None, response_timeout=3, debug=False):
105+
def __init__(
106+
self, eth, mac_address, hostname=None, response_timeout=3, debug=False
107+
):
106108
self._debug = debug
107109
self._response_timeout = response_timeout
108110
self._mac_address = mac_address
@@ -134,8 +136,9 @@ def __init__(self, eth, mac_address, hostname=None, response_timeout=3, debug=Fa
134136

135137
# Host name
136138
mac_string = "".join("{:02X}".format(o) for o in mac_address)
137-
self._hostname = bytes((hostname or "WIZnet{}")
138-
.split('.')[0].format(mac_string)[:42], "utf-8")
139+
self._hostname = bytes(
140+
(hostname or "WIZnet{}").split(".")[0].format(mac_string)[:42], "utf-8"
141+
)
139142

140143
def send_dhcp_message(self, state, time_elapsed):
141144
"""Assemble and send a DHCP message packet to a socket.
@@ -206,29 +209,29 @@ def send_dhcp_message(self, state, time_elapsed):
206209
if state == DHCP_REQUEST:
207210
# Set the parsed local IP addr
208211
_BUFF[after_hostname] = 50
209-
_BUFF[after_hostname+1] = 0x04
212+
_BUFF[after_hostname + 1] = 0x04
210213

211-
_BUFF[after_hostname+2:after_hostname+6] = self.local_ip
214+
_BUFF[after_hostname + 2 : after_hostname + 6] = self.local_ip
212215
# Set the parsed dhcp server ip addr
213-
_BUFF[after_hostname+6] = 54
214-
_BUFF[after_hostname+7] = 0x04
215-
_BUFF[after_hostname+8:after_hostname+12] = self.dhcp_server_ip
216+
_BUFF[after_hostname + 6] = 54
217+
_BUFF[after_hostname + 7] = 0x04
218+
_BUFF[after_hostname + 8 : after_hostname + 12] = self.dhcp_server_ip
216219

217-
_BUFF[after_hostname+12] = 55
218-
_BUFF[after_hostname+13] = 0x06
220+
_BUFF[after_hostname + 12] = 55
221+
_BUFF[after_hostname + 13] = 0x06
219222
# subnet mask
220-
_BUFF[after_hostname+14] = 1
223+
_BUFF[after_hostname + 14] = 1
221224
# routers on subnet
222-
_BUFF[after_hostname+15] = 3
225+
_BUFF[after_hostname + 15] = 3
223226
# DNS
224-
_BUFF[after_hostname+16] = 6
227+
_BUFF[after_hostname + 16] = 6
225228
# domain name
226-
_BUFF[after_hostname+17] = 15
229+
_BUFF[after_hostname + 17] = 15
227230
# renewal (T1) value
228-
_BUFF[after_hostname+18] = 58
231+
_BUFF[after_hostname + 18] = 58
229232
# rebinding (T2) value
230-
_BUFF[after_hostname+19] = 59
231-
_BUFF[after_hostname+20] = 255
233+
_BUFF[after_hostname + 19] = 59
234+
_BUFF[after_hostname + 20] = 255
232235

233236
# Send DHCP packet
234237
self._sock.send(_BUFF)
@@ -416,7 +419,9 @@ def request_dhcp_lease(
416419
msg_type = 0
417420
self._dhcp_state = STATE_DHCP_START
418421

419-
if result != 1 and ((time.monotonic() - start_time > self._response_timeout)):
422+
if result != 1 and (
423+
(time.monotonic() - start_time > self._response_timeout)
424+
):
420425
break
421426

422427
self._transaction_id += 1

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
"AdafruitWiznet5k Library Documentation",
148148
author,
149149
"manual",
150-
),
150+
)
151151
]
152152

153153
# -- Options for manual page output ---------------------------------------
@@ -178,5 +178,5 @@
178178
"AdafruitWiznet5kLibrary",
179179
"One line description of project.",
180180
"Miscellaneous",
181-
),
181+
)
182182
]

0 commit comments

Comments
 (0)