コード例 #1
0
computer_files = [name[2:] for name in computer_files if ".swp" not in name]
print(computer_files)

seperate()

hash_json = ".hash.json"
hashs = {}
if not disk.exists(hash_json):
    for file in computer_files:
        hashs.update({file: disk.get_hash_of_a_file(file)})
        t.run_command(PUT + file)
        print(f"updated: {file}")
    io.write(hash_json, json.dumps(hashs))
    print("no json found, created a new one.")
else:
    hashs = json.loads(io.read(hash_json))

for file in computer_files:
    if file not in micropython_files:
        t.run_command(PUT + file)
        print(f"updated: {file}")
    else:
        if hashs[file] != disk.get_hash_of_a_file(file):
            t.run_command(PUT + file)
            print(f"updated: {file}")
        else:
            pass

for file in micropython_files:
    if file not in computer_files:
        t.run_command(DELETE + file)
コード例 #2
0
import json
from pprint import pprint

import numpy as np


files = os.listdir("../data")
files = [file for file in files if '.json' in file]


global x, y

for index, file in enumerate(files):
    # get x
    xx = json.loads(io.read("../data/{name}".format(name=file)))
    xx = np.array(xx)
    print(xx.shape)
    # get y
    #yy = np.zeros(xx.shape[0])
    yy = np.full(xx.shape[0], index)

    if index == 0:
        x = xx
        y = yy
    else:
        x = np.append(x, xx, axis=0)
        y = np.append(y, yy, axis=0)


# randomnize data