Skip to content

all: Enable ruff F841 'Local variable is assigned to but never used'. #856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions micropython/bluetooth/aioble/examples/l2cap_file_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def size(self, path):
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
Expand All @@ -97,7 +97,7 @@ async def download(self, path, dest):
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)
Expand Down
5 changes: 1 addition & 4 deletions micropython/bluetooth/aioble/examples/l2cap_file_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,20 @@ 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:
try:
stat = os.stat(file)
size = stat[6]
status = 0
except OSError as e:
except OSError:
size = 0
status = _STATUS_NOT_FOUND
control_characteristic.notify(
Expand Down
4 changes: 1 addition & 3 deletions micropython/bluetooth/aioble/multitests/ble_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
1 change: 0 additions & 1 deletion micropython/espflash/espflash.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ def flash_write_file(self, path, blksize=0x1000):
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
Expand Down
2 changes: 1 addition & 1 deletion micropython/ucontextlib/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_context_manager(self):
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)
Expand Down
26 changes: 9 additions & 17 deletions micropython/udnspkt/udnspkt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions micropython/urllib.urequest/urllib/urequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion python-ecosys/aiohttp/aiohttp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ async def __aexit__(self, *args):

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 = []
Expand Down
2 changes: 1 addition & 1 deletion python-ecosys/cbor2/cbor2/_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Loading