<commit_before># -*- coding: utf-8 -*-
#
# napi documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 30 16:51:31 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

# 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.doctest',
    'sphinx.ext.intersphinx',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.pngmath',
    'sphinx.ext.ifconfig',
    'sphinx.ext.viewcode',
    'ipython.sphinxext.ipython_console_highlighting',
    'ipython.sphinxext.ipython_directive']

# 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'napi'
copyright = u'2013, Ahmet Bakan'

# 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 = release = '0.1'

# 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 = 'sphinx'

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

# -- 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 = 'default'

# 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 = 'napidoc'

# -- 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', 'napi.tex', u'napi Documentation',
   u'Ahmet Bakan', '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', 'napi', u'napi Documentation',
     [u'Ahmet Bakan'], 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', 'napi', u'napi Documentation',
   u'Ahmet Bakan', 'napi', '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'

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

# Bibliographic Dublin Core info.
epub_title = u'napi'
epub_author = u'Ahmet Bakan'
epub_publisher = u'Ahmet Bakan'
epub_copyright = u'2013, Ahmet Bakan'

# 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 = ()

# 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

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
    'http://docs.python.org/': None,
    'http://docs.scipy.org/doc/numpy/': None,
}
<commit_msg>Fixed extension module name.<commit_after># -*- coding: utf-8 -*-
#
# napi documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 30 16:51:31 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

# 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.doctest',
    'sphinx.ext.intersphinx',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.pngmath',
    'sphinx.ext.ifconfig',
    'sphinx.ext.viewcode',
    'IPython.sphinxext.ipython_console_highlighting',
    'IPython.sphinxext.ipython_directive']

# 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'napi'
copyright = u'2013, Ahmet Bakan'

# 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 = release = '0.1'

# 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 = 'sphinx'

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

# -- 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 = 'default'

# 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 = 'napidoc'

# -- 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', 'napi.tex', u'napi Documentation',
   u'Ahmet Bakan', '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', 'napi', u'napi Documentation',
     [u'Ahmet Bakan'], 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', 'napi', u'napi Documentation',
   u'Ahmet Bakan', 'napi', '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'

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

# Bibliographic Dublin Core info.
epub_title = u'napi'
epub_author = u'Ahmet Bakan'
epub_publisher = u'Ahmet Bakan'
epub_copyright = u'2013, Ahmet Bakan'

# 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 = ()

# 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

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
    'http://docs.python.org/': None,
    'http://docs.scipy.org/doc/numpy/': None,
}
<|endoftext|>


<commit_before>
import discord
from discord.ext import commands

from utilities import errors

# TODO: Check necessity of all checks
# TODO: Use native discord.py check predicates?

def is_guild_owner():

	async def predicate(ctx):
		if ctx.channel.type is discord.ChannelType.private:
			return True
		if ctx.author == ctx.guild.owner:
			return True
		try:
			return await commands.is_owner().predicate(ctx)
		except commands.NotOwner:
			raise errors.NotGuildOwner

	return commands.check(predicate)

def is_voice_connected():

	async def predicate(ctx):
		if ctx.guild and ctx.guild.voice_client:
			return True
		permitted = await ctx.get_permission("join", user = ctx.author)
		if permitted:
			raise errors.PermittedVoiceNotConnected
		try:
			await is_guild_owner().predicate(ctx)
			raise errors.PermittedVoiceNotConnected
		except errors.NotGuildOwner:
			raise errors.NotPermittedVoiceNotConnected

	return commands.check(predicate)

def has_permissions_for(channel, **permissions):

	async def predicate(ctx):
		if not (missing := [permission for permission, setting in permissions.items()
							if getattr(channel.permissions_for(ctx.author), permission, None) != setting]):
			return True
		raise commands.MissingPermissions(missing)

	return commands.check(predicate)

def bot_has_permissions_for(channel, **permissions):

	def predicate(ctx):
		if not (missing := [permission for permission, setting in permissions.items()
							if getattr(channel.permissions_for(ctx.me), permission, None) != setting]):
			return True
		raise commands.BotMissingPermissions(missing)

	return commands.check(predicate)

def not_forbidden():

	async def predicate(ctx):
		if ctx.channel.type is discord.ChannelType.private:
			return True
		command = ctx.command
		while ((permitted := await ctx.get_permission(command.name, user = ctx.author)) is None
				and command.parent is not None):
			command = command.parent
		try:
			return permitted is not False or await is_guild_owner().predicate(ctx)
		except errors.NotGuildOwner:
			raise errors.NotPermitted

	return commands.check(predicate)

