HW8 Complete
This commit is contained in:
1
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/__init__.py
vendored
Normal file
1
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/__init__.py
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# Make tests a package
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
3
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/conftest.py
vendored
Normal file
3
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/conftest.py
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
from matplotlib.testing.conftest import (mpl_test_settings,
|
||||
mpl_image_comparison_parameters,
|
||||
pytest_configure, pytest_unconfigure)
|
||||
53
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/test_tinypages.py
vendored
Normal file
53
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/test_tinypages.py
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"""Tests for tinypages build using sphinx extensions."""
|
||||
|
||||
import filecmp
|
||||
from os.path import join as pjoin, dirname, isdir
|
||||
from subprocess import Popen, PIPE
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
pytest.importorskip('sphinx')
|
||||
|
||||
|
||||
def test_tinypages(tmpdir):
|
||||
html_dir = pjoin(str(tmpdir), 'html')
|
||||
doctree_dir = pjoin(str(tmpdir), 'doctrees')
|
||||
# Build the pages with warnings turned into errors
|
||||
cmd = [sys.executable, '-msphinx', '-W', '-b', 'html', '-d', doctree_dir,
|
||||
pjoin(dirname(__file__), 'tinypages'), html_dir]
|
||||
proc = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True)
|
||||
out, err = proc.communicate()
|
||||
assert proc.returncode == 0, \
|
||||
"sphinx build failed with stdout:\n{}\nstderr:\n{}\n".format(out, err)
|
||||
if err:
|
||||
pytest.fail("sphinx build emitted the following warnings:\n{}"
|
||||
.format(err))
|
||||
|
||||
assert isdir(html_dir)
|
||||
|
||||
def plot_file(num):
|
||||
return pjoin(html_dir, 'some_plots-{0}.png'.format(num))
|
||||
|
||||
range_10, range_6, range_4 = [plot_file(i) for i in range(1, 4)]
|
||||
# Plot 5 is range(6) plot
|
||||
assert filecmp.cmp(range_6, plot_file(5))
|
||||
# Plot 7 is range(4) plot
|
||||
assert filecmp.cmp(range_4, plot_file(7))
|
||||
# Plot 11 is range(10) plot
|
||||
assert filecmp.cmp(range_10, plot_file(11))
|
||||
# Plot 12 uses the old range(10) figure and the new range(6) figure
|
||||
assert filecmp.cmp(range_10, plot_file('12_00'))
|
||||
assert filecmp.cmp(range_6, plot_file('12_01'))
|
||||
# Plot 13 shows close-figs in action
|
||||
assert filecmp.cmp(range_4, plot_file(13))
|
||||
# Plot 14 has included source
|
||||
with open(pjoin(html_dir, 'some_plots.html'), 'rb') as fobj:
|
||||
html_contents = fobj.read()
|
||||
assert b'# Only a comment' in html_contents
|
||||
# check plot defined in external file.
|
||||
assert filecmp.cmp(range_4, pjoin(html_dir, 'range4.png'))
|
||||
assert filecmp.cmp(range_6, pjoin(html_dir, 'range6.png'))
|
||||
# check if figure caption made it into html file
|
||||
assert b'This is the caption for plot 15.' in html_contents
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
##############################
|
||||
Static directory for tinypages
|
||||
##############################
|
||||
|
||||
We need this README file to make sure the ``_static`` directory gets created
|
||||
in the installation. The tests check for warnings in builds, and, when the
|
||||
``_static`` directory is absent, this raises a warning.
|
||||
262
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/tinypages/conf.py
vendored
Normal file
262
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/tinypages/conf.py
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
# tinypages documentation build configuration file, created by
|
||||
# sphinx-quickstart on Tue Mar 18 11:58:34 2014.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys
|
||||
from os.path import join as pjoin, abspath
|
||||
import sphinx
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
# 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, abspath(pjoin('..', '..')))
|
||||
|
||||
# -- 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 = ['matplotlib.sphinxext.plot_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 = 'tinypages'
|
||||
copyright = '2014, Matplotlib developers'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.1'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.1'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#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 = []
|
||||
|
||||
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||
#keep_warnings = False
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
if LooseVersion(sphinx.__version__) >= LooseVersion('1.3'):
|
||||
html_theme = 'classic'
|
||||
else:
|
||||
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']
|
||||
|
||||
# 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
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'tinypagesdoc'
|
||||
|
||||
|
||||
# -- 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, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'tinypages.tex', 'tinypages Documentation',
|
||||
'Matplotlib developers', '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', 'tinypages', 'tinypages Documentation',
|
||||
['Matplotlib developers'], 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', 'tinypages', 'tinypages Documentation',
|
||||
'Matplotlib developers', 'tinypages', '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
|
||||
21
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/tinypages/index.rst
vendored
Normal file
21
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/tinypages/index.rst
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
.. tinypages documentation master file, created by
|
||||
sphinx-quickstart on Tue Mar 18 11:58:34 2014.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to tinypages's documentation!
|
||||
=====================================
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
some_plots
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
5
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/tinypages/range4.py
vendored
Normal file
5
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/tinypages/range4.py
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
plt.figure()
|
||||
plt.plot(range(4))
|
||||
plt.show()
|
||||
13
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/tinypages/range6.py
vendored
Normal file
13
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/tinypages/range6.py
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
|
||||
def range4():
|
||||
'''This is never be called if plot_directive works as expected.'''
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def range6():
|
||||
'''This is the function that should be executed.'''
|
||||
plt.figure()
|
||||
plt.plot(range(6))
|
||||
plt.show()
|
||||
129
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/tinypages/some_plots.rst
vendored
Normal file
129
matPlotLib/env/lib/python3.7/site-packages/matplotlib/sphinxext/tests/tinypages/some_plots.rst
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
##########
|
||||
Some plots
|
||||
##########
|
||||
|
||||
Plot 1 does not use context:
|
||||
|
||||
.. plot::
|
||||
|
||||
plt.plot(range(10))
|
||||
a = 10
|
||||
|
||||
Plot 2 doesn't use context either; has length 6:
|
||||
|
||||
.. plot::
|
||||
|
||||
plt.plot(range(6))
|
||||
|
||||
Plot 3 has length 4:
|
||||
|
||||
.. plot::
|
||||
|
||||
plt.plot(range(4))
|
||||
|
||||
Plot 4 shows that a new block with context does not see the variable defined
|
||||
in the no-context block:
|
||||
|
||||
.. plot::
|
||||
:context:
|
||||
|
||||
assert 'a' not in globals()
|
||||
|
||||
Plot 5 defines ``a`` in a context block:
|
||||
|
||||
.. plot::
|
||||
:context:
|
||||
|
||||
plt.plot(range(6))
|
||||
a = 10
|
||||
|
||||
Plot 6 shows that a block with context sees the new variable. It also uses
|
||||
``:nofigs:``:
|
||||
|
||||
.. plot::
|
||||
:context:
|
||||
:nofigs:
|
||||
|
||||
assert a == 10
|
||||
b = 4
|
||||
|
||||
Plot 7 uses a variable previously defined in previous ``nofigs`` context. It
|
||||
also closes any previous figures to create a fresh figure:
|
||||
|
||||
.. plot::
|
||||
:context: close-figs
|
||||
|
||||
assert b == 4
|
||||
plt.plot(range(b))
|
||||
|
||||
Plot 8 shows that a non-context block still doesn't have ``a``:
|
||||
|
||||
.. plot::
|
||||
:nofigs:
|
||||
|
||||
assert 'a' not in globals()
|
||||
|
||||
Plot 9 has a context block, and does have ``a``:
|
||||
|
||||
.. plot::
|
||||
:context:
|
||||
:nofigs:
|
||||
|
||||
assert a == 10
|
||||
|
||||
Plot 10 resets context, and ``a`` has gone again:
|
||||
|
||||
.. plot::
|
||||
:context: reset
|
||||
:nofigs:
|
||||
|
||||
assert 'a' not in globals()
|
||||
c = 10
|
||||
|
||||
Plot 11 continues the context, we have the new value, but not the old:
|
||||
|
||||
.. plot::
|
||||
:context:
|
||||
|
||||
assert c == 10
|
||||
assert 'a' not in globals()
|
||||
plt.plot(range(c))
|
||||
|
||||
Plot 12 opens a new figure. By default the directive will plot both the first
|
||||
and the second figure:
|
||||
|
||||
.. plot::
|
||||
:context:
|
||||
|
||||
plt.figure()
|
||||
plt.plot(range(6))
|
||||
|
||||
Plot 13 shows ``close-figs`` in action. ``close-figs`` closes all figures
|
||||
previous to this plot directive, so we get always plot the figure we create in
|
||||
the directive:
|
||||
|
||||
.. plot::
|
||||
:context: close-figs
|
||||
|
||||
plt.figure()
|
||||
plt.plot(range(4))
|
||||
|
||||
Plot 14 uses ``include-source``:
|
||||
|
||||
.. plot::
|
||||
:include-source:
|
||||
|
||||
# Only a comment
|
||||
|
||||
Plot 15 uses an external file with the plot commands and a caption:
|
||||
|
||||
.. plot:: range4.py
|
||||
|
||||
This is the caption for plot 15.
|
||||
|
||||
|
||||
Plot 16 uses a specific function in a file with plot commands:
|
||||
|
||||
.. plot:: range6.py range6
|
||||
|
||||
|
||||
Reference in New Issue
Block a user