Skip to content

Commit

Permalink
docs: add some missing inline documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Sep 13, 2023
1 parent 4e90818 commit 9681802
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/finch/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 4 additions & 0 deletions src/finch/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/finch/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', '<array>', '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))
Expand Down

0 comments on commit 9681802

Please sign in to comment.