Skip to content

Commit 7cf35b2

Browse files
chore: require kwargs for utils.copy_dict()
The non-keyword arguments were a tiny bit confusing as the destination was first and the source was second. Change the order and require key-word only arguments to ensure we don't silently break anyone.
1 parent 64d01ef commit 7cf35b2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

gitlab/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ def http_request(
647647
url = self._build_url(path)
648648

649649
params: Dict[str, Any] = {}
650-
utils.copy_dict(params, query_data)
650+
utils.copy_dict(src=query_data, dest=params)
651651

652652
# Deal with kwargs: by default a user uses kwargs to send data to the
653653
# gitlab server, but this generates problems (python keyword conflicts
@@ -656,12 +656,12 @@ def http_request(
656656
# value as arguments for the gitlab server, and ignore the other
657657
# arguments, except pagination ones (per_page and page)
658658
if "query_parameters" in kwargs:
659-
utils.copy_dict(params, kwargs["query_parameters"])
659+
utils.copy_dict(src=kwargs["query_parameters"], dest=params)
660660
for arg in ("per_page", "page"):
661661
if arg in kwargs:
662662
params[arg] = kwargs[arg]
663663
else:
664-
utils.copy_dict(params, kwargs)
664+
utils.copy_dict(src=kwargs, dest=params)
665665

666666
opts = self._get_session_opts()
667667

gitlab/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ def response_content(
4444
return None
4545

4646

47-
def copy_dict(dest: Dict[str, Any], src: Dict[str, Any]) -> None:
47+
def copy_dict(
48+
*,
49+
src: Dict[str, Any],
50+
dest: Dict[str, Any],
51+
) -> None:
4852
for k, v in src.items():
4953
if isinstance(v, dict):
5054
# Transform dict values to new attributes. For example:

0 commit comments

Comments
 (0)