# Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.

cdef class XMP:

    cdef set namespaces

    def __init__ (self):
        self.namespaces = {
            "stRef",
            "dc",
            "xmp",
            "xmpRights",
            "xmpMM",
            "xmpidq",
        }

    def __len__ (self):
        return 0

    def __iter__ (self):
        return iter(())

    def __getattr__ (self, name):
        if name in self.namespaces:
            return ()

        else:
            self.__raise_no_attr(name)

    def __repr__ (self):
        return "<{}>".format(self.__class__.__name__)

    def __raise_no_attr (self, name):
        obj = "{}.{}".format(self.__class__.__module__,
                             self.__class__.__name__)

        message = "{} object has no attribute {}".format(repr(obj),
                                                         repr(name))

        raise AttributeError(message)

# Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.

cdef set DEFAULT_XMP_NAMESPACES = {
    "stRef",
    "dc",
    "xmp",
    "xmpRights",
    "xmpMM",
    "xmpidq",
}

cdef class XMP:

    def __len__ (self):
        return 0

    def __iter__ (self):
        return iter(())

    def __getattr__ (self, name):
        if name in DEFAULT_XMP_NAMESPACES:
            return ()

        else:
            self.raise_error_no_attr(name)

    def __repr__ (self):
        return "<{}>".format(self.__class__.__name__)

    cdef raise_error_no_attr (self, name):
        obj = "{}.{}".format(self.__class__.__module__,
                             self.__class__.__name__)

        message = "{} object has no attribute {}".format(repr(obj),
                                                         repr(name))

        raise AttributeError(message)

Replace __ prefixes with cdefs for better encapsulation
Replace __ prefixes with cdefs for better encapsulation
