<commit_before># -*- coding: utf-8 -*-
#
# Ray documentation build configuration file, created by
# sphinx-quickstart on Fri Jul  1 13:19:58 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import glob
import shutil
import sys
import os
import urllib
sys.path.insert(0, os.path.abspath('.'))
from custom_directives import CustomGalleryItemDirective
from datetime import datetime

# These lines added to enable Sphinx to work without installing Ray.
import mock


class ChildClassMock(mock.Mock):
    @classmethod
    def __getattr__(cls, name):
        return mock.Mock


MOCK_MODULES = [
    "ax",
    "ax.service.ax_client",
    "blist",
    "ConfigSpace",
    "gym",
    "gym.spaces",
    "horovod",
    "horovod.ray",
    "kubernetes",
    "mlflow",
    "mxnet",
    "mxnet.model",
    "psutil",
    "pytorch_lightning.core.step_result",
    "pytorch_lightning.overrides.data_parallel",
    "pytorch_lightning.utilities.model_utils",
    "pytorch_lightning.trainer.model_hooks",
    "pytorch_lightning.trainer.optimizers",
    "pytorch_lightning.utilities.exceptions",
    "pytorch_lightning.utilities.memory",
    "ray._raylet",
    "ray.core.generated",
    "ray.core.generated.common_pb2",
    "ray.core.generated.gcs_pb2",
    "ray.core.generated.ray.protocol.Task",
    "scipy.signal",
    "scipy.stats",
    "setproctitle",
    "tensorflow_probability",
    "tensorflow",
    "tensorflow.contrib",
    "tensorflow.contrib.all_reduce",
    "tree",
    "tensorflow.contrib.all_reduce.python",
    "tensorflow.contrib.layers",
    "tensorflow.contrib.rnn",
    "tensorflow.contrib.slim",
    "tensorflow.core",
    "tensorflow.core.util",
    "tensorflow.keras",
    "tensorflow.python",
    "tensorflow.python.client",
    "tensorflow.python.util",
    "torch",
    "torch.distributed",
    "torch.nn",
    "torch.nn.parallel",
    "torch.utils.data",
    "torch.utils.data.distributed",
    "wandb",
    "zoopt",
]

import scipy.stats
import scipy.linalg

for mod_name in MOCK_MODULES:
    sys.modules[mod_name] = mock.Mock()
# ray.rllib.models.action_dist.py and
# ray.rllib.models.lstm.py will use tf.VERSION
sys.modules["tensorflow"].VERSION = "9.9.9"
sys.modules["tensorflow.keras.callbacks"] = ChildClassMock()
sys.modules["pytorch_lightning"] = ChildClassMock()
sys.modules["xgboost"] = ChildClassMock()
sys.modules["xgboost.core"] = ChildClassMock()
sys.modules["xgboost.callback"] = ChildClassMock()


class SimpleClass(object):
    pass


class SimpleClass2(object):
    pass


# ray.util.sgd.torch.lightning_operator.LightningOperator extends
# TrainingOperator, pytorch_lightning.TrainerOptimizersMixin,
# and pytorch_lightning.TrainerModelHooksMixin.
# But, we are mocking all pytorch_lightning modules, causing the ptl base
# classes to have a different metaclass than TrainingOperator.
# To fix this, we replace the base classes with dummy classes that extend
# object.
# We have to create 2 dummy classes, one for TrainerOptimizersMixin and one
# for TrainerModelHooksMixin so that we don't extend from the same base
# class twice.
setattr(sys.modules["pytorch_lightning.trainer.optimizers"],
        "TrainerOptimizersMixin", SimpleClass)
setattr(sys.modules["pytorch_lightning.trainer.model_hooks"],
        "TrainerModelHooksMixin", SimpleClass2)

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath("../../python/"))

import ray

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.viewcode',
    'sphinx.ext.napoleon',
    'sphinx_click.ext',
    'sphinx_tabs.tabs',
    'sphinx-jsonschema',
    'sphinx_gallery.gen_gallery',
    'sphinxemoji.sphinxemoji',
    'sphinx_copybutton',
    'sphinxcontrib.yt',
    'versionwarning.extension',
]

