# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import datetime as dt
import sys
from pathlib import Path

import data_morph

sys.path.insert(0, str(Path('.').absolute()))
from post_build import determine_versions  # noqa: E402

project = 'Data Morph'
current_year = dt.date.today().year
copyright = f'2023{f"-{current_year}" if current_year != 2023 else ""}, Stefanie Molin'
author = 'Stefanie Molin'
release = data_morph.__version__
version_match, _ = determine_versions()

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

nitpick_ignore_regex = [('py:class', r'(optional|default.*)')]

# default language for code-highlighting (requires specific declarations to highlight)
highlight_language = 'output'

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosectionlabel',
    'sphinx.ext.autosummary',
    'sphinx.ext.githubpages',
    'sphinx.ext.intersphinx',
    'sphinx.ext.napoleon',
    'sphinx.ext.viewcode',
    'sphinx_copybutton',
    'sphinxarg.ext',
    'matplotlib.sphinxext.plot_directive',
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- autosectionlabel ---------------------------------------------------------

# Make sure the target is unique
autosectionlabel_prefix_document = True


# -- intersphinx -------------------------------------------------------------

intersphinx_mapping = {
    'matplotlib': ('https://matplotlib.org/stable/', None),
    'numpy': ('https://numpy.org/doc/stable/', None),
    'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
    'Pillow': ('https://pillow.readthedocs.io/en/stable/', None),
    'pytest': ('https://pytest.org/en/stable/', None),
    'python': ('https://docs.python.org/3/', None),
    'scipy': ('https://docs.scipy.org/doc/scipy/', None),
}


# -- autosummary -------------------------------------------------------------

autosummary_generate = True
autodoc_default_options = {
    'members': True,
    'undoc-members': False,
    'private-members': False,
    'special-members': False,
    'show-inheritance': True,
    'inherited-members': True,
}


# -- Internationalization ----------------------------------------------------

# specifying the natural language populates some key tags
language = 'en'


# -- copybutton config -------------------------------------------------------
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
copybutton_prompt_is_regexp = True


# -- matplotlib plot directive config ----------------------------------------
plot_html_show_source_link = False
plot_html_show_formats = False


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'pydata_sphinx_theme'
html_static_path = ['_static']
html_logo = '_static/logo.png'
html_favicon = '_static/favicon.ico'

html_theme_options = {
    'github_url': 'https://github.com/stefmolin/data-morph',
    'twitter_url': 'https://twitter.com/StefanieMolin',
    'show_toc_level': 1,
    'navbar_align': 'left',
    'navbar_end': ['version-switcher', 'theme-switcher', 'navbar-icon-links'],
    'switcher': {
        'json_url': 'https://raw.githubusercontent.com/stefmolin/data-morph/main/docs/_static/switcher.json',
        'version_match': version_match,
    },
}

html_context = {
    'github_user': 'stefmolin',
    'github_repo': 'data-morph',
    'github_version': 'main',
    'doc_path': 'docs',
}


# -- sphinx adjustments --------------------------------------------------
def skip(app, what, name, obj, would_skip, options):
    if name.startswith('_'):
        return True
    return would_skip


def docstring_strip(app, what, name, obj, options, lines):
    if what == 'module' and name == 'data_morph' and lines[0] == 'Data Morph.':
        # Tweak the package docstring for the docs
        _ = lines.pop(0)
        _ = lines.pop(0)
        extended_summary = lines[0].split()
        extended_summary[0] = 'Data Morph allows you to morph'
        lines[0] = ' '.join(extended_summary)


def setup(app):
    app.connect('autodoc-skip-member', skip)
    app.connect('autodoc-process-docstring', docstring_strip)

b481e59376c28750eb0a6484f32c924cae87660e
<mask token>


def docstring_strip(app, what, name, obj, options, lines):
    if what == 'module' and name == 'data_morph' and lines[0] == 'Data Morph.':
        _ = lines.pop(0)
        _ = lines.pop(0)
        extended_summary = lines[0].split()
        extended_summary[0] = 'Data Morph allows you to morph'
        lines[0] = ' '.join(extended_summary)


