Skip to content

Commit 08f0fbc

Browse files
committed
chore(opytimizer): Removes __future__ for Python 3.6 support.
1 parent 599d0df commit 08f0fbc

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

opytimizer/core/node.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""Node.
22
"""
33

4-
from __future__ import annotations
5-
64
from typing import Any, Dict, List, Optional, Union
75

86
import numpy as np
@@ -19,9 +17,9 @@ def __init__(
1917
name: Union[str, int],
2018
category: str,
2119
value: Optional[np.ndarray] = None,
22-
left: Optional[Node] = None,
23-
right: Optional[Node] = None,
24-
parent: Optional[Node] = None,
20+
left: Optional["Node"] = None,
21+
right: Optional["Node"] = None,
22+
parent: Optional["Node"] = None,
2523
) -> None:
2624
"""Initialization method.
2725
@@ -108,39 +106,39 @@ def value(self, value: np.ndarray) -> None:
108106
self._value = value
109107

110108
@property
111-
def left(self) -> Node:
109+
def left(self) -> "Node":
112110
"""Pointer to the node's left child."""
113111

114112
return self._left
115113

116114
@left.setter
117-
def left(self, left: Node) -> None:
115+
def left(self, left: "Node") -> None:
118116
if left and not isinstance(left, Node):
119117
raise e.TypeError("`left` should be a Node")
120118

121119
self._left = left
122120

123121
@property
124-
def right(self) -> Node:
122+
def right(self) -> "Node":
125123
"""Pointer to the node's right child."""
126124

127125
return self._right
128126

129127
@right.setter
130-
def right(self, right: Node) -> None:
128+
def right(self, right: "Node") -> None:
131129
if right and not isinstance(right, Node):
132130
raise e.TypeError("`right` should be a Node")
133131

134132
self._right = right
135133

136134
@property
137-
def parent(self) -> Node:
135+
def parent(self) -> "Node":
138136
"""Pointer to the node's parent."""
139137

140138
return self._parent
141139

142140
@parent.setter
143-
def parent(self, parent: Node) -> None:
141+
def parent(self, parent: "Node") -> None:
144142
if parent and not isinstance(parent, Node):
145143
raise e.TypeError("`parent` should be a Node")
146144

@@ -190,7 +188,7 @@ def position(self) -> np.ndarray:
190188
return _evaluate(self)
191189

192190
@property
193-
def post_order(self) -> List[Node]:
191+
def post_order(self) -> List["Node"]:
194192
"""Traverses the node in post-order."""
195193

196194
# Creates lists for post-order and stacked nodes
@@ -241,7 +239,7 @@ def post_order(self) -> List[Node]:
241239
return post_order
242240

243241
@property
244-
def pre_order(self) -> List[Node]:
242+
def pre_order(self) -> List["Node"]:
245243
"""Traverses the node in pre-order."""
246244

247245
# Creates lists for pre-order and stacked nodes
@@ -267,7 +265,7 @@ def pre_order(self) -> List[Node]:
267265

268266
return pre_order
269267

270-
def find_node(self, position: int) -> Node:
268+
def find_node(self, position: int) -> "Node":
271269
"""Finds a node at a given position.
272270
273271
Args:

0 commit comments

Comments
 (0)