# Path: servicebus/pika/exceptions.py
# class AMQPError(Exception):
# class AMQPConnectionError(AMQPError):
# class IncompatibleProtocolError(AMQPConnectionError):
# class AuthenticationError(AMQPConnectionError):
# class ProbableAuthenticationError(AMQPConnectionError):
# class ProbableAccessDeniedError(AMQPConnectionError):
# class NoFreeChannels(AMQPConnectionError):
# class ConnectionClosed(AMQPConnectionError):
# class AMQPChannelError(AMQPError):
# class ChannelClosed(AMQPChannelError):
# class DuplicateConsumerTag(AMQPChannelError):
# class ConsumerCancelled(AMQPChannelError):
# class UnroutableError(AMQPChannelError):
# class NackError(AMQPChannelError):
# class InvalidChannelNumber(AMQPError):
# class ProtocolSyntaxError(AMQPError):
# class UnexpectedFrameError(ProtocolSyntaxError):
# class ProtocolVersionMismatch(ProtocolSyntaxError):
# class BodyTooLongError(ProtocolSyntaxError):
# class InvalidFrameError(ProtocolSyntaxError):
# class InvalidFieldTypeException(ProtocolSyntaxError):
# class UnsupportedAMQPFieldException(ProtocolSyntaxError):
# class UnspportedAMQPFieldException(UnsupportedAMQPFieldException):
# class MethodNotImplemented(AMQPError):
# class ChannelError(Exception):
# class InvalidMinimumFrameSize(ProtocolSyntaxError):
# class InvalidMaximumFrameSize(ProtocolSyntaxError):
# class RecursionError(Exception):
# class ShortStringTooLong(AMQPError):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __init__(self, messages):
#     def __repr__(self):
#     def __init__(self, messages):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):


import struct
import decimal
import calendar
from datetime import datetime
from servicebus.pika import exceptions
from servicebus.pika.compat import unicode_type, PY2, long, as_bytes
        return 5
    elif isinstance(value, decimal.Decimal):
        value = value.normalize()
        if value.as_tuple().exponent < 0:
            decimals = -value.as_tuple().exponent
            raw = int(value * (decimal.Decimal(10) ** decimals))
            pieces.append(struct.pack('>cBi', b'D', decimals, raw))
        else:
            # per spec, the "decimals" octet is unsigned (!)
            pieces.append(struct.pack('>cBi', b'D', 0, int(value)))
        return 6
    elif isinstance(value, datetime):
        pieces.append(struct.pack('>cQ', b'T',
                                  calendar.timegm(value.utctimetuple())))
        return 9
    elif isinstance(value, dict):
        pieces.append(struct.pack('>c', b'F'))
        return 1 + encode_table(pieces, value)
    elif isinstance(value, list):
        p = []
        for v in value:
            encode_value(p, v)
        piece = b''.join(p)
        pieces.append(struct.pack('>cI', b'A', len(piece)))
        pieces.append(piece)
        return 5 + len(piece)
    elif value is None:
        pieces.append(struct.pack('>c', b'V'))
        return 1
    else:

# Path: servicebus/pika/exceptions.py
# class AMQPError(Exception):
# class AMQPConnectionError(AMQPError):
# class IncompatibleProtocolError(AMQPConnectionError):
# class AuthenticationError(AMQPConnectionError):
# class ProbableAuthenticationError(AMQPConnectionError):
# class ProbableAccessDeniedError(AMQPConnectionError):
# class NoFreeChannels(AMQPConnectionError):
# class ConnectionClosed(AMQPConnectionError):
# class AMQPChannelError(AMQPError):
# class ChannelClosed(AMQPChannelError):
# class DuplicateConsumerTag(AMQPChannelError):
# class ConsumerCancelled(AMQPChannelError):
# class UnroutableError(AMQPChannelError):
# class NackError(AMQPChannelError):
# class InvalidChannelNumber(AMQPError):
# class ProtocolSyntaxError(AMQPError):
# class UnexpectedFrameError(ProtocolSyntaxError):
# class ProtocolVersionMismatch(ProtocolSyntaxError):
# class BodyTooLongError(ProtocolSyntaxError):
# class InvalidFrameError(ProtocolSyntaxError):
# class InvalidFieldTypeException(ProtocolSyntaxError):
# class UnsupportedAMQPFieldException(ProtocolSyntaxError):
# class UnspportedAMQPFieldException(UnsupportedAMQPFieldException):
# class MethodNotImplemented(AMQPError):
# class ChannelError(Exception):
# class InvalidMinimumFrameSize(ProtocolSyntaxError):
# class InvalidMaximumFrameSize(ProtocolSyntaxError):
# class RecursionError(Exception):
# class ShortStringTooLong(AMQPError):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __init__(self, messages):
#     def __repr__(self):
#     def __init__(self, messages):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):


# Path: servicebus/pika/data.py
import struct
import decimal
import calendar
from datetime import datetime
from servicebus.pika import exceptions
from servicebus.pika.compat import unicode_type, PY2, long, as_bytes

        return 5
    elif isinstance(value, decimal.Decimal):
        value = value.normalize()
        if value.as_tuple().exponent < 0:
            decimals = -value.as_tuple().exponent
            raw = int(value * (decimal.Decimal(10) ** decimals))
            pieces.append(struct.pack('>cBi', b'D', decimals, raw))
        else:
            # per spec, the "decimals" octet is unsigned (!)
            pieces.append(struct.pack('>cBi', b'D', 0, int(value)))
        return 6
    elif isinstance(value, datetime):
        pieces.append(struct.pack('>cQ', b'T',
                                  calendar.timegm(value.utctimetuple())))
        return 9
    elif isinstance(value, dict):
        pieces.append(struct.pack('>c', b'F'))
        return 1 + encode_table(pieces, value)
    elif isinstance(value, list):
        p = []
        for v in value:
            encode_value(p, v)
        piece = b''.join(p)
        pieces.append(struct.pack('>cI', b'A', len(piece)))
        pieces.append(piece)
        return 5 + len(piece)
    elif value is None:
        pieces.append(struct.pack('>c', b'V'))
        return 1
    else:

        raise exceptions.UnsupportedAMQPFieldException(pieces, value)