mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-11 00:31:56 -06:00
ipapython/graph.py String formatting
Changed string formatting for Value Errors raise. Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
parent
52a435978b
commit
fe913b9c9f
@ -24,8 +24,10 @@ class Graph(object):
|
||||
def add_edge(self, tail, head):
|
||||
if tail not in self.vertices:
|
||||
raise ValueError("tail is not a vertex")
|
||||
|
||||
if head not in self.vertices:
|
||||
raise ValueError("head is not a vertex")
|
||||
|
||||
self.edges.append((tail, head))
|
||||
self._adj[tail].append(head)
|
||||
|
||||
@ -34,14 +36,17 @@ class Graph(object):
|
||||
self.edges.remove((tail, head))
|
||||
except KeyError:
|
||||
raise ValueError(
|
||||
"graph does not contain edge: (%s, %s)" % (tail, head))
|
||||
"graph does not contain edge: ({0}, {1})".format(tail, head)
|
||||
)
|
||||
self._adj[tail].remove(head)
|
||||
|
||||
def remove_vertex(self, vertex):
|
||||
try:
|
||||
self.vertices.remove(vertex)
|
||||
except KeyError:
|
||||
raise ValueError("graph does not contain vertex: %s" % vertex)
|
||||
raise ValueError(
|
||||
"graph does not contain vertex: {0}".format(vertex)
|
||||
)
|
||||
|
||||
# delete _adjacencies
|
||||
del self._adj[vertex]
|
||||
|
Loading…
Reference in New Issue
Block a user