Some flake8 issues with the fetchmail script

master
Pierre Jaury 8 years ago
parent 508a2a7516
commit f1be8d7fd5

@ -23,6 +23,7 @@ poll "{host}" proto {protocol} port {port}
sslproto 'AUTO' sslproto 'AUTO'
""" """
def escape_rc_string(arg): def escape_rc_string(arg):
return arg.replace("\\", "\\\\").replace('"', '\\"') return arg.replace("\\", "\\\\").replace('"', '\\"')
@ -66,11 +67,11 @@ def run(connection, cursor, keep, debug):
# No mail is not an error # No mail is not an error
if not error_message.startswith("fetchmail: No mail"): if not error_message.startswith("fetchmail: No mail"):
print(error_message) print(error_message)
user_info = "for %s at %s" % (user_email, host) user_info = "for %s at %s" % (user_email, host)
# Number of messages seen is not a error as well # Number of messages seen is not a error as well
if "messages" in error_message and "(seen " in error_message and \ if ("messages" in error_message and
user_info in error_message: "(seen " in error_message and
user_info in error_message):
print(error_message) print(error_message)
finally: finally:
cursor.execute(""" cursor.execute("""
@ -80,7 +81,6 @@ def run(connection, cursor, keep, debug):
connection.commit() connection.commit()
if __name__ == "__main__": if __name__ == "__main__":
debug = os.environ.get("DEBUG", None) == "True" debug = os.environ.get("DEBUG", None) == "True"
keep = os.environ.get("FETCHMAIL_KEEP", None) == "True" keep = os.environ.get("FETCHMAIL_KEEP", None) == "True"
@ -91,4 +91,3 @@ if __name__ == "__main__":
run(connection, cursor, keep, debug) run(connection, cursor, keep, debug)
cursor.close() cursor.close()
time.sleep(int(os.environ.get("FETCHMAIL_DELAY", 60))) time.sleep(int(os.environ.get("FETCHMAIL_DELAY", 60)))

Loading…
Cancel
Save