MCPcopy Index your code
hub / github.com/couchbase/couchbase-python-client / size

Method size

couchbase/datastructures.py:509–532  ·  view source on GitHub ↗

Returns the number of items in the map. Returns: int: The number of items in the map.

(self)

Source from the content-addressed store, hash-verified

507 raise InvalidArgumentException(message=f'Key: {mapkey} is not in the map.') from None
508
509 def size(self) -> int:
510 """Returns the number of items in the map.
511
512 Returns:
513 int: The number of items in the map.
514
515 """
516 op_type = DatastructureOperationType.MapSize
517 with ObservableRequestHandler(op_type, self._impl.observability_instruments) as ds_obs_handler:
518 ds_obs_handler.create_kv_span(self._impl._request_builder._collection_dtls.get_details_as_dict())
519 kv_op_type = KeyValueOperationType.LookupIn
520 with ObservableRequestHandler(kv_op_type, self._impl.observability_instruments) as obs_handler:
521 op = count('')
522 req, transcoder = self._impl.request_builder.build_lookup_in_request(self._key,
523 (op,),
524 obs_handler,
525 parent_span=ds_obs_handler.wrapped_span) # noqa: E501
526 sd_res: LookupInResult = self._execute_op(self._impl.lookup_in,
527 req,
528 obs_handler,
529 ds_obs_handler.wrapped_span,
530 create_type=True,
531 transcoder=transcoder)
532 return sd_res.value[0].get('value', None)
533
534 def exists(self, key: str) -> bool:
535 """Checks whether a specific key exists in the map.

Callers 14

test_listMethod · 0.45
test_mapMethod · 0.45
test_setsMethod · 0.45
test_queueMethod · 0.45
test_kv_ds_listMethod · 0.45
test_kv_ds_mapMethod · 0.45
test_kv_ds_queueMethod · 0.45
test_kv_ds_setMethod · 0.45
test_kv_ds_listMethod · 0.45
test_kv_ds_mapMethod · 0.45
test_kv_ds_queueMethod · 0.45
test_kv_ds_setMethod · 0.45

Calls 7

_execute_opMethod · 0.95
countFunction · 0.90
get_details_as_dictMethod · 0.80
create_kv_spanMethod · 0.45
getMethod · 0.45

Tested by 12

test_listMethod · 0.36
test_mapMethod · 0.36
test_setsMethod · 0.36
test_queueMethod · 0.36
test_kv_ds_listMethod · 0.36
test_kv_ds_mapMethod · 0.36
test_kv_ds_queueMethod · 0.36
test_kv_ds_setMethod · 0.36
test_kv_ds_listMethod · 0.36
test_kv_ds_mapMethod · 0.36
test_kv_ds_queueMethod · 0.36
test_kv_ds_setMethod · 0.36