versionwarning_admonition_type = "tip"

versionwarning_messages = {
    "latest": (
        "This document is for the latest pip release. "
        'Visit the <a href="/en/master/">master branch documentation here</a>.'
    ),
}

versionwarning_body_selector = "#main-content"
sphinx_gallery_conf = {
    "examples_dirs": ["../examples",
                      "tune/_tutorials"],  # path to example scripts
    # path where to save generated examples
    "gallery_dirs": ["auto_examples", "tune/tutorials"],
    "ignore_pattern": "../examples/doc_code/",
    "plot_gallery": "False",
    "min_reported_time": sys.maxsize,
    # "filename_pattern": "tutorial.py",
    # "backreferences_dir": "False",
    # "show_memory': False,
}

for i in range(len(sphinx_gallery_conf["examples_dirs"])):
    gallery_dir = sphinx_gallery_conf["gallery_dirs"][i]
    source_dir = sphinx_gallery_conf["examples_dirs"][i]
    try:
        os.mkdir(gallery_dir)
    except OSError:
        pass

    # Copy rst files from source dir to gallery dir.
    for f in glob.glob(os.path.join(source_dir, '*.rst')):
        shutil.copy(f, gallery_dir)

    # Copy inc files from source dir to gallery dir.
    for f in glob.glob(os.path.join(source_dir, '*.inc')):
        shutil.copy(f, gallery_dir)<commit_msg>[docs] add summit banner (#15938)<commit_after># -*- coding: utf-8 -*-
#
# Ray documentation build configuration file, created by
# sphinx-quickstart on Fri Jul  1 13:19:58 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import glob
import shutil
import sys
import os
import urllib
sys.path.insert(0, os.path.abspath('.'))
from custom_directives import CustomGalleryItemDirective
from datetime import datetime

# These lines added to enable Sphinx to work without installing Ray.
import mock


class ChildClassMock(mock.Mock):
    @classmethod
    def __getattr__(cls, name):
        return mock.Mock


MOCK_MODULES = [
    "ax",
    "ax.service.ax_client",
    "blist",
    "ConfigSpace",
    "gym",
    "gym.spaces",
    "horovod",
    "horovod.ray",
    "kubernetes",
    "mlflow",
    "mxnet",
    "mxnet.model",
    "psutil",
    "pytorch_lightning.core.step_result",
    "pytorch_lightning.overrides.data_parallel",
    "pytorch_lightning.utilities.model_utils",
    "pytorch_lightning.trainer.model_hooks",
    "pytorch_lightning.trainer.optimizers",
    "pytorch_lightning.utilities.exceptions",
    "pytorch_lightning.utilities.memory",
    "ray._raylet",
    "ray.core.generated",
    "ray.core.generated.common_pb2",
    "ray.core.generated.gcs_pb2",
    "ray.core.generated.ray.protocol.Task",
    "scipy.signal",
    "scipy.stats",
    "setproctitle",
    "tensorflow_probability",
    "tensorflow",
    "tensorflow.contrib",
    "tensorflow.contrib.all_reduce",
    "tree",
    "tensorflow.contrib.all_reduce.python",
    "tensorflow.contrib.layers",
    "tensorflow.contrib.rnn",
    "tensorflow.contrib.slim",
    "tensorflow.core",
    "tensorflow.core.util",
    "tensorflow.keras",
    "tensorflow.python",
    "tensorflow.python.client",
    "tensorflow.python.util",
    "torch",
    "torch.distributed",
    "torch.nn",
    "torch.nn.parallel",
    "torch.utils.data",
    "torch.utils.data.distributed",
    "wandb",
    "zoopt",
]

import scipy.stats
import scipy.linalg

for mod_name in MOCK_MODULES:
    sys.modules[mod_name] = mock.Mock()
# ray.rllib.models.action_dist.py and
# ray.rllib.models.lstm.py will use tf.VERSION
sys.modules["tensorflow"].VERSION = "9.9.9"
sys.modules["tensorflow.keras.callbacks"] = ChildClassMock()
sys.modules["pytorch_lightning"] = ChildClassMock()
sys.modules["xgboost"] = ChildClassMock()
sys.modules["xgboost.core"] = ChildClassMock()
sys.modules["xgboost.callback"] = ChildClassMock()


class SimpleClass(object):
    pass


class SimpleClass2(object):
    pass


# ray.util.sgd.torch.lightning_operator.LightningOperator extends
# TrainingOperator, pytorch_lightning.TrainerOptimizersMixin,
# and pytorch_lightning.TrainerModelHooksMixin.
# But, we are mocking all pytorch_lightning modules, causing the ptl base
# classes to have a different metaclass than TrainingOperator.
# To fix this, we replace the base classes with dummy classes that extend
# object.
# We have to create 2 dummy classes, one for TrainerOptimizersMixin and one
# for TrainerModelHooksMixin so that we don't extend from the same base
# class twice.
setattr(sys.modules["pytorch_lightning.trainer.optimizers"],
        "TrainerOptimizersMixin", SimpleClass)
setattr(sys.modules["pytorch_lightning.trainer.model_hooks"],
        "TrainerModelHooksMixin", SimpleClass2)

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath("../../python/"))

