@@ -1329,7 +1329,7 @@ def __init__(self, instance, arguments):
13291329 self .arguments = arguments
13301330 self .default_class = self .arguments .default_class .strip ()
13311331 if not self .default_class :
1332- self .default_class = instance .config ['MAILGW_DEFAULT_CLASS' ]
1332+ self .default_class = instance .config ['MAILGW_DEFAULT_CLASS' ]
13331333 self .props_by_class = {}
13341334 self .parse_set_value ()
13351335
@@ -1349,7 +1349,7 @@ def parse_set_value(self):
13491349 try :
13501350 n , r = v .split ('=' , 1 )
13511351 except ValueError :
1352- errors .append ('"%s" is not of the form "property=value"' % v )
1352+ errors .append ('"%s" is not of the form "property=value"' % v )
13531353 break
13541354 try :
13551355 classname , rv = n .split ('.' , 1 )
@@ -1359,8 +1359,8 @@ def parse_set_value(self):
13591359 r = v
13601360 if classname not in self .props_by_class :
13611361 # We can only check later if this is a valid class
1362- self .props_by_class [classname ] = []
1363- self .props_by_class [classname ].append (r )
1362+ self .props_by_class [classname ] = []
1363+ self .props_by_class [classname ].append (r )
13641364 if errors :
13651365 mailadmin = self .instance .config ['ADMIN_EMAIL' ]
13661366 raise MailUsageError (_ ("""
@@ -1436,15 +1436,15 @@ class mboxRoundupMessage(mailbox.mboxMessage, RoundupMessage):
14361436
14371437 def get_oauth_tokens (self , oauth_path ):
14381438 if not oauth_path :
1439- oauth_path = self .instance .config ['TRACKER_HOME' ]
1439+ oauth_path = self .instance .config ['TRACKER_HOME' ]
14401440 oauth_path = os .path .join (oauth_path , 'oauth' )
14411441 self .oauth_path = oauth_path
14421442 with open (os .path .join (oauth_path , 'access_token' ), 'r' ) as f :
14431443 self .access_token = f .read ().strip ()
14441444 with open (os .path .join (oauth_path , 'refresh_token' ), 'r' ) as f :
14451445 self .refresh_token = f .read ().strip ()
14461446
1447- def write_token (self , tokenname ):
1447+ def write_token (self , tokenname ):
14481448 n = os .path .join (self .oauth_path , tokenname )
14491449 tmp = n + '.tmp'
14501450 old = n + '.old'
@@ -1464,24 +1464,24 @@ def renew_oauth_tokens(self):
14641464 client_secret = f .read ().strip ()
14651465 with open (os .path .join (self .oauth_path , 'client_id' ), 'r' ) as f :
14661466 client_id = f .read ().strip ()
1467- data = dict \
1468- ( client_id = client_id
1469- , client_secret = client_secret
1470- , refresh_token = self .refresh_token
1471- , grant_type = 'refresh_token'
1472- )
1467+ data = dict (
1468+ client_id = client_id ,
1469+ client_secret = client_secret ,
1470+ refresh_token = self .refresh_token ,
1471+ grant_type = 'refresh_token'
1472+ )
14731473 session = requests .session ()
1474- r = session .post (self .token_endpoint , data = data )
1474+ r = session .post (self .token_endpoint , data = data )
14751475 if not 200 <= r .status_code <= 299 :
14761476 raise RuntimeError ('Invalid get result: %s: %s\n %s'
1477- % (r .status_code , r .reason , r .text ))
1477+ % (r .status_code , r .reason , r .text ))
14781478 d = r .json ()
1479- if d ['refresh_token' ] != self .refresh_token :
1480- self .refresh_token = d ['refresh_token' ]
1481- self .write_token ('refresh_token' )
1482- if d ['access_token' ] != self .access_token :
1483- self .access_token = d ['access_token' ]
1484- self .write_token ('access_token' )
1479+ if d ['refresh_token' ] != self .refresh_token :
1480+ self .refresh_token = d ['refresh_token' ]
1481+ self .write_token ('refresh_token' )
1482+ if d ['access_token' ] != self .access_token :
1483+ self .access_token = d ['access_token' ]
1484+ self .write_token ('access_token' )
14851485
14861486 def do_imap (self , server , user = '' , password = '' , mailbox = '' , ** kw ):
14871487 ''' Do an IMAP connection
@@ -1510,12 +1510,12 @@ def do_imap(self, server, user='', password='', mailbox='', **kw):
15101510 if kw .get ('oauth' ):
15111511 if requests is None :
15121512 self .logger .error ('For OAUTH, the requests library '
1513- 'must be installed' )
1513+ 'must be installed' )
15141514 return 1
15151515 self .get_oauth_tokens (kw .get ('oauth_path' ))
15161516 # The following are mandatory for oauth and are passed by
15171517 # the command-line handler:
1518- self .token_endpoint = kw ['token_endpoint' ]
1518+ self .token_endpoint = kw ['token_endpoint' ]
15191519 for k in range (2 ):
15201520 t = self .access_token
15211521 s = 'user=%s\1 auth=Bearer %s\1 \1 ' % (user , t )
@@ -1828,8 +1828,7 @@ def get_class_arguments(self, class_type, classname=None):
18281828 return {}
18291829 for propstring in self .props_by_class [classname ]:
18301830 errors , props = setPropArrayFromString (self , cls ,
1831- propstring .strip ())
1832-
1831+ propstring .strip ())
18331832
18341833 if errors :
18351834 mailadmin = self .instance .config ['ADMIN_EMAIL' ]
0 commit comments