jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/615567 )
Change subject: [IMPR] Simplify bot.handle_args() function ......................................................................
[IMPR] Simplify bot.handle_args() function
Change-Id: I5d80c2fa29cfa51752271d2ca68dc78f69400a3a --- M pywikibot/bot.py 1 file changed, 6 insertions(+), 10 deletions(-)
Approvals: Matěj Suchánek: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py index 2c3e105..70b2b14 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -807,17 +807,16 @@ # it's the version in pywikibot.__init__ that is changed by scripts, # not the one in pywikibot.bot. args = pywikibot.argvu[1:] + # get the name of the module calling this function. This is # required because the -help option loads the module's docstring and # because the module name will be used for the filename of the log. - module_name = calledModuleName() - if not module_name: - module_name = 'terminal-interface' + module_name = calledModuleName() or 'terminal-interface' non_global_args = [] username = None do_help = None if do_help else False for arg in args: - option, sep, value = arg.partition(':') + option, _, value = arg.partition(':') if do_help is not False and option == '-help': do_help = True elif option == '-dir': @@ -871,15 +870,12 @@ elif option == '-debug': if module_name not in config.log: config.log.append(module_name) - if value: - if value not in config.debug_log: - config.debug_log.append(value) - elif '' not in config.debug_log: - config.debug_log.append('') + if value not in config.debug_log: + config.debug_log.append(value) # may be empty string elif option in ('-verbose', '-v'): config.verbose_output += 1 elif option == '-daemonize': - redirect_std = value if value else None + redirect_std = value or None daemonize.daemonize(redirect_std=redirect_std) else: # the argument depends on numerical config settings
pywikibot-commits@lists.wikimedia.org