Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions redisgraph/client.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import random
import string

from query_result import QueryResult
from .query_result import QueryResult


def random_string(length=10):
"""
Returns a random N chracter long string.
"""
return ''.join(random.choice(string.lowercase) for x in range(length))
return ''.join(random.choice(string.ascii_lowercase) for x in range(length))


class Node(object):
Expand All @@ -28,7 +28,7 @@ def __str__(self):
return '({alias}:{label} {{{properties}}})'.format(
alias=self.alias,
label=self.label,
properties=','.join(key+':'+str(val) for key, val in self.properties.iteritems()))
properties=','.join(key+':'+str(val) for key, val in self.properties.items()))


class Edge(object):
Expand All @@ -51,7 +51,7 @@ def __str__(self):
return '({src_alias})-[:{relation} {{{properties}}}]->({dest_alias})'.format(
src_alias=self.src_node.alias,
relation=self.relation,
properties=','.join(key+':'+str(val) for key, val in self.properties.iteritems()),
properties=','.join(key+':'+str(val) for key, val in self.properties.items()),
dest_alias=self.dest_node.alias)
else:
return '({src_alias})-[:{relation}]->({dest_alias})'.format(
Expand Down Expand Up @@ -97,7 +97,7 @@ def commit(self):
"""

query = 'CREATE '
for _, node in self.nodes.iteritems():
for _, node in self.nodes.items():
query += str(node) + ','

for edge in self.edges:
Expand Down
1 change: 1 addition & 0 deletions redisgraph/query_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def _retrieve_data_from_statistics(self, statistics):
@staticmethod
def _get_value(prop, statistics):
for stat in statistics:
stat = stat.decode()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not that familiar with Python3, could you explain why do we need decode here?

if prop in stat:
return float(stat.split(': ')[1].split(' ')[0])

Expand Down