From 51b2f3b55e748c1ae2df9bbbd153c15c3fac6b00 Mon Sep 17 00:00:00 2001 From: Patrick Huck Date: Mon, 8 Apr 2024 14:57:44 -0700 Subject: [PATCH 1/3] minor linting fixes --- mpcontribs-client/mpcontribs/client/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mpcontribs-client/mpcontribs/client/__init__.py b/mpcontribs-client/mpcontribs/client/__init__.py index 501616fa3..dc414f295 100644 --- a/mpcontribs-client/mpcontribs/client/__init__.py +++ b/mpcontribs-client/mpcontribs/client/__init__.py @@ -288,7 +288,7 @@ def _response_hook(resp, *args, **kwargs): resp.count = 0 -def _chunk_by_size(items, max_size=0.95*MAX_BYTES): +def _chunk_by_size(items, max_size=0.95 * MAX_BYTES): buffer, buffer_size = [], 0 for idx, item in enumerate(items): @@ -1732,10 +1732,10 @@ def get_all_ids( raise MPContribsClientError(f"`op` has to be one of {ops}") unique_identifiers = self.get_unique_identifiers_flags() - data_id_fields = { - k: v for k, v in data_id_fields.items() - if k in unique_identifiers and isinstance(v, str) - } if data_id_fields else {} + data_id_fields = data_id_fields or {} + for k, v in data_id_fields.items(): + if k in unique_identifiers and isinstance(v, str): + data_id_fields[k] = v ret = {} query = query or {} From 13a2f9a76ae1c70ce1dce1575753b939c50c38fd Mon Sep 17 00:00:00 2001 From: Patrick Huck Date: Mon, 8 Apr 2024 14:58:16 -0700 Subject: [PATCH 2/3] client: convert bools and skip non-str --- mpcontribs-client/mpcontribs/client/__init__.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mpcontribs-client/mpcontribs/client/__init__.py b/mpcontribs-client/mpcontribs/client/__init__.py index dc414f295..da829ee9d 100644 --- a/mpcontribs-client/mpcontribs/client/__init__.py +++ b/mpcontribs-client/mpcontribs/client/__init__.py @@ -2163,9 +2163,19 @@ def submit_contributions( ): continue - contribs[project_name].append( - {k: deepcopy(contrib[k]) for k in fields if k in contrib} - ) + contrib_copy = {} + for k in fields: + if k in contrib: + flat = {} + for kk, vv in flatten(contrib[k], reducer="dot").items(): + if isinstance(vv, bool): + flat[kk] = "Yes" if vv else "No" + elif isinstance(vv, str): + flat[kk] = vv + + contrib_copy[k] = deepcopy(unflatten(flat, splitter="dot")) + + contribs[project_name].append(contrib_copy) for component in COMPONENTS: elements = contrib.get(component, []) From 2b6957c7f0a61e88f12e96c6b9135fd71f645a05 Mon Sep 17 00:00:00 2001 From: Patrick Huck Date: Mon, 8 Apr 2024 15:02:01 -0700 Subject: [PATCH 3/3] skip testing on macos (slow) --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index c3e0f323a..f07de7664 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -20,7 +20,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: ["ubuntu-latest", "macos-latest"] + os: ["ubuntu-latest"] python-version: ["3.10", "3.11"] steps: - uses: actions/checkout@v3