<mask token>

<mask token>


def docstring_strip(app, what, name, obj, options, lines):
    if what == 'module' and name == 'data_morph' and lines[0] == 'Data Morph.':
        _ = lines.pop(0)
        _ = lines.pop(0)
        extended_summary = lines[0].split()
        extended_summary[0] = 'Data Morph allows you to morph'
        lines[0] = ' '.join(extended_summary)


def setup(app):
    app.connect('autodoc-skip-member', skip)
    app.connect('autodoc-process-docstring', docstring_strip)

<mask token>
sys.path.insert(0, str(Path('.').absolute()))
<mask token>


def skip(app, what, name, obj, would_skip, options):
    if name.startswith('_'):
        return True
    return would_skip


def docstring_strip(app, what, name, obj, options, lines):
    if what == 'module' and name == 'data_morph' and lines[0] == 'Data Morph.':
        _ = lines.pop(0)
        _ = lines.pop(0)
        extended_summary = lines[0].split()
        extended_summary[0] = 'Data Morph allows you to morph'
        lines[0] = ' '.join(extended_summary)


def setup(app):
    app.connect('autodoc-skip-member', skip)
    app.connect('autodoc-process-docstring', docstring_strip)

<mask token>
sys.path.insert(0, str(Path('.').absolute()))
<mask token>
project = 'Data Morph'
current_year = dt.date.today().year
copyright = (
    f"2023{f'-{current_year}' if current_year != 2023 else ''}, Stefanie Molin"
    )
author = 'Stefanie Molin'
release = data_morph.__version__
version_match, _ = determine_versions()
nitpick_ignore_regex = [('py:class', '(optional|default.*)')]
highlight_language = 'output'
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosectionlabel',
    'sphinx.ext.autosummary', 'sphinx.ext.githubpages',
    'sphinx.ext.intersphinx', 'sphinx.ext.napoleon', 'sphinx.ext.viewcode',
    'sphinx_copybutton', 'sphinxarg.ext', 'matplotlib.sphinxext.plot_directive'
    ]
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
autosectionlabel_prefix_document = True
intersphinx_mapping = {'matplotlib': ('https://matplotlib.org/stable/',
    None), 'numpy': ('https://numpy.org/doc/stable/', None), 'pandas': (
    'https://pandas.pydata.org/pandas-docs/stable/', None), 'Pillow': (
    'https://pillow.readthedocs.io/en/stable/', None), 'pytest': (
    'https://pytest.org/en/stable/', None), 'python': (
    'https://docs.python.org/3/', None), 'scipy': (
    'https://docs.scipy.org/doc/scipy/', None)}
autosummary_generate = True
autodoc_default_options = {'members': True, 'undoc-members': False,
    'private-members': False, 'special-members': False, 'show-inheritance':
    True, 'inherited-members': True}
language = 'en'
copybutton_prompt_text = (
    '>>> |\\.\\.\\. |\\$ |In \\[\\d*\\]: | {2,5}\\.\\.\\.: | {5,8}: ')
copybutton_prompt_is_regexp = True
plot_html_show_source_link = False
plot_html_show_formats = False
html_theme = 'pydata_sphinx_theme'
html_static_path = ['_static']
html_logo = '_static/logo.png'
html_favicon = '_static/favicon.ico'
html_theme_options = {'github_url':
    'https://github.com/stefmolin/data-morph', 'twitter_url':
    'https://twitter.com/StefanieMolin', 'show_toc_level': 1,
    'navbar_align': 'left', 'navbar_end': ['version-switcher',
    'theme-switcher', 'navbar-icon-links'], 'switcher': {'json_url':
    'https://raw.githubusercontent.com/stefmolin/data-morph/main/docs/_static/switcher.json'
    , 'version_match': version_match}}
html_context = {'github_user': 'stefmolin', 'github_repo': 'data-morph',
    'github_version': 'main', 'doc_path': 'docs'}


def skip(app, what, name, obj, would_skip, options):
    if name.startswith('_'):
        return True
    return would_skip


