Ejemplo n.º 1
0
import threading as _threading
import traceback as _traceback
import types as _types
import json as _json
import numpy as _np

from streamlit import code_util as _code_util
from streamlit import util as _util
from streamlit.ReportThread import get_report_ctx, add_report_ctx
from streamlit.DeltaGenerator import DeltaGenerator as _DeltaGenerator

# Modules that the user should have access to.
from streamlit.caching import cache  # noqa: F401

# Delta generator with no queue so it can't send anything out.
_NULL_DELTA_GENERATOR = _DeltaGenerator(None)

# This is set to True inside cli._main_run(), and is False otherwise.
# If False, we should assume that DeltaGenerator functions are effectively
# no-ops, and adapt gracefully.
_is_running_with_streamlit = False


def _set_log_level():
    _logger.set_log_level(_config.get_option("global.logLevel").upper())
    _logger.init_tornado_logs()


# Make this file only depend on config option in an asynchronous manner. This
# avoids a race condition when another file (such as a test file) tries to pass
# in an alternative config.
Ejemplo n.º 2
0
# If False, we should assume that DeltaGenerator functions are effectively
# no-ops, and adapt gracefully.
_is_running_with_streamlit = False


def _set_log_level():
    _logger.set_log_level(_config.get_option("global.logLevel").upper())
    _logger.init_tornado_logs()


# Make this file only depend on config option in an asynchronous manner. This
# avoids a race condition when another file (such as a test file) tries to pass
# in an alternative config.
_config.on_config_parsed(_set_log_level)

_main = _DeltaGenerator(container=_BlockPath_pb2.BlockPath.MAIN)
sidebar = _DeltaGenerator(container=_BlockPath_pb2.BlockPath.SIDEBAR)

# DeltaGenerator methods:

altair_chart = _main.altair_chart  # noqa: E221
area_chart = _main.area_chart  # noqa: E221
audio = _main.audio  # noqa: E221
balloons = _main.balloons  # noqa: E221
bar_chart = _main.bar_chart  # noqa: E221
bokeh_chart = _main.bokeh_chart  # noqa: E221
button = _main.button  # noqa: E221
checkbox = _main.checkbox  # noqa: E221
code = _main.code  # noqa: E221
dataframe = _main.dataframe  # noqa: E221
date_input = _main.date_input  # noqa: E221