From 5ce6cf8425bb58260bd85c011e2728b1789860ca Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 21 Jun 2021 22:11:19 -0700 Subject: [PATCH] Migrate scripts to vlogging.main_decorator. --- adb_install.py | 3 +-- bitwise_or.py | 3 +-- contentreplace.py | 3 +-- fdroidapk.py | 2 +- ffstreams.py | 3 +-- hash_hardlink.py | 3 +-- heresmyclipboard.py | 3 +-- internetcheck.py | 3 +-- rarpar.py | 2 +- reserve_disk_space.py | 3 +-- resize.py | 3 +-- rotate.py | 3 +-- sole_subdir_lift.py | 3 +-- stderr.py | 3 +-- stdout.py | 3 +-- stitch.py | 3 +-- 16 files changed, 16 insertions(+), 30 deletions(-) diff --git a/adb_install.py b/adb_install.py index 89acd7a..c216460 100644 --- a/adb_install.py +++ b/adb_install.py @@ -46,9 +46,8 @@ def adbinstall_argparse(args): log.info(command) os.system(command) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('apks', nargs='+') diff --git a/bitwise_or.py b/bitwise_or.py index a629b71..e456ce4 100644 --- a/bitwise_or.py +++ b/bitwise_or.py @@ -63,9 +63,8 @@ def bitwise_or_argparse(args): output_handle.write(chunk.to_bytes(length, 'big')) pipeable.stdout(output.absolute_path) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('files', nargs='+') diff --git a/contentreplace.py b/contentreplace.py index 13eae9b..786e968 100644 --- a/contentreplace.py +++ b/contentreplace.py @@ -74,9 +74,8 @@ def contentreplace_argparse(args): except UnicodeDecodeError: log.error('%s encountered unicode decode error.', file.absolute_path) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('filename_glob') diff --git a/fdroidapk.py b/fdroidapk.py index 396be3f..78dc80a 100644 --- a/fdroidapk.py +++ b/fdroidapk.py @@ -116,8 +116,8 @@ def fpk_argparse(args): return return_status +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) (notify_context, argv) = operatornotify.main_log_context(argv, subject='fdroidapk warnings') parser = argparse.ArgumentParser(description=__doc__) diff --git a/ffstreams.py b/ffstreams.py index a3373ec..2794bbd 100644 --- a/ffstreams.py +++ b/ffstreams.py @@ -131,9 +131,8 @@ def ffstreams_argparse(args): moveto=args.moveto, ) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('input_filename', nargs='+') parser.add_argument('--moveto', default=None) diff --git a/hash_hardlink.py b/hash_hardlink.py index cea24f1..e3d7863 100644 --- a/hash_hardlink.py +++ b/hash_hardlink.py @@ -65,9 +65,8 @@ def hash_hardlink_argparse(args): send2trash.send2trash(follower.absolute_path) os.link(leader.absolute_path, follower.absolute_path) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('paths', nargs='+') diff --git a/heresmyclipboard.py b/heresmyclipboard.py index bbc5df9..2f5796a 100644 --- a/heresmyclipboard.py +++ b/heresmyclipboard.py @@ -29,9 +29,8 @@ def heresmyclipboard_argparse(args): log.info(f'Starting server on port {args.port}, pid={os.getpid()}') site.run(host='0.0.0.0', port=args.port) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('port', nargs='?', type=int, default=4848) diff --git a/internetcheck.py b/internetcheck.py index 2165cdc..42de385 100644 --- a/internetcheck.py +++ b/internetcheck.py @@ -148,9 +148,8 @@ def check_forever(): else: time.sleep(20) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - try: check_forever() except KeyboardInterrupt: diff --git a/rarpar.py b/rarpar.py index 70463ac..176fa0a 100644 --- a/rarpar.py +++ b/rarpar.py @@ -527,8 +527,8 @@ def rarpar_argparse(args): return status +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) (notify_context, argv) = operatornotify.main_log_context(argv, subject='rarpar warnings') parser = argparse.ArgumentParser(description=__doc__) diff --git a/reserve_disk_space.py b/reserve_disk_space.py index ae902a6..394bd04 100644 --- a/reserve_disk_space.py +++ b/reserve_disk_space.py @@ -56,9 +56,8 @@ def reserve_disk_space_argparse(args): log.fatal('Only %s available out of %s.', free, reserve) return 1 +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('reserve') diff --git a/resize.py b/resize.py index 9f48c31..ceba1c1 100644 --- a/resize.py +++ b/resize.py @@ -84,9 +84,8 @@ def resize_argparse(args): quality=args.quality, ) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('pattern') diff --git a/rotate.py b/rotate.py index 12c4a1b..9971c03 100644 --- a/rotate.py +++ b/rotate.py @@ -41,9 +41,8 @@ def rotate_argparse(args): pipeable.stdout(newname) image.save(newname, exif=exif, quality=args.quality) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('pattern') diff --git a/sole_subdir_lift.py b/sole_subdir_lift.py index 94ebde8..1aa5187 100644 --- a/sole_subdir_lift.py +++ b/sole_subdir_lift.py @@ -55,9 +55,8 @@ def sole_lift_argparse(args): os.rmdir(temp_dir.absolute_path) queue.append(directory.parent) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('starting', nargs='?', default='.') diff --git a/stderr.py b/stderr.py index 2ed45f3..f517b96 100644 --- a/stderr.py +++ b/stderr.py @@ -12,9 +12,8 @@ def printstderr_argparse(args): for line in text: pipeable.stderr(line) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('texts', nargs='+') diff --git a/stdout.py b/stdout.py index 839c855..11713e3 100644 --- a/stdout.py +++ b/stdout.py @@ -12,9 +12,8 @@ def printstdout_argparse(args): for line in text: pipeable.stdout(line) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('texts', nargs='+') diff --git a/stitch.py b/stitch.py index 765f1f1..57e3eba 100644 --- a/stitch.py +++ b/stitch.py @@ -43,9 +43,8 @@ def stitch_argparse(args): log.info(args.output) final_image.save(args.output) +@vlogging.main_decorator def main(argv): - argv = vlogging.main_level_by_argv(argv) - parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('image_files', nargs='+')