diff options
author | Takashi Kajinami <tkajinam@redhat.com> | 2022-05-17 17:22:01 +0900 |
---|---|---|
committer | Takashi Kajinami <tkajinam@redhat.com> | 2022-05-18 22:31:01 +0900 |
commit | 69125bfd07398245480e783415352a2ed0c5ee92 (patch) | |
tree | 0c783c5e14ecb6dbf9aeb2960df3e06f3dc1c7c6 /barbicanclient/v1/secrets.py | |
parent | c6ce0af02863439e5a4834fede07fb4bf855e631 (diff) | |
download | python-barbicanclient-69125bfd07398245480e783415352a2ed0c5ee92.tar.gz |
Remove six
Python 2 is no longer supported, so we no longer need the six library.
This change removes usage of the library as well as reference to it
(and Python 2) from the documentation.
Change-Id: I6328b11dcad54f70f64ecff53eb60708e34351cf
Diffstat (limited to 'barbicanclient/v1/secrets.py')
-rw-r--r-- | barbicanclient/v1/secrets.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/barbicanclient/v1/secrets.py b/barbicanclient/v1/secrets.py index f4bc7ad..4a57860 100644 --- a/barbicanclient/v1/secrets.py +++ b/barbicanclient/v1/secrets.py @@ -17,7 +17,6 @@ import functools import logging from oslo_utils.timeutils import parse_isotime -import six from barbicanclient import base from barbicanclient import exceptions @@ -293,7 +292,7 @@ class Secret(SecretFormatter): } if self.payload is not None: - if not isinstance(self.payload, (six.text_type, six.binary_type)): + if not isinstance(self.payload, (str, bytes)): raise exceptions.PayloadException("Invalid Payload Type") if not len(self.payload): @@ -307,7 +306,7 @@ class Secret(SecretFormatter): for backwards compatibility and should be removed in a future release. ''' - if type(self.payload) is six.binary_type: + if type(self.payload) is bytes: secret_dict['payload'] = self.payload.decode('utf-8') else: secret_dict['payload'] = self.payload @@ -315,9 +314,9 @@ class Secret(SecretFormatter): secret_dict['payload_content_encoding'] = ( self.payload_content_encoding ) - elif type(self.payload) is six.binary_type: + elif type(self.payload) is bytes: ''' - six.binary_type is stored as application/octet-stream + bytes is stored as application/octet-stream and it is base64 encoded for a one-step POST ''' secret_dict['payload'] = ( @@ -325,9 +324,9 @@ class Secret(SecretFormatter): ).decode('UTF-8') secret_dict['payload_content_type'] = u'application/octet-stream' secret_dict['payload_content_encoding'] = u'base64' - elif type(self.payload) is six.text_type: + elif type(self.payload) is str: ''' - six.text_type is stored as text/plain + str is stored as text/plain ''' secret_dict['payload'] = self.payload secret_dict['payload_content_type'] = u'text/plain' @@ -350,9 +349,9 @@ class Secret(SecretFormatter): if not self.secret_ref: raise LookupError("Secret is not yet stored.") - if type(self.payload) is six.binary_type: + if type(self.payload) is bytes: headers = {'content-type': "application/octet-stream"} - elif type(self.payload) is six.text_type: + elif type(self.payload) is str: headers = {'content-type': "text/plain"} else: raise exceptions.PayloadException("Invalid Payload Type") @@ -479,9 +478,9 @@ class SecretManager(base.BaseEntityManager): if not secret_ref: raise ValueError('secret_ref is required.') - if type(payload) is six.binary_type: + if type(payload) is bytes: headers = {'content-type': "application/octet-stream"} - elif type(payload) is six.text_type: + elif type(payload) is str: headers = {'content-type': "text/plain"} else: raise exceptions.PayloadException("Invalid Payload Type") |