Skip to content

Commit cd2da3f

Browse files
RMKDswilly22
authored andcommitted
Python3 compatibility (#3)
* Python3 compatibility * Removing decode artefact
1 parent 7e02ab4 commit cd2da3f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

redisgraph/client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import random
22
import string
33

4-
from query_result import QueryResult
4+
from .query_result import QueryResult
55

66

77
def random_string(length=10):
88
"""
99
Returns a random N chracter long string.
1010
"""
11-
return ''.join(random.choice(string.lowercase) for x in range(length))
11+
return ''.join(random.choice(string.ascii_lowercase) for x in range(length))
1212

1313

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

3333

3434
class Edge(object):
@@ -51,7 +51,7 @@ def __str__(self):
5151
return '({src_alias})-[:{relation} {{{properties}}}]->({dest_alias})'.format(
5252
src_alias=self.src_node.alias,
5353
relation=self.relation,
54-
properties=','.join(key+':'+str(val) for key, val in self.properties.iteritems()),
54+
properties=','.join(key+':'+str(val) for key, val in self.properties.items()),
5555
dest_alias=self.dest_node.alias)
5656
else:
5757
return '({src_alias})-[:{relation}]->({dest_alias})'.format(
@@ -97,7 +97,7 @@ def commit(self):
9797
"""
9898

9999
query = 'CREATE '
100-
for _, node in self.nodes.iteritems():
100+
for _, node in self.nodes.items():
101101
query += str(node) + ','
102102

103103
for edge in self.edges:

redisgraph/query_result.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def _retrieve_data_from_statistics(self, statistics):
4646
@staticmethod
4747
def _get_value(prop, statistics):
4848
for stat in statistics:
49+
stat = stat.decode()
4950
if prop in stat:
5051
return float(stat.split(': ')[1].split(' ')[0])
5152

0 commit comments

Comments
 (0)