From 3c4b66e8490c6fdf93fb8fee735d52c76eb2853b Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Wed, 19 Feb 2025 03:22:26 +0000 Subject: remove annoying comments for better readability of code --- cli.py | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'cli.py') diff --git a/cli.py b/cli.py index d19c18d..c03ffd1 100644 --- a/cli.py +++ b/cli.py @@ -7,7 +7,6 @@ from obfuscator.csv_writer import create_byte_stream def main(): - # Create an argument parser parser = argparse.ArgumentParser( prog="GDPR-Obfuscator", description="Obfuscate sensitive data stored locally or in an AWS environment", @@ -17,16 +16,10 @@ def main(): "-v", "--verbose", action="store_true", help="Enable verbose logging" ) - # Require user to either choose a local file or an S3 object - # The user can only choose one of these options or the program will exit - # If not provided, the program will exit loc = parser.add_mutually_exclusive_group(required=True) loc.add_argument("-l", "--local", help="Local path to file") loc.add_argument("-s", "--s3", help="URI path to file stored in S3") - # Require user to provide a list of PII fields to obfuscate - # e.g. --pii name email_address - # If not provided, the program will exit parser.add_argument( "-p", "--pii", @@ -35,23 +28,17 @@ def main(): help="List of PII fields to obfuscate, separated by spaces", ) - # Parse the arguments args = parser.parse_args() - # If the user chose verbose logging, set the logger to debug log_level = "DEBUG" if args.verbose else "INFO" - # Create the logger logger = get_logger("CLI", log_level) - # Create the CSVReader object reader = CSVReader(log_level) - # 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") data = reader.read_local(args.local) - # For debug purposes, log the data read from the CSV logger.debug("Contents: " + str(data)) else: logger.debug("User chose to read CSV from S3") @@ -59,13 +46,10 @@ def main(): data = reader.read_s3(args.s3) 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("Obfuscated data (JSON): " + json.dumps(obfuscated_data, indent=4)) return create_byte_stream(obfuscated_data) -# If the script is run directly (as it should be), call the main function if __name__ == "__main__": main() -- cgit v1.2.3