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)
| 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 |
no test coverage detected