<commit_before>import os
import tempfile
import pytz
from datetime import datetime, timedelta
from collections import defaultdict
from copy import deepcopy
import jinja2
from sdcm.keystore import KeyStore
from sdcm.utils.cloud_monitor.resources import CLOUD_PROVIDERS
from sdcm.utils.cloud_monitor.resources.instances import CloudInstances
from sdcm.utils.cloud_monitor.resources.static_ips import StaticIPs

class BaseReport:

    def __init__(self, cloud_instances: CloudInstances, static_ips: StaticIPs, html_template: str):
        self.cloud_instances = cloud_instances
        self.static_ips = static_ips
        self.html_template = html_template

    @property
    def templates_dir(self):
        cur_path = os.path.dirname(os.path.abspath(__file__))
        return os.path.join(cur_path, "templates")

    def _jinja_render_template(self, **kwargs):
        loader = jinja2.FileSystemLoader(self.templates_dir)
        env = jinja2.Environment(loader=loader, autoescape=True, extensions=['jinja2.ext.loopcontrols'],
                                 finalize=lambda x: x if x != 0 else "")
        template = env.get_template(self.html_template)
        html = template.render(**kwargs)
        return html

    def render_template(self):
        return self._jinja_render_template(**vars(self))

    def to_html(self):
        return self.render_template()

    def to_file(self):
        with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8",
                                         prefix='cloud-report_', delete=False, suffix='.html') as report_file:
            report_file.write(self.to_html())
            return report_file.name

class CloudResourcesReport(BaseReport):
    def __init__(self, cloud_instances: CloudInstances, static_ips: StaticIPs):
        super(CloudResourcesReport, self).__init__(cloud_instances, static_ips, html_template="cloud_resources.html")
        stats = dict(num_running_instances=0,
                     num_stopped_instances=0,
                     unused_static_ips=0,
                     num_used_static_ips=0,
                     )
        self.report = {cloud_provider: deepcopy(stats) for cloud_provider in CLOUD_PROVIDERS}

    def to_html(self):
        for cloud_provider in CLOUD_PROVIDERS:
            num_running_instances = len([i for i in self.cloud_instances[cloud_provider] if i.state == "running"])
            num_stopped_instances = len([i for i in self.cloud_instances[cloud_provider] if i.state == "stopped"])
            num_unused_static_ips = len([i for i in self.static_ips[cloud_provider] if not i.is_used])
            self.report[cloud_provider]["num_running_instances"] = num_running_instances
            self.report[cloud_provider]["num_stopped_instances"] = num_stopped_instances
            self.report[cloud_provider]["num_unused_static_ips"] = num_unused_static_ips
            self.report[cloud_provider]["num_used_static_ips"] = len(self.static_ips[cloud_provider])
        return self.render_template()

class PerUserSummaryReport(BaseReport):
    def __init__(self, cloud_instances: CloudInstances, static_ips: StaticIPs):
        super(PerUserSummaryReport, self).__init__(cloud_instances, static_ips, html_template="per_user_summary.html")
        self.report = {"results": {"qa": {}, "others": {}}, "cloud_providers": CLOUD_PROVIDERS}
        self.qa_users = KeyStore().get_qa_users()

    def user_type(self, user_name: str):
        return "qa" if user_name in self.qa_users else "others"

    def to_html(self):
        for cloud_provider in CLOUD_PROVIDERS:
            for instance in self.cloud_instances[cloud_provider]:
                user_type = self.user_type(instance.owner)
                results = self.report["results"]
                if instance.owner not in results[user_type]:
                    stats = dict(num_running_instances_spot=0, num_running_instances_on_demand=0,
                                 num_stopped_instances=0)
                    results[user_type][instance.owner] = {cp: deepcopy(stats) for cp in self.report["cloud_providers"]}
                    results[user_type][instance.owner]["num_instances_keep_alive"] = 0
                    results[user_type][instance.owner]["total_cost"] = 0
                    results[user_type][instance.owner]["projected_daily_cost"] = 0
                if instance.state == "running":
                    if instance.lifecycle == "spot":
                        results[user_type][instance.owner][cloud_provider]["num_running_instances_spot"] += 1
                    else:
                        results[user_type][instance.owner][cloud_provider]["num_running_instances_on_demand"] += 1
                    results[user_type][instance.owner]["total_cost"] += instance.total_cost
                    results[user_type][instance.owner]["projected_daily_cost"] += instance.projected_daily_cost
                if instance.state == "stopped":
                    results[user_type][instance.owner][cloud_provider]["num_stopped_instances"] += 1
                if instance.keep:
                    results[user_type][instance.owner]["num_instances_keep_alive"] += 1
        return self.render_template()

class GeneralReport(BaseReport):
    def __init__(self, cloud_instances: CloudInstances, static_ips: StaticIPs):
        super(GeneralReport, self).__init__(cloud_instances, static_ips, html_template="base.html")
        self.cloud_resources_report = CloudResourcesReport(cloud_instances=cloud_instances, static_ips=static_ips)
        self.per_user_report = PerUserSummaryReport(cloud_instances, static_ips)

    def to_html(self):
        cloud_resources_html = self.cloud_resources_report.to_html()
        per_user_report_html = self.per_user_report.to_html()
        return self._jinja_render_template(body=cloud_resources_html + per_user_report_html)

class DetailedReport(BaseReport):
    """Attached as HTML file"""

    def __init__(self, cloud_instances: CloudInstances, static_ips: StaticIPs, user=None):
        super(DetailedReport, self).__init__(cloud_instances, static_ips, html_template="per_user.html")
        self.user = user
        self.report = defaultdict(list)

    def to_html(self):
        for instance in self.cloud_instances.all:
            self.report[instance.owner].append(instance)
        if self.user:
            self.report = {self.user: self.report.get(self.user)}
        resources_html = self.render_template()
        self.html_template = "base.html"
        return self._jinja_render_template(body=resources_html)

