mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 02:40:07 +00:00
16 lines
333 B
Python
16 lines
333 B
Python
|
|
||
|
class DictOfSets(dict):
|
||
|
def add(self, key, value):
|
||
|
if key in self:
|
||
|
self[key].add(value)
|
||
|
else:
|
||
|
self[key] = set([value])
|
||
|
|
||
|
def discard(self, key, value):
|
||
|
if not key in self:
|
||
|
return
|
||
|
self[key].discard(value)
|
||
|
if not self[key]:
|
||
|
del self[key]
|
||
|
|