comparison wsgraph/model.py @ 31:5f14a4183bf2

fix things
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 13 Dec 2012 18:52:04 -0800
parents 4bed1424bb3f
children 943a4b7097af
comparison
equal deleted inserted replaced
30:2fe3933f8eca 31:5f14a4183bf2
64 if isinstance(key, basestring) or (not isiterable(key)): 64 if isinstance(key, basestring) or (not isiterable(key)):
65 return self.node(key) 65 return self.node(key)
66 else: 66 else:
67 return self.edge(*key) 67 return self.edge(*key)
68 68
69 def __setitem__(self, key, value):
70 if isinstance(key, basestring) or (not isiterable(key)):
71 self.node(key, value)
72 else:
73 key1, key2 = key
74 self.edge(key1, key2, value)
75
69 def __contains__(self, key): 76 def __contains__(self, key):
70 """ 77 """
71 if key is ..., returns if that node is in the graph 78 if key is ..., returns if that node is in the graph
72 if key is a 2-tuple/list, returns if the edge is in the graph 79 if key is a 2-tuple/list, returns if the edge is in the graph
73 """ 80 """