From 08f0fbc979ef8e8d1af88f3cb32304c3d174c548 Mon Sep 17 00:00:00 2001 From: Gustavo Rosa Date: Wed, 4 May 2022 17:26:55 -0300 Subject: [PATCH] chore(opytimizer): Removes __future__ for Python 3.6 support. --- opytimizer/core/node.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/opytimizer/core/node.py b/opytimizer/core/node.py index 040a6924..002a0883 100644 --- a/opytimizer/core/node.py +++ b/opytimizer/core/node.py @@ -1,8 +1,6 @@ """Node. """ -from __future__ import annotations - from typing import Any, Dict, List, Optional, Union import numpy as np @@ -19,9 +17,9 @@ def __init__( name: Union[str, int], category: str, value: Optional[np.ndarray] = None, - left: Optional[Node] = None, - right: Optional[Node] = None, - parent: Optional[Node] = None, + left: Optional["Node"] = None, + right: Optional["Node"] = None, + parent: Optional["Node"] = None, ) -> None: """Initialization method. @@ -108,39 +106,39 @@ def value(self, value: np.ndarray) -> None: self._value = value @property - def left(self) -> Node: + def left(self) -> "Node": """Pointer to the node's left child.""" return self._left @left.setter - def left(self, left: Node) -> None: + def left(self, left: "Node") -> None: if left and not isinstance(left, Node): raise e.TypeError("`left` should be a Node") self._left = left @property - def right(self) -> Node: + def right(self) -> "Node": """Pointer to the node's right child.""" return self._right @right.setter - def right(self, right: Node) -> None: + def right(self, right: "Node") -> None: if right and not isinstance(right, Node): raise e.TypeError("`right` should be a Node") self._right = right @property - def parent(self) -> Node: + def parent(self) -> "Node": """Pointer to the node's parent.""" return self._parent @parent.setter - def parent(self, parent: Node) -> None: + def parent(self, parent: "Node") -> None: if parent and not isinstance(parent, Node): raise e.TypeError("`parent` should be a Node") @@ -190,7 +188,7 @@ def position(self) -> np.ndarray: return _evaluate(self) @property - def post_order(self) -> List[Node]: + def post_order(self) -> List["Node"]: """Traverses the node in post-order.""" # Creates lists for post-order and stacked nodes @@ -241,7 +239,7 @@ def post_order(self) -> List[Node]: return post_order @property - def pre_order(self) -> List[Node]: + def pre_order(self) -> List["Node"]: """Traverses the node in pre-order.""" # Creates lists for pre-order and stacked nodes @@ -267,7 +265,7 @@ def pre_order(self) -> List[Node]: return pre_order - def find_node(self, position: int) -> Node: + def find_node(self, position: int) -> "Node": """Finds a node at a given position. Args: