Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Small cleanups. #11522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/api/next_api_changes/2018-02-26-AL-removals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ The following deprecated API elements have been removed:
- passing non-numbers to ``EngFormatter.format_eng``,
- passing ``frac`` to ``PolarAxes.set_theta_grids``,
- any mention of idle events,

The following API elements have been removed:

- ``matplotlib.sphinxext.sphinx_version``,
6 changes: 0 additions & 6 deletions lib/matplotlib/sphinxext/plot_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,6 @@
align = Image.align
import sphinx

sphinx_version = sphinx.__version__.split(".")
# The split is necessary for sphinx beta versions where the string is
# '6b1'
sphinx_version = tuple([int(re.split('[^0-9]', x)[0])
for x in sphinx_version[:2]])

import jinja2 # Sphinx dependency.

import matplotlib
Expand Down
9 changes: 4 additions & 5 deletions lib/matplotlib/testing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import functools
import locale
import warnings

import matplotlib as mpl
Expand All @@ -24,8 +25,6 @@ def set_reproducibility_for_testing():
def setup():
# The baseline images are created in this locale, so we should use
# it during all of the tests.
import locale
from matplotlib.backends import backend_agg, backend_pdf, backend_svg

try:
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
Expand All @@ -35,15 +34,15 @@ def setup():
except locale.Error:
warnings.warn(
"Could not set locale to English/United States. "
"Some date-related tests may fail")
"Some date-related tests may fail.")

mpl.use('Agg', warn=False) # use Agg backend for these tests

# These settings *must* be hardcoded for running the comparison tests and
# are not necessarily the default values as specified in rcsetup.py
with warnings.catch_warnings():
warnings.simplefilter("ignore", MatplotlibDeprecationWarning)
mpl.rcdefaults() # Start with all defaults

# These settings *must* be hardcoded for running the comparison tests and
# are not necessarily the default values as specified in rcsetup.py.
set_font_settings_for_testing()
set_reproducibility_for_testing()
25 changes: 10 additions & 15 deletions lib/matplotlib/tests/test_rcparams.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from collections import OrderedDict
import copy
from itertools import chain
import locale
import os
from unittest import mock
import warnings
Expand All @@ -9,7 +12,6 @@
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from itertools import chain
import numpy as np
from matplotlib.rcsetup import (validate_bool_maybe_none,
validate_stringlist,
Expand All @@ -25,15 +27,13 @@
_validate_linestyle)


mpl.rc('text', usetex=False)
mpl.rc('lines', linewidth=22)

fname = os.path.join(os.path.dirname(__file__), 'test_rcparams.rc')


def test_rcparams():
mpl.rc('text', usetex=False)
mpl.rc('lines', linewidth=22)

usetex = mpl.rcParams['text.usetex']
linewidth = mpl.rcParams['lines.linewidth']
fname = os.path.join(os.path.dirname(__file__), 'test_rcparams.rc')

# test context given dictionary
with mpl.rc_context(rc={'text.usetex': not usetex}):
Expand All @@ -51,11 +51,8 @@ def test_rcparams():
assert mpl.rcParams['lines.linewidth'] == linewidth

# test rc_file
try:
mpl.rc_file(fname)
assert mpl.rcParams['lines.linewidth'] == 33
finally:
mpl.rcParams['lines.linewidth'] = linewidth
mpl.rc_file(fname)
assert mpl.rcParams['lines.linewidth'] == 33


def test_RcParams_class():
Expand Down Expand Up @@ -131,8 +128,7 @@ def test_Bug_2543():
mpl.rcParams[key] = _copy[key]
mpl.rcParams['text.dvipnghack'] = None
with mpl.rc_context():
from copy import deepcopy
_deep_copy = deepcopy(mpl.rcParams)
_deep_copy = copy.deepcopy(mpl.rcParams)
# real test is that this does not raise
assert validate_bool_maybe_none(None) is None
assert validate_bool_maybe_none("none") is None
Expand Down Expand Up @@ -194,7 +190,6 @@ def test_mec_rcparams():
def test_Issue_1713():
utf32_be = os.path.join(os.path.dirname(__file__),
'test_utf32_be_rcparams.rc')
import locale
with mock.patch('locale.getpreferredencoding', return_value='UTF-32-BE'):
rc = mpl.rc_params_from_file(utf32_be, True, False)
assert rc.get('timezone') == 'UTC'
Expand Down
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,8 @@ def run(self):
for mod in ext_modules:
mod.finalize()

extra_args = {}

# Finally, pass this all along to distutils to do the heavy lifting.
distrib = setup(
setup(
name="matplotlib",
version=__version__,
description="Python plotting package",
Expand Down Expand Up @@ -278,5 +276,4 @@ def run(self):
# check for zip safety.
zip_safe=False,
cmdclass=cmdclass,
**extra_args
)