From 30eaeb84fd8bae7110695a5bd5f1414dbb36582f Mon Sep 17 00:00:00 2001 From: Bill Schnurr Date: Thu, 6 May 2021 23:47:33 -0700 Subject: [PATCH] fixing TrytesCompatible so that its nolonger generic. I'm assuming this is a mistake based on usage. TrytesCompatible = Union[AnyStr, bytearray, 'TryteString'] defines a generic type alias, which can be legitimate. To use it properly, you'd need to provide a type argument that is compatible with the AnyStr type variable. TrytesCompatible[str] or TrytesCompatible[bytes] or TrytesCompatible[AnyStr] would all be allowed. --- iota/types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iota/types.py b/iota/types.py index a4c3cf1..799aaa1 100644 --- a/iota/types.py +++ b/iota/types.py @@ -3,7 +3,7 @@ from itertools import chain from math import ceil from random import SystemRandom -from typing import Any, AnyStr, Generator, Iterable, Iterator, List, \ +from typing import Any, Generator, Iterable, Iterator, List, \ MutableSequence, Optional, Type, TypeVar, Union, Dict from warnings import warn @@ -24,7 +24,7 @@ ] # Custom types for type hints and docstrings. -TrytesCompatible = Union[AnyStr, bytearray, 'TryteString'] +TrytesCompatible = Union[str, bytes, bytearray, 'TryteString'] T = TypeVar('T', bound='TryteString')