MCPcopy Index your code
hub / github.com/google/adk-python / setdefault

Method setdefault

src/google/adk/sessions/state.py:104–110  ·  view source on GitHub ↗

Gets the value of a key, or sets it to a default if the key doesn't exist.

(self, key: str, default: Any = None)

Source from the content-addressed store, hash-verified

102 return key in self._value or key in self._delta
103
104 def setdefault(self, key: str, default: Any = None) -> Any:
105 """Gets the value of a key, or sets it to a default if the key doesn't exist."""
106 if key in self:
107 return self[key]
108 else:
109 self[key] = default
110 return default
111
112 def has_delta(self) -> bool:
113 """Whether the state has pending delta."""

Callers 15

_sanitize_schema_typeFunction · 0.80
callMethod · 0.80
get_table_schemaFunction · 0.80
__init__Method · 0.80
_create_session_implMethod · 0.80
append_eventMethod · 0.80
model_dump_jsonMethod · 0.80
_normalize_idsFunction · 0.80
exportMethod · 0.80
_build_reference_mapFunction · 0.80

Calls

no outgoing calls

Tested by 5

_normalize_idsFunction · 0.64
save_artifactMethod · 0.64
add_artifactMethod · 0.64
runMethod · 0.64
runMethod · 0.64