bschoening commented on code in PR #1273:
URL:
https://github.com/apache/cassandra-python-driver/pull/1273#discussion_r2908072247
##########
cassandra/util.py:
##########
@@ -1692,57 +1692,53 @@ def __repr__(self):
self.lower_bound, self.upper_bound, self.value
)
+VERSION_REGEX =
re.compile("^(\\d+)\\.(\\d+)(\\.\\d+)?(\\.\\d+)?([~\\-]\\w[.\\w]*(?:-\\w[.\\w]*)*)?(\\+[.\\w]+)?$")
@total_ordering
class Version(object):
"""
- Internal minimalist class to compare versions.
- A valid version is: <int>.<int>.<int>.<int or str>.
-
- TODO: when python2 support is removed, use packaging.version.
+ Representation of a Cassandra version. Mostly follows the implementation
of the same logic in the Java driver;
+ see
https://github.com/apache/cassandra-java-driver/blob/4.19.2/core/src/main/java/com/datastax/oss/driver/api/core/Version.java
Review Comment:
should this be 'trunk' instead of 4.19.2?
##########
cassandra/util.py:
##########
@@ -1757,48 +1753,27 @@ def __repr__(self):
def __str__(self):
return self._version
- @staticmethod
- def _compare_version_part(version, other_version, cmp):
- if not (isinstance(version, int) and
- isinstance(other_version, int)):
- version = str(version)
- other_version = str(other_version)
-
- return cmp(version, other_version)
-
+ # Methods below leverage the fact that Tuples are compared position by
position from left to right
Review Comment:
suggest just a slightly simpler rewording
# Methods below leverage Tuples positional comparison left to right
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]