Skip to content

Commit

Permalink
PEP8: fix E128: continuation line under-indented for visual indent
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Guo <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
Reviewed-by: Douglas Bagnall <[email protected]>
  • Loading branch information
catalyst-joe-guo authored and douglasbagnall committed Aug 24, 2018
1 parent bbb9f57 commit 5d53254
Show file tree
Hide file tree
Showing 117 changed files with 2,223 additions and 2,135 deletions.
2 changes: 1 addition & 1 deletion auth/credentials/tests/bind.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def test_user_account_bind_no_domain(self):
print("BindTest (no domain) with: " + self.username)
try:
ldb_user4 = samba.tests.connect_samdb(host, credentials=creds_user4,
lp=lp, ldap_only=True)
lp=lp, ldap_only=True)
except:
self.fail("Failed to connect without the domain set")

Expand Down
317 changes: 163 additions & 154 deletions lib/ldb-samba/tests/match_rules.py

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions lib/ldb/tests/python/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ def test_opaque(self):
def test_search_scope_base_empty_db(self):
l = ldb.Ldb(self.url(), flags=self.flags())
self.assertEqual(len(l.search(ldb.Dn(l, "dc=foo1"),
ldb.SCOPE_BASE)), 0)
ldb.SCOPE_BASE)), 0)

def test_search_scope_onelevel_empty_db(self):
l = ldb.Ldb(self.url(), flags=self.flags())
self.assertEqual(len(l.search(ldb.Dn(l, "dc=foo1"),
ldb.SCOPE_ONELEVEL)), 0)
ldb.SCOPE_ONELEVEL)), 0)

def test_delete(self):
l = ldb.Ldb(self.url(), flags=self.flags())
Expand Down Expand Up @@ -1873,7 +1873,7 @@ def test_unique(self):
# Now set this to unique index, but forget to check the result
try:
self.ldb.add({"dn": "@ATTRIBUTES",
"y": "UNIQUE_INDEX"})
"y": "UNIQUE_INDEX"})
self.fail()
except ldb.LdbError:
pass
Expand Down Expand Up @@ -1903,7 +1903,7 @@ def test_unique_transaction(self):
# Now set this to unique index, but forget to check the result
try:
self.ldb.add({"dn": "@ATTRIBUTES",
"y": "UNIQUE_INDEX"})
"y": "UNIQUE_INDEX"})
except ldb.LdbError:
pass

Expand Down Expand Up @@ -2767,7 +2767,7 @@ def test_search_against_trans(self):

# This should not turn up until the transaction is concluded
res11 = self.l.search(base="OU=OU11,DC=SAMBA,DC=ORG",
scope=ldb.SCOPE_BASE)
scope=ldb.SCOPE_BASE)
self.assertEqual(len(res11), 0)

os.write(w2, b"search")
Expand All @@ -2779,7 +2779,7 @@ def test_search_against_trans(self):

# This should now turn up, as the transaction is over
res11 = self.l.search(base="OU=OU11,DC=SAMBA,DC=ORG",
scope=ldb.SCOPE_BASE)
scope=ldb.SCOPE_BASE)
self.assertEqual(len(res11), 1)

self.assertFalse(found11)
Expand Down Expand Up @@ -2839,7 +2839,7 @@ def test_search_iter_against_trans(self):

# This should not turn up until the transaction is concluded
res11 = self.l.search(base="OU=OU11,DC=SAMBA,DC=ORG",
scope=ldb.SCOPE_BASE)
scope=ldb.SCOPE_BASE)
self.assertEqual(len(res11), 0)

os.write(w2, b"search")
Expand All @@ -2851,7 +2851,7 @@ def test_search_iter_against_trans(self):
# removed the read lock, but for ldb_tdb that happened as soon
# as we called the first res.next()
res11 = self.l.search(base="OU=OU11,DC=SAMBA,DC=ORG",
scope=ldb.SCOPE_BASE)
scope=ldb.SCOPE_BASE)
self.assertEqual(len(res11), 0)

# These results are all collected at the first next(res) call
Expand All @@ -2867,7 +2867,7 @@ def test_search_iter_against_trans(self):
# This should now turn up, as the transaction is over and all
# read locks are gone
res11 = self.l.search(base="OU=OU11,DC=SAMBA,DC=ORG",
scope=ldb.SCOPE_BASE)
scope=ldb.SCOPE_BASE)
self.assertEqual(len(res11), 1)