class QAonlyTimeDistributionReport(BaseReport):
    def __init__(self, cloud_instances: CloudInstances, static_ips: StaticIPs, user=None):
        super(QAonlyTimeDistributionReport, self).__init__(
            cloud_instances, static_ips, html_template="per_qa_user.html")
        self.user = user
        self.report = {7: defaultdict(list), 5: defaultdict(list), 3: defaultdict(list)}
        self.qa_users = KeyStore().get_qa_users()

    def to_html(self):
        for instance in self.cloud_instances.all:
            if self._is_user_be_skipped(instance) or self._is_instance_be_skipped(instance):
                continue
            if self._is_older_than_3days(instance.create_time):
                self.report[3][instance.owner].append(instance)
            elif self._is_older_than_5days(instance.create_time):
                self.report[5][instance.owner].append(instance)
            elif self._is_older_than_7days(instance.create_time):
                self.report[7][instance.owner].append(instance)
            else:
                continue
        if self.user:
            for key in self.report:
                self.report[key] = {self.user: self.report[key].get(self.user, list())}

        resources_html = self.render_template()
        self.html_template = "base.html"
        return self._jinja_render_template(body=resources_html)

    @staticmethod
    def _is_older_than_3days(create_time):
        return pytz.utc.localize(datetime.utcnow() - timedelta(days=3)) > create_time > pytz.utc.localize(datetime.utcnow() - timedelta(days=5))

    @staticmethod
    def _is_older_than_5days(create_time):
        return pytz.utc.localize(datetime.utcnow() - timedelta(days=5)) > create_time > pytz.utc.localize(datetime.utcnow() - timedelta(days=7))

    @staticmethod
    def _is_older_than_7days(create_time):
        return create_time < pytz.utc.localize(datetime.utcnow() - timedelta(days=7))

    def _is_user_be_skipped(self, instance):
        return instance.owner == "qa" or instance.owner not in self.qa_users

    def _is_instance_be_skipped(self, instance):
        return instance.state != "running"
<commit_msg>fix(report.py): fix linting issues<commit_after>import os
import tempfile

from datetime import datetime, timedelta
from collections import defaultdict
from copy import deepcopy

import jinja2
import pytz

from sdcm.keystore import KeyStore
from sdcm.utils.cloud_monitor.resources import CLOUD_PROVIDERS
from sdcm.utils.cloud_monitor.resources.instances import CloudInstances
from sdcm.utils.cloud_monitor.resources.static_ips import StaticIPs

class BaseReport:

    def __init__(self, cloud_instances: CloudInstances, static_ips: StaticIPs, html_template: str):
        self.cloud_instances = cloud_instances
        self.static_ips = static_ips
        self.html_template = html_template

    @property
    def templates_dir(self):
        cur_path = os.path.dirname(os.path.abspath(__file__))
        return os.path.join(cur_path, "templates")

    def _jinja_render_template(self, **kwargs):
        loader = jinja2.FileSystemLoader(self.templates_dir)
        env = jinja2.Environment(loader=loader, autoescape=True, extensions=['jinja2.ext.loopcontrols'],
                                 finalize=lambda x: x if x != 0 else "")
        template = env.get_template(self.html_template)
        html = template.render(**kwargs)
        return html

    def render_template(self):
        return self._jinja_render_template(**vars(self))

    def to_html(self):
        return self.render_template()

    def to_file(self):
        with tempfile.NamedTemporaryFile(mode="w", encoding="utf-8",
                                         prefix='cloud-report_', delete=False, suffix='.html') as report_file:
            report_file.write(self.to_html())
            return report_file.name

class CloudResourcesReport(BaseReport):
    def __init__(self, cloud_instances: CloudInstances, static_ips: StaticIPs):
        super().__init__(cloud_instances, static_ips, html_template="cloud_resources.html")
        stats = dict(num_running_instances=0,
                     num_stopped_instances=0,
                     unused_static_ips=0,
                     num_used_static_ips=0,
                     )
        self.report = {cloud_provider: deepcopy(stats) for cloud_provider in CLOUD_PROVIDERS}

    def to_html(self):
        for cloud_provider in CLOUD_PROVIDERS:
            num_running_instances = len([i for i in self.cloud_instances[cloud_provider] if i.state == "running"])
            num_stopped_instances = len([i for i in self.cloud_instances[cloud_provider] if i.state == "stopped"])
            num_unused_static_ips = len([i for i in self.static_ips[cloud_provider] if not i.is_used])
            self.report[cloud_provider]["num_running_instances"] = num_running_instances
            self.report[cloud_provider]["num_stopped_instances"] = num_stopped_instances
            self.report[cloud_provider]["num_unused_static_ips"] = num_unused_static_ips
            self.report[cloud_provider]["num_used_static_ips"] = len(self.static_ips[cloud_provider])
        return self.render_template()

class PerUserSummaryReport(BaseReport):
    def __init__(self, cloud_instances: CloudInstances, static_ips: StaticIPs):
        super().__init__(cloud_instances, static_ips, html_template="per_user_summary.html")
        self.report = {"results": {"qa": {}, "others": {}}, "cloud_providers": CLOUD_PROVIDERS}
        self.qa_users = KeyStore().get_qa_users()

    def user_type(self, user_name: str):
        return "qa" if user_name in self.qa_users else "others"

    def to_html(self):
        for cloud_provider in CLOUD_PROVIDERS:
            for instance in self.cloud_instances[cloud_provider]:
                user_type = self.user_type(instance.owner)
                results = self.report["results"]
                if instance.owner not in results[user_type]:
                    stats = dict(num_running_instances_spot=0, num_running_instances_on_demand=0,
                                 num_stopped_instances=0)
                    results[user_type][instance.owner] = {cp: deepcopy(stats) for cp in self.report["cloud_providers"]}
                    results[user_type][instance.owner]["num_instances_keep_alive"] = 0
                    results[user_type][instance.owner]["total_cost"] = 0
                    results[user_type][instance.owner]["projected_daily_cost"] = 0
                if instance.state == "running":
                    if instance.lifecycle == "spot":
                        results[user_type][instance.owner][cloud_provider]["num_running_instances_spot"] += 1
                    else:
                        results[user_type][instance.owner][cloud_provider]["num_running_instances_on_demand"] += 1
                    results[user_type][instance.owner]["total_cost"] += instance.total_cost
                    results[user_type][instance.owner]["projected_daily_cost"] += instance.projected_daily_cost
                if instance.state == "stopped":
                    results[user_type][instance.owner][cloud_provider]["num_stopped_instances"] += 1
                if instance.keep:
                    results[user_type][instance.owner]["num_instances_keep_alive"] += 1
        return self.render_template()

class GeneralReport(BaseReport):
    def __init__(self, cloud_instances: CloudInstances, static_ips: StaticIPs):
        super().__init__(cloud_instances, static_ips, html_template="base.html")
        self.cloud_resources_report = CloudResourcesReport(cloud_instances=cloud_instances, static_ips=static_ips)
        self.per_user_report = PerUserSummaryReport(cloud_instances, static_ips)

    def to_html(self):
        cloud_resources_html = self.cloud_resources_report.to_html()
        per_user_report_html = self.per_user_report.to_html()
        return self._jinja_render_template(body=cloud_resources_html + per_user_report_html)

