From f5e9472f6002dc2dfdaf1b08b3fa572fd983de0c Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:58:50 -0700 Subject: [PATCH] =?UTF-8?q?Revert=20"=F0=9F=9A=A7=20figure=20out=20why=20t?= =?UTF-8?q?his=20breaks=20tests"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6581f104e980b6f9e2e038b09b22217ad4da4d18. --- augur/argparse_.py | 6 +++++- augur/curate/__init__.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/augur/argparse_.py b/augur/argparse_.py index d979b1acf..ac1861ccb 100644 --- a/augur/argparse_.py +++ b/augur/argparse_.py @@ -33,7 +33,7 @@ def run(args): parser.set_defaults(__command__ = default_command) -def register_commands(parser: argparse.ArgumentParser, commands): +def register_commands(parser: argparse.ArgumentParser, commands, command_attribute='__command__'): """ Add subparsers for each command module. @@ -56,6 +56,10 @@ def register_commands(parser: argparse.ArgumentParser, commands): # Allow each command to register its own subparser subparser = command.register_parser(subparsers) + # Add default attribute for command module + if command_attribute: + subparser.set_defaults(**{command_attribute: command}) + # Ensure all subparsers format like the top-level parser subparser.formatter_class = parser.formatter_class diff --git a/augur/curate/__init__.py b/augur/curate/__init__.py index 2b21ead8f..6b92b58f2 100644 --- a/augur/curate/__init__.py +++ b/augur/curate/__init__.py @@ -4,6 +4,7 @@ from . import format_dates, normalize_strings, passthru, titlecase, apply_geolocation_rules, apply_record_annotations, abbreviate_authors, parse_genbank_location, transform_strain_name, rename +SUBCOMMAND_ATTRIBUTE = '_curate_subcommand' SUBCOMMANDS = [ passthru, normalize_strings,