Adopt Python >= 3.8 assignment expressions using auto-walrus (#7737)

* Adopt Python >= 3.8 assignment expressions using auto-walrus

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Christian Clauss
2022-10-28 15:54:54 +02:00
committed by GitHub
parent 15c93e5f4b
commit 19bff003aa
7 changed files with 642 additions and 639 deletions

View File

@ -20,8 +20,7 @@ def indian_phone_validator(phone: str) -> bool:
True
"""
pat = re.compile(r"^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$")
match = re.search(pat, phone)
if match:
if match := re.search(pat, phone):
return match.string == phone
return False