client.units

Classes

TimeUnit

A helper class provides static functions to switch among seconds, minutes, and hours.

MemUnit

A helper class to convert memory units between B, k, K, m, M, g, G, t, T.

Module Contents

class client.units.TimeUnit(sec: int = 0, min: float = 0.0, hour: float = 0.0)

A helper class provides static functions to switch among seconds, minutes, and hours.

It also can be initialized with combined input of seconds, minutes, and hours, and converts them to any single time unit.

The constructor.

static min_to_sec(minutes: float) int

Static helper function to turn minutes into seconds. Accept pointers.

static hour_to_sec(hour: float) int

Static helper function to turn minutes into seconds.

static hour_to_min(hour: float) float

Static helper function to turn minutes into seconds.

static min_to_hour(min: float) float

Static helper function to turn minutes into seconds.

static sec_to_hour(sec: int) float

Static helper function to turn minutes into seconds.

static sec_to_min(sec: int) float

Static helper function to turn minutes into seconds.

seconds = 0
minutes
hours
readable = ''
class client.units.MemUnit

A helper class to convert memory units between B, k, K, m, M, g, G, t, T.

base_chart_to_B
static convert(input: str, to: str = 'M') int

Convert memory to different units.

input: a string in format “1G”, “1g”, “1Gib”, “1gb”,etc. to: the unit to convert to; takes B, K, M, G, T. Lower case unit will be treated as capital. Return: an int of the memory value of your specified unit