From f1be8d7fd5e00821649a7731095281e452543de4 Mon Sep 17 00:00:00 2001 From: Pierre Jaury Date: Fri, 2 Dec 2016 10:57:17 +0100 Subject: [PATCH] Some flake8 issues with the fetchmail script --- fetchmail/fetchmail.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/fetchmail/fetchmail.py b/fetchmail/fetchmail.py index 3a460fb5..f6453825 100755 --- a/fetchmail/fetchmail.py +++ b/fetchmail/fetchmail.py @@ -23,6 +23,7 @@ poll "{host}" proto {protocol} port {port} sslproto 'AUTO' """ + def escape_rc_string(arg): return arg.replace("\\", "\\\\").replace('"', '\\"') @@ -57,21 +58,21 @@ def run(connection, cursor, keep, debug): options=options ) if debug: - print( fetchmailrc ) + print(fetchmailrc) try: - print( fetchmail( fetchmailrc ) ) + print(fetchmail(fetchmailrc)) error_message = "" except subprocess.CalledProcessError as error: - error_message = error.output.decode( "utf8" ) + error_message = error.output.decode("utf8") # No mail is not an error if not error_message.startswith("fetchmail: No mail"): - print( error_message ) - - user_info = "for %s at %s" % ( user_email, host ) + print(error_message) + user_info = "for %s at %s" % (user_email, host) # Number of messages seen is not a error as well - if "messages" in error_message and "(seen " in error_message and \ - user_info in error_message: - print( error_message ) + if ("messages" in error_message and + "(seen " in error_message and + user_info in error_message): + print(error_message) finally: cursor.execute(""" UPDATE fetch SET error=?, last_check=datetime('now') @@ -80,7 +81,6 @@ def run(connection, cursor, keep, debug): connection.commit() - if __name__ == "__main__": debug = os.environ.get("DEBUG", None) == "True" keep = os.environ.get("FETCHMAIL_KEEP", None) == "True" @@ -91,4 +91,3 @@ if __name__ == "__main__": run(connection, cursor, keep, debug) cursor.close() time.sleep(int(os.environ.get("FETCHMAIL_DELAY", 60))) -