Message ID | 20220223230040.159317-4-sjg@chromium.org |
---|---|
State | Superseded |
Delegated to: | Simon Glass |
Headers | show |
Series | binman: rockchip: Migrate from rockchip SPL_FIT_GENERATOR script | expand |
On 24/02/2022 02:00, Simon Glass wrote: > Simplify the code by using the available function. > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > > 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 <alpernebiyasak@gmail.com> > 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 >
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
Simplify the code by using the available function. Signed-off-by: Simon Glass <sjg@chromium.org> --- 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(-)