class DetailedReport(BaseReport):
    """Attached as HTML file"""

    def __init__(self, cloud_instances: CloudInstances, static_ips: StaticIPs, user=None):
        super().__init__(cloud_instances, static_ips, html_template="per_user.html")
        self.user = user
        self.report = defaultdict(list)

    def to_html(self):
        for instance in self.cloud_instances.all:
            self.report[instance.owner].append(instance)
        if self.user:
            self.report = {self.user: self.report.get(self.user)}
        resources_html = self.render_template()
        self.html_template = "base.html"
        return self._jinja_render_template(body=resources_html)

class QAonlyTimeDistributionReport(BaseReport):
    def __init__(self, cloud_instances: CloudInstances, static_ips: StaticIPs, user=None):
        super().__init__(cloud_instances, static_ips, html_template="per_qa_user.html")
        self.user = user
        self.report = {7: defaultdict(list), 5: defaultdict(list), 3: defaultdict(list)}
        self.qa_users = KeyStore().get_qa_users()

    def to_html(self):
        for instance in self.cloud_instances.all:
            if self._is_user_be_skipped(instance) or self._is_instance_be_skipped(instance):
                continue
            if self._is_older_than_3days(instance.create_time):
                self.report[3][instance.owner].append(instance)
            elif self._is_older_than_5days(instance.create_time):
                self.report[5][instance.owner].append(instance)
            elif self._is_older_than_7days(instance.create_time):
                self.report[7][instance.owner].append(instance)
            else:
                continue
        if self.user:
            for key in self.report:
                self.report[key] = {self.user: self.report[key].get(self.user, list())}

        resources_html = self.render_template()
        self.html_template = "base.html"
        return self._jinja_render_template(body=resources_html)

    @staticmethod
    def _is_older_than_3days(create_time):
        return pytz.utc.localize(datetime.utcnow() - timedelta(days=3)) > create_time > pytz.utc.localize(
            datetime.utcnow() - timedelta(days=5))

    @staticmethod
    def _is_older_than_5days(create_time):
        return pytz.utc.localize(datetime.utcnow() - timedelta(days=5)) > create_time > pytz.utc.localize(
            datetime.utcnow() - timedelta(days=7))

    @staticmethod
    def _is_older_than_7days(create_time):
        return create_time < pytz.utc.localize(datetime.utcnow() - timedelta(days=7))

    def _is_user_be_skipped(self, instance):
        return instance.owner == "qa" or instance.owner not in self.qa_users

    @staticmethod
    def _is_instance_be_skipped(instance):
        return instance.state != "running"
<|endoftext|>


<commit_before>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# libact documentation build configuration file, created by
# sphinx-quickstart on Sun Nov  1 23:21:58 2015.
#
# 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 sys
import os
import shlex
import sys
from unittest.mock import MagicMock

class Mock(MagicMock):

    @classmethod
    def __getattr__(cls, name):
        return Mock()

MOCK_MODULES = ['scipy', 'scipy.optimize', 'scipy.stats',
                'matplotlib', 'matplotlib.pyplot', 'numpy', 'sklearn',
                'sklearn.linear_model', 'sklearn.svm', 'sklearn.metrics',
                'sklearn.metrics.pairwise', 'sklearn.cluster',
                # c extensions
                'libact.query_strategies._hintsvm',
                'libact.query_strategies._variance_reduction']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)

# 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('.'))

# -- 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.autosummary',
    'sphinx.ext.coverage',
    'sphinx.ext.intersphinx',
    'sphinx.ext.mathjax',
    'sphinx.ext.napoleon',
    'sphinx.ext.viewcode',
    'numpydoc',
]

# Napoleon settings
napoleon_numpy_docstring = True
napoleon_google_docstring = False
napoleon_use_admonition_for_examples = True
napoleon_use_admonition_for_references = True

# 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', '.md']
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'libact'
copyright = '2015, Y.-Y. Yang, S.-C. Lee, Y.-A. Chung, T.-E. Wu, H.-T. Lin'
author = 'Y.-Y. Yang, S.-C. Lee, Y.-A. Chung, T.-E. Wu, H.-T. Lin'

# 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.2'
# The full version, including alpha/beta/rc tags.
release = '0.1.2'

# 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

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']

# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

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

# A list of ignored prefixes for module index sorting.
modindex_common_prefix = ['libact']

# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False

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

# -- 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'
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# 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 themes here, relative to this directory.
#html_theme_path = []

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
#html_title = None

# A shorter title for the navigation bar.  Default is the same as html_title.
#html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None

# 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']

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}

# If false, no module index is generated.
#html_domain_indices = True

# If false, no index is generated.
#html_use_index = True

# If true, the index is split into individual pages for each letter.
#html_split_index = False

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None

# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
#   'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
#   'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
#html_search_language = 'en'

# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}

# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'libactdoc'

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
    # The paper size ('letterpaper' or 'a4paper').
    #'papersize': 'letterpaper',

    # The font size ('10pt', '11pt' or '12pt').
    #'pointsize': '10pt',

    # Additional stuff for the LaTeX preamble.
    #'preamble': '',

    # Latex figure (float) alignment
    #'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
#  author, documentclass [howto, manual, or own class]).
latex_documents = [
    (master_doc, 'libact.tex', 'libact Documentation',
     author, 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# If true, show page references after internal links.
#latex_show_pagerefs = False

# If true, show URL addresses after external links.
#latex_show_urls = False

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_domain_indices = True

# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    (master_doc, 'libact', 'libact Documentation',
     [author], 1)
]

# If true, show URL addresses after external links.
#man_show_urls = False

# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
    (master_doc, 'libact', 'libact Documentation',
     author, 'libact', 'One line description of project.',
     'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []

# If false, no module index is generated.
#texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False

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

# Skip private members in this project, which start with an underscore (_).
def skip_private_member(app, what, name, obj, skip, options):
    if name.startswith('_'):
        return True
    return False

def setup(app):
    app.connect('autodoc-skip-member', skip_private_member)

# Fix numpydoc conflict with autosummary
# Ref: http://stackoverflow.com/questions/12206334
numpydoc_show_class_members = False
<commit_msg>FIX infinite recursion when building on rtd<commit_after>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# libact documentation build configuration file, created by
# sphinx-quickstart on Sun Nov  1 23:21:58 2015.
#
# 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 sys
import os
import shlex
import sys
from unittest.mock import MagicMock

MOCK_MODULES = ['scipy', 'scipy.optimize', 'scipy.stats',
                'matplotlib', 'matplotlib.pyplot', 'numpy', 'sklearn',
                'sklearn.linear_model', 'sklearn.svm', 'sklearn.metrics',
                'sklearn.metrics.pairwise', 'sklearn.cluster',
                # c extensions
                'libact.query_strategies._hintsvm',
                'libact.query_strategies._variance_reduction']
sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES)

# 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('.'))

