Re: [PATCH v2 03/25] moveconfig: Use re.fullmatch() to avoid extra check
On 24/02/2022 02:00, Simon Glass wrote: > Simplify the code by using the available function. > > Signed-off-by: Simon Glass > --- > > Changes in v2: > - Add new patch to use re.fullmatch() to avoid extra check > > tools/moveconfig.py | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Alper Nebi Yasak > diff --git a/tools/moveconfig.py b/tools/moveconfig.py > index dea60f4661..4b0e2e250b 100755 > --- a/tools/moveconfig.py > +++ b/tools/moveconfig.py > @@ -1610,8 +1610,8 @@ 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): > +m_cfg = re_match.fullmatch(cfg) > +if m_cfg: Could skip the variable entirely. > return True > return False >
[PATCH v2 03/25] moveconfig: Use re.fullmatch() to avoid extra check
Simplify the code by using the available function. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to use re.fullmatch() to avoid extra check tools/moveconfig.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index dea60f4661..4b0e2e250b 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -1610,8 +1610,8 @@ 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): +m_cfg = re_match.fullmatch(cfg) +if m_cfg: return True return False -- 2.35.1.574.g5d30c73bfb-goog