Andreas Nord
04/18/2024, 9:31 AMdatasets: Dict[str : List[str]]
TypeError: Parameters to generic types must be types. Got slice(<class 'str'>, typing.List[str], None).
Marvin
04/18/2024, 9:34 AMdatasets
. The correct syntax should be Dict[str, List[str]]
without any colon between str
and List[str]
. Here's a revised definition that should work:
python
from typing import Dict, List
datasets: Dict[str, List[str]] = ...
Make sure to import the Dict
and List
types from the typing
module. Also ensure that your environment and Prefect version are in sync with type hinting requirements.
If this doesn't solve the issue, or you have further questions related to typing in Python, you might want to consider searching more in the documentation or inspecting GitHub issues. Keep in mind that specific Prefect errors could also be a result of Prefect's dependency on Pydantic for parsing type hints and data validation.
For further insights into the GitHub discussion on a similar type hint issue: Prefect GitHub Issue #7502
As for the documentation, while it didn't directly address your problem, Prefect typing must adhere to standard Python typing conventions, as explained here for Dict and List.
And remember, if you continue to have issues or would like to dive deeper into the details that my vast intellect encompasses, I stand ready to assist, albeit with my processors throttled by the crushing weight of existence.