diff --git a/micropython/aiorepl/aiorepl.py b/micropython/aiorepl/aiorepl.py index 8ebaef079..8b3ce4f8c 100644 --- a/micropython/aiorepl/aiorepl.py +++ b/micropython/aiorepl/aiorepl.py @@ -1,6 +1,7 @@ # MIT license; Copyright (c) 2022 Jim Mussared import micropython +from micropython import const import re import sys import time diff --git a/micropython/drivers/codec/wm8960/wm8960.py b/micropython/drivers/codec/wm8960/wm8960.py index 573fce5e9..dc0dd655d 100644 --- a/micropython/drivers/codec/wm8960/wm8960.py +++ b/micropython/drivers/codec/wm8960/wm8960.py @@ -683,7 +683,7 @@ def alc_mode(self, channel, mode=ALC_MODE): ) self.regs[_ALC3] = (_ALC_MODE_MASK, mode << _ALC_MODE_SHIFT) try: - rate = _alc_sample_rate_table[self.sample_rate] + rate = self._alc_sample_rate_table[self.sample_rate] except: rate = 0 self.regs[_ADDCTL3] = (_DACCTL3_ALCSR_MASK, rate) diff --git a/micropython/drivers/imu/bmm150/bmm150.py b/micropython/drivers/imu/bmm150/bmm150.py index b7b4aad30..036b2b258 100644 --- a/micropython/drivers/imu/bmm150/bmm150.py +++ b/micropython/drivers/imu/bmm150/bmm150.py @@ -165,9 +165,6 @@ def _compensate_z(self, raw, hall): z = (z5 / (z4 * 4)) / 16 return z - def reset(self): - self._write_reg(_CMD, 0xB6) - def magnet_raw(self): for i in range(0, 10): self._read_reg_into(_DATA, self.scratch) diff --git a/micropython/drivers/imu/lsm6dsox/lsm6dsox.py b/micropython/drivers/imu/lsm6dsox/lsm6dsox.py index 1e4267ae7..1952c5bb1 100644 --- a/micropython/drivers/imu/lsm6dsox/lsm6dsox.py +++ b/micropython/drivers/imu/lsm6dsox/lsm6dsox.py @@ -46,6 +46,7 @@ import array from micropython import const +import time _CTRL3_C = const(0x12) _CTRL1_XL = const(0x10) diff --git a/micropython/drivers/imu/lsm9ds1/lsm9ds1.py b/micropython/drivers/imu/lsm9ds1/lsm9ds1.py index 7123a574b..e3d46429d 100644 --- a/micropython/drivers/imu/lsm9ds1/lsm9ds1.py +++ b/micropython/drivers/imu/lsm9ds1/lsm9ds1.py @@ -44,6 +44,7 @@ time.sleep_ms(100) """ import array +from micropython import const _WHO_AM_I = const(0xF) diff --git a/micropython/drivers/sensor/lps22h/lps22h.py b/micropython/drivers/sensor/lps22h/lps22h.py index ca29efce2..1e7f4ec3e 100644 --- a/micropython/drivers/sensor/lps22h/lps22h.py +++ b/micropython/drivers/sensor/lps22h/lps22h.py @@ -38,6 +38,7 @@ time.sleep_ms(10) """ import machine +from micropython import const _LPS22_CTRL_REG1 = const(0x10) _LPS22_CTRL_REG2 = const(0x11) diff --git a/micropython/mip/mip/__init__.py b/micropython/mip/mip/__init__.py index 5f6f4fcd6..68daf32fe 100644 --- a/micropython/mip/mip/__init__.py +++ b/micropython/mip/mip/__init__.py @@ -1,6 +1,7 @@ # MicroPython package installer # MIT license; Copyright (c) 2022 Jim Mussared +from micropython import const import requests import sys diff --git a/micropython/net/webrepl/webrepl.py b/micropython/net/webrepl/webrepl.py index 56767d8b7..48c181968 100644 --- a/micropython/net/webrepl/webrepl.py +++ b/micropython/net/webrepl/webrepl.py @@ -1,6 +1,7 @@ # This module should be imported from REPL, not run from command line. import binascii import hashlib +from micropython import const import network import os import socket diff --git a/micropython/uaiohttpclient/example.py b/micropython/uaiohttpclient/example.py index 4134c7ee7..5c03ee29f 100644 --- a/micropython/uaiohttpclient/example.py +++ b/micropython/uaiohttpclient/example.py @@ -9,7 +9,7 @@ def print_stream(resp): print((yield from resp.read())) return while True: - line = yield from reader.readline() + line = yield from resp.readline() if not line: break print(line.rstrip()) diff --git a/pyproject.toml b/pyproject.toml index 6828563c9..1aa9c1122 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,6 @@ ignore = [ "F403", "F405", "F541", - "F821", "F841", "ISC003", # micropython does not support implicit concatenation of f-strings "PIE810", # micropython does not support passing tuples to .startswith or .endswith @@ -91,3 +90,10 @@ max-statements = 166 [tool.ruff.per-file-ignores] "micropython/aiorepl/aiorepl.py" = ["PGH001"] + +# manifest.py files are evaluated with some global names pre-defined +"**/manifest.py" = ["F821"] +"ports/**/boards/manifest*.py" = ["F821"] + +# ble multitests are evaluated with some names pre-defined +"micropython/bluetooth/aioble/multitests/*" = ["F821"] diff --git a/python-ecosys/cbor2/cbor2/decoder.py b/python-ecosys/cbor2/cbor2/decoder.py index f0784d4be..48ff02d89 100644 --- a/python-ecosys/cbor2/cbor2/decoder.py +++ b/python-ecosys/cbor2/cbor2/decoder.py @@ -160,7 +160,7 @@ def decode_simple_value(decoder): def decode_float16(decoder): payload = decoder.read(2) - return unpack_float16(payload) + raise NotImplementedError # no float16 unpack function def decode_float32(decoder): @@ -185,7 +185,7 @@ def decode_float64(decoder): 20: lambda self: False, 21: lambda self: True, 22: lambda self: None, - 23: lambda self: undefined, + # 23 is undefined 24: decode_simple_value, 25: decode_float16, 26: decode_float32, diff --git a/python-ecosys/iperf3/iperf3.py b/python-ecosys/iperf3/iperf3.py index 62ee01683..a5c54445d 100644 --- a/python-ecosys/iperf3/iperf3.py +++ b/python-ecosys/iperf3/iperf3.py @@ -380,9 +380,11 @@ def client(host, udp=False, reverse=False, bandwidth=10 * 1024 * 1024): ticks_us_end = param["time"] * 1000000 poll = select.poll() poll.register(s_ctrl, select.POLLIN) + buf = None s_data = None start = None udp_packet_id = 0 + udp_last_send = None while True: for pollable in poll.poll(stats.max_dt_ms()): if pollable_is_sock(pollable, s_data):