# -- 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.autosummary',
    'sphinx.ext.coverage',
    'sphinx.ext.intersphinx',
    'sphinx.ext.mathjax',
    'sphinx.ext.napoleon',
    'sphinx.ext.viewcode',
    'numpydoc',
]

# Napoleon settings
napoleon_numpy_docstring = True
napoleon_google_docstring = False
napoleon_use_admonition_for_examples = True
napoleon_use_admonition_for_references = True

# 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', '.md']
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'libact'
copyright = '2015, Y.-Y. Yang, S.-C. Lee, Y.-A. Chung, T.-E. Wu, H.-T. Lin'
author = 'Y.-Y. Yang, S.-C. Lee, Y.-A. Chung, T.-E. Wu, H.-T. Lin'

# 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.2'
# The full version, including alpha/beta/rc tags.
release = '0.1.2'

# 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

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']

# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

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

# A list of ignored prefixes for module index sorting.
modindex_common_prefix = ['libact']

# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False

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

# -- 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'
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# 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 themes here, relative to this directory.
#html_theme_path = []

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
#html_title = None

# A shorter title for the navigation bar.  Default is the same as html_title.
#html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None

# 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']

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}

# If false, no module index is generated.
#html_domain_indices = True

# If false, no index is generated.
#html_use_index = True

# If true, the index is split into individual pages for each letter.
#html_split_index = False

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None

# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
#   'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
#   'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
#html_search_language = 'en'

# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}

# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'libactdoc'

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
    # The paper size ('letterpaper' or 'a4paper').
    #'papersize': 'letterpaper',

    # The font size ('10pt', '11pt' or '12pt').
    #'pointsize': '10pt',

    # Additional stuff for the LaTeX preamble.
    #'preamble': '',

    # Latex figure (float) alignment
    #'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
#  author, documentclass [howto, manual, or own class]).
latex_documents = [
    (master_doc, 'libact.tex', 'libact Documentation',
     author, 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# If true, show page references after internal links.
#latex_show_pagerefs = False

# If true, show URL addresses after external links.
#latex_show_urls = False

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_domain_indices = True

# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    (master_doc, 'libact', 'libact Documentation',
     [author], 1)
]

# If true, show URL addresses after external links.
#man_show_urls = False

# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
    (master_doc, 'libact', 'libact Documentation',
     author, 'libact', 'One line description of project.',
     'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []

# If false, no module index is generated.
#texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False

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

# Skip private members in this project, which start with an underscore (_).
def skip_private_member(app, what, name, obj, skip, options):
    if name.startswith('_'):
        return True
    return False

def setup(app):
    app.connect('autodoc-skip-member', skip_private_member)

# Fix numpydoc conflict with autosummary
# Ref: http://stackoverflow.com/questions/12206334
numpydoc_show_class_members = False
<|endoftext|>


<commit_before># -*- coding: utf-8 -*-
#
# Flocker documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 28 14:54:33 2014.
#
# 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.

from twisted.python.filepath import FilePath

import sys
import os

sys.path.insert(0, FilePath(__file__).parent().parent().path)

# Check if we are building on readthedocs
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

# -- 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.extlinks',
    'sphinx.ext.intersphinx',
    'sphinx.ext.ifconfig',
    'flocker.provision._sphinx',
    'flocker.docs.version_extensions',
    'sphinx-prompt',
    'sphinxcontrib.httpdomain',
    'flocker.restapi.docs.publicapi',
    'flocker.restapi.docs.hidden_code_block',
    'flocker.docs.bootstrap',
]

if not on_rtd:
    # readthedocs doesn't install dependencies
    extensions.append('sphinxcontrib.spelling')

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

# The suffix of source filenames.
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'Flocker'
copyright = u'2014, ClusterHQ'

extlinks = {
    'issue': ('https://clusterhq.atlassian.net/browse/FLOC-%s', 'issue '),
}

# 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.
#
from flocker import __version__
from flocker.common.version import get_doc_version, is_release
# The short X.Y version.
version = get_doc_version(__version__)

html_context = {
    # This is used to show the development version warning.
    'is_release': is_release(__version__),
}

# The full version, including alpha/beta/rc tags.
release = version

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# We override with our own variant to improve search results slightly.
from sphinx.search.en import SearchEnglish
from sphinx.search import languages as sphinx_languages

class FlockerLanguage(SearchEnglish):
    """
    Workaround for https://bitbucket.org/birkenfeld/sphinx/issue/1529/
    """
    def word_filter(self, word):
        """
        Only omit stop words; default also omits words shorter than 3
        characters which breaks search for "ZFS" since stemming turns that into
        "zf".
        """
        return word not in self.stopwords

# Read The Docs may override the language, which is why we're overriding
# English rather than defining our own language.
sphinx_languages['en'] = FlockerLanguage
language = 'en'

# String specifying a file containing a list of words known to be spelled
# correctly but that do not appear in the language dictionary.
# See:
# http://sphinxcontrib-spelling.readthedocs.org/en/latest/customize.html#input-options
spelling_word_list_filename = 'spelling_wordlist.txt'

if not on_rtd:
    sys.path.insert(0, FilePath(__file__).parent().path)
    from filters import IgnoreWordsFilterFactory
    # Don't spell check the version:
    spelling_filters = [IgnoreWordsFilterFactory(words={version})]
    del sys.path[0]

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']

# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

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

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

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

# The HTMLTranslator class
html_translator_class = 'flocker.docs.bootstrap.HTMLWriter'
# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
html_theme = 'clusterhq'

# 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 themes here, relative to this directory.
html_theme_path = ['_themes']

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
#html_title = None

# A shorter title for the navigation bar.  Default is the same as html_title.
#html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None

# 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']

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}

# If false, no module index is generated.
#html_domain_indices = True

# If false, no index is generated.
html_use_index = False

# If true, the index is split into individual pages for each letter.
#html_split_index = False

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'Flockerdoc'

# -- Options for LaTeX output --------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
  ('index', 'Flocker.tex', u'Flocker Documentation',
   u'ClusterHQ', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# If true, show page references after internal links.
#latex_show_pagerefs = False

# If true, show URL addresses after external links.
#latex_show_urls = False

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_domain_indices = True

# -- Options for manual page output --------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    ('index', 'flocker', u'Flocker Documentation',
     [u'ClusterHQ'], 1)
]

# If true, show URL addresses after external links.
#man_show_urls = False

