Returns True if other_version matches. Args: other_version: string, of the form "x[.y[.x]]" where {x,y,z} can be a number or a wildcard.
(self, other_version)
| 215 | return hash(self.tuple) |
| 216 | |
| 217 | def match(self, other_version) -> bool: |
| 218 | """Returns True if other_version matches. |
| 219 | |
| 220 | Args: |
| 221 | other_version: string, of the form "x[.y[.x]]" where {x,y,z} can be a |
| 222 | number or a wildcard. |
| 223 | """ |
| 224 | major, minor, patch = _str_to_version(other_version, allow_wildcard=True) |
| 225 | return ( |
| 226 | major in [self.major, "*"] |
| 227 | and minor in [self.minor, "*"] |
| 228 | and patch in [self.patch, "*"] |
| 229 | ) |
| 230 | |
| 231 | @classmethod |
| 232 | def is_valid(cls, version: VersionOrStr | None) -> bool: |