summaryrefslogtreecommitdiff
path: root/python/samba
diff options
context:
space:
mode:
authorJoe Guo <joeg@catalyst.net.nz>2018-07-30 18:16:43 +1200
committerDouglas Bagnall <dbagnall@samba.org>2018-08-24 07:49:27 +0200
commita9551edaeebdb2e8c209a843bae7088e60946e96 (patch)
treef27c3090e881ab00c9af974143d826a989d4d770 /python/samba
parent944d70435e4859a626b875c18535c1adb7c3e66f (diff)
downloadsamba-a9551edaeebdb2e8c209a843bae7088e60946e96.tar.gz
PEP8: fix E201: whitespace after '('
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'python/samba')
-rw-r--r--python/samba/dbchecker.py2
-rw-r--r--python/samba/gp_sec_ext.py4
-rw-r--r--python/samba/join.py12
-rw-r--r--python/samba/netcmd/computer.py2
-rw-r--r--python/samba/netcmd/dbcheck.py2
-rw-r--r--python/samba/netcmd/dns.py36
-rw-r--r--python/samba/netcmd/domain.py8
-rw-r--r--python/samba/netcmd/dsacl.py4
-rw-r--r--python/samba/netcmd/gpo.py22
-rw-r--r--python/samba/netcmd/group.py4
-rw-r--r--python/samba/netcmd/ldapcmp.py56
-rw-r--r--python/samba/netcmd/ou.py2
-rw-r--r--python/samba/netcmd/schema.py2
-rw-r--r--python/samba/netcmd/user.py2
-rw-r--r--python/samba/provision/__init__.py10
-rw-r--r--python/samba/provision/backend.py16
-rw-r--r--python/samba/remove_dc.py4
-rw-r--r--python/samba/tests/__init__.py2
-rw-r--r--python/samba/tests/blackbox/ndrdump.py2
-rw-r--r--python/samba/tests/s3idmapdb.py2
-rw-r--r--python/samba/tests/s3param.py2
-rw-r--r--python/samba/tests/s3passdb.py2
-rw-r--r--python/samba/tests/s3registry.py2
-rw-r--r--python/samba/tests/s3windb.py2
-rw-r--r--python/samba/tests/samba3sam.py2
-rw-r--r--python/samba/tests/samba_tool/user.py16
26 files changed, 110 insertions, 110 deletions
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py
index 73bcb254bfa..a6c9d17af70 100644
--- a/python/samba/dbchecker.py
+++ b/python/samba/dbchecker.py
@@ -2224,7 +2224,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
and not linkID):
set_attrs_seen.add(str(attrname).lower())
- if syntax_oid in [ dsdb.DSDB_SYNTAX_BINARY_DN, dsdb.DSDB_SYNTAX_OR_NAME,
+ if syntax_oid in [dsdb.DSDB_SYNTAX_BINARY_DN, dsdb.DSDB_SYNTAX_OR_NAME,
dsdb.DSDB_SYNTAX_STRING_DN, ldb.SYNTAX_DN ]:
# it's some form of DN, do specialised checking on those
error_count += self.check_dn(obj, attrname, syntax_oid)
diff --git a/python/samba/gp_sec_ext.py b/python/samba/gp_sec_ext.py
index f22a6ce30da..68e3a0081e5 100644
--- a/python/samba/gp_sec_ext.py
+++ b/python/samba/gp_sec_ext.py
@@ -37,7 +37,7 @@ class inf_to_kdc_tdb(gp_ext_setter):
self.gp_db.delete(str(self), self.attribute)
def mapper(self):
- return { 'kdc:user_ticket_lifetime': (self.set_kdc_tdb, self.explicit),
+ return {'kdc:user_ticket_lifetime': (self.set_kdc_tdb, self.explicit),
'kdc:service_ticket_lifetime': (self.set_kdc_tdb,
self.mins_to_hours),
'kdc:renewal_lifetime': (self.set_kdc_tdb,
@@ -93,7 +93,7 @@ class inf_to_ldb(gp_ext_setter):
def mapper(self):
'''ldap value : samba setter'''
- return { "minPwdAge" : (self.ch_minPwdAge, self.days2rel_nttime),
+ return {"minPwdAge" : (self.ch_minPwdAge, self.days2rel_nttime),
"maxPwdAge" : (self.ch_maxPwdAge, self.days2rel_nttime),
# Could be none, but I like the method assignment in
# update_samba
diff --git a/python/samba/join.py b/python/samba/join.py
index e4f03075f4d..f427275f39e 100644
--- a/python/samba/join.py
+++ b/python/samba/join.py
@@ -143,7 +143,7 @@ class DCJoinContext(object):
else:
ctx.topology_dn = None
- ctx.SPNs = [ "HOST/%s" % ctx.myname,
+ ctx.SPNs = ["HOST/%s" % ctx.myname,
"HOST/%s" % ctx.dnshostname,
"GC/%s/%s" % (ctx.dnshostname, ctx.dnsforest) ]
@@ -541,7 +541,7 @@ class DCJoinContext(object):
"systemFlags" : str(samba.dsdb.SYSTEM_FLAG_DISALLOW_MOVE_ON_DELETE),
"dMDLocation" : ctx.schema_dn}
- nc_list = [ ctx.base_dn, ctx.config_dn, ctx.schema_dn ]
+ nc_list = [ctx.base_dn, ctx.config_dn, ctx.schema_dn ]
if ctx.behavior_version >= samba.dsdb.DS_DOMAIN_FUNCTION_2003:
rec["msDS-Behavior-Version"] = str(samba.dsdb.DS_DOMAIN_FUNCTION_2008_R2)
@@ -1369,8 +1369,8 @@ class DCJoinContext(object):
# full_nc_list is the list of naming context (NC) we hold
# read/write copies of. These are not subsets of each other.
- ctx.nc_list = [ ctx.config_dn, ctx.schema_dn ]
- ctx.full_nc_list = [ ctx.base_dn, ctx.config_dn, ctx.schema_dn ]
+ ctx.nc_list = [ctx.config_dn, ctx.schema_dn ]
+ ctx.full_nc_list = [ctx.base_dn, ctx.config_dn, ctx.schema_dn ]
if ctx.subdomain and ctx.dns_backend != "NONE":
ctx.full_nc_list += [ctx.domaindns_zone]
@@ -1452,13 +1452,13 @@ def join_RODC(logger=None, server=None, creds=None, lp=None, site=None, netbios_
samba.dsdb.UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION |
samba.dsdb.UF_PARTIAL_SECRETS_ACCOUNT)
- ctx.SPNs.extend([ "RestrictedKrbHost/%s" % ctx.myname,
+ ctx.SPNs.extend(["RestrictedKrbHost/%s" % ctx.myname,
"RestrictedKrbHost/%s" % ctx.dnshostname ])
ctx.connection_dn = "CN=RODC Connection (FRS),%s" % ctx.ntds_dn
ctx.secure_channel_type = misc.SEC_CHAN_RODC
ctx.RODC = True
- ctx.replica_flags |= ( drsuapi.DRSUAPI_DRS_SPECIAL_SECRET_PROCESSING |
+ ctx.replica_flags |= (drsuapi.DRSUAPI_DRS_SPECIAL_SECRET_PROCESSING |
drsuapi.DRSUAPI_DRS_GET_ALL_GROUP_MEMBERSHIP)
ctx.domain_replica_flags = ctx.replica_flags
if domain_critical_only:
diff --git a/python/samba/netcmd/computer.py b/python/samba/netcmd/computer.py
index 39d29af6264..58ec053903a 100644
--- a/python/samba/netcmd/computer.py
+++ b/python/samba/netcmd/computer.py
@@ -531,7 +531,7 @@ class cmd_computer_move(Command):
type=str, metavar="URL", dest="H"),
]
- takes_args = [ "computername", "new_ou_dn" ]
+ takes_args = ["computername", "new_ou_dn" ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions,
diff --git a/python/samba/netcmd/dbcheck.py b/python/samba/netcmd/dbcheck.py
index 073510c1a26..6d4efaaa41a 100644
--- a/python/samba/netcmd/dbcheck.py
+++ b/python/samba/netcmd/dbcheck.py
@@ -108,7 +108,7 @@ class cmd_dbcheck(Command):
samdb_schema = SamDB(session_info=system_session(), url=None,
credentials=creds, lp=lp)
- scope_map = { "SUB": ldb.SCOPE_SUBTREE, "BASE": ldb.SCOPE_BASE, "ONE":ldb.SCOPE_ONELEVEL }
+ scope_map = {"SUB": ldb.SCOPE_SUBTREE, "BASE": ldb.SCOPE_BASE, "ONE":ldb.SCOPE_ONELEVEL }
scope = scope.upper()
if not scope in scope_map:
raise CommandError("Unknown scope %s" % scope)
diff --git a/python/samba/netcmd/dns.py b/python/samba/netcmd/dns.py
index 04a395cd34b..65e545b2cc1 100644
--- a/python/samba/netcmd/dns.py
+++ b/python/samba/netcmd/dns.py
@@ -85,50 +85,50 @@ def bitmap_string(module, bitmap_defs, value):
def boot_method_string(boot_method):
- enum_defs = [ 'DNS_BOOT_METHOD_UNINITIALIZED', 'DNS_BOOT_METHOD_FILE',
+ enum_defs = ['DNS_BOOT_METHOD_UNINITIALIZED', 'DNS_BOOT_METHOD_FILE',
'DNS_BOOT_METHOD_REGISTRY', 'DNS_BOOT_METHOD_DIRECTORY' ]
return enum_string(dnsserver, enum_defs, boot_method)
def name_check_flag_string(check_flag):
- enum_defs = [ 'DNS_ALLOW_RFC_NAMES_ONLY', 'DNS_ALLOW_NONRFC_NAMES',
+ enum_defs = ['DNS_ALLOW_RFC_NAMES_ONLY', 'DNS_ALLOW_NONRFC_NAMES',
'DNS_ALLOW_MULTIBYTE_NAMES', 'DNS_ALLOW_ALL_NAMES' ]
return enum_string(dnsserver, enum_defs, check_flag)
def zone_type_string(zone_type):
- enum_defs = [ 'DNS_ZONE_TYPE_CACHE', 'DNS_ZONE_TYPE_PRIMARY',
+ enum_defs = ['DNS_ZONE_TYPE_CACHE', 'DNS_ZONE_TYPE_PRIMARY',
'DNS_ZONE_TYPE_SECONDARY', 'DNS_ZONE_TYPE_STUB',
'DNS_ZONE_TYPE_FORWARDER', 'DNS_ZONE_TYPE_SECONDARY_CACHE' ]
return enum_string(dnsp, enum_defs, zone_type)
def zone_update_string(zone_update):
- enum_defs = [ 'DNS_ZONE_UPDATE_OFF', 'DNS_ZONE_UPDATE_UNSECURE',
+ enum_defs = ['DNS_ZONE_UPDATE_OFF', 'DNS_ZONE_UPDATE_UNSECURE',
'DNS_ZONE_UPDATE_SECURE' ]
return enum_string(dnsp, enum_defs, zone_update)
def zone_secondary_security_string(security):
- enum_defs = [ 'DNS_ZONE_SECSECURE_NO_SECURITY', 'DNS_ZONE_SECSECURE_NS_ONLY',
+ enum_defs = ['DNS_ZONE_SECSECURE_NO_SECURITY', 'DNS_ZONE_SECSECURE_NS_ONLY',
'DNS_ZONE_SECSECURE_LIST_ONLY', 'DNS_ZONE_SECSECURE_NO_XFER' ]
return enum_string(dnsserver, enum_defs, security)
def zone_notify_level_string(notify_level):
- enum_defs = [ 'DNS_ZONE_NOTIFY_OFF', 'DNS_ZONE_NOTIFY_ALL_SECONDARIES',
+ enum_defs = ['DNS_ZONE_NOTIFY_OFF', 'DNS_ZONE_NOTIFY_ALL_SECONDARIES',
'DNS_ZONE_NOTIFY_LIST_ONLY' ]
return enum_string(dnsserver, enum_defs, notify_level)
def dp_flags_string(dp_flags):
- bitmap_defs = [ 'DNS_DP_AUTOCREATED', 'DNS_DP_LEGACY', 'DNS_DP_DOMAIN_DEFAULT',
+ bitmap_defs = ['DNS_DP_AUTOCREATED', 'DNS_DP_LEGACY', 'DNS_DP_DOMAIN_DEFAULT',
'DNS_DP_FOREST_DEFAULT', 'DNS_DP_ENLISTED', 'DNS_DP_DELETED' ]
return bitmap_string(dnsserver, bitmap_defs, dp_flags)
def zone_flags_string(flags):
- bitmap_defs = [ 'DNS_RPC_ZONE_PAUSED', 'DNS_RPC_ZONE_SHUTDOWN',
+ bitmap_defs = ['DNS_RPC_ZONE_PAUSED', 'DNS_RPC_ZONE_SHUTDOWN',
'DNS_RPC_ZONE_REVERSE', 'DNS_RPC_ZONE_AUTOCREATED',
'DNS_RPC_ZONE_DSINTEGRATED', 'DNS_RPC_ZONE_AGING',
'DNS_RPC_ZONE_UPDATE_UNSECURE', 'DNS_RPC_ZONE_UPDATE_SECURE',
@@ -538,7 +538,7 @@ class cmd_serverinfo(Command):
synopsis = '%prog <server> [options]'
- takes_args = [ 'server' ]
+ takes_args = ['server' ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
@@ -570,7 +570,7 @@ class cmd_zoneinfo(Command):
synopsis = '%prog <server> <zone> [options]'
- takes_args = [ 'server', 'zone' ]
+ takes_args = ['server', 'zone' ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
@@ -602,7 +602,7 @@ class cmd_zonelist(Command):
synopsis = '%prog <server> [options]'
- takes_args = [ 'server' ]
+ takes_args = ['server' ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
@@ -681,7 +681,7 @@ class cmd_zonecreate(Command):
synopsis = '%prog <server> <zone> [options]'
- takes_args = [ 'server', 'zone' ]
+ takes_args = ['server', 'zone' ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
@@ -758,7 +758,7 @@ class cmd_zonedelete(Command):
synopsis = '%prog <server> <zone> [options]'
- takes_args = [ 'server', 'zone' ]
+ takes_args = ['server', 'zone' ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
@@ -792,7 +792,7 @@ class cmd_query(Command):
synopsis = '%prog <server> <zone> <name> <A|AAAA|CNAME|MX|NS|SOA|SRV|TXT|ALL> [options]'
- takes_args = [ 'server', 'zone', 'name', 'rtype' ]
+ takes_args = ['server', 'zone', 'name', 'rtype' ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
@@ -872,7 +872,7 @@ class cmd_roothints(Command):
synopsis = '%prog <server> [<name>] [options]'
- takes_args = [ 'server', 'name?' ]
+ takes_args = ['server', 'name?' ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
@@ -912,7 +912,7 @@ class cmd_add_record(Command):
synopsis = '%prog <server> <zone> <name> <A|AAAA|PTR|CNAME|NS|MX|SRV|TXT> <data>'
- takes_args = [ 'server', 'zone', 'name', 'rtype', 'data' ]
+ takes_args = ['server', 'zone', 'name', 'rtype', 'data' ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
@@ -964,7 +964,7 @@ class cmd_update_record(Command):
synopsis = '%prog <server> <zone> <name> <A|AAAA|PTR|CNAME|NS|MX|SOA|SRV|TXT> <olddata> <newdata>'
- takes_args = [ 'server', 'zone', 'name', 'rtype', 'olddata', 'newdata' ]
+ takes_args = ['server', 'zone', 'name', 'rtype', 'olddata', 'newdata' ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
@@ -1034,7 +1034,7 @@ class cmd_delete_record(Command):
synopsis = '%prog <server> <zone> <name> <A|AAAA|PTR|CNAME|NS|MX|SRV|TXT> <data>'
- takes_args = [ 'server', 'zone', 'name', 'rtype', 'data' ]
+ takes_args = ['server', 'zone', 'name', 'rtype', 'data' ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
diff --git a/python/samba/netcmd/domain.py b/python/samba/netcmd/domain.py
index 155a1e2f2e2..09dd1733dc7 100644
--- a/python/samba/netcmd/domain.py
+++ b/python/samba/netcmd/domain.py
@@ -2606,7 +2606,7 @@ class cmd_domain_trust_create(DomainTrustCommand):
try:
if remote_trust_info:
self.outf.write("Creating remote TDO.\n")
- current_request = { "location": "remote", "name": "CreateTrustedDomainEx2"}
+ current_request = {"location": "remote", "name": "CreateTrustedDomainEx2"}
remote_tdo_handle = \
remote_lsa.CreateTrustedDomainEx2(remote_policy,
remote_trust_info,
@@ -2615,13 +2615,13 @@ class cmd_domain_trust_create(DomainTrustCommand):
self.outf.write("Remote TDO created.\n")
if enc_types:
self.outf.write("Setting supported encryption types on remote TDO.\n")
- current_request = { "location": "remote", "name": "SetInformationTrustedDomain"}
+ current_request = {"location": "remote", "name": "SetInformationTrustedDomain"}
remote_lsa.SetInformationTrustedDomain(remote_tdo_handle,
lsa.LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES,
enc_types)
self.outf.write("Creating local TDO.\n")
- current_request = { "location": "local", "name": "CreateTrustedDomainEx2"}
+ current_request = {"location": "local", "name": "CreateTrustedDomainEx2"}
local_tdo_handle = local_lsa.CreateTrustedDomainEx2(local_policy,
local_trust_info,
local_auth_info,
@@ -2629,7 +2629,7 @@ class cmd_domain_trust_create(DomainTrustCommand):
self.outf.write("Local TDO created\n")
if enc_types:
self.outf.write("Setting supported encryption types on local TDO.\n")
- current_request = { "location": "local", "name": "SetInformationTrustedDomain"}
+ current_request = {"location": "local", "name": "SetInformationTrustedDomain"}
local_lsa.SetInformationTrustedDomain(local_tdo_handle,
lsa.LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES,
enc_types)
diff --git a/python/samba/netcmd/dsacl.py b/python/samba/netcmd/dsacl.py
index c044a7a49ef..bc9a6942b08 100644
--- a/python/samba/netcmd/dsacl.py
+++ b/python/samba/netcmd/dsacl.py
@@ -87,7 +87,7 @@ class cmd_dsacl_set(Command):
res = samdb.search(base=trusteedn, expression="(objectClass=*)",
scope=SCOPE_BASE)
assert(len(res) == 1)
- return ndr_unpack( security.dom_sid,res[0]["objectSid"][0])
+ return ndr_unpack(security.dom_sid,res[0]["objectSid"][0])
def modify_descriptor(self, samdb, object_dn, desc, controls=None):
assert(isinstance(desc, security.descriptor))
@@ -109,7 +109,7 @@ class cmd_dsacl_set(Command):
def get_domain_sid(self, samdb):
res = samdb.search(base=samdb.domain_dn(),
expression="(objectClass=*)", scope=SCOPE_BASE)
- return ndr_unpack( security.dom_sid,res[0]["objectSid"][0])
+ return ndr_unpack(security.dom_sid,res[0]["objectSid"][0])
def add_ace(self, samdb, object_dn, new_ace):
"""Add new ace explicitly."""
diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py
index 0f3fe6238af..d0777c4b5c3 100644
--- a/python/samba/netcmd/gpo.py
+++ b/python/samba/netcmd/gpo.py
@@ -108,7 +108,7 @@ def parse_gplink(gplink):
d = g.split(';')
if len(d) != 2 or not d[0].startswith("[LDAP://"):
raise RuntimeError("Badly formed gPLink '%s'" % g)
- ret.append({ 'dn' : d[0][8:], 'options' : int(d[1])})
+ ret.append({'dn' : d[0][8:], 'options' : int(d[1])})
return ret
@@ -308,8 +308,8 @@ attr_flags = smb.FILE_ATTRIBUTE_SYSTEM | \
def copy_directory_remote_to_local(conn, remotedir, localdir):
if not os.path.isdir(localdir):
os.mkdir(localdir)
- r_dirs = [ remotedir ]
- l_dirs = [ localdir ]
+ r_dirs = [remotedir ]
+ l_dirs = [localdir ]
while r_dirs:
r_dir = r_dirs.pop()
l_dir = l_dirs.pop()
@@ -333,8 +333,8 @@ def copy_directory_local_to_remote(conn, localdir, remotedir,
ignore_existing=False):
if not conn.chkpath(remotedir):
conn.mkdir(remotedir)
- l_dirs = [ localdir ]
- r_dirs = [ remotedir ]
+ l_dirs = [localdir ]
+ r_dirs = [remotedir ]
while l_dirs:
l_dir = l_dirs.pop()
r_dir = r_dirs.pop()
@@ -444,7 +444,7 @@ class cmd_list(Command):
except Exception:
raise CommandError("Failed to find objectClass for user %s" % username)
- session_info_flags = ( AUTH_SESSION_INFO_DEFAULT_GROUPS |
+ session_info_flags = (AUTH_SESSION_INFO_DEFAULT_GROUPS |
AUTH_SESSION_INFO_AUTHENTICATED )
# When connecting to a remote server, don't look up the local privilege DB
@@ -680,10 +680,10 @@ class cmd_setlink(Command):
if found:
raise CommandError("GPO '%s' already linked to this container" % gpo)
else:
- gplist.insert(0, { 'dn' : gpo_dn, 'options' : gplink_options })
+ gplist.insert(0, {'dn' : gpo_dn, 'options' : gplink_options })
else:
gplist = []
- gplist.append({ 'dn' : gpo_dn, 'options' : gplink_options })
+ gplist.append({'dn' : gpo_dn, 'options' : gplink_options })
gplink_str = encode_gplink(gplist)
@@ -834,7 +834,7 @@ class cmd_setinheritance(Command):
"credopts": options.CredentialsOptions,
}
- takes_args = [ 'container_dn', 'inherit_state' ]
+ takes_args = ['container_dn', 'inherit_state' ]
takes_options = [
Option("-H", help="LDB URL for database or target server", type=str)
@@ -1218,7 +1218,7 @@ class cmd_create(Command):
self.samdb.add(m)
# Get new security descriptor
- ds_sd_flags = ( security.SECINFO_OWNER |
+ ds_sd_flags = (security.SECINFO_OWNER |
security.SECINFO_GROUP |
security.SECINFO_DACL )
msg = get_gpo_info(self.samdb, gpo=gpo, sd_flags=ds_sd_flags)[0]
@@ -1234,7 +1234,7 @@ class cmd_create(Command):
create_directory_hier(conn, sharepath)
# Set ACL
- sio = ( security.SECINFO_OWNER |
+ sio = (security.SECINFO_OWNER |
security.SECINFO_GROUP |
security.SECINFO_DACL |
security.SECINFO_PROTECTED_DACL )
diff --git a/python/samba/netcmd/group.py b/python/samba/netcmd/group.py
index 0a6dc433b74..d876259700e 100644
--- a/python/samba/netcmd/group.py
+++ b/python/samba/netcmd/group.py
@@ -459,7 +459,7 @@ class cmd_group_move(Command):
type=str, metavar="URL", dest="H"),
]
- takes_args = [ "groupname", "new_parent_dn" ]
+ takes_args = ["groupname", "new_parent_dn" ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions,
@@ -564,7 +564,7 @@ Example3 shows how to display a users objectGUID and member attributes.
attrs = group_attrs.split(",")
filter = ("(&(sAMAccountType=%d)(sAMAccountName=%s))" %
- ( ATYPE_SECURITY_GLOBAL_GROUP,
+ (ATYPE_SECURITY_GLOBAL_GROUP,
ldb.binary_encode(groupname)))
domaindn = samdb.domain_dn()
diff --git a/python/samba/netcmd/ldapcmp.py b/python/samba/netcmd/ldapcmp.py
index d5a27d416be..e987dec1d4c 100644
--- a/python/samba/netcmd/ldapcmp.py
+++ b/python/samba/netcmd/ldapcmp.py
@@ -326,10 +326,10 @@ class Descriptor(object):
self_ace_fixed = "%s" % self.fix_sid(self_ace)
other_ace_fixed = "%s" % other.fix_sid(other_ace)
if self_ace_fixed != other_ace_fixed:
- res += "%60s * %s\n" % ( self_ace_fixed, other_ace_fixed )
+ res += "%60s * %s\n" % (self_ace_fixed, other_ace_fixed )
flag = False
else:
- res += "%60s | %s\n" % ( self_ace_fixed, other_ace_fixed )
+ res += "%60s | %s\n" % (self_ace_fixed, other_ace_fixed )
i += 1
return (flag, res)
@@ -345,8 +345,8 @@ class Descriptor(object):
other_aces = []
self_dacl_list_fixed = []
other_dacl_list_fixed = []
- [self_dacl_list_fixed.append( self.fix_sid(ace) ) for ace in self.dacl_list]
- [other_dacl_list_fixed.append( other.fix_sid(ace) ) for ace in other.dacl_list]
+ [self_dacl_list_fixed.append(self.fix_sid(ace) ) for ace in self.dacl_list]
+ [other_dacl_list_fixed.append(other.fix_sid(ace) ) for ace in other.dacl_list]
for ace in self_dacl_list_fixed:
try:
other_dacl_list_fixed.index(ace)
@@ -496,15 +496,15 @@ class LDAPObject(object):
self.domain_attributes = [x.upper() for x in self.domain_attributes]
#
# May contain DOMAIN_NETBIOS and SERVER_NAME
- self.servername_attributes = [ "distinguishedName", "name", "CN", "sAMAccountName", "dNSHostName",
+ self.servername_attributes = ["distinguishedName", "name", "CN", "sAMAccountName", "dNSHostName",
"servicePrincipalName", "rIDSetReferences", "serverReference", "serverReferenceBL",
"msDS-IsDomainFor", "interSiteTopologyGenerator",]
self.servername_attributes = [x.upper() for x in self.servername_attributes]
#
- self.netbios_attributes = [ "servicePrincipalName", "CN", "distinguishedName", "nETBIOSName", "name",]
+ self.netbios_attributes = ["servicePrincipalName", "CN", "distinguishedName", "nETBIOSName", "name",]
self.netbios_attributes = [x.upper() for x in self.netbios_attributes]
#
- self.other_attributes = [ "name", "DC",]
+ self.other_attributes = ["name", "DC",]
self.other_attributes = [x.upper() for x in self.other_attributes]
#
self.ignore_attributes = [x.upper() for x in self.ignore_attributes]
@@ -740,7 +740,7 @@ class LDAPBundel(object):
def __eq__(self, other):
res = True
if self.size != other.size:
- self.log( "\n* DN lists have different size: %s != %s" % (self.size, other.size) )
+ self.log("\n* DN lists have different size: %s != %s" % (self.size, other.size) )
if not self.skip_missing_dn:
res = False
#
@@ -752,10 +752,10 @@ class LDAPBundel(object):
for x in self.dn_list:
if not x.upper() in [q.upper() for q in other.dn_list]:
if title and not self.skip_missing_dn:
- self.log( title )
+ self.log(title )
title = None
res = False
- self.log( 4*" " + x )
+ self.log(4*" " + x )
self.dn_list[self.dn_list.index(x)] = ""
self.dn_list = [x for x in self.dn_list if x]
#
@@ -763,10 +763,10 @@ class LDAPBundel(object):
for x in other.dn_list:
if not x.upper() in [q.upper() for q in self.dn_list]:
if title and not self.skip_missing_dn:
- self.log( title )
+ self.log(title )
title = None
res = False
- self.log( 4*" " + x )
+ self.log(4*" " + x )
other.dn_list[other.dn_list.index(x)] = ""
other.dn_list = [x for x in other.dn_list if x]
#
@@ -774,7 +774,7 @@ class LDAPBundel(object):
other.update_size()
assert self.size == other.size
assert sorted([x.upper() for x in self.dn_list]) == sorted([x.upper() for x in other.dn_list])
- self.log( "\n* Objects to be compared: %s" % self.size )
+ self.log("\n* Objects to be compared: %s" % self.size )
index = 0
while index < self.size:
@@ -788,7 +788,7 @@ class LDAPBundel(object):
except LdbError as e:
(enum, estr) = e.args
if enum == ERR_NO_SUCH_OBJECT:
- self.log( "\n!!! Object not found: %s" % self.dn_list[index] )
+ self.log("\n!!! Object not found: %s" % self.dn_list[index] )
skip = True
raise
try:
@@ -800,7 +800,7 @@ class LDAPBundel(object):
except LdbError as e1:
(enum, estr) = e1.args
if enum == ERR_NO_SUCH_OBJECT:
- self.log( "\n!!! Object not found: %s" % other.dn_list[index] )
+ self.log("\n!!! Object not found: %s" % other.dn_list[index] )
skip = True
raise
if skip:
@@ -808,16 +808,16 @@ class LDAPBundel(object):
continue
if object1 == object2:
if self.con.verbose:
- self.log( "\nComparing:" )
- self.log( "'%s' [%s]" % (object1.dn, object1.con.host) )
- self.log( "'%s' [%s]" % (object2.dn, object2.con.host) )
- self.log( 4*" " + "OK" )
+ self.log("\nComparing:" )
+ self.log("'%s' [%s]" % (object1.dn, object1.con.host) )
+ self.log("'%s' [%s]" % (object2.dn, object2.con.host) )
+ self.log(4*" " + "OK" )
else:
- self.log( "\nComparing:" )
- self.log( "'%s' [%s]" % (object1.dn, object1.con.host) )
- self.log( "'%s' [%s]" % (object2.dn, object2.con.host) )
- self.log( object1.screen_output )
- self.log( 4*" " + "FAILED" )
+ self.log("\nComparing:" )
+ self.log("'%s' [%s]" % (object1.dn, object1.con.host) )
+ self.log("'%s' [%s]" % (object2.dn, object2.con.host) )
+ self.log(object1.screen_output )
+ self.log(4*" " + "FAILED" )
res = False
self.summary = object1.summary
other.summary = object2.summary
@@ -870,12 +870,12 @@ class LDAPBundel(object):
self.summary["df_value_attrs"] = list(set(self.summary["df_value_attrs"]))
#
if self.summary["unique_attrs"]:
- self.log( "\nAttributes found only in %s:" % self.con.host )
- self.log( "".join([str("\n" + 4*" " + x) for x in self.summary["unique_attrs"]]) )
+ self.log("\nAttributes found only in %s:" % self.con.host )
+ self.log("".join([str("\n" + 4*" " + x) for x in self.summary["unique_attrs"]]) )
#
if self.summary["df_value_attrs"]:
- self.log( "\nAttributes with different values:" )
- self.log( "".join([str("\n" + 4*" " + x) for x in self.summary["df_value_attrs"]]) )
+ self.log("\nAttributes with different values:" )
+ self.log("".join([str("\n" + 4*" " + x) for x in self.summary["df_value_attrs"]]) )
self.summary["df_value_attrs"] = []
diff --git a/python/samba/netcmd/ou.py b/python/samba/netcmd/ou.py
index c5fe6ce75d8..a34be62f479 100644
--- a/python/samba/netcmd/ou.py
+++ b/python/samba/netcmd/ou.py
@@ -233,7 +233,7 @@ class cmd_listobjects(Command):
action='store_true', help="List objects recursively."),
]
- takes_args = [ "ou_dn" ]
+ takes_args = ["ou_dn" ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions,
diff --git a/python/samba/netcmd/schema.py b/python/samba/netcmd/schema.py
index a82c6aee4ad..733d40c253b 100644
--- a/python/samba/netcmd/schema.py
+++ b/python/samba/netcmd/schema.py
@@ -99,7 +99,7 @@ class cmd_schema_attribute_modify(Command):
flags = searchflags.split(',')
# We have to normalise all the values. To achieve this predictably
# we title case (Fattrindex), then swapcase (fATTINDEX)
- flags = [ x.capitalize().swapcase() for x in flags ]
+ flags = [x.capitalize().swapcase() for x in flags ]
for flag in flags:
if flag not in bitFields['searchflags'].keys():
raise CommandError("Unknown flag '%s', please see --help" % flag)
diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py
index 49538c9cefc..94040217f4f 100644
--- a/python/samba/netcmd/user.py
+++ b/python/samba/netcmd/user.py
@@ -2544,7 +2544,7 @@ class cmd_user_move(Command):
type=str, metavar="URL", dest="H"),
]
- takes_args = [ "username", "new_parent_dn" ]
+ takes_args = ["username", "new_parent_dn" ]
takes_optiongroups = {
"sambaopts": options.SambaOptions,
"credopts": options.CredentialsOptions,
diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
index 542693bf719..fd7c9fd38e2 100644
--- a/python/samba/provision/__init__.py
+++ b/python/samba/provision/__init__.py
@@ -277,8 +277,8 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf,
scope=ldb.SCOPE_BASE, attrs=["objectGUID",
"objectSid","msDS-Behavior-Version" ])
names.domainguid = str(ndr_unpack(misc.GUID, res6[0]["objectGUID"][0]))
- names.domainsid = ndr_unpack( security.dom_sid, res6[0]["objectSid"][0])
- names.forestsid = ndr_unpack( security.dom_sid, res6[0]["objectSid"][0])
+ names.domainsid = ndr_unpack(security.dom_sid, res6[0]["objectSid"][0])
+ names.forestsid = ndr_unpack(security.dom_sid, res6[0]["objectSid"][0])
if res6[0].get("msDS-Behavior-Version") is None or \
int(res6[0]["msDS-Behavior-Version"][0]) < DS_DOMAIN_FUNCTION_2000:
names.domainlevel = DS_DOMAIN_FUNCTION_2000
@@ -978,11 +978,11 @@ def secretsdb_self_join(secretsdb, domain,
secretsdb.modify(msg)
secretsdb.rename(res[0].dn, msg.dn)
else:
- spn = [ 'HOST/%s' % shortname ]
+ spn = ['HOST/%s' % shortname ]
if secure_channel_type == SEC_CHAN_BDC and dnsname is not None:
# we are a domain controller then we add servicePrincipalName
# entries for the keytab code to update.
- spn.extend([ 'HOST/%s' % dnsname ])
+ spn.extend(['HOST/%s' % dnsname ])
msg["servicePrincipalName"] = spn
secretsdb.add(msg)
@@ -1973,7 +1973,7 @@ def provision_fill(samdb, secrets_ldb, logger, names, paths,
logger.info("Setting up sam.ldb rootDSE marking as synchronized")
setup_modify_ldif(samdb, setup_path("provision_rootdse_modify.ldif"),
- { 'NTDSGUID' : names.ntdsguid })
+ {'NTDSGUID' : names.ntdsguid })
# fix any dangling GUIDs from the provision
logger.info("Fixing provision GUIDs")
diff --git a/python/samba/provision/backend.py b/python/samba/provision/backend.py
index 8b72851c300..bb65834166c 100644
--- a/python/samba/provision/backend.py
+++ b/python/samba/provision/backend.py
@@ -317,7 +317,7 @@ class OpenLDAPBackend(LDAPBackend):
ldap_backend_extra_port=None, ldap_dryrun_mode=False,
ol_mmr_urls=None, nosync=False, ldap_backend_forced_uri=None):
from samba.provision import setup_path
- super(OpenLDAPBackend, self).__init__( backend_type=backend_type,
+ super(OpenLDAPBackend, self).__init__(backend_type=backend_type,
paths=paths, lp=lp,
names=names, logger=logger,
domainsid=domainsid, schema=schema, hostname=hostname,
@@ -528,7 +528,7 @@ class OpenLDAPBackend(LDAPBackend):
cn_samba = read_and_sub_file(
setup_path("cn=samba.ldif"),
- { "LDAPADMINPASS": self.ldapadminpass,
+ {"LDAPADMINPASS": self.ldapadminpass,
"MMR_PASSWORD": mmr_pass,
"MMR": mmr })
@@ -717,14 +717,14 @@ class FDSBackend(LDAPBackend):
if lnkattr[attr] is not None:
refint_config += read_and_sub_file(
setup_path("fedorads-refint-add.ldif"),
- { "ARG_NUMBER" : str(argnum),
- "LINK_ATTR" : attr })
+ {"ARG_NUMBER" : str(argnum),
+ "LINK_ATTR" : attr })
memberof_config += read_and_sub_file(
setup_path("fedorads-linked-attributes.ldif"),
- { "MEMBER_ATTR" : attr,
- "MEMBEROF_ATTR" : lnkattr[attr] })
+ {"MEMBER_ATTR" : attr,
+ "MEMBEROF_ATTR" : lnkattr[attr] })
index_config += read_and_sub_file(
- setup_path("fedorads-index.ldif"), { "ATTR" : attr })
+ setup_path("fedorads-index.ldif"), {"ATTR" : attr })
argnum += 1
f = open(self.refint_ldif, 'w')
@@ -751,7 +751,7 @@ class FDSBackend(LDAPBackend):
attr = "nsUniqueId"
index_config += read_and_sub_file(
- setup_path("fedorads-index.ldif"), { "ATTR" : attr })
+ setup_path("fedorads-index.ldif"), {"ATTR" : attr })
f = open(self.index_ldif, 'w')
try:
diff --git a/python/samba/remove_dc.py b/python/samba/remove_dc.py
index f9698cdfdc7..baf088010fd 100644
--- a/python/samba/remove_dc.py
+++ b/python/samba/remove_dc.py
@@ -156,7 +156,7 @@ def remove_dns_references(samdb, logger, dnsHostName, ignore_no_name=False):
raise DemoteException("lookup of %s failed: %s" % (a_name, estr))
orig_num_recs = len(a_recs)
- a_recs = [ r for r in a_recs if not a_rec_to_remove(r) ]
+ a_recs = [r for r in a_recs if not a_rec_to_remove(r) ]
if len(a_recs) != orig_num_recs:
logger.info("updating %s keeping %d values, removing %s values" % \
@@ -196,7 +196,7 @@ def remove_hanging_dns_references(samdb, logger, dnsHostNameUpper, zones):
continue
# Remove references to dnsHostName in A, AAAA, NS, CNAME and SRV
- values = [ ndr_unpack(dnsp.DnssrvRpcRecord, v)
+ values = [ndr_unpack(dnsp.DnssrvRpcRecord, v)
for v in orig_values if not to_remove(v) ]
if len(values) != len(orig_values):
diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py
index 603a7699420..a3caba6472c 100644
--- a/python/samba/tests/__init__.py
+++ b/python/samba/tests/__init__.py
@@ -499,5 +499,5 @@ def create_test_ou(samdb, name):
# testenv may still exist at the point that tests start on another testenv.
rand = randint(1, 10000000)
dn = ldb.Dn(samdb, "OU=%s%d,%s" %(name, rand, samdb.get_default_basedn()))
- samdb.add({ "dn": dn, "objectclass": "organizationalUnit"})
+ samdb.add({"dn": dn, "objectclass": "organizationalUnit"})
return dn
diff --git a/python/samba/tests/blackbox/ndrdump.py b/python/samba/tests/blackbox/ndrdump.py
index 86f958d63c3..350d576bc81 100644
--- a/python/samba/tests/blackbox/ndrdump.py
+++ b/python/samba/tests/blackbox/ndrdump.py
@@ -24,7 +24,7 @@ from __future__ import print_function
import os
from samba.tests import BlackboxTestCase
-for p in [ "../../../../../source4/librpc/tests", "../../../../../librpc/tests"]:
+for p in ["../../../../../source4/librpc/tests", "../../../../../librpc/tests"]:
data_path_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), p))
print(data_path_dir)
if os.path.exists(data_path_dir):
diff --git a/python/samba/tests/s3idmapdb.py b/python/samba/tests/s3idmapdb.py
index 651ef0faca1..9386a4c8111 100644
--- a/python/samba/tests/s3idmapdb.py
+++ b/python/samba/tests/s3idmapdb.py
@@ -22,7 +22,7 @@ from samba.tests import TestCase, TestCaseInTempDir
from samba.dcerpc.security import dom_sid
import os
-for p in [ "../../../../../testdata/samba3", "../../../../testdata/samba3" ]:
+for p in ["../../../../../testdata/samba3", "../../../../testdata/samba3" ]:
DATADIR = os.path.join(os.path.dirname(__file__), p)
if os.path.exists(DATADIR):
break
diff --git a/python/samba/tests/s3param.py b/python/samba/tests/s3param.py
index 5d06191d20b..77c9399ff0a 100644
--- a/python/samba/tests/s3param.py
+++ b/python/samba/tests/s3param.py
@@ -22,7 +22,7 @@ from samba.tests import TestCase, TestCaseInTempDir
import os
-for p in [ "../../../../../testdata/samba3", "../../../../testdata/samba3" ]:
+for p in ["../../../../../testdata/samba3", "../../../../testdata/samba3" ]:
DATADIR = os.path.join(os.path.dirname(__file__), p)
if os.path.exists(DATADIR):
break
diff --git a/python/samba/tests/s3passdb.py b/python/samba/tests/s3passdb.py
index fe2ab088081..04a0ae272e5 100644
--- a/python/samba/tests/s3passdb.py
+++ b/python/samba/tests/s3passdb.py
@@ -24,7 +24,7 @@ from samba.dcerpc.security import dom_sid
import os
-for p in [ "../../../../../testdata/samba3", "../../../../testdata/samba3" ]:
+for p in ["../../../../../testdata/samba3", "../../../../testdata/samba3" ]:
DATADIR = os.path.join(os.path.dirname(__file__), p)
if os.path.exists(DATADIR):
break
diff --git a/python/samba/tests/s3registry.py b/python/samba/tests/s3registry.py
index 87ef533ddca..e33b0495b4a 100644
--- a/python/samba/tests/s3registry.py
+++ b/python/samba/tests/s3registry.py
@@ -23,7 +23,7 @@ from samba.dcerpc.security import dom_sid
import os
-for p in [ "../../../../../testdata/samba3", "../../../../testdata/samba3" ]:
+for p in ["../../../../../testdata/samba3", "../../../../testdata/samba3" ]:
DATADIR = os.path.join(os.path.dirname(__file__), p)
if os.path.exists(DATADIR):
break
diff --git a/python/samba/tests/s3windb.py b/python/samba/tests/s3windb.py
index 6fc5b09bf76..bf2b90523b5 100644
--- a/python/samba/tests/s3windb.py
+++ b/python/samba/tests/s3windb.py
@@ -22,7 +22,7 @@ from samba.tests import TestCase, TestCaseInTempDir
import os
-for p in [ "../../../../../testdata/samba3", "../../../../testdata/samba3" ]:
+for p in ["../../../../../testdata/samba3", "../../../../testdata/samba3" ]:
DATADIR = os.path.join(os.path.dirname(__file__), p)
if os.path.exists(DATADIR):
break
diff --git a/python/samba/tests/samba3sam.py b/python/samba/tests/samba3sam.py
index f860031dc1b..f10fbd8fdda 100644
--- a/python/samba/tests/samba3sam.py
+++ b/python/samba/tests/samba3sam.py
@@ -33,7 +33,7 @@ from operator import attrgetter
def read_datafile(filename):
- paths = [ "../../../../../testdata/samba3",
+ paths = ["../../../../../testdata/samba3",
"../../../../testdata/samba3" ]
for p in paths:
datadir = os.path.join(os.path.dirname(__file__), p)
diff --git a/python/samba/tests/samba_tool/user.py b/python/samba/tests/samba_tool/user.py
index 08662ad9d1d..584d1a60e10 100644
--- a/python/samba/tests/samba_tool/user.py
+++ b/python/samba/tests/samba_tool/user.py
@@ -205,14 +205,14 @@ class UserCmdTestCase(SambaToolCmdTest):
self.assertCmdSuccess(result, out, err, "Ensure syncpasswords --cache-ldb-initialize runs")
self.assertEqual(err,"","getpassword without url")
cache_attrs = {
- "objectClass": { "value": "userSyncPasswords" },
- "samdbUrl": { },
- "dirsyncFilter": { },
- "dirsyncAttribute": { },
- "dirsyncControl": { "value": "dirsync:1:0:0"},
- "passwordAttribute": { },
- "decryptSambaGPG": { },
- "currentTime": { },
+ "objectClass": {"value": "userSyncPasswords" },
+ "samdbUrl": {},
+ "dirsyncFilter": {},
+ "dirsyncAttribute": {},
+ "dirsyncControl": {"value": "dirsync:1:0:0"},
+ "passwordAttribute": {},
+ "decryptSambaGPG": {},
+ "currentTime": {},
}
for a in cache_attrs.keys():
v = cache_attrs[a].get("value", "")