From bb4e747fd34946956f445083b347bad507869e46 Mon Sep 17 00:00:00 2001
From: Ivan Paljak <ivan.paljak@memgraph.io>
Date: Thu, 27 Feb 2020 16:15:50 +0100
Subject: [PATCH] Finalize PyEdgeFromVertex and PyEdgeToVertex implementations

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2693
---
 src/query/procedure/py_module.cpp | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/query/procedure/py_module.cpp b/src/query/procedure/py_module.cpp
index 4b9a03201..790662d7d 100644
--- a/src/query/procedure/py_module.cpp
+++ b/src/query/procedure/py_module.cpp
@@ -541,9 +541,8 @@ PyObject *PyEdgeFromVertex(PyEdge *self, PyObject *Py_UNUSED(ignored)) {
   CHECK(self->py_graph->graph);
   const auto *vertex = mgp_edge_get_from(self->edge);
   CHECK(vertex);
-  // TODO: Wrap mgp_vertex_copy(vertex) into _mgp.Vertex and return it.
-  PyErr_SetString(PyExc_NotImplementedError, "from_vertex");
-  return nullptr;
+  return MakePyVertex(mgp_vertex_copy(vertex, self->py_graph->memory),
+                      self->py_graph);
 }
 
 PyObject *PyEdgeToVertex(PyEdge *self, PyObject *Py_UNUSED(ignored)) {
@@ -553,9 +552,8 @@ PyObject *PyEdgeToVertex(PyEdge *self, PyObject *Py_UNUSED(ignored)) {
   CHECK(self->py_graph->graph);
   const auto *vertex = mgp_edge_get_to(self->edge);
   CHECK(vertex);
-  // TODO: Wrap mgp_vertex_copy(vertex) into _mgp.Vertex and return it.
-  PyErr_SetString(PyExc_NotImplementedError, "to_vertex");
-  return nullptr;
+  return MakePyVertex(mgp_vertex_copy(vertex, self->py_graph->memory),
+                      self->py_graph);
 }
 
 void PyEdgeDealloc(PyEdge *self) {