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

Method __init_subclass__

reflex/istate/shared.py:504–521  ·  view source on GitHub ↗

Initialize subclass and set up shared state fields. Args: **kwargs: The kwargs to pass to the init_subclass method.

(cls, **kwargs)

Source from the content-addressed store, hash-verified

502
503 @classmethod
504 def __init_subclass__(cls, **kwargs):
505 """Initialize subclass and set up shared state fields.
506
507 Args:
508 **kwargs: The kwargs to pass to the init_subclass method.
509 """
510 kwargs["mixin"] = False
511 cls._mixin = False
512 super().__init_subclass__(**kwargs)
513 root_state = cls.get_root_state()
514 if root_state.backend_vars["_reflex_internal_links"] is None:
515 root_state.backend_vars["_reflex_internal_links"] = {}
516 if root_state is State:
517 # Always fetch SharedStateBaseInternal to access
518 # `_modify_linked_states` without having to use `.get_state()` which
519 # pulls in all linked states and substates which may not actually be
520 # accessed for this event.
521 root_state._always_dirty_substates.add(SharedStateBaseInternal.get_name())

Callers

nothing calls this directly

Calls 2

get_root_stateMethod · 0.80
get_nameMethod · 0.80

Tested by

no test coverage detected