Skip to content

Commit

Permalink
lint: Formatting changes from new ruff version
Browse files Browse the repository at this point in the history
Signed-off-by: Jussi Kukkonen <[email protected]>
  • Loading branch information
jku committed Jan 29, 2025
1 parent abd247f commit 61b0725
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
9 changes: 4 additions & 5 deletions securesystemslib/_gpg/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,9 @@ def _assign_certified_key_info(bundle):

if not is_valid:
log.info(
"Ignoring invalid User ID self-certificate issued "
"by '{}'.".format(signature["keyid"])
"Ignoring invalid User ID self-certificate issued by '{}'.".format(
signature["keyid"]
)
)
continue

Expand Down Expand Up @@ -752,11 +753,9 @@ def parse_signature_packet(
hashed_subpackets = data[ptr : ptr + hashed_octet_count]
hashed_subpacket_info = gpg_util.parse_subpackets(hashed_subpackets)

# Check whether we were actually able to read this much hashed octets
if len(hashed_subpackets) != hashed_octet_count: # pragma: no cover
raise ValueError(
"This signature packet seems to be corrupted."
"It is missing hashed octets!"
"Signature packet contains an unexpected amount of hashed octets"
)

ptr += hashed_octet_count
Expand Down
3 changes: 1 addition & 2 deletions securesystemslib/_gpg/eddsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ def get_pubkey_params(data):
# See 9.2. ECC Curve OID
if curve_oid != ED25519_PUBLIC_KEY_OID:
raise PacketParsingError(
f"bad ed25519 curve OID '{curve_oid}', "
f"expected {ED25519_PUBLIC_KEY_OID}'"
f"bad ed25519 curve OID '{curve_oid}', expected {ED25519_PUBLIC_KEY_OID}'"
)

# See 13.3. EdDSA Point Format
Expand Down
2 changes: 1 addition & 1 deletion securesystemslib/_gpg/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def parse_packet_header(data, expected_type=None): # noqa: PLR0912

elif length_type == 3:
raise PacketParsingError(
"Old length " "format packets of indeterminate length are not supported"
"Old length format packets of indeterminate length are not supported"
)

else: # pragma: no cover (unreachable)
Expand Down
6 changes: 3 additions & 3 deletions tests/check_public_interfaces_gpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
class TestPublicInterfacesGPG(unittest.TestCase):
@classmethod
def setUpClass(cls):
assert (
not have_gpg()
), "please remove GnuPG from your environment to run this test case"
assert not have_gpg(), (
"please remove GnuPG from your environment to run this test case"
)

def test_gpg_functions(self):
"""Signing, key export and util functions must raise on missing gpg."""
Expand Down
2 changes: 1 addition & 1 deletion tests/test_gpg.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ def test_verify_signature_with_expired_key(self):
)
self.assertTrue(
expected == str(ctx.exception),
f"\nexpected: {expected}" "\ngot: {ctx.exception}",
f"\nexpected: {expected}\ngot: {{ctx.exception}}",
)


Expand Down

0 comments on commit 61b0725

Please sign in to comment.