@@ -171,7 +171,7 @@ def set_pasv(self, val):
171171 def sanitize (self , s ):
172172 if s [:5 ] == 'pass ' or s [:5 ] == 'PASS ' :
173173 i = len (s )
174- while i > 5 and s [i - 1 ] in '\r \n ' :
174+ while i > 5 and s [i - 1 ] in { '\r ' , ' \n '} :
175175 i = i - 1
176176 s = s [:5 ] + '*' * (i - 5 ) + s [i :]
177177 return repr (s )
@@ -221,7 +221,7 @@ def getresp(self):
221221 if self .debugging : print ('*resp*' , self .sanitize (resp ))
222222 self .lastresp = resp [:3 ]
223223 c = resp [:1 ]
224- if c in ( '1' , '2' , '3' ) :
224+ if c in { '1' , '2' , '3' } :
225225 return resp
226226 if c == '4' :
227227 raise error_temp (resp )
@@ -245,7 +245,7 @@ def abort(self):
245245 if self .debugging > 1 : print ('*put urgent*' , self .sanitize (line ))
246246 self .sock .sendall (line , MSG_OOB )
247247 resp = self .getmultiline ()
248- if resp [:3 ] not in ( '426' , '225' , '226' ) :
248+ if resp [:3 ] not in { '426' , '225' , '226' } :
249249 raise error_proto (resp )
250250
251251 def sendcmd (self , cmd ):
@@ -375,7 +375,7 @@ def login(self, user = '', passwd = '', acct = ''):
375375 if not user : user = 'anonymous'
376376 if not passwd : passwd = ''
377377 if not acct : acct = ''
378- if user == 'anonymous' and passwd in ( '' , '-' ) :
378+ if user == 'anonymous' and passwd in { '' , '-' } :
379379 # If there is no anonymous ftp password specified
380380 # then we'll just use anonymous@
381381 # We don't send any other thing because:
@@ -534,7 +534,7 @@ def rename(self, fromname, toname):
534534 def delete (self , filename ):
535535 '''Delete a file.'''
536536 resp = self .sendcmd ('DELE ' + filename )
537- if resp [:3 ] in ( '250' , '200' ) :
537+ if resp [:3 ] in { '250' , '200' } :
538538 return resp
539539 else :
540540 raise error_reply (resp )
@@ -897,9 +897,9 @@ def ftpcp(source, sourcename, target, targetname = '', type = 'I'):
897897 # transfer request.
898898 # So: STOR before RETR, because here the target is a "user".
899899 treply = target .sendcmd ('STOR ' + targetname )
900- if treply [:3 ] not in ( '125' , '150' ) : raise error_proto # RFC 959
900+ if treply [:3 ] not in { '125' , '150' } : raise error_proto # RFC 959
901901 sreply = source .sendcmd ('RETR ' + sourcename )
902- if sreply [:3 ] not in ( '125' , '150' ) : raise error_proto # RFC 959
902+ if sreply [:3 ] not in { '125' , '150' } : raise error_proto # RFC 959
903903 source .voidresp ()
904904 target .voidresp ()
905905
0 commit comments