diff --git a/redisgraph/edge.py b/redisgraph/edge.py index d85a277..34c4b67 100644 --- a/redisgraph/edge.py +++ b/redisgraph/edge.py @@ -2,7 +2,7 @@ from .util import * -class Edge(object): +class Edge: """ An edge connecting two nodes. """ @@ -58,7 +58,7 @@ def __eq__(self, rhs): # Source and destination nodes should match. if self.src_node != rhs.src_node: return False - + if self.dest_node != rhs.dest_node: return False diff --git a/redisgraph/graph.py b/redisgraph/graph.py index 1b521b2..bd05a07 100644 --- a/redisgraph/graph.py +++ b/redisgraph/graph.py @@ -3,7 +3,7 @@ from .query_result import QueryResult from .exceptions import VersionMismatchException -class Graph(object): +class Graph: """ Graph, collection of nodes and edges. """ @@ -189,10 +189,10 @@ def execution_plan(self, query, params=None): Get the execution plan for given query, GRAPH.EXPLAIN returns an array of operations. """ - + if params is not None: query = self.build_params_header(params) + query - + plan = self.redis_con.execute_command("GRAPH.EXPLAIN", self.name, query, query) return self._execution_plan_to_string(plan) @@ -202,7 +202,7 @@ def delete(self): """ self._clear_schema() return self.redis_con.execute_command("GRAPH.DELETE", self.name) - + def merge(self, pattern): """ Merge pattern. diff --git a/redisgraph/node.py b/redisgraph/node.py index 77c9078..c1b2d36 100644 --- a/redisgraph/node.py +++ b/redisgraph/node.py @@ -1,6 +1,6 @@ from .util import * -class Node(object): +class Node: """ A node within the garph. """ diff --git a/redisgraph/path.py b/redisgraph/path.py index 9b693bd..db40460 100644 --- a/redisgraph/path.py +++ b/redisgraph/path.py @@ -1,7 +1,7 @@ from .node import Node from .edge import Edge -class Path(object): +class Path: def __init__(self, nodes, edges): assert(isinstance(nodes, list) and isinstance(edges, list)) @@ -33,7 +33,7 @@ def last_node(self): def edge_count(self): return len(self._edges) - + def nodes_count(self): return len(self._nodes) @@ -64,4 +64,3 @@ def __str__(self): res += "(" + str(node_id) + ")" res += ">" return res - \ No newline at end of file diff --git a/redisgraph/query_result.py b/redisgraph/query_result.py index 6830825..1f0601a 100644 --- a/redisgraph/query_result.py +++ b/redisgraph/query_result.py @@ -20,13 +20,13 @@ NODES_DELETED, RELATIONSHIPS_DELETED, INDICES_CREATED, INDICES_DELETED, CACHED_EXECUTION, INTERNAL_EXECUTION_TIME] -class ResultSetColumnTypes(object): +class ResultSetColumnTypes: COLUMN_UNKNOWN = 0 COLUMN_SCALAR = 1 COLUMN_NODE = 2 # Unused as of RedisGraph v2.1.0, retained for backwards compatibility. COLUMN_RELATION = 3 # Unused as of RedisGraph v2.1.0, retained for backwards compatibility. -class ResultSetScalarTypes(object): +class ResultSetScalarTypes: VALUE_UNKNOWN = 0 VALUE_NULL = 1 VALUE_STRING = 2 @@ -38,7 +38,7 @@ class ResultSetScalarTypes(object): VALUE_NODE = 8 VALUE_PATH = 9 -class QueryResult(object): +class QueryResult: def __init__(self, graph, response): self.graph = graph diff --git a/redisgraph/util.py b/redisgraph/util.py index 48ae127..0f32e0d 100644 --- a/redisgraph/util.py +++ b/redisgraph/util.py @@ -5,7 +5,7 @@ def random_string(length=10): """ - Returns a random N chracter long string. + Returns a random N character long string. """ return ''.join(random.choice(string.ascii_lowercase) for x in range(length))