From f0101283ab24c98cb3d8343aa001176c7981a6e3 Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Sat, 27 May 2023 00:01:25 +0200 Subject: [PATCH 1/4] fix type annotation for DataladAuth-constructor This commit replaces the faulty CredentialManager annotation for the cfg-parameter of DataladAuth.__init__() with the correct type, i.e. ConfigManager. --- datalad_next/utils/requests_auth.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/datalad_next/utils/requests_auth.py b/datalad_next/utils/requests_auth.py index f3192278..14029cb2 100644 --- a/datalad_next/utils/requests_auth.py +++ b/datalad_next/utils/requests_auth.py @@ -9,6 +9,7 @@ import requests import www_authenticate +from datalad.config import ConfigManager from datalad_next.utils import CredentialManager from datalad_next.utils.http_helpers import get_auth_realm @@ -38,7 +39,7 @@ class DataladAuth(requests.auth.AuthBase): 'bearer': 'token', } - def __init__(self, cfg: CredentialManager, credential: str | None = None): + def __init__(self, cfg: ConfigManager, credential: str | None = None): """ Parameters ---------- From cac91ff6a17c36844f91a0ac1249a6e65f61c0d5 Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Sat, 27 May 2023 00:09:42 +0200 Subject: [PATCH 2/4] add a changelog entry for the PR --- .../20230527_000546_christian.moench_bf_type_error.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog.d/20230527_000546_christian.moench_bf_type_error.md diff --git a/changelog.d/20230527_000546_christian.moench_bf_type_error.md b/changelog.d/20230527_000546_christian.moench_bf_type_error.md new file mode 100644 index 00000000..4956f41f --- /dev/null +++ b/changelog.d/20230527_000546_christian.moench_bf_type_error.md @@ -0,0 +1,5 @@ +### 🏠 Internal + +- Use the correct type annotation for `cfg`-parameter of + `datalad_next.utils.requests_auth.DataladAuth.__init__()` + https://github.com/datalad/datalad-next/pull/385 (by @christian-monch) From 0a94594a8f937d3b830bf8fc2152e48fad18e85e Mon Sep 17 00:00:00 2001 From: Michael Hanke Date: Sat, 27 May 2023 06:38:17 +0200 Subject: [PATCH 3/4] Prefer import from datalad_next --- datalad_next/utils/requests_auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datalad_next/utils/requests_auth.py b/datalad_next/utils/requests_auth.py index 14029cb2..8deda588 100644 --- a/datalad_next/utils/requests_auth.py +++ b/datalad_next/utils/requests_auth.py @@ -9,7 +9,7 @@ import requests import www_authenticate -from datalad.config import ConfigManager +from datalad_next.config import ConfigManager from datalad_next.utils import CredentialManager from datalad_next.utils.http_helpers import get_auth_realm From 00208f62b214919bb6529efa48c9f11c07e199a3 Mon Sep 17 00:00:00 2001 From: Christian Monch Date: Sat, 27 May 2023 07:54:17 +0200 Subject: [PATCH 4/4] fix DataladAuth.__init__() docstring --- datalad_next/utils/requests_auth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datalad_next/utils/requests_auth.py b/datalad_next/utils/requests_auth.py index 8deda588..44181521 100644 --- a/datalad_next/utils/requests_auth.py +++ b/datalad_next/utils/requests_auth.py @@ -43,8 +43,8 @@ def __init__(self, cfg: ConfigManager, credential: str | None = None): """ Parameters ---------- - cfg: CredentialManager - Credentials are looked up in this instance. + cfg: ConfigManager + Is passed to CredentialManager() as `cfg`-parameter. credential: str, optional Name of a particular credential to be used for any operations. """