diff --git a/ldaptor/_scripts/ldap2dhcpconf.py b/ldaptor/_scripts/ldap2dhcpconf.py index a589e02c..992e8d2e 100644 --- a/ldaptor/_scripts/ldap2dhcpconf.py +++ b/ldaptor/_scripts/ldap2dhcpconf.py @@ -30,7 +30,7 @@ def my_aton_numbits(num): n = 0 while num > 0: n >>= 1 - n |= 2 ** 31 + n |= 2**31 num -= 1 return n diff --git a/ldaptor/config.py b/ldaptor/config.py index 1d5adcc3..eb052389 100644 --- a/ldaptor/config.py +++ b/ldaptor/config.py @@ -16,7 +16,6 @@ def __str__(self): @implementer(interfaces.ILDAPConfig) class LDAPConfig: - baseDN = None identityBaseDN = None identitySearch = None diff --git a/ldaptor/dns.py b/ldaptor/dns.py index 0005e93e..710b3824 100644 --- a/ldaptor/dns.py +++ b/ldaptor/dns.py @@ -13,7 +13,7 @@ def aton_numbits(num): n = 0 while num > 0: n >>= 1 - n |= 2 ** 31 + n |= 2**31 num -= 1 return n @@ -35,7 +35,7 @@ def ntoa(n): def netmaskToNumbits(netmask): bits = aton(netmask) - i = 2 ** 31 + i = 2**31 n = 0 while bits and i > 0: if (bits & i) == 0: diff --git a/ldaptor/entry.py b/ldaptor/entry.py index 2d8e23bf..9b2599e1 100644 --- a/ldaptor/entry.py +++ b/ldaptor/entry.py @@ -207,7 +207,6 @@ def diff(self, other): sharedKeys = list(myKeys & otherKeys) sharedKeys.sort(key=to_bytes) # for reproducability only for shared in sharedKeys: - addedValues = list(other[shared] - self[shared]) if addedValues: addedValues.sort(key=to_bytes) # for reproducability only diff --git a/ldaptor/protocols/ldap/autofill/sambaAccount.py b/ldaptor/protocols/ldap/autofill/sambaAccount.py index 72a7ef0f..ad8aa68d 100644 --- a/ldaptor/protocols/ldap/autofill/sambaAccount.py +++ b/ldaptor/protocols/ldap/autofill/sambaAccount.py @@ -21,7 +21,6 @@ def start(self, ldapObject): ldapObject["pwdMustChange"] = ["0"] def notify(self, ldapObject, attributeType): - # rid=2*uid+1000 if attributeType == "uidNumber": assert "uidNumber" in ldapObject diff --git a/ldaptor/protocols/ldap/distinguishedname.py b/ldaptor/protocols/ldap/distinguishedname.py index 63b4511f..f90e195b 100644 --- a/ldaptor/protocols/ldap/distinguishedname.py +++ b/ldaptor/protocols/ldap/distinguishedname.py @@ -65,7 +65,6 @@ def _splitOnNotEscaped(s, separator): r[-1] = r[-1] + s[:2] s = s[2:] else: - if first == separator: r.append("") s = s[1:] diff --git a/ldaptor/protocols/ldap/merger.py b/ldaptor/protocols/ldap/merger.py index 7efc7573..3f716afe 100644 --- a/ldaptor/protocols/ldap/merger.py +++ b/ldaptor/protocols/ldap/merger.py @@ -82,7 +82,7 @@ def queue(self, id, op): def connectionMade(self): clientCreator = ldapconnector.LDAPClientCreator(reactor, self.protocol) - for (c, tls) in zip(self.configs, self.use_tls): + for c, tls in zip(self.configs, self.use_tls): d = clientCreator.connect(dn="", overrides=c.getServiceLocationOverrides()) if tls: d.addCallback(lambda x: x.startTLS()) diff --git a/ldaptor/schema.py b/ldaptor/schema.py index e4a1ea24..826439c0 100644 --- a/ldaptor/schema.py +++ b/ldaptor/schema.py @@ -610,7 +610,6 @@ def __init__(self, text): self._parse(to_bytes(text)) def _parse(self, text): - assert text[:1] == b"(" assert text[-1:] == b")" text = text[1:-1] @@ -698,7 +697,6 @@ def __init__(self, text): self._parse(to_bytes(text)) def _parse(self, text): - assert text[:1] == b"(" assert text[-1:] == b")" text = text[1:-1] diff --git a/ldaptor/test/test_ldif.py b/ldaptor/test/test_ldif.py index 86ee9e2a..5e995a87 100644 --- a/ldaptor/test/test_ldif.py +++ b/ldaptor/test/test_ldif.py @@ -52,7 +52,6 @@ def test_startswith_special_character(self): Returned value is base64 encoded. """ for c in b"\0", b"\n", b"\r", b" ", b":", b"<": - value = c + b"value" result = attributeAsLDIF(b"key", value) self.assertEqual(result, b"key:: %s\n" % encode(value)) @@ -63,7 +62,6 @@ def test_endswith_special_character(self): Returned value is base64 encoded. """ for c in b"\0", b"\n", b"\r", b" ": - value = b"value" + c result = attributeAsLDIF(b"key", value) self.assertEqual(result, b"key:: %s\n" % encode(value)) @@ -75,7 +73,6 @@ def test_contains_special_characters(self): Returned value is base64 encoded. """ for c in b"\0", b"\n", b"\r": - value = b"foo" + c + b"bar" result = attributeAsLDIF(b"key", value) self.assertEqual(result, b"key:: %s\n" % encode(value)) diff --git a/ldaptor/test/test_pureber.py b/ldaptor/test/test_pureber.py index ea4633c9..5c8ccd25 100644 --- a/ldaptor/test/test_pureber.py +++ b/ldaptor/test/test_pureber.py @@ -34,7 +34,7 @@ class BerLengths(unittest.TestCase): (257, [0x80 | 2, 1, 1]), (65535, [0x80 | 2, 0xFF, 0xFF]), (65536, [0x80 | 3, 0x01, 0x00, 0x00]), - (256 ** 127 - 1, [0x80 | 127] + 127 * [0xFF]), + (256**127 - 1, [0x80 | 127] + 127 * [0xFF]), ) def testToBER(self): @@ -61,7 +61,7 @@ def testPartialBER(self): pureber.BERExceptionInsufficientData, pureber.berDecodeLength, m[:1] ) - m = bytes(pureber.int2berlen(256 ** 100 - 1)) + m = bytes(pureber.int2berlen(256**100 - 1)) self.assertEqual(101, len(m)) self.assertRaises( pureber.BERExceptionInsufficientData, pureber.berDecodeLength, m[:100] diff --git a/ldaptor/test/test_pureldap.py b/ldaptor/test/test_pureldap.py index 6bdd4d8d..741f9680 100644 --- a/ldaptor/test/test_pureldap.py +++ b/ldaptor/test/test_pureldap.py @@ -1173,7 +1173,6 @@ def test_nested_equal(self): self.assertEqual(filter1, filter2) def test_escape_and_equal(self): - filter1 = pureldap.LDAPFilter_and( [ pureldap.LDAPFilter_equalityMatch(