trees.py
def _remove_node(self, node: TwoDTree) -> None:
        """
        Remove the <node> in self.

        === Precondition ===
        - The <node> is leaf node
        - The point of <node> is already been used to replace another root node
        point above it.
        """
        x, y = self._point
        x1, y1 = node._point
        if self._split_type == 'x':
            if x1 <= x:
                if self._lt is node:
                    self._lt = None
                elif self._lt:
                    self._lt._remove_node(node)
            else:
                if self._gt is node:
                    self._gt = None
                elif self._gt:
                    self._gt._remove_node(node)
        else:
            if y1 <= y:
                if self._lt is node:
                    self._lt = None
                elif self._gt:
                    self._lt._remove_node(node)
            else:
                if self._gt is node:
                    self._gt = None
                elif self._gt:
                    self._gt._remove_node(node)

        Remove the <node> in self.

        === Precondition ===
        - The <node> is leaf node
        - The point of <node> is already been used to replace another root node
        point above it.
        
Remove the  in self.
Precondition
The  is leaf node
The point of  is already been used to replace another root node
point above it.
Remove the in self . Precondition The is leaf node The point of is already been used to replace another root node point above it .
def _remove_node(self, node: TwoDTree) -> None:
        x, y = self._point
        x1, y1 = node._point
        if self._split_type == 'x':
            if x1 <= x:
                if self._lt is node:
                    self._lt = None
                elif self._lt:
                    self._lt._remove_node(node)
            else:
                if self._gt is node:
                    self._gt = None
                elif self._gt:
                    self._gt._remove_node(node)
        else:
            if y1 <= y:
                if self._lt is node:
                    self._lt = None
                elif self._gt:
                    self._lt._remove_node(node)
            else:
                if self._gt is node:
                    self._gt = None
                elif self._gt:
                    self._gt._remove_node(node)
def _remove_node ( self , node : TwoDTree ) -> None : x , y = self . _point x1 , y1 = node . _point if self . _split_type == 'x' : if x1 <= x : if self . _lt is node : self . _lt = None elif self . _lt : self . _lt . _remove_node ( node ) else : if self . _gt is node : self . _gt = None elif self . _gt : self . _gt . _remove_node ( node ) else : if y1 <= y : if self . _lt is node : self . _lt = None elif self . _gt : self . _lt . _remove_node ( node ) else : if self . _gt is node : self . _gt = None elif self . _gt : self . _gt . _remove_node ( node )
Remove the <node> in self.
Remove the <node > in self .
"""
        Remove the <node> in self.

        === Precondition ===
        - The <node> is leaf node
        - The point of <node> is already been used to replace another root node
        point above it.
        """
self
node
TwoDTree