from streamlit.folder_black_list import FolderBlackList

from streamlit.logger import get_logger

LOGGER = get_logger(__name__)

try:
    # If the watchdog module is installed.
    from streamlit.watcher.EventBasedFileWatcher import (
        EventBasedFileWatcher as FileWatcher, )
except ImportError:
    # Fallback that doesn't use watchdog.
    from streamlit.watcher.PollingFileWatcher import PollingFileWatcher as FileWatcher

    if not config.get_option("global.disableWatchdogWarning"):
        msg = "\n  $ xcode-select --install" if util.is_darwin() else ""

        LOGGER.warning("""
  For better performance, install the Watchdog module:
  %s
  $ pip install watchdog

        """ % msg)

# Streamlit never watches files in the folders below.
DEFAULT_FOLDER_BLACKLIST = [
    "**/.*",
    "**/anaconda2",
    "**/anaconda3",
    "**/miniconda2",
    "**/miniconda3",
Esempio n. 2
0
from streamlit import util

from streamlit.logger import get_logger

LOGGER = get_logger(__name__)

try:
    # If the watchdog module is installed.
    from streamlit.watcher.EventBasedFileWatcher import (
        EventBasedFileWatcher as FileWatcher, )
except ImportError:
    # Fallback that doesn't use watchdog.
    from streamlit.watcher.PollingFileWatcher import PollingFileWatcher as FileWatcher

    if not config.get_option('global.disableWatchdogWarning'):
        msg = '\n  $ xcode-select --install' if util.is_darwin() else ''

        LOGGER.warning("""
  For better performance, install the Watchdog module:
  %s
  $ pip install watchdog

        """ % msg)

WatchedModule = collections.namedtuple("WatchedModule",
                                       ["watcher", "module_name"])


class LocalSourcesWatcher(object):
    def __init__(self, report, on_file_changed):
        self._report = report