self.assertTrue(found)
Expand Down
10 changes: 5 additions & 5 deletions lib/ldb/tests/python/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,11 +1311,11 @@ def tearDown(self):
def test_try_subdb_index(self):
try:
self.l.add({"dn": "@INDEXLIST",
"@IDX_LMDB_SUBDB": [b"1"],
"@IDXONE": [b"1"],
"@IDXONE": [b"1"],
"@IDXGUID": [b"objectUUID"],
"@IDX_DN_GUID": [b"GUID"],
"@IDX_LMDB_SUBDB": [b"1"],
"@IDXONE": [b"1"],
"@IDXONE": [b"1"],
"@IDXGUID": [b"objectUUID"],
"@IDX_DN_GUID": [b"GUID"],
})
except ldb.LdbError as e:
code = e.args[0]
Expand Down
2 changes: 1 addition & 1 deletion python/examples/winreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
sambaopts = options.SambaOptions(parser)
parser.add_option_group(sambaopts)
parser.add_option("--createkey", type="string", metavar="KEYNAME",
help="create a key")
help="create a key")

opts, args = parser.parse_args()

Expand Down
18 changes: 9 additions & 9 deletions python/samba/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def erase_users_computers(self, dn):

try:
res = self.search(base=dn, scope=ldb.SCOPE_SUBTREE, attrs=[],
expression="(|(objectclass=user)(objectclass=computer))")
expression="(|(objectclass=user)(objectclass=computer))")
except ldb.LdbError as error:
(errno, estr) = error.args
if errno == ldb.ERR_NO_SUCH_OBJECT:
Expand Down Expand Up @@ -173,8 +173,8 @@ def erase_except_schema_controlled(self):
# Delete the 'visible' records, and the invisble 'deleted' records (if
# this DB supports it)
for msg in self.search(basedn, ldb.SCOPE_SUBTREE,
"(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
[], controls=["show_deleted:0", "show_recycled:0"]):
"(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
[], controls=["show_deleted:0", "show_recycled:0"]):
try:
self.delete(msg.dn, ["relax:0"])
except ldb.LdbError as error:
Expand All @@ -184,8 +184,8 @@ def erase_except_schema_controlled(self):
raise

res = self.search(basedn, ldb.SCOPE_SUBTREE,
"(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
[], controls=["show_deleted:0", "show_recycled:0"])
"(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))",
[], controls=["show_deleted:0", "show_recycled:0"])
assert len(res) == 0

# delete the specials
Expand Down Expand Up @@ -271,7 +271,7 @@ def check_all_substituted(text):
var_end = text.find("}", var_start)

raise Exception("Not all variables substituted: %s" %
text[var_start:var_end+1])
text[var_start:var_end+1])


