def with_meta(class_to_decorate=None, add_init_kwargs=True):
    """
        Class decorator to enable a class (and it's sub-classes) to have a 'Meta' class attribute.

        :type class_to_decorate: class
        :param bool add_init_kwargs: Pass Meta class members to constructor

        :rtype: class
    """

    if class_to_decorate is None:
        return functools.partial(with_meta, add_init_kwargs=add_init_kwargs)

    if add_init_kwargs:
        def get_extra_args_function(self):
            return {k: v for k, v in self.get_meta().items() if not k.startswith('_')}

        add_args_to_init_call(class_to_decorate, get_extra_args_function)

    setattr(class_to_decorate, 'get_meta', classmethod(get_meta))

    return class_to_decorate
def with_meta ( class_to_decorate = None , add_init_kwargs = True ) : if class_to_decorate is None : return functools . partial ( with_meta , add_init_kwargs = add_init_kwargs ) if add_init_kwargs : def get_extra_args_function ( self ) : return { k : v for k , v in self . get_meta ( ) . items ( ) if not k . startswith ( '_' ) } add_args_to_init_call ( class_to_decorate , get_extra_args_function ) setattr ( class_to_decorate , 'get_meta' , classmethod ( get_meta ) ) return class_to_decorate
Class decorator to enable a class (and it's sub-classes) to have a 'Meta' class attribute.

        :type class_to_decorate: class
        :param bool add_init_kwargs: Pass Meta class members to constructor

        :rtype: class