versions
NamedTuple-like class to represent a version number.
New in version 0.4.4.
Classes:
|
NamedTuple-like class to represent a version number. |
-
namedtuple
Version
(major=0, minor=0, patch=0)[source] -
NamedTuple-like class to represent a version number.
- Fields
Changed in version 1.4.0: Implemented the same interface as a
collections.namedtuple()
.-
__ge__
(other)[source] Returns whether this version is greater than or equal to the other version.
- Return type
-
__le__
(other)[source] Returns whether this version is less than or equal to the other version.
- Return type
-
_asdict
()[source] Return a new dict which maps field names to their corresponding values.
New in version 1.4.0.
-
_field_defaults
= {'major': 0, 'minor': 0, 'patch': 0} -
Dictionary mapping field names to default values.
New in version 1.4.0.
-
_fields
= ('major', 'minor', 'patch') -
Tuple of strings listing the field names.
Useful for introspection and for creating new named tuple types from existing named tuples.
New in version 1.4.0.
-
classmethod
_make
(iterable)[source] Class method that makes a new instance from an existing sequence or iterable.
New in version 1.4.0.
-
_replace
(**kwargs)[source] Return a new instance of the named tuple replacing specified fields with new values.
New in version 1.4.0.
- Parameters
kwargs
- Return type
~_V
-
classmethod
from_tuple
(version_tuple)[source] Create a
Version
from atuple
.- Parameters
version_tuple (
Tuple
[Union
[int
,str
], …]) – The version number.- Return type
~_V
- Returns
The created
Version
.
Changed in version 0.9.0: Tuples with more than three elements are truncated. Previously a
TypeError
was raised.