Skip to content

utils

mainsequence.client.utils

LazyConstants

Bases: dict

Class Method to load constants only once they are called. this minimizes the calls to the API

to_attr_dict(data)

Recursively convert a Python dict into an object that allows dot-notation access. Non-dict values (e.g., int, str, list) are returned as-is; dicts become _AttrDict.

bios_uuid()

Best‑effort hardware/OS identifier that never returns None.

Order of preference
  1. /sys/class/dmi/id/product_uuid (kernel‑exported, no root)
  2. dmidecode -s system-uuid (requires root and dmidecode)
  3. /etc/machine-id or /var/lib/dbus/machine-id
  4. uuid.getnode() (MAC address as 48‑bit int, zero‑padded hex)

The value is always lower‑case and stripped of whitespace.

is_process_running(pid)

Check if a process with the given PID is running.

Args: pid (int): The process ID to check.

Returns: bool: True if the process is running, False otherwise.