refactor: Comply with black 23.1 style

This commit is contained in:
radim.karnis
2023-02-01 15:33:25 +01:00
parent cc80ecd267
commit ea61f8f008
9 changed files with 3 additions and 14 deletions

View File

@@ -8,7 +8,6 @@ from ..mem_definition_base import EfuseBlocksBase, EfuseFieldsBase, EfuseRegiste
class EfuseDefineRegisters(EfuseRegistersBase):
EFUSE_MEM_SIZE = 0x011C + 4
# EFUSE registers & command/conf values

View File

@@ -19,7 +19,6 @@ class EfuseRegistersBase(object):
class EfuseBlocksBase(object):
BLOCKS = None
NamedtupleBlock = namedtuple(
"Block",
@@ -45,7 +44,6 @@ class EfuseBlocksBase(object):
class EfuseFieldsBase(object):
NamedtupleField = namedtuple(
"Efuse",
"name category block word pos type write_disable_bit "

View File

@@ -738,7 +738,6 @@ def verify_signature_v1(args):
def validate_signature_block(image_content, sig_blk_num):
offset = -SECTOR_SIZE + sig_blk_num * SIG_BLOCK_SIZE
sig_blk = image_content[offset : offset + SIG_BLOCK_SIZE]
assert len(sig_blk) == SIG_BLOCK_SIZE

View File

@@ -889,7 +889,7 @@ def make_image(args):
raise FatalError(
"Number of specified files does not match number of specified addresses"
)
for (seg, addr) in zip(args.segfile, args.segaddr):
for seg, addr in zip(args.segfile, args.segaddr):
with open(seg, "rb") as f:
data = f.read()
image.segments.append(ImageSegment(addr, data))

View File

@@ -343,7 +343,6 @@ class ESPLoader(object):
if self._trace_enabled:
now = time.time()
try:
delta = now - self._last_trace
except AttributeError:
delta = 0.0
@@ -738,7 +737,7 @@ class ESPLoader(object):
stub = StubFlasher(get_stub_json_path(self.CHIP_NAME))
load_start = offset
load_end = offset + size
for (start, end) in [
for start, end in [
(stub.data_start, stub.data_start + len(stub.data)),
(stub.text_start, stub.text_start + len(stub.text)),
]:

View File

@@ -950,7 +950,6 @@ class TestBurnKeyCommands(EfuseTestCase):
reason="512 bit keys are only supported on ESP32-S2 and S3",
)
def test_burn_key_512bit_non_consecutive_blocks(self):
# Burn efuses seperately to test different kinds
# of "key used" detection criteria
self.espefuse_py(

View File

@@ -105,7 +105,6 @@ class TestESP32SecureBootloader(EspSecureTestCase):
class TestSigning(EspSecureTestCase):
VerifyArgs = namedtuple(
"verify_signature_args", ["version", "hsm", "hsm_config", "keyfile", "datafile"]
)
@@ -659,7 +658,6 @@ class TestSigning(EspSecureTestCase):
assert "Signature could not be verified with the provided key." in str(cm.value)
def test_extract_binary_public_key(self):
with tempfile.NamedTemporaryFile() as pub_keyfile, tempfile.NamedTemporaryFile() as pub_keyfile2: # noqa E501
args = self.ExtractKeyArgs(
"1", self._open("ecdsa_secure_boot_signing_key.pem"), pub_keyfile
@@ -710,7 +708,6 @@ class TestSigning(EspSecureTestCase):
class TestFlashEncryption(EspSecureTestCase):
EncryptArgs = namedtuple(
"encrypt_flash_data_args",
[
@@ -744,7 +741,6 @@ class TestFlashEncryption(EspSecureTestCase):
flash_crypt_conf=0xF,
aes_xts=None,
):
original_plaintext = self._open(input_plaintext)
keyfile = self._open(key_path)
ciphertext = io.BytesIO()

View File

@@ -123,7 +123,6 @@ class ESPRFC2217Server(object):
@pytest.mark.flaky(reruns=1, condition=arg_preload_port is not False)
class EsptoolTestCase:
def run_espsecure(self, args):
cmd = [sys.executable, "-m", "espsecure"] + args.split(" ")
print("\nExecuting {}...".format(" ".join(cmd)))
try:

View File

@@ -45,7 +45,7 @@ class TestMergeBin:
"-o",
output_file.name,
] + options
for (offset, name) in offsets_names:
for offset, name in offsets_names:
cmd += [hex(offset), name]
print("\nExecuting {}".format(" ".join(cmd)))