Skip to content

chore: require kwargs for utils.copy_dict() #1871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gitlab/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ def http_request(
url = self._build_url(path)

params: Dict[str, Any] = {}
utils.copy_dict(params, query_data)
utils.copy_dict(src=query_data, dest=params)

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

opts = self._get_session_opts()

Expand Down
6 changes: 5 additions & 1 deletion gitlab/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ def response_content(
return None


def copy_dict(dest: Dict[str, Any], src: Dict[str, Any]) -> None:
def copy_dict(
*,
src: Dict[str, Any],
dest: Dict[str, Any],
) -> None:
for k, v in src.items():
if isinstance(v, dict):
# Transform dict values to new attributes. For example:
Expand Down