def is_permitted():

	async def predicate(ctx):
		command = ctx.command
		while ((permitted := await ctx.get_permission(command.name, user = ctx.author)) is None
				and command.parent is not None):
			command = command.parent
		if permitted:
			return True
		raise errors.NotPermitted

	return commands.check(predicate)

<commit_msg>[Discord] Compare IDs in guild owner check<commit_after>
import discord
from discord.ext import commands

from utilities import errors

# TODO: Check necessity of all checks
# TODO: Use native discord.py check predicates?

def is_guild_owner():

	async def predicate(ctx):
		if ctx.channel.type is discord.ChannelType.private:
			return True
		if ctx.author.id == ctx.guild.owner_id:
			return True
		try:
			return await commands.is_owner().predicate(ctx)
		except commands.NotOwner:
			raise errors.NotGuildOwner

	return commands.check(predicate)

def is_voice_connected():

	async def predicate(ctx):
		if ctx.guild and ctx.guild.voice_client:
			return True
		permitted = await ctx.get_permission("join", user = ctx.author)
		if permitted:
			raise errors.PermittedVoiceNotConnected
		try:
			await is_guild_owner().predicate(ctx)
			raise errors.PermittedVoiceNotConnected
		except errors.NotGuildOwner:
			raise errors.NotPermittedVoiceNotConnected

	return commands.check(predicate)

def has_permissions_for(channel, **permissions):

	async def predicate(ctx):
		if not (missing := [permission for permission, setting in permissions.items()
							if getattr(channel.permissions_for(ctx.author), permission, None) != setting]):
			return True
		raise commands.MissingPermissions(missing)

	return commands.check(predicate)

def bot_has_permissions_for(channel, **permissions):

	def predicate(ctx):
		if not (missing := [permission for permission, setting in permissions.items()
							if getattr(channel.permissions_for(ctx.me), permission, None) != setting]):
			return True
		raise commands.BotMissingPermissions(missing)

	return commands.check(predicate)

def not_forbidden():

	async def predicate(ctx):
		if ctx.channel.type is discord.ChannelType.private:
			return True
		command = ctx.command
		while ((permitted := await ctx.get_permission(command.name, user = ctx.author)) is None
				and command.parent is not None):
			command = command.parent
		try:
			return permitted is not False or await is_guild_owner().predicate(ctx)
		except errors.NotGuildOwner:
			raise errors.NotPermitted

	return commands.check(predicate)

def is_permitted():

	async def predicate(ctx):
		command = ctx.command
		while ((permitted := await ctx.get_permission(command.name, user = ctx.author)) is None
				and command.parent is not None):
			command = command.parent
		if permitted:
			return True
		raise errors.NotPermitted

	return commands.check(predicate)

<|endoftext|>


<commit_before>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# openmmtools documentation build configuration file, created by
# sphinx-quickstart on Sat May 13 13:35:37 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

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

# -- 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.mathjax',
    'numpydoc',
    'sphinx.ext.doctest',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.viewcode',
    'sphinx.ext.githubpages'
    ]

autosummary_generate = True
autodoc_default_flags = ['members', 'inherited-members']
numpydoc_class_members_toctree = False

# 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 master toctree document.
master_doc = 'index'

# General information about the project.
project = 'openmmtools'
copyright = '2015-2017, The Chodera Lab, MSKCC'
author = 'The Chodera Lab, MSKCC'

# 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.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

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

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

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

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

# 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 = {
    'logo' : 'images/logo.jpg',
    "logo_name": 'true',
    'page_width': 'auto',
    'github_button': 'true',
    'github_user': 'choderalab',
    'github_repo': 'openmmtools',
    'github_banner': 'true',
    'travis_button': 'true',
    'show_powered_by' :'true',
    'font_family': 'calibri, helvetica, sans-serif',
    'head_font_family': 'cambria, tahoma, serif',
    'description' : 'A batteries-included toolkit for the GPU-accelerated OpenMM molecular simulation engine',
    'pre_bg': '#41323f', # color used for syntax block
    'body_text': "#41323f",
    "pink_1": "peachpuff"

}

# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = [alabaster.get_path()]

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

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

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

# -- Options for HTMLHelp output ------------------------------------------

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

# -- 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, 'openmmtools.tex', 'openmmtools Documentation',
     'The Chodera Lab, MSKCC', 'manual'),
]

