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

Method size

couchbase/datastructures.py:806–829  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

804 return value in list_
805
806 def size(self) -> int:
807 """Returns the number of items in the set.
808
809 Returns:
810 int: The number of items in the set.
811
812 """
813 op_type = DatastructureOperationType.SetSize
814 with ObservableRequestHandler(op_type, self._impl.observability_instruments) as ds_obs_handler:
815 ds_obs_handler.create_kv_span(self._impl._request_builder._collection_dtls.get_details_as_dict())
816 kv_op_type = KeyValueOperationType.LookupIn
817 with ObservableRequestHandler(kv_op_type, self._impl.observability_instruments) as obs_handler:
818 op = count('')
819 req, transcoder = self._impl.request_builder.build_lookup_in_request(self._key,
820 (op,),
821 obs_handler,
822 parent_span=ds_obs_handler.wrapped_span) # noqa: E501
823 sd_res: LookupInResult = self._execute_op(self._impl.lookup_in,
824 req,
825 obs_handler,
826 ds_obs_handler.wrapped_span,
827 create_type=True,
828 transcoder=transcoder)
829 return sd_res.value[0].get('value', None)
830
831 def clear(self) -> None:
832 """Clears the set.

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