kopia lustrzana https://github.com/micropython/micropython-lib
all: Enable ruff F841 'Local variable is assigned to but never used'.
Most of these look like they were used for print debugging and then kept in when the print statements were removed or commented. Some look like missing or incomplete functionality, these have been marked with comments where possible. Signed-off-by: Angus Gratton <angus@redyak.com.au>pull/856/head
rodzic
cb281a4177
commit
6c6fab1db1
|
@ -85,7 +85,7 @@ class FileClient:
|
|||
async def download(self, path, dest):
|
||||
size = await self.size(path)
|
||||
|
||||
send_seq = await self._command(_COMMAND_SEND, path.encode())
|
||||
await self._command(_COMMAND_SEND, path.encode())
|
||||
|
||||
with open(dest, "wb") as f: # noqa: ASYNC101
|
||||
total = 0
|
||||
|
@ -97,7 +97,7 @@ class FileClient:
|
|||
total += n
|
||||
|
||||
async def list(self, path):
|
||||
send_seq = await self._command(_COMMAND_LIST, path.encode())
|
||||
await self._command(_COMMAND_LIST, path.encode())
|
||||
results = bytearray()
|
||||
buf = bytearray(self._channel.our_mtu)
|
||||
mv = memoryview(buf)
|
||||
|
|
|
@ -132,15 +132,12 @@ async def control_task(connection):
|
|||
file = msg[2:].decode()
|
||||
|
||||
if command == _COMMAND_SEND:
|
||||
op_seq = seq
|
||||
send_file = file
|
||||
l2cap_event.set()
|
||||
elif command == _COMMAND_RECV:
|
||||
op_seq = seq
|
||||
recv_file = file
|
||||
l2cap_event.set()
|
||||
elif command == _COMMAND_LIST:
|
||||
op_seq = seq
|
||||
list_path = file
|
||||
l2cap_event.set()
|
||||
elif command == _COMMAND_SIZE:
|
||||
|
@ -148,7 +145,7 @@ async def control_task(connection):
|
|||
stat = os.stat(file)
|
||||
size = stat[6]
|
||||
status = 0
|
||||
except OSError as e:
|
||||
except OSError:
|
||||
size = 0
|
||||
status = _STATUS_NOT_FOUND
|
||||
control_characteristic.notify(
|
||||
|
|
|
@ -32,9 +32,7 @@ async def instance0_task():
|
|||
char1_desc1.write("char1_desc1")
|
||||
char1_desc2 = aioble.Descriptor(char1, CHAR1_DESC2_UUID, read=True, write=True)
|
||||
char1_desc2.write("char1_desc2")
|
||||
char2 = aioble.Characteristic(
|
||||
service, CHAR2_UUID, read=True, write=True, notify=True, indicate=True
|
||||
)
|
||||
aioble.Characteristic(service, CHAR2_UUID, read=True, write=True, notify=True, indicate=True)
|
||||
char3 = aioble.Characteristic(
|
||||
service, CHAR3_UUID, read=True, write=True, notify=True, indicate=True
|
||||
)
|
||||
|
|
|
@ -258,7 +258,6 @@ class ESPFlash:
|
|||
print(f"Flash write size: {size} total_blocks: {total_blocks} block size: {blksize}")
|
||||
with open(path, "rb") as f:
|
||||
seq = 0
|
||||
subseq = 0
|
||||
for i in range(total_blocks):
|
||||
buf = f.read(blksize)
|
||||
# Update digest
|
||||
|
|
|
@ -24,7 +24,7 @@ class ContextManagerTestCase(unittest.TestCase):
|
|||
def test_context_manager_on_error(self):
|
||||
exc = Exception()
|
||||
try:
|
||||
with self._manager(123) as x:
|
||||
with self._manager(123):
|
||||
raise exc
|
||||
except Exception as e:
|
||||
self.assertEqual(exc, e)
|
||||
|
|
|
@ -43,36 +43,28 @@ def parse_resp(buf, is_ipv6):
|
|||
if is_ipv6:
|
||||
typ = 28 # AAAA
|
||||
|
||||
id = buf.readbin(">H")
|
||||
buf.readbin(">H") # id
|
||||
flags = buf.readbin(">H")
|
||||
assert flags & 0x8000
|
||||
qcnt = buf.readbin(">H")
|
||||
buf.readbin(">H") # qcnt
|
||||
acnt = buf.readbin(">H")
|
||||
nscnt = buf.readbin(">H")
|
||||
addcnt = buf.readbin(">H")
|
||||
# print(qcnt, acnt, nscnt, addcnt)
|
||||
buf.readbin(">H") # nscnt
|
||||
buf.readbin(">H") # addcnt
|
||||
|
||||
skip_fqdn(buf)
|
||||
v = buf.readbin(">H")
|
||||
# print(v)
|
||||
v = buf.readbin(">H")
|
||||
# print(v)
|
||||
buf.readbin(">H")
|
||||
buf.readbin(">H")
|
||||
|
||||
for i in range(acnt):
|
||||
# print("Resp #%d" % i)
|
||||
# v = read_fqdn(buf)
|
||||
# print(v)
|
||||
skip_fqdn(buf)
|
||||
t = buf.readbin(">H")
|
||||
# print("Type", t)
|
||||
v = buf.readbin(">H")
|
||||
# print("Class", v)
|
||||
v = buf.readbin(">I")
|
||||
# print("TTL", v)
|
||||
t = buf.readbin(">H") # Type
|
||||
buf.readbin(">H") # Class
|
||||
buf.readbin(">I") # TTL
|
||||
rlen = buf.readbin(">H")
|
||||
# print("rlen", rlen)
|
||||
rval = buf.read(rlen)
|
||||
# print(rval)
|
||||
|
||||
if t == typ:
|
||||
return rval
|
||||
|
|
|
@ -48,10 +48,10 @@ def urlopen(url, data=None, method="GET"):
|
|||
if data:
|
||||
s.write(data)
|
||||
|
||||
l = s.readline()
|
||||
l = l.split(None, 2)
|
||||
l = s.readline() # Status-Line
|
||||
# l = l.split(None, 2)
|
||||
# print(l)
|
||||
status = int(l[1])
|
||||
# status = int(l[1]) # FIXME: Status-Code element is not currently checked
|
||||
while True:
|
||||
l = s.readline()
|
||||
if not l or l == b"\r\n":
|
||||
|
|
|
@ -63,7 +63,6 @@ ignore = [
|
|||
"F405",
|
||||
"E501",
|
||||
"F541",
|
||||
"F841",
|
||||
"ISC001",
|
||||
"ISC003", # micropython does not support implicit concatenation of f-strings
|
||||
"PIE810", # micropython does not support passing tuples to .startswith or .endswith
|
||||
|
|
|
@ -104,7 +104,6 @@ class ClientSession:
|
|||
|
||||
async def _request(self, method, url, data=None, json=None, ssl=None, params=None, headers={}):
|
||||
redir_cnt = 0
|
||||
redir_url = None
|
||||
while redir_cnt < 2:
|
||||
reader = await self.request_raw(method, url, data, json, ssl, params, headers)
|
||||
_headers = []
|
||||
|
|
|
@ -159,7 +159,7 @@ def decode_simple_value(decoder):
|
|||
|
||||
|
||||
def decode_float16(decoder):
|
||||
payload = decoder.read(2)
|
||||
decoder.read(2)
|
||||
raise NotImplementedError # no float16 unpack function
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue