pyuserconfig/userconfig/checks.py

20 lines
521 B
Python

import platform
def get_short_hostname():
hostname = platform.node()
if hostname.count("."):
hostname = hostname.split(".")[0]
return hostname
def classes_for_host(reverse=False):
classes = [(0, "", "header"),
(1000, "", "footer"),
(998, "", "all"),
(800, "Arch", platform.system()),
(10, "Host", get_short_hostname())
]
classes.sort(key=lambda k: k[0], reverse=reverse)
return [(k[1], k[2]) for k in classes]