

def __setitem__(self, key, vals):
    vals = set(vals)
    added = (vals - self.keyVal[key])
    removed = (self.keyVal[key] - vals)
    for v in added:
        self.valKeys[v].add(key)
    for v in removed:
        self.valKeys[v].remove(key)
        if (not self.valKeys[v]):
            del self.valKeys[v]
    self.keyVal[key] = vals
    if (not self.keyVal[key]):
        del self.keyVal[key]

dataset/ETHPy150Open ufora/ufora/ufora/util/TwoWaySetMap.py TwoWaySetMap.__setitem__/original