Merge meta parameters.

    next meta has priority over current, it will overwrite attributes.

    :param class or None meta: class with properties.
    :return class: merged meta.
354846
def merge_metas(*metas):
    
    metadict = {}
    for meta in metas:
        metadict.update(meta.__dict__)

    metadict = {k: v for k, v in metadict.items() if not k.startswith('__')}
    return type('Meta', (object, ), metadict)
317826
def mix(self, cls):
        

        if hasattr(cls, 'unmixed_class'):
            base_class = cls.unmixed_class
            old_mixins = cls.__bases__[1:]  # Skip the original unmixed class
            mixins = old_mixins + tuple(
                mixin
                for mixin in self._mixins
                if mixin not in old_mixins
            )
        else:
            base_class = cls
            mixins = self._mixins

        mixin_key = (base_class, mixins)

        if mixin_key not in _CLASS_CACHE:
            # Only lock if we're about to make a new class
            with _CLASS_CACHE_LOCK:
                # Use setdefault so that if someone else has already
                # created a class before we got the lock, we don't
                # overwrite it
                return _CLASS_CACHE.setdefault(mixin_key, type(
                    base_class.__name__ + str('WithMixins'),  # type() requires native str
                    (base_class, ) + mixins,
                    {'unmixed_class': base_class}
                ))
        else:
            return _CLASS_CACHE[mixin_key]
813631
public static MetaClass getMetaClass(Class c) {
        MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry();
        MetaClass mc = metaClassRegistry.getMetaClass(c);
        if (mc instanceof ExpandoMetaClass
                || mc instanceof DelegatingMetaClass && ((DelegatingMetaClass) mc).getAdaptee() instanceof ExpandoMetaClass)
            return mc;
        else {
            return new HandleMetaClass(mc);
        }
    }
999697
def merge(self, other):
        
        ignore = self.ignore
        extra = self.extras
        if isinstance(other, Dict):
            other_keys = other.keys
            ignore += other.ignore
            extra += other.extras
        elif isinstance(other, (list, tuple)):
            other_keys = list(other)
        elif isinstance(other, dict):
            return self.__class__(other, *self.keys)
        else:
            raise TypeError('You must merge Dict only with Dict'
                            ' or list of Keys')
        return self.__class__(*(self.keys + other_keys), ignore_extra=ignore,
                              allow_extra=extra)
958988
def from_meta(cls, meta, meta_all=None):
        """"""
        if len(meta.args) == 2:
            name = meta.args[1]
            meta_type = None
            for x in meta_all:
                if x.args[1] == name and x.args[0] == 'type':
                    meta_type = x.description
                    break

            return cls(args=meta.args, description=meta.description, type=meta_type)
        else:
            return cls(args=meta.args, description=meta.description)
1091027
def replace_meta(self, name, content=None, meta_key=None):
        '''
        '''
        children = self.meta._children
        if not content:     # small optimazation
            children = tuple(children)
        meta_key = meta_key or 'name'
        for child in children:
            if child.attr(meta_key) == name:
                if content:
                    child.attr('content', content)
                else:
                    self.meta._children.remove(child)
                return
        if content:
            self.add_meta(**{meta_key: name, 'content': content})
287035
def _next_class(cls):
        
        return next(
            class_
            for class_ in cls.__mro__
            if not issubclass(class_, Multi)
        )
116465
def merge!(other)
      self.class.coerce(other).to_h.each { |name, values| set name, values }
    end
1224074
def set_meta(self, meta_data):
        '''
        
        '''
        if not (isinstance(meta_data, ps.PMap) or isinstance(meta_data, IMap)):
            meta_data = ps.pmap(meta_data)
        new_cnode = copy.copy(self)
        object.__setattr__(new_cnode, 'meta_data', meta_data)
        return new_cnode
304630
def with_metaclass(meta, *bases):
    """"""
    # This requires a bit of explanation: the basic idea is to make a dummy
    # metaclass for one level of class instantiation that replaces itself with
    # the actual metaclass.
    class metaclass(type):

        def __new__(cls, name, this_bases, d):
            return meta(name, bases, d)

        @classmethod
        def __prepare__(cls, name, this_bases):
            return meta.__prepare__(name, bases)
    return type.__new__(metaclass, 'temporary_class', (), {})
1057481
def _add_parameter(self_, param_name,param_obj):
        
        # CEBALERT: can't we just do
        # setattr(cls,param_name,param_obj)?  The metaclass's
        # __setattr__ is actually written to handle that.  (Would also
        # need to do something about the params() cache.  That cache
        # is a pain, but it definitely improved the startup time; it
        # would be worthwhile making sure no method except for one
        # "add_param()" method has to deal with it (plus any future
        # remove_param() method.)
        cls = self_.cls
        type.__setattr__(cls,param_name,param_obj)
        ParameterizedMetaclass._initialize_parameter(cls,param_name,param_obj)
        # delete cached params()
        try:
            delattr(cls,'_%s__params'%cls.__name__)
        except AttributeError:
            pass
34561
def append_with(self, obj, **properties):
        ''''''
        for prop, val in properties.items():
            val = self.serialize(val)
            self._meta.setdefault(prop, {}).setdefault(val, []).append(obj)
        self.append(obj)
916622
def get_noconflict_metaclass(bases, left_metas, right_metas):
    
    # make tuple of needed metaclasses in specified priority order
    metas = left_metas + tuple(map(type, bases)) + right_metas
    needed_metas = remove_redundant(metas)

    # return existing confict-solving meta, if any
    if needed_metas in memoized_metaclasses_map:
        return memoized_metaclasses_map[needed_metas]
    # nope: compute, memoize and return needed conflict-solving meta
    elif not needed_metas:         # wee, a trivial case, happy us
        meta = type
    elif len(needed_metas) == 1:  # another trivial case
        meta = needed_metas[0]
    # check for recursion, can happen i.e. for Zope ExtensionClasses
    elif needed_metas == bases:
        raise TypeError("Incompatible root metatypes", needed_metas)
    else:  # gotta work ...
        metaname = '_' + ''.join([m.__name__ for m in needed_metas])
        meta = classmaker()(metaname, needed_metas, {})
    memoized_metaclasses_map[needed_metas] = meta
    return meta
1182775
def store_meta(self,meta):
        ""
        if self.meta is None:
            self.meta = {}
        self.meta.update(meta)
        return self
982381
def merge(self, other):
        
        if not isinstance(other, NameVariants):
            raise TypeError("NameVariants isinstance can be merge with"
                            "other isinstance of the same class")
        for key in self.variants:
            self.variants[key] = self.variants[key] or other.variants[key]

        return self
1239643
public function forClass(string $class): MetaClass
    {
        $cacheName = 'MetaForClass:' . $class;
        $meta = $this->cache->get($cacheName);

        if (!$meta instanceof MetaClass) {
            $data = $this->source->forClass($class);
            $meta = $this->asMeta($data);

            $this->cache->set($cacheName, $meta);
        }

        return $meta;
    }
690806
def merge(a, b):
    
    for item in a:
        setattr(b, item[0], item[1])
        b.__metadata__ = b.__metadata__
    return b