コード例 #1
0
def cmd_data(args):
    if not os.path.exists(COMO_BATTERY_FILE):
        puts(colored.yellow("No como database."))
    else:
        data = read_database()
        title("Como Database")
        with indent(6, quote='    '):
            puts("Number of Entries: %d" % len(data))
            puts("First save: " + str(data['time'][0]))
            puts("Last save: " + str(data['time'][-1]))
            timedelta = datetime.utcnow() - datetime.strptime(
                data['time'][0], "%Y-%m-%dT%H:%M:%S")
            puts("Age of Database: %s Days" % str(timedelta.days))
            # History Graphs
            if not is_win:
                history = []
                for element in data['capacity']:
                    history.append(int(element))
                cycles = []
                for element in data['cycles']:
                    if element:
                        cycles.append(int(element))
                    else:
                        cycles.append(element)
                history = [h - min(history) for h in history]
                cycles = [
                    c - min(c for c in cycles if type(c) == int)
                    if type(c) == int else c for c in cycles
                ]
                text1 = str(spark_string(history).encode('utf-8'))
                text2 = str(spark_string(cycles).encode('utf-8'))
                warning("Capacity:")
                puts(text1)
                warning("Cycles:")
                puts(text2)
コード例 #2
0
ファイル: core.py プロジェクト: stuartphilp/como
def cmd_data(args):
    if not os.path.exists(COMO_BATTERY_FILE):
        puts(colored.yellow("No como database."))
    else:
        data = read_database()
        title("Como Database")
        with indent(6, quote='    '):
            puts("Number of Entries: %d" % len(data))
            puts("First save: " + str(data['time'][0]))
            puts("Last save: " + str(data['time'][-1]))
            timedelta = datetime.utcnow() - datetime.strptime(
                data['time'][0], "%Y-%m-%dT%H:%M:%S")
            puts("Age of Database: %s Days" % str(timedelta.days))
            # History Graphs
            if not is_win:
                history = []
                for element in data['capacity']:
                    history.append(int(element))
                cycles = []
                for element in data['cycles']:
                    if element:
                        cycles.append(int(element))
                    else:
                        cycles.append(element)
                history = [h - min(history) for h in history]
                cycles = [
                    c - min(c for c in cycles if type(c) == int)
                    if type(c) == int else c for c in cycles
                ]
                text1 = str(spark_string(history).encode('utf-8'))
                text2 = str(spark_string(cycles).encode('utf-8'))
                warning("Capacity:")
                puts(text1)
                warning("Cycles:")
                puts(text2)
コード例 #3
0
ファイル: core.py プロジェクト: cwoebker/como
def cmd_reset(args):
    if os.path.exists(COMO_BATTERY_FILE):
        sure = raw_input("Are you sure? this will remove everything! [y/n] ")
        if sure == "y":
            os.remove(COMO_BATTERY_FILE)
            info("removed database")
    else:
        warning("no como database")
コード例 #4
0
ファイル: core.py プロジェクト: stuartphilp/como
def cmd_reset(args):
    if os.path.exists(COMO_BATTERY_FILE):
        sure = raw_input("Are you sure? this will remove everything! [y/n] ")
        if sure == "y":
            os.remove(COMO_BATTERY_FILE)
            info("removed database")
    else:
        warning("no como database")
コード例 #5
0
ファイル: core.py プロジェクト: cwoebker/como
def create_database():
    warning("Creating ~/.como")
    open(COMO_BATTERY_FILE, 'w').close()
    return Dataset(headers=['time', 'capacity', 'cycles'])
コード例 #6
0
ファイル: core.py プロジェクト: stuartphilp/como
def create_database():
    warning("Creating ~/.como")
    open(COMO_BATTERY_FILE, 'w').close()
    return Dataset(headers=['time', 'capacity', 'cycles'])