class documentation

class KernelVersion:

View In Hierarchy

The version of the kernel.

A kernel version has at least a major and minor version numbers, and optionally a patch version number.

On Windows, the patch version is the build number.

Its string representation may contain additional information, such as the versioning suffix.

Note that a kernel version does not necessarily match with the "brand version" of the OS, e.g. Windows 7 has kernel version 6.1.

Method __eq__ Compares the instance for equality with an object.
Method __init__ Returns an instance of this type from the major, minor, patch and version string.
Method __repr__ Returns the "official" string representation of this instance.
Method __str__ Returns the nicely printable string representation of this instance.
Method matches Compare the components of this instance with the non-None components of the other.
Property major The major version number.
Property minor The minor version number.
Property patch The patch version number, if any.
Instance Variable _major Undocumented
Instance Variable _minor Undocumented
Instance Variable _patch Undocumented
Instance Variable _version_string Undocumented
def __eq__(self, other):

Compares the instance for equality with an object.

Parameters
other:objectUndocumented
Returns
boolUndocumented
def __init__(self, major, minor=None, patch=None, version_string=None):

Returns an instance of this type from the major, minor, patch and version string.

The string can be arbitrary, but it is expected to be roughly the same format as semver.

Parameters
major:intUndocumented
minor:_Optional[int]Undocumented
patch:_Optional[int]Undocumented
version_string:_Optional[str]Undocumented
def __repr__(self):

Returns the "official" string representation of this instance.

Returns
strUndocumented
def __str__(self):

Returns the nicely printable string representation of this instance.

Note that the returned string may contain some information not represented in the major, minor and patch properties.

Returns
strUndocumented
def matches(self, other):

Compare the components of this instance with the non-None components of the other.

This method behaves like the equality comparison, expects that it still considers this instance to match with the other if they only differ on components (minor, patch) that are None for the other.

This allows to compare for versions that are unconstrained on some dimensions, and this is used in Os.matches and Os.expect.

Notes

  • The matches relationship is not symmetric: a.matches(b) does not imply b.matches(a)
  • Equal instances always match.
  • The string part of the kernel version is never compared in matches and does not influence the result of the match.
Parameters
other:KernelVersionUndocumented
Returns
boolUndocumented
@property
major: int =

The major version number.

@property
minor: _Optional[int] =

The minor version number.

@property
patch: _Optional[int] =

The patch version number, if any.

_major =

Undocumented

_minor =

Undocumented

_patch =

Undocumented

_version_string =

Undocumented