@@ -105,7 +105,7 @@ def parse_pubkey_payload(data):
105
105
ptr += 1
106
106
if version_number not in SUPPORTED_PUBKEY_PACKET_VERSIONS :
107
107
raise PacketVersionNotSupportedError (
108
- "Pubkey packet version '{}' not supported, must be one of {}" .format ( # pylint: disable=consider-using-f-string
108
+ "Pubkey packet version '{}' not supported, must be one of {}" .format (
109
109
version_number , SUPPORTED_PUBKEY_PACKET_VERSIONS
110
110
)
111
111
)
@@ -130,7 +130,7 @@ def parse_pubkey_payload(data):
130
130
# as described in section 5.2.3.21.
131
131
if algorithm not in SUPPORTED_SIGNATURE_ALGORITHMS :
132
132
raise SignatureAlgorithmNotSupportedError (
133
- "Signature algorithm '{}' not " # pylint: disable=consider-using-f-string
133
+ "Signature algorithm '{}' not "
134
134
"supported, please verify that your gpg configuration is creating "
135
135
"either DSA, RSA, or EdDSA signatures (see RFC4880 9.1. Public-Key "
136
136
"Algorithms)." .format (algorithm )
@@ -216,7 +216,7 @@ def parse_pubkey_bundle(data):
216
216
and not key_bundle [PACKET_TYPE_PRIMARY_KEY ]["key" ]
217
217
):
218
218
raise PacketParsingError (
219
- "First packet must be a primary key ('{}'), " # pylint: disable=consider-using-f-string
219
+ "First packet must be a primary key ('{}'), "
220
220
"got '{}'." .format (PACKET_TYPE_PRIMARY_KEY , packet_type )
221
221
)
222
222
@@ -282,7 +282,7 @@ def parse_pubkey_bundle(data):
282
282
283
283
else :
284
284
log .info (
285
- "Ignoring gpg key packet '{}', we only handle packets of " # pylint: disable=logging-format-interpolation,consider-using-f-string
285
+ "Ignoring gpg key packet '{}', we only handle packets of "
286
286
"types '{}' (see RFC4880 4.3. Packet Tags)." .format (
287
287
packet_type ,
288
288
[
@@ -297,8 +297,8 @@ def parse_pubkey_bundle(data):
297
297
298
298
# Both errors might be raised in parse_packet_header and in this loop
299
299
except (PacketParsingError , IndexError ) as e :
300
- raise PacketParsingError ( # pylint: disable=raise-missing-from
301
- "Invalid public key data at position {}: {}." .format ( # pylint: disable=consider-using-f-string
300
+ raise PacketParsingError (
301
+ "Invalid public key data at position {}: {}." .format (
302
302
position , e
303
303
)
304
304
)
@@ -369,15 +369,15 @@ def _assign_certified_key_info(bundle):
369
369
# TODO: Revise exception taxonomy:
370
370
# It's okay to ignore some exceptions (unsupported algorithms etc.) but
371
371
# we should blow up if a signature is malformed (missing subpackets).
372
- except Exception as e : # pylint: disable=broad-except
372
+ except Exception as e :
373
373
log .info (e )
374
374
continue
375
375
376
376
if not bundle [PACKET_TYPE_PRIMARY_KEY ]["key" ]["keyid" ].endswith (
377
377
signature ["keyid" ]
378
378
):
379
379
log .info (
380
- "Ignoring User ID certificate issued by '{}'." .format ( # pylint: disable=logging-format-interpolation,consider-using-f-string
380
+ "Ignoring User ID certificate issued by '{}'." .format (
381
381
signature ["keyid" ]
382
382
)
383
383
)
@@ -392,7 +392,7 @@ def _assign_certified_key_info(bundle):
392
392
393
393
if not is_valid :
394
394
log .info (
395
- "Ignoring invalid User ID self-certificate issued " # pylint: disable=logging-format-interpolation,consider-using-f-string
395
+ "Ignoring invalid User ID self-certificate issued "
396
396
"by '{}'." .format (signature ["keyid" ])
397
397
)
398
398
continue
@@ -493,7 +493,7 @@ def _get_verified_subkeys(bundle):
493
493
)
494
494
495
495
# TODO: Revise exception taxonomy
496
- except Exception as e : # pylint: disable=broad-except
496
+ except Exception as e :
497
497
log .info (e )
498
498
continue
499
499
@@ -523,7 +523,7 @@ def _get_verified_subkeys(bundle):
523
523
key_binding_signatures .append (signature )
524
524
525
525
# TODO: Revise exception taxonomy
526
- except Exception as e : # pylint: disable=broad-except
526
+ except Exception as e :
527
527
log .info (e )
528
528
continue
529
529
# NOTE: As per the V4 key structure diagram in RFC4880 section 12.1., a
@@ -535,7 +535,7 @@ def _get_verified_subkeys(bundle):
535
535
# an *embedded primary key binding signature*.
536
536
if len (key_binding_signatures ) != 1 :
537
537
log .info (
538
- "Ignoring subkey '{}' due to wrong amount of key binding " # pylint: disable=logging-format-interpolation,consider-using-f-string
538
+ "Ignoring subkey '{}' due to wrong amount of key binding "
539
539
"signatures ({}), must be exactly 1." .format (
540
540
subkey ["keyid" ], len (key_binding_signatures )
541
541
)
@@ -550,7 +550,7 @@ def _get_verified_subkeys(bundle):
550
550
551
551
if not is_valid :
552
552
log .info (
553
- "Ignoring subkey '{}' due to invalid key binding signature." .format ( # pylint: disable=logging-format-interpolation,consider-using-f-string
553
+ "Ignoring subkey '{}' due to invalid key binding signature." .format (
554
554
subkey ["keyid" ]
555
555
)
556
556
)
@@ -610,8 +610,9 @@ def get_pubkey_bundle(data, keyid):
610
610
"""
611
611
if not data :
612
612
raise KeyNotFoundError (
613
- "Could not find gpg key '{}' in empty exported key " # pylint: disable=consider-using-f-string
614
- "data." .format (keyid )
613
+ "Could not find gpg key '{}' in empty exported key " "data." .format (
614
+ keyid
615
+ )
615
616
)
616
617
617
618
# Parse out master key and subkeys (enriched and verified via certificates
@@ -631,7 +632,7 @@ def get_pubkey_bundle(data, keyid):
631
632
if public_key and public_key ["keyid" ].endswith (keyid .lower ()):
632
633
if idx > 1 :
633
634
log .debug (
634
- "Exporting master key '{}' including subkeys '{}' for" # pylint: disable=logging-format-interpolation,consider-using-f-string
635
+ "Exporting master key '{}' including subkeys '{}' for"
635
636
" passed keyid '{}'." .format (
636
637
master_public_key ["keyid" ],
637
638
", " .join (list (sub_public_keys .keys ())),
@@ -642,9 +643,7 @@ def get_pubkey_bundle(data, keyid):
642
643
643
644
else :
644
645
raise KeyNotFoundError (
645
- "Could not find gpg key '{}' in exported key data." .format ( # pylint: disable=consider-using-f-string
646
- keyid
647
- )
646
+ "Could not find gpg key '{}' in exported key data." .format (keyid )
648
647
)
649
648
650
649
# Add subkeys dictionary to master pubkey "subkeys" field if subkeys exist
@@ -655,7 +654,7 @@ def get_pubkey_bundle(data, keyid):
655
654
656
655
657
656
# ruff: noqa: PLR0912, PLR0915
658
- def parse_signature_packet ( # pylint: disable=too-many-locals,too-many-branches,too-many-statements
657
+ def parse_signature_packet (
659
658
data ,
660
659
supported_signature_types = None ,
661
660
supported_hash_algorithms = None ,
@@ -725,7 +724,7 @@ def parse_signature_packet( # pylint: disable=too-many-locals,too-many-branches
725
724
ptr += 1
726
725
if version_number not in SUPPORTED_SIGNATURE_PACKET_VERSIONS :
727
726
raise ValueError (
728
- "Signature version '{}' not supported, must be one of " # pylint: disable=consider-using-f-string
727
+ "Signature version '{}' not supported, must be one of "
729
728
"{}." .format (version_number , SUPPORTED_SIGNATURE_PACKET_VERSIONS )
730
729
)
731
730
@@ -738,7 +737,7 @@ def parse_signature_packet( # pylint: disable=too-many-locals,too-many-branches
738
737
739
738
if signature_type not in supported_signature_types :
740
739
raise ValueError (
741
- "Signature type '{}' not supported, must be one of {} " # pylint: disable=consider-using-f-string
740
+ "Signature type '{}' not supported, must be one of {} "
742
741
"(see RFC4880 5.2.1. Signature Types)." .format (
743
742
signature_type , supported_signature_types
744
743
)
@@ -749,7 +748,7 @@ def parse_signature_packet( # pylint: disable=too-many-locals,too-many-branches
749
748
750
749
if signature_algorithm not in SUPPORTED_SIGNATURE_ALGORITHMS :
751
750
raise ValueError (
752
- "Signature algorithm '{}' not " # pylint: disable=consider-using-f-string
751
+ "Signature algorithm '{}' not "
753
752
"supported, please verify that your gpg configuration is creating "
754
753
"either DSA, RSA, or EdDSA signatures (see RFC4880 9.1. Public-Key "
755
754
"Algorithms)." .format (signature_algorithm )
@@ -763,7 +762,7 @@ def parse_signature_packet( # pylint: disable=too-many-locals,too-many-branches
763
762
764
763
if hash_algorithm not in supported_hash_algorithms :
765
764
raise ValueError (
766
- "Hash algorithm '{}' not supported, must be one of {}" # pylint: disable=consider-using-f-string
765
+ "Hash algorithm '{}' not supported, must be one of {}"
767
766
" (see RFC4880 9.4. Hash Algorithms)." .format (
768
767
hash_algorithm , supported_hash_algorithms
769
768
)
@@ -863,7 +862,7 @@ def parse_signature_packet( # pylint: disable=too-many-locals,too-many-branches
863
862
# Fail if keyid and short keyid are specified but don't match
864
863
if keyid and not keyid .endswith (short_keyid ): # pragma: no cover
865
864
raise ValueError (
866
- "This signature packet seems to be corrupted. The key ID " # pylint: disable=consider-using-f-string
865
+ "This signature packet seems to be corrupted. The key ID "
867
866
"'{}' of the 'Issuer' subpacket must match the lower 64 bits of the "
868
867
"fingerprint '{}' of the 'Issuer Fingerprint' subpacket (see RFC4880 "
869
868
"and rfc4880bis-06 5.2.3.28. Issuer Fingerprint)." .format (
@@ -887,7 +886,7 @@ def parse_signature_packet( # pylint: disable=too-many-locals,too-many-branches
887
886
signature = handler .get_signature_params (data [ptr :])
888
887
889
888
signature_data = {
890
- "keyid" : "{}" .format (keyid ), # pylint: disable=consider-using-f-string
889
+ "keyid" : "{}" .format (keyid ),
891
890
"other_headers" : binascii .hexlify (data [:other_headers_ptr ]).decode (
892
891
"ascii"
893
892
),
0 commit comments