Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions kmip/core/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.

import six

from kmip.core import enums
from kmip.core.enums import HashingAlgorithm as HashingAlgorithmEnum
from kmip.core.enums import KeyFormatType as KeyFormatTypeEnum
Expand Down Expand Up @@ -476,7 +474,7 @@ def iv_length(self):
def iv_length(self, value):
if value is None:
self._iv_length = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._iv_length = Integer(
value=value,
tag=Tags.IV_LENGTH
Expand All @@ -495,7 +493,7 @@ def tag_length(self):
def tag_length(self, value):
if value is None:
self._tag_length = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._tag_length = Integer(
value=value,
tag=Tags.TAG_LENGTH
Expand All @@ -514,7 +512,7 @@ def fixed_field_length(self):
def fixed_field_length(self, value):
if value is None:
self._fixed_field_length = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._fixed_field_length = Integer(
value=value,
tag=Tags.FIXED_FIELD_LENGTH
Expand All @@ -533,7 +531,7 @@ def invocation_field_length(self):
def invocation_field_length(self, value):
if value is None:
self._invocation_field_length = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._invocation_field_length = Integer(
value=value,
tag=Tags.INVOCATION_FIELD_LENGTH
Expand All @@ -552,7 +550,7 @@ def counter_length(self):
def counter_length(self, value):
if value is None:
self._counter_length = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._counter_length = Integer(
value=value,
tag=Tags.COUNTER_LENGTH
Expand All @@ -571,7 +569,7 @@ def initial_counter_value(self):
def initial_counter_value(self, value):
if value is None:
self._initial_counter_value = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._initial_counter_value = Integer(
value=value,
tag=Tags.INITIAL_COUNTER_VALUE
Expand Down Expand Up @@ -1112,7 +1110,7 @@ def application_namespace(self):
def application_namespace(self, value):
if value is None:
self._application_namespace = None
elif isinstance(value, six.string_types):
elif isinstance(value, str):
self._application_namespace = primitives.TextString(
value=value,
tag=enums.Tags.APPLICATION_NAMESPACE
Expand All @@ -1130,7 +1128,7 @@ def application_data(self):
def application_data(self, value):
if value is None:
self._application_data = None
elif isinstance(value, six.string_types):
elif isinstance(value, str):
self._application_data = primitives.TextString(
value=value,
tag=enums.Tags.APPLICATION_DATA
Expand Down Expand Up @@ -1361,7 +1359,7 @@ def initialization_vector(self):
def initialization_vector(self, value):
if value is None:
self._initialization_vector = None
elif isinstance(value, six.binary_type):
elif isinstance(value, bytes):
self._initialization_vector = ByteString(
value=value,
tag=enums.Tags.INITIALIZATION_VECTOR
Expand All @@ -1380,7 +1378,7 @@ def derivation_data(self):
def derivation_data(self, value):
if value is None:
self._derivation_data = None
elif isinstance(value, six.binary_type):
elif isinstance(value, bytes):
self._derivation_data = ByteString(
value=value,
tag=enums.Tags.DERIVATION_DATA
Expand All @@ -1399,7 +1397,7 @@ def salt(self):
def salt(self, value):
if value is None:
self._salt = None
elif isinstance(value, six.binary_type):
elif isinstance(value, bytes):
self._salt = ByteString(
value=value,
tag=enums.Tags.SALT
Expand All @@ -1418,7 +1416,7 @@ def iteration_count(self):
def iteration_count(self, value):
if value is None:
self._iteration_count = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._iteration_count = Integer(
value=value,
tag=Tags.ITERATION_COUNT
Expand Down
5 changes: 2 additions & 3 deletions kmip/core/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import copy
import enum
import functools
import six


class OrderedEnum(enum.Enum):
Expand Down Expand Up @@ -1784,7 +1783,7 @@ def convert_attribute_name_to_tag(value):
ValueError: if the attribute name string is not a string or if it is
an unrecognized attribute name
"""
if not isinstance(value, six.string_types):
if not isinstance(value, str):
raise ValueError("The attribute name must be a string.")

for entry in attribute_name_tag_table:
Expand Down Expand Up @@ -1873,7 +1872,7 @@ def is_bit_mask(enumeration, potential_mask):
True: if the potential mask is a valid bit mask of the mask enumeration
False: otherwise
"""
if not isinstance(potential_mask, six.integer_types):
if not isinstance(potential_mask, int):
return False

mask_enumerations = (
Expand Down
6 changes: 2 additions & 4 deletions kmip/core/messages/contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.

import six

from kmip.core import enums
from kmip.core import objects
from kmip.core import utils
Expand Down Expand Up @@ -67,7 +65,7 @@ def major(self):
def major(self, value):
if value is None:
self._major = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._major = primitives.Integer(
value=value,
tag=enums.Tags.PROTOCOL_VERSION_MAJOR
Expand All @@ -88,7 +86,7 @@ def minor(self):
def minor(self, value):
if value is None:
self._minor = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._minor = primitives.Integer(
value=value,
tag=enums.Tags.PROTOCOL_VERSION_MINOR
Expand Down
4 changes: 1 addition & 3 deletions kmip/core/messages/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.

import six

from kmip.core import enums
from kmip.core.enums import Tags

Expand Down Expand Up @@ -171,7 +169,7 @@ def server_hashed_password(self):
def server_hashed_password(self, value):
if value is None:
self._server_hashed_password = None
elif isinstance(value, six.binary_type):
elif isinstance(value, bytes):
self._server_hashed_password = primitives.ByteString(
value=value,
tag=enums.Tags.SERVER_HASHED_PASSWORD
Expand Down
6 changes: 2 additions & 4 deletions kmip/core/messages/payloads/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.

import six

from kmip import enums
from kmip.core import primitives
from kmip.core import utils
Expand Down Expand Up @@ -53,7 +51,7 @@ def unique_identifier(self):
def unique_identifier(self, value):
if value is None:
self._unique_identifier = None
elif isinstance(value, six.string_types):
elif isinstance(value, str):
self._unique_identifier = primitives.TextString(
value=value,
tag=enums.Tags.UNIQUE_IDENTIFIER
Expand Down Expand Up @@ -182,7 +180,7 @@ def unique_identifier(self):
def unique_identifier(self, value):
if value is None:
self._unique_identifier = None
elif isinstance(value, six.string_types):
elif isinstance(value, str):
self._unique_identifier = primitives.TextString(
value=value,
tag=enums.Tags.UNIQUE_IDENTIFIER
Expand Down
6 changes: 2 additions & 4 deletions kmip/core/messages/payloads/cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.

import six

from kmip import enums
from kmip.core import primitives
from kmip.core import utils
Expand Down Expand Up @@ -54,7 +52,7 @@ def asynchronous_correlation_value(self):
def asynchronous_correlation_value(self, value):
if value is None:
self._asynchronous_correlation_value = None
elif isinstance(value, six.binary_type):
elif isinstance(value, bytes):
self._asynchronous_correlation_value = primitives.ByteString(
value=value,
tag=enums.Tags.ASYNCHRONOUS_CORRELATION_VALUE
Expand Down Expand Up @@ -201,7 +199,7 @@ def asynchronous_correlation_value(self):
def asynchronous_correlation_value(self, value):
if value is None:
self._asynchronous_correlation_value = None
elif isinstance(value, six.binary_type):
elif isinstance(value, bytes):
self._asynchronous_correlation_value = primitives.ByteString(
value=value,
tag=enums.Tags.ASYNCHRONOUS_CORRELATION_VALUE
Expand Down
18 changes: 8 additions & 10 deletions kmip/core/messages/payloads/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.

import six

from kmip import enums
from kmip.core import primitives
from kmip.core import utils
Expand Down Expand Up @@ -79,7 +77,7 @@ def unique_identifier(self):
def unique_identifier(self, value):
if value is None:
self._unique_identifier = None
elif isinstance(value, six.string_types):
elif isinstance(value, str):
self._unique_identifier = primitives.TextString(
value=value,
tag=enums.Tags.UNIQUE_IDENTIFIER
Expand All @@ -98,7 +96,7 @@ def usage_limits_count(self):
def usage_limits_count(self, value):
if value is None:
self._usage_limits_count = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._usage_limits_count = primitives.LongInteger(
value=value,
tag=enums.Tags.USAGE_LIMITS_COUNT
Expand All @@ -117,7 +115,7 @@ def cryptographic_usage_mask(self):
def cryptographic_usage_mask(self, value):
if value is None:
self._cryptographic_usage_mask = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._cryptographic_usage_mask = primitives.Integer(
value=value,
tag=enums.Tags.CRYPTOGRAPHIC_USAGE_MASK
Expand All @@ -136,7 +134,7 @@ def lease_time(self):
def lease_time(self, value):
if value is None:
self._lease_time = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._lease_time = primitives.Interval(
value=value,
tag=enums.Tags.LEASE_TIME
Expand Down Expand Up @@ -344,7 +342,7 @@ def unique_identifier(self):
def unique_identifier(self, value):
if value is None:
self._unique_identifier = None
elif isinstance(value, six.string_types):
elif isinstance(value, str):
self._unique_identifier = primitives.TextString(
value=value,
tag=enums.Tags.UNIQUE_IDENTIFIER
Expand All @@ -363,7 +361,7 @@ def usage_limits_count(self):
def usage_limits_count(self, value):
if value is None:
self._usage_limits_count = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._usage_limits_count = primitives.LongInteger(
value=value,
tag=enums.Tags.USAGE_LIMITS_COUNT
Expand All @@ -382,7 +380,7 @@ def cryptographic_usage_mask(self):
def cryptographic_usage_mask(self, value):
if value is None:
self._cryptographic_usage_mask = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._cryptographic_usage_mask = primitives.Integer(
value=value,
tag=enums.Tags.CRYPTOGRAPHIC_USAGE_MASK
Expand All @@ -401,7 +399,7 @@ def lease_time(self):
def lease_time(self, value):
if value is None:
self._lease_time = None
elif isinstance(value, six.integer_types):
elif isinstance(value, int):
self._lease_time = primitives.Interval(
value=value,
tag=enums.Tags.LEASE_TIME
Expand Down
4 changes: 1 addition & 3 deletions kmip/core/messages/payloads/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.

import six

from kmip.core import enums
from kmip.core import exceptions
from kmip.core import objects
Expand Down Expand Up @@ -386,7 +384,7 @@ def unique_identifier(self):
def unique_identifier(self, value):
if value is None:
self._unique_identifier = None
elif isinstance(value, six.string_types):
elif isinstance(value, str):
self._unique_identifier = primitives.TextString(
value=value,
tag=enums.Tags.UNIQUE_IDENTIFIER
Expand Down
6 changes: 2 additions & 4 deletions kmip/core/messages/payloads/create_key_pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.

import six

from kmip.core import enums
from kmip.core import exceptions
from kmip.core import objects
Expand Down Expand Up @@ -578,7 +576,7 @@ def private_key_unique_identifier(self):
def private_key_unique_identifier(self, value):
if value is None:
self._private_key_unique_identifier = None
elif isinstance(value, six.string_types):
elif isinstance(value, str):
self._private_key_unique_identifier = primitives.TextString(
value=value,
tag=enums.Tags.PRIVATE_KEY_UNIQUE_IDENTIFIER
Expand All @@ -597,7 +595,7 @@ def public_key_unique_identifier(self):
def public_key_unique_identifier(self, value):
if value is None:
self._public_key_unique_identifier = None
elif isinstance(value, six.string_types):
elif isinstance(value, str):
self._public_key_unique_identifier = primitives.TextString(
value=value,
tag=enums.Tags.PUBLIC_KEY_UNIQUE_IDENTIFIER
Expand Down
Loading