def __init__(self, sock): asynchat.async_chat.__init__(self, sock=sock) self._createTime = TimeUtils.getNowSeconds() self._data = None self._message = None self.handling = False self._requestFlags = 0 self._responseFlags = 0 self._chunk = ByteChunk(endianess=ByteChunk.BIG_ENDIAN) self._resetRouterState()
def __init__(self): """ Creates a new instance of NimbleConnection and opens the communication socket to the corresponding NimbleServer instance. NimbleEnvironment is used to determine whether the connection should be to a Maya or external application NimbleServer instance. """ self._active = False self._socket = None self._activatedTime = None self._chunk = ByteChunk(endianess=ByteChunk.BIG_ENDIAN)
from pyaid.string.ByteChunk import ByteChunk from array import array import random a = array('d') for i in range(100): a.append(10000.0 * (random.random() - 0.5)) bc = ByteChunk() bc.writeArrayChunk(a) bc.position = 0 out = bc.readArrayChunk() print('[TEST] Array Chunk I/O: %s' % ('PASSED' if a == out else 'FAILED'))