From ce6cff8e9a9bf98f318061cdb2eb199ece28733e Mon Sep 17 00:00:00 2001 From: Jan-Lukas Wynen Date: Tue, 16 Apr 2024 15:25:23 +0200 Subject: [PATCH] Fix type issues --- src/scitacean/client.py | 4 ++-- tests/client/query_client_test.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/scitacean/client.py b/src/scitacean/client.py index ee18be14..ab456299 100644 --- a/src/scitacean/client.py +++ b/src/scitacean/client.py @@ -781,12 +781,12 @@ def query_datasets( ) """ # Use a pydantic model to support serializing custom types to JSON. - params_model = pydantic.create_model( + params_model = pydantic.create_model( # type: ignore[call-overload] "QueryParams", **{key: (type(field), ...) for key, field in fields.items()} ) params = {"fields": params_model(**fields).model_dump_json()} - limits = {} + limits: dict[str, Union[str, int]] = {} if order is not None: limits["order"] = order if limit is not None: diff --git a/tests/client/query_client_test.py b/tests/client/query_client_test.py index e9730064..49a97950 100644 --- a/tests/client/query_client_test.py +++ b/tests/client/query_client_test.py @@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2024 SciCat Project (https://github.com/SciCatProject/scitacean) +from typing import Union + import pytest from dateutil.parser import parse as parse_datetime @@ -8,7 +10,9 @@ from scitacean.testing.backend import skip_if_not_backend from scitacean.testing.backend.config import SciCatAccess -UPLOAD_DATASETS = { +UPLOAD_DATASETS: dict[ + str, Union[model.UploadDerivedDataset, model.UploadRawDataset] +] = { "raw1": model.UploadRawDataset( ownerGroup="PLACEHOLDER", accessGroups=["uu", "faculty"],