mirror of
https://github.com/ansible-collections/community.crypto.git
synced 2026-05-06 21:33:00 +00:00
Remove six usages. (#884)
This commit is contained in:
@@ -9,7 +9,6 @@ import os
|
||||
import stat
|
||||
import traceback
|
||||
|
||||
from ansible.module_utils import six
|
||||
from ansible_collections.community.crypto.plugins.module_utils.openssh.utils import (
|
||||
parse_openssh_version,
|
||||
)
|
||||
@@ -59,8 +58,7 @@ def _restore_all_on_failure(f):
|
||||
return backup_and_restore
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class OpensshModule:
|
||||
class OpensshModule(metaclass=abc.ABCMeta):
|
||||
def __init__(self, module):
|
||||
self.module = module
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ from __future__ import annotations
|
||||
import abc
|
||||
import os
|
||||
|
||||
from ansible.module_utils import six
|
||||
from ansible.module_utils.basic import missing_required_lib
|
||||
from ansible.module_utils.common.text.converters import to_bytes, to_text
|
||||
from ansible_collections.community.crypto.plugins.module_utils.cryptography_dep import (
|
||||
@@ -40,8 +39,7 @@ from ansible_collections.community.crypto.plugins.module_utils.version import (
|
||||
)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class KeypairBackend(OpensshModule):
|
||||
class KeypairBackend(OpensshModule, metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self, module):
|
||||
super(KeypairBackend, self).__init__(module)
|
||||
|
||||
@@ -12,7 +12,6 @@ from base64 import b64encode
|
||||
from datetime import datetime
|
||||
from hashlib import sha256
|
||||
|
||||
from ansible.module_utils import six
|
||||
from ansible.module_utils.common.text.converters import to_text
|
||||
from ansible_collections.community.crypto.plugins.module_utils.openssh.utils import (
|
||||
OpensshParser,
|
||||
@@ -159,7 +158,7 @@ class OpensshCertificateTimeParameters:
|
||||
@staticmethod
|
||||
def to_datetime(time_string_or_timestamp):
|
||||
try:
|
||||
if isinstance(time_string_or_timestamp, six.string_types):
|
||||
if isinstance(time_string_or_timestamp, (str, bytes)):
|
||||
result = OpensshCertificateTimeParameters._time_string_to_datetime(
|
||||
time_string_or_timestamp.strip()
|
||||
)
|
||||
@@ -216,10 +215,10 @@ class OpensshCertificateOption:
|
||||
if option_type not in ("critical", "extension"):
|
||||
raise ValueError("type must be either 'critical' or 'extension'")
|
||||
|
||||
if not isinstance(name, six.string_types):
|
||||
if not isinstance(name, (str, bytes)):
|
||||
raise TypeError(f"name must be a string not {type(name)}")
|
||||
|
||||
if not isinstance(data, six.string_types):
|
||||
if not isinstance(data, (str, bytes)):
|
||||
raise TypeError(f"data must be a string not {type(data)}")
|
||||
|
||||
self._option_type = option_type
|
||||
@@ -263,7 +262,7 @@ class OpensshCertificateOption:
|
||||
|
||||
@classmethod
|
||||
def from_string(cls, option_string):
|
||||
if not isinstance(option_string, six.string_types):
|
||||
if not isinstance(option_string, (str, bytes)):
|
||||
raise ValueError(
|
||||
f"option_string must be a string not {type(option_string)}"
|
||||
)
|
||||
@@ -287,8 +286,7 @@ class OpensshCertificateOption:
|
||||
)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class OpensshCertificateInfo:
|
||||
class OpensshCertificateInfo(metaclass=abc.ABCMeta):
|
||||
"""Encapsulates all certificate information which is signed by a CA key"""
|
||||
|
||||
def __init__(
|
||||
|
||||
Reference in New Issue
Block a user