# Path: pypot/dynamixel/conversion.py
# def dxl_code_all(value, length, nb_elem):
#     if nb_elem > 1:
#         return list(itertools.chain(*(dxl_code(v, length) for v in value)))
#     else:
#         return dxl_code(value, length)
# 
# def dxl_decode_all(data, nb_elem):
#     if nb_elem > 1:
#         data = list(zip(*([iter(data)] * (len(data) // nb_elem))))
#         return tuple(map(dxl_decode, data))
#     else:
#         return dxl_decode(data)
# 
# def decode_error(error_code):
#     bits = numpy.unpackbits(numpy.asarray(error_code, dtype=numpy.uint8))
#     return tuple(numpy.array(dynamixelErrors)[bits == 1])
# 
# def dxl_to_model(value, dummy=None):
#     return dynamixelModels[value]


import serial
import logging
import operator
import itertools
import threading
        import platform
        import pypot.utils.pypot_time as time
from collections import namedtuple, OrderedDict
from contextlib import contextmanager
from ..conversion import (dxl_code_all, dxl_decode_all, decode_error,
                          dxl_to_model)
# -*- coding: utf-8 -*-





logger = logging.getLogger(__name__)
# With this logger you should always provide as extra:
# - the port
# - the baudrate
# - the timeout


_DxlControl = namedtuple('_DxlControl', ('name',
                                         'address', 'length', 'nb_elem',
                                         'access',
                                         'models',
                                         'dxl_to_si', 'si_to_dxl',
                                         'getter_name', 'setter_name'))



# Path: pypot/dynamixel/conversion.py
# def dxl_code_all(value, length, nb_elem):
#     if nb_elem > 1:
#         return list(itertools.chain(*(dxl_code(v, length) for v in value)))
#     else:
#         return dxl_code(value, length)
# 
# def dxl_decode_all(data, nb_elem):
#     if nb_elem > 1:
#         data = list(zip(*([iter(data)] * (len(data) // nb_elem))))
#         return tuple(map(dxl_decode, data))
#     else:
#         return dxl_decode(data)
# 
# def decode_error(error_code):
#     bits = numpy.unpackbits(numpy.asarray(error_code, dtype=numpy.uint8))
#     return tuple(numpy.array(dynamixelErrors)[bits == 1])
# 
# def dxl_to_model(value, dummy=None):
#     return dynamixelModels[value]


# Path: pypot/dynamixel/io/abstract_io.py
import serial
import logging
import operator
import itertools
import threading
        import platform
        import pypot.utils.pypot_time as time
from collections import namedtuple, OrderedDict
from contextlib import contextmanager
from ..conversion import (dxl_code_all, dxl_decode_all, decode_error,
                          dxl_to_model)

# -*- coding: utf-8 -*-





logger = logging.getLogger(__name__)
# With this logger you should always provide as extra:
# - the port
# - the baudrate
# - the timeout


_DxlControl = namedtuple('_DxlControl', ('name',
                                         'address', 'length', 'nb_elem',
                                         'access',
                                         'models',
                                         'dxl_to_si', 'si_to_dxl',
                                         'getter_name', 'setter_name'))



class _DxlAccess(object):