#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# microsoftml documentation build configuration file, created by
# sphinx-quickstart.
#
# 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.

# 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.
#
import os
import sys

this = os.path.abspath(os.path.dirname(__file__))
mml = os.path.join(this, "..")
mxlibs = os.path.join(this, "..", "nimbusml", "mxlibs")
pathmdoutput = os.path.join(
    this,
    "..",
    "..",
    "..",
    "..",
    "sphinx.ext.mdoutput")
sys.path.insert(0, mxlibs)  # path to mxlibs
sys.path.insert(0, mml)  # path to microsoftml
sys.path.insert(0, this)

# We check we can import the necessary dependencies.


# -- 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.intersphinx',
              'sphinx.ext.coverage',
              'sphinx.ext.ifconfig',
              'sphinx.ext.viewcode',
              'sphinx.ext.autosummary',
              'sphinx.ext.graphviz',
              'sphinx.ext.napoleon',
              # 'sphinx_gallery.gen_gallery',  # It might fail with an
              # exception.
              #                                # Just disable it in
              # sphinx-gallery.
              # But regular is better without it.
              'sphinx.ext.doctest',
              'sphinx.ext.imgmath',
              'docfx_yaml.extension'
              ]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = ['.rst']

# The master toctree document.
master_doc = 'index'

# General information about the project (HTML format)
project = 'nimbusml'
copyright = '2018, Microsoft'
author = 'Microsoft'

# The version info for the project you're documenting, acts as
# replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build*', 'Thumbs.db', '.DS_Store', 'build']

autodoc_default_flags = ['members', 'undoc-members', 'inherited-members']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False

# Example configuration for intersphinx: refer to the Python standard
# library.
intersphinx_mapping = {'https://docs.python.org/': None}

# Generate the plots for the gallery
plot_gallery = True

sphinx_gallery_conf = {
    'examples_dirs': os.path.join(this, "..", "examples"),
    'gallery_dirs': 'auto_examples',
    'doc_module': 'nimbusml',
    'backreferences_dir': os.path.join('modules', 'generated'),
    'relative': True,
    'reference_url': {
        'nimbusml': None,
        'matplotlib': 'http://matplotlib.org',
        'numpy': 'http://www.numpy.org/',
        'scipy': 'https://www.scipy.org/'},
}

# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
# html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a
# theme
# further.  For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets)
# here,
# relative to this directory. They are copied after the builtin static
# files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
htmlhelp_basename = 'pyexampledoc'

napoleon_use_admonition_for_examples = True

exclude_patterns = [
    '_build',
    '*.tests.rst',
    'azure.servicemanagement*.rst']

