From b1c5987c606a14874b412e70f93015e161e278d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20H=E1=BB=93ng=20Qu=C3=A2n?= Date: Sat, 30 May 2020 02:33:40 +0700 Subject: [PATCH] fix: Support more Python sequence types when encoding to Protobuf (#21) --- google/cloud/firestore_v1/_helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google/cloud/firestore_v1/_helpers.py b/google/cloud/firestore_v1/_helpers.py index 09f5d7f41c0e..34e7c5bbfa56 100644 --- a/google/cloud/firestore_v1/_helpers.py +++ b/google/cloud/firestore_v1/_helpers.py @@ -186,8 +186,8 @@ def encode_value(value): if isinstance(value, GeoPoint): return document_pb2.Value(geo_point_value=value.to_protobuf()) - if isinstance(value, list): - value_list = [encode_value(element) for element in value] + if isinstance(value, (list, tuple, set, frozenset)): + value_list = tuple(encode_value(element) for element in value) value_pb = document_pb2.ArrayValue(values=value_list) return document_pb2.Value(array_value=value_pb)