1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-23 06:50:21 +03:00

PEP8: fix E305: expected 2 blank lines after class or function definition, found 1

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>
This commit is contained in:
Joe Guo 2018-07-30 18:21:29 +12:00 committed by Douglas Bagnall
parent fd6b2086cb
commit 115f2a71b8
56 changed files with 71 additions and 0 deletions

View File

@ -165,4 +165,5 @@ unicodePwd:: """ + base64.b64encode(u"\"P@ssw0rd\"".encode('utf-16-le')).decode(
res = ldb_user4.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"])
TestProgram(module=__name__, opts=subunitopts)

View File

@ -1752,6 +1752,7 @@ class MatchRuleConditionTests(samba.tests.TestCase):
self.ou_groups, self.ou_computers))
self.assertEqual(len(res1), 0)
parser = optparse.OptionParser("match_rules.py [options] <host>")
sambaopts = options.SambaOptions(parser)
parser.add_option_group(sambaopts)

View File

@ -92,6 +92,7 @@ class MessageElementTextWrapper(_WrapBase):
def set_flags(self):
return self._wrapped.set_flags
_wrap_element = MessageElementTextWrapper._wrap

View File

@ -1324,6 +1324,7 @@ class RejectSubDBIndex(LdbBaseTest):
self.assertEqual(ldb.ERR_OPERATIONS_ERROR, code)
self.assertIn("sub-database index", string)
if __name__ == '__main__':
import unittest
unittest.TestProgram()

View File

@ -109,5 +109,6 @@ class ContextTests(TestCase):
self.ctx.loop_once()
self.assertEqual(collecting_list, [1, 2])
if __name__ == '__main__':
TestProgram()

View File

@ -106,6 +106,7 @@ def test_EnumDomains(samr, handle):
test_domain_ops(samr, dom_handle)
samr.Close(dom_handle)
if len(sys.argv) != 2:
print "Usage: samr.js <BINDING>"
sys.exit(1)

View File

@ -69,6 +69,7 @@ def list_path(key, path):
list_values(subkey)
return count
if len(args) > 1:
root = args[1]
else:

View File

@ -304,6 +304,7 @@ def setup_file(template, fname, subst_vars=None):
finally:
f.close()
MAX_NETBIOS_NAME_LEN = 15
@ -384,6 +385,7 @@ def arcfour_encrypt(key, data):
from samba.crypto import arcfour_crypt_blob
return arcfour_crypt_blob(data, key)
version = _glue.version
interface_ips = _glue.interface_ips
fault_setup = _glue.fault_setup

View File

@ -402,6 +402,7 @@ class gp_inf_ext(gp_ext):
def __str__(self):
pass
''' Fetch the hostname of a writable DC '''
@ -411,6 +412,7 @@ def get_dc_hostname(creds, lp):
nbt.NBT_SERVER_DS))
return cldap_ret.pdc_dns_name
''' Fetch a list of GUIDs for applicable GPOs '''

View File

@ -43,6 +43,7 @@ from samba.colour import GREY, WHITE
def _color_debug(*args, **kwargs):
DEBUG('%s%s%s' % (kwargs['color'], args[0], C_NORMAL), *args[1:])
_globals = globals()
for _color in ('DARK_RED', 'RED', 'DARK_GREEN', 'GREEN', 'YELLOW',
'DARK_YELLOW', 'DARK_BLUE', 'BLUE', 'PURPLE', 'MAGENTA',

View File

@ -41,6 +41,7 @@ class KCCError(Exception):
class NCType(object):
(unknown, schema, domain, config, application) = range(0, 5)
# map the NCType enum to strings for debugging
nctype_lut = dict((v, k) for k, v in NCType.__dict__.items() if k[:2] != '__')

View File

@ -54,6 +54,7 @@ def __read_folded_line(f, buffer):
return (line, buffer)
# Only compile regexp once.
# Will not match options after the attribute type.
attr_type_re = re.compile("^([A-Za-z][A-Za-z0-9-]*):")
@ -181,6 +182,7 @@ def read_ms_ldif(filename):
return "\n\n".join(out) + "\n\n"
if __name__ == '__main__':
import sys

View File

@ -259,6 +259,7 @@ def read_ms_markdown(in_file, out_folder=None, out_dict={}):
# print ET.tostring(node, method='text')
if __name__ == '__main__':
import sys

View File

@ -315,6 +315,7 @@ def read_ms_schema(attr_file, classes_file, dump_attributes=True, dump_classes=T
return attr_ldif + "\n\n" + classes_ldif + "\n\n"
if __name__ == '__main__':
import sys

View File

@ -58,6 +58,7 @@ def read_ms_markdown(in_file, out_folder):
if ldf is not None:
ldf.close()
if __name__ == '__main__':
import sys

View File

@ -156,6 +156,7 @@ def get_testparm_var(testparm, smbconf, varname):
return lines[0].strip()
return ""
try:
import samba.dckeytab
except ImportError:

View File

@ -158,6 +158,7 @@ def get_rounds(options):
return 0
return 0
try:
random_reason = check_random()
if random_reason is not None:

View File

@ -4980,6 +4980,7 @@ class TestDCERPC_BIND(RawDCERPCTest):
conn2.do_single_request(call_id=1, ctx=ctx2, io=inq_if_ids)
return
if __name__ == "__main__":
global_ndr_print = True
global_hexdump = True

View File

@ -134,6 +134,7 @@ class RpcTests(object):
self.check_all_interfaces()
return self.errcount
tests = RpcTests()
errcount = tests.run()
if errcount == 0:

View File

@ -1909,4 +1909,5 @@ class TestRPCRoundtrip(DNSTest):
None,
add_rec_buf)
TestProgram(module=__name__, opts=subunitopts)

View File

@ -603,4 +603,5 @@ class TestDnsForwarding(DNSTest):
except socket.timeout:
self.fail("DNS server is too slow (timeout %s)" % timeout)
TestProgram(module=__name__, opts=subunitopts)

View File

@ -36,6 +36,7 @@ def debug(msg):
print("\033[00;36m%s\033[00m" % msg)
sys.stdout.flush()
timeout = 0
@ -93,4 +94,5 @@ def main():
server = SocketServer.UDPServer((host, int(port)), DnsHandler)
server.serve_forever()
main()

View File

@ -211,4 +211,5 @@ class TestDNSUpdates(DNSTKeyTest):
rcode = self.search_record(self.newrecname)
self.assert_rcode_equals(rcode, dns.DNS_RCODE_NXDOMAIN)
TestProgram(module=__name__, opts=subunitopts)

View File

@ -75,6 +75,7 @@ class LibsmbTestCase(samba.tests.TestCase):
if t.exc:
raise t.exc[0](t.exc[1])
if __name__ == "__main__":
import unittest
unittest.main()

View File

@ -403,6 +403,7 @@ class SambaToolVisualizeLdif(SambaToolCmdTest):
self.remove_files(dbfile, dot_file)
EXPECTED_DOT_MULTISITE_NO_KEY = r"""/* generated by samba */
digraph A_samba_tool_production {
label="NTDS Connections known to CN=WIN01,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=ad,DC=samba,DC=example,DC=com";

View File

@ -40,6 +40,7 @@ import ldb
def dummymessage(a=None, b=None):
pass
smb_conf_path = "%s/%s/%s" % (os.environ["SELFTEST_PREFIX"], "ad_dc_ntvfs", "etc/smb.conf")

View File

@ -685,6 +685,7 @@ def push_to(push_url, push_branch="master"):
(push_remote, push_branch),
show=True, dir=test_master)
def_testbase = os.getenv("AUTOBUILD_TESTBASE", "/memdisk/%s" % os.getenv('USER'))
gitroot = find_git_root()

