top: Update Python formatting to black "2023 stable style".

See https://black.readthedocs.io/en/stable/the_black_code_style/index.html

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
pull/605/head
Jim Mussared 2023-02-02 15:09:36 +11:00 zatwierdzone przez Damien George
rodzic c1526d2d1e
commit a08087249f
20 zmienionych plików z 9 dodań i 23 usunięć

Wyświetl plik

@ -34,6 +34,7 @@ _FLAG_WRITE = const(0x0008)
_FLAG_NOTIFY = const(0x0010)
_FLAG_INDICATE = const(0x0020)
# Forward IRQs directly to static methods on the type that handles them and
# knows how to map handles to instances. Note: We copy all uuid and data
# params here for safety, but a future optimisation might be able to avoid

Wyświetl plik

@ -21,6 +21,7 @@ SERVICE_UUID = bluetooth.UUID("A5A5A5A5-FFFF-9999-1111-5A5A5A5A5A5A")
CHAR_FIRST_UUID = bluetooth.UUID("00000000-1111-2222-3333-444444444444")
CHAR_SECOND_UUID = bluetooth.UUID("00000000-1111-2222-3333-555555555555")
# Acting in peripheral role.
async def instance0_task():
service = aioble.Service(SERVICE_UUID)

Wyświetl plik

