class documentation
class OsError(_Generic[OsComponent], ValueError):
Error that is raised when there is an incompatibility between the OS and the expected OS.
Method | __init__ |
Initializes a new instance of this class. |
Method | __repr__ |
Returns the "official" string representation of this instance. |
Method | __str__ |
Returns the nicely printable string representation of this instance. |
Method | expected |
The OS components that would have been compatible. |
Method | got |
The OS component that wasn't conformant. |
Method | message |
The additional message, if any. |
Method | _incompatible |
Undocumented |
Instance Variable | _expected |
Undocumented |
Instance Variable | _got |
Undocumented |
Instance Variable | _message |
Undocumented |
def __init__(self, got, expected=(), message=None):
Initializes a new instance of this class.
Usually used in a raise statement, and results in an error looking like:
reven2.ossi.os.OsError: Got 'Windows 10', expected one of: 'Windows 7', 'Windows 8'
Information
Parameters | |
got:_Optional[ | the OS component (full OS, family, architecture, version, kernel_version) that wasn't conformant. |
expected:_Iterable[ | either a single or a list of the OS components that would have been compatible. If provided with the empty list, changes the base message from "Got x expected y" to "Incompatible OS x". |
message:_Optional[ | an optional additional message to append to the error. It does not replace the "base message" ("Got x expected y"). |
def __repr__(self):
Returns the "official" string representation of this instance.
Returns | |
str | Undocumented |
def __str__(self):
Returns the nicely printable string representation of this instance.
Returns | |
str | Undocumented |
def expected(self):
The OS components that would have been compatible.
Returns | |
_Iterator[ | Undocumented |