Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 25, 2023
1 parent 08edeec commit c12a94f
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ldaptor/_scripts/ldap2dhcpconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion ldaptor/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def __str__(self):

@implementer(interfaces.ILDAPConfig)
class LDAPConfig:

baseDN = None
identityBaseDN = None
identitySearch = None
Expand Down
4 changes: 2 additions & 2 deletions ldaptor/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand Down
1 change: 0 additions & 1 deletion ldaptor/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion ldaptor/protocols/ldap/autofill/sambaAccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion ldaptor/protocols/ldap/distinguishedname.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]
Expand Down
2 changes: 1 addition & 1 deletion ldaptor/protocols/ldap/merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 0 additions & 2 deletions ldaptor/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down
3 changes: 0 additions & 3 deletions ldaptor/test/test_ldif.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
Expand All @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions ldaptor/test/test_pureber.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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]
Expand Down
1 change: 0 additions & 1 deletion ldaptor/test/test_pureldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit c12a94f

Please sign in to comment.