Skip to content

Commit

Permalink
Ensure that VersionRange is immutable and hashable
Browse files Browse the repository at this point in the history
See #20
We now ensure that a `version_constraints` attribute is a tuple 

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
  • Loading branch information
pombredanne authored Jan 10, 2022
1 parent ca2cf4d commit 6d47bdf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/univers/version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class VersionRange:

# A list of lists of VersionConstraint that are signposts on the versions
# timeline
constraints = attr.ib(type=list, default=attr.Factory(list))
constraints = attr.ib(type=tuple, converter=tuple, default=attr.Factory(tuple))

def __attrs_post_init__(self, *args, **kwargs):
self.constraints.sort()
Expand Down

0 comments on commit 6d47bdf

Please sign in to comment.