mirror of https://github.com/OpenKMIP/PyKMIP.git
Fix flake8 warnings to reflect modern Python style
This commit is contained in:
parent
7648ea801b
commit
c012a430aa
|
@ -215,7 +215,7 @@ class Integer(Base):
|
|||
self.value = unpack(self.pack_string, istream.read(self.length))[0]
|
||||
pad = unpack(self.pack_string, istream.read(self.padding_length))[0]
|
||||
|
||||
if pad is not 0:
|
||||
if pad != 0:
|
||||
raise exceptions.ReadValueError(
|
||||
Integer.__name__,
|
||||
'pad',
|
||||
|
@ -595,7 +595,7 @@ class Enumeration(Base):
|
|||
pad = unpack('!I', istream.read(Enumeration.LENGTH))[0]
|
||||
|
||||
# Verify that the padding bytes are zero bytes.
|
||||
if pad is not 0:
|
||||
if pad != 0:
|
||||
raise exceptions.InvalidPaddingBytes("padding bytes must be zero")
|
||||
|
||||
self.validate()
|
||||
|
@ -823,7 +823,7 @@ class TextString(Base):
|
|||
if self.padding_length < self.PADDING_SIZE:
|
||||
for _ in range(self.padding_length):
|
||||
pad = unpack('!B', istream.read(1))[0]
|
||||
if pad is not 0:
|
||||
if pad != 0:
|
||||
raise exceptions.ReadValueError(
|
||||
TextString.__name__,
|
||||
'pad',
|
||||
|
@ -918,7 +918,7 @@ class ByteString(Base):
|
|||
if self.padding_length < self.PADDING_SIZE:
|
||||
for _ in range(self.padding_length):
|
||||
pad = unpack('!B', istream.read(1))[0]
|
||||
if pad is not 0:
|
||||
if pad != 0:
|
||||
raise exceptions.ReadValueError(
|
||||
TextString.__name__,
|
||||
'pad',
|
||||
|
@ -1058,7 +1058,7 @@ class Interval(Base):
|
|||
pad = unpack('!I', istream.read(Interval.LENGTH))[0]
|
||||
|
||||
# Verify that the padding bytes are zero bytes.
|
||||
if pad is not 0:
|
||||
if pad != 0:
|
||||
raise exceptions.InvalidPaddingBytes("padding bytes must be zero")
|
||||
|
||||
self.validate()
|
||||
|
|
|
@ -2045,8 +2045,8 @@ class KmipEngine(object):
|
|||
"for encryption."
|
||||
)
|
||||
|
||||
if enums.CryptographicUsageMask.ENCRYPT not in \
|
||||
managed_object.cryptographic_usage_masks:
|
||||
masks = managed_object.cryptographic_usage_masks
|
||||
if enums.CryptographicUsageMask.ENCRYPT not in masks:
|
||||
raise exceptions.PermissionDenied(
|
||||
"The Encrypt bit must be set in the encryption key's "
|
||||
"cryptographic usage mask."
|
||||
|
@ -2108,8 +2108,8 @@ class KmipEngine(object):
|
|||
"for decryption."
|
||||
)
|
||||
|
||||
if enums.CryptographicUsageMask.DECRYPT not in \
|
||||
managed_object.cryptographic_usage_masks:
|
||||
masks = managed_object.cryptographic_usage_masks
|
||||
if enums.CryptographicUsageMask.DECRYPT not in masks:
|
||||
raise exceptions.PermissionDenied(
|
||||
"The Decrypt bit must be set in the decryption key's "
|
||||
"cryptographic usage mask."
|
||||
|
@ -2251,8 +2251,8 @@ class KmipEngine(object):
|
|||
"Object is not in a state that can be used for MACing."
|
||||
)
|
||||
|
||||
if enums.CryptographicUsageMask.MAC_GENERATE not in \
|
||||
managed_object.cryptographic_usage_masks:
|
||||
masks = managed_object.cryptographic_usage_masks
|
||||
if enums.CryptographicUsageMask.MAC_GENERATE not in masks:
|
||||
raise exceptions.PermissionDenied(
|
||||
"MAC Generate must be set in the object's cryptographic "
|
||||
"usage mask"
|
||||
|
|
Loading…
Reference in New Issue