menu/lcdmenu.py
def load_average(_):
        """Return the load average component of the uptime command"""
        values = popen("uptime").read().strip().split(' ')[-3:]

        out = []
        for value in values:
            if len(value) > 4:
                # This value is too big to display well
                try:
                    f = float(value)
                    if f > 100.0:
                        # Unfortunately this load avg is inherently too big
                        # Just display the integer
                        value = "{:.0f}".format(f)
                    else:
                        # Round to 3 sig fig to display in 4 digits or less
                        value = "{:0.3g}".format(f)
                except ValueError:
                    pass
            out.append(value)

        # Ensure the output is at least 14 characters to ensure stability during
        # potential text rotation
        return " ".join(out).ljust(14)
Return the load average component of the uptime command
Return the load average component of the uptime command
Return the load average component of the uptime command
def load_average(_):
        values = popen("uptime").read().strip().split(' ')[-3:]
        out = []
        for value in values:
            if len(value) > 4:
                try:
                    f = float(value)
                    if f > 100.0:
                        value = "{:.0f}".format(f)
                    else:
                        value = "{:0.3g}".format(f)
                except ValueError:
                    pass
            out.append(value)
        return " ".join(out).ljust(14)
def load_average ( _ ) : values = popen ( "uptime" ) . read ( ) . strip ( ) . split ( ' ' ) [ - 3 : ] out = [ ] for value in values : if len ( value ) > 4 : try : f = float ( value ) if f > 100.0 : value = "{:.0f}" . format ( f ) else : value = "{:0.3g}" . format ( f ) except ValueError : pass out . append ( value ) return " " . join ( out ) . ljust ( 14 )
Return the load average component of the uptime command
Return the load average component of the uptime command
"""Return the load average component of the uptime command""" # This value is too big to display well # Unfortunately this load avg is inherently too big # Just display the integer # Round to 3 sig fig to display in 4 digits or less # Ensure the output is at least 14 characters to ensure stability during # potential text rotation
_