Hello I am using Python 3.8
And I am implementing a dataclass with a fix list in order to do this I have the following code:
from dataclasses import dataclass
from typing import Annotated, List, ValueRange
from pydantic import validate_arguments
@validate_arguments
@dataclass
class WorldArea:
...
data: Annotated[List[float], ValueRange(1, 3)]
...
The idea is that data will be a list with 1, 2 or 3 elements, as you can see I am using Annotated and ValueRange, but when I execute I get the following error:
File "a.py", line 2, in from typing import List, ValueRange ImportError: cannot import name 'Annotated' from 'typing'
File "a.py", line 2, in from typing import List, ValueRange ImportError: cannot import name 'ValueRange' from 'typing'