Skip to content

_runtime_type_check_setup

Configure runtime typechecking conditionally.

Functions⚓︎

configure_runtime_type_checking_mode ⚓︎

configure_runtime_type_checking_mode()

Optionally configure runtime type checking mode globally.

Source code in tail_jsonl/_runtime_type_check_setup.py
def configure_runtime_type_checking_mode() -> None:  # pragma: no cover
    """Optionally configure runtime type checking mode globally."""
    rtc_mode = _RuntimeTypeCheckingModes.from_environment()

    if rtc_mode is not _RuntimeTypeCheckingModes.OFF:
        from beartype.roar import BeartypeClawDecorWarning  # noqa: PLC0415

        beartype_this_package(
            conf=BeartypeConf(
                warning_cls_on_decorator_exception=(
                    None
                    if rtc_mode is _RuntimeTypeCheckingModes.ERROR
                    else BeartypeClawDecorWarning
                ),
            ),
        )