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

Function _fake_app

tests/units/utils/test_telemetry_accounting.py:44–64  ·  view source on GitHub ↗

Build a SimpleNamespace app with the attributes the collector touches. Args: **overrides: App attribute overrides. ``_lifespan_tasks`` is surfaced through a ``get_lifespan_tasks()`` method to match the real API. Returns: A ``SimpleNamespace`` standing in for a c

(**overrides)

Source from the content-addressed store, hash-verified

42
43
44def _fake_app(**overrides):
45 """Build a SimpleNamespace app with the attributes the collector touches.
46
47 Args:
48 **overrides: App attribute overrides. ``_lifespan_tasks`` is surfaced
49 through a ``get_lifespan_tasks()`` method to match the real API.
50
51 Returns:
52 A ``SimpleNamespace`` standing in for a compiled ``App``.
53 """
54 defaults = {
55 "_state": None,
56 "_pages": {},
57 "_unevaluated_pages": {},
58 }
59 lifespan_tasks = overrides.pop("_lifespan_tasks", {})
60 defaults.update(overrides)
61 return SimpleNamespace(
62 get_lifespan_tasks=lambda: tuple(lifespan_tasks),
63 **defaults,
64 )
65
66
67class TelAcctRoot(BaseState):

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected