From 54201439cb7e1ebb743dbdfabead50f592424bd2 Mon Sep 17 00:00:00 2001 From: morales-gregorio Date: Mon, 26 Aug 2024 12:00:16 +0200 Subject: [PATCH] capitalize global variable --- auth.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/auth.py b/auth.py index aed1472..1559a08 100644 --- a/auth.py +++ b/auth.py @@ -2,7 +2,7 @@ import json import sys from getpass import getpass -pwdb_path = 'pwdb.json' +PWDB_PATH = 'pwdb.json' def get_credentials(): username = input('Enter your username: ') @@ -16,26 +16,26 @@ def add_user(username, pwdb): pwdb[username] = input(f'Enter password for {username}: ') return pwdb -def read_pwdb(pwdb_path): +def read_pwdb(PWDB_PATH): try: - pwdb_file = open(pwdb_path, 'rt') + pwdb_file = open(PWDB_PATH, 'rt') pwdb = json.load(pwdb_file) except Exception: pwdb = {} return pwdb -def write_pwdb(pwdb, pwdb_path): - pwdb_file = open(pwdb_path, 'wt') +def write_pwdb(pwdb, PWDB_PATH): + pwdb_file = open(PWDB_PATH, 'wt') json.dump(pwdb, pwdb_file) if __name__ == "__main__": - pwdb_path = 'pwdb.json' - pwdb = read_pwdb(pwdb_path) + PWDB_PATH = 'pwdb.json' + pwdb = read_pwdb(PWDB_PATH) if len(sys.argv) > 1: pwdb = add_user(sys.argv[1], pwdb) - write_pwdb(pwdb, pwdb_path) + write_pwdb(pwdb, PWDB_PATH) else: username, password = get_credentials() if username not in pwdb: