From 348f71ba69243fcfbcd5422be0857015465a8bfb Mon Sep 17 00:00:00 2001 From: Roxi Dittberner Date: Wed, 4 Mar 2026 12:13:17 +0100 Subject: [PATCH] Reformatted DataPuller.py --- DataPuller.py | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/DataPuller.py b/DataPuller.py index 837e5c1..28428e9 100644 --- a/DataPuller.py +++ b/DataPuller.py @@ -7,14 +7,15 @@ import filecmp # Argument Parsing parser = argparse.ArgumentParser( - prog='DataPuller', - description='Check differences between folders and update files if needed') + prog="DataPuller", + description="Check differences between folders and update files if needed", +) -parser.add_argument('-i', '--input') -parser.add_argument('-o', '--output') -parser.add_argument('-q', '--quiet', action='store_true') -parser.add_argument('-y', '--confirm', action="store_true") -parser.add_argument('-d', '--delete', action="store_true") +parser.add_argument("-i", "--input") +parser.add_argument("-o", "--output") +parser.add_argument("-q", "--quiet", action="store_true") +parser.add_argument("-y", "--confirm", action="store_true") +parser.add_argument("-d", "--delete", action="store_true") parser.add_argument("--dryrun", action="store_true") args = parser.parse_args() @@ -29,6 +30,7 @@ if not args.output: else: outpath = args.output + def get_files(path): file_info = {} if not os.path.exists(path): @@ -48,10 +50,13 @@ def get_files(path): pass return file_info + def main(): startstring = " FOLDER-SYNC 1.0 " if not args.quiet: - print(len(startstring)*"=" + "\n" + startstring + "\n" + len(startstring)*"=") + print( + len(startstring) * "=" + "\n" + startstring + "\n" + len(startstring) * "=" + ) # Test Folder availability if not os.path.exists((inpath)): @@ -116,7 +121,9 @@ def main(): if args.confirm: copy_confirm = "y" else: - copy_confirm = input("Write new and changed files? (y/N): ").strip().lower() + copy_confirm = ( + input("Write new and changed files? (y/N): ").strip().lower() + ) if copy_confirm in ["ja", "j", "yes", "y"]: if not args.quiet: print("\nCopying files...") @@ -135,7 +142,12 @@ def main(): except Exception as error: print(f"Failed to copy {path} with error {error}") if not args.confirm: - if not input("Continue? (y/N): ") in ["ja", "j", "yes", "y"]: + if not input("Continue? (y/N): ") in [ + "ja", + "j", + "yes", + "y", + ]: exit(1) elif not args.quiet: print("\nSkipping changes...") @@ -149,7 +161,9 @@ def main(): if args.delete: delete_confirm = "y" else: - delete_confirm = input("Delete files on the target? (y/N): ").strip().lower() + delete_confirm = ( + input("Delete files on the target? (y/N): ").strip().lower() + ) if delete_confirm in ["ja", "j", "yes", "y"]: if not args.quiet: print("\nDeleting files...") @@ -162,7 +176,12 @@ def main(): except Exception as error: print(f"Failed to delete {path} with error {error}") if not args.confirm: - if not input("Continue? (y/N): ") in ["ja", "j", "yes", "y"]: + if not input("Continue? (y/N): ") in [ + "ja", + "j", + "yes", + "y", + ]: exit(1) elif not args.quiet: print("\nSkipping deletion...") @@ -172,6 +191,5 @@ def main(): input("\nPress ENTER to exit...") - if __name__ == "__main__": main()