<@ULVA73B9P> Hi! Whats the correct pattern for typ...
# ask-marvin
a
@Marvin Hi! Whats the correct pattern for typing that prefect accepts for my particular parameter:
Copy code
datasets: Dict[str : List[str]]
TypeError: Parameters to generic types must be types. Got slice(<class 'str'>, typing.List[str], None).
m
It looks like an issue with your typing syntax, and the error message implies a problem specifying generic types in the type hint for
datasets
. 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:
Copy code
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.