Skip to content

Commit 8da07c6

Browse files
committed
fix(firestore): restore required client parameter and format comprehensions for librarian
- Make client a required positional parameter in decode_value and decode_dict. - Format comprehensions in _helpers.py as single lines to satisfy librarian generation check. Towards #18402
1 parent 7eb279e commit 8da07c6

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

  • packages/google-cloud-firestore/google/cloud/firestore_v1

packages/google-cloud-firestore/google/cloud/firestore_v1/_helpers.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def reference_value_to_document(reference_value, client) -> Any:
348348

349349

350350
def decode_value(
351-
value, client=None
351+
value, client
352352
) -> Union[
353353
None,
354354
bool,
@@ -407,8 +407,7 @@ def decode_value(
407407
)
408408
elif value_type == "array_value":
409409
return [
410-
decode_value(element, client)
411-
for element in value_pb.array_value.values
410+
decode_value(element, client) for element in value_pb.array_value.values
412411
]
413412
elif value_type == "map_value":
414413
return decode_dict(value_pb.map_value.fields, client)
@@ -430,7 +429,7 @@ def _decode_bson_dict_recursive(data: Any) -> Any:
430429

431430
def decode_dict(
432431
value_fields,
433-
client=None,
432+
client,
434433
) -> Union[dict, Vector, _BSONType]:
435434
"""Converts a protobuf map of Firestore ``Value``-s.
436435
@@ -446,10 +445,7 @@ def decode_dict(
446445
Python values, Vector, or BSON object converted from ``value_fields``.
447446
"""
448447
value_fields_pb = getattr(value_fields, "_pb", value_fields)
449-
res = {
450-
key: decode_value(value, client)
451-
for key, value in value_fields_pb.items()
452-
}
448+
res = {key: decode_value(value, client) for key, value in value_fields_pb.items()}
453449

454450
if res.get("__type__", None) == "__vector__":
455451
# Vector data type is represented as mapping.

0 commit comments

Comments
 (0)