From c40cd463558f172e9b0be9ed3e30164ad8b09818 Mon Sep 17 00:00:00 2001 From: kiblik Date: Tue, 30 Apr 2024 13:07:20 +0200 Subject: [PATCH] (fix)semver: SyntaxWarning: invalid escape sequence --- yamale/validators/validators.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yamale/validators/validators.py b/yamale/validators/validators.py index 026e540..03259d9 100644 --- a/yamale/validators/validators.py +++ b/yamale/validators/validators.py @@ -243,8 +243,8 @@ class Mac(Regex): def __init__(self, *args, **kwargs): super(Mac, self).__init__(*args, **kwargs) self.regexes = [ - re.compile("[0-9a-fA-F]{2}([-:]?)[0-9a-fA-F]{2}(\\1[0-9a-fA-F]{2}){4}$"), - re.compile("[0-9a-fA-F]{4}([-:]?)[0-9a-fA-F]{4}(\\1[0-9a-fA-F]{4})$"), + re.compile(r"[0-9a-fA-F]{2}([-:]?)[0-9a-fA-F]{2}(\\1[0-9a-fA-F]{2}){4}$"), + re.compile(r"[0-9a-fA-F]{4}([-:]?)[0-9a-fA-F]{4}(\\1[0-9a-fA-F]{4})$"), ] @@ -257,7 +257,7 @@ def __init__(self, *args, **kwargs): super(SemVer, self).__init__(*args, **kwargs) self.regexes = [ # https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string - re.compile("^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"), + re.compile(r"^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"), ]