Duplicate attributes of dict or other typedef.
356270
def dup(self, other=None, **kwds):
        '''
        '''
        if other is None:
            d = _dict_typedef.kwds()
        else:
            d =  other.kwds()
        d.update(kwds)
        self.reset(**d)
68499
def duplicate(self):
        """"""
        other = Matcher(self.loc, self.check_var, self.checkdefs, self.names, self.var_index)
        other.insert_check(0, "not " + self.check_var)
        self.others.append(other)
        return other
983668
def c_typedefs(self):
        """"""
        defs = []
        attrs = self.opts.attrs + '\n' if self.opts.attrs else ''
        for name, args in self.funcs:
            logging.debug('name: %s args: %s', name, args)
            defs.append(
                'typedef\n{}\n{}{}({});\n'.format(
                    args[0], attrs,
                    self._c_type_name(name), make_c_args(args[2])
                )
            )
        return defs
813545
def typedefs(
            self,
            name=None,
            function=None,
            header_dir=None,
            header_file=None,
            recursive=None,
            allow_empty=None):
        """"""
        return (
            self._find_multiple(
                self._impl_matchers[scopedef_t.typedef],
                name=name,
                function=function,
                decl_type=self._impl_decl_types[
                    scopedef_t.typedef],
                header_dir=header_dir,
                header_file=header_file,
                recursive=recursive,
                allow_empty=allow_empty)
        )
1264387
def Copy(self):
    """"""
    return Attribute(
        self.predicate,
        self.attribute_type,
        self.description,
        self.name,
        _copy=True)
1219609
def _get_dict(names, ndarrays):
        """"""
        nset = set()
        for nm in names:
            if nm in nset:
                raise ValueError('Duplicate names detected, %s' % str(names))
            nset.add(nm)
        return dict(zip(names, ndarrays))
393045
def _pick_attrs(attrs, keys):
    
    return dict((k, v) for k, v in attrs.items() if k in keys)
1372693
def merge_dicts(*dicts, **copy_check):
    '''
    
    '''
    merged = {}
    if not dicts:
        return merged
    for index, merge_dict in enumerate(dicts):
        if index == 0 and not copy_check.get('copy'):
            merged = merge_dict
        else:
            merged.update(merge_dict)
    return merged
640396
def merge(self, dict_=None):
        """"""
        if dict_ is None and hasattr(self, '__dict__'):
            dict_ = self.__dict__  
            # doesn't work anymore as we have _lock attribute
        if dict_ is None:
            return self
        self.update(dict_)
        return self
366105
def coerce(cls, key, value):
        """"""
        if value is None:
            return value
        if isinstance(value, cls):
            return value
        if isinstance(value, dict):
            return NestedMutableDict.coerce(key, value)
        if isinstance(value, list):
            return NestedMutableList.coerce(key, value)
        return super(cls).coerce(key, value)
919107
def clean_dict_keys(d):
    
    new_d = {}
    for (k, v) in d.iteritems():
        new_d[str(k)] = v
    return new_d
1285954
def cast_dicts(self, to=DEFAULT, d=DEFAULT):
        """"""
        if to is DEFAULT:
            to = type(self)
        if d is DEFAULT:
            d = self
        if isinstance(d, list):
            return [v for v in (self.cast_dicts(to, v) for v in d)]
        elif isinstance(d, dict):
            return to({k: v for k, v in ((k, self.cast_dicts(to, v)) for k, v in d.items())})
        return d
1328779
def copy_attrs(obj1, obj2, attrs):
    
    for attr in attrs:
        value = getattr(obj2, attr) if hasattr(obj2, attr) else None
        if value is None and isinstance(obj2, dict) and attr in obj2:
            value = obj2[attr]
        setattr(obj1, attr, value)
232239
def _copy_interfaces_info(interfaces):
    '''
    
    '''
    ret = {}

    for interface in interfaces:
        _interface_attrs_cpy = set()
        for attr in ATTRS:
            if attr in interfaces[interface]:
                attr_dict = Hashabledict()
                attr_dict[attr] = repr(interfaces[interface][attr])
                _interface_attrs_cpy.add(attr_dict)
        ret[interface] = _interface_attrs_cpy

    return ret
914743
def squeeze(attrs, inputs, proto_obj):
    """"""
    new_attrs = translation_utils._fix_attribute_names(attrs,
                                                       {'axes' : 'axis'})
    return 'squeeze', new_attrs, inputs
407110
def flatatt(attrs):
    
    return _flatatt({k.replace('_', '-'): v for k, v in attrs.items()})
519342
def _derive_typedef(typ):
    '''
    '''
    v = [v for v in _values(_typedefs) if _issubclass(typ, v.type)]
    if len(v) == 1:
        return v[0]
    return None