mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Py3: Replace six.string_types with str
In Python 3, six.string_types is just an alias for str. See: https://pagure.io/freeipa/issue/7715 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
@@ -28,8 +28,6 @@ import os
|
||||
import json
|
||||
import collections
|
||||
|
||||
import six
|
||||
|
||||
from ipapython import ipautil
|
||||
from ipatests.pytest_ipa.integration.config import Config, Domain
|
||||
from ipalib.constants import MAX_DOMAIN_LEVEL
|
||||
@@ -134,7 +132,7 @@ def config_from_env(env):
|
||||
kwargs['domains'] = []
|
||||
|
||||
# $IPv6SETUP needs to be 'TRUE' to enable ipv6
|
||||
if isinstance(kwargs['ipv6'], six.string_types):
|
||||
if isinstance(kwargs['ipv6'], str):
|
||||
kwargs['ipv6'] = (kwargs['ipv6'].upper() == 'TRUE')
|
||||
|
||||
config = Config(**kwargs)
|
||||
|
||||
@@ -66,11 +66,11 @@ class StageUserTracker(KerberosAliasMixin, Tracker):
|
||||
""" Check for non-empty unicode string for the required attributes
|
||||
in the init method """
|
||||
|
||||
if not (isinstance(givenname, six.string_types) and givenname):
|
||||
if not (isinstance(givenname, str) and givenname):
|
||||
raise ValueError(
|
||||
"Invalid first name provided: {!r}".format(givenname)
|
||||
)
|
||||
if not (isinstance(sn, six.string_types) and sn):
|
||||
if not (isinstance(sn, str) and sn):
|
||||
raise ValueError("Invalid second name provided: {!r}".format(sn))
|
||||
|
||||
super(StageUserTracker, self).__init__(default_version=None)
|
||||
|
||||
@@ -67,11 +67,11 @@ class UserTracker(CertmapdataMixin, KerberosAliasMixin, Tracker):
|
||||
""" Check for non-empty unicode string for the required attributes
|
||||
in the init method """
|
||||
|
||||
if not (isinstance(givenname, six.string_types) and givenname):
|
||||
if not (isinstance(givenname, str) and givenname):
|
||||
raise ValueError(
|
||||
"Invalid first name provided: {!r}".format(givenname)
|
||||
)
|
||||
if not (isinstance(sn, six.string_types) and sn):
|
||||
if not (isinstance(sn, str) and sn):
|
||||
raise ValueError("Invalid second name provided: {!r}".format(sn))
|
||||
|
||||
super(UserTracker, self).__init__(default_version=None)
|
||||
|
||||
@@ -43,7 +43,7 @@ else:
|
||||
# Matches a gidnumber like '1391016742'
|
||||
# FIXME: Does it make more sense to return gidnumber, uidnumber, etc. as `int`
|
||||
# or `long`? If not, we still need to return them as `unicode` instead of `str`.
|
||||
fuzzy_digits = Fuzzy(r'^\d+$', type=six.string_types)
|
||||
fuzzy_digits = Fuzzy(r'^\d+$', type=str)
|
||||
|
||||
uuid_re = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
|
||||
|
||||
@@ -109,18 +109,16 @@ fuzzy_caid = fuzzy_uuid
|
||||
fuzzy_ipauniqueid = Fuzzy('(?i)ipauniqueid=%s' % uuid_re)
|
||||
|
||||
# Matches a hash signature, not enforcing length
|
||||
fuzzy_hash = Fuzzy(
|
||||
r'^([a-f0-9][a-f0-9]:)+[a-f0-9][a-f0-9]$', type=six.string_types
|
||||
)
|
||||
fuzzy_hash = Fuzzy(r'^([a-f0-9][a-f0-9]:)+[a-f0-9][a-f0-9]$', type=str)
|
||||
|
||||
# Matches a date, like Tue Apr 26 17:45:35 2016 UTC
|
||||
fuzzy_date = Fuzzy(
|
||||
r'^[a-zA-Z]{3} [a-zA-Z]{3} \d{2} \d{2}:\d{2}:\d{2} \d{4} UTC$'
|
||||
)
|
||||
|
||||
fuzzy_issuer = Fuzzy(type=six.string_types)
|
||||
fuzzy_issuer = Fuzzy(type=str)
|
||||
|
||||
fuzzy_hex = Fuzzy(r'^0x[0-9a-fA-F]+$', type=six.string_types)
|
||||
fuzzy_hex = Fuzzy(r'^0x[0-9a-fA-F]+$', type=str)
|
||||
|
||||
# Matches password - password consists of all printable characters without
|
||||
# whitespaces. The only exception is space, but space cannot be at the
|
||||
@@ -131,7 +129,7 @@ fuzzy_password = Fuzzy(r'^\S([\S ]*\S)*$')
|
||||
fuzzy_dergeneralizedtime = Fuzzy(type=datetime.datetime)
|
||||
|
||||
# match any string
|
||||
fuzzy_string = Fuzzy(type=six.string_types)
|
||||
fuzzy_string = Fuzzy(type=str)
|
||||
|
||||
fuzzy_bytes = Fuzzy(type=bytes)
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ class Fuzzy:
|
||||
:param test: A callable used to perform equality test, e.g.
|
||||
``lambda other: other >= 18``
|
||||
"""
|
||||
assert regex is None or isinstance(regex, six.string_types)
|
||||
assert regex is None or isinstance(regex, str)
|
||||
assert test is None or callable(test)
|
||||
if regex is None:
|
||||
self.re = None
|
||||
@@ -286,7 +286,7 @@ class Fuzzy:
|
||||
self.re = re.compile(regex)
|
||||
if type is None:
|
||||
type = unicode
|
||||
assert type in (unicode, bytes, six.string_types)
|
||||
assert type in (unicode, bytes, str)
|
||||
self.regex = regex
|
||||
self.type = type
|
||||
self.test = test
|
||||
@@ -398,7 +398,7 @@ def assert_deepequal(expected, got, doc='', stack=tuple()):
|
||||
if isinstance(got, tuple):
|
||||
got = list(got)
|
||||
if isinstance(expected, DN):
|
||||
if isinstance(got, six.string_types):
|
||||
if isinstance(got, str):
|
||||
got = DN(got)
|
||||
if (
|
||||
not (isinstance(expected, Fuzzy)
|
||||
|
||||
Reference in New Issue
Block a user