Commit 9331a3d1 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Do not forget "string" type in _check_prop_vector()

parent 3fea60ff
...@@ -212,9 +212,11 @@ def _check_prop_scalar(prop, name=None, floating=False): ...@@ -212,9 +212,11 @@ def _check_prop_scalar(prop, name=None, floating=False):
(((" '%s'" % name) if name != None else ""), (((" '%s'" % name) if name != None else ""),
(" floating" if floating else ""))) (" floating" if floating else "")))
def _check_prop_vector(prop, name=None, floating=False): def _check_prop_vector(prop, name=None, scalar=True, floating=False):
scalars = ["bool", "int32_t", "int64_t", "unsigned long", scalars = ["bool", "int32_t", "int64_t", "unsigned long",
"double", "long double"] "double", "long double"]
if not scalar:
scalars += ["string"]
if floating: if floating:
scalars = ["double", "long double"] scalars = ["double", "long double"]
vals = ["vector<%s>" % v for v in scalars] vals = ["vector<%s>" % v for v in scalars]
...@@ -274,7 +276,7 @@ def group_vector_property(g, props, value_type=None, vprop=None, pos=None): ...@@ -274,7 +276,7 @@ def group_vector_property(g, props, value_type=None, vprop=None, pos=None):
else: else:
ValueError("Can't automatically determine property map value" + ValueError("Can't automatically determine property map value" +
" type. Please provide the 'value_type' parameter.") " type. Please provide the 'value_type' parameter.")
_check_prop_vector(vprop, name="vprop") _check_prop_vector(vprop, name="vprop", scalar=False)
for i,p in enumerate(props): for i,p in enumerate(props):
if k != "g": if k != "g":
...@@ -314,7 +316,7 @@ def ungroup_vector_property(g, vprop, pos, props=None): ...@@ -314,7 +316,7 @@ def ungroup_vector_property(g, vprop, pos, props=None):
A list of property maps with the ungrouped values of ``vprop``. A list of property maps with the ungrouped values of ``vprop``.
""" """
_check_prop_vector(vprop, name="vprop") _check_prop_vector(vprop, name="vprop", scalar=False)
k = vprop.key_type() k = vprop.key_type()
value_type = vprop.value_type().split("<")[1].split(">")[0] value_type = vprop.value_type().split("<")[1].split(">")[0]
if props == None: if props == None:
...@@ -456,7 +458,7 @@ class Graph(object): ...@@ -456,7 +458,7 @@ class Graph(object):
f += ", vertices filtered by %s" % (str(self.get_vertex_filter())) f += ", vertices filtered by %s" % (str(self.get_vertex_filter()))
n = self.num_vertices() n = self.num_vertices()
e = self.num_edges() e = self.num_edges()
return "<Graph object, %s%s, with %d %s and %d edge%s,%s at 0x%x>"\ return "<Graph object, %s%s, with %d %s and %d edge%s%s at 0x%x>"\
% (d, fr, n, "vertex" if n == 1 else "vertices", e, % (d, fr, n, "vertex" if n == 1 else "vertices", e,
"" if e == 1 else "s", f, id(self)) "" if e == 1 else "s", f, id(self))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment