# Path: tailor/hardware/arduino/protocol/commands.py



from .commands import command_lookup, command_names

def mappp(list, dict):
    return [dict[i] for i in list]


def mapppp(values, sig):
    return {k: values[i] for i, k in enumerate(sig)}


def make_container(name, sig, values):
    return Container(name=name, **mapppp(values, sig))


# generator
def parse(handler):
    while 1:
        byte = yield

        if byte in command_names:
            name, sig = command_names[byte]
            value0 = yield
            c = make_container(name, sig, (value0,))
            handler(c)

        else:
            raise UnhandledPacketType


def build(name, **kwargs):
    try:

# Path: tailor/hardware/arduino/protocol/commands.py



# Path: tailor/hardware/arduino/protocol/factory.py
from .commands import command_lookup, command_names


def mappp(list, dict):
    return [dict[i] for i in list]


def mapppp(values, sig):
    return {k: values[i] for i, k in enumerate(sig)}


def make_container(name, sig, values):
    return Container(name=name, **mapppp(values, sig))


# generator
def parse(handler):
    while 1:
        byte = yield

        if byte in command_names:
            name, sig = command_names[byte]
            value0 = yield
            c = make_container(name, sig, (value0,))
            handler(c)

        else:
            raise UnhandledPacketType


def build(name, **kwargs):
    try:

        command = command_lookup[name]