VersionTuple¶
- class lsst.dax.apdb.VersionTuple(major: int, minor: int, patch: int)¶
Bases:
NamedTuple
Class representing a version number.
- Parameters:
- major, minor, patch
int
Version number components
- major, minor, patch
Attributes Summary
Alias for field number 0
Alias for field number 1
Alias for field number 2
Methods Summary
checkCompatibility
(database_version, update)Compare implementation schema version with schema version in database.
count
(value, /)Return number of occurrences of value.
fromString
(versionStr)Extract version number from a string.
index
(value[, start, stop])Return first index of value.
Attributes Documentation
Methods Documentation
- checkCompatibility(database_version: VersionTuple, update: bool) bool ¶
Compare implementation schema version with schema version in database.
- Parameters:
- database_version
VersionTuple
Version of the database schema.
- update
bool
If True then read-write access is expected.
- database_version
- Returns:
- compatible
bool
True if schema versions are compatible.
- compatible
Notes
This method implements default rules for checking schema compatibility:
if major numbers differ, schemas are not compatible;
otherwise, if minor versions are different then newer version can read schema made by older version, but cannot write into it; older version can neither read nor write into newer schema;
otherwise, different patch versions are totally compatible.
- count(value, /)¶
Return number of occurrences of value.
- classmethod fromString(versionStr: str) VersionTuple ¶
Extract version number from a string.
- Parameters:
- versionStr
str
Version number in string form “X.Y.Z”, all components must be present.
- versionStr
- Returns:
- version
VersionTuple
Parsed version tuple.
- version
- Raises:
- ValueError
Raised if string has an invalid format.
- index(value, start=0, stop=sys.maxsize, /)¶
Return first index of value.
Raises ValueError if the value is not present.