File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -25,26 +25,22 @@ def _update_parent_kwargs(kwargs: dict) -> dict:
2525 Asserts that the `parent=` and `parent_id=` keys are not both provided.
2626 """
2727 parent = kwargs .get ("parent" , None )
28+ parent_id = kwargs .get ("parent_id" , None )
2829 if parent is None :
2930 # No parent to upgrade, return the kwargs as is
3031 return kwargs
31-
32+ if parent and parent_id :
33+ raise ValueError ("Cannot provide both `parent=` and `parent_id=`" )
3234 if not isinstance (parent , Tag ):
3335 raise TypeError (
3436 "`parent=` must be a Tag instance. If using a string, please use `parent_id=`"
3537 )
3638
37- parent_id = kwargs .get ("parent_id" , None )
38- if parent_id :
39- raise ValueError ("Cannot provide both `parent=` and `parent_id=`" )
40-
39+ # Remove `parent` from a copy of `kwargs` and replace it with `parent_id`
4140 ret_kwargs = {** kwargs }
42-
43- # Remove `parent` from ret_kwargs
44- # and store the `parent_id` in the ret_kwargs below
4541 del ret_kwargs ["parent" ]
46-
4742 ret_kwargs ["parent_id" ] = parent ["id" ]
43+
4844 return ret_kwargs
4945
5046
You can’t perform that action at this time.
0 commit comments