# -- 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, 'openmmtools', 'openmmtools Documentation',
     [author], 1)
]

# -- 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, 'openmmtools', 'openmmtools Documentation',
     author, 'openmmtools', 'One line description of project.',
     'Miscellaneous'),
]
<commit_msg>Add google analytics tracking ID<commit_after>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# openmmtools documentation build configuration file, created by
# sphinx-quickstart on Sat May 13 13:35:37 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

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

# -- 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.mathjax',
    'numpydoc',
    'sphinx.ext.doctest',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.viewcode',
    'sphinx.ext.githubpages'
    ]

autosummary_generate = True
autodoc_default_flags = ['members', 'inherited-members']
numpydoc_class_members_toctree = False

# 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 master toctree document.
master_doc = 'index'

# General information about the project.
project = 'openmmtools'
copyright = '2015-2017, The Chodera Lab, MSKCC'
author = 'The Chodera Lab, MSKCC'

# 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.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

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

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

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

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

# 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 = {
    'logo' : 'images/logo.jpg',
    "logo_name": 'true',
    'page_width': 'auto',
    'github_button': 'true',
    'github_user': 'choderalab',
    'github_repo': 'openmmtools',
    'github_banner': 'true',
    'travis_button': 'true',
    'show_powered_by' :'true',
    'font_family': 'calibri, helvetica, sans-serif',
    'head_font_family': 'cambria, tahoma, serif',
    'description' : 'A batteries-included toolkit for the GPU-accelerated OpenMM molecular simulation engine',
    'pre_bg': '#41323f', # color used for syntax block
    'body_text': "#41323f",
    "pink_1": "peachpuff",
    "analytics_id" : "UA-99115718-1" # choderalab google analytics tracking id
}

# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = [alabaster.get_path()]

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

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

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

# -- Options for HTMLHelp output ------------------------------------------

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

# -- 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, 'openmmtools.tex', 'openmmtools Documentation',
     'The Chodera Lab, MSKCC', 'manual'),
]

# -- 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, 'openmmtools', 'openmmtools Documentation',
     [author], 1)
]

# -- 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, 'openmmtools', 'openmmtools Documentation',
     author, 'openmmtools', 'One line description of project.',
     'Miscellaneous'),
]
<|endoftext|>


<commit_before>project = "gdsfactory"
release = "3.5.2"
copyright = "2019, PsiQ"
author = "PsiQ"

html_theme = "furo"
# html_theme = "sphinx_rtd_theme"

source_suffix = {
    ".rst": "restructuredtext",
    ".txt": "markdown",
    ".md": "markdown",
}

html_static_path = ["_static"]

extensions = [
    "matplotlib.sphinxext.plot_directive",
    "myst_parser",
    "nbsphinx",
    "sphinx.ext.autodoc",
    "sphinx.ext.doctest",
    "sphinx.ext.mathjax",
    "sphinx.ext.napoleon",
    "sphinx.ext.todo",
    "sphinx.ext.viewcode",
    "sphinx_autodoc_typehints",
    "sphinx_click",
    "sphinx_markdown_tables",
]

autodoc_member_order = "bysource"

templates_path = ["_templates"]
exclude_patterns = [
    "_build",
    "Thumbs.db",
    ".DS_Store",
    "**.ipynb_checkpoints",
    "build",
    "extra/**",
]

napoleon_use_param = True

source_suffix = {
    ".rst": "restructuredtext",
    ".txt": "markdown",
    ".md": "markdown",
}

language = "en"
myst_html_meta = {
    "description lang=en": "metadata description",
    "description lang=fr": "description des métadonnées",
    "keywords": "Sphinx, MyST",
    "property=og:locale": "en_US",
}
<commit_msg>exclude_patterns for plugin notebooks<commit_after>project = "gdsfactory"
release = "3.5.2"
copyright = "2019, PsiQ"
author = "PsiQ"

html_theme = "furo"
# html_theme = "sphinx_rtd_theme"

source_suffix = {
    ".rst": "restructuredtext",
    ".txt": "markdown",
    ".md": "markdown",
}

html_static_path = ["_static"]

extensions = [
    "matplotlib.sphinxext.plot_directive",
    "myst_parser",
    "nbsphinx",
    "sphinx.ext.autodoc",
    "sphinx.ext.doctest",
    "sphinx.ext.mathjax",
    "sphinx.ext.napoleon",
    "sphinx.ext.todo",
    "sphinx.ext.viewcode",
    "sphinx_autodoc_typehints",
    "sphinx_click",
    "sphinx_markdown_tables",
]

