Skip to content

Commit e50f3eb

Browse files
authored
Merge pull request #37 from costowell/bump-deps
fix: bump pylint and python version in CI
2 parents 29f2600 + eec112e commit e50f3eb

7 files changed

Lines changed: 39 additions & 49 deletions

File tree

.github/workflows/python.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: [3.6, 3.7, 3.8, 3.9]
14+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1515
steps:
1616
- name: Install ldap dependencies
1717
run: sudo apt-get update && sudo apt-get install libldap2-dev libsasl2-dev

.pylintrc

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
11
[MASTER]
2-
ignore = ,input
2+
ignore-paths=input
33
persistent = yes
44

55
[MESSAGES CONTROL]
66
disable =
77
missing-docstring,
8-
fixme,
9-
duplicate-code,
10-
no-member,
11-
parse-error,
12-
bad-continuation,
13-
too-few-public-methods,
14-
global-statement,
15-
cyclic-import,
16-
locally-disabled,
17-
file-ignored,
8+
fixme,
9+
duplicate-code,
10+
no-member,
11+
parse-error,
12+
too-few-public-methods,
13+
global-statement,
14+
cyclic-import,
15+
locally-disabled,
16+
file-ignored,
1817
import-error,
1918
unused-import
2019

2120
[REPORTS]
2221
output-format = text
23-
files-output = no
2422
reports = no
2523

2624
[FORMAT]
2725
max-line-length = 120
28-
max-statement-lines = 75
2926
single-line-if-stmt = no
30-
no-space-check = trailing-comma,dict-separator
3127
max-module-lines = 1000
3228
indent-string = ' '
3329

@@ -75,8 +71,8 @@ good-names=logger,id,ID
7571
# Bad variable names which should always be refused, separated by a comma
7672
bad-names=foo,bar,baz,toto,tutu,tata
7773

78-
# List of builtins function names that should not be used, separated by a comma
79-
bad-functions=apply,input
74+
# Note: bad-functions option was removed in modern pylint versions
75+
# Use specific pylint checks instead
8076

8177

8278
[DESIGN]
@@ -92,4 +88,4 @@ min-public-methods = 2
9288
max-public-methods = 20
9389

9490
[EXCEPTIONS]
95-
overgeneral-exceptions = Exception
91+
overgeneral-exceptions = builtins.Exception

csh_ldap/__init__.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class CSHLDAP:
1111
__domain__ = "csh.rit.edu"
1212

1313
@reconnect_on_fail
14-
def __init__(self, bind_dn, bind_pw, batch_mods=False,
14+
def __init__(self, bind_dn, bind_pw, *, batch_mods=False,
1515
sasl=False, ro=False):
1616
"""Handler for bindings to CSH LDAP.
1717
@@ -74,7 +74,7 @@ def get_member_ibutton(self, val):
7474
members = self.__con__.search_s(
7575
CSHMember.__ldap_user_ou__,
7676
ldap.SCOPE_SUBTREE,
77-
"(ibutton=%s)" % val,
77+
f"(ibutton={val})",
7878
['ipaUniqueID'])
7979
if members:
8080
return CSHMember(
@@ -96,7 +96,7 @@ def get_member_slackuid(self, slack):
9696
members = self.__con__.search_s(
9797
CSHMember.__ldap_user_ou__,
9898
ldap.SCOPE_SUBTREE,
99-
"(slackuid=%s)" % slack,
99+
f"(slackuid={slack})",
100100
['ipaUniqueID'])
101101
if members:
102102
return CSHMember(
@@ -132,7 +132,7 @@ def get_directorship_heads(self, val):
132132
res = self.__con__.search_s(
133133
__ldap_group_ou__,
134134
ldap.SCOPE_SUBTREE,
135-
"(cn=eboard-%s)" % val,
135+
f"(cn=eboard-{val})",
136136
['member'])
137137

138138
ret = []
@@ -176,19 +176,14 @@ def flush_mod(self):
176176
mod_str = "ADD"
177177
else:
178178
mod_str = "REPLACE"
179-
print("{} VALUE {} = {} FOR {}".format(mod_str,
180-
mod[1],
181-
mod[2],
182-
dn))
179+
print(f"{mod_str} VALUE {mod[1]} = {mod[2]} FOR {dn}")
183180
else:
184181
self.__con__.modify_s(dn, self.__mod_queue__[dn])
185182
except ldap.TYPE_OR_VALUE_EXISTS:
186-
print("Error! Conflicting Batch Modification: %s"
187-
% str(self.__mod_queue__[dn]))
183+
print(f"Error! Conflicting Batch Modification: {self.__mod_queue__[dn]}")
188184
continue
189185
except ldap.NO_SUCH_ATTRIBUTE:
190-
print("Error! Conflicting Batch Modification: %s"
191-
% str(self.__mod_queue__[dn]))
186+
print(f"Error! Conflicting Batch Modification: {self.__mod_queue__[dn]}")
192187
continue
193188
self.__mod_queue__[dn] = None
194189
self.__pending_mod_dn__ = []

csh_ldap/group.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, lib, search_val):
2121
res = self.__con__.search_s(
2222
self.__ldap_group_ou__,
2323
ldap.SCOPE_SUBTREE,
24-
"(cn=%s)" % search_val,
24+
f"(cn={search_val})",
2525
['cn'])
2626

2727
if res:
@@ -35,7 +35,7 @@ def get_members(self):
3535
res = self.__con__.search_s(
3636
self.__ldap_base_dn__,
3737
ldap.SCOPE_SUBTREE,
38-
"(memberof=%s)" % self.__dn__,
38+
f"(memberof={self.__dn__})",
3939
['uid'])
4040

4141
ret = []
@@ -69,13 +69,13 @@ def check_member(self, member, dn=False):
6969
res = self.__con__.search_s(
7070
self.__dn__,
7171
ldap.SCOPE_BASE,
72-
"(member=%s)" % dn,
72+
f"(member={dn})",
7373
['ipaUniqueID'])
7474
else:
7575
res = self.__con__.search_s(
7676
self.__dn__,
7777
ldap.SCOPE_BASE,
78-
"(member=%s)" % member.get_dn(),
78+
f"(member={member.get_dn()})",
7979
['ipaUniqueID'])
8080
return len(res) > 0
8181

@@ -105,7 +105,7 @@ def add_member(self, member, dn=False):
105105
mod_attrs = [mod]
106106
self.__con__.modify_s(self.__dn__, mod_attrs)
107107
else:
108-
print("ADD VALUE member = {} FOR {}".format(mod[2], self.__dn__))
108+
print(f"ADD VALUE member = {mod[2]} FOR {self.__dn__}")
109109

110110
@reconnect_on_fail
111111
def del_member(self, member, dn=False):
@@ -133,5 +133,4 @@ def del_member(self, member, dn=False):
133133
mod_attrs = [mod]
134134
self.__con__.modify_s(self.__dn__, mod_attrs)
135135
else:
136-
print("DELETE VALUE member = {} FOR {}".format(mod[2],
137-
self.__dn__))
136+
print(f"DELETE VALUE member = {mod[2]} FOR {self.__dn__}")

csh_ldap/member.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ def __init__(self, lib, search_val, uid):
2424
res = self.__con__.search_s(
2525
self.__ldap_user_ou__,
2626
ldap.SCOPE_SUBTREE,
27-
"(uid=%s)" % search_val,
27+
f"(uid={search_val})",
2828
['ipaUniqueID'])
2929
else:
3030
res = self.__con__.search_s(
3131
self.__ldap_user_ou__,
3232
ldap.SCOPE_SUBTREE,
33-
"(ipaUniqueID=%s)" % search_val,
33+
f"(ipaUniqueID={search_val})",
3434
['uid'])
3535

3636
if res:
@@ -51,15 +51,15 @@ def __hash__(self):
5151
def __repr__(self):
5252
"""Generate a str representation of the bound CSH LDAP member object.
5353
"""
54-
return "CSH Member(dn: %s)" % self.__dn__
54+
return f"CSH Member(dn: {self.__dn__})"
5555

5656
def get(self, key):
5757
"""Get an attribute from the bound CSH LDAP member object.
5858
5959
Arguments:
6060
key -- the attribute to get the value of
6161
"""
62-
return self.__getattr__(key, as_list=True)
62+
return self._get_attr(key, as_list=True)
6363

6464
@reconnect_on_fail
6565
def groups(self):
@@ -91,7 +91,7 @@ def get_dn(self):
9191
return self.__dn__
9292

9393
@reconnect_on_fail
94-
def __getattr__(self, key, as_list=False):
94+
def _get_attr(self, key, as_list=False):
9595
res = self.__con__.search_s(
9696
self.__dn__,
9797
ldap.SCOPE_BASE,
@@ -153,7 +153,4 @@ def __setattr__(self, key, value):
153153
mod_str = "ADD"
154154
else:
155155
mod_str = "REPLACE"
156-
print("{} FIELD {} WITH {} FOR {}".format(mod_str,
157-
key,
158-
value,
159-
self.__dn__))
156+
print(f"{mod_str} FIELD {key} WITH {value} FOR {self.__dn__}")

csh_ldap/utility.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ def wrapper(*method_args, **method_kwargs):
2525
:return: result of method call
2626
"""
2727
max_reconnects = MAX_RECONNECTS
28-
is_cshldap = lambda arg: any(
28+
29+
def is_cshldap(arg):
30+
return any(
2931
filter(
3032
lambda t: t.__name__ == 'CSHLDAP',
3133
type(arg).__mro__
32-
)
3334
)
35+
)
3436
ldap_obj = next(filter(is_cshldap, method_args)) \
3537
if any(filter(is_cshldap, method_args)) \
3638
else method_args[0].__lib__
@@ -55,5 +57,6 @@ def wrapper(*method_args, **method_kwargs):
5557
max_reconnects -= 1
5658
if max_reconnects == 0:
5759
raise
60+
return None
5861

5962
return wrapper

requirements-test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
pycodestyle==2.4.0
2-
pylint==2.5.2
2+
pylint==3.3.8

0 commit comments

Comments
 (0)