-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subclass semver for nginx #63
Conversation
a87b2b9
to
498c403
Compare
* Because nginx versions are not exactly semver. * Also add convenience properties to the semver version class to avoid leaking internals too much. Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
@@ -219,6 +219,64 @@ def is_valid(cls, string): | |||
except ValueError: | |||
return False | |||
|
|||
@property | |||
def major(self): | |||
return self.value and self.value.major |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice trick !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's more of an idiom to me! Though in earnest I am always split in abusing this shortcutting of "and" and "or" and their returning of a value as used here ... it can become hard to read unless used for very simple checks like this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Because nginx versions are not exactly semver.
Signed-off-by: Philippe Ombredanne pombredanne@nexb.com