# -- Options for Texinfo output ------------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
  ('index', 'Flocker', u'Flocker Documentation',
   u'ClusterHQ', 'Flocker', 'Data-oriented Docker clustering.',
   'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []

# If false, no module index is generated.
#texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

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

# Don't check anchors because many websites use #! for AJAX magic
# http://sphinx-doc.org/config.html#confval-linkcheck_anchors
linkcheck_anchors = False

linkcheck_ignore = [
    # Don't check links to tutorial IPs
    r'http://172\.16\.255\.',
    # Example comparisons between branches
    r'https://github.com/ClusterHQ/flocker/compare/\S+',
    # Some Amazon EC2 links require a login and so
    # "HTTP Error 401: Unauthorized" is given.
    r'https://console.aws.amazon.com/cloudfront/home',
    r'https://console.aws.amazon.com/ec2/v2/home\S+',
    # Internal ClusterHQ documents need a login to see
    r'https://docs.google.com/a/clusterhq.com/\S+',
    # Example Flocker GUI local URL
    r'http://localhost/client/#/nodes/list',
]
<commit_msg>Ignore TLS issues<commit_after># -*- coding: utf-8 -*-
#
# Flocker documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 28 14:54:33 2014.
#
# 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.

from twisted.python.filepath import FilePath

import sys
import os

sys.path.insert(0, FilePath(__file__).parent().parent().path)

# Check if we are building on readthedocs
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'

# -- 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.extlinks',
    'sphinx.ext.intersphinx',
    'sphinx.ext.ifconfig',
    'flocker.provision._sphinx',
    'flocker.docs.version_extensions',
    'sphinx-prompt',
    'sphinxcontrib.httpdomain',
    'flocker.restapi.docs.publicapi',
    'flocker.restapi.docs.hidden_code_block',
    'flocker.docs.bootstrap',
]

if not on_rtd:
    # readthedocs doesn't install dependencies
    extensions.append('sphinxcontrib.spelling')

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

# The suffix of source filenames.
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'Flocker'
copyright = u'2014, ClusterHQ'

extlinks = {
    'issue': ('https://clusterhq.atlassian.net/browse/FLOC-%s', 'issue '),
}

# 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.
#
from flocker import __version__
from flocker.common.version import get_doc_version, is_release
# The short X.Y version.
version = get_doc_version(__version__)

html_context = {
    # This is used to show the development version warning.
    'is_release': is_release(__version__),
}

# The full version, including alpha/beta/rc tags.
release = version

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# We override with our own variant to improve search results slightly.
from sphinx.search.en import SearchEnglish
from sphinx.search import languages as sphinx_languages

class FlockerLanguage(SearchEnglish):
    """
    Workaround for https://bitbucket.org/birkenfeld/sphinx/issue/1529/
    """
    def word_filter(self, word):
        """
        Only omit stop words; default also omits words shorter than 3
        characters which breaks search for "ZFS" since stemming turns that into
        "zf".
        """
        return word not in self.stopwords

# Read The Docs may override the language, which is why we're overriding
# English rather than defining our own language.
sphinx_languages['en'] = FlockerLanguage
language = 'en'

# String specifying a file containing a list of words known to be spelled
# correctly but that do not appear in the language dictionary.
# See:
# http://sphinxcontrib-spelling.readthedocs.org/en/latest/customize.html#input-options
spelling_word_list_filename = 'spelling_wordlist.txt'

if not on_rtd:
    sys.path.insert(0, FilePath(__file__).parent().path)
    from filters import IgnoreWordsFilterFactory
    # Don't spell check the version:
    spelling_filters = [IgnoreWordsFilterFactory(words={version})]
    del sys.path[0]

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']

# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

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

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

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

# The HTMLTranslator class
html_translator_class = 'flocker.docs.bootstrap.HTMLWriter'
# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
html_theme = 'clusterhq'

# 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 themes here, relative to this directory.
html_theme_path = ['_themes']

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
#html_title = None

# A shorter title for the navigation bar.  Default is the same as html_title.
#html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None

# 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']

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}

# If false, no module index is generated.
#html_domain_indices = True

# If false, no index is generated.
html_use_index = False

# If true, the index is split into individual pages for each letter.
#html_split_index = False

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'Flockerdoc'

# -- Options for LaTeX output --------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
  ('index', 'Flocker.tex', u'Flocker Documentation',
   u'ClusterHQ', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# If true, show page references after internal links.
#latex_show_pagerefs = False

# If true, show URL addresses after external links.
#latex_show_urls = False

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_domain_indices = True

# -- Options for manual page output --------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    ('index', 'flocker', u'Flocker Documentation',
     [u'ClusterHQ'], 1)
]

# If true, show URL addresses after external links.
#man_show_urls = False

