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

Method clear

couchbase/datastructures.py:331–348  ·  view source on GitHub ↗

Clears the list. Raises: :class:`~couchbase.exceptions.DocumentNotFoundException`: If the list does not already exist.

(self)

Source from the content-addressed store, hash-verified

329 return list_.content_as[list]
330
331 def clear(self) -> None:
332 """Clears the list.
333
334 Raises:
335 :class:`~couchbase.exceptions.DocumentNotFoundException`: If the list does not already exist.
336 """
337 op_type = DatastructureOperationType.ListClear
338 with ObservableRequestHandler(op_type, self._impl.observability_instruments) as ds_obs_handler:
339 ds_obs_handler.create_kv_span(self._impl._request_builder._collection_dtls.get_details_as_dict())
340 kv_op_type = KeyValueOperationType.Remove
341 with ObservableRequestHandler(kv_op_type, self._impl.observability_instruments) as obs_handler:
342 try:
343 req = self._impl.request_builder.build_remove_request(self._key,
344 obs_handler,
345 parent_span=ds_obs_handler.wrapped_span)
346 self._impl.remove(req, obs_handler)
347 except DocumentNotFoundException:
348 pass
349
350 def __iter__(self):
351 list_ = self._get()

Callers

nothing calls this directly

Calls 5

get_details_as_dictMethod · 0.80
build_remove_requestMethod · 0.80
create_kv_spanMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected