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

Method size

couchbase/datastructures.py:273–296  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

271 raise InvalidArgumentException(message=f'Index: {index} is out of range.') from None
272
273 def size(self) -> int:
274 """Returns the number of items in the list.
275
276 Returns:
277 int: The number of items in the list.
278
279 """
280 op_type = DatastructureOperationType.ListSize
281 with ObservableRequestHandler(op_type, self._impl.observability_instruments) as ds_obs_handler:
282 ds_obs_handler.create_kv_span(self._impl._request_builder._collection_dtls.get_details_as_dict())
283 kv_op_type = KeyValueOperationType.LookupIn
284 with ObservableRequestHandler(kv_op_type, self._impl.observability_instruments) as obs_handler:
285 op = count('')
286 req, transcoder = self._impl.request_builder.build_lookup_in_request(self._key,
287 (op,),
288 obs_handler,
289 parent_span=ds_obs_handler.wrapped_span) # noqa: E501
290 sdres: LookupInResult = self._execute_op(self._impl.lookup_in,
291 req,
292 obs_handler,
293 ds_obs_handler.wrapped_span,
294 create_type=True,
295 transcoder=transcoder)
296 return sdres.value[0].get('value', None)
297
298 def index_of(self, value: JSONType) -> int:
299 """Returns the index of a specific value from the list.

Callers

nothing calls this directly

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

no test coverage detected