Skip to content

Commit

Permalink
top: Update Python formatting to black "2023 stable style".
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmo authored and dpgeorge committed Feb 3, 2023
1 parent c1526d2 commit a080872
Show file tree
Hide file tree
Showing 20 changed files with 9 additions and 23 deletions.
1 change: 1 addition & 0 deletions micropython/bluetooth/aioble/aioble/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
_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
Expand Down
1 change: 1 addition & 0 deletions micropython/bluetooth/aioble/multitests/ble_write_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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)
Expand Down
12 changes: 0 additions & 12 deletions micropython/drivers/codec/wm8960/wm8960.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ def __setitem__(self, reg, value):


class WM8960:

_bit_clock_divider_table = {
2: 0,
3: 1,
Expand Down Expand Up @@ -399,7 +398,6 @@ def __init__(
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)
Expand Down Expand Up @@ -467,33 +465,28 @@ def set_speaker_clock(self, sysclk):
)

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,
Expand All @@ -504,36 +497,31 @@ def set_module(self, module, is_enabled):
)

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,
)
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

Expand Down
1 change: 1 addition & 0 deletions micropython/drivers/display/ssd1306/ssd1306.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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):
Expand Down
1 change: 0 additions & 1 deletion micropython/drivers/storage/sdcard/sdcard.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def init_spi(self, baudrate):
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)

Expand Down
1 change: 0 additions & 1 deletion micropython/umqtt.robust/umqtt/robust.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class MQTTClient(simple.MQTTClient):

DELAY = 2
DEBUG = False

Expand Down
1 change: 1 addition & 0 deletions micropython/umqtt.simple/example_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# 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))
Expand Down
1 change: 0 additions & 1 deletion python-stdlib/contextlib/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def test_suppress(self):


class TestExitStack(unittest.TestCase):

# @support.requires_docstrings
def _test_instance_docs(self):
# Issue 19330: ensure context manager instances have good docstrings
Expand Down
1 change: 1 addition & 0 deletions python-stdlib/copy/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ def _reconstruct(x, info, deep, memo=None):

del types


# Helper for instance creation without calling __init__
class _EmptyClass:
pass
1 change: 0 additions & 1 deletion python-stdlib/json/json/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ def _make_iterencode(
str=str,
tuple=tuple,
):

if _indent is not None and not isinstance(_indent, str):
_indent = " " * _indent

Expand Down
1 change: 1 addition & 0 deletions python-stdlib/logging/examples/example_logging_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
except:
logger.error("Some trouble (%s)", "expected")


# Custom handler example
class MyHandler(logging.Handler):
def emit(self, record):
Expand Down
1 change: 0 additions & 1 deletion python-stdlib/textwrap/textwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ def _wrap_chunks(self, chunks):
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 = []
Expand Down
1 change: 0 additions & 1 deletion python-stdlib/unittest/tests/test_assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ def testSkip(self):
self.fail("this should be skipped")

def testAssert(self):

e1 = None
try:

Expand Down
1 change: 0 additions & 1 deletion unix-ffi/email.internal/email/_encoded_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion unix-ffi/email.internal/email/_policybase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions unix-ffi/email.utils/email/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
# 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):
Expand Down
2 changes: 1 addition & 1 deletion unix-ffi/html.entities/html/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -2499,7 +2499,7 @@
# (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)

Expand Down
1 change: 0 additions & 1 deletion unix-ffi/http.client/http/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,6 @@ def getcode(self):


class HTTPConnection:

_http_vsn = 11
_http_vsn_str = "HTTP/1.1"

Expand Down
1 change: 0 additions & 1 deletion unix-ffi/machine/machine/pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Pin(umachine.PinBase):

IN = "in"
OUT = "out"

Expand Down
1 change: 1 addition & 0 deletions unix-ffi/urllib.parse/urllib/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ def _hostinfo(self):
# retained since deprecating it isn't worth the hassle
ResultBase = _NetlocResultMixinStr


# Structured result objects for string data
class DefragResult(_DefragResultBase, _ResultMixinStr):
__slots__ = ()
Expand Down

0 comments on commit a080872

Please sign in to comment.