From 8f7f7bf276a1372a2e83021d4af766b774cf7352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Magalh=C3=A3es?= Date: Sun, 7 Jul 2019 21:50:13 +0100 Subject: [PATCH] Allow validating if given a partial version_strimg is valid. This change will add an argument on function validate, that allows to verify if given a version_string it's valid on a partial way. --- semantic_version/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/semantic_version/base.py b/semantic_version/base.py index 4ddaf05..428f685 100644 --- a/semantic_version/base.py +++ b/semantic_version/base.py @@ -560,10 +560,10 @@ def match(spec, version): return Spec(spec).match(Version(version)) -def validate(version_string): - """Validates a version string againt the SemVer specification.""" +def validate(version_string, partial=False): + """Validates a version string against the SemVer specification.""" try: - Version.parse(version_string) + Version.parse(version_string, partial) return True except ValueError: return False