namespace_package_dict = {
    'azure_batch-([A-Za-z0-9\-\.]*).egg': 'azure-batch',
    'azure_common-([A-Za-z0-9\-\.]*).egg': 'azure-common',
    'azure_graphrbac-([A-Za-z0-9\-\.]*).egg': 'azure-graphrbac',
    'azure_keyvault-([A-Za-z0-9\-\.]*).egg': 'azure-keyvault',
    'azure_mgmt_authorization-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-authorization',
    'azure_mgmt_batch-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-batch',
    'azure_mgmt_billing-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-billing',
    'azure_mgmt_cdn-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-cdn',
    'azure_mgmt_cognitiveservices-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-cognitiveservices',
    'azure_mgmt_commerce-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-commerce',
    'azure_mgmt_compute-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-compute',
    'azure_mgmt_consumption-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-consumption',
    'azure_mgmt_containerregistry-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-containerregistry',
    'azure_mgmt_datalake_analytics-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-datalake_analytics',
    'azure_mgmt_datalake_store-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-datalake-store',
    'azure_mgmt_devtestlabs-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-devtestlabs',
    'azure_mgmt_dns-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-dns',
    'azure_mgmt_documentdb-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-documentdb',
    'azure_mgmt_eventhub-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-eventhub',
    'azure_mgmt_iothub-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-iothub',
    'azure_mgmt_keyvault-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-keyvault',
    'azure_mgmt_logic-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-logic',
    'azure_mgmt_media-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-media',
    'azure_mgmt_monitor-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-monitor',
    'azure_mgmt_network-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-network',
    'azure_mgmt_notificationhubs-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-notificationhubs',
    'azure_mgmt_powerbiembedded-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-powerbiembedded',
    'azure_mgmt_rdbms-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-rdbms',
    'azure_mgmt_recoveryservicesbackup-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-recoveryservicesbackup',
    'azure_mgmt_redis-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-redis',
    'azure_mgmt_resource-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-resource',
    'azure_mgmt_scheduler-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-scheduler',
    'azure_mgmt_search-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-search',
    'azure_mgmt_servermanager-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-servermanager',
    'azure_mgmt_servicebus-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-servicebus',
    'azure_mgmt_sql-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-sql',
    'azure_mgmt_storage-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-storage',
    'azure_mgmt_trafficmanager-([A-Za-z0-9\-\.]*).egg':
        'azure-mgmt-trafficmanager',
    'azure_mgmt_web-([A-Za-z0-9\-\.]*).egg': 'azure-mgmt-web',
    'azure_monitor-([A-Za-z0-9\-\.]*).egg': 'azure-monitor',
    'azure_servicebus-([A-Za-z0-9\-\.]*).egg': 'azure-servicebus',
    'azure_servicefabric-([A-Za-z0-9\-\.]*).egg': 'azure-servicefabric',
    'azure_servicemanagement_legacy-([A-Za-z0-9\-\.]*).egg':
        'azure-servicemanagement-legacy',
    'azure_storage_common-([A-Za-z0-9\-\.]*).egg': 'azure-storage-common',
    'azure_storage_blob-([A-Za-z0-9\-\.]*).egg': 'azure-storage-blob',
    'azure_storage_file-([A-Za-z0-9\-\.]*).egg': 'azure-storage-file',
    'azure_storage_queue-([A-Za-z0-9\-\.]*).egg': 'azure-storage-queue',
}

# -- Options for MD output ----------------------------------------------

# Default value for the header added to every file.
# The template is defined by rxtemplate.
# Specific to Microsoft documentation
rxprod = "nimbusml"
rxlabels = {"Ms.topic": "reference"}
rxlabelstitle = {'rxparameters': 'Arguments',
                 'rxdescription': 'Description'}
rxmanager = "ms"
rxexamplefolders = [
    os.path.normpath(
        os.path.join(
            os.path.abspath(
                os.path.dirname(__file__)),
            "..",
            "examples")),
]

# autoclass_content = 'both'

# All values are double-quote enclosed. Values cannot include embedded
# markdown formatting.
# Title is the function name or a descriptive string similar to what we
# use in scaler.
# Description can be derived from a revoscaler equivalent.
# Keywords can be null as far as publishing requirements go, but could
# have values for package name, function name, similar to what we have
# for revoscaler.
# Ms.service and ms.assetid need to exist, but are not used by us.
# Please include but leave blank.
# Optional metadata can be left blank, except for ms.technology mapped
# to "r-server"
# Ms.date is formatted per the example. This needs to change based on the
# date the file was generated.

rxtemplate = """
---

# required metadata
title: "{{rxobjectname}}{{rxtitle}}"
description: "{{rxdescription}}"
keywords: "{{', '.join(rxkeywords)}}"
ms.date: "{{__NOW__}}"
ms.topic: "article"
ms.prod: "microsoft-r"
ms.service: ""
ms.assetid: ""

# optional metadata
ROBOTS: ""
audience: ""
ms.devlang: "Python"
ms.reviewer: ""
ms.suite: ""
ms.tgt_pltfrm: ""
ms.technology: "r-server"
ms.custom: ""

---
"""

# This string is added just after the first title of every page by the
# markdown writer. Currently blank. Strings are """ enclosed.
rxaftertitle = """ """

# External references to packages. It only works for MD format.
pkg_dictionary = {
    'nimbusml': "./nimbusml/index.md",
}

# Initial title level (add or remove '#' in title)
md_initial_title_level = 1

# Replace underscore in filenames.
md_replace_underscore = "-"
