@@ -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__ = []
0 commit comments