mirror of
https://github.com/samba-team/samba.git
synced 2024-12-31 17:18:04 +03:00
python: use python3 style super statements
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
3db3251342
commit
c8ded4621d
@ -49,7 +49,7 @@ class DNSParseError(ValueError):
|
||||
class ARecord(dnsserver.DNS_RPC_RECORD):
|
||||
def __init__(self, ip_addr, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE,
|
||||
node_flag=0):
|
||||
super(ARecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_A
|
||||
self.dwFlags = rank | node_flag
|
||||
self.dwSerial = serial
|
||||
@ -65,7 +65,7 @@ class AAAARecord(dnsserver.DNS_RPC_RECORD):
|
||||
|
||||
def __init__(self, ip6_addr, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE,
|
||||
node_flag=0):
|
||||
super(AAAARecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_AAAA
|
||||
self.dwFlags = rank | node_flag
|
||||
self.dwSerial = serial
|
||||
@ -81,7 +81,7 @@ class PTRRecord(dnsserver.DNS_RPC_RECORD):
|
||||
|
||||
def __init__(self, ptr, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE,
|
||||
node_flag=0):
|
||||
super(PTRRecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_PTR
|
||||
self.dwFlags = rank | node_flag
|
||||
self.dwSerial = serial
|
||||
@ -119,7 +119,7 @@ class NSRecord(dnsserver.DNS_RPC_RECORD):
|
||||
|
||||
def __init__(self, dns_server, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE,
|
||||
node_flag=0):
|
||||
super(NSRecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_NS
|
||||
self.dwFlags = rank | node_flag
|
||||
self.dwSerial = serial
|
||||
@ -138,7 +138,7 @@ class MXRecord(dnsserver.DNS_RPC_RECORD):
|
||||
|
||||
def __init__(self, mail_server, preference, serial=1, ttl=900,
|
||||
rank=dnsp.DNS_RANK_ZONE, node_flag=0):
|
||||
super(MXRecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_MX
|
||||
self.dwFlags = rank | node_flag
|
||||
self.dwSerial = serial
|
||||
@ -165,7 +165,7 @@ class SOARecord(dnsserver.DNS_RPC_RECORD):
|
||||
def __init__(self, mname, rname, serial=1, refresh=900, retry=600,
|
||||
expire=86400, minimum=3600, ttl=3600, rank=dnsp.DNS_RANK_ZONE,
|
||||
node_flag=dnsp.DNS_RPC_FLAG_AUTH_ZONE_ROOT):
|
||||
super(SOARecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_SOA
|
||||
self.dwFlags = rank | node_flag
|
||||
self.dwSerial = serial
|
||||
@ -202,7 +202,7 @@ class SRVRecord(dnsserver.DNS_RPC_RECORD):
|
||||
|
||||
def __init__(self, target, port, priority=0, weight=100, serial=1, ttl=900,
|
||||
rank=dnsp.DNS_RANK_ZONE, node_flag=0):
|
||||
super(SRVRecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_SRV
|
||||
self.dwFlags = rank | node_flag
|
||||
self.dwSerial = serial
|
||||
@ -237,7 +237,7 @@ class TXTRecord(dnsserver.DNS_RPC_RECORD):
|
||||
|
||||
def __init__(self, slist, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE,
|
||||
node_flag=0):
|
||||
super(TXTRecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_TXT
|
||||
self.dwFlags = rank | node_flag
|
||||
self.dwSerial = serial
|
||||
|
@ -405,8 +405,7 @@ class drs_ReplicateRenamer(drs_Replicate):
|
||||
|
||||
def __init__(self, binding_string, lp, creds, samdb, invocation_id,
|
||||
old_base_dn, new_base_dn):
|
||||
super(drs_ReplicateRenamer, self).__init__(binding_string, lp, creds,
|
||||
samdb, invocation_id)
|
||||
super().__init__(binding_string, lp, creds, samdb, invocation_id)
|
||||
self.old_base_dn = old_base_dn
|
||||
self.new_base_dn = new_base_dn
|
||||
|
||||
@ -454,6 +453,4 @@ class drs_ReplicateRenamer(drs_Replicate):
|
||||
self.rename_top_level_object(ctr.first_object.object)
|
||||
|
||||
# then do the normal repl processing to apply this chunk to our DB
|
||||
super(drs_ReplicateRenamer, self).process_chunk(level, ctr, schema,
|
||||
req_level, req,
|
||||
first_chunk)
|
||||
super().process_chunk(level, ctr, schema, req_level, req, first_chunk)
|
||||
|
@ -109,7 +109,7 @@ class GPTIniParser(GPIniParser):
|
||||
|
||||
def parse(self, contents):
|
||||
try:
|
||||
super(GPTIniParser, self).parse(contents)
|
||||
super().parse(contents)
|
||||
except UnicodeDecodeError:
|
||||
# Required dict_type in Python 2.7
|
||||
self.ini_conf = ConfigParser(dict_type=collections.OrderedDict,
|
||||
@ -122,9 +122,8 @@ class GPTIniParser(GPIniParser):
|
||||
|
||||
class GPScriptsIniParser(GPIniParser):
|
||||
def build_xml_parameter(self, section_xml, section, key_ini, val_ini):
|
||||
parent_return = super(GPScriptsIniParser,
|
||||
self).build_xml_parameter(section_xml, section,
|
||||
key_ini, val_ini)
|
||||
parent_return = super().build_xml_parameter(section_xml, section,
|
||||
key_ini, val_ini)
|
||||
|
||||
cmdline = re.match('\\d+CmdLine$', key_ini)
|
||||
if cmdline is not None:
|
||||
@ -136,9 +135,8 @@ class GPScriptsIniParser(GPIniParser):
|
||||
|
||||
class GPFDeploy1IniParser(GPIniParser):
|
||||
def build_xml_parameter(self, section_xml, section, key_ini, val_ini):
|
||||
parent_return = super(GPFDeploy1IniParser,
|
||||
self).build_xml_parameter(section_xml, section,
|
||||
key_ini, val_ini)
|
||||
parent_return = super().build_xml_parameter(section_xml, section,
|
||||
key_ini, val_ini)
|
||||
# Add generalization metadata and parse out SID list
|
||||
if section.lower() == 'folder_redirection':
|
||||
# Process the header section
|
||||
@ -182,8 +180,7 @@ class GPFDeploy1IniParser(GPIniParser):
|
||||
return (key, value)
|
||||
|
||||
# Do the normal ini code for other sections
|
||||
return super(GPFDeploy1IniParser,
|
||||
self).load_xml_parameter(param_xml, section)
|
||||
return super().load_xml_parameter(param_xml, section)
|
||||
|
||||
def build_xml_section(self, root_xml, sec_ini):
|
||||
section = SubElement(root_xml, 'Section')
|
||||
|
@ -42,13 +42,13 @@ class IDmapDB(samba.Ldb):
|
||||
if url is None:
|
||||
url = lp.private_path("idmap.ldb")
|
||||
|
||||
super(IDmapDB, self).__init__(url=url, lp=lp, modules_dir=modules_dir,
|
||||
session_info=session_info, credentials=credentials, flags=flags,
|
||||
options=options)
|
||||
super().__init__(url=url, lp=lp, modules_dir=modules_dir,
|
||||
session_info=session_info, credentials=credentials, flags=flags,
|
||||
options=options)
|
||||
|
||||
def connect(self, url=None, flags=0, options=None):
|
||||
super(IDmapDB, self).connect(url=self.lp.private_path(url), flags=flags,
|
||||
options=options)
|
||||
super().connect(url=self.lp.private_path(url), flags=flags,
|
||||
options=options)
|
||||
|
||||
def increment_xid(self):
|
||||
"""Increment xidNumber, if not present it create and assign it to the lowerBound
|
||||
|
@ -54,7 +54,7 @@ from samba import dsdb, functional_level
|
||||
class DCJoinException(Exception):
|
||||
|
||||
def __init__(self, msg):
|
||||
super(DCJoinException, self).__init__("Can't join, error: %s" % msg)
|
||||
super().__init__("Can't join, error: %s" % msg)
|
||||
|
||||
|
||||
class DCJoinContext(object):
|
||||
@ -1651,11 +1651,11 @@ class DCCloneContext(DCJoinContext):
|
||||
targetdir=None, domain=None, dns_backend=None,
|
||||
include_secrets=False, backend_store=None,
|
||||
backend_store_size=None):
|
||||
super(DCCloneContext, ctx).__init__(logger, server, creds, lp,
|
||||
targetdir=targetdir, domain=domain,
|
||||
dns_backend=dns_backend,
|
||||
backend_store=backend_store,
|
||||
backend_store_size=backend_store_size)
|
||||
super().__init__(logger, server, creds, lp,
|
||||
targetdir=targetdir, domain=domain,
|
||||
dns_backend=dns_backend,
|
||||
backend_store=backend_store,
|
||||
backend_store_size=backend_store_size)
|
||||
|
||||
# As we don't want to create or delete these DNs, we set them to None
|
||||
ctx.server_dn = None
|
||||
@ -1706,12 +1706,12 @@ class DCCloneAndRenameContext(DCCloneContext):
|
||||
def __init__(ctx, new_base_dn, new_domain_name, new_realm, logger=None,
|
||||
server=None, creds=None, lp=None, targetdir=None, domain=None,
|
||||
dns_backend=None, include_secrets=True, backend_store=None):
|
||||
super(DCCloneAndRenameContext, ctx).__init__(logger, server, creds, lp,
|
||||
targetdir=targetdir,
|
||||
domain=domain,
|
||||
dns_backend=dns_backend,
|
||||
include_secrets=include_secrets,
|
||||
backend_store=backend_store)
|
||||
super().__init__(logger, server, creds, lp,
|
||||
targetdir=targetdir,
|
||||
domain=domain,
|
||||
dns_backend=dns_backend,
|
||||
include_secrets=include_secrets,
|
||||
backend_store=backend_store)
|
||||
# store the new DN (etc) that we want the cloned DB to use
|
||||
ctx.new_base_dn = new_base_dn
|
||||
ctx.new_domain_name = new_domain_name
|
||||
|
@ -34,7 +34,7 @@ class ColoredFormatter(logging.Formatter):
|
||||
"""Add color to log according to level"""
|
||||
|
||||
def format(self, record):
|
||||
log = super(ColoredFormatter, self).format(record)
|
||||
log = super().format(record)
|
||||
color = LEVEL_COLORS.get(record.levelno, GREY)
|
||||
return color + log + C_NORMAL
|
||||
|
||||
|
@ -1660,8 +1660,7 @@ class cmd_restore(cmd_create):
|
||||
|
||||
dtd_header += '\n]>\n'
|
||||
|
||||
super(cmd_restore, self).run(displayname, H, tmpdir, sambaopts,
|
||||
credopts, versionopts)
|
||||
super().run(displayname, H, tmpdir, sambaopts, credopts, versionopts)
|
||||
|
||||
try:
|
||||
if tmpdir is None:
|
||||
|
@ -178,7 +178,7 @@ if len(disabled_virtual_attributes) != 0:
|
||||
class GetPasswordCommand(Command):
|
||||
|
||||
def __init__(self):
|
||||
super(GetPasswordCommand, self).__init__()
|
||||
super().__init__()
|
||||
self.lp = None
|
||||
|
||||
def inject_virtual_attributes(self, samdb):
|
||||
|
@ -2511,14 +2511,14 @@ class InvalidNetbiosName(Exception):
|
||||
"""A specified name was not a valid NetBIOS name."""
|
||||
|
||||
def __init__(self, name):
|
||||
super(InvalidNetbiosName, self).__init__(
|
||||
super().__init__(
|
||||
"The name '%r' is not a valid NetBIOS name" % name)
|
||||
|
||||
|
||||
class MissingShareError(ProvisioningError):
|
||||
|
||||
def __init__(self, name, smbconf):
|
||||
super(MissingShareError, self).__init__(
|
||||
super().__init__(
|
||||
"Existing smb.conf does not have a [%s] share, but you are "
|
||||
"configuring a DC. Please remove %s or add the share manually." %
|
||||
(name, smbconf))
|
||||
|
@ -86,7 +86,7 @@ def get_dnsadmins_sid(samdb, domaindn):
|
||||
class ARecord(dnsp.DnssrvRpcRecord):
|
||||
|
||||
def __init__(self, ip_addr, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE):
|
||||
super(ARecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_A
|
||||
self.rank = rank
|
||||
self.dwSerial = serial
|
||||
@ -97,7 +97,7 @@ class ARecord(dnsp.DnssrvRpcRecord):
|
||||
class AAAARecord(dnsp.DnssrvRpcRecord):
|
||||
|
||||
def __init__(self, ip6_addr, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE):
|
||||
super(AAAARecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_AAAA
|
||||
self.rank = rank
|
||||
self.dwSerial = serial
|
||||
@ -119,7 +119,7 @@ class CNAMERecord(dnsp.DnssrvRpcRecord):
|
||||
class NSRecord(dnsp.DnssrvRpcRecord):
|
||||
|
||||
def __init__(self, dns_server, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE):
|
||||
super(NSRecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_NS
|
||||
self.rank = rank
|
||||
self.dwSerial = serial
|
||||
@ -131,7 +131,7 @@ class SOARecord(dnsp.DnssrvRpcRecord):
|
||||
|
||||
def __init__(self, mname, rname, serial=1, refresh=900, retry=600,
|
||||
expire=86400, minimum=3600, ttl=3600, rank=dnsp.DNS_RANK_ZONE):
|
||||
super(SOARecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_SOA
|
||||
self.rank = rank
|
||||
self.dwSerial = serial
|
||||
@ -151,7 +151,7 @@ class SRVRecord(dnsp.DnssrvRpcRecord):
|
||||
|
||||
def __init__(self, target, port, priority=0, weight=100, serial=1, ttl=900,
|
||||
rank=dnsp.DNS_RANK_ZONE):
|
||||
super(SRVRecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_SRV
|
||||
self.rank = rank
|
||||
self.dwSerial = serial
|
||||
@ -167,7 +167,7 @@ class SRVRecord(dnsp.DnssrvRpcRecord):
|
||||
class TXTRecord(dnsp.DnssrvRpcRecord):
|
||||
|
||||
def __init__(self, slist, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE):
|
||||
super(TXTRecord, self).__init__()
|
||||
super().__init__()
|
||||
self.wType = dnsp.DNS_TYPE_TXT
|
||||
self.rank = rank
|
||||
self.dwSerial = serial
|
||||
@ -181,7 +181,7 @@ class TXTRecord(dnsp.DnssrvRpcRecord):
|
||||
class TypeProperty(dnsp.DnsProperty):
|
||||
|
||||
def __init__(self, zone_type=dnsp.DNS_ZONE_TYPE_PRIMARY):
|
||||
super(TypeProperty, self).__init__()
|
||||
super().__init__()
|
||||
self.wDataLength = 1
|
||||
self.version = 1
|
||||
self.id = dnsp.DSPROPERTY_ZONE_TYPE
|
||||
@ -191,7 +191,7 @@ class TypeProperty(dnsp.DnsProperty):
|
||||
class AllowUpdateProperty(dnsp.DnsProperty):
|
||||
|
||||
def __init__(self, allow_update=dnsp.DNS_ZONE_UPDATE_SECURE):
|
||||
super(AllowUpdateProperty, self).__init__()
|
||||
super().__init__()
|
||||
self.wDataLength = 1
|
||||
self.version = 1
|
||||
self.id = dnsp.DSPROPERTY_ZONE_ALLOW_UPDATE
|
||||
@ -201,7 +201,7 @@ class AllowUpdateProperty(dnsp.DnsProperty):
|
||||
class SecureTimeProperty(dnsp.DnsProperty):
|
||||
|
||||
def __init__(self, secure_time=0):
|
||||
super(SecureTimeProperty, self).__init__()
|
||||
super().__init__()
|
||||
self.wDataLength = 1
|
||||
self.version = 1
|
||||
self.id = dnsp.DSPROPERTY_ZONE_SECURE_TIME
|
||||
@ -211,7 +211,7 @@ class SecureTimeProperty(dnsp.DnsProperty):
|
||||
class NorefreshIntervalProperty(dnsp.DnsProperty):
|
||||
|
||||
def __init__(self, norefresh_interval=0):
|
||||
super(NorefreshIntervalProperty, self).__init__()
|
||||
super().__init__()
|
||||
self.wDataLength = 1
|
||||
self.version = 1
|
||||
self.id = dnsp.DSPROPERTY_ZONE_NOREFRESH_INTERVAL
|
||||
@ -221,7 +221,7 @@ class NorefreshIntervalProperty(dnsp.DnsProperty):
|
||||
class RefreshIntervalProperty(dnsp.DnsProperty):
|
||||
|
||||
def __init__(self, refresh_interval=0):
|
||||
super(RefreshIntervalProperty, self).__init__()
|
||||
super().__init__()
|
||||
self.wDataLength = 1
|
||||
self.version = 1
|
||||
self.id = dnsp.DSPROPERTY_ZONE_REFRESH_INTERVAL
|
||||
@ -231,7 +231,7 @@ class RefreshIntervalProperty(dnsp.DnsProperty):
|
||||
class AgingStateProperty(dnsp.DnsProperty):
|
||||
|
||||
def __init__(self, aging_enabled=0):
|
||||
super(AgingStateProperty, self).__init__()
|
||||
super().__init__()
|
||||
self.wDataLength = 1
|
||||
self.version = 1
|
||||
self.id = dnsp.DSPROPERTY_ZONE_AGING_STATE
|
||||
@ -241,7 +241,7 @@ class AgingStateProperty(dnsp.DnsProperty):
|
||||
class AgingEnabledTimeProperty(dnsp.DnsProperty):
|
||||
|
||||
def __init__(self, next_cycle_hours=0):
|
||||
super(AgingEnabledTimeProperty, self).__init__()
|
||||
super().__init__()
|
||||
self.wDataLength = 1
|
||||
self.version = 1
|
||||
self.id = dnsp.DSPROPERTY_ZONE_AGING_ENABLED_TIME
|
||||
|
@ -87,9 +87,9 @@ class SamDB(samba.Ldb):
|
||||
|
||||
self.url = url
|
||||
|
||||
super(SamDB, self).__init__(url=url, lp=lp, modules_dir=modules_dir,
|
||||
session_info=session_info, credentials=credentials, flags=flags,
|
||||
options=options)
|
||||
super().__init__(url=url, lp=lp, modules_dir=modules_dir,
|
||||
session_info=session_info, credentials=credentials, flags=flags,
|
||||
options=options)
|
||||
|
||||
if global_schema:
|
||||
dsdb._dsdb_set_global_schema(self)
|
||||
@ -103,8 +103,7 @@ class SamDB(samba.Ldb):
|
||||
url = self.lp.private_path(url)
|
||||
self.url = url
|
||||
|
||||
super(SamDB, self).connect(url=url, flags=flags,
|
||||
options=options)
|
||||
super().connect(url=url, flags=flags, options=options)
|
||||
|
||||
def am_rodc(self):
|
||||
"""return True if we are an RODC"""
|
||||
@ -1357,7 +1356,7 @@ schemaUpdateNow: 1
|
||||
"""
|
||||
self.transaction_start()
|
||||
try:
|
||||
seq = super(SamDB, self).sequence_number(seq_type)
|
||||
seq = super().sequence_number(seq_type)
|
||||
except:
|
||||
self.transaction_cancel()
|
||||
raise
|
||||
|
@ -77,13 +77,13 @@ class TestProtocolClient(unittest.TestResult):
|
||||
|
||||
def startTest(self, test):
|
||||
"""Mark a test as starting its test run."""
|
||||
super(TestProtocolClient, self).startTest(test)
|
||||
super().startTest(test)
|
||||
self._stream.write("test: " + test.id() + "\n")
|
||||
self._stream.flush()
|
||||
|
||||
def stopTest(self, test):
|
||||
"""Mark a test as having finished its test run."""
|
||||
super(TestProtocolClient, self).stopTest(test)
|
||||
super().stopTest(test)
|
||||
self.writeOutcome(test)
|
||||
|
||||
def writeOutcome(self, test):
|
||||
@ -359,7 +359,7 @@ class HookedTestResultDecorator(TestResultDecorator):
|
||||
"""A TestResult which calls a hook on every event."""
|
||||
|
||||
def __init__(self, decorated):
|
||||
self.super = super(HookedTestResultDecorator, self)
|
||||
self.super = super()
|
||||
self.super.__init__(decorated)
|
||||
|
||||
def startTest(self, test):
|
||||
@ -430,7 +430,7 @@ class AutoTimingTestResultDecorator(HookedTestResultDecorator):
|
||||
|
||||
def __init__(self, decorated):
|
||||
self._time = None
|
||||
super(AutoTimingTestResultDecorator, self).__init__(decorated)
|
||||
super().__init__(decorated)
|
||||
|
||||
def _before_event(self):
|
||||
time = self._time
|
||||
|
Loading…
Reference in New Issue
Block a user