diff --git a/kmip/core/attributes.py b/kmip/core/attributes.py index d2788688..843b0c44 100644 --- a/kmip/core/attributes.py +++ b/kmip/core/attributes.py @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/kmip/core/enums.py b/kmip/core/enums.py index 5118d3ad..41af28a5 100644 --- a/kmip/core/enums.py +++ b/kmip/core/enums.py @@ -19,7 +19,6 @@ import copy import enum import functools -import six class OrderedEnum(enum.Enum): @@ -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: @@ -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 = ( diff --git a/kmip/core/messages/contents.py b/kmip/core/messages/contents.py index 470c4318..0eee8574 100644 --- a/kmip/core/messages/contents.py +++ b/kmip/core/messages/contents.py @@ -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 @@ -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 @@ -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 diff --git a/kmip/core/messages/messages.py b/kmip/core/messages/messages.py index c1b4c6bc..88f5a0f0 100644 --- a/kmip/core/messages/messages.py +++ b/kmip/core/messages/messages.py @@ -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 @@ -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 diff --git a/kmip/core/messages/payloads/archive.py b/kmip/core/messages/payloads/archive.py index 100de943..e7b40af1 100644 --- a/kmip/core/messages/payloads/archive.py +++ b/kmip/core/messages/payloads/archive.py @@ -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 @@ -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 @@ -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 diff --git a/kmip/core/messages/payloads/cancel.py b/kmip/core/messages/payloads/cancel.py index 383d5b96..748ef3ef 100644 --- a/kmip/core/messages/payloads/cancel.py +++ b/kmip/core/messages/payloads/cancel.py @@ -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 @@ -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 @@ -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 diff --git a/kmip/core/messages/payloads/check.py b/kmip/core/messages/payloads/check.py index e4d0da51..3e2cc855 100644 --- a/kmip/core/messages/payloads/check.py +++ b/kmip/core/messages/payloads/check.py @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/kmip/core/messages/payloads/create.py b/kmip/core/messages/payloads/create.py index d212d7f2..dc0fe479 100644 --- a/kmip/core/messages/payloads/create.py +++ b/kmip/core/messages/payloads/create.py @@ -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 @@ -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 diff --git a/kmip/core/messages/payloads/create_key_pair.py b/kmip/core/messages/payloads/create_key_pair.py index 29fc4329..59398514 100644 --- a/kmip/core/messages/payloads/create_key_pair.py +++ b/kmip/core/messages/payloads/create_key_pair.py @@ -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 @@ -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 @@ -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 diff --git a/kmip/core/messages/payloads/decrypt.py b/kmip/core/messages/payloads/decrypt.py index cc12cf1f..1d0f0856 100644 --- a/kmip/core/messages/payloads/decrypt.py +++ b/kmip/core/messages/payloads/decrypt.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six - from kmip.core import attributes from kmip.core import enums from kmip.core import primitives @@ -102,7 +100,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 @@ -137,7 +135,7 @@ def data(self): def data(self, value): if value is None: self._data = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._data = primitives.ByteString( value=value, tag=enums.Tags.DATA @@ -156,7 +154,7 @@ def iv_counter_nonce(self): def iv_counter_nonce(self, value): if value is None: self._iv_counter_nonce = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._iv_counter_nonce = primitives.ByteString( value=value, tag=enums.Tags.IV_COUNTER_NONCE @@ -175,7 +173,7 @@ def auth_additional_data(self): def auth_additional_data(self, value): if value is None: self._auth_additional_data = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._auth_additional_data = primitives.ByteString( value=value, tag=enums.Tags.AUTHENTICATED_ENCRYPTION_ADDITIONAL_DATA @@ -194,7 +192,7 @@ def auth_tag(self): def auth_tag(self, value): if value is None: self._auth_tag = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._auth_tag = primitives.ByteString( value=value, tag=enums.Tags.AUTHENTICATED_ENCRYPTION_TAG @@ -435,7 +433,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 @@ -454,7 +452,7 @@ def data(self): def data(self, value): if value is None: self._data = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._data = primitives.ByteString( value=value, tag=enums.Tags.DATA diff --git a/kmip/core/messages/payloads/delete_attribute.py b/kmip/core/messages/payloads/delete_attribute.py index 758e4451..e474eaaf 100644 --- a/kmip/core/messages/payloads/delete_attribute.py +++ b/kmip/core/messages/payloads/delete_attribute.py @@ -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 @@ -90,7 +88,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 @@ -108,7 +106,7 @@ def attribute_name(self): def attribute_name(self, value): if value is None: self._attribute_name = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._attribute_name = primitives.TextString( value=value, tag=enums.Tags.ATTRIBUTE_NAME @@ -126,7 +124,7 @@ def attribute_index(self): def attribute_index(self, value): if value is None: self._attribute_index = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._attribute_index = primitives.Integer( value=value, tag=enums.Tags.ATTRIBUTE_INDEX @@ -414,7 +412,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 diff --git a/kmip/core/messages/payloads/derive_key.py b/kmip/core/messages/payloads/derive_key.py index 06f09f4b..af7c860d 100644 --- a/kmip/core/messages/payloads/derive_key.py +++ b/kmip/core/messages/payloads/derive_key.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six - from kmip.core import attributes from kmip.core import enums from kmip.core import exceptions @@ -120,7 +118,7 @@ def unique_identifiers(self, value): elif isinstance(value, list): unique_identifiers = [] for i in value: - if isinstance(i, six.string_types): + if isinstance(i, str): unique_identifiers.append( primitives.TextString( value=i, @@ -479,7 +477,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 diff --git a/kmip/core/messages/payloads/encrypt.py b/kmip/core/messages/payloads/encrypt.py index f17d4f8e..0db84764 100644 --- a/kmip/core/messages/payloads/encrypt.py +++ b/kmip/core/messages/payloads/encrypt.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six - from kmip.core import attributes from kmip.core import enums from kmip.core import primitives @@ -89,7 +87,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 @@ -124,7 +122,7 @@ def data(self): def data(self, value): if value is None: self._data = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._data = primitives.ByteString( value=value, tag=enums.Tags.DATA @@ -143,7 +141,7 @@ def iv_counter_nonce(self): def iv_counter_nonce(self, value): if value is None: self._iv_counter_nonce = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._iv_counter_nonce = primitives.ByteString( value=value, tag=enums.Tags.IV_COUNTER_NONCE @@ -162,7 +160,7 @@ def auth_additional_data(self): def auth_additional_data(self, value): if value is None: self._auth_additional_data = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._auth_additional_data = primitives.ByteString( value=value, tag=enums.Tags.AUTHENTICATED_ENCRYPTION_ADDITIONAL_DATA @@ -406,7 +404,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 @@ -425,7 +423,7 @@ def data(self): def data(self, value): if value is None: self._data = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._data = primitives.ByteString( value=value, tag=enums.Tags.DATA @@ -444,7 +442,7 @@ def iv_counter_nonce(self): def iv_counter_nonce(self, value): if value is None: self._iv_counter_nonce = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._iv_counter_nonce = primitives.ByteString( value=value, tag=enums.Tags.IV_COUNTER_NONCE @@ -463,7 +461,7 @@ def auth_tag(self): def auth_tag(self, value): if value is None: self._auth_tag = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._auth_tag = primitives.ByteString( value=value, tag=enums.Tags.AUTHENTICATED_ENCRYPTION_TAG diff --git a/kmip/core/messages/payloads/get.py b/kmip/core/messages/payloads/get.py index cf4d8071..1d5a0f5a 100644 --- a/kmip/core/messages/payloads/get.py +++ b/kmip/core/messages/payloads/get.py @@ -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 primitives @@ -85,7 +83,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 @@ -371,7 +369,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 diff --git a/kmip/core/messages/payloads/get_attribute_list.py b/kmip/core/messages/payloads/get_attribute_list.py index e36f4289..c6a4c3aa 100644 --- a/kmip/core/messages/payloads/get_attribute_list.py +++ b/kmip/core/messages/payloads/get_attribute_list.py @@ -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 @@ -62,7 +60,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 @@ -201,7 +199,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 @@ -227,7 +225,7 @@ def attribute_names(self, value): names = list() for i in range(len(value)): name = value[i] - if not isinstance(name, six.string_types): + if not isinstance(name, str): raise TypeError( "Attribute names must be a list of strings; " "item {0} has type {1}".format(i + 1, type(name)) diff --git a/kmip/core/messages/payloads/get_attributes.py b/kmip/core/messages/payloads/get_attributes.py index db70ad34..3eef0d1b 100644 --- a/kmip/core/messages/payloads/get_attributes.py +++ b/kmip/core/messages/payloads/get_attributes.py @@ -10,8 +10,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 @@ -68,7 +66,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 @@ -94,7 +92,7 @@ def attribute_names(self, value): names = list() for i in range(len(value)): name = value[i] - if not isinstance(name, six.string_types): + if not isinstance(name, str): raise TypeError( "Attribute names must be a list of strings; " "item {0} has type {1}.".format(i + 1, type(name)) @@ -316,7 +314,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 diff --git a/kmip/core/messages/payloads/get_usage_allocation.py b/kmip/core/messages/payloads/get_usage_allocation.py index 9e98f84e..a2c6892a 100644 --- a/kmip/core/messages/payloads/get_usage_allocation.py +++ b/kmip/core/messages/payloads/get_usage_allocation.py @@ -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 @@ -62,7 +60,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 @@ -81,7 +79,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 @@ -230,7 +228,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 diff --git a/kmip/core/messages/payloads/locate.py b/kmip/core/messages/payloads/locate.py index a4307c49..806fdc2c 100644 --- a/kmip/core/messages/payloads/locate.py +++ b/kmip/core/messages/payloads/locate.py @@ -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 primitives @@ -90,7 +88,7 @@ def maximum_items(self): def maximum_items(self, value): if value is None: self._maximum_items = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._maximum_items = primitives.Integer( value=value, tag=enums.Tags.MAXIMUM_ITEMS @@ -109,7 +107,7 @@ def offset_items(self): def offset_items(self, value): if value is None: self._offset_items = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._offset_items = primitives.Integer( value=value, tag=enums.Tags.OFFSET_ITEMS @@ -128,7 +126,7 @@ def storage_status_mask(self): def storage_status_mask(self, value): if value is None: self._storage_status_mask = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): if enums.is_bit_mask(enums.StorageStatusMask, value): self._storage_status_mask = primitives.Integer( value=value, @@ -410,7 +408,7 @@ def located_items(self): def located_items(self, value): if value is None: self._located_items = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._located_items = primitives.Integer( value=value, tag=enums.Tags.LOCATED_ITEMS @@ -431,7 +429,7 @@ def unique_identifiers(self, value): elif isinstance(value, list): self._unique_identifiers = [] for v in value: - if not isinstance(v, six.string_types): + if not isinstance(v, str): self._unique_identifiers = [] raise TypeError( "Unique identifiers must be a list of strings." diff --git a/kmip/core/messages/payloads/modify_attribute.py b/kmip/core/messages/payloads/modify_attribute.py index e94c08da..fc322f0f 100644 --- a/kmip/core/messages/payloads/modify_attribute.py +++ b/kmip/core/messages/payloads/modify_attribute.py @@ -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 @@ -84,7 +82,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 @@ -361,7 +359,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 diff --git a/kmip/core/messages/payloads/obtain_lease.py b/kmip/core/messages/payloads/obtain_lease.py index 178712dc..bdf58898 100644 --- a/kmip/core/messages/payloads/obtain_lease.py +++ b/kmip/core/messages/payloads/obtain_lease.py @@ -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 @@ -54,7 +52,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 @@ -202,7 +200,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 @@ -221,7 +219,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 @@ -240,7 +238,7 @@ def last_change_date(self): def last_change_date(self, value): if value is None: self._last_change_date = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._last_change_date = primitives.DateTime( value=value, tag=enums.Tags.LAST_CHANGE_DATE diff --git a/kmip/core/messages/payloads/poll.py b/kmip/core/messages/payloads/poll.py index 948bdac6..21ff48a7 100644 --- a/kmip/core/messages/payloads/poll.py +++ b/kmip/core/messages/payloads/poll.py @@ -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 @@ -55,7 +53,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 diff --git a/kmip/core/messages/payloads/query.py b/kmip/core/messages/payloads/query.py index 8c65d2e2..6f8b0622 100644 --- a/kmip/core/messages/payloads/query.py +++ b/kmip/core/messages/payloads/query.py @@ -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 misc @@ -396,7 +394,7 @@ def vendor_identification(self): def vendor_identification(self, value): if value is None: self._vendor_identification = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._vendor_identification = primitives.TextString( value=value, tag=enums.Tags.VENDOR_IDENTIFICATION @@ -432,7 +430,7 @@ def application_namespaces(self, value): elif isinstance(value, list): application_namespaces = [] for i in value: - if isinstance(i, six.string_types): + if isinstance(i, str): application_namespaces.append( primitives.TextString( value=i, @@ -671,7 +669,7 @@ def protection_storage_masks(self, value): elif isinstance(value, list): protection_storage_masks = [] for i in value: - if isinstance(i, six.integer_types): + if isinstance(i, int): protection_storage_masks.append( primitives.Integer( value=i, diff --git a/kmip/core/messages/payloads/recover.py b/kmip/core/messages/payloads/recover.py index abbf3163..ddceeec6 100644 --- a/kmip/core/messages/payloads/recover.py +++ b/kmip/core/messages/payloads/recover.py @@ -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 @@ -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 @@ -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 diff --git a/kmip/core/messages/payloads/register.py b/kmip/core/messages/payloads/register.py index 730f7faa..d90e6d7d 100644 --- a/kmip/core/messages/payloads/register.py +++ b/kmip/core/messages/payloads/register.py @@ -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 @@ -428,7 +426,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 diff --git a/kmip/core/messages/payloads/rekey.py b/kmip/core/messages/payloads/rekey.py index 0bd8f86e..52181281 100644 --- a/kmip/core/messages/payloads/rekey.py +++ b/kmip/core/messages/payloads/rekey.py @@ -10,8 +10,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 primitives @@ -69,7 +67,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 @@ -88,7 +86,7 @@ def offset(self): def offset(self, value): if value is None: self._offset = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._offset = primitives.Interval( value=value, tag=enums.Tags.OFFSET @@ -268,7 +266,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 diff --git a/kmip/core/messages/payloads/set_attribute.py b/kmip/core/messages/payloads/set_attribute.py index e9288079..21cff342 100644 --- a/kmip/core/messages/payloads/set_attribute.py +++ b/kmip/core/messages/payloads/set_attribute.py @@ -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 @@ -65,7 +63,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 @@ -270,7 +268,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 diff --git a/kmip/core/messages/payloads/sign.py b/kmip/core/messages/payloads/sign.py index 7035c8ee..a6371eef 100644 --- a/kmip/core/messages/payloads/sign.py +++ b/kmip/core/messages/payloads/sign.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six - from kmip.core import attributes from kmip.core import enums from kmip.core import primitives @@ -73,7 +71,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 @@ -108,7 +106,7 @@ def data(self): def data(self, value): if value is None: self._data is None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._data = primitives.ByteString( value=value, tag=enums.Tags.DATA @@ -278,7 +276,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 @@ -297,7 +295,7 @@ def signature_data(self): def signature_data(self, value): if value is None: self._signature_data = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._signature_data = primitives.ByteString( value=value, tag=enums.Tags.SIGNATURE_DATA diff --git a/kmip/core/messages/payloads/signature_verify.py b/kmip/core/messages/payloads/signature_verify.py index dc6f5066..52f5aafd 100644 --- a/kmip/core/messages/payloads/signature_verify.py +++ b/kmip/core/messages/payloads/signature_verify.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six - from kmip.core import attributes from kmip.core import enums from kmip.core import primitives @@ -109,7 +107,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 @@ -144,7 +142,7 @@ def data(self): def data(self, value): if value is None: self._data = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._data = primitives.ByteString( value=value, tag=enums.Tags.DATA @@ -163,7 +161,7 @@ def digested_data(self): def digested_data(self, value): if value is None: self._digested_data = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._digested_data = primitives.ByteString( value=value, tag=enums.Tags.DIGESTED_DATA @@ -182,7 +180,7 @@ def signature_data(self): def signature_data(self, value): if value is None: self._signature_data = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._signature_data = primitives.ByteString( value=value, tag=enums.Tags.SIGNATURE_DATA @@ -201,7 +199,7 @@ def correlation_value(self): def correlation_value(self, value): if value is None: self._correlation_value = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._correlation_value = primitives.ByteString( value=value, tag=enums.Tags.CORRELATION_VALUE @@ -494,7 +492,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 @@ -535,7 +533,7 @@ def data(self): def data(self, value): if value is None: self._data = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._data = primitives.ByteString( value=value, tag=enums.Tags.DATA @@ -554,7 +552,7 @@ def correlation_value(self): def correlation_value(self, value): if value is None: self._correlation_value = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._correlation_value = primitives.ByteString( value=value, tag=enums.Tags.CORRELATION_VALUE diff --git a/kmip/core/objects.py b/kmip/core/objects.py index fb49555f..b2993afb 100644 --- a/kmip/core/objects.py +++ b/kmip/core/objects.py @@ -581,7 +581,7 @@ def vendor_identification(self): def vendor_identification(self, value): if value is None: self._vendor_identification = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._vendor_identification = primitives.TextString( value, tag=enums.Tags.VENDOR_IDENTIFICATION @@ -600,7 +600,7 @@ def attribute_name(self): def attribute_name(self, value): if value is None: self._attribute_name = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._attribute_name = primitives.TextString( value, tag=enums.Tags.ATTRIBUTE_NAME @@ -1002,7 +1002,7 @@ def nonce_id(self): def nonce_id(self, value): if value is None: self._nonce_id = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._nonce_id = primitives.ByteString( value=value, tag=enums.Tags.NONCE_ID @@ -1021,7 +1021,7 @@ def nonce_value(self): def nonce_value(self, value): if value is None: self._nonce_value = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._nonce_value = primitives.ByteString( value=value, tag=enums.Tags.NONCE_VALUE @@ -1182,7 +1182,7 @@ def username(self): def username(self, value): if value is None: self._username = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._username = primitives.TextString( value=value, tag=enums.Tags.USERNAME @@ -1201,7 +1201,7 @@ def password(self): def password(self, value): if value is None: self._password = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._password = primitives.TextString( value=value, tag=enums.Tags.PASSWORD @@ -1379,7 +1379,7 @@ def device_serial_number(self): def device_serial_number(self, value): if value is None: self._device_serial_number = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._device_serial_number = primitives.TextString( value=value, tag=enums.Tags.DEVICE_SERIAL_NUMBER @@ -1398,7 +1398,7 @@ def password(self): def password(self, value): if value is None: self._password = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._password = primitives.TextString( value=value, tag=enums.Tags.PASSWORD @@ -1417,7 +1417,7 @@ def device_identifier(self): def device_identifier(self, value): if value is None: self._device_identifier = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._device_identifier = primitives.TextString( value=value, tag=enums.Tags.DEVICE_IDENTIFIER @@ -1436,7 +1436,7 @@ def network_identifier(self): def network_identifier(self, value): if value is None: self._network_identifier = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._network_identifier = primitives.TextString( value=value, tag=enums.Tags.NETWORK_IDENTIFIER @@ -1455,7 +1455,7 @@ def machine_identifier(self): def machine_identifier(self, value): if value is None: self._machine_identifier = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._machine_identifier = primitives.TextString( value=value, tag=enums.Tags.MACHINE_IDENTIFIER @@ -1474,7 +1474,7 @@ def media_identifier(self): def media_identifier(self, value): if value is None: self._media_identifier = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._media_identifier = primitives.TextString( value=value, tag=enums.Tags.MEDIA_IDENTIFIER @@ -1743,7 +1743,7 @@ def attestation_measurement(self): def attestation_measurement(self, value): if value is None: self._attestation_measurement = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._attestation_measurement = primitives.ByteString( value=value, tag=enums.Tags.ATTESTATION_MEASUREMENT @@ -1762,7 +1762,7 @@ def attestation_assertion(self): def attestation_assertion(self, value): if value is None: self._attestation_assertion = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._attestation_assertion = primitives.ByteString( value=value, tag=enums.Tags.ATTESTATION_ASSERTION @@ -2419,7 +2419,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 @@ -2601,7 +2601,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 @@ -2864,7 +2864,7 @@ def mac_signature(self): def mac_signature(self, value): if value is None: self._mac_signature = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._mac_signature = primitives.ByteString( value=value, tag=enums.Tags.MAC_SIGNATURE @@ -2883,7 +2883,7 @@ def iv_counter_nonce(self): def iv_counter_nonce(self, value): if value is None: self._iv_counter_nonce = None - elif isinstance(value, six.binary_type): + elif isinstance(value, bytes): self._iv_counter_nonce = primitives.ByteString( value=value, tag=enums.Tags.IV_COUNTER_NONCE @@ -3224,7 +3224,7 @@ def attribute_names(self, value): elif isinstance(value, list): attribute_names = [] for i in value: - if isinstance(i, six.string_types): + if isinstance(i, str): attribute_names.append( primitives.TextString( value=i, @@ -4500,7 +4500,7 @@ def cryptographic_length(self): def cryptographic_length(self, value): if value is None: self._cryptographic_length = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._cryptographic_length = primitives.Integer( value=value, tag=enums.Tags.CRYPTOGRAPHIC_LENGTH @@ -4936,7 +4936,7 @@ def server_uri(self): def server_uri(self, value): if value is None: self._server_uri = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._server_uri = primitives.TextString( value=value, tag=enums.Tags.SERVER_URI @@ -4954,7 +4954,7 @@ def server_port(self): def server_port(self, value): if value is None: self._server_port = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._server_port = primitives.Integer( value=value, tag=enums.Tags.SERVER_PORT @@ -5251,7 +5251,7 @@ def validation_authority_country(self): def validation_authority_country(self, value): if value is None: self._validation_authority_country = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._validation_authority_country = primitives.TextString( value=value, tag=enums.Tags.VALIDATION_AUTHORITY_COUNTRY @@ -5271,7 +5271,7 @@ def validation_authority_uri(self): def validation_authority_uri(self, value): if value is None: self._validation_authority_uri = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._validation_authority_uri = primitives.TextString( value=value, tag=enums.Tags.VALIDATION_AUTHORITY_URI @@ -5289,7 +5289,7 @@ def validation_version_major(self): def validation_version_major(self, value): if value is None: self._validation_version_major = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._validation_version_major = primitives.Integer( value=value, tag=enums.Tags.VALIDATION_VERSION_MAJOR @@ -5307,7 +5307,7 @@ def validation_version_minor(self): def validation_version_minor(self, value): if value is None: self._validation_version_minor = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._validation_version_minor = primitives.Integer( value=value, tag=enums.Tags.VALIDATION_VERSION_MINOR @@ -5346,7 +5346,7 @@ def validation_level(self): def validation_level(self, value): if value is None: self._validation_level = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._validation_level = primitives.Integer( value=value, tag=enums.Tags.VALIDATION_LEVEL @@ -5364,7 +5364,7 @@ def validation_certificate_identifier(self): def validation_certificate_identifier(self, value): if value is None: self._validation_certificate_identifier = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._validation_certificate_identifier = primitives.TextString( value=value, tag=enums.Tags.VALIDATION_CERTIFICATE_IDENTIFIER @@ -5384,7 +5384,7 @@ def validation_certificate_uri(self): def validation_certificate_uri(self, value): if value is None: self._validation_certificate_uri = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._validation_certificate_uri = primitives.TextString( value=value, tag=enums.Tags.VALIDATION_CERTIFICATE_URI @@ -5402,7 +5402,7 @@ def validation_vendor_uri(self): def validation_vendor_uri(self, value): if value is None: self._validation_vendor_uri = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._validation_vendor_uri = primitives.TextString( value=value, tag=enums.Tags.VALIDATION_VENDOR_URI @@ -5423,7 +5423,7 @@ def validation_profiles(self, value): elif isinstance(value, list): validation_profiles = [] for v in value: - if isinstance(v, six.string_types): + if isinstance(v, str): validation_profiles.append( primitives.TextString( value=v, @@ -6455,7 +6455,7 @@ def protection_storage_masks(self, value): elif isinstance(value, list): protection_storage_masks = [] for x in value: - if isinstance(x, six.integer_types): + if isinstance(x, int): if enums.is_bit_mask(enums.ProtectionStorageMask, x): protection_storage_masks.append( primitives.Integer( diff --git a/kmip/core/primitives.py b/kmip/core/primitives.py index b8cd9a75..7dd5ea29 100644 --- a/kmip/core/primitives.py +++ b/kmip/core/primitives.py @@ -15,7 +15,6 @@ import enum as enumeration import logging -import six import struct import sys import time @@ -246,9 +245,9 @@ def validate(self): integer """ if self.value is not None: - if type(self.value) not in six.integer_types: + if type(self.value) not in int: raise TypeError('expected (one of): {0}, observed: {1}'.format( - six.integer_types, type(self.value))) + int, type(self.value))) else: if self.value > Integer.MAX: raise ValueError('integer value greater than accepted max') @@ -378,9 +377,9 @@ def validate(self): integer """ if self.value is not None: - if not isinstance(self.value, six.integer_types): + if not isinstance(self.value, int): raise TypeError('expected (one of): {0}, observed: {1}'.format( - six.integer_types, type(self.value))) + int, type(self.value))) else: if self.value > LongInteger.MAX: raise ValueError( @@ -520,9 +519,9 @@ def validate(self): TypeError: if the value is not of type int or long """ if self.value is not None: - if not isinstance(self.value, six.integer_types): + if not isinstance(self.value, int): raise TypeError('expected (one of): {0}, observed: {1}'.format( - six.integer_types, type(self.value))) + int, type(self.value))) def __repr__(self): return "BigInteger(value={0}, tag={1})".format(self.value, self.tag) @@ -648,7 +647,7 @@ def validate(self): raise TypeError( 'enumeration {0} must be of type {1}'.format( self.value, self.enum)) - if type(self.value.value) not in six.integer_types: + if type(self.value.value) not in int: raise TypeError('enumeration value must be an int') else: if self.value.value > Enumeration.MAX: @@ -884,7 +883,7 @@ def validate(self): def __validate(self): if self.value is not None: - if not isinstance(self.value, six.string_types): + if not isinstance(self.value, str): msg = exceptions.ErrorStrings.BAD_EXP_RECV raise TypeError(msg.format('TextString', 'value', str, type(self.value))) @@ -1121,9 +1120,9 @@ def validate(self): 32-bit integer """ if self.value is not None: - if type(self.value) not in six.integer_types: + if type(self.value) not in int: raise TypeError('expected (one of): {0}, observed: {1}'.format( - six.integer_types, type(self.value))) + int, type(self.value))) else: if self.value > Interval.MAX: raise ValueError( diff --git a/kmip/core/secrets.py b/kmip/core/secrets.py index 1b0ceace..16b5c75b 100644 --- a/kmip/core/secrets.py +++ b/kmip/core/secrets.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six - from kmip.core.attributes import CertificateType from kmip.core import enums @@ -301,7 +299,7 @@ def split_key_parts(self): def split_key_parts(self, value): if value is None: self._split_key_parts = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._split_key_parts = primitives.Integer( value=value, tag=enums.Tags.SPLIT_KEY_PARTS @@ -319,7 +317,7 @@ def key_part_identifier(self): def key_part_identifier(self, value): if value is None: self._key_part_identifier = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._key_part_identifier = primitives.Integer( value=value, tag=enums.Tags.KEY_PART_IDENTIFIER @@ -337,7 +335,7 @@ def split_key_threshold(self): def split_key_threshold(self, value): if value is None: self._split_key_threshold = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._split_key_threshold = primitives.Integer( value=value, tag=enums.Tags.SPLIT_KEY_THRESHOLD @@ -376,7 +374,7 @@ def prime_field_size(self): def prime_field_size(self, value): if value is None: self._prime_field_size = None - elif isinstance(value, six.integer_types): + elif isinstance(value, int): self._prime_field_size = primitives.BigInteger( value=value, tag=enums.Tags.PRIME_FIELD_SIZE diff --git a/kmip/pie/client.py b/kmip/pie/client.py index d27ad4b1..e6f398d2 100644 --- a/kmip/pie/client.py +++ b/kmip/pie/client.py @@ -14,7 +14,6 @@ # under the License. import logging -import six from kmip.core import enums from kmip.core import primitives @@ -222,7 +221,7 @@ def create(self, algorithm, length, operation_policy_name=None, name=None, if not isinstance(algorithm, enums.CryptographicAlgorithm): raise TypeError( "algorithm must be a CryptographicAlgorithm enumeration") - elif not isinstance(length, six.integer_types) or length <= 0: + elif not isinstance(length, int) or length <= 0: raise TypeError("length must be a positive integer") if cryptographic_usage_mask is not None: if not isinstance(cryptographic_usage_mask, list) or \ @@ -305,7 +304,7 @@ def create_key_pair(self, if not isinstance(algorithm, enums.CryptographicAlgorithm): raise TypeError( "algorithm must be a CryptographicAlgorithm enumeration") - elif not isinstance(length, six.integer_types) or length <= 0: + elif not isinstance(length, int) or length <= 0: raise TypeError("length must be a positive integer") # Create the common attributes that are shared @@ -611,10 +610,10 @@ def rekey(self, TypeError: if the input arguments are invalid """ if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("The unique identifier must be a string.") if offset is not None: - if not isinstance(offset, six.integer_types): + if not isinstance(offset, int): raise TypeError("The offset must be an integer.") # TODO (peter-hamilton) Unify attribute handling across operations @@ -735,7 +734,7 @@ def derive_key(self, raise TypeError("Unique identifiers must be a list of strings.") else: for unique_identifier in unique_identifiers: - if not isinstance(unique_identifier, six.string_types): + if not isinstance(unique_identifier, str): raise TypeError( "Unique identifiers must be a list of strings." ) @@ -833,13 +832,13 @@ def locate(self, maximum_items=None, storage_status_mask=None, """ # Check inputs if maximum_items is not None: - if not isinstance(maximum_items, six.integer_types): + if not isinstance(maximum_items, int): raise TypeError("maximum_items must be an integer") if offset_items is not None: - if not isinstance(offset_items, six.integer_types): + if not isinstance(offset_items, int): raise TypeError("offset items must be an integer") if storage_status_mask is not None: - if not isinstance(storage_status_mask, six.integer_types): + if not isinstance(storage_status_mask, int): raise TypeError("storage_status_mask must be an integer") if object_group_member is not None: if not isinstance(object_group_member, enums.ObjectGroupMember): @@ -891,10 +890,10 @@ def check(self, specified managed object. Optional, defaults to None. """ if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("The unique identifier must be a string.") if usage_limits_count is not None: - if not isinstance(usage_limits_count, six.integer_types): + if not isinstance(usage_limits_count, int): raise TypeError("The usage limits count must be an integer.") if cryptographic_usage_mask is not None: if not isinstance(cryptographic_usage_mask, list) or \ @@ -907,7 +906,7 @@ def check(self, "CryptographicUsageMask enumerations." ) if lease_time is not None: - if not isinstance(lease_time, six.integer_types): + if not isinstance(lease_time, int): raise TypeError("The lease time must be an integer.") result = self.proxy.check( @@ -973,7 +972,7 @@ def get(self, uid=None, key_wrapping_specification=None): """ # Check input if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("uid must be a string") if key_wrapping_specification is not None: if not isinstance(key_wrapping_specification, dict): @@ -1018,14 +1017,14 @@ def get_attributes(self, uid=None, attribute_names=None): """ # Check input if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("uid must be a string") if attribute_names is not None: if not isinstance(attribute_names, list): raise TypeError("attribute_names must be a list of strings") else: for attribute_name in attribute_names: - if not isinstance(attribute_name, six.string_types): + if not isinstance(attribute_name, str): raise TypeError( "attribute_names must be a list of strings" ) @@ -1056,7 +1055,7 @@ def get_attribute_list(self, uid=None): """ # Check input if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("uid must be a string") # Get the list of attribute names for a managed object. @@ -1090,7 +1089,7 @@ def activate(self, uid=None): """ # Check input if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("uid must be a string") # Activate the managed object and handle the results @@ -1135,13 +1134,13 @@ def revoke(self, revocation_reason, uid=None, revocation_message=None, raise TypeError( "revocation_reason must be a RevocationReasonCode enumeration") if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("uid must be a string") if revocation_message is not None: - if not isinstance(revocation_message, six.string_types): + if not isinstance(revocation_message, str): raise TypeError("revocation_message must be a string") if compromise_occurrence_date is not None: - if not isinstance(compromise_occurrence_date, six.integer_types): + if not isinstance(compromise_occurrence_date, int): raise TypeError( "compromise_occurrence_date must be an integer") compromise_occurrence_date = primitives.DateTime( @@ -1178,7 +1177,7 @@ def destroy(self, uid=None): """ # Check input if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("uid must be a string") # Destroy the managed object and handle the results @@ -1265,16 +1264,16 @@ def encrypt(self, data, uid=None, cryptographic_parameters=None, | mode (typically 1). """ # Check input - if not isinstance(data, six.binary_type): + if not isinstance(data, bytes): raise TypeError("data must be bytes") if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("uid must be a string") if cryptographic_parameters is not None: if not isinstance(cryptographic_parameters, dict): raise TypeError("cryptographic_parameters must be a dict") if iv_counter_nonce is not None: - if not isinstance(iv_counter_nonce, six.binary_type): + if not isinstance(iv_counter_nonce, bytes): raise TypeError("iv_counter_nonce must be bytes") cryptographic_parameters = self._build_cryptographic_parameters( @@ -1370,16 +1369,16 @@ def decrypt(self, data, uid=None, cryptographic_parameters=None, | mode (typically 1). """ # Check input - if not isinstance(data, six.binary_type): + if not isinstance(data, bytes): raise TypeError("data must be bytes") if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("uid must be a string") if cryptographic_parameters is not None: if not isinstance(cryptographic_parameters, dict): raise TypeError("cryptographic_parameters must be a dict") if iv_counter_nonce is not None: - if not isinstance(iv_counter_nonce, six.binary_type): + if not isinstance(iv_counter_nonce, bytes): raise TypeError("iv_counter_nonce must be bytes") cryptographic_parameters = self._build_cryptographic_parameters( @@ -1435,12 +1434,12 @@ def signature_verify(self, message, signature, uid=None, see the documentation for encrypt/decrypt. """ # Check input - if not isinstance(message, six.binary_type): + if not isinstance(message, bytes): raise TypeError("Message must be bytes.") - if not isinstance(signature, six.binary_type): + if not isinstance(signature, bytes): raise TypeError("Signature must be bytes.") if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("Unique identifier must be a string.") if cryptographic_parameters is not None: if not isinstance(cryptographic_parameters, dict): @@ -1493,10 +1492,10 @@ def sign(self, data, uid=None, cryptographic_parameters=None): TypeError: if the input arguments are invalid """ # Check input - if not isinstance(data, six.binary_type): + if not isinstance(data, bytes): raise TypeError("Data to be signed must be bytes.") if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("Unique identifier must be a string.") if cryptographic_parameters is not None: if not isinstance(cryptographic_parameters, dict): @@ -1548,10 +1547,10 @@ def mac(self, data, uid=None, algorithm=None): TypeError: if the input arguments are invalid """ # Check inputs - if not isinstance(data, six.binary_type): + if not isinstance(data, bytes): raise TypeError("data must be bytes") if uid is not None: - if not isinstance(uid, six.string_types): + if not isinstance(uid, str): raise TypeError("uid must be a string") if algorithm is not None: if not isinstance(algorithm, enums.CryptographicAlgorithm): diff --git a/kmip/pie/objects.py b/kmip/pie/objects.py index 4089ebbb..e45746fa 100644 --- a/kmip/pie/objects.py +++ b/kmip/pie/objects.py @@ -20,7 +20,6 @@ from sqlalchemy.ext.associationproxy import association_proxy import binascii -import six from kmip.core import enums from kmip.pie import sqltypes as sql @@ -721,7 +720,7 @@ def validate(self): enums.CryptographicAlgorithm): raise TypeError("key algorithm must be a CryptographicAlgorithm " "enumeration") - elif not isinstance(self.cryptographic_length, six.integer_types): + elif not isinstance(self.cryptographic_length, int): raise TypeError("key length must be an integer") mask_count = len(self.cryptographic_usage_masks) @@ -736,7 +735,7 @@ def validate(self): name_count = len(self.names) for i in range(name_count): name = self.names[i] - if not isinstance(name, six.string_types): + if not isinstance(name, str): position = "({0} in list)".format(i) raise TypeError("key name {0} must be a string".format( position)) @@ -895,7 +894,7 @@ def validate(self): enums.CryptographicAlgorithm): raise TypeError("key algorithm must be a CryptographicAlgorithm " "enumeration") - elif not isinstance(self.cryptographic_length, six.integer_types): + elif not isinstance(self.cryptographic_length, int): raise TypeError("key length must be an integer") elif not isinstance(self.key_format_type, enums.KeyFormatType): raise TypeError("key format type must be a KeyFormatType " @@ -918,7 +917,7 @@ def validate(self): name_count = len(self.names) for i in range(name_count): name = self.names[i] - if not isinstance(name, six.string_types): + if not isinstance(name, str): position = "({0} in list)".format(i) raise TypeError("key name {0} must be a string".format( position)) @@ -1066,7 +1065,7 @@ def validate(self): enums.CryptographicAlgorithm): raise TypeError("key algorithm must be a CryptographicAlgorithm " "enumeration") - elif not isinstance(self.cryptographic_length, six.integer_types): + elif not isinstance(self.cryptographic_length, int): raise TypeError("key length must be an integer") elif not isinstance(self.key_format_type, enums.KeyFormatType): raise TypeError("key format type must be a KeyFormatType " @@ -1089,7 +1088,7 @@ def validate(self): name_count = len(self.names) for i in range(name_count): name = self.names[i] - if not isinstance(name, six.string_types): + if not isinstance(name, str): position = "({0} in list)".format(i) raise TypeError("key name {0} must be a string".format( position)) @@ -1249,7 +1248,7 @@ def split_key_parts(self): @split_key_parts.setter def split_key_parts(self, value): - if (value is None) or (isinstance(value, six.integer_types)): + if (value is None) or (isinstance(value, int)): self._split_key_parts = value else: raise TypeError("The split key parts must be an integer.") @@ -1260,7 +1259,7 @@ def key_part_identifier(self): @key_part_identifier.setter def key_part_identifier(self, value): - if (value is None) or (isinstance(value, six.integer_types)): + if (value is None) or (isinstance(value, int)): self._key_part_identifier = value else: raise TypeError("The key part identifier must be an integer.") @@ -1271,7 +1270,7 @@ def split_key_threshold(self): @split_key_threshold.setter def split_key_threshold(self, value): - if (value is None) or (isinstance(value, six.integer_types)): + if (value is None) or (isinstance(value, int)): self._split_key_threshold = value else: raise TypeError("The split key threshold must be an integer.") @@ -1295,7 +1294,7 @@ def prime_field_size(self): @prime_field_size.setter def prime_field_size(self, value): - if (value is None) or (isinstance(value, six.integer_types)): + if (value is None) or (isinstance(value, int)): self._prime_field_size = value else: raise TypeError("The prime field size must be an integer.") @@ -1489,7 +1488,7 @@ def validate(self): name_count = len(self.names) for i in range(name_count): name = self.names[i] - if not isinstance(name, six.string_types): + if not isinstance(name, str): position = "({0} in list)".format(i) raise TypeError("certificate name {0} must be a string".format( position)) @@ -1664,7 +1663,7 @@ def validate(self): name_count = len(self.names) for i in range(name_count): name = self.names[i] - if not isinstance(name, six.string_types): + if not isinstance(name, str): position = "({0} in list)".format(i) raise TypeError("secret data name {0} must be a string".format( position)) @@ -1771,7 +1770,7 @@ def validate(self): name_count = len(self.names) for i in range(name_count): name = self.names[i] - if not isinstance(name, six.string_types): + if not isinstance(name, str): position = "({0} in list)".format(i) raise TypeError("opaque data name {0} must be a string".format( position)) @@ -1847,7 +1846,7 @@ def application_namespace(self): @application_namespace.setter def application_namespace(self, value): - if (value is None) or (isinstance(value, six.string_types)): + if (value is None) or (isinstance(value, str)): self._application_namespace = value else: raise TypeError("The application namespace must be a string.") @@ -1858,7 +1857,7 @@ def application_data(self): @application_data.setter def application_data(self, value): - if (value is None) or (isinstance(value, six.string_types)): + if (value is None) or (isinstance(value, str)): self._application_data = value else: raise TypeError("The application data must be a string.") @@ -1937,7 +1936,7 @@ def object_group(self): @object_group.setter def object_group(self, value): - if (value is None) or (isinstance(value, six.string_types)): + if (value is None) or (isinstance(value, str)): self._object_group = value else: raise TypeError("The object group must be a string.") diff --git a/kmip/services/kmip_client.py b/kmip/services/kmip_client.py index 7f72adf7..10c319d8 100644 --- a/kmip/services/kmip_client.py +++ b/kmip/services/kmip_client.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -from __future__ import print_function - from kmip.services.results import ActivateResult from kmip.services.results import CreateResult from kmip.services.results import CreateKeyPairResult @@ -98,7 +96,7 @@ def __init__(self, host=None, port=None, keyfile=None, self.kmip_version = enums.KMIPVersion.KMIP_1_2 if config_file: - if not isinstance(config_file, six.string_types): + if not isinstance(config_file, str): raise ValueError( "The client configuration file argument must be a string." ) diff --git a/kmip/services/server/auth/slugs.py b/kmip/services/server/auth/slugs.py index 5046313a..d9600991 100644 --- a/kmip/services/server/auth/slugs.py +++ b/kmip/services/server/auth/slugs.py @@ -14,7 +14,6 @@ # under the License. import requests -import six from kmip.core import exceptions from kmip.services.server.auth import api @@ -50,7 +49,7 @@ def url(self, value): self._url = None self.users_url = None self.groups_url = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self._url = value if not self._url.endswith("/"): self._url += "/" diff --git a/kmip/services/server/config.py b/kmip/services/server/config.py index 912d980d..aa74eb67 100644 --- a/kmip/services/server/config.py +++ b/kmip/services/server/config.py @@ -15,7 +15,6 @@ import logging import os -import six from six.moves import configparser @@ -186,7 +185,7 @@ def _parse_settings(self, parser): self._set_database_path(parser.get('server', 'database_path')) def _set_hostname(self, value): - if isinstance(value, six.string_types): + if isinstance(value, str): self.settings['hostname'] = value else: raise exceptions.ConfigurationError( @@ -194,7 +193,7 @@ def _set_hostname(self, value): ) def _set_port(self, value): - if isinstance(value, six.integer_types): + if isinstance(value, int): if 0 < value < 65535: self.settings['port'] = value else: @@ -209,7 +208,7 @@ def _set_port(self, value): def _set_certificate_path(self, value): if value is None: self.settings['certificate_path'] = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): if os.path.exists(value): self.settings['certificate_path'] = value else: @@ -226,7 +225,7 @@ def _set_certificate_path(self, value): def _set_key_path(self, value): if value is None: self.settings['key_path'] = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): if os.path.exists(value): self.settings['key_path'] = value else: @@ -243,7 +242,7 @@ def _set_key_path(self, value): def _set_ca_path(self, value): if value is None: self.settings['ca_path'] = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): if os.path.exists(value): self.settings['ca_path'] = value else: @@ -271,7 +270,7 @@ def _set_auth_suite(self, value): def _set_policy_path(self, value): if not value: self.settings['policy_path'] = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self.settings['policy_path'] = value else: raise exceptions.ConfigurationError( @@ -294,12 +293,12 @@ def _set_tls_cipher_suites(self, value): if not value: self.settings['tls_cipher_suites'] = [] return - if isinstance(value, six.string_types): + if isinstance(value, str): value = value.split() if isinstance(value, list): for entry in value: - if not isinstance(entry, six.string_types): + if not isinstance(entry, str): raise exceptions.ConfigurationError( "The TLS cipher suites must be a set of strings " "representing cipher suite names." @@ -325,7 +324,7 @@ def _set_logging_level(self, value): } if value in logging_levels.values(): self.settings['logging_level'] = value - elif isinstance(value, six.string_types): + elif isinstance(value, str): level = logging_levels.get(value.upper()) if level: self.settings['logging_level'] = level @@ -343,7 +342,7 @@ def _set_logging_level(self, value): def _set_database_path(self, value): if not value: self.settings['database_path'] = None - elif isinstance(value, six.string_types): + elif isinstance(value, str): self.settings['database_path'] = value else: raise exceptions.ConfigurationError( diff --git a/kmip/tests/functional/services/test_authentication.py b/kmip/tests/functional/services/test_authentication.py index 6f912eac..44b8a7a5 100644 --- a/kmip/tests/functional/services/test_authentication.py +++ b/kmip/tests/functional/services/test_authentication.py @@ -15,7 +15,6 @@ import os import pytest -import six import testtools import time @@ -66,7 +65,7 @@ def test_group_level_access_control(self): 256, operation_policy_name="policy_1" ) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) key = c.get(uid) self.assertIsInstance(key, objects.SymmetricKey) @@ -116,7 +115,7 @@ def test_policy_live_loading(self): 256, operation_policy_name="policy_1" ) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) key = c.get(uid) self.assertIsInstance(key, objects.SymmetricKey) @@ -192,7 +191,7 @@ def test_policy_caching(self): 256, operation_policy_name="policy_1" ) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) key = c.get(uid) self.assertIsInstance(key, objects.SymmetricKey) diff --git a/kmip/tests/integration/services/test_proxykmipclient.py b/kmip/tests/integration/services/test_proxykmipclient.py index 9af12636..e6d79e3c 100644 --- a/kmip/tests/integration/services/test_proxykmipclient.py +++ b/kmip/tests/integration/services/test_proxykmipclient.py @@ -13,7 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six import testtools import time import pytest @@ -48,7 +47,7 @@ def test_symmetric_key_create_get_destroy(self): symmetric key. """ uid = self.client.create(enums.CryptographicAlgorithm.AES, 256) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) try: key = self.client.get(uid) @@ -124,7 +123,7 @@ def test_symmetric_key_register_get_destroy(self): ) uid = self.client.register(key) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) try: result = self.client.get(uid) @@ -258,8 +257,8 @@ def test_asymmetric_key_pair_create_get_destroy(self): public_usage_mask=[enums.CryptographicUsageMask.ENCRYPT], private_usage_mask=[enums.CryptographicUsageMask.DECRYPT] ) - self.assertIsInstance(public_uid, six.string_types) - self.assertIsInstance(private_uid, six.string_types) + self.assertIsInstance(public_uid, str) + self.assertIsInstance(private_uid, str) try: public_key = self.client.get(public_uid) @@ -325,7 +324,7 @@ def test_public_key_register_get_destroy(self): enums.KeyFormatType.PKCS_1) uid = self.client.register(key) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) try: result = self.client.get(uid) @@ -433,7 +432,7 @@ def test_private_key_register_get_destroy(self): enums.KeyFormatType.PKCS_8) uid = self.client.register(key) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) try: result = self.client.get(uid) @@ -511,7 +510,7 @@ def test_x509_certificate_register_get_destroy(self): b'\xEB\x5F\x7E\xA8\x11\xEB\xB2\x5A\x7F\x86')) uid = self.client.register(cert) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) try: result = self.client.get(uid) @@ -539,7 +538,7 @@ def test_secret_data_register_get_destroy(self): enums.SecretDataType.PASSWORD) uid = self.client.register(secret) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) try: result = self.client.get(uid) @@ -578,7 +577,7 @@ def test_secret_data_register_get_destroy_app_specific(self): ) uid = self.client.register(secret) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) try: result = self.client.get(uid) @@ -641,7 +640,7 @@ def test_opaque_object_register_get_destroy(self): b'\x53\x65\x63\x72\x65\x74\x50\x61\x73\x73\x77\x6F\x72\x64', enums.OpaqueDataType.NONE) uid = self.client.register(obj) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) try: result = self.client.get(uid) @@ -987,7 +986,7 @@ def test_create_key_pair_sign_signature_verify(self): } ) - self.assertIsInstance(signature, six.binary_type) + self.assertIsInstance(signature, bytes) # Verify the message signature. result = self.client.signature_verify( @@ -1469,7 +1468,7 @@ def test_split_key_register_get_destroy(self): ) uid = self.client.register(key) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) try: result = self.client.get(uid) diff --git a/kmip/tests/unit/core/messages/test_messages.py b/kmip/tests/unit/core/messages/test_messages.py index 0e3feda1..a959c463 100644 --- a/kmip/tests/unit/core/messages/test_messages.py +++ b/kmip/tests/unit/core/messages/test_messages.py @@ -16,7 +16,6 @@ import testtools from testtools import TestCase import binascii -import six from kmip.core.factories.secrets import SecretFactory from kmip.core.factories.attributes import AttributeFactory @@ -1588,9 +1587,9 @@ def test_create_response_read(self): unique_identifier = response_payload.unique_identifier value = 'fb4b5b9c-6188-4c63-8142-fe9c328129fc' - self.assertIsInstance(unique_identifier, six.string_types, + self.assertIsInstance(unique_identifier, str, self.msg.format('unique identifier', 'type', - six.string_types, + str, type(unique_identifier))) self.assertEqual(value, unique_identifier, self.msg.format('unique identifier', 'value', @@ -2104,8 +2103,8 @@ def test_register_response_read(self): unique_identifier = response_payload.unique_identifier msg = "Bad unique identifier type: expected {0}, received {1}" - self.assertIsInstance(unique_identifier, six.string_types, - msg.format(six.string_types, + self.assertIsInstance(unique_identifier, str, + msg.format(str, type(unique_identifier))) msg = "Bad unique identifier value: expected {0}, received {1}" exp_value = '5c9b81ef-4ee5-42cd-ba2d-c002fdd0c7b3' diff --git a/kmip/tests/unit/core/primitives/test_text_string.py b/kmip/tests/unit/core/primitives/test_text_string.py index fb1a78e4..31eacac8 100644 --- a/kmip/tests/unit/core/primitives/test_text_string.py +++ b/kmip/tests/unit/core/primitives/test_text_string.py @@ -13,7 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six import testtools from kmip.core import exceptions @@ -55,7 +54,7 @@ def test_init(self): def test_init_unset(self): text_string = primitives.TextString() - expected = six.string_types + expected = str observed = text_string.value msg = "expected {0}, observed {1}".format(expected, observed) diff --git a/kmip/tests/unit/pie/test_client.py b/kmip/tests/unit/pie/test_client.py index c9947a8f..565d4f40 100644 --- a/kmip/tests/unit/pie/test_client.py +++ b/kmip/tests/unit/pie/test_client.py @@ -240,7 +240,7 @@ def test_create(self): uid = client.create(algorithm, length) client.proxy.create.assert_called_with( enums.ObjectType.SYMMETRIC_KEY, template) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) self.assertEqual(uid, key_id) @mock.patch('kmip.pie.client.KMIPProxy', @@ -511,8 +511,8 @@ def test_create_key_pair(self): "public_key_template_attribute": None } client.proxy.create_key_pair.assert_called_with(**kwargs) - self.assertIsInstance(public_uid, six.string_types) - self.assertIsInstance(private_uid, six.string_types) + self.assertIsInstance(public_uid, str) + self.assertIsInstance(private_uid, str) @mock.patch('kmip.pie.client.KMIPProxy', mock.MagicMock(spec_set=KMIPProxy)) @@ -1278,7 +1278,7 @@ def test_get_attributes(self): 'aaaaaaaa-1111-2222-3333-ffffffffffff', ['Name', 'Object Type'] ) - self.assertIsInstance(result[0], six.string_types) + self.assertIsInstance(result[0], str) self.assertIsInstance(result[1], list) for r in result[1]: self.assertIsInstance(r, obj.Attribute) @@ -1739,7 +1739,7 @@ def test_register(self): client.proxy.register.return_value = result uid = client.register(key) self.assertTrue(client.proxy.register.called) - self.assertIsInstance(uid, six.string_types) + self.assertIsInstance(uid, str) @mock.patch('kmip.pie.client.KMIPProxy', mock.MagicMock(spec_set=KMIPProxy)) diff --git a/kmip/tests/unit/services/server/test_engine.py b/kmip/tests/unit/services/server/test_engine.py index ad596dfe..84deb436 100644 --- a/kmip/tests/unit/services/server/test_engine.py +++ b/kmip/tests/unit/services/server/test_engine.py @@ -1538,7 +1538,7 @@ def test_get_attribute_from_managed_object(self): 'Initial Date' ) self.assertIsNotNone(result) - self.assertIsInstance(result, six.integer_types) + self.assertIsInstance(result, int) result = e._get_attribute_from_managed_object( symmetric_key,