@ -244,7 +244,6 @@ class Regs:
class WM8960:
_bit_clock_divider_table = {
2: 0,
3: 1,
@ -399,7 +398,6 @@ class WM8960:
self.config_data_format(sysclk, sample_rate, bits)
def deinit(self):
self.set_module(MODULE_ADC, False)
self.set_module(MODULE_DAC, False)
self.set_module(MODULE_VREF, False)
@ -467,33 +465,28 @@ class WM8960:
)
def set_module(self, module, is_enabled):
is_enabled = 1 if is_enabled else 0
regs = self.regs
if module == MODULE_ADC:
regs[_POWER1] = (
_POWER1_ADCL_MASK | _POWER1_ADCR_MASK,
(_POWER1_ADCL_MASK | _POWER1_ADCR_MASK) * is_enabled,
)
elif module == MODULE_DAC:
regs[_POWER2] = (
_POWER2_DACL_MASK | _POWER2_DACR_MASK,
(_POWER2_DACL_MASK | _POWER2_DACR_MASK) * is_enabled,
)
elif module == MODULE_VREF:
regs[_POWER1] = (
_POWER1_VREF_MASK,
(is_enabled << _POWER1_VREF_SHIFT),
)
elif module == MODULE_LINE_IN:
regs[_POWER1] = (
_POWER1_AINL_MASK | _POWER1_AINR_MASK,
(_POWER1_AINL_MASK | _POWER1_AINR_MASK) * is_enabled,
@ -504,21 +497,18 @@ class WM8960:
)
elif module == MODULE_LINE_OUT:
regs[_POWER2] = (
_POWER2_LOUT1_MASK | _POWER2_ROUT1_MASK,
(_POWER2_LOUT1_MASK | _POWER2_ROUT1_MASK) * is_enabled,
)
elif module == MODULE_MIC_BIAS:
regs[_POWER1] = (
_POWER1_MICB_MASK,
(is_enabled << _POWER1_MICB_SHIFT),
)
elif module == MODULE_SPEAKER:
regs[_POWER2] = (
_POWER2_SPKL_MASK | _POWER2_SPKR_MASK,
(_POWER2_SPKL_MASK | _POWER2_SPKR_MASK) * is_enabled,
@ -526,14 +516,12 @@ class WM8960:
regs[_CLASSD1] = 0xF7
elif module == MODULE_OMIX:
regs[_POWER3] = (
_POWER3_LOMIX_MASK | _POWER3_ROMIX_MASK,
(_POWER3_LOMIX_MASK | _POWER3_ROMIX_MASK) * is_enabled,
)
elif module == MODULE_MONO_OUT:
regs[_MONOMIX1] = regs[_MONOMIX2] = is_enabled << 7
regs[_MONO] = is_enabled << 6

Wyświetl plik

@ -24,6 +24,7 @@ SET_PRECHARGE = const(0xD9)
SET_VCOM_DESEL = const(0xDB)
SET_CHARGE_PUMP = const(0x8D)
# Subclassing FrameBuffer provides support for graphics primitives
# http://docs.micropython.org/en/latest/pyboard/library/framebuf.html
class SSD1306(framebuf.FrameBuffer):

Wyświetl plik

@ -64,7 +64,6 @@ class SDCard:
self.spi.init(master, baudrate=baudrate, phase=0, polarity=0)
def init_card(self, baudrate):
# init CS pin
self.cs.init(self.cs.OUT, value=1)

Wyświetl plik

@ -3,7 +3,6 @@ from . import simple
class MQTTClient(simple.MQTTClient):
DELAY = 2
DEBUG = False

Wyświetl plik

@ -4,6 +4,7 @@ from umqtt.simple import MQTTClient
# Publish test messages e.g. with:
# mosquitto_pub -t foo_topic -m hello
# Received messages from subscriptions will be delivered to this callback
def sub_cb(topic, msg):
print((topic, msg))

Wyświetl plik

@ -37,7 +37,6 @@ class SuppressTestCase(unittest.TestCase):
class TestExitStack(unittest.TestCase):
# @support.requires_docstrings
def _test_instance_docs(self):
# Issue 19330: ensure context manager instances have good docstrings

Wyświetl plik

@ -374,6 +374,7 @@ del d
del types
# Helper for instance creation without calling __init__
class _EmptyClass:
pass

Wyświetl plik

@ -294,7 +294,6 @@ def _make_iterencode(
str=str,
tuple=tuple,
):
if _indent is not None and not isinstance(_indent, str):
_indent = " " * _indent

Wyświetl plik

@ -37,6 +37,7 @@ try:
except:
logger.error("Some trouble (%s)", "expected")
# Custom handler example
class MyHandler(logging.Handler):
def emit(self, record):

Wyświetl plik

@ -248,7 +248,6 @@ class TextWrapper:
chunks.reverse()
while chunks:
# Start the list of chunks that will make up the current line.
# cur_len is just the length of all the chunks in cur_line.
cur_line = []

Wyświetl plik

@ -112,7 +112,6 @@ class TestUnittestAssertions(unittest.TestCase):
self.fail("this should be skipped")
def testAssert(self):
e1 = None
try:

Wyświetl plik

@ -74,7 +74,6 @@ def decode_q(encoded):
# dict mapping bytes to their encoded form
class _QByteMap(dict):
safe = b"-!*+/" + ascii_letters.encode("ascii") + digits.encode("ascii")
def __missing__(self, key):

Wyświetl plik

@ -115,7 +115,6 @@ def _extend_docstrings(cls):
class Policy(_PolicyBase): # , metaclass=abc.ABCMeta):
r"""Controls for how messages are interpreted and formatted.
Most of the classes and many of the methods in the email package accept

Wyświetl plik

@ -58,6 +58,7 @@ escapesre = re.compile(r'[\\"]')
# source with undecodable characters.
_has_surrogates = re.compile("([^\ud800-\udbff]|\A)[\udc00-\udfff]([^\udc00-\udfff]|\Z)").search
# How to deal with a string containing bytes before handing it to the
# application through the 'normal' interface.
def _sanitize(string):

Wyświetl plik

@ -2499,7 +2499,7 @@ codepoint2name = {}
# (or a character reference if the character is outside the Latin-1 range)
entitydefs = {}
for (name, codepoint) in name2codepoint.items():
for name, codepoint in name2codepoint.items():
codepoint2name[codepoint] = name
entitydefs[name] = chr(codepoint)

Wyświetl plik

@ -740,7 +740,6 @@ class HTTPResponse:
class HTTPConnection:
_http_vsn = 11
_http_vsn_str = "HTTP/1.1"

Wyświetl plik

@ -2,7 +2,6 @@ import umachine
class Pin(umachine.PinBase):
IN = "in"
OUT = "out"

Wyświetl plik

@ -332,6 +332,7 @@ _ParseResultBase = namedtuple("ParseResult", "scheme netloc path params query fr
# retained since deprecating it isn't worth the hassle
ResultBase = _NetlocResultMixinStr
# Structured result objects for string data
class DefragResult(_DefragResultBase, _ResultMixinStr):
__slots__ = ()