def read_and_sub_file(file_name, subst_vars):
Expand Down Expand Up @@ -336,7 +336,7 @@ def import_bundled_package(modulename, location, source_tree_container,
"""
if in_source_tree():
extra_path = os.path.join(source_tree_topdir(), source_tree_container,
location)
location)
if not extra_path in sys.path:
sys.path.insert(0, extra_path)
sys.modules[modulename] = __import__(modulename)
Expand All @@ -356,8 +356,8 @@ def ensure_third_party_module(modulename, location):
__import__(modulename)
except ImportError:
import_bundled_package(modulename, location,
source_tree_container="third_party",
namespace="samba.third_party")
source_tree_container="third_party",
namespace="samba.third_party")


def dn_from_dns_name(dnsdomain):
Expand Down
22 changes: 11 additions & 11 deletions python/samba/dbchecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def __init__(self, samdb, samdb_schema=None, verbose=False, fix=False,
self.name_map = {}
try:
res = samdb.search(base="CN=DnsAdmins,CN=Users,%s" % samdb.domain_dn(), scope=ldb.SCOPE_BASE,
attrs=["objectSid"])
attrs=["objectSid"])
dnsadmins_sid = ndr_unpack(security.dom_sid, res[0]["objectSid"][0])
self.name_map['DnsAdmins'] = str(dnsadmins_sid)
except ldb.LdbError as e5:
Expand Down Expand Up @@ -195,7 +195,7 @@ def __init__(self, samdb, samdb_schema=None, verbose=False, fix=False,
res = self.samdb.search(scope=ldb.SCOPE_BASE,
base="@SAMBA_DSDB",
attrs=["compatibleFeatures",
"requiredFeatures"])
"requiredFeatures"])
if "compatibleFeatures" in res[0]:
self.compatibleFeatures = res[0]["compatibleFeatures"]
if "requiredFeatures" in res[0]:
Expand Down Expand Up @@ -463,7 +463,7 @@ def err_normalise_mismatch(self, dn, attrname, values):
m['value_%u' % i] = ldb.MessageElement(val, ldb.FLAG_MOD_DELETE, attrname)
if nval != '':
m['normv_%u' % i] = ldb.MessageElement(nval, ldb.FLAG_MOD_ADD,
attrname)
attrname)

if self.do_modify(m, ["relax:0", "show_recycled:1"],
"Failed to normalise attribute %s" % attrname,
Expand Down Expand Up @@ -767,7 +767,7 @@ def err_recover_forward_links(self, obj, forward_attr, forward_vals):
m.dn = obj.dn
m['value'] = ldb.MessageElement(forward_vals, ldb.FLAG_MOD_REPLACE, forward_attr)
if self.do_modify(m, ["local_oid:%s:1" % dsdb.DSDB_CONTROL_DBCHECK_FIX_DUPLICATE_LINKS],
"Failed to fix duplicate links in attribute '%s'" % forward_attr):
"Failed to fix duplicate links in attribute '%s'" % forward_attr):
self.report("Fixed duplicate links in attribute '%s'" % (forward_attr))
duplicate_cache_key = "%s:%s" % (str(obj.dn), forward_attr)
assert duplicate_cache_key in self.duplicate_link_cache
Expand Down Expand Up @@ -1142,9 +1142,9 @@ def check_dn(self, obj, attrname, syntax_oid):

missing_forward_links, missing_error_count = \
self.find_missing_forward_links_from_backlinks(obj,
attrname, syntax_oid,
reverse_link_name,
unique_dict)
attrname, syntax_oid,
reverse_link_name,
unique_dict)
error_count += missing_error_count

forward_links = [dn for dn in unique_dict.values()]
Expand Down Expand Up @@ -1186,7 +1186,7 @@ def check_dn(self, obj, attrname, syntax_oid):
if guid is None:
error_count += 1
self.err_missing_dn_GUID_component(obj.dn, attrname, val, dsdb_dn,
"missing GUID")
"missing GUID")
continue

guidstr = str(misc.GUID(guid))
Expand Down Expand Up @@ -1839,9 +1839,9 @@ def err_replmetadata_incorrect_attid(self, dn, attr, repl_meta_data, wrong_attid
nmsg.dn = dn
nmsg[attr] = ldb.MessageElement(replBlob, ldb.FLAG_MOD_REPLACE, attr)
if self.do_modify(nmsg, ["local_oid:%s:0" % dsdb.DSDB_CONTROL_DBCHECK_MODIFY_RO_REPLICA,
"local_oid:1.3.6.1.4.1.7165.4.3.14:0",
"local_oid:1.3.6.1.4.1.7165.4.3.25:0"],
"Failed to fix attribute %s" % attr):
"local_oid:1.3.6.1.4.1.7165.4.3.14:0",
"local_oid:1.3.6.1.4.1.7165.4.3.25:0"],
"Failed to fix attribute %s" % attr):
self.report("Fixed attribute '%s' of '%s'\n" % (attr, dn))


Expand Down
4 changes: 2 additions & 2 deletions python/samba/dnsserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def __init__(self, mname, rname, serial=1, refresh=900, retry=600,
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):
rank=dnsp.DNS_RANK_ZONE, node_flag=0):
super(SRVRecord, self).__init__()
self.wType = dnsp.DNS_TYPE_SRV
self.dwFlags = rank | node_flag
Expand All @@ -160,7 +160,7 @@ def __init__(self, target, port, priority=0, weight=100, serial=1, ttl=900,
class TXTRecord(dnsserver.DNS_RPC_RECORD):

def __init__(self, slist, serial=1, ttl=900, rank=dnsp.DNS_RANK_ZONE,
node_flag=0):
node_flag=0):
super(TXTRecord, self).__init__()
self.wType = dnsp.DNS_TYPE_TXT
self.dwFlags = rank | node_flag
Expand Down
2 changes: 1 addition & 1 deletion python/samba/drs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def drsuapi_connect(server, lp, creds):


def sendDsReplicaSync(drsuapiBind, drsuapi_handle, source_dsa_guid,
naming_context, req_option):
naming_context, req_option):
"""Send DS replica sync request.
:param drsuapiBind: a drsuapi Bind object
Expand Down
38 changes: 19 additions & 19 deletions python/samba/getopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ class VersionOptions(optparse.OptionGroup):
def __init__(self, parser):
optparse.OptionGroup.__init__(self, parser, "Version Options")
self.add_option("-V", "--version", action="callback",
callback=self._display_version,
help="Display version number")
callback=self._display_version,
help="Display version number")

