Mercurial > hg > WSGraph
comparison wsgraph/model.py @ 34:16673636dcb6
wow, testing is fun!
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 13 Dec 2012 19:06:00 -0800 |
parents | 943a4b7097af |
children | f17a6577cc0d |
comparison
equal
deleted
inserted
replaced
33:c880cf90f01d | 34:16673636dcb6 |
---|---|
97 # setter | 97 # setter |
98 self._nodes[name] = deepcopy(value) | 98 self._nodes[name] = deepcopy(value) |
99 else: | 99 else: |
100 # getter | 100 # getter |
101 # TODO: deepcopy | 101 # TODO: deepcopy |
102 return self._nodes.get(name, None) | 102 return deepcopy(self._nodes.get(name, None)) |
103 | 103 |
104 def nodes(self): | 104 def nodes(self): |
105 return self._nodes.keys() | 105 return self._nodes.keys() |
106 | 106 |
107 def edge(self, node1, node2, value=None): | 107 def edge(self, node1, node2, value=None): |
111 for node in node1, node2: | 111 for node in node1, node2: |
112 self._nodes.setdefault(node, {}) | 112 self._nodes.setdefault(node, {}) |
113 else: | 113 else: |
114 # getter | 114 # getter |
115 # TODO: deepcopy | 115 # TODO: deepcopy |
116 return self._edges.get((node1, node2), None) | 116 return deepcopy(self._edges.get((node1, node2), None)) |
117 | 117 |
118 def edges(self): | 118 def edges(self): |
119 return self._edges.keys() | 119 return self._edges.keys() |
120 | 120 |
121 class FileCache(MemoryCache): | 121 class FileCache(MemoryCache): |