View File

@ -51,6 +51,7 @@ def find_git_root():
p = os.path.abspath(os.path.join(p, '..'))
return None
cwd = os.getcwd()
gitroot = find_git_root()
@ -79,6 +80,7 @@ def cleanup():
os.unlink(f.name)
sys.exit(-1)
# run bisect
ret = -1
try:

View File

@ -101,6 +101,7 @@ def iterate_all(path):
'deprecated' : deprecated,
'synonyms' : synonyms }
# map doc attributes to a section of the generated function
context_dict = {"G": "_GLOBAL", "S": "_LOCAL"}
param_type_dict = {
@ -148,6 +149,7 @@ def generate_functions(path_in, path_out):
finally:
f.close()
mapping = {
'boolean' : 'bool ',
'string' : 'char *',
@ -313,6 +315,7 @@ def make_param_defs(path_in, path_out, scope):
finally:
file_out.close()
type_dict = {
"boolean" : "P_BOOL",
"boolean-rev" : "P_BOOLREV",
@ -400,6 +403,7 @@ def make_param_table(path_in, path_out):
finally:
file_out.close()
if options.mode == 'FUNCTIONS':
generate_functions(options.filename, options.output)
elif options.mode == 'S3PROTO':

View File

@ -43,6 +43,7 @@ def bindir():
def binpath(name):
return os.path.join(bindir(), name)
# Split perl variable to allow $PERL to be set to e.g. "perl -W"
perl = os.getenv("PERL", "perl").split()

View File

@ -28,6 +28,7 @@ def fill_cache(inids, idtype='gid'):
subprocess.Popen([wbinfo, '--%s-to-sid=%s' % (idtype, inid)],
stdout=subprocess.PIPE).communicate()
domain = subprocess.Popen([wbinfo, "--own-domain"],
stdout=subprocess.PIPE).communicate()[0].strip()
domsid = subprocess.Popen([wbinfo, "-n", domain + "/"],
@ -106,6 +107,7 @@ def check_multiple(sids, idtypes):
sys.exit(1)
i += 1
# first round: with filled cache via sid-to-id
check_singular(sids, gids, 'gid')
check_singular(sids, uids, 'uid')

View File

@ -37,6 +37,7 @@ def plansmbtorture4testsuite(name, env, options, description=''):
selftesthelpers.plansmbtorture4testsuite(
name, env, options, target='samba3', modname=modname)
# find config.h
try:
config_h = os.environ["CONFIG_H"]

View File

@ -331,6 +331,7 @@ def main():
os.waitpid(client_pid, 0)
sys.exit(0)
if __name__ == "__main__":
main()

View File

@ -254,6 +254,7 @@ def get_object_classes(db):
list.append(item)
return list
classinfo = pull_classinfo(db)
if objectclass is None:

View File

@ -283,6 +283,7 @@ class UserTests(samba.tests.TestCase):
def test_03_13_member_search_linked_users(self):
self._test_member_search(rounds=2)
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host

View File

@ -3270,6 +3270,7 @@ class BaseDnTests(samba.tests.TestCase):
expected = "%s:%s$@%s" % (dns_domainname.lower(), hostname.lower(), dns_domainname.upper())
self.assertEquals(given, expected)
if not "://" in host:
if os.path.isfile(host):
host = "tdb://%s" % host

View File

@ -1645,6 +1645,7 @@ class SchemaTests_msDS_isRODC(samba.tests.TestCase):
else:
self.assertTrue("msDS-isRODC" in ldb_msg)
if not "://" in host:
if os.path.isfile(host):
host = "tdb://%s" % host

View File

@ -384,4 +384,5 @@ name: """ + object_name + """
(num, _) = e14.args
self.assertEquals(num, ERR_CONSTRAINT_VIOLATION)
TestProgram(module=__name__, opts=subunitopts)

View File

@ -720,6 +720,7 @@ class LATests(samba.tests.TestCase):
self.assert_forward_links(e1, [], attr='addressBookRoots2',
show_deactivated_link=0)
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host

View File

@ -179,6 +179,7 @@ userPassword: %s
def test_login_basics_ntlm(self):
self._test_login_basics(self.lockout1ntlm_creds)
host_url = "ldap://%s" % host
TestProgram(module=__name__, opts=subunitopts)

View File

@ -212,6 +212,7 @@ class UserTests(samba.tests.TestCase):
desc = ndr_unpack(drsuapi.DsGetNCChangesCtr6, blob)
self._test_pack(desc, cycles=20)
if "://" not in host:
if os.path.isfile(host):
host = "tdb://%s" % host

View File

@ -364,6 +364,7 @@ delete: otherLoginWorkstations
print("va[%s]" % va)
self.assertEquals(num, ERR_UNWILLING_TO_PERFORM)
if not "://" in url:
if os.path.isfile(url):
url = "tdb://%s" % url

View File

@ -1357,6 +1357,7 @@ userPassword: """ + userpass + """
self._test_samr_password_change(self.lockout1ntlm_creds,
other_creds=self.lockout2ntlm_creds)
host_url = "ldap://%s" % host
TestProgram(module=__name__, opts=subunitopts)

View File

@ -1133,6 +1133,7 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')).
# Close the second LDB connection (with the user credentials)
self.ldb2 = None
if not "://" in host:
if os.path.isfile(host):
host = "tdb://%s" % host

View File

@ -255,4 +255,5 @@ def main():
TestProgram(module=__name__, opts=subunitopts)
main()

View File

@ -1296,4 +1296,5 @@ def main():
finally:
set_auto_replication(RWDC, True)
main()

View File

@ -2145,6 +2145,7 @@ class SdAutoInheritTests(DescriptorTests):
sub_usn2 = int(sub_res2[0]["uSNChanged"][0])
self.assertTrue(sub_usn2 == sub_usn0)
if not "://" in host:
if os.path.isfile(host):
host = "tdb://%s" % host

View File

@ -50,6 +50,7 @@ def norm(x):
x = x.decode('utf-8')
return normalize('NFKC', x).upper().encode('utf-8')
# Python, Windows, and Samba all sort the following sequence in
# drastically different ways. The order here is what you get from
# Windows2012R2.

View File

@ -648,6 +648,7 @@ class DynamicTokenTest(samba.tests.TestCase):
self.assertEqual(len(rids.rids), 1)
self.assertEqual(rids.rids[0].rid, user_info.primary_gid)
if not "://" in url:
if os.path.isfile(url):
url = "tdb://%s" % url

View File

@ -42,6 +42,7 @@ def _swig_repr(self):
except: strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
import types
try:
_object = types.ObjectType
@ -72,6 +73,8 @@ class IUnknown(object):
def __init__(self, *args, **kwargs):
_wmi.IUnknown_swiginit(self, _wmi.new_IUnknown(*args, **kwargs))
__swig_destroy__ = _wmi.delete_IUnknown
IUnknown.Release = new_instancemethod(_wmi.IUnknown_Release, None, IUnknown)
IUnknown_swigregister = _wmi.IUnknown_swigregister
IUnknown_swigregister(IUnknown)
@ -84,6 +87,8 @@ class IWbemServices(object):
def __init__(self, *args, **kwargs):
_wmi.IWbemServices_swiginit(self, _wmi.new_IWbemServices(*args, **kwargs))
__swig_destroy__ = _wmi.delete_IWbemServices
IWbemServices.ExecQuery = new_instancemethod(_wmi.IWbemServices_ExecQuery, None, IWbemServices)
IWbemServices.ExecNotificationQuery = new_instancemethod(_wmi.IWbemServices_ExecNotificationQuery, None, IWbemServices)
IWbemServices.CreateInstanceEnum = new_instancemethod(_wmi.IWbemServices_CreateInstanceEnum, None, IWbemServices)
@ -98,6 +103,8 @@ class IEnumWbemClassObject(object):
def __init__(self, *args, **kwargs):
_wmi.IEnumWbemClassObject_swiginit(self, _wmi.new_IEnumWbemClassObject(*args, **kwargs))
__swig_destroy__ = _wmi.delete_IEnumWbemClassObject
IEnumWbemClassObject.Reset = new_instancemethod(_wmi.IEnumWbemClassObject_Reset, None, IEnumWbemClassObject)
IEnumWbemClassObject_swigregister = _wmi.IEnumWbemClassObject_swigregister
IEnumWbemClassObject_swigregister(IEnumWbemClassObject)

View File

@ -39,6 +39,7 @@ def add_deps(node):
for n in graph[node]:
add_deps(n)
add_deps(top)
# Generate output

View File

@ -42,6 +42,7 @@ def printdirsync(ctl):
print("highest usn in extra %s" % cookie.blob.extra.ctr.cursors[0].highest_usn)
return cookie
remote_ldb = Ldb("ldap://" + opts.host + ":389", credentials=creds, lp=lp)
tab = []
if opts.b:

View File

@ -146,6 +146,7 @@ def _pfm_schi_verify(drs_schi, ldb_schi):
% (drs_schi.invocation_id, ldb_schi.invocation_id))
return errors
########### main code ###########
if __name__ == "__main__":
# command line parsing

View File

@ -77,6 +77,7 @@ class globals:
def attid_equal(a1, a2):
return (a1 & 0xffffffff) == (a2 & 0xffffffff)
########### main code ###########
if __name__ == "__main__":
parser = OptionParser("repl_cleartext_pwd.py [options] server dn cookie_file clear_utf8_name [attid attname attmode] [clear_utf16_name")

View File

@ -226,6 +226,7 @@ class AclSearchSpeedTest(SpeedTest):
# Important unit running information
if not "://" in host:
host = "ldap://%s" % host

View File

@ -31,6 +31,7 @@ def plansmbtorture4testsuite(name, env, options, modname=None):
return selftesthelpers.plansmbtorture4testsuite(name, env, options,
target='samba4', modname=modname)
samba4srcdir = source4dir()
samba4bindir = bindir()
validate = os.getenv("VALIDATE", "")