Skip to content

Commit

Permalink
Allow validating if given a partial version_strimg is valid.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pjrm committed Jul 7, 2019
1 parent fdef1e9 commit d894ae5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions semantic_version/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=partial)
return True
except ValueError:
return False

0 comments on commit d894ae5

Please sign in to comment.