From 2ff8b1e7b58344baa166a08ea373a0915c5ae3cc Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 6 Sep 2023 08:21:58 -0400 Subject: [PATCH] fix(client): properly handle optional file params (#194) --- src/modern_treasury/_utils/_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modern_treasury/_utils/_utils.py b/src/modern_treasury/_utils/_utils.py index af575663..a5541bec 100644 --- a/src/modern_treasury/_utils/_utils.py +++ b/src/modern_treasury/_utils/_utils.py @@ -38,12 +38,15 @@ def _extract_items( path: Sequence[str], *, index: int, - # TODO: rename flattened_key: str | None, ) -> list[tuple[str, FileTypes]]: try: key = path[index] except IndexError: + if isinstance(obj, NotGiven): + # no value was provided - we can safely ignore + return [] + # We have exhausted the path, return the entry we found. if not isinstance(obj, bytes) and not isinstance(obj, tuple): raise RuntimeError(