Skip to content

Commit

Permalink
Fix pylint warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
gareth-palmer committed Jun 17, 2023
1 parent d66da70 commit 43b3ae1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ persistent=no
extension-pkg-whitelist=lxml

[MESSAGES CONTROL]
disable=missing-module-docstring,missing-class-docstring,missing-function-docstring,bad-whitespace,invalid-name,line-too-long,redefined-builtin,too-many-statements,too-many-branches,too-many-locals,too-many-arguments,broad-except,consider-using-sys-exit,len-as-condition,no-else-continue,duplicate-code
disable=missing-module-docstring,missing-class-docstring,missing-function-docstring,bad-whitespace,invalid-name,line-too-long,redefined-builtin,too-many-statements,too-many-branches,too-many-locals,too-many-arguments,broad-except,consider-using-sys-exit,len-as-condition,no-else-continue,duplicate-code,raise-missing-from

[REPORTS]
output-format=text
10 changes: 5 additions & 5 deletions enccnf
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def parse_enc_file(enc_file, tftp_certificate_file):
elif tlv_tag == HEADER_HASH_ALGORITHM:
hash_algorithm = tlv_data[tlv_index]

print(f'Digest Algorithm: ', end = '')
print('Digest Algorithm: ', end = '')

if hash_algorithm == HASH_SHA1:
print('SHA1')
Expand Down Expand Up @@ -179,7 +179,7 @@ def parse_enc_file(enc_file, tftp_certificate_file):
elif tlv_tag == HEADER_ENCRYPTION_HASH_ALGORITHM:
encryption_hash_algorithm = tlv_data[tlv_index]

print(f'Encryption Digest Algorithm: ', end = '')
print('Encryption Digest Algorithm: ', end = '')

if encryption_hash_algorithm == HASH_SHA1:
print('SHA1')
Expand All @@ -202,7 +202,7 @@ def parse_enc_file(enc_file, tftp_certificate_file):
print('')

if hash_algorithm is None:
raise ProgramError(f'Missing HEADER_HASH_ALGORITHM')
raise ProgramError('Missing HEADER_HASH_ALGORITHM')

if hash_algorithm not in (HASH_SHA1, HASH_SHA512):
raise ProgramError(f'Unsupported HEADER_HASH_ALGORITHM: {hash_algorithm}')
Expand Down Expand Up @@ -270,7 +270,7 @@ def remove_enc_file(enc_file, private_key_file):
if tlv_tag != HEADER_VERSION:
raise ProgramError(f'Tag is not HEADER_VERSION: {tlv_tag}')

(major, minor) = struct.unpack_from('B B', tlv_data, tlv_index)
# Skip version
tlv_index += tlv_length

(tlv_tag, tlv_length) = struct.unpack_from('> B H', tlv_data, tlv_index)
Expand Down Expand Up @@ -748,7 +748,7 @@ def main():

elif mode == 'remove':
if private_key_file is None:
raise ProgramError(f'No private-key file specified')
raise ProgramError('No private-key file specified')

remove_enc_file(enc_file, private_key_file)

Expand Down
4 changes: 2 additions & 2 deletions sgnfile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def parse_sgn_file(sgn_file, tftp_certificate_file):
elif tlv_tag == HEADER_HASH_ALGORITHM:
hash_algorithm = tlv_data[tlv_index]

print(f'Digest Algorithm: ', end = '')
print('Digest Algorithm: ', end = '')

if hash_algorithm == HASH_SHA1:
print('SHA1')
Expand Down Expand Up @@ -211,7 +211,7 @@ def remove_sgn_file(sgn_file):
if tlv_tag != HEADER_VERSION:
raise ProgramError(f'Tag is not HEADER_VERSION: {tlv_tag}')

(major, minor) = struct.unpack_from('B B', tlv_data, tlv_index)
# Skip version
tlv_index += tlv_length

(tlv_tag, tlv_length) = struct.unpack_from('> B H', tlv_data, tlv_index)
Expand Down
2 changes: 1 addition & 1 deletion stripsgn
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def strip_sgn_file(sgn_file):
if tlv_tag != HEADER_VERSION:
raise ProgramError(f'Tag is not HEADER_VERSION: {tlv_tag}')

(major, minor) = struct.unpack_from('B B', tlv_data, tlv_index)
# Skip version
tlv_index += tlv_length

(tlv_tag, tlv_length) = struct.unpack_from('> B H', tlv_data, tlv_index)
Expand Down
8 changes: 4 additions & 4 deletions tlvfile
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def parse_tlv_file(tlv_file):
elif tlv_tag == HEADER_HASH_ALGORITHM:
hash_algorithm = tlv_data[tlv_index]

print(f'Digest Algorithm: ', end = '')
print('Digest Algorithm: ', end = '')

if hash_algorithm == HASH_SHA1:
print('SHA1')
Expand Down Expand Up @@ -188,10 +188,10 @@ def parse_tlv_file(tlv_file):
print('')

if sast_serial_number is None:
raise ProgramError(f'Missing HEADER_SERIAL_NUMBER')
raise ProgramError('Missing HEADER_SERIAL_NUMBER')

if hash_algorithm is None:
raise ProgramError(f'Missing HEADER_HASH_ALGORITHM')
raise ProgramError('Missing HEADER_HASH_ALGORITHM')

if hash_algorithm not in (HASH_SHA1, HASH_SHA512):
raise ProgramError(f'Unsupported HEADER_HASH_ALGORITHM: {hash_algorithm}')
Expand Down Expand Up @@ -238,7 +238,7 @@ def parse_tlv_file(tlv_file):
elif tlv_tag == RECORD_ROLE:
(role,) = struct.unpack_from('> H', tlv_data, tlv_index)

print(f'Role: ', end = '')
print('Role: ', end = '')

if role == ROLE_SAST:
print('SAST')
Expand Down

0 comments on commit 43b3ae1

Please sign in to comment.