-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Labels
Description
TODO migrate to pydantic 2.0, and use a nested self-referential Union like this:
AutoPR/autopr/models/executable.py
Lines 30 to 40 in 1d818f4
# supports jinja2 templates like `{{ pull_request.title }}` | |
TemplateString = str | |
# supports jinja2 templates in nested dicts/lists | |
TemplateObject = Union[TemplateString, dict[str, Any], list[Any]] | |
# TODO migrate to pydantic 2.0, and use a nested self-referential Union like this: | |
# TemplateObject = Union[TemplateString, dict[str, "TemplateObject"], list["TemplateObject"]] | |
class ContextDict(dict[ContextVarName, Any]): | |
def get_path(self, path: ContextVarPath) -> Any: |
To resolve this TODO, you can start by updating the code to use the latest version of pydantic (2.0). Then, you can implement a nested self-referential Union, following the example provided.