From: Joe Guo Date: Mon, 30 Jul 2018 06:21:32 +0000 (+1200) Subject: PEP8: fix E306: expected 1 blank line before a nested definition, found 0 X-Git-Tag: tdb-1.3.17~2054 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d529c400ba966ff633812a0f9f6a46862bd9e56;p=thirdparty%2Fsamba.git PEP8: fix E306: expected 1 blank line before a nested definition, found 0 Signed-off-by: Joe Guo Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py index fbe69c6ed65..13fe43a2381 100755 --- a/lib/ldb/tests/python/api.py +++ b/lib/ldb/tests/python/api.py @@ -2038,6 +2038,7 @@ class DnTests(TestCase): def test_set_dn_invalid(self): x = ldb.Message() + def assign(): x.dn = "astring" self.assertRaises(TypeError, assign) @@ -2617,6 +2618,7 @@ class ModuleTests(TestCase): def test_use_module(self): ops = [] + class ExampleModule: name = "bla" diff --git a/lib/tevent/bindings.py b/lib/tevent/bindings.py index 28e404dac4e..f5e14997c3d 100644 --- a/lib/tevent/bindings.py +++ b/lib/tevent/bindings.py @@ -78,6 +78,7 @@ class ContextTests(TestCase): def test_timer_deallocate_timer(self): """Test timer is scheduled even if reference to it isn't held""" collecting_list = [] + def callback(t): collecting_list.append(True) timer = self.ctx.add_timer(0, lambda t: collecting_list.append(True)) @@ -89,6 +90,7 @@ class ContextTests(TestCase): def test_timer_deallocate_context(self): """Test timer is unscheduled when context is freed""" collecting_list = [] + def callback(t): collecting_list.append(True) timer = self.ctx.add_timer(0, lambda t: collecting_list.append(True)) diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py index a7b3b988652..b14700213d5 100644 --- a/python/samba/netcmd/user.py +++ b/python/samba/netcmd/user.py @@ -996,6 +996,7 @@ class GetPasswordCommand(Command): del obj["userPrincipalName"] calculated = {} + def get_package(name, min_idx=0): if name in calculated: return calculated[name] @@ -1068,6 +1069,7 @@ class GetPasswordCommand(Command): # Extract the WDigest hash for the value specified by i. # Builds an htdigest compatible value DIGEST = "Digest" + def get_wDigest(i, primary_wdigest, account_name, account_upn, domain, dns_domain): if i == 1: diff --git a/python/samba/tests/dcerpc/integer.py b/python/samba/tests/dcerpc/integer.py index 62d1e67a36b..a56bf7d3687 100644 --- a/python/samba/tests/dcerpc/integer.py +++ b/python/samba/tests/dcerpc/integer.py @@ -35,18 +35,21 @@ class IntegerTests(samba.tests.TestCase): def test_negative_int_into_hyper(self): s = server_id.server_id() + def assign(): s.unique_id = -1 self.assertRaises(OverflowError, assign) def test_hyper_into_uint32(self): s = server_id.server_id() + def assign(): s.vnn = server_id.SERVERID_UNIQUE_ID_NOT_TO_VERIFY self.assertRaises(OverflowError, assign) def test_hyper_into_int32(self): s = srvsvc.NetRemoteTODInfo() + def assign(): s.timezone = server_id.SERVERID_UNIQUE_ID_NOT_TO_VERIFY self.assertRaises(OverflowError, assign) @@ -58,6 +61,7 @@ class IntegerTests(samba.tests.TestCase): def test_uint32_into_int32(self): s = srvsvc.NetRemoteTODInfo() + def assign(): s.timezone = server_id.NONCLUSTER_VNN self.assertRaises(OverflowError, assign) @@ -69,6 +73,7 @@ class IntegerTests(samba.tests.TestCase): def test_larger_long_int_into_int32(self): s = srvsvc.NetRemoteTODInfo() + def assign(): s.timezone = 2147483648 self.assertRaises(OverflowError, assign) @@ -80,12 +85,14 @@ class IntegerTests(samba.tests.TestCase): def test_float_into_int32(self): s = srvsvc.NetRemoteTODInfo() + def assign(): s.timezone = 2.5 self.assertRaises(TypeError, assign) def test_int_float_into_int32(self): s = srvsvc.NetRemoteTODInfo() + def assign(): s.timezone = 2.0 self.assertRaises(TypeError, assign) @@ -97,36 +104,42 @@ class IntegerTests(samba.tests.TestCase): def test_negative_into_uint32(self): s = server_id.server_id() + def assign(): s.vnn = -1 self.assertRaises(OverflowError, assign) def test_hyper_into_uint16(self): g = misc.GUID() + def assign(): g.time_mid = server_id.SERVERID_UNIQUE_ID_NOT_TO_VERIFY self.assertRaises(OverflowError, assign) def test_int_into_uint16(self): g = misc.GUID() + def assign(): g.time_mid = 200000 self.assertRaises(OverflowError, assign) def test_negative_int_into_uint16(self): g = misc.GUID() + def assign(): g.time_mid = -2 self.assertRaises(OverflowError, assign) def test_int_into_uint16(self): g = misc.GUID() + def assign(): g.time_mid = 200000 self.assertRaises(OverflowError, assign) def test_negative_int_into_uint16(self): g = misc.GUID() + def assign(): g.time_mid = -2 self.assertRaises(OverflowError, assign) @@ -143,18 +156,21 @@ class IntegerTests(samba.tests.TestCase): def test_overflow_bitmap_into_uint16(self): g = misc.GUID() + def assign(): g.time_mid = misc.SV_TYPE_LOCAL_LIST_ONLY self.assertRaises(OverflowError, assign) def test_overflow_bitmap_into_uint16_2(self): g = misc.GUID() + def assign(): g.time_mid = misc.SV_TYPE_DOMAIN_ENUM self.assertRaises(OverflowError, assign) def test_hyper_into_int64(self): s = samr.DomInfo1() + def assign(): s.max_password_age = server_id.SERVERID_UNIQUE_ID_NOT_TO_VERIFY self.assertRaises(OverflowError, assign) @@ -191,24 +207,28 @@ class IntegerTests(samba.tests.TestCase): def test_negative_list_over_uint8_list(self): g = misc.GUID() + def assign(): g.node = [-1, 0, 5, 0, 7, 4] self.assertRaises(OverflowError, assign) def test_overflow_list_over_uint8_list(self): g = misc.GUID() + def assign(): g.node = [256, 0, 5, 0, 7, 4] self.assertRaises(OverflowError, assign) def test_short_list_over_uint8_list(self): g = misc.GUID() + def assign(): g.node = [5, 0, 5] self.assertRaises(TypeError, assign) def test_long_list_over_uint8_list(self): g = misc.GUID() + def assign(): g.node = [5, 0, 5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF] self.assertRaises(TypeError, assign) @@ -225,12 +245,14 @@ class IntegerTests(samba.tests.TestCase): def test_negative_into_uint8_list(self): g = misc.GUID() + def assign(): g.node[1] = -1 self.assertRaises(OverflowError, assign) def test_overflow_into_uint8_list(self): g = misc.GUID() + def assign(): g.node[1] = 256 self.assertRaises(OverflowError, assign) diff --git a/python/samba/tests/messaging.py b/python/samba/tests/messaging.py index 2a3685fee29..6484d0655ff 100644 --- a/python/samba/tests/messaging.py +++ b/python/samba/tests/messaging.py @@ -37,6 +37,7 @@ class MessagingTests(TestCase): def test_register(self): x = self.get_context() + def callback(): pass msg_type = x.register((callback, None)) @@ -82,6 +83,7 @@ class MessagingTests(TestCase): msg_ping = 0 server_ctx = self.get_context((0, 1)) + def ping_callback(got_ping, msg_type, src, data): got_ping["count"] += 1 server_ctx.send(src, msg_pong, data) @@ -123,6 +125,7 @@ class MessagingTests(TestCase): pid = os.getpid() server_ctx = self.get_context((pid, 1)) + def ping_callback(got_ping, msg_type, src, data): got_ping["count"] += 1 server_ctx.send(src, msg_pong, data) diff --git a/source4/torture/drs/python/samba_tool_drs.py b/source4/torture/drs/python/samba_tool_drs.py index f5a83aaccf6..7b9a6c482d5 100644 --- a/source4/torture/drs/python/samba_tool_drs.py +++ b/source4/torture/drs/python/samba_tool_drs.py @@ -295,6 +295,7 @@ class SambaToolDrsTests(drs_base.DrsBaseTestCase): samdb = samba.tests.connect_samdb("ldb://" + os.path.join(self.tempdir, "private", "sam.ldb"), ldap_only=False, lp=self.get_loadparm()) + def get_krbtgt_pw(): krbtgt_pw = samdb.searchone("unicodePwd", "cn=krbtgt,CN=users,%s" % nc_name) self.assertRaises(KeyError, get_krbtgt_pw) @@ -413,6 +414,7 @@ class SambaToolDrsTests(drs_base.DrsBaseTestCase): server_ldap_service_name = str(server_rootdse["ldapServiceName"][0]) server_realm = server_ldap_service_name.split(":")[0] creds = self.get_credentials() + def attempt_clone(): out = self.check_output("samba-tool drs clone-dc-database %s --server=%s %s" % (server_realm,