autodoc_member_order = "bysource"

templates_path = ["_templates"]
exclude_patterns = [
    "_build",
    "Thumbs.db",
    ".DS_Store",
    "**.ipynb_checkpoints",
    "build",
    "extra/**",
    "plugins/**",
]

napoleon_use_param = True

source_suffix = {
    ".rst": "restructuredtext",
    ".txt": "markdown",
    ".md": "markdown",
}

language = "en"
myst_html_meta = {
    "description lang=en": "metadata description",
    "description lang=fr": "description des métadonnées",
    "keywords": "Sphinx, MyST",
    "property=og:locale": "en_US",
}
<|endoftext|>


<commit_before>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ratcave documentation build configuration file, created by
# sphinx-quickstart on Wed Oct  5 16:47:55 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
from mock import Mock as MagicMock

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

    def __len__(self):
        return 3  # Hacky patch

MOCK_MODULES = ['argparse', 'numpy', 'pyglet', 'pyglet.gl', '_transformations', 'ratcave.resources']
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('.'))
sys.path.insert(0, os.path.abspath('..'))

autoclass_content = 'both'  # Ensures the class.__init__() methods get documented.

# -- 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',
    'sphinxcontrib.napoleon',
    'sphinx.ext.todo',
]

# 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 = 'ratcave'
copyright = '2016, Nicholas A Del Grosso'
author = 'Nicholas A Del Grosso'

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

# 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 = False

# 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 = []

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

stodo_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'
html_theme =  'sphinx_rtd_theme'  # can also use 'alabaster'
# html_theme = 'pyramid'

# 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 = 'ratcavedoc'

# -- 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, 'ratcave.tex', 'ratcave Documentation',
     'Nicholas A Del Grosso', '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, 'ratcave', 'ratcave 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, 'ratcave', 'ratcave Documentation',
     author, 'ratcave', '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
<commit_msg>Testing new path for ReadtheDocs<commit_after>#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ratcave documentation build configuration file, created by
# sphinx-quickstart on Wed Oct  5 16:47:55 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
from mock import Mock as MagicMock

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

    def __len__(self):
        return 3  # Hacky patch

MOCK_MODULES = ['argparse', 'numpy', 'pyglet', 'pyglet.gl', '_transformations', 'ratcave.resources']
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('.'))
# sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(__file__ + '/..'))

autoclass_content = 'both'  # Ensures the class.__init__() methods get documented.

# -- 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',
    'sphinxcontrib.napoleon',
    'sphinx.ext.todo',
]

# 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 = 'ratcave'
copyright = '2016, Nicholas A Del Grosso'
author = 'Nicholas A Del Grosso'

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

# 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 = False

# 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 = []

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

stodo_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'
html_theme =  'sphinx_rtd_theme'  # can also use 'alabaster'
# html_theme = 'pyramid'

# 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 = 'ratcavedoc'

# -- 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, 'ratcave.tex', 'ratcave Documentation',
     'Nicholas A Del Grosso', '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, 'ratcave', 'ratcave 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, 'ratcave', 'ratcave Documentation',
     author, 'ratcave', '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
<|endoftext|>


<commit_before>#! /usr/bin/env python3

import argparse
import logging
import os
import pickle
import sys

import numpy as np
import pandas as pd

import misc.logging_utils as logging_utils
import misc.parallel as parallel
import misc.utils as utils

logger = logging.getLogger(__name__)

default_num_cpus = 1

default_periodic_models = []
default_nonperiodic_models = []

default_periodic_offset_start = -20
default_periodic_offset_end = 0
default_metagene_profile_length = 21

default_type_field = 'type'
default_position_field = 'position'
default_count_field = 'count'

default_iterations = 500
default_chains = 2
default_seed = 8675309

class NullDevice():
    def write(self, s):
        pass

def estimate_marginal_likelihoods(signal, periodic_models, nonperiodic_models, iterations, chains, seed):

    # construct the input for the models
    x_1 = signal[0::3]
    x_2 = signal[1::3]
    x_3 = signal[2::3]
    T = len(x_1)

    very_high_prior_location = max(signal)

    data = {
        "x_1": x_1,
        "x_2": x_2,
        "x_3": x_3,
        "T": T,
        "very_high_prior_location": very_high_prior_location
    }

    # get the likelihood for each of the models
    bft_periodic = [
        pm.sampling(data=data, iter=iterations, chains=chains, n_jobs=1, seed=seed, refresh=-1)
            for pm in periodic_models]

    bft_nonperiodic = [
        nm.sampling(data=data, iter=iterations, chains=chains, n_jobs=1, seed=seed, refresh=-1)
            for nm in nonperiodic_models]

    return (bft_periodic, bft_nonperiodic)