def docstring_strip(app, what, name, obj, options, lines):
    if what == 'module' and name == 'data_morph' and lines[0] == 'Data Morph.':
        _ = lines.pop(0)
        _ = lines.pop(0)
        extended_summary = lines[0].split()
        extended_summary[0] = 'Data Morph allows you to morph'
        lines[0] = ' '.join(extended_summary)


def setup(app):
    app.connect('autodoc-skip-member', skip)
    app.connect('autodoc-process-docstring', docstring_strip)

# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import datetime as dt
import sys
from pathlib import Path

import data_morph

sys.path.insert(0, str(Path('.').absolute()))
from post_build import determine_versions  # noqa: E402

project = 'Data Morph'
current_year = dt.date.today().year
copyright = f'2023{f"-{current_year}" if current_year != 2023 else ""}, Stefanie Molin'
author = 'Stefanie Molin'
release = data_morph.__version__
version_match, _ = determine_versions()

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

nitpick_ignore_regex = [('py:class', r'(optional|default.*)')]

# default language for code-highlighting (requires specific declarations to highlight)
highlight_language = 'output'

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosectionlabel',
    'sphinx.ext.autosummary',
    'sphinx.ext.githubpages',
    'sphinx.ext.intersphinx',
    'sphinx.ext.napoleon',
    'sphinx.ext.viewcode',
    'sphinx_copybutton',
    'sphinxarg.ext',
    'matplotlib.sphinxext.plot_directive',
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- autosectionlabel ---------------------------------------------------------

# Make sure the target is unique
autosectionlabel_prefix_document = True


# -- intersphinx -------------------------------------------------------------

intersphinx_mapping = {
    'matplotlib': ('https://matplotlib.org/stable/', None),
    'numpy': ('https://numpy.org/doc/stable/', None),
    'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
    'Pillow': ('https://pillow.readthedocs.io/en/stable/', None),
    'pytest': ('https://pytest.org/en/stable/', None),
    'python': ('https://docs.python.org/3/', None),
    'scipy': ('https://docs.scipy.org/doc/scipy/', None),
}


# -- autosummary -------------------------------------------------------------

autosummary_generate = True
autodoc_default_options = {
    'members': True,
    'undoc-members': False,
    'private-members': False,
    'special-members': False,
    'show-inheritance': True,
    'inherited-members': True,
}


# -- Internationalization ----------------------------------------------------

# specifying the natural language populates some key tags
language = 'en'


# -- copybutton config -------------------------------------------------------
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
copybutton_prompt_is_regexp = True


# -- matplotlib plot directive config ----------------------------------------
plot_html_show_source_link = False
plot_html_show_formats = False


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'pydata_sphinx_theme'
html_static_path = ['_static']
html_logo = '_static/logo.png'
html_favicon = '_static/favicon.ico'

html_theme_options = {
    'github_url': 'https://github.com/stefmolin/data-morph',
    'twitter_url': 'https://twitter.com/StefanieMolin',
    'show_toc_level': 1,
    'navbar_align': 'left',
    'navbar_end': ['version-switcher', 'theme-switcher', 'navbar-icon-links'],
    'switcher': {
        'json_url': 'https://raw.githubusercontent.com/stefmolin/data-morph/main/docs/_static/switcher.json',
        'version_match': version_match,
    },
}

html_context = {
    'github_user': 'stefmolin',
    'github_repo': 'data-morph',
    'github_version': 'main',
    'doc_path': 'docs',
}


# -- sphinx adjustments --------------------------------------------------
def skip(app, what, name, obj, would_skip, options):
    if name.startswith('_'):
        return True
    return would_skip


def docstring_strip(app, what, name, obj, options, lines):
    if what == 'module' and name == 'data_morph' and lines[0] == 'Data Morph.':
        # Tweak the package docstring for the docs
        _ = lines.pop(0)
        _ = lines.pop(0)
        extended_summary = lines[0].split()
        extended_summary[0] = 'Data Morph allows you to morph'
        lines[0] = ' '.join(extended_summary)


def setup(app):
    app.connect('autodoc-skip-member', skip)
    app.connect('autodoc-process-docstring', docstring_strip)
