aboutsummaryrefslogtreecommitdiffstats
path: root/cli.py
diff options
context:
space:
mode:
authorAlex Schofield <git@ajschof.me>2025-02-19 03:22:26 +0000
committerAlex Schofield <git@ajschof.me>2025-02-19 03:22:26 +0000
commit3c4b66e8490c6fdf93fb8fee735d52c76eb2853b (patch)
tree67f3d2c401b4b0e77d18f259ba2d788f1fcfcd84 /cli.py
parentef05a027ffbf8bbee89bb031ccd6152de49762c6 (diff)
downloadgdpr-obfuscator-3c4b66e8490c6fdf93fb8fee735d52c76eb2853b.tar.gz
gdpr-obfuscator-3c4b66e8490c6fdf93fb8fee735d52c76eb2853b.zip
remove annoying comments for better readability of code
Diffstat (limited to 'cli.py')
-rw-r--r--cli.py16
1 files changed, 0 insertions, 16 deletions
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()
git.ajschof.me — hosted by ajschofield — powered by cgit