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

Method update

packages/reflex-base/src/reflex_base/style.py:264–282  ·  view source on GitHub ↗

Update the style. Args: style_dict: The style dictionary. kwargs: Other key value pairs to apply to the dict update.

(self, style_dict: dict | None, **kwargs)

Source from the content-addressed store, hash-verified

262 super().__init__(style_dict)
263
264 def update(self, style_dict: dict | None, **kwargs):
265 """Update the style.
266
267 Args:
268 style_dict: The style dictionary.
269 kwargs: Other key value pairs to apply to the dict update.
270 """
271 if not isinstance(style_dict, Style):
272 converted_dict = type(self)(style_dict)
273 else:
274 converted_dict = style_dict
275 if kwargs:
276 if converted_dict is None:
277 converted_dict = type(self)(kwargs)
278 else:
279 converted_dict.update(kwargs)
280 # Combine our VarData with that of any Vars in the style_dict that was passed.
281 self._var_data = VarData.merge(self._var_data, converted_dict._var_data)
282 super().update(converted_dict)
283
284 def __setitem__(self, key: str, value: Any):
285 """Set an item in the style.

Callers 15

_add_styleMethod · 0.95
createMethod · 0.45
createMethod · 0.45
_get_custom_codeMethod · 0.45
_run_deploy_scriptFunction · 0.45
_post_initMethod · 0.45
_set_persistentMethod · 0.45
__init__Method · 0.45
format_as_emotionFunction · 0.45
createMethod · 0.45
createMethod · 0.45

Calls 1

mergeMethod · 0.45

Tested by 11

test_replace_defaultsFunction · 0.36
restore_envFunction · 0.36
add_ageMethod · 0.36
preserve_memo_registriesFunction · 0.36
test_mutable_dictFunction · 0.36
test_mutable_setFunction · 0.36
_fake_configFunction · 0.36
_fake_appFunction · 0.36
_clear_exec_cachesFunction · 0.36