def estimate_profile_bayes_factors(profile, args):
    length = profile['length'].iloc[0]

    # read in the relevant models
    periodic_models = [pickle.load(open(pm, 'rb')) for pm in args.periodic_models]
    nonperiodic_models = [pickle.load(open(npm, 'rb')) for npm in args.nonperiodic_models]

    # pull out the start offsets ("position" field) and counts
    mask_start = profile[args.type_field] == 'start'
    start_profile_df = profile.loc[mask_start]
    start_profile_df = start_profile_df.sort_values(args.position_field)

    start_positions = start_profile_df[args.position_field].values
    start_counts = start_profile_df[args.count_field].values

    # find the positions of the offsets of interest within the arrays
    begin_index = np.where(start_positions==args.periodic_offset_start)[0][0]
    stop_index = np.where(start_positions==args.periodic_offset_end)[0][0]

    # collect all of the results as a data frame
    ret = []

    for i in range(begin_index, stop_index+1):
        offset = start_positions[i]

        msg = "Length: {}, Offset: {}".format(length, offset)
        logger.debug(msg)

        # pull out the signal for this offset
        signal = start_counts[i:i+args.metagene_profile_length]
        (bft_periodic, bft_nonperiodic) = estimate_marginal_likelihoods(signal,
            periodic_models, nonperiodic_models,
            iterations=args.iterations,chains=args.chains,seed=args.seed)

        # extract the parameters of interest
        m_periodic_ex = [m.extract(pars=['lp__']) for m in bft_periodic]
        m_nonperiodic_ex = [m.extract(pars=['lp__']) for m in bft_nonperiodic]

        # now, choose the best model of each class,  based on mean likelihood
        m_periodic_means = [np.mean(m_ex['lp__']) for m_ex in m_periodic_ex]
        m_nonperiodic_means = [np.mean(m_ex['lp__']) for m_ex in m_nonperiodic_ex]

        max_periodic_mean = np.argmax(m_periodic_means)
        max_nonperiodic_mean = np.argmax(m_nonperiodic_means)

        # select the best sampling results
        m_periodic_ex = m_periodic_ex[max_periodic_mean]
        m_nonperiodic_ex = m_nonperiodic_ex[max_nonperiodic_mean]

        profile_sum = np.sum(signal)
        profile_peak = signal[0]

        v = {
            "offset": offset,
            "p_periodic_mean": np.mean(m_periodic_ex['lp__']),
            "p_periodic_var": np.var(m_periodic_ex['lp__']),
            "p_nonperiodic_mean": np.mean(m_nonperiodic_ex['lp__']),
            "p_nonperiodic_var": np.var(m_nonperiodic_ex['lp__']),
            'profile_sum': profile_sum,
            'profile_peak': profile_peak
        }

        v['bayes_factor_mean'] = v['p_periodic_mean'] - v['p_nonperiodic_mean']
        v['bayes_factor_var'] = v['p_periodic_var'] + v['p_periodic_var']

        ret.append(pd.Series(v))

    ret = pd.DataFrame(ret)
    ret['length'] = length

    return ret

