1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Simplify regex filter code (#50202)

This was written when we were redefining `bool` in the same module. As
we aren't doing this any longer, simplify it back to just calling
`bool()`.
This commit is contained in:
Jim Rollenhagen 2019-02-03 15:10:16 -05:00 committed by ansibot
parent 89a1c68f98
commit 07605923e1

View file

@ -120,8 +120,7 @@ def regex(value='', pattern='', ignorecase=False, multiline=False, match_type='s
if multiline:
flags |= re.M
_re = re.compile(pattern, flags=flags)
_bool = __builtins__.get('bool')
return _bool(getattr(_re, match_type, 'search')(value))
return bool(getattr(_re, match_type, 'search')(value))
def match(value, pattern='', ignorecase=False, multiline=False):