From 36cc243fa700c1c5a9731c421fbddf282ff8f715 Mon Sep 17 00:00:00 2001 From: Patrick Latimer Date: Mon, 6 Jan 2025 10:06:25 -0800 Subject: [PATCH] Update fetch docstring to handle lists --- src/aind_slims_api/core.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/aind_slims_api/core.py b/src/aind_slims_api/core.py index eab4f01..b02e2ca 100644 --- a/src/aind_slims_api/core.py +++ b/src/aind_slims_api/core.py @@ -74,7 +74,9 @@ def fetch( start (int, optional): The first row to return end (int, optional): The last row to return *args (Slims.criteria.Criterion): Optional criteria to apply - **kwargs (dict[str,str]): "field=value" filters + **kwargs (dict[str,str|list]): "field=value" filters. + If value is a list, will apply "field IN value" criterion + Returns: records (list[SlimsRecord] | None): Matching records, if any @@ -333,9 +335,7 @@ def rest_link(self, table: SLIMS_TABLES, **kwargs): queries = [f"?{k}={v}" for k, v in kwargs.items()] return base_url + "".join(queries) - def add_model( - self, model: SlimsBaseModelTypeVar, *args, **kwargs - ) -> SlimsBaseModelTypeVar: + def add_model(self, model: SlimsBaseModelTypeVar, *args, **kwargs) -> SlimsBaseModelTypeVar: """Given a SlimsBaseModel object, add it to SLIMS Args model (SlimsBaseModel): object to add @@ -380,9 +380,7 @@ def update_model(self, model: SlimsBaseModel, *args, **kwargs): rtn = self.update( model._slims_table, model.pk, - model.model_dump( - include=fields_to_include, by_alias=True, **kwargs, context="slims_post" - ), + model.model_dump(include=fields_to_include, by_alias=True, **kwargs, context="slims_post"), ) return type(model).model_validate(rtn)