def _display_version(self, option, opt_str, arg, parser):
import samba
Expand Down Expand Up @@ -136,30 +136,30 @@ def __init__(self, parser, special_name=None):
self.machine_pass = False
optparse.OptionGroup.__init__(self, parser, self.section)
self._add_option("--simple-bind-dn", metavar="DN", action="callback",
callback=self._set_simple_bind_dn, type=str,
help="DN to use for a simple bind")
callback=self._set_simple_bind_dn, type=str,
help="DN to use for a simple bind")
self._add_option("--password", metavar="PASSWORD", action="callback",
help="Password", type=str, callback=self._set_password)
help="Password", type=str, callback=self._set_password)
self._add_option("-U", "--username", metavar="USERNAME",
action="callback", type=str,
help="Username", callback=self._parse_username)
action="callback", type=str,
help="Username", callback=self._parse_username)
self._add_option("-W", "--workgroup", metavar="WORKGROUP",
action="callback", type=str,
help="Workgroup", callback=self._parse_workgroup)
action="callback", type=str,
help="Workgroup", callback=self._parse_workgroup)
self._add_option("-N", "--no-pass", action="callback",
help="Don't ask for a password",
callback=self._set_no_password)
help="Don't ask for a password",
callback=self._set_no_password)
self._add_option("-k", "--kerberos", metavar="KERBEROS",
action="callback", type=str,
help="Use Kerberos", callback=self._set_kerberos)
action="callback", type=str,
help="Use Kerberos", callback=self._set_kerberos)
self._add_option("", "--ipaddress", metavar="IPADDRESS",
action="callback", type=str,
help="IP address of server",
callback=self._set_ipaddress)
action="callback", type=str,
help="IP address of server",
callback=self._set_ipaddress)
self._add_option("-P", "--machine-pass",
action="callback",
help="Use stored machine account password",
callback=self._set_machine_pass)
action="callback",
help="Use stored machine account password",
callback=self._set_machine_pass)
self._add_option("--krb5-ccache", metavar="KRB5CCNAME",
action="callback", type=str,
help="Kerberos Credentials cache",
Expand Down
2 changes: 1 addition & 1 deletion python/samba/gp_sec_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __str__(self):

def list(self, rootpath):
return os.path.join(rootpath,
"MACHINE/Microsoft/Windows NT/SecEdit/GptTmpl.inf")
"MACHINE/Microsoft/Windows NT/SecEdit/GptTmpl.inf")

def listmachpol(self, rootpath):
return os.path.join(rootpath, "Machine/Registry.pol")
Expand Down
6 changes: 3 additions & 3 deletions python/samba/gpclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def __str__(self):
def get_dc_hostname(creds, lp):
net = Net(creds=creds, lp=lp)
cldap_ret = net.finddc(domain=lp.get('realm'), flags=(nbt.NBT_SERVER_LDAP |
nbt.NBT_SERVER_DS))
nbt.NBT_SERVER_DS))
return cldap_ret.pdc_dns_name

''' Fetch a list of GUIDs for applicable GPOs '''
Expand Down Expand Up @@ -464,7 +464,7 @@ def apply_gp(lp, creds, test_ldb, logger, store, gp_extensions):
check_refresh_gpo_list(dc_hostname, lp, creds, gpos)
except:
logger.error('Failed downloading gpt cache from \'%s\' using SMB' \
% dc_hostname)
% dc_hostname)
return

for gpo_obj in gpos:
Expand All @@ -485,7 +485,7 @@ def apply_gp(lp, creds, test_ldb, logger, store, gp_extensions):
ext.parse(ext.list(path), test_ldb, gp_db, lp)
except Exception as e:
logger.error('Failed to parse gpo %s for extension %s' % \
(guid, str(ext)))
(guid, str(ext)))
logger.error('Message was: ' + str(e))
store.cancel()
continue
Expand Down
4 changes: 2 additions & 2 deletions python/samba/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ def shorten_vertex_names(vertices, suffix=',...', aggressive=False):
break
else:
vmap = dict((k, v.replace(',CN=Servers,', ',**,', 1))
for k, v in vmap.items())
for k, v in vmap.items())
replacements.append(('**', 'CN=Servers'))

for v in vmap.values():
if not v.startswith('CN=NTDS Settings,'):
break
else:
vmap = dict((k, v.replace('CN=NTDS Settings,', '*,', 1))
for k, v in vmap.items())
for k, v in vmap.items())
replacements.append(('*', 'CN=NTDS Settings'))

return vmap, replacements
Expand Down
6 changes: 3 additions & 3 deletions python/samba/idmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ def __init__(self, url=None, lp=None, modules_dir=None, session_info=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)
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)
options=options)

def increment_xid(self):
"""Increment xidNumber, if not present it create and assign it to the lowerBound
Expand Down
Loading

0 comments on commit 5d53254

Please sign in to comment.