MCPcopy Index your code
hub / github.com/reactive-python/reactpy / __init__

Method __init__

src/py/reactpy/reactpy/testing/backend.py:41–63  ·  view source on GitHub ↗
(
        self,
        host: str = "127.0.0.1",
        port: int | None = None,
        app: Any | None = None,
        implementation: BackendType[Any] | None = None,
        options: Any | None = None,
        timeout: float | None = None,
    )

Source from the content-addressed store, hash-verified

39 _exit_stack = AsyncExitStack()
40
41 def __init__(
42 self,
43 host: str = "127.0.0.1",
44 port: int | None = None,
45 app: Any | None = None,
46 implementation: BackendType[Any] | None = None,
47 options: Any | None = None,
48 timeout: float | None = None,
49 ) -> None:
50 self.host = host
51 self.port = port or find_available_port(host)
52 self.mount, self._root_component = _hotswap()
53 self.timeout = (
54 REACTPY_TESTING_DEFAULT_TIMEOUT.current if timeout is None else timeout
55 )
56
57 if app is not None and implementation is None:
58 msg = "If an application instance its corresponding server implementation must be provided too."
59 raise ValueError(msg)
60
61 self._app = app
62 self.implementation = implementation or default_server
63 self._options = options
64
65 @property
66 def log_records(self) -> list[logging.LogRecord]:

Callers

nothing calls this directly

Calls 2

find_available_portFunction · 0.90
_hotswapFunction · 0.85

Tested by

no test coverage detected