import ray

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.viewcode',
    'sphinx.ext.napoleon',
    'sphinx_click.ext',
    'sphinx_tabs.tabs',
    'sphinx-jsonschema',
    'sphinx_gallery.gen_gallery',
    'sphinxemoji.sphinxemoji',
    'sphinx_copybutton',
    'sphinxcontrib.yt',
    'versionwarning.extension',
]

versionwarning_admonition_type = "tip"

SUMMIT_LINK = ("https://www.anyscale.com/ray-summit-2021"
               "?utm_source=anyscale&utm_medium=docs&utm_campaign=raysummit")

versionwarning_messages = {
    "latest": (
        "This document is for the latest pip release. "
        'Visit the <a href="/en/master/">master branch documentation here</a>.'
    ),
    "master": ("[Ray Summit 2021 | June 22-24 | Virtual & Free]"
               f'<a href="{SUMMIT_LINK}">Join the global Ray '
               "community at Ray Summit 2021</a> "
               "to learn about new Ray features and hear how "
               "users are scaling machine learning applications with Ray!"),
}

versionwarning_body_selector = "#main-content"
sphinx_gallery_conf = {
    "examples_dirs": ["../examples",
                      "tune/_tutorials"],  # path to example scripts
    # path where to save generated examples
    "gallery_dirs": ["auto_examples", "tune/tutorials"],
    "ignore_pattern": "../examples/doc_code/",
    "plot_gallery": "False",
    "min_reported_time": sys.maxsize,
    # "filename_pattern": "tutorial.py",
    # "backreferences_dir": "False",
    # "show_memory': False,
}

for i in range(len(sphinx_gallery_conf["examples_dirs"])):
    gallery_dir = sphinx_gallery_conf["gallery_dirs"][i]
    source_dir = sphinx_gallery_conf["examples_dirs"][i]
    try:
        os.mkdir(gallery_dir)
    except OSError:
        pass

    # Copy rst files from source dir to gallery dir.
    for f in glob.glob(os.path.join(source_dir, '*.rst')):
        shutil.copy(f, gallery_dir)

    # Copy inc files from source dir to gallery dir.
    for f in glob.glob(os.path.join(source_dir, '*.inc')):
        shutil.copy(f, gallery_dir)
{'fraction_non_alphanumeric': 0.12903495567820705, 'fraction_numerical': 0.00577019568489714, 'mean_word_length': 3.644271844660194, 'pattern_counts': {'":': 17, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5351157', 'n_tokens_mistral': 4023, 'n_tokens_neox': 3928, 'n_words': 921}