def main():
    parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        description="This script estimates the Bayes factors for all metagene profiles in the "
        "given file. The script accepts as input multiple \"periodic\" and \"nonperiodic\" "
        "models. It uses the models of each type with the best mean to estimate the Bayes "
        "factor distributions.\n\nIt contains some hard-coded field names.")

    parser.add_argument('metagene_profiles', help="The (csv) file containing the metagene profiles")
    parser.add_argument('out', help="The output (csv.gz) file")

    parser.add_argument('--periodic-models', help="A list of pickled StanModel files which contain "
        "models that somehow represent periodic metagene profiles", nargs="+",
        default=default_periodic_models)
    parser.add_argument('--nonperiodic-models', help="A list of pickled StanModel files which contain "
        "models that somehow represent nonperiodic metagene profiles", nargs="+",
        default=default_nonperiodic_models)

    parser.add_argument('--periodic-offset-start', help="The position, relative to the translation "
        "initiation site, to begin calculating periodicity Bayes factors (inclusive)", type=int,
        default=default_periodic_offset_start)
    parser.add_argument('--periodic-offset-end', help="The position, relative to the translation "
        "initiation site, to stop calculating periodicity Bayes factors (inclusive)", type=int,
        default=default_periodic_offset_end)
    parser.add_argument('--metagene-profile-length', help="The length of the profile to use in the "
        "models. metagene_profile_length + periodic_offset_end must be consistent with the length "
        "of the extracted metagene profile. The length must be divisible by three.", type=int,
        default=default_metagene_profile_length)

    parser.add_argument('-s', '--seed', help="The random seeds to use for inference",
        type=int, default=default_seed)
    parser.add_argument('-c', '--chains', help="The number of MCMC chains to use", type=int,
        default=default_chains)
    parser.add_argument('-i', '--iterations', help="The number of MCMC iterations to use for "
        "each chain", type=int, default=default_iterations)

    parser.add_argument('-p', '--num-cpus', help="The number of CPUs to use. Each read "
        "length will be processed in its own thread (so that is the maximum number of CPUs "
        "that is useful).", type=int, default=default_num_cpus)

    parser.add_argument('--type-field', default=default_type_field)
    parser.add_argument('--count-field', default=default_count_field)
    parser.add_argument('--position-field', default=default_position_field)

    logging_utils.add_logging_options(parser)
    args = parser.parse_args()
    logging_utils.update_logging(args)

    # we will parallelize based on the lengths. So we need to know which lengths
    # are present in the metagene profiles file
    metagene_profiles = pd.read_csv(args.metagene_profiles)
    lengths = list(metagene_profiles['length'].unique())

    length_str = ','.join(str(int(l)) for l in lengths)
    msg = "Profiles will be created for lengths: {}".format(length_str)
    logger.info(msg)

    length_groups = metagene_profiles.groupby('length')

    # this does not seem to work
    # it is an attempt to redirect stderr to /dev/null so we don't
    # see the useless Stan output
    temp = sys.stderr
    f = open(os.devnull, 'w')
    sys.stderr = f

    all_profile_estimates_df = parallel.apply_parallel_groups(length_groups, args.num_cpus,
        estimate_profile_bayes_factors, args, progress_bar=True)
    sys.stderr = temp

    all_profile_estimates_df = pd.concat(all_profile_estimates_df)

    utils.write_df(all_profile_estimates_df, args.out, index=False)

if __name__ == '__main__':
    main()

<commit_msg>Added handling to estimating metagene profile Bayes factors to ignore read lengths with no alignments<commit_after>#! /usr/bin/env python3

import argparse
import logging
import os
import pickle
import sys

import numpy as np
import pandas as pd

import misc.logging_utils as logging_utils
import misc.parallel as parallel
import misc.utils as utils

logger = logging.getLogger(__name__)

default_num_cpus = 1

default_periodic_models = []
default_nonperiodic_models = []

default_periodic_offset_start = -20
default_periodic_offset_end = 0
default_metagene_profile_length = 21

default_type_field = 'type'
default_position_field = 'position'
default_count_field = 'count'

default_iterations = 500
default_chains = 2
default_seed = 8675309

class NullDevice():
    def write(self, s):
        pass

def estimate_marginal_likelihoods(signal, periodic_models, nonperiodic_models, iterations, chains, seed):

    # construct the input for the models
    x_1 = signal[0::3]
    x_2 = signal[1::3]
    x_3 = signal[2::3]
    T = len(x_1)

    very_high_prior_location = max(signal)

    data = {
        "x_1": x_1,
        "x_2": x_2,
        "x_3": x_3,
        "T": T,
        "very_high_prior_location": very_high_prior_location
    }

    # get the likelihood for each of the models
    bft_periodic = [
        pm.sampling(data=data, iter=iterations, chains=chains, n_jobs=1, seed=seed, refresh=-1)
            for pm in periodic_models]

    bft_nonperiodic = [
        nm.sampling(data=data, iter=iterations, chains=chains, n_jobs=1, seed=seed, refresh=-1)
            for nm in nonperiodic_models]

    return (bft_periodic, bft_nonperiodic)

