Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove inheritance from object #109

Merged
merged 1 commit into from
Dec 26, 2020
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
4 changes: 2 additions & 2 deletions redisgraph/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from .util import *

class Edge(object):
class Edge:
"""
An edge connecting two nodes.
"""
Expand Down Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions redisgraph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .query_result import QueryResult
from .exceptions import VersionMismatchException

class Graph(object):
class Graph:
"""
Graph, collection of nodes and edges.
"""
Expand Down Expand Up @@ -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)

Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion redisgraph/node.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .util import *

class Node(object):
class Node:
"""
A node within the garph.
"""
Expand Down
5 changes: 2 additions & 3 deletions redisgraph/path.py
Original file line number Diff line number Diff line change
@@ -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))
Expand Down Expand Up @@ -33,7 +33,7 @@ def last_node(self):

def edge_count(self):
return len(self._edges)

def nodes_count(self):
return len(self._nodes)

Expand Down Expand Up @@ -64,4 +64,3 @@ def __str__(self):
res += "(" + str(node_id) + ")"
res += ">"
return res

6 changes: 3 additions & 3 deletions redisgraph/query_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion redisgraph/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down