# Path: schwa/dr/containers.py
# class StoreList(list):
#   __slots__ = ('_klass', )
# 
#   def __init__(self, klass, *args, **kwargs):
#     super(StoreList, self).__init__(*args, **kwargs)
#     self._klass = klass
# 
#   def __repr__(self):
#     r = super(StoreList, self).__repr__()
#     return 'StoreList({0})'.format(r)
# 
#   def clear(self):
#     del self[:]
# 
#   def create(self, **kwargs):
#     """Instantiate, append and return an object of this store's klass"""
#     obj = self._klass(**kwargs)
#     self.append(obj)
#     return obj
# 
#   def create_n(self, n, **kwargs):
#     """Instantiate and append n objects of this store's klass, returning the corresponding slice"""
#     for i in xrange(n):
#       obj = self._klass(**kwargs)
#       self.append(obj)
#     return slice(len(self) - n, len(self))
# 
# Path: schwa/dr/exceptions.py
# class WriterException(Exception):
#   pass


import six
from .containers import StoreList
from .exceptions import WriterException
      from .meta import MetaBase
    from .meta import Ann
    from .meta import Ann
    from .meta import Ann
# vim: set et nosi ai ts=2 sts=2 sw=2:
# coding: utf-8
from __future__ import absolute_import, print_function, unicode_literals



__all__ = ['BaseAttr', 'BaseField', 'Field', 'Pointer', 'Pointers', 'SelfPointer', 'SelfPointers', 'Slice', 'Store']


def _from_wire_pointer(val, store):
  if val is None:
    return None
  return store[val]


def _to_wire_pointer(obj, store):
  if not hasattr(obj, '_dr_index'):
    raise WriterException('Cannot serialize a pointer which is not in a store ({0}).'.format(obj))
  if obj._dr_index is None:

# Path: schwa/dr/containers.py
# class StoreList(list):
#   __slots__ = ('_klass', )
# 
#   def __init__(self, klass, *args, **kwargs):
#     super(StoreList, self).__init__(*args, **kwargs)
#     self._klass = klass
# 
#   def __repr__(self):
#     r = super(StoreList, self).__repr__()
#     return 'StoreList({0})'.format(r)
# 
#   def clear(self):
#     del self[:]
# 
#   def create(self, **kwargs):
#     """Instantiate, append and return an object of this store's klass"""
#     obj = self._klass(**kwargs)
#     self.append(obj)
#     return obj
# 
#   def create_n(self, n, **kwargs):
#     """Instantiate and append n objects of this store's klass, returning the corresponding slice"""
#     for i in xrange(n):
#       obj = self._klass(**kwargs)
#       self.append(obj)
#     return slice(len(self) - n, len(self))
# 
# Path: schwa/dr/exceptions.py
# class WriterException(Exception):
#   pass


# Path: schwa/dr/fields_core.py
import six
from .containers import StoreList
from .exceptions import WriterException
      from .meta import MetaBase
    from .meta import Ann
    from .meta import Ann
    from .meta import Ann

# vim: set et nosi ai ts=2 sts=2 sw=2:
# coding: utf-8
from __future__ import absolute_import, print_function, unicode_literals



__all__ = ['BaseAttr', 'BaseField', 'Field', 'Pointer', 'Pointers', 'SelfPointer', 'SelfPointers', 'Slice', 'Store']


def _from_wire_pointer(val, store):
  if val is None:
    return None
  return store[val]


def _to_wire_pointer(obj, store):
  if not hasattr(obj, '_dr_index'):
    raise WriterException('Cannot serialize a pointer which is not in a store ({0}).'.format(obj))
  if obj._dr_index is None:

    raise WriterException('Cannot serialize pointer to {0} as it is not not in any store'.format(obj))