From c40cd463558f172e9b0be9ed3e30164ad8b09818 Mon Sep 17 00:00:00 2001 From: kiblik Date: Tue, 30 Apr 2024 13:07:20 +0200 Subject: [PATCH 1/2] (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-]+)*))?$"), ] From e13f6f5301eaa827aed910b4608306fef4c97bb0 Mon Sep 17 00:00:00 2001 From: kiblik Date: Tue, 30 Apr 2024 21:54:03 +0200 Subject: [PATCH 2/2] Fix regex for Mac --- yamale/validators/validators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yamale/validators/validators.py b/yamale/validators/validators.py index 03259d9..20fbb7a 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(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})$"), + 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})$"), ]