# Path: dockit/core/serializers/base.py
# class Serializer(object):
# class Deserializer(object):
# class UnSet:
# class DeserializedObject(object):
#     def serialize(self, queryset, **options):
#     def start_serialization(self):
#     def end_serialization(self):
#     def start_object(self, obj):
#     def end_object(self, obj):
#     def getvalue(self):
#     def __init__(self, stream_or_string, **options):
#     def __iter__(self):
#     def next(self):
#     def __init__(self, obj, natural_key=UnSet):
#     def __repr__(self):
#     def save(self, enforce_natural_key=True):
# 
# Path: dockit/schema/loading.py
# def get_base_document(self, key):
#     if self.pending_documents and self.app_cache_ready():
#         self.post_app_ready()
#     return self.documents[key]


from django.utils.encoding import smart_unicode
from dockit.core.serializers import base
from dockit.schema.loading import get_base_document
            "natural_key_hash": obj.natural_key_hash,
            "fields" : self._current,
        }
        self.objects.append(entry)
        self._current = None

    def getvalue(self):
        return self.objects

def Deserializer(object_list, **options):
    """
    Deserialize simple Python objects back into Django ORM instances.

    It's expected that you pass the Python objects themselves (instead of a
    stream or a string) to the constructor
    """
    #models.get_apps()
    use_natural_keys = options.get('use_natural_keys', True)
    for d in object_list:
        # Look up the model and starting build a dict of data for it.
        doc_cls = get_base_document(d["collection"])
        data = d['fields']
        if use_natural_keys and 'natural_key' in d:
            data['@natural_key'] = d['natural_key']
        elif 'pk' in d:
            data[doc_cls._meta.pk.attname] = doc_cls._meta.pk.to_python(d["pk"])
        
        if 'natural_key' in d:
            yield base.DeserializedObject(doc_cls.to_python(data), natural_key=d['natural_key'])
        else:

# Path: dockit/core/serializers/base.py
# class Serializer(object):
# class Deserializer(object):
# class UnSet:
# class DeserializedObject(object):
#     def serialize(self, queryset, **options):
#     def start_serialization(self):
#     def end_serialization(self):
#     def start_object(self, obj):
#     def end_object(self, obj):
#     def getvalue(self):
#     def __init__(self, stream_or_string, **options):
#     def __iter__(self):
#     def next(self):
#     def __init__(self, obj, natural_key=UnSet):
#     def __repr__(self):
#     def save(self, enforce_natural_key=True):
# 
# Path: dockit/schema/loading.py
# def get_base_document(self, key):
#     if self.pending_documents and self.app_cache_ready():
#         self.post_app_ready()
#     return self.documents[key]


# Path: dockit/core/serializers/python.py
from django.utils.encoding import smart_unicode
from dockit.core.serializers import base
from dockit.schema.loading import get_base_document

            "natural_key_hash": obj.natural_key_hash,
            "fields" : self._current,
        }
        self.objects.append(entry)
        self._current = None

    def getvalue(self):
        return self.objects

def Deserializer(object_list, **options):
    """
    Deserialize simple Python objects back into Django ORM instances.

    It's expected that you pass the Python objects themselves (instead of a
    stream or a string) to the constructor
    """
    #models.get_apps()
    use_natural_keys = options.get('use_natural_keys', True)
    for d in object_list:
        # Look up the model and starting build a dict of data for it.
        doc_cls = get_base_document(d["collection"])
        data = d['fields']
        if use_natural_keys and 'natural_key' in d:
            data['@natural_key'] = d['natural_key']
        elif 'pk' in d:
            data[doc_cls._meta.pk.attname] = doc_cls._meta.pk.to_python(d["pk"])
        
        if 'natural_key' in d:
            yield base.DeserializedObject(doc_cls.to_python(data), natural_key=d['natural_key'])
        else:

            yield base.DeserializedObject(doc_cls.to_python(data))