From 794d3890a8f81e1e0ef66f07aaf4df2f8b2f9698 Mon Sep 17 00:00:00 2001 From: lixintao Date: Thu, 27 Jun 2024 11:04:05 +0800 Subject: [PATCH] Optimize the format of the code, check the list None before use Signed-off-by: lixintao --- avocado/core/nrunner/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/avocado/core/nrunner/app.py b/avocado/core/nrunner/app.py index c8ee4c1556..04ed069755 100644 --- a/avocado/core/nrunner/app.py +++ b/avocado/core/nrunner/app.py @@ -153,9 +153,9 @@ def _setup_parser(self, prog, description): def _get_commands_method(self): prefix = "command_" return { - c[0][len(prefix) :].replace("_", "-"): getattr(self, c[0]) + c[0][len(prefix):].replace("_", "-"): getattr(self, c[0]) for c in inspect.getmembers(self, inspect.ismethod) - if c[0].startswith(prefix) + if c and c[0].startswith(prefix) } @staticmethod