<commit_before># NOTE: parts of this file were taken from scipy's doc/source/conf.py. See
# scikit-bio/licenses/scipy.txt for scipy's license.

import glob
import sys
import os
import types
import re

import sphinx
import sphinx.ext.autosummary as autosummary

class NewAuto(autosummary.Autosummary):
    def get_items(self, names):
        # Camel to snake case from http://stackoverflow.com/a/1176023/579416
        first_cap_re = re.compile('(.)([A-Z][a-z]+)')
        all_cap_re = re.compile('([a-z0-9])([A-Z])')
        def fix_item(display_name, sig, summary, real_name):
            class_names = {
                'TreeNode': 'tree',
                'TabularMSA': 'msa'
            }

            class_name = real_name.split('.')[-2]
            if class_name in class_names:
                nice_name = class_names[class_name]
            else:
                s1 = first_cap_re.sub(r'\1_\2', class_name)
                nice_name = all_cap_re.sub(r'\1_\2', s1).lower()
                if len(nice_name) > 10:
                    nice_name = ''.join([e[0] for e in nice_name.split('_')])
            def fmt(string):
                count = string.count('%s')
                return string % tuple([nice_name] * count)

            specials = {
                '__eq__': fmt('%s1 == %s2'),
                '__ne__': fmt('%s1 != %s2'),
                '__gt__': fmt('%s1 > %s2'),
                '__lt__': fmt('%s1 < %s2'),
                '__ge__': fmt('%s1 >= %s2'),
                '__le__': fmt('%s1 <= %s2'),
                '__getitem__': fmt('%s[x]'),
                '__iter__': fmt('iter(%s)'),
                '__contains__': fmt('x in %s'),
                '__bool__': fmt('bool(%s)'),
                '__str__': fmt('str(%s)'),
                '__reversed__': fmt('reversed(%s)'),
                '__len__': fmt('len(%s)'),
                '__copy__': fmt('copy.copy(%s)'),
                '__deepcopy__': fmt('copy.deepcopy(%s)'),
            }
            if display_name in specials:
                return specials[display_name], '', summary, real_name
            return display_name, sig, summary, real_name

        skip = ['__nonzero__']

        return [fix_item(*e) for e in super(NewAuto, self).get_items(names)
                if e[0] not in skip]

autosummary.Autosummary = NewAuto

import sphinx_bootstrap_theme

# We currently rely on the latest version of numpydoc available on GitHub:
#   git+git://github.com/numpy/numpydoc.git
#
# There isn't a way to specify this in setup.py as a dependency since this
# feature is being removed from pip. We also can't check the version of
# numpydoc installed because there isn't a numpydoc.__version__ defined.
try:
    import numpydoc
except ImportError:
    raise RuntimeError(
        "numpydoc v0.6 or later required. Install it with:\n"
        "  pip install git+git://github.com/numpy/numpydoc.git@<PASSWORD>"
        "d4fe356f4607799524bcc577ed")

@property
def _extras(self):
    # This will be accessed in a for-loop, so memoize to prevent quadratic
    # behavior.
    if not hasattr(self, '__memoized_extras'):
        # We want every dunder that has a function type (not class slot),
        # meaning we created the dunder, not Python.
        # We don't ever care about __init__ and the user will see plenty of
        # __repr__ calls, so why waste space.
        self.__memoized_extras = [
            a for a, v in inspect.getmembers(self._cls)
            if type(v) == types.FunctionType and a.startswith('__')
            and a not in ['__init__', '__repr__']
        ]
    return self.__memoized_extras

# The extra_public_methods depends on what class we are looking at.
numpydoc.docscrape.ClassDoc.extra_public_methods = _extras


import skbio
from skbio.util._decorator import classproperty

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

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

# If your documentation needs a minimal Sphinx version, state it here.
# Using `sphinx_version` doesn't work, likely because Sphinx is expecting a
# version string of the form X.Y, not X.Y.Z.
needs_sphinx = '1.2'

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

# Determine if the matplotlib has a recent enough version of the
# plot_directive.
try:
    from matplotlib.sphinxext import plot_directive
except ImportError:
    use_matplotlib_plot_directive = False
else:
    try:
        use_matplotlib_plot_directive = (plot_directive.__version__ >= 2)
    except AttributeError:
        use_matplotlib_plot_directive = False

if use_matplotlib_plot_directive:
    extensions.append('matplotlib.sphinxext.plot_directive')
else:
    raise RuntimeError("You need a recent enough version of matplotlib")

# 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.<commit_msg>Force use of Agg backend (no X) for matplotlib<commit_after># NOTE: parts of this file were taken from scipy's doc/source/conf.py. See
# scikit-bio/licenses/scipy.txt for scipy's license.

