From 96bf18d5f159ee3fa52f4b221dde578a0ffcf896 Mon Sep 17 00:00:00 2001 From: dosisod <39638017+dosisod@users.noreply.github.com> Date: Fri, 31 Mar 2023 12:19:38 -0700 Subject: [PATCH 1/2] Remove `UNSET` objects from lists --- githubkit/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/githubkit/utils.py b/githubkit/utils.py index 71693a723..abc66e876 100644 --- a/githubkit/utils.py +++ b/githubkit/utils.py @@ -36,6 +36,8 @@ def exclude_unset(data: Any) -> Any: return data.__class__( (k, exclude_unset(v)) for k, v in data.items() if v is not UNSET ) + elif isinstance(data, list): + return [exclude_unset(i) for i in data] elif data is UNSET: return None return data From 4f6e514bd04052ef67c74cdb094fadef4975a50a Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Sat, 1 Apr 2023 12:12:13 +0800 Subject: [PATCH 2/2] :recycle: use data class to construct --- githubkit/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/githubkit/utils.py b/githubkit/utils.py index abc66e876..805c6b739 100644 --- a/githubkit/utils.py +++ b/githubkit/utils.py @@ -37,7 +37,7 @@ def exclude_unset(data: Any) -> Any: (k, exclude_unset(v)) for k, v in data.items() if v is not UNSET ) elif isinstance(data, list): - return [exclude_unset(i) for i in data] + return data.__class__(exclude_unset(i) for i in data) elif data is UNSET: return None return data