def estimate_profile_bayes_factors(profile, args):
    length = profile['length'].iloc[0]

    # read in the relevant models
    periodic_models = [pickle.load(open(pm, 'rb')) for pm in args.periodic_models]
    nonperiodic_models = [pickle.load(open(npm, 'rb')) for npm in args.nonperiodic_models]

    # pull out the start offsets ("position" field) and counts
    mask_start = profile[args.type_field] == 'start'
    start_profile_df = profile.loc[mask_start]
    start_profile_df = start_profile_df.sort_values(args.position_field)

    start_positions = start_profile_df[args.position_field].values
    start_counts = start_profile_df[args.count_field].values

    # find the positions of the offsets of interest within the arrays
    begin_start_pos = np.where(start_positions==args.periodic_offset_start)[0]
    if len(begin_start_pos) == 0:
        msg = "Did not find any start offsets for length: {}".format(length)
        logging.warning(msg)
        return None
    begin_index = begin_start_pos[0]

    stop_start_pos = np.where(start_positions==args.periodic_offset_end)[0]
    if len(stop_start_pos) == 0:
        msg = "Did not find any stop offsets for length: {}".format(length)
        logging.warning(msg)
        return None
    stop_index = stop_start_pos[0]

    # collect all of the results as a data frame
    ret = []

    for i in range(begin_index, stop_index+1):
        offset = start_positions[i]

        msg = "Length: {}, Offset: {}".format(length, offset)
        logger.debug(msg)

        # pull out the signal for this offset
        signal = start_counts[i:i+args.metagene_profile_length]
        (bft_periodic, bft_nonperiodic) = estimate_marginal_likelihoods(signal,
            periodic_models, nonperiodic_models,
            iterations=args.iterations,chains=args.chains,seed=args.seed)

        # extract the parameters of interest
        m_periodic_ex = [m.extract(pars=['lp__']) for m in bft_periodic]
        m_nonperiodic_ex = [m.extract(pars=['lp__']) for m in bft_nonperiodic]

        # now, choose the best model of each class,  based on mean likelihood
        m_periodic_means = [np.mean(m_ex['lp__']) for m_ex in m_periodic_ex]
        m_nonperiodic_means = [np.mean(m_ex['lp__']) for m_ex in m_nonperiodic_ex]

        max_periodic_mean = np.argmax(m_periodic_means)
        max_nonperiodic_mean = np.argmax(m_nonperiodic_means)

        # select the best sampling results
        m_periodic_ex = m_periodic_ex[max_periodic_mean]
        m_nonperiodic_ex = m_nonperiodic_ex[max_nonperiodic_mean]

        profile_sum = np.sum(signal)
        profile_peak = signal[0]

        v = {
            "offset": offset,
            "p_periodic_mean": np.mean(m_periodic_ex['lp__']),
            "p_periodic_var": np.var(m_periodic_ex['lp__']),
            "p_nonperiodic_mean": np.mean(m_nonperiodic_ex['lp__']),
            "p_nonperiodic_var": np.var(m_nonperiodic_ex['lp__']),
            'profile_sum': profile_sum,
            'profile_peak': profile_peak
        }

        v['bayes_factor_mean'] = v['p_periodic_mean'] - v['p_nonperiodic_mean']
        v['bayes_factor_var'] = v['p_periodic_var'] + v['p_periodic_var']

        ret.append(pd.Series(v))

    ret = pd.DataFrame(ret)
    ret['length'] = length

    return ret

