[PATCH v3 03/26] moveconfig: Use re.fullmatch() to avoid extra check

Simon Glass sjg at chromium.org
Sun Mar 6 04:18:54 CET 2022


Simplify the code by using the available function.

Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak at gmail.com>
---

Changes in v3:
- Drop unnecessary variable

Changes in v2:
- Add new patch to use re.fullmatch() to avoid extra check

 tools/moveconfig.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index ecc6e16c6c..84bc875fff 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -1607,8 +1607,7 @@ def defconfig_matches(configs, re_match):
         bool: True if any CONFIG matches the regex
     """
     for cfg in configs:
-        m_cfg = re_match.match(cfg)
-        if m_cfg and m_cfg.span()[1] == len(cfg):
+        if re_match.fullmatch(cfg):
             return True
     return False
 
-- 
2.35.1.616.g0bdcbb4464-goog



More information about the U-Boot mailing list