Reformat offlineimap/ui/TTY.py
Add some spaces, remove lines,... now format is better (lintian).
This commit is contained in:
parent
8bae38ed93
commit
6e0647de1a
@ -28,14 +28,14 @@ class TTYFormatter(logging.Formatter):
|
|||||||
"""Specific Formatter that adds thread information to the log output."""
|
"""Specific Formatter that adds thread information to the log output."""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
#super() doesn't work in py2.6 as 'logging' uses old-style class
|
# super() doesn't work in py2.6 as 'logging' uses old-style class
|
||||||
logging.Formatter.__init__(self, *args, **kwargs)
|
logging.Formatter.__init__(self, *args, **kwargs)
|
||||||
self._last_log_thread = None
|
self._last_log_thread = None
|
||||||
|
|
||||||
def format(self, record):
|
def format(self, record):
|
||||||
"""Override format to add thread information."""
|
"""Override format to add thread information."""
|
||||||
|
|
||||||
#super() doesn't work in py2.6 as 'logging' uses old-style class
|
# super() doesn't work in py2.6 as 'logging' uses old-style class
|
||||||
log_str = logging.Formatter.format(self, record)
|
log_str = logging.Formatter.format(self, record)
|
||||||
# If msg comes from a different thread than our last, prepend
|
# If msg comes from a different thread than our last, prepend
|
||||||
# thread info. Most look like 'Account sync foo' or 'Folder
|
# thread info. Most look like 'Account sync foo' or 'Folder
|
||||||
@ -47,7 +47,7 @@ class TTYFormatter(logging.Formatter):
|
|||||||
self._last_log_thread = t_name
|
self._last_log_thread = t_name
|
||||||
log_str = "%s:\n %s" % (t_name, log_str)
|
log_str = "%s:\n %s" % (t_name, log_str)
|
||||||
else:
|
else:
|
||||||
log_str = " %s"% log_str
|
log_str = " %s" % log_str
|
||||||
return log_str
|
return log_str
|
||||||
|
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ class TTYUI(UIBase):
|
|||||||
|
|
||||||
# create console handler with a higher log level
|
# create console handler with a higher log level
|
||||||
ch = logging.StreamHandler()
|
ch = logging.StreamHandler()
|
||||||
#ch.setLevel(logging.DEBUG)
|
# ch.setLevel(logging.DEBUG)
|
||||||
# create formatter and add it to the handlers
|
# create formatter and add it to the handlers
|
||||||
self.formatter = TTYFormatter("%(message)s")
|
self.formatter = TTYFormatter("%(message)s")
|
||||||
ch.setFormatter(self.formatter)
|
ch.setFormatter(self.formatter)
|
||||||
@ -80,7 +80,7 @@ class TTYUI(UIBase):
|
|||||||
"""TTYUI backend is capable of querying the password."""
|
"""TTYUI backend is capable of querying the password."""
|
||||||
|
|
||||||
if errmsg:
|
if errmsg:
|
||||||
self.warn("%s: %s"% (username, errmsg))
|
self.warn("%s: %s" % (username, errmsg))
|
||||||
self._log_con_handler.acquire() # lock the console output
|
self._log_con_handler.acquire() # lock the console output
|
||||||
try:
|
try:
|
||||||
return getpass("Enter password for user '%s': " % username)
|
return getpass("Enter password for user '%s': " % username)
|
||||||
@ -106,8 +106,8 @@ class TTYUI(UIBase):
|
|||||||
'abort', ie a request to sync immediately."""
|
'abort', ie a request to sync immediately."""
|
||||||
|
|
||||||
if sleepsecs > 0:
|
if sleepsecs > 0:
|
||||||
if remainingsecs//60 != (remainingsecs-sleepsecs)//60:
|
if remainingsecs // 60 != (remainingsecs - sleepsecs) // 60:
|
||||||
self.logger.info("Next refresh in %.1f minutes" % (
|
self.logger.info("Next refresh in %.1f minutes" % (
|
||||||
remainingsecs/60.0))
|
remainingsecs / 60.0))
|
||||||
time.sleep(sleepsecs)
|
time.sleep(sleepsecs)
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user