Ejemplo n.º 1
0
 def __eq__(self, other):
     """ Determine if this node is equal to ``other``. """
     if other.__class__ == Node:
         nd_self = self.node_data
         nd_other = core.get_node(self._cursor, other.id)
         return nd_self.to_dict() == nd_other.to_dict()
     return False
Ejemplo n.º 2
0
    def get_node(self, node_id):
        """
        Get node with given database ID.

        :param int node_id: Database ID
        """
        node_id = core.get_node(self.cursor, node_id).id
        return self.node_factory(self, node_id)
Ejemplo n.º 3
0
 def _node_data(self):
     """
     Return a :class:`libtree.core.node_data.NodeData` object for
     current node ID from database.
     """
     return core.get_node(self._cursor, self.id)
Ejemplo n.º 4
0
 def __eq__(self, other):
     if other.__class__ == Node:
         nd_self = self._node_data
         nd_other = core.get_node(self._cursor, other.id)
         return nd_self.to_dict() == nd_other.to_dict()
     return False