# Path: smarkets/uuid.py
# class UuidTag(UuidTagBase):  # pylint: disable=E1001
# class Uuid(UuidBase):  # pylint: disable=E1001
#     def hex_str(self):
#     def tag_number(self, number):
#     def split_int_tag(cls, number):
#     def low(self):
#     def high(self):
#     def shorthex(self):
#     def to_slug(self, prefix=True, base=36, chars=None, pad=0):
#     def to_hex(self, pad=32):
#     def base_n(number, chars):
#     def pad_uuid(uuid, pad=32, padchar='0'):
#     def unsplit64(cls, high, low):
#     def from_int(cls, number, ttype):
#     def from_slug(cls, slug, base=36, chars=None):
#     def from_hex(cls, hex_str):
# def int_to_slug(number, ttype):
# def slug_to_int(slug, return_tag=None, split=False):
# def uuid_to_slug(number, prefix=True):
# def slug_to_uuid(slug):
# def int_to_uuid(number, ttype):
# def uuid_to_int(uuid, return_tag=None, split=False):
# def uid_or_int_to_int(value, expected_type):
# def uuid_to_short(uuid):
# TAGS = (
#     UuidTag('Account', int('acc1', 16), 'a'),
#     UuidTag('ContractGroup', int('c024', 16), 'm'),
#     UuidTag('Contract', int('cccc', 16), 'c'),
#     UuidTag('Order', int('fff0', 16), 'o'),
#     UuidTag('Comment', int('b1a4', 16), 'b'),
#     UuidTag('Entity', int('0444', 16), 'n'),
#     UuidTag('Event', int('1100', 16), 'e'),
#     UuidTag('Session', int('9999', 16), 's'),
#     UuidTag('User', int('0f00', 16), 'u'),
#     UuidTag('Referrer', int('4e4e', 16), 'r'),
# )
# 
# Path: smarkets/streaming_api/api.py
# SIDE_BID = seto.SIDE_BUY
# SIDE_OFFER = seto.SIDE_SELL
# 
# Path: smarkets/streaming_api/exceptions.py
# class LoginError(_Error):
# 
#     "Raised when a login is not successful"
#     def __init__(self, reason):
#         self.reason_msg = 'Unknown'
#         self.reason = reason
#         if reason in LogoutReason.values():
#             self.reason_msg = LogoutReason.Name(reason)
# 
# class LoginTimeout(_Error):
# 
#     "Raised when no message is received after sending login request"
#     pass
# 
# Path: smarkets/streaming_api/framing.py
# def frame_decode_all(to_decode):
#     """
#     :type to_decode: bytes
#     :rtype: tuple (list of bytes, remaining bytes)
#     """
#     payloads = []
#     while len(to_decode) >= MIN_FRAME_SIZE:
#         try:
#             decoded = uleb128_decode(to_decode)
#         except IncompleteULEB128:
#             # There may be not enough data in the input to decode the header
#             break
#         else:
#             payload_size, header_size = decoded
#             frame_size = max(payload_size + header_size, MIN_FRAME_SIZE)
#             if len(to_decode) >= frame_size:
#                 frame, to_decode = to_decode[:frame_size], to_decode[frame_size:]
#                 payloads.append(frame[header_size:header_size + payload_size])
#             else:
#                 break
# 
#     return payloads, to_decode


import unittest
import six
from collections import namedtuple
from itertools import chain, product
from mock import patch
from nose.tools import eq_
from six.moves import xrange
from smarkets import uuid
from smarkets.streaming_api.api import eto, InvalidCallbackError, seto, StreamingAPIClient
from smarkets.streaming_api.exceptions import LoginError, LoginTimeout
from smarkets.streaming_api.framing import frame_decode_all

    class indexer(object):
        index = 0

    def ret_buff():
        if indexer.index < len(buffers):
            val = buffers[indexer.index]
            indexer.index += 1
            return val
        return None

    return ret_buff


class Handler(object):
    call_count = 0

    def __call__(self, *args, **kwargs):
        self.call_count += 1


class SmarketsTestCase(unittest.TestCase):

    "Tests for the `smarkets.Smarkets` client object"

    def setUp(self):
        "Patch the `Session` object for mock use"
        self.session_patcher = patch('smarkets.streaming_api.session.Session')
        self.mock_session_cls = self.session_patcher.start()
        self.mock_session = self.mock_session_cls.return_value

