Пример #1
0
    exit()

computer_files = disk.get_files(".", recursive=False, type_limiter=[".py"])
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
Пример #2
0
from auto_everything.base import IO
io = IO()

import os
import json

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

item_list = []
for index, file in enumerate(files):
    file = file.replace(".json", "")
    item_list.append({'index': index, 'label_name': file})
    print(index, file)

start = """
export const motion_classes = {
"""
end = "}"

final_js = start
for item in item_list:
    final_js += '{index}: "{name}",'.format(index=item['index'],
                                            name=item['label_name']) + '\n'
final_js += end

io.write('../js/motion_classes.js', final_js)
Пример #3
0
from auto_everything.base import IO
io = IO()

import os
import json

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

item_list = []
for index, file in enumerate(files):
    file = file.replace(".json", "")
    item_list.append({'index': index, 'label_name': file})
    print(index, file)

start = """
export const looking_classes = {
"""
end = "}"

final_js = start
for item in item_list:
    final_js += '{index}: "{name}",'.format(index=item['index'],
                                            name=item['label_name']) + '\n'
final_js += end

io.write('../js/looking_classes.js', final_js)
Пример #4
0
from auto_everything.base import IO
io = IO()

from flask import Flask, render_template,redirect
from flask_socketio import SocketIO, emit
    
# make sure static folder is the react build folder, and static path is the root, so static_url_path = ''
app = Flask(__name__, template_folder='../front-end_app/build', static_url_path='', static_folder='../front-end_app/build')
app.config['SECRET_KEY'] = 'yingshaoxo is the king'
socketio = SocketIO(app)

msgs = []
temp_json_file = "msgs.json"
if not os.path.exists(temp_json_file):
    io.write(temp_json_file, json.dumps([]))


@server.on_received
def handle(protocol, text):
    #protocol.send_to_all_except_sender(text)
    message = {"username": protocol.name, "text": text}
    message = json.dumps(message)
    print(message)

    socketio.emit('message_receiver_on_client', message, broadcast=True) # when broadcast=True, it'll send a message to everyone except current socket


    global msgs
    msgs.append(json.loads(message))
    msgs = msgs[-10:]
Пример #5
0
from auto_everything.base import IO
io = IO()

import os
import json

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

item_list = []
for index, file in enumerate(files):
    file = file.replace(".json", "")
    item_list.append({'index': index, 'label_name': file})
    print(index, file)

start = """
export const pose_classes = {
"""
end = "}"

final_js = start
for item in item_list:
    final_js += '{index}: "{name}",'.format(index=item['index'],
                                            name=item['label_name']) + '\n'
final_js += end

io.write('../js/pose_classes.js', final_js)