From 9681802be2fbc1922052eab060efeefa7c29a228 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Wed, 13 Sep 2023 19:22:34 +0000 Subject: [PATCH] docs: add some missing inline documentation --- src/finch/_base_client.py | 11 +++++++++++ src/finch/_utils/_transform.py | 4 ++++ src/finch/_utils/_utils.py | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/src/finch/_base_client.py b/src/finch/_base_client.py index 58309b6b..9437d66b 100644 --- a/src/finch/_base_client.py +++ b/src/finch/_base_client.py @@ -132,6 +132,17 @@ def __init__( class BasePage(GenericModel, Generic[ModelT]): + """ + Defines the core interface for pagination. + + Type Args: + ModelT: The pydantic model that represents an item in the response. + + Methods: + has_next_page(): Check if there is another page available + next_page_info(): Get the necesary information to make a request for the next page + """ + _options: FinalRequestOptions = PrivateAttr() _model: Type[ModelT] = PrivateAttr() diff --git a/src/finch/_utils/_transform.py b/src/finch/_utils/_transform.py index 9bb71090..c007d8b0 100644 --- a/src/finch/_utils/_transform.py +++ b/src/finch/_utils/_transform.py @@ -108,6 +108,10 @@ def _get_annoted_type(type_: type) -> type | None: def _maybe_transform_key(key: str, type_: type) -> str: + """Transform the given `data` based on the annotations provided in `type_`. + + Note: this function only looks at `Annotated` types that contain `PropertInfo` metadata. + """ annotated_type = _get_annoted_type(type_) if annotated_type is None: # no `Annotated` definition for this type, no transformation needed diff --git a/src/finch/_utils/_utils.py b/src/finch/_utils/_utils.py index dde4b457..603f7c10 100644 --- a/src/finch/_utils/_utils.py +++ b/src/finch/_utils/_utils.py @@ -27,6 +27,12 @@ def extract_files( *, paths: Sequence[Sequence[str]], ) -> list[tuple[str, FileTypes]]: + """Recursively extract files from the given dictionary based on specified paths. + + A path may look like this ['foo', 'files', '', 'data']. + + Note: this mutates the given dictionary. + """ files: list[tuple[str, FileTypes]] = [] for path in paths: files.extend(_extract_items(query, path, index=0, flattened_key=None))