From a3b20cbb17c4c18f5dd95c43e6619736e5dbda62 Mon Sep 17 00:00:00 2001 From: shockrah Date: Sat, 22 Aug 2020 18:09:13 -0700 Subject: [PATCH] reduced code clutter --- invites-manager/invites-routine.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/invites-manager/invites-routine.py b/invites-manager/invites-routine.py index fb9dd36..867fa98 100644 --- a/invites-manager/invites-routine.py +++ b/invites-manager/invites-routine.py @@ -5,10 +5,7 @@ import mysql.connector as mysql from os import getenv import time, sys -code_name = 'INVITES_MANAGER' - def remove_old(config): - global code_name ''' Removes invites that are out of date ''' @@ -22,11 +19,10 @@ def remove_old(config): cursor.close() conn.close() - print(f'[ {code_name} ] : Removed old invites with no errors') + print(f'[ {__file__} ] : Removed old invites with no errors') if __name__ == '__main__': - fail = False config = { 'database': getenv('DATABASE_NAME'), 'password': getenv('DATABASE_PASS'), @@ -36,11 +32,7 @@ if __name__ == '__main__': } for k in config: if config[k] is None: - print(f'[ {code_name} ] : {k} not set', file=sys.stderr) - fail = True - - - if not fail: - remove_old(config) + print(f'[ {__file__} ] : {k} not set', file=sys.stderr) else: - exit(1) + remove_old(config) +