Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
skip_dispatch = kwargs.pop('_awe_skip_dispatch', None)
arg = kwargs.pop('_awe_arg', None)
args = [arg] if arg else []
# type: Element
result = element_type(
root=self.root,
parent=self,
element_id=element_id,
props=props,
style=style,
stack=self._stack,
)
self._register(result)
result._init(*args, **kwargs)
if updater:
self._register(element_updater.Updater(
element=result,
updater=updater
))
result._init_complete = True
self.children.append(result)
if not skip_dispatch:
self._dispatch(result._get_new_element_action())
return result
def _register(self, obj, obj_id=None):
if isinstance(obj, element_updater.Updater):
self._element_updater.add(obj)
else:
self._registry.register(obj, obj_id)