import glob
import sys
import os
import types
import re

# Force matplotlib to not use any Xwindows backend.
import matplotlib
matplotlib.use('Agg')

import sphinx
import sphinx.ext.autosummary as autosummary

class NewAuto(autosummary.Autosummary):
    def get_items(self, names):
        # Camel to snake case from http://stackoverflow.com/a/1176023/579416
        first_cap_re = re.compile('(.)([A-Z][a-z]+)')
        all_cap_re = re.compile('([a-z0-9])([A-Z])')
        def fix_item(display_name, sig, summary, real_name):
            class_names = {
                'TreeNode': 'tree',
                'TabularMSA': 'msa'
            }

            class_name = real_name.split('.')[-2]
            if class_name in class_names:
                nice_name = class_names[class_name]
            else:
                s1 = first_cap_re.sub(r'\1_\2', class_name)
                nice_name = all_cap_re.sub(r'\1_\2', s1).lower()
                if len(nice_name) > 10:
                    nice_name = ''.join([e[0] for e in nice_name.split('_')])
            def fmt(string):
                count = string.count('%s')
                return string % tuple([nice_name] * count)

            specials = {
                '__eq__': fmt('%s1 == %s2'),
                '__ne__': fmt('%s1 != %s2'),
                '__gt__': fmt('%s1 > %s2'),
                '__lt__': fmt('%s1 < %s2'),
                '__ge__': fmt('%s1 >= %s2'),
                '__le__': fmt('%s1 <= %s2'),
                '__getitem__': fmt('%s[x]'),
                '__iter__': fmt('iter(%s)'),
                '__contains__': fmt('x in %s'),
                '__bool__': fmt('bool(%s)'),
                '__str__': fmt('str(%s)'),
                '__reversed__': fmt('reversed(%s)'),
                '__len__': fmt('len(%s)'),
                '__copy__': fmt('copy.copy(%s)'),
                '__deepcopy__': fmt('copy.deepcopy(%s)'),
            }
            if display_name in specials:
                return specials[display_name], '', summary, real_name
            return display_name, sig, summary, real_name

        skip = ['__nonzero__']

        return [fix_item(*e) for e in super(NewAuto, self).get_items(names)
                if e[0] not in skip]

autosummary.Autosummary = NewAuto

import sphinx_bootstrap_theme

# We currently rely on the latest version of numpydoc available on GitHub:
#   git+git://github.com/numpy/numpydoc.git
#
# There isn't a way to specify this in setup.py as a dependency since this
# feature is being removed from pip. We also can't check the version of
# numpydoc installed because there isn't a numpydoc.__version__ defined.
try:
    import numpydoc
except ImportError:
    raise RuntimeError(
        "numpydoc v0.6 or later required. Install it with:\n"
        "  pip install git+git://github.com/numpy/numpydoc.git@1a848331c2cf53"
        "d4fe356f4607799524bcc577ed")

@property
def _extras(self):
    # This will be accessed in a for-loop, so memoize to prevent quadratic
    # behavior.
    if not hasattr(self, '__memoized_extras'):
        # We want every dunder that has a function type (not class slot),
        # meaning we created the dunder, not Python.
        # We don't ever care about __init__ and the user will see plenty of
        # __repr__ calls, so why waste space.
        self.__memoized_extras = [
            a for a, v in inspect.getmembers(self._cls)
            if type(v) == types.FunctionType and a.startswith('__')
            and a not in ['__init__', '__repr__']
        ]
    return self.__memoized_extras

# The extra_public_methods depends on what class we are looking at.
numpydoc.docscrape.ClassDoc.extra_public_methods = _extras


import skbio
from skbio.util._decorator import classproperty

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

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

# If your documentation needs a minimal Sphinx version, state it here.
# Using `sphinx_version` doesn't work, likely because Sphinx is expecting a
# version string of the form X.Y, not X.Y.Z.
needs_sphinx = '1.2'

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

# Determine if the matplotlib has a recent enough version of the
# plot_directive.

try:
    from matplotlib.sphinxext import plot_directive
except ImportError:
    use_matplotlib_plot_directive = False
else:
    try:
        use_matplotlib_plot_directive = (plot_directive.__version__ >= 2)
    except AttributeError:
        use_matplotlib_plot_directive = False

if use_matplotlib_plot_directive:
    extensions.append('matplotlib.sphinxext.plot_directive')
else:
    raise RuntimeError("You need a recent enough version of matplotlib")

# 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.
{'fraction_non_alphanumeric': 0.12031732040546496, 'fraction_numerical': 0.011811370647862494, 'mean_word_length': 2.5578551269990593, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5729291', 'n_tokens_mistral': 3724, 'n_tokens_neox': 3541, 'n_words': 1026}