From 0022dba517a82cf15477281d8d02e0d7da8dbbe1 Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Tue, 18 Feb 2025 21:21:31 +0000 Subject: create CSVReader object outside of args if statement --- cli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cli.py') diff --git a/cli.py b/cli.py index a4ab4c3..9d003a7 100644 --- a/cli.py +++ b/cli.py @@ -26,11 +26,12 @@ def main(): # Parse the arguments args = parser.parse_args() + # Create the CSVReader object + reader = CSVReader() + # Read the CSV data based on the user's choice of local or S3 if args.local and not args.s3: logger.debug("User chose to read CSV from local path") - # Create a CSVReader object and read the local CSV file - reader = CSVReader() data = reader.read_local(args.local) # For debug purposes, log the data read from the CSV logger.debug(data) -- cgit v1.2.3 From 125225291481a7e9d383c037dc8c0fc720de48cd Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Tue, 18 Feb 2025 22:08:55 +0000 Subject: read data from S3 object path and debug log contents --- cli.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cli.py') diff --git a/cli.py b/cli.py index 9d003a7..974ac3c 100644 --- a/cli.py +++ b/cli.py @@ -37,6 +37,8 @@ def main(): logger.debug(data) else: logger.debug("User chose to read CSV from S3") + data = reader.read_s3(args.s3) + logger.debug(data) # Obfuscate the data based on the user's choice of PII fields obfuscated_data = obfuscate(data, args.pii) -- cgit v1.2.3 From 5875763f8e384a50004c4dd8ea08598d68f251ed Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Tue, 18 Feb 2025 22:13:51 +0000 Subject: make debug log messages clearer in output --- cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cli.py') diff --git a/cli.py b/cli.py index 974ac3c..b1d4000 100644 --- a/cli.py +++ b/cli.py @@ -34,16 +34,16 @@ def main(): logger.debug("User chose to read CSV from local path") data = reader.read_local(args.local) # For debug purposes, log the data read from the CSV - logger.debug(data) + logger.debug("Contents: " + str(data)) else: logger.debug("User chose to read CSV from S3") data = reader.read_s3(args.s3) - logger.debug(data) + logger.debug("Contents: " + str(data)) # Obfuscate the data based on the user's choice of PII fields obfuscated_data = obfuscate(data, args.pii) # For debug purposes, log the obfuscated data as JSON for readability - logger.debug(json.dumps(obfuscated_data, indent=4)) + logger.debug("Obfuscated data (JSON): " + json.dumps(obfuscated_data, indent=4)) # If the script is run directly (as it should be), call the main function -- cgit v1.2.3