MCPcopy
hub / github.com/reflex-dev/reflex / get

Method get

packages/reflex-base/src/reflex_base/vars/object.py:244–265  ·  view source on GitHub ↗

Get an item from the object. Args: key: The key to get from the object. default: The default value if the key is not found. Returns: The item from the object.

(self, key: Var | Any, default: Var | Any | None = None)

Source from the content-addressed store, hash-verified

242 return ObjectItemOperation.create(self, key).guess_type()
243
244 def get(self, key: Var | Any, default: Var | Any | None = None) -> Var:
245 """Get an item from the object.
246
247 Args:
248 key: The key to get from the object.
249 default: The default value if the key is not found.
250
251 Returns:
252 The item from the object.
253 """
254 from reflex_components_core.core.cond import cond
255
256 if default is None:
257 default = Var.create(None)
258
259 value = self.__getitem__(key) # pyright: ignore[reportUnknownVariableType,reportAttributeAccessIssue,reportUnknownMemberType]
260
261 return cond( # pyright: ignore[reportUnknownVariableType]
262 value,
263 value,
264 default,
265 )
266
267 # NoReturn is used here to catch when key value is Any
268 @overload

Callers 15

_generate_docstringsFunction · 0.45
_get_visible_type_nameFunction · 0.45
wrapperFunction · 0.45
get_serializerFunction · 0.45
get_serializer_typeFunction · 0.45
format_query_paramsFunction · 0.45
get_field_typeFunction · 0.45

Calls 3

__getitem__Method · 0.95
condFunction · 0.90
createMethod · 0.45

Tested by

no test coverage detected