From 9693db32bbd134e004eb47832cbefb9de6c6dec6 Mon Sep 17 00:00:00 2001 From: UnknownUser95 Date: Sun, 7 Jul 2024 04:17:09 +0200 Subject: [PATCH] python 3.9 type hint fixes --- src/pickpack/__init__.py | 10 +++++----- src/pickpack/anytree_utils.py | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pickpack/__init__.py b/src/pickpack/__init__.py index b12a0fd..9bb40d5 100644 --- a/src/pickpack/__init__.py +++ b/src/pickpack/__init__.py @@ -6,7 +6,7 @@ import enum from _curses import window from dataclasses import dataclass, field -from typing import Any, Callable, TypeAlias, TypeVar +from typing import Any, Callable, TypeVar, Union from anytree import Node, RenderTree @@ -19,10 +19,10 @@ KEYS_UP = (curses.KEY_UP, ord('k')) KEYS_DOWN = (curses.KEY_DOWN, ord('j')) KEYS_SELECT = (curses.KEY_RIGHT, ord(' ')) - -NodeWithIndex: TypeAlias = tuple[str | Node, int] -NodeNameOnly: TypeAlias = str | Node -AnyNode: TypeAlias = NodeNameOnly | NodeWithIndex + +NodeWithIndex = tuple[Union[str, Node], int] +NodeNameOnly = Union[str, Node] +AnyNode = Union[NodeNameOnly, NodeWithIndex] _T = TypeVar("_T") diff --git a/src/pickpack/anytree_utils.py b/src/pickpack/anytree_utils.py index 08d601e..d065ca9 100644 --- a/src/pickpack/anytree_utils.py +++ b/src/pickpack/anytree_utils.py @@ -1,4 +1,5 @@ """ anytree_utils.py """ +from __future__ import annotations from anytree import Node, RenderTree, find