smartie.database module

Drive and manufacturer-specific quirk database.

This module contains a database of drive and manufacturer-specific quirks, primarily used for vendor-specific SMART data. This is necessary because SMART is a specification for _communicating_ with a drive, not a specification of what SMART data actually means.

Note

It may be very tempting to copy data from sources like smartmontools, which has a database of drive-specific quirks. However, these databases are often licensed under the GPL, which is incompatible with the MIT license used by SMARTie. As such, this database is built from vendor spec sheets when possible and guesswork when it’s not. If you wish to contribute to this database, please do so by submitting a pull request on GitHub.

class smartie.database.DriveEntry(name: str, filters: ~typing.List[str] = <factory>, smart_attributes: ~typing.Dict[int, ~smartie.database.SMARTAttribute] = <factory>, notes: ~typing.List[str] = <factory>)[source]

Bases: object

Represents a single entry in the drive database.

This is used to provide non-standard SMART attributes for specific drives, and other drive-specific or manufacturer-specific information.

filters: List[str]
name: str
notes: List[str]
smart_attributes: Dict[int, SMARTAttribute]
class smartie.database.SMARTAttribute(name: str, id: int, flags: int = 0, unit: Units = Units.UNKNOWN, processor: callable | None = None, current_value: int | None = None, worst_value: int | None = None, threshold: int | None = None)[source]

Bases: object

An Attribute represents a single parsed SMART attribute.

current_value: int | None = None

The current value of the attribute.

flags: int = 0

The SMART Attribute flags.

id: int

The SMART Attribute ID.

name: str

A human-readable identifier, if known.

property p_value

The current value, run through any provided processor.

property p_worst_value

The worst value, run through any provided processor.

processor: callable | None = None

If provided, a callable function which will be used to process current_value and worst_value.

threshold: int | None = None

The maximum acceptable value of the attribute.

unit: Units = 0

If known, a hint for the possible measurement unit in current_value.

worst_value: int | None = None

The worst known value of the attribute.

class smartie.database.Units(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Hints for the possible measurement unit of a SMART attribute, primarily used for display purposes.

CELSIUS = 10
COUNT = 30
HOURS = 21
MILLISECONDS = 20
UNKNOWN = 0
smartie.database.get_drive_entry(filters: List[str]) DriveEntry[source]

Get a merged DriveEntry that matches all the given filters.

smartie.database.get_matching_drive_entries(filters: List[str]) List[DriveEntry][source]

Get a list of DriveEntry that matches the given filters.