Skip to content

Commit

Permalink
πŸ› Fix add_annotations codemod to respect model_config
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Apr 18, 2024
1 parent d8b6584 commit 969f63f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bump_pydantic/codemods/add_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def leave_Assign(self, original_node: cst.Assign, updated_node: cst.Assign) -> c
if not self.in_field:
return updated_node
if self.inside_base_model:
if m.matches(updated_node, m.Assign(targets=[m.AssignTarget(target=m.Name("model_config"))])):
return updated_node
Undefined = object()
value: cst.BaseExpression | object = Undefined
if m.matches(updated_node.value, m.Call(func=m.Name("Field"))):
Expand Down

0 comments on commit 969f63f

Please sign in to comment.