Skip to content

Commit 4c41d03

Browse files
committed
linted
1 parent 97a59c1 commit 4c41d03

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

adafruit_esp32spi/adafruit_esp32spi.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,8 @@ def socket_available(self, socket_num):
515515
def socket_read(self, socket_num, size):
516516
"""Read up to 'size' bytes from the socket number. Returns a bytearray"""
517517
if self._debug:
518-
print("Reading %d bytes from socket with status %d" % (size, self.socket_status(socket_num)))
518+
print("Reading %d bytes from socket with status %d" %
519+
(size, self.socket_status(socket_num)))
519520
resp = self._send_command_get_response(_GET_DATABUF_TCP_CMD,
520521
[[socket_num], [size & 0xFF, (size >> 8) & 0xFF]],
521522
sent_param_len_16=True, recv_param_len_16=True)

adafruit_esp32spi/adafruit_esp32spi_requests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,14 @@ def json(self):
107107
return ujson.loads(self.content)
108108

109109
def iter_content(self, chunk_size=1, decode_unicode=False):
110+
"""An iterator that will stream data by only reading 'chunk_size'
111+
bytes and yielding them, when we can't buffer the whole datastream"""
110112
if decode_unicode:
111113
raise NotImplementedError("Unicode not supported")
112114

113115
while True:
114116
chunk = self.socket.read(chunk_size)
115-
if chunk and len(chunk) > 0:
117+
if chunk:
116118
yield chunk
117119
else:
118120
return

adafruit_esp32spi/adafruit_esp32spi_socket.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ def read(self, size=0):
111111
return ret
112112

113113
def settimeout(self, value):
114+
"""Set the reading timeout for sockets before we return with fewer
115+
or no data on read(). If set to 0 we are fully blocking"""
114116
self._timeout = value
115117

116118
def close(self):

0 commit comments

Comments
 (0)