Skip to content

Commit

Permalink
refactor: Comply with black 23.1 style
Browse files Browse the repository at this point in the history
  • Loading branch information
radimkarnis committed Feb 1, 2023
1 parent cc80ecd commit ea61f8f
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 14 deletions.
1 change: 0 additions & 1 deletion espefuse/efuse/esp32/mem_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class EfuseDefineRegisters(EfuseRegistersBase):

EFUSE_MEM_SIZE = 0x011C + 4

# EFUSE registers & command/conf values
Expand Down
2 changes: 0 additions & 2 deletions espefuse/efuse/mem_definition_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class EfuseRegistersBase(object):


class EfuseBlocksBase(object):

BLOCKS = None
NamedtupleBlock = namedtuple(
"Block",
Expand All @@ -45,7 +44,6 @@ def get_blocks_for_keys(self):


class EfuseFieldsBase(object):

NamedtupleField = namedtuple(
"Efuse",
"name category block word pos type write_disable_bit "
Expand Down
1 change: 0 additions & 1 deletion espsecure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion esptool/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 1 addition & 2 deletions esptool/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ def trace(self, message, *format_args):
if self._trace_enabled:
now = time.time()
try:

delta = now - self._last_trace
except AttributeError:
delta = 0.0
Expand Down Expand Up @@ -738,7 +737,7 @@ def mem_begin(self, size, blocks, blocksize, offset):
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)),
]:
Expand Down
1 change: 0 additions & 1 deletion test/test_espefuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,6 @@ def test_burn_key_512bit(self):
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(
Expand Down
4 changes: 0 additions & 4 deletions test/test_espsecure.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def test_digest_rsa_public_key(self):


class TestSigning(EspSecureTestCase):

VerifyArgs = namedtuple(
"verify_signature_args", ["version", "hsm", "hsm_config", "keyfile", "datafile"]
)
Expand Down Expand Up @@ -659,7 +658,6 @@ def test_verify_signature_public_key(self):
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
Expand Down Expand Up @@ -710,7 +708,6 @@ def test_generate_and_extract_key_v2(self):


class TestFlashEncryption(EspSecureTestCase):

EncryptArgs = namedtuple(
"encrypt_flash_data_args",
[
Expand Down Expand Up @@ -744,7 +741,6 @@ def _test_encrypt_decrypt(
flash_crypt_conf=0xF,
aes_xts=None,
):

original_plaintext = self._open(input_plaintext)
keyfile = self._open(key_path)
ciphertext = io.BytesIO()
Expand Down
1 change: 0 additions & 1 deletion test/test_esptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def __exit__(self, type, value, traceback):
@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:
Expand Down
2 changes: 1 addition & 1 deletion test/test_merge_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def run_merge_bin(self, chip, offsets_names, options=[]):
"-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)))

Expand Down

0 comments on commit ea61f8f

Please sign in to comment.