# HG changeset patch # User Jeff Hammel # Date 1355189624 28800 # Node ID ee45f44394a09ae8bb270ea5f80e201f5091a900 # Parent 3d0430390e72cc87a825be2bc8233fdbe31dc650 i need a name, Bastian diff -r 3d0430390e72 -r ee45f44394a0 wsgraph/model.py --- a/wsgraph/model.py Mon Dec 10 17:32:33 2012 -0800 +++ b/wsgraph/model.py Mon Dec 10 17:33:44 2012 -0800 @@ -1,6 +1,6 @@ from abc import abstractmethod from copy import deepcopy -from utils import iterable +from utils import isiterable class GraphModel(object): @@ -36,7 +36,7 @@ if key is a 2-tuple/list, return the edge of that name """ - if isinstance(key, basestring) or (not iterable(key)): + if isinstance(key, basestring) or (not isiterable(key)): return self.node(key) else: return self.edge(*key) @@ -47,12 +47,14 @@ if key is a 2-tuple/list, returns if the edge is in the graph """ # XXX not necessarily the best implementation! - if isinstance(key, basestring) or (not iterable(key)): + if isinstance(key, basestring) or (not isiterable(key)): return key in self.nodes() else: return tuple(key) in self.edges() + class MemoryCache(GraphModel): + """volatile in-memory representation of a graph""" def __init__(self): self._edges = {}