

def update(self, from_od):
    '\n        Update from another OrderedDict or sequence of (key, value) pairs\n\n        >>> d = OrderedDict(((1, 0), (0, 1)))\n        >>> d.update(OrderedDict(((1, 3), (3, 2), (2, 1))))\n        >>> d\n        OrderedDict([(1, 3), (0, 1), (3, 2), (2, 1)])\n        >>> d.update({4: 4})\n        Traceback (most recent call last):\n        TypeError: undefined order, cannot get items from dict\n        >>> d.update((4, 4))\n        Traceback (most recent call last):\n        TypeError: cannot convert dictionary update sequence element "4" to a 2-item sequence\n        '
    if isinstance(from_od, OrderedDict):
        for (key, val) in from_od.items():
            self[key] = val
    elif isinstance(from_od, dict):
        raise TypeError('undefined order, cannot get items from dict')
    else:
        for item in from_od:
            try:
                (key, val) = item
            except TypeError:
                raise TypeError(('cannot convert dictionary update sequence element "%s" to a 2-item sequence' % item))
            self[key] = val

dataset/ETHPy150Open editorconfig/editorconfig-vim/plugin/editorconfig-core-py/editorconfig/odict.py OrderedDict.update/original