Skip to content

Commit

Permalink
chore(opytimizer): Removes __future__ for Python 3.6 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
gugarosa committed May 4, 2022
1 parent 599d0df commit 08f0fbc
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions opytimizer/core/node.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""Node.
"""

from __future__ import annotations

from typing import Any, Dict, List, Optional, Union

import numpy as np
Expand All @@ -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.
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 08f0fbc

Please sign in to comment.