# Path: gymnast/pdf_types/common.py
# class PdfType(object):
#     """Abstract base class for PDF objects"""
#     def pdf_encode(self):
#         """Translate the object into bytes in PDF format"""
#         raise NotImplementedError
#     @property
#     def value(self):
#         """Objects, references, and such will override this in clever
#         ways."""
#         return self
#     @property
#     def parsed_object(self):
#         """Objects, references, and such will override this in clever
#         ways."""
#         return self
# 
# Path: gymnast/pdf_types/compound_types.py
# class PdfDict(PdfType, UserDict):
#     """PDF dict type"""
#     def __init__(self, *args, **kwargs):
#         PdfType.__init__(self)
#         UserDict.__init__(self, *args, **kwargs)
# 
#     def __getattr__(self, name):
#         try:
#             return self[name].parsed_object
#         except AttributeError:
#             return self[name]
#         except KeyError:
#             raise AttributeError('Object has no attribute "{}"'.format(name))
#     def pdf_encode(self):
#         return b'<<'+b' '.join(k.pdf_encode()+b' '+v.pdf_encode()
#                                for k, v in six.iteritems(self))+b'>>'
# 
# Path: gymnast/exc.py
# class PdfError(Exception):
#     """Generic PDF exception"""
#     pass


from .common         import PdfType
from .compound_types import PdfDict
from ..exc           import PdfError
        from .. import pdf_elements
        self._object_number = object_number
        self._generation    = generation
        self._object        = obj
        self._document      = document
        self._parsed_obj    = None

    @property
    def object_key(self):
        return (self._object_number, self._generation)
    @property
    def value(self):
        return self._object
    @property
    def parsed_object(self):
        """The PdfElement corresponding to the object

        TODO: Move most of this somewhere more sane."""
        obj_types = {'Page'          : pdf_elements.PdfPage,
                     'Pages'         : pdf_elements.PdfPageNode,
                     'Font'          : pdf_elements.PdfFont,
                     #'XObject'       : PdfXObject,   #TODO
                     'FontDescriptor': pdf_elements.FontDescriptor,
                     'Encoding'      : pdf_elements.FontEncoding,
                     #'ObjStm'        : ObjectStream, #TODO
                     #'XRef'          : XRef
                     'Catalog'       : pdf_elements.PdfCatalog
                    }
        if self._parsed_obj is not None:
            return self._parsed_obj
        val = self.value

# Path: gymnast/pdf_types/common.py
# class PdfType(object):
#     """Abstract base class for PDF objects"""
#     def pdf_encode(self):
#         """Translate the object into bytes in PDF format"""
#         raise NotImplementedError
#     @property
#     def value(self):
#         """Objects, references, and such will override this in clever
#         ways."""
#         return self
#     @property
#     def parsed_object(self):
#         """Objects, references, and such will override this in clever
#         ways."""
#         return self
# 
# Path: gymnast/pdf_types/compound_types.py
# class PdfDict(PdfType, UserDict):
#     """PDF dict type"""
#     def __init__(self, *args, **kwargs):
#         PdfType.__init__(self)
#         UserDict.__init__(self, *args, **kwargs)
# 
#     def __getattr__(self, name):
#         try:
#             return self[name].parsed_object
#         except AttributeError:
#             return self[name]
#         except KeyError:
#             raise AttributeError('Object has no attribute "{}"'.format(name))
#     def pdf_encode(self):
#         return b'<<'+b' '.join(k.pdf_encode()+b' '+v.pdf_encode()
#                                for k, v in six.iteritems(self))+b'>>'
# 
# Path: gymnast/exc.py
# class PdfError(Exception):
#     """Generic PDF exception"""
#     pass


# Path: gymnast/pdf_types/object_types.py
from .common         import PdfType
from .compound_types import PdfDict
from ..exc           import PdfError
        from .. import pdf_elements

        self._object_number = object_number
        self._generation    = generation
        self._object        = obj
        self._document      = document
        self._parsed_obj    = None

    @property
    def object_key(self):
        return (self._object_number, self._generation)
    @property
    def value(self):
        return self._object
    @property
    def parsed_object(self):
        """The PdfElement corresponding to the object

        TODO: Move most of this somewhere more sane."""
        obj_types = {'Page'          : pdf_elements.PdfPage,
                     'Pages'         : pdf_elements.PdfPageNode,
                     'Font'          : pdf_elements.PdfFont,
                     #'XObject'       : PdfXObject,   #TODO
                     'FontDescriptor': pdf_elements.FontDescriptor,
                     'Encoding'      : pdf_elements.FontEncoding,
                     #'ObjStm'        : ObjectStream, #TODO
                     #'XRef'          : XRef
                     'Catalog'       : pdf_elements.PdfCatalog
                    }
        if self._parsed_obj is not None:
            return self._parsed_obj
        val = self.value

        if isinstance(val, PdfDict):