# Path: smarkets/uuid.py
# class UuidTag(UuidTagBase):  # pylint: disable=E1001
# class Uuid(UuidBase):  # pylint: disable=E1001
#     def hex_str(self):
#     def tag_number(self, number):
#     def split_int_tag(cls, number):
#     def low(self):
#     def high(self):
#     def shorthex(self):
#     def to_slug(self, prefix=True, base=36, chars=None, pad=0):
#     def to_hex(self, pad=32):
#     def base_n(number, chars):
#     def pad_uuid(uuid, pad=32, padchar='0'):
#     def unsplit64(cls, high, low):
#     def from_int(cls, number, ttype):
#     def from_slug(cls, slug, base=36, chars=None):
#     def from_hex(cls, hex_str):
# def int_to_slug(number, ttype):
# def slug_to_int(slug, return_tag=None, split=False):
# def uuid_to_slug(number, prefix=True):
# def slug_to_uuid(slug):
# def int_to_uuid(number, ttype):
# def uuid_to_int(uuid, return_tag=None, split=False):
# def uid_or_int_to_int(value, expected_type):
# def uuid_to_short(uuid):
# TAGS = (
#     UuidTag('Account', int('acc1', 16), 'a'),
#     UuidTag('ContractGroup', int('c024', 16), 'm'),
#     UuidTag('Contract', int('cccc', 16), 'c'),
#     UuidTag('Order', int('fff0', 16), 'o'),
#     UuidTag('Comment', int('b1a4', 16), 'b'),
#     UuidTag('Entity', int('0444', 16), 'n'),
#     UuidTag('Event', int('1100', 16), 'e'),
#     UuidTag('Session', int('9999', 16), 's'),
#     UuidTag('User', int('0f00', 16), 'u'),
#     UuidTag('Referrer', int('4e4e', 16), 'r'),
# )
# 
# Path: smarkets/streaming_api/api.py
# SIDE_BID = seto.SIDE_BUY
# SIDE_OFFER = seto.SIDE_SELL
# 
# Path: smarkets/streaming_api/exceptions.py
# class LoginError(_Error):
# 
#     "Raised when a login is not successful"
#     def __init__(self, reason):
#         self.reason_msg = 'Unknown'
#         self.reason = reason
#         if reason in LogoutReason.values():
#             self.reason_msg = LogoutReason.Name(reason)
# 
# class LoginTimeout(_Error):
# 
#     "Raised when no message is received after sending login request"
#     pass
# 
# Path: smarkets/streaming_api/framing.py
# def frame_decode_all(to_decode):
#     """
#     :type to_decode: bytes
#     :rtype: tuple (list of bytes, remaining bytes)
#     """
#     payloads = []
#     while len(to_decode) >= MIN_FRAME_SIZE:
#         try:
#             decoded = uleb128_decode(to_decode)
#         except IncompleteULEB128:
#             # There may be not enough data in the input to decode the header
#             break
#         else:
#             payload_size, header_size = decoded
#             frame_size = max(payload_size + header_size, MIN_FRAME_SIZE)
#             if len(to_decode) >= frame_size:
#                 frame, to_decode = to_decode[:frame_size], to_decode[frame_size:]
#                 payloads.append(frame[header_size:header_size + payload_size])
#             else:
#                 break
# 
#     return payloads, to_decode


# Path: smarkets/tests/streaming_api/client.py
import unittest
import six
from collections import namedtuple
from itertools import chain, product
from mock import patch
from nose.tools import eq_
from six.moves import xrange
from smarkets import uuid
from smarkets.streaming_api.api import eto, InvalidCallbackError, seto, StreamingAPIClient
from smarkets.streaming_api.exceptions import LoginError, LoginTimeout
from smarkets.streaming_api.framing import frame_decode_all


    class indexer(object):
        index = 0

    def ret_buff():
        if indexer.index < len(buffers):
            val = buffers[indexer.index]
            indexer.index += 1
            return val
        return None

    return ret_buff


class Handler(object):
    call_count = 0

    def __call__(self, *args, **kwargs):
        self.call_count += 1


class SmarketsTestCase(unittest.TestCase):

    "Tests for the `smarkets.Smarkets` client object"

    def setUp(self):
        "Patch the `Session` object for mock use"
        self.session_patcher = patch('smarkets.streaming_api.session.Session')
        self.mock_session_cls = self.session_patcher.start()
        self.mock_session = self.mock_session_cls.return_value

        self.client = StreamingAPIClient(self.mock_session)