# -- Options for Texinfo output ------------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
  ('index', 'Flocker', u'Flocker Documentation',
   u'ClusterHQ', 'Flocker', 'Data-oriented Docker clustering.',
   'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []

# If false, no module index is generated.
#texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

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

# Don't check anchors because many websites use #! for AJAX magic
# http://sphinx-doc.org/config.html#confval-linkcheck_anchors
linkcheck_anchors = False

linkcheck_ignore = [
    # Don't check links to tutorial IPs
    r'http://172\.16\.255\.',
    # Example comparisons between branches
    r'https://github.com/ClusterHQ/flocker/compare/\S+',
    # Some Amazon EC2 links require a login and so
    # "HTTP Error 401: Unauthorized" is given.
    r'https://console.aws.amazon.com/cloudfront/home',
    r'https://console.aws.amazon.com/ec2/v2/home\S+',
    # Internal ClusterHQ documents need a login to see
    r'https://docs.google.com/a/clusterhq.com/\S+',
    # Example Flocker GUI local URL
    r'http://localhost/client/#/nodes/list',

    # The following link checks fail because of a TLS handshake error.
    # The link checking should be fixed and these ignores should be removed.
    # See https://clusterhq.atlassian.net/browse/FLOC-1156.
    r'https://docs.clusterhq.com/',
    r'https://docs.staging.clusterhq.com/',
    r'https://docs.docker.com/\S+',
]
<|endoftext|>


<commit_before>from flask import Blueprint, render_template, request, redirect, g
from piipod.views import current_user, login_required, url_for, requires
from .forms import EventForm, EventSignupForm, EventCheckinForm, \
    EventGenerateCodeForm, ProcessWaitlistForm
from piipod.models import Group, Event, User, UserSetting, Membership, Signup,\
    GroupRole, EventRole, Base
from sqlalchemy.orm.exc import NoResultFound
from piipod.defaults import default_user_settings
import arrow

event = Blueprint('event', __name__,
    url_prefix='/<string:group_url>/e/<int:event_id>/<string:event_slug>')

@event.url_defaults
def add_ids(endpoint, values):
    values.setdefault('group_url', getattr(g, 'group_url', None))
    values.setdefault('event_id', getattr(g, 'event_id', None))
    values.setdefault('event_slug', getattr(g, 'event_slug', None))

@event.slug_value_preprocessor
def pull_ids(endpoint, values):
    try:
        g.group_url = values.pop('group_url')
        g.group = Group.query.filter_by(url=g.group_url).one_or_none()
        g.event_id = values.pop('event_id')
        g.event_slug = values.pop('event_slug')
        g.event = Event.query.get(g.event_id)
        if not g.group or not g.event:
            abort(404)
        g.event.to_local('start', 'end')
        g.user = current_user()
        if g.user.is_authenticated:
            g.membership = Membership.query.filter_by(
                group_id=g.group.id,
                user_id=g.user.id,
                is_active=True).one_or_none()
            if g.membership:
                g.group_role = GroupRole.query.get(g.membership.role_id)
            else:
                g.group_role = None
            g.signup = Signup.query.filter_by(
                event_id=g.event.id,
                user_id=g.user.id,
                is_active=True).one_or_none()
            if g.signup:
                g.event_role = EventRole.query.get(g.signup.role_id)
            else:
                g.event_role = None
        else:
            g.membership = g.signup = g.group_role = g.event_role = None
    except NoResultFound:
        return 'No such event.'

def render_event(f, *args, **kwargs):
    """custom render for events"""
    from piipod.views import render
    data = vars(g)
    data.update(kwargs)
    return render(f, *args, **data)

################
# PUBLIC PAGES #
################

@event.route('/')
def home():
    """event homepage"""
    return render_event('event/index.html')

@event.route('/signup', methods=['GET', 'POST'])
@login_required
def signup():
    """event signup"""
    form = EventSignupForm(request.form)
    message = ''
    choose_role = g.event.setting('choose_role').is_active
    whitelisted = []
    raise UserWarning(form.role_id.choices)
    for block in g.group.setting('whitelist').value.split(','):
        data = block.split('(')
        if len(data) == 2:
            whitelisted.append((data[0].strip(), data[1].strip()[:-1]))
        else:
            whitelisted.append((data[0].strip(), ''))
    emails = [s.strip() for s, _ in whitelisted]
    if g.user.email in emails:
        title = [title for email, title in whitelisted if email == g.user.email][0]
        message = 'You\'ve been identified as "%s". Hello! Click "Confirm" below, to get started.' % title
    roles = EventRole.query.filter_by(
        event_id=g.event.id,
        is_active=True).all()
    if choose_role:
        form.role_id.choices = [(r.id, r.name) for r in roles]
    else:
        del form.role_id
    if g.user in g.event:
        return redirect(url_for('event.home', notif=7))
    if request.method == 'POST' and form.validate():
        if g.user.email in emails:
            if title not in [r.name for r in roles]:
                title = 'Authorizer'
            role = {'role': title or 'Authorizer'}
        elif choose_role:
            role = {'role_id': request.form['role_id']}
        else:
            role = {'role': g.event.setting('role').value }
        signup = g.user.signup(g.event, **role)
        return redirect(url_for('event.home'))
    form.event_id.default = g.event.id
    form.user_id.default = g.user.id
    form.process()
    return render_event('form.html',
        title='Signup for %s' % event.name,
        submit='Confirm',
        form=form,
        message=message,
        back=url_for('event.home'))

@event.route('/leave')
@login_required
def leave():
    """leave event"""
    g.user.leave(g.event)
    return redirect(url_for('event.home'))

@event.route('/checkin', methods=['GET', 'POST'])
@login_required
def checkin():
    """event checkin"""
    message = ''
    form = EventCheckinForm(request.form)
    if request.method == 'POST' and form.validate():
        setting = UserSetting.query.filter_by(
            name='authorize_code',
            value=request.form['code'].strip(),
            is_active=True).one_or_none()
        if setting:
            checkin = g.user.checkin(g.event, setting.user)
            return redirect(url_for('event.home', notif=8))
        message = 'Authorization failed.'
    form.event_id.default = g.event.id
    form.user_id.default = g.user.id
    form.process()
    return render_event('form.html',
        title='Checkin for %s' % event.name,
        message=message,
        submit='Checkin',
        form=form)

#########
# STAFF #
#########

@event.route('/authorize', methods=['GET', 'POST'])
@login_required
def authorize():
    """event authorization (for checkin)"""
    form = EventGenerateCodeForm(request.form)
    setting = g.user.setting('authorize_code')
    n = 25
    if (request.method == 'POST' and form.validate()) or setting.value == default_user_settings['authorize_code']['value'] or UserSetting.query.filter_by(value=setting.value).count() > 1:
        setting.value = Base.hash(request.form.get('value', str(arrow.now()))
            )[n:n+int(request.form.get('length', 5))]
        setting.save()
    message = 'Current code: %s' % setting.value
    return render_event('form.html',
        title='Authorization Code for %s' % event.name,
        message=message,
        submit='Regenerate',
        form=form,
        back=url_for('event.home'))

##############
# MANAGEMENT #
##############

@event.route('/edit', methods=['GET', 'POST'])
@login_required
def edit():
    """event edit"""
    form = EventForm(request.form, obj=g.event)
    if request.method == 'POST' and form.validate():
        g.event.update(**request.form).save().set_local('start', 'end').save()
        return redirect(url_for('event.home'))
    return render_event('form.html',
        title='Edit Event',
        submit='save',
        form=form)

@event.route('/settings', methods=['GET', 'POST'])
@login_required
def settings():
    """edit settings"""
    settings = EventSetting.query.filter_by(event_id=g.event.id).all()
    if request.method == 'POST':
        pass
    return render_event('settings.html', settings=settings)

@event.route('/process', methods=['GET', 'POST'])
@requires('create_event')
@login_required
def process():
    """process whitelist"""
    form = ProcessWaitlistForm(request.form)
    if request.method == 'POST' and form.validate():
        pass
    return render_event('form.html',
        title='Process Waitlist',
        submit='Process',
        form=form)

@event.route('/delete')
@requires('create_event')
@login_required
def delete():
    """delete event"""
    g.event.deactivate()
    return redirect(url_for('group.events'))
<commit_msg>fixed url_preprocesseo<commit_after>from flask import Blueprint, render_template, request, redirect, g
from piipod.views import current_user, login_required, url_for, requires
from .forms import EventForm, EventSignupForm, EventCheckinForm, \
    EventGenerateCodeForm, ProcessWaitlistForm
from piipod.models import Group, Event, User, UserSetting, Membership, Signup,\
    GroupRole, EventRole, Base
from sqlalchemy.orm.exc import NoResultFound
from piipod.defaults import default_user_settings
import arrow

event = Blueprint('event', __name__,
    url_prefix='/<string:group_url>/e/<int:event_id>/<string:event_slug>')

@event.url_defaults
def add_ids(endpoint, values):
    values.setdefault('group_url', getattr(g, 'group_url', None))
    values.setdefault('event_id', getattr(g, 'event_id', None))
    values.setdefault('event_slug', getattr(g, 'event_slug', None))

@event.url_value_preprocessor
def pull_ids(endpoint, values):
    try:
        g.group_url = values.pop('group_url')
        g.group = Group.query.filter_by(url=g.group_url).one_or_none()
        g.event_id = values.pop('event_id')
        g.event_slug = values.pop('event_slug')
        g.event = Event.query.get(g.event_id)
        if not g.group or not g.event:
            abort(404)
        g.event.to_local('start', 'end')
        g.user = current_user()
        if g.user.is_authenticated:
            g.membership = Membership.query.filter_by(
                group_id=g.group.id,
                user_id=g.user.id,
                is_active=True).one_or_none()
            if g.membership:
                g.group_role = GroupRole.query.get(g.membership.role_id)
            else:
                g.group_role = None
            g.signup = Signup.query.filter_by(
                event_id=g.event.id,
                user_id=g.user.id,
                is_active=True).one_or_none()
            if g.signup:
                g.event_role = EventRole.query.get(g.signup.role_id)
            else:
                g.event_role = None
        else:
            g.membership = g.signup = g.group_role = g.event_role = None
    except NoResultFound:
        return 'No such event.'

def render_event(f, *args, **kwargs):
    """custom render for events"""
    from piipod.views import render
    data = vars(g)
    data.update(kwargs)
    return render(f, *args, **data)

################
# PUBLIC PAGES #
################

@event.route('/')
def home():
    """event homepage"""
    return render_event('event/index.html')

@event.route('/signup', methods=['GET', 'POST'])
@login_required
def signup():
    """event signup"""
    form = EventSignupForm(request.form)
    message = ''
    choose_role = g.event.setting('choose_role').is_active
    whitelisted = []
    raise UserWarning(form.role_id.choices)
    for block in g.group.setting('whitelist').value.split(','):
        data = block.split('(')
        if len(data) == 2:
            whitelisted.append((data[0].strip(), data[1].strip()[:-1]))
        else:
            whitelisted.append((data[0].strip(), ''))
    emails = [s.strip() for s, _ in whitelisted]
    if g.user.email in emails:
        title = [title for email, title in whitelisted if email == g.user.email][0]
        message = 'You\'ve been identified as "%s". Hello! Click "Confirm" below, to get started.' % title
    roles = EventRole.query.filter_by(
        event_id=g.event.id,
        is_active=True).all()
    if choose_role:
        form.role_id.choices = [(r.id, r.name) for r in roles]
    else:
        del form.role_id
    if g.user in g.event:
        return redirect(url_for('event.home', notif=7))
    if request.method == 'POST' and form.validate():
        if g.user.email in emails:
            if title not in [r.name for r in roles]:
                title = 'Authorizer'
            role = {'role': title or 'Authorizer'}
        elif choose_role:
            role = {'role_id': request.form['role_id']}
        else:
            role = {'role': g.event.setting('role').value }
        signup = g.user.signup(g.event, **role)
        return redirect(url_for('event.home'))
    form.event_id.default = g.event.id
    form.user_id.default = g.user.id
    form.process()
    return render_event('form.html',
        title='Signup for %s' % event.name,
        submit='Confirm',
        form=form,
        message=message,
        back=url_for('event.home'))

@event.route('/leave')
@login_required
def leave():
    """leave event"""
    g.user.leave(g.event)
    return redirect(url_for('event.home'))

@event.route('/checkin', methods=['GET', 'POST'])
@login_required
def checkin():
    """event checkin"""
    message = ''
    form = EventCheckinForm(request.form)
    if request.method == 'POST' and form.validate():
        setting = UserSetting.query.filter_by(
            name='authorize_code',
            value=request.form['code'].strip(),
            is_active=True).one_or_none()
        if setting:
            checkin = g.user.checkin(g.event, setting.user)
            return redirect(url_for('event.home', notif=8))
        message = 'Authorization failed.'
    form.event_id.default = g.event.id
    form.user_id.default = g.user.id
    form.process()
    return render_event('form.html',
        title='Checkin for %s' % event.name,
        message=message,
        submit='Checkin',
        form=form)

#########
# STAFF #
#########

@event.route('/authorize', methods=['GET', 'POST'])
@login_required
def authorize():
    """event authorization (for checkin)"""
    form = EventGenerateCodeForm(request.form)
    setting = g.user.setting('authorize_code')
    n = 25
    if (request.method == 'POST' and form.validate()) or setting.value == default_user_settings['authorize_code']['value'] or UserSetting.query.filter_by(value=setting.value).count() > 1:
        setting.value = Base.hash(request.form.get('value', str(arrow.now()))
            )[n:n+int(request.form.get('length', 5))]
        setting.save()
    message = 'Current code: %s' % setting.value
    return render_event('form.html',
        title='Authorization Code for %s' % event.name,
        message=message,
        submit='Regenerate',
        form=form,
        back=url_for('event.home'))

##############
# MANAGEMENT #
##############

@event.route('/edit', methods=['GET', 'POST'])
@login_required
def edit():
    """event edit"""
    form = EventForm(request.form, obj=g.event)
    if request.method == 'POST' and form.validate():
        g.event.update(**request.form).save().set_local('start', 'end').save()
        return redirect(url_for('event.home'))
    return render_event('form.html',
        title='Edit Event',
        submit='save',
        form=form)

@event.route('/settings', methods=['GET', 'POST'])
@login_required
def settings():
    """edit settings"""
    settings = EventSetting.query.filter_by(event_id=g.event.id).all()
    if request.method == 'POST':
        pass
    return render_event('settings.html', settings=settings)

@event.route('/process', methods=['GET', 'POST'])
@requires('create_event')
@login_required
def process():
    """process whitelist"""
    form = ProcessWaitlistForm(request.form)
    if request.method == 'POST' and form.validate():
        pass
    return render_event('form.html',
        title='Process Waitlist',
        submit='Process',
        form=form)

@event.route('/delete')
@requires('create_event')
@login_required
def delete():
    """delete event"""
    g.event.deactivate()
    return redirect(url_for('group.events'))
<|endoftext|>


<commit_before>#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

"""Apache Beam SDK version information and utilities."""

__version__ = '2.2.0.dev'
<commit_msg>Update python version.<commit_after>#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

"""Apache Beam SDK version information and utilities."""

__version__ = '2.2.0'
<|endoftext|>


<commit_before>#!/usr/bin/env python3
#
# i3pystatus documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 14 17:41:37 2013.
#
# 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 sys, os

sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))

# requires PyPI mock
import mock

MOCK_MODULES = [
    "alsaaudio",
    "netifaces", "psutil",
    "lxml.html", "lxml.cssselect", "lxml",
    "praw",
    "gi.repository", "dbus.mainloop.glib", "dbus",
    "pywapi", "basiciw",
    "i3pystatus.pulseaudio.pulse",
    "notmuch",
    "requests",
    "bs4",
    "dota2py",
    "novaclient",
    "speedtest_cli",
    "pyzabbix",
    "vk",
    "google-api-python-client",
    "dateutil",
    "httplib2",
    "oauth2client",
    "apiclient",
    "googleapiclient.errors",
    "vlc",
    "dateutil.tz",
    "i3ipc",
]

for mod_name in MOCK_MODULES:
    sys.modules[mod_name] = mock.Mock()

# -- 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',
    'module_docs',
]

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

# The suffix of source filenames.
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'i3pystatus'
copyright = '2012-2016 i3pystatus developers. Free and open software under the MIT license'

# 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 = ''
# The full version, including alpha/beta/rc tags.
#release = ''

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']

# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

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

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False

# -- 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 = "haiku"

# 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 themes here, relative to this directory.
#html_theme_path = []

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
#html_title = None

# A shorter title for the navigation bar.  Default is the same as html_title.
#html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None

# 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']

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}

# If false, no module index is generated.
#html_domain_indices = True

# If false, no index is generated.
#html_use_index = True

# If true, the index is split into individual pages for each letter.
#html_split_index = False

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'i3pystatusdoc'

# -- Options for LaTeX output --------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
  ('index', 'i3pystatus.tex', 'i3pystatus Documentation',
   'Author', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# If true, show page references after internal links.
#latex_show_pagerefs = False

# If true, show URL addresses after external links.
#latex_show_urls = False

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_domain_indices = True

# -- Options for manual page output --------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    ('index', 'i3pystatus', 'i3pystatus Documentation',
     ['Author'], 1)
]

# If true, show URL addresses after external links.
#man_show_urls = False

# -- Options for Texinfo output ------------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
  ('index', 'i3pystatus', 'i3pystatus Documentation',
   'Author', 'i3pystatus', 'One line description of project.',
   'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []

# If false, no module index is generated.
#texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False

# -- Options for Epub output ---------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = 'i3pystatus'
epub_author = 'Author'
epub_publisher = 'Author'
epub_copyright = '2013, Author'

# The language of the text. It defaults to the language option
# or en if the language is not set.
#epub_language = ''

# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''

# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#epub_identifier = ''

# A unique identification for the text.
#epub_uid = ''

# A tuple containing the cover image and cover page html template filenames.
#epub_cover = ()

# A sequence of (type, uri, title) tuples for the guide element of content.opf.
#epub_guide = ()

# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []

# HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []

# A list of files that should not be packed into the epub file.
#epub_exclude_files = []

# The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3

# Allow duplicate toc entries.
#epub_tocdup = True

# Fix unsupported image types using the PIL.
#epub_fix_images = False

# Scale large images.
#epub_max_image_width = 0

# If 'no', URL addresses will not be shown.
#epub_show_urls = 'inline'

# If false, no index is generated.
#epub_use_index = True
<commit_msg>change to conf as per https://github.com/enkore/i3pystatus/pull/449#issuecomment-247045192<commit_after>#!/usr/bin/env python3
#
# i3pystatus documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 14 17:41:37 2013.
#
# 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 sys, os

sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))

# requires PyPI mock
import mock

MOCK_MODULES = [
    "alsaaudio",
    "netifaces", "psutil",
    "lxml.html", "lxml.cssselect", "lxml",
    "praw",
    "gi.repository", "dbus.mainloop.glib", "dbus",
    "pywapi", "basiciw",
    "i3pystatus.pulseaudio.pulse",
    "notmuch",
    "requests",
    "bs4",
    "dota2py",
    "novaclient",
    "speedtest",
    "pyzabbix",
    "vk",
    "google-api-python-client",
    "dateutil",
    "httplib2",
    "oauth2client",
    "apiclient",
    "googleapiclient.errors",
    "vlc",
    "dateutil.tz",
    "i3ipc",
]

for mod_name in MOCK_MODULES:
    sys.modules[mod_name] = mock.Mock()

# -- 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',
    'module_docs',
]

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

# The suffix of source filenames.
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'i3pystatus'
copyright = '2012-2016 i3pystatus developers. Free and open software under the MIT license'

# 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 = ''
# The full version, including alpha/beta/rc tags.
#release = ''

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']

# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

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

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False

# -- 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 = "haiku"

# 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 themes here, relative to this directory.
#html_theme_path = []

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
#html_title = None

# A shorter title for the navigation bar.  Default is the same as html_title.
#html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None

# 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']

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}

# If false, no module index is generated.
#html_domain_indices = True

# If false, no index is generated.
#html_use_index = True

# If true, the index is split into individual pages for each letter.
#html_split_index = False

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'i3pystatusdoc'

# -- Options for LaTeX output --------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
  ('index', 'i3pystatus.tex', 'i3pystatus Documentation',
   'Author', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# If true, show page references after internal links.
#latex_show_pagerefs = False

# If true, show URL addresses after external links.
#latex_show_urls = False

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_domain_indices = True

# -- Options for manual page output --------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    ('index', 'i3pystatus', 'i3pystatus Documentation',
     ['Author'], 1)
]

# If true, show URL addresses after external links.
#man_show_urls = False

# -- Options for Texinfo output ------------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
  ('index', 'i3pystatus', 'i3pystatus Documentation',
   'Author', 'i3pystatus', 'One line description of project.',
   'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []

# If false, no module index is generated.
#texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False

# -- Options for Epub output ---------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = 'i3pystatus'
epub_author = 'Author'
epub_publisher = 'Author'
epub_copyright = '2013, Author'

# The language of the text. It defaults to the language option
# or en if the language is not set.
#epub_language = ''

# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''

# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#epub_identifier = ''

# A unique identification for the text.
#epub_uid = ''

# A tuple containing the cover image and cover page html template filenames.
#epub_cover = ()

# A sequence of (type, uri, title) tuples for the guide element of content.opf.
#epub_guide = ()

# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []

# HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []

# A list of files that should not be packed into the epub file.
#epub_exclude_files = []

# The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3

# Allow duplicate toc entries.
#epub_tocdup = True

# Fix unsupported image types using the PIL.
#epub_fix_images = False

# Scale large images.
#epub_max_image_width = 0

# If 'no', URL addresses will not be shown.
#epub_show_urls = 'inline'

# If false, no index is generated.
#epub_use_index = True
<|endoftext|>