magpie.compat¶
Classes¶
This class abstracts handling of a project's versions. |
Module Contents¶
- class magpie.compat.LooseVersion(version: str)[source]¶
Bases:
packaging.version.Version
,VersionInterface
This class abstracts handling of a project’s versions.
A
Version
instance is comparison aware and can be compared and sorted using the standard Python interfaces.>>> v1 = Version("1.0a5") >>> v2 = Version("1.0") >>> v1 <Version('1.0a5')> >>> v2 <Version('1.0')> >>> v1 < v2 True >>> v1 == v2 False >>> v1 > v2 False >>> v1 >= v2 False >>> v1 <= v2 True
Initialize a Version object.
- Parameters:
version – The string representation of a version which will be parsed and normalized before use.
- Raises:
InvalidVersion – If the
version
does not conform to PEP 440 in any way then this exception will be raised.
- _cmp(other: LooseVersion | str) int [source]¶