From 2aa6201d478eec51b83fec6fa4e523297198e461 Mon Sep 17 00:00:00 2001 From: derAnfaenger Date: Fri, 1 Sep 2017 12:02:31 +0200 Subject: [PATCH] zulip_bot_output.py: Rename options to args. --- zulip_bots/zulip_bots/zulip_bot_output.py | 34 +++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/zulip_bots/zulip_bots/zulip_bot_output.py b/zulip_bots/zulip_bots/zulip_bot_output.py index fc447e8..7fc6c6b 100644 --- a/zulip_bots/zulip_bots/zulip_bot_output.py +++ b/zulip_bots/zulip_bots/zulip_bot_output.py @@ -51,9 +51,9 @@ def parse_args(): action='store_true', help='Install dependencies for the bot.') - options = parser.parse_args() + args = parser.parse_args() - if not options.name and not options.path_to_bot: + if not args.name and not args.path_to_bot: error_message = """ You must either specify the name of an existing bot or specify a path to the file (--path-to-bot) that contains @@ -64,33 +64,33 @@ the bot handler class. # checks if both of these are in sync, otherwise we'll # have to be bias towards one and the user may get incorrect # result. - elif not name_and_path_match(options.name, options.path_to_bot): + elif not name_and_path_match(args.name, args.path_to_bot): error_message = """ Please make sure that the given name of the bot and the given path to the bot are same and valid. """ parser.error(error_message) - return options + return args def main(): # type: () -> None - options = parse_args() - bot_name = options.name - if options.path_to_bot: - if options.provision: - bot_dir = os.path.dirname(os.path.abspath(options.path_to_bot)) - provision_bot(bot_dir, options.force) - lib_module = import_module_from_source(options.path_to_bot, name=bot_name) - elif options.name: - if options.provision: + args = parse_args() + bot_name = args.name + if args.path_to_bot: + if args.provision: + bot_dir = os.path.dirname(os.path.abspath(args.path_to_bot)) + provision_bot(bot_dir, args.force) + lib_module = import_module_from_source(args.path_to_bot, name=bot_name) + elif args.name: + if args.provision: current_dir = os.path.dirname(os.path.abspath(__file__)) bots_parent_dir = os.path.join(current_dir, "bots") - bot_dir = os.path.join(bots_parent_dir, options.name) - provision_bot(bot_dir, options.force) + bot_dir = os.path.join(bots_parent_dir, args.name) + provision_bot(bot_dir, args.force) lib_module = import_module('zulip_bots.bots.{bot}.{bot}'.format(bot=bot_name)) - message = {'content': options.message, 'sender_email': 'foo_sender@zulip.com'} + message = {'content': args.message, 'sender_email': 'foo_sender@zulip.com'} message_handler = lib_module.handler_class() with patch('zulip_bots.lib.ExternalBotHandler') as mock_bot_handler: @@ -120,7 +120,7 @@ def main(): bot_handler=mock_bot_handler, state_handler=StateHandler() ) - print("On sending ", options.name, " bot the following message:\n\"", options.message, "\"") + print("On sending ", args.name, " bot the following message:\n\"", args.message, "\"") # send_reply and send_message have slightly arguments; the # following takes that into account.