diff options
| author | Nejc Habjan <hab.nejc@gmail.com> | 2022-02-03 23:16:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-03 23:16:19 +0100 |
| commit | 2adf31dff04cd9b037d8727ab1b48385248bbabd (patch) | |
| tree | 0c97eb35be08710974f253984e3ef1e41587e3a9 | |
| parent | 64d01ef23b1269b705350106d8ddc2962a780dce (diff) | |
| parent | 7cf35b2c0e44732ca02b74b45525cc7c789457fb (diff) | |
| download | gitlab-2adf31dff04cd9b037d8727ab1b48385248bbabd.tar.gz | |
Merge pull request #1871 from python-gitlab/jlvillal/copy_dict
chore: require kwargs for `utils.copy_dict()`
| -rw-r--r-- | gitlab/client.py | 6 | ||||
| -rw-r--r-- | gitlab/utils.py | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/gitlab/client.py b/gitlab/client.py index 46ddd9d..a4c5831 100644 --- a/gitlab/client.py +++ b/gitlab/client.py @@ -647,7 +647,7 @@ class Gitlab: 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 @@ -656,12 +656,12 @@ class Gitlab: # 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() diff --git a/gitlab/utils.py b/gitlab/utils.py index f549042..7b01d17 100644 --- a/gitlab/utils.py +++ b/gitlab/utils.py @@ -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: |