def main():
    parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        description="This script estimates the Bayes factors for all metagene profiles in the "
        "given file. The script accepts as input multiple \"periodic\" and \"nonperiodic\" "
        "models. It uses the models of each type with the best mean to estimate the Bayes "
        "factor distributions.\n\nIt contains some hard-coded field names.")

    parser.add_argument('metagene_profiles', help="The (csv) file containing the metagene profiles")
    parser.add_argument('out', help="The output (csv.gz) file")

    parser.add_argument('--periodic-models', help="A list of pickled StanModel files which contain "
        "models that somehow represent periodic metagene profiles", nargs="+",
        default=default_periodic_models)
    parser.add_argument('--nonperiodic-models', help="A list of pickled StanModel files which contain "
        "models that somehow represent nonperiodic metagene profiles", nargs="+",
        default=default_nonperiodic_models)

    parser.add_argument('--periodic-offset-start', help="The position, relative to the translation "
        "initiation site, to begin calculating periodicity Bayes factors (inclusive)", type=int,
        default=default_periodic_offset_start)
    parser.add_argument('--periodic-offset-end', help="The position, relative to the translation "
        "initiation site, to stop calculating periodicity Bayes factors (inclusive)", type=int,
        default=default_periodic_offset_end)
    parser.add_argument('--metagene-profile-length', help="The length of the profile to use in the "
        "models. metagene_profile_length + periodic_offset_end must be consistent with the length "
        "of the extracted metagene profile. The length must be divisible by three.", type=int,
        default=default_metagene_profile_length)

    parser.add_argument('-s', '--seed', help="The random seeds to use for inference",
        type=int, default=default_seed)
    parser.add_argument('-c', '--chains', help="The number of MCMC chains to use", type=int,
        default=default_chains)
    parser.add_argument('-i', '--iterations', help="The number of MCMC iterations to use for "
        "each chain", type=int, default=default_iterations)

    parser.add_argument('-p', '--num-cpus', help="The number of CPUs to use. Each read "
        "length will be processed in its own thread (so that is the maximum number of CPUs "
        "that is useful).", type=int, default=default_num_cpus)

    parser.add_argument('--type-field', default=default_type_field)
    parser.add_argument('--count-field', default=default_count_field)
    parser.add_argument('--position-field', default=default_position_field)

    logging_utils.add_logging_options(parser)
    args = parser.parse_args()
    logging_utils.update_logging(args)

    # we will parallelize based on the lengths. So we need to know which lengths
    # are present in the metagene profiles file
    metagene_profiles = pd.read_csv(args.metagene_profiles)
    lengths = list(metagene_profiles['length'].unique())

    length_str = ','.join(str(int(l)) for l in lengths)
    msg = "Estimating Bayes factors for lengths: {}".format(length_str)
    logger.info(msg)

    length_groups = metagene_profiles.groupby('length')

    all_profile_estimates_df = parallel.apply_parallel_groups(length_groups, args.num_cpus,
        estimate_profile_bayes_factors, args, progress_bar=True)

    msg = "Combining estimates into one data frame"
    logger.info(msg)

    all_profile_estimates_df = utils.remove_nones(all_profile_estimates_df)
    all_profile_estimates_df = pd.concat(all_profile_estimates_df)

    utils.write_df(all_profile_estimates_df, args.out, index=False)

if __name__ == '__main__':
    main()

<|endoftext|>


<commit_before>import webnotes
from webnotes.utils import cstr
from stock.stock_ledger import update_entries_after

def execute():
	pr_items = webnotes.conn.sql("""select item_code, warehouse, serial_no, valuation_rate, name
		from `tabPurchase Receipt Item` where ifnull(serial_no, '') != '' and docstatus = 1""",
		as_dict=True)

	item_warehouse = []

	for item in pr_items:
		serial_nos = cstr(item.serial_no).strip().split("\n")
		serial_nos = map(lambda x: x.strip(), serial_nos)

		webnotes.conn.sql("""update `tabPurchase Receipt Item` set serial_no = %s
			where name = %s""", ("\n".join(serial_nos), item.name))

		webnotes.conn.sql("""update `tabSerial No` set purchase_rate = %s where name in (%s)""" %
			('%s', ', '.join(['%s']*len(serial_nos))), tuple([item.valuation_rate] + serial_nos))

		if [item.item_code, item.warehouse] not in item_warehouse:
			item_warehouse.append([item.item_code, item.warehouse])

	for d in item_warehouse:
		update_entries_after({"item_code": d[0], "warehouse": d[1] })<commit_msg>[patch][serial no] for striped serial nos<commit_after>import webnotes
from webnotes.utils import cstr
from stock.stock_ledger import update_entries_after

def execute():
	webnotes.conn.auto_commit_on_many_writes = 1

	pr_items = webnotes.conn.sql("""select item_code, warehouse, serial_no, valuation_rate, name
		from `tabPurchase Receipt Item` where ifnull(serial_no, '') != '' and docstatus = 1""",
		as_dict=True)

	item_warehouse = []

	for item in pr_items:
		serial_nos = cstr(item.serial_no).strip().split("\n")
		serial_nos = map(lambda x: x.strip(), serial_nos)

		if cstr(item.serial_no) != "\n".join(serial_nos):
			webnotes.conn.sql("""update `tabPurchase Receipt Item` set serial_no = %s
				where name = %s""", ("\n".join(serial_nos), item.name))

			if [item.item_code, item.warehouse] not in item_warehouse:
				item_warehouse.append([item.item_code, item.warehouse])

			webnotes.conn.sql("""update `tabSerial No` set purchase_rate = %s
				where name in (%s)""" % ('%s', ', '.join(['%s']*len(serial_nos))),
				tuple([item.valuation_rate] + serial_nos))

	for d in item_warehouse:
		try:
			update_entries_after({"item_code": d[0], "warehouse": d[1] })
		except:
			continue

	webnotes.conn.auto_commit_on_many_writes = 0<|endoftext|>