1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-04 08:22:08 +03:00

python compat: remove string_types

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>
This commit is contained in:
Douglas Bagnall
2020-07-04 13:47:44 +12:00
committed by Noel Power
parent 323073f4e0
commit 9cc65a552b
5 changed files with 8 additions and 13 deletions

View File

@ -29,7 +29,6 @@ import ldb
import samba.param
from samba import _glue
from samba._ldb import Ldb as _Ldb
from samba.compat import string_types
def source_tree_topdir():
@ -250,8 +249,8 @@ def substitute_var(text, values):
"""
for (name, value) in values.items():
assert isinstance(name, string_types), "%r is not a string" % name
assert isinstance(value, string_types), "Value %r for %s is not a string" % (value, name)
assert isinstance(name, str), "%r is not a string" % name
assert isinstance(value, str), "Value %r for %s is not a string" % (value, name)
text = text.replace("${%s}" % name, value)
return text

View File

@ -72,7 +72,6 @@ if PY3:
from functools import cmp_to_key as cmp_to_key_fn
# compat types
string_types = str
text_type = str
binary_type = bytes

View File

@ -21,7 +21,6 @@ from __future__ import print_function
import re
import base64
import uuid
from samba.compat import string_types
bitFields = {}
@ -178,7 +177,7 @@ def fix_dn(dn):
def __convert_bitfield(key, value):
"""Evaluate the OR expression in 'value'"""
assert(isinstance(value, string_types))
assert(isinstance(value, str))
value = value.replace("\n ", "")
value = value.replace(" ", "")
@ -201,7 +200,7 @@ def __write_ldif_one(entry):
out = []
for l in entry:
if isinstance(l[1], string_types):
if isinstance(l[1], str):
vl = [l[1]]
else:
vl = l[1]
@ -254,7 +253,7 @@ def __transform_entry(entry, objectClass):
l[1] = oMObjectClassBER[l[1].strip()]
l[2] = True
if isinstance(l[1], string_types):
if isinstance(l[1], str):
l[1] = fix_dn(l[1])
if key == 'dn':

View File

@ -27,7 +27,6 @@
__docformat__ = "restructuredText"
from urllib.parse import quote as urllib_quote
from samba.compat import string_types
from samba.compat import binary_type
from base64 import b64encode
import errno
@ -1606,7 +1605,7 @@ def fill_samdb(samdb, lp, names, logger, policyguid,
ntds_dn = "CN=NTDS Settings,%s" % names.serverdn
names.ntdsguid = samdb.searchone(basedn=ntds_dn,
attribute="objectGUID", expression="", scope=ldb.SCOPE_BASE).decode('utf8')
assert isinstance(names.ntdsguid, string_types)
assert isinstance(names.ntdsguid, str)
return samdb
@ -2014,7 +2013,7 @@ def provision_fill(samdb, secrets_ldb, logger, names, paths,
domainguid = samdb.searchone(basedn=samdb.get_default_basedn(),
attribute="objectGUID").decode('utf8')
assert isinstance(domainguid, string_types)
assert isinstance(domainguid, str)
lastProvisionUSNs = get_last_provision_usn(samdb)
maxUSN = get_max_usn(samdb, str(names.rootdn))

View File

@ -35,7 +35,6 @@ from enum import IntEnum, unique
import samba.auth
import samba.dcerpc.base
from samba.compat import text_type
from samba.compat import string_types
from random import randint
from random import SystemRandom
from contextlib import contextmanager
@ -92,7 +91,7 @@ class TestCase(unittest.TestCase):
def hexdump(self, src):
N = 0
result = ''
is_string = isinstance(src, string_types)
is_string = isinstance(src, str)
while src:
ll = src[:8]
lr = src[8:16]