core: add type inference for bytes/bytearray (have to fix later)

This commit is contained in:
Shiz 2022-08-22 22:18:48 +02:00
parent 7cfcab44e5
commit a767c9cc7e
1 changed files with 3 additions and 0 deletions

View File

@ -246,6 +246,9 @@ PossibleType = U[Type, list, tuple, Callable[[O[Any]], Type]]
def to_type(type: PossibleType, ident: O[Any] = None) -> Type:
if isinstance(type, Type):
return type
if isinstance(type, (bytes, bytearray)):
from sx.types.data import Data
return Data()
t = getattr(type, '_sx_type_', None)
if t:
return t