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

Method get

couchbase/datastructures.py:456–482  ·  view source on GitHub ↗

Fetches a specific key from the map. Args: mapkey (str): The key to fetch. Returns: Any: The value of the specified key.

(self, mapkey: str)

Source from the content-addressed store, hash-verified

454 create_type=True)
455
456 def get(self, mapkey: str) -> Any:
457 """Fetches a specific key from the map.
458
459 Args:
460 mapkey (str): The key to fetch.
461
462 Returns:
463 Any: The value of the specified key.
464
465 """
466 op_type = DatastructureOperationType.MapGet
467 with ObservableRequestHandler(op_type, self._impl.observability_instruments) as ds_obs_handler:
468 ds_obs_handler.create_kv_span(self._impl._request_builder._collection_dtls.get_details_as_dict())
469 kv_op_type = KeyValueOperationType.LookupIn
470 with ObservableRequestHandler(kv_op_type, self._impl.observability_instruments) as obs_handler:
471 op = subdoc_get(mapkey)
472 req, transcoder = self._impl.request_builder.build_lookup_in_request(self._key,
473 (op,),
474 obs_handler,
475 parent_span=ds_obs_handler.wrapped_span) # noqa: E501
476 sd_res = self._execute_op(self._impl.lookup_in,
477 req,
478 obs_handler,
479 ds_obs_handler.wrapped_span,
480 create_type=True,
481 transcoder=transcoder)
482 return sd_res.value[0].get('value', None)
483
484 def remove(self, mapkey: str) -> None:
485 """Removes a specific key from the map.

Callers 6

get_atMethod · 0.45
sizeMethod · 0.45
sizeMethod · 0.45
sizeMethod · 0.45
popMethod · 0.45
sizeMethod · 0.45

Calls 5

_execute_opMethod · 0.95
get_details_as_dictMethod · 0.80
create_kv_spanMethod · 0.45

Tested by

no test coverage detected