# Path: fixtest/base/message.py
# class BasicMessage(collections.MutableMapping):
#     """ A BasicMessage is just a collection of (ID, VALUE) pairs.
# 
#         All IDs are converted into strings, this allows users of the
#         BasicMessage to class to use integers or strings as keys.
#         e.g. message[35] == message['35']
# 
#         If you iterate through the BasicMessage, the items will be
#         returned in the order they were added.  This is important
#         because the order of the fields is important to FIX.
#     """
#     def __init__(self, **kwargs):
#         """ Initialization
# 
#             Args:
#                 source: copy over the fields from the source and
#                     merge with this.  This can be a list of (ID, VALUE)
#                     tuples or a BasicMessage().
#         """
#         self.store = collections.OrderedDict()
# 
#         if 'source' in kwargs:
#             self.update(kwargs['source'])
# 
#     def __getitem__(self, key):
#         return self.store[self.__keytransform__(key)]
# 
#     def __setitem__(self, key, value):
#         self.store[self.__keytransform__(key)] = value
# 
#     def __delitem__(self, key):
#         del self.store[self.__keytransform__(key)]
# 
#     def __iter__(self):
#         return iter(self.store)
# 
#     def __len__(self):
#         return len(self.store)
# 
#     def __keytransform__(self, key):
#         """ Override this to enforce the type of key expected.
#         """
#         # pylint: disable=no-self-use
#         return str(key)


from cStringIO import StringIO
from fixtest.base.message import BasicMessage
import struct

        This is a FIX-formatted message, so this assumes that the
        key is a numeric string, that is only digits are allowed.

        Args:
            output:
            tag:
            value:
    """
    output.write(_single_field(tag, value))


def _write_field(output, tag, value):
    """ Writes a field to the output. The value may be hiearchical.

        Args:
            output:
            tag: The ID portion.
            value: The value portion.  This may be a nested group.
    """
    if hasattr(value, '__iter__'):
        # write out the number of subgroups
        _write_single_field(output, tag, len(value))
        for subgroup in value:
            for k, v in subgroup.iteritems():
                _write_field(output, k, v)
    else:
        _write_single_field(output, tag, value)



# Path: fixtest/base/message.py
# class BasicMessage(collections.MutableMapping):
#     """ A BasicMessage is just a collection of (ID, VALUE) pairs.
# 
#         All IDs are converted into strings, this allows users of the
#         BasicMessage to class to use integers or strings as keys.
#         e.g. message[35] == message['35']
# 
#         If you iterate through the BasicMessage, the items will be
#         returned in the order they were added.  This is important
#         because the order of the fields is important to FIX.
#     """
#     def __init__(self, **kwargs):
#         """ Initialization
# 
#             Args:
#                 source: copy over the fields from the source and
#                     merge with this.  This can be a list of (ID, VALUE)
#                     tuples or a BasicMessage().
#         """
#         self.store = collections.OrderedDict()
# 
#         if 'source' in kwargs:
#             self.update(kwargs['source'])
# 
#     def __getitem__(self, key):
#         return self.store[self.__keytransform__(key)]
# 
#     def __setitem__(self, key, value):
#         self.store[self.__keytransform__(key)] = value
# 
#     def __delitem__(self, key):
#         del self.store[self.__keytransform__(key)]
# 
#     def __iter__(self):
#         return iter(self.store)
# 
#     def __len__(self):
#         return len(self.store)
# 
#     def __keytransform__(self, key):
#         """ Override this to enforce the type of key expected.
#         """
#         # pylint: disable=no-self-use
#         return str(key)


# Path: fixtest/fix/message.py
from cStringIO import StringIO
from fixtest.base.message import BasicMessage
import struct


        This is a FIX-formatted message, so this assumes that the
        key is a numeric string, that is only digits are allowed.

        Args:
            output:
            tag:
            value:
    """
    output.write(_single_field(tag, value))


def _write_field(output, tag, value):
    """ Writes a field to the output. The value may be hiearchical.

        Args:
            output:
            tag: The ID portion.
            value: The value portion.  This may be a nested group.
    """
    if hasattr(value, '__iter__'):
        # write out the number of subgroups
        _write_single_field(output, tag, len(value))
        for subgroup in value:
            for k, v in subgroup.iteritems():
                _write_field(output, k, v)
    else:
        _write_single_field(output, tag, value)



class FIXMessage(BasicMessage):