Skip to content

TST: Don't review/merge Test travis #11597

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

Closed
wants to merge 10 commits into from
Closed
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
112 changes: 112 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
[flake8]
ignore =
# Normal default
E121,E123,E126,E226,E24,E704,W503,W504,
# Additional ignores:
E111, E114, E115, E116, E122, E124, E125, E127, E128, E129, E131,
E265, E266,
E305, E306,
E722, E741,
F401, F403, F811, F841,
# Some new flake8 ignores:
N801, N802, N803, N806, N812,

exclude =
.git
build
# External files.
versioneer.py
tools/gh_api.py
tools/github_stats.py

per-file-ignores =
setup.py: E402
setupext.py: E302, E501

tools/compare_backend_driver_results.py: E501
tools/subset.py: E221, E231, E251, E261, E302, E501, E701

matplotlib/_cm.py: E202, E203
matplotlib/_mathtext_data.py: E203, E261
matplotlib/backend_bases.py: E225
matplotlib/backends/_backend_tk.py: E203, E222, E225, E231, E271, E301, E303, E401, E501, E701
matplotlib/backends/backend_agg.py: E261, E302, E303, E701
matplotlib/backends/backend_cairo.py: E203, E221, E261, E303, E402, E711
matplotlib/backends/backend_gtk3.py: E203, E221, E222, E225, E251, E261, E501
matplotlib/backends/backend_macosx.py: E231, E261
matplotlib/backends/backend_pgf.py: E303, E731
matplotlib/backends/backend_ps.py: E203, E225, E228, E231, E261, E262, E302, E303, E501, E701
matplotlib/backends/backend_svg.py: E203, E225, E228, E231, E261, E302, E501
matplotlib/backends/qt_editor/formlayout.py: E301, E501
matplotlib/backends/tkagg.py: E231, E302, E701
matplotlib/backends/windowing.py: E301, E302
matplotlib/font_manager.py: E203, E221, E225, E251, E261, E262, E302, E501
matplotlib/fontconfig_pattern.py: E201, E203, E221, E222, E225, E302
matplotlib/legend_handler.py: E201, E501
matplotlib/mathtext.py: E201, E202, E203, E211, E221, E222, E225, E231, E251, E261, E301, E302, E303, E402, E501
matplotlib/patheffects.py: E231
matplotlib/projections/geo.py: E203, E221, E231, E261, E502
matplotlib/pylab.py: E501
matplotlib/pyplot.py: E201, E202, E221, E222, E225, E231, E251, E261, E302, E501, E701
matplotlib/rcsetup.py: E203, E225, E261, E302, E501
matplotlib/sphinxext/mathmpl.py: E302
matplotlib/sphinxext/only_directives.py: E302
matplotlib/sphinxext/plot_directive.py: E261, E302, E402
matplotlib/tests/test_image.py: E225, E231, E251, E302, E501
matplotlib/tests/test_lines.py: E231, E261
matplotlib/tests/test_mathtext.py: E261, E501
matplotlib/transforms.py: E201, E202, E203, E501
matplotlib/tri/triinterpolate.py: E201, E221
matplotlib/type1font.py: E731

mpl_toolkits/__init__.py: E261
mpl_toolkits/axes_grid/axes_divider.py: E501
mpl_toolkits/axes_grid/axes_rgb.py: E302, E501
mpl_toolkits/axes_grid1/axes_divider.py: E402, E501
mpl_toolkits/axes_grid1/axes_grid.py: E225
mpl_toolkits/axes_grid1/axes_rgb.py: E231
mpl_toolkits/axes_grid1/axes_size.py: E261, E501
mpl_toolkits/axes_grid1/colorbar.py: E225, E231, E261, E262, E302, E303, E501, E701
mpl_toolkits/axes_grid1/inset_locator.py: E501
mpl_toolkits/axes_grid1/mpl_axes.py: E303, E501
mpl_toolkits/axes_grid1/parasite_axes.py: E225, E231, E302, E303, E501
mpl_toolkits/axisartist/angle_helper.py: E201, E203, E221, E222, E225, E231, E251, E261, E262, E302, E303, E501
mpl_toolkits/axisartist/axis_artist.py: E201, E202, E221, E225, E228, E231, E251, E261, E262, E302, E303, E402, E501, E701, E711
mpl_toolkits/axisartist/axisline_style.py: E231, E261, E262, E302, E303
mpl_toolkits/axisartist/axislines.py: E225, E231, E261, E303, E501
mpl_toolkits/axisartist/clip_path.py: E225, E302, E303, E501
mpl_toolkits/axisartist/floating_axes.py: E225, E231, E261, E262, E302, E303, E402, E501
mpl_toolkits/axisartist/grid_finder.py: E231, E261, E302, E303, E402
mpl_toolkits/axisartist/grid_helper_curvelinear.py: E225, E231, E261, E262, E271, E302, E303, E501
mpl_toolkits/mplot3d/art3d.py: E203, E222, E225, E231
mpl_toolkits/mplot3d/axes3d.py: E203, E231, E303, E402, E501, E701
mpl_toolkits/mplot3d/axis3d.py: E231, E302
mpl_toolkits/mplot3d/proj3d.py: E231, E302, E303
mpl_toolkits/tests/test_axes_grid1.py: E201, E202
mpl_toolkits/tests/test_mplot3d.py: E231, E302

doc/**: E302, E501
doc/conf.py: E402
tutorials/**: E402, E501

examples/**: E501, E402
examples/images_contours_and_fields/tricontour_demo.py: E201
examples/images_contours_and_fields/tripcolor_demo.py: E201
examples/images_contours_and_fields/triplot_demo.py: E201
examples/misc/table_demo.py: E201
examples/pyplots/annotate_transform.py: E228, E251
examples/pyplots/annotation_polar.py: E231
examples/pyplots/auto_subplots_adjust.py: E231, E261, E302
examples/pyplots/boxplot_demo_pyplot.py: E231
examples/pyplots/compound_path_demo.py: E231
examples/pyplots/fig_axes_customize_simple.py: E261
examples/pyplots/pyplot_formatstr.py: E231
examples/pyplots/pyplot_mathtext.py: E231
examples/pyplots/pyplot_simple.py: E231
examples/pyplots/pyplot_two_subplots.py: E302
examples/pyplots/text_commands.py: E231
examples/pyplots/text_layout.py: E231
examples/pyplots/whats_new_98_4_fancy.py: E225, E261, E302
examples/pyplots/whats_new_98_4_fill_between.py: E225
examples/pyplots/whats_new_98_4_legend.py: E228
examples/pyplots/whats_new_99_spines.py: E231, E261
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ env:
- OPENBLAS_NUM_THREADS=1
- PYTHONFAULTHANDLER=1
- PYTEST_ADDOPTS="-rawR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n $NPROC"
- RUN_PEP8=
- RUN_FLAKE8=

matrix:
include:
Expand All @@ -78,8 +78,8 @@ matrix:
- python: 3.6
env:
- DELETE_FONT_CACHE=1
- PYTEST_ADDOPTS="$PYTEST_ADDOPTS --pep8"
- EXTRAREQS='-r requirements/testing/travis36.txt'
- RUN_FLAKE8=1
- python: "nightly"
env: PRE=--pre
- os: osx
Expand Down Expand Up @@ -158,6 +158,10 @@ before_script: |
fi

script: |
set -e
if [[ $RUN_FLAKE8 == 1 ]]; then
flake8 --statistics && echo "Flake8 passed without any issues!"
fi
echo "Calling pytest with the following arguments: $PYTEST_ADDOPTS"
python -mpytest

Expand Down
2 changes: 0 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def _check_deps():
}



# Sphinx gallery configuration
sphinx_gallery_conf = {
'examples_dirs': ['../examples', '../tutorials'],
Expand Down Expand Up @@ -149,7 +148,6 @@ def _check_deps():
'team; 2012 - 2018 The Matplotlib development team')



# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
#
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinxext/gallery_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __call__(self, item):
class MplExplicitSubOrder(object):
""" for use within the 'within_subsection_order' key """
def __init__(self, src_dir):
self.src_dir = src_dir #src_dir is unused here
self.src_dir = src_dir # src_dir is unused here
self.ordered_list = explicit_subsection_order

def __call__(self, item):
Expand Down
2 changes: 1 addition & 1 deletion doc/users/generate_credits.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def check_duplicates():
contributors = [line.split('\t', 1)[1].strip() for line in lines if line]
emails = [re.match('.*<(.*)>', line).group(1) for line in contributors]
email_counter = Counter(emails)

if email_counter.most_common(1)[0][1] > 1:
print('DUPLICATE CHECK: The following email addesses are used with more '
'than one name.\nConsider adding them to .mailmap.\n')
Expand Down
2 changes: 1 addition & 1 deletion examples/lines_bars_and_markers/marker_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def nice_repr(text):

def math_repr(text):
tx = repr(text).lstrip('u').strip("'").strip("$")
return "'\${}\$'".format(tx)
return r"'\${}\$'".format(tx)


def split_list(a_list):
Expand Down
2 changes: 1 addition & 1 deletion examples/recipes/fill_between_alpha.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
ax.plot(t, mu2, lw=2, label='mean population 2', color='yellow')
ax.fill_between(t, mu1+sigma1, mu1-sigma1, facecolor='blue', alpha=0.5)
ax.fill_between(t, mu2+sigma2, mu2-sigma2, facecolor='yellow', alpha=0.5)
ax.set_title('random walkers empirical $\mu$ and $\pm \sigma$ interval')
ax.set_title(r'random walkers empirical $\mu$ and $\pm \sigma$ interval')
ax.legend(loc='upper left')
ax.set_xlabel('num steps')
ax.set_ylabel('position')
Expand Down
5 changes: 4 additions & 1 deletion examples/recipes/placing_text_boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
mu = x.mean()
median = np.median(x)
sigma = x.std()
textstr = '$\mu=%.2f$\n$\mathrm{median}=%.2f$\n$\sigma=%.2f$' % (mu, median, sigma)
textstr = '\n'.join((
r'$\mu=%.2f$' % (mu, ),
r'$\mathrm{median}=%.2f$' % (median, ),
r'$\sigma=%.2f$' % (sigma, )))

ax.hist(x, 50)
# these are matplotlib.patch.Patch properties
Expand Down
2 changes: 1 addition & 1 deletion examples/scales/power_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
axes[0, 0].hist2d(data[:, 0], data[:, 1], bins=100)

for ax, gamma in zip(axes.flat[1:], gammas):
ax.set_title('Power law $(\gamma=%1.1f)$' % gamma)
ax.set_title(r'Power law $(\gamma=%1.1f)$' % gamma)
ax.hist2d(data[:, 0], data[:, 1],
bins=100, norm=mcolors.PowerNorm(gamma))

Expand Down
2 changes: 1 addition & 1 deletion examples/text_labels_and_annotations/arrow_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def draw_arrow(pair, alpha=alpha, ec=ec, labelcolor=labelcolor):
coords = np.dot(orig_position, M) + [[x_pos, y_pos]]
x, y = np.ravel(coords)
orig_label = rate_labels[pair]
label = '$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:])
label = r'$%s_{_{\mathrm{%s}}}$' % (orig_label[0], orig_label[1:])

plt.text(x, y, label, size=label_text_size, ha='center', va='center',
color=labelcolor or fc)
Expand Down
2 changes: 1 addition & 1 deletion examples/ticks_and_spines/spines_bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# set ticks and tick labels
ax.set_xlim((0, 2*np.pi))
ax.set_xticks([0, np.pi, 2*np.pi])
ax.set_xticklabels(['0', '$\pi$', '2$\pi$'])
ax.set_xticklabels(['0', r'$\pi$', r'2$\pi$'])
ax.set_ylim((-1.5, 1.5))
ax.set_yticks([-1, 0, 1])

Expand Down
10 changes: 5 additions & 5 deletions examples/units/basic_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ def __get__(self, obj, objtype=None):


class TaggedValueMeta(type):
def __init__(cls, name, bases, dict):
for fn_name in cls._proxies:
def __init__(self, name, bases, dict):
for fn_name in self._proxies:
try:
dummy = getattr(cls, fn_name)
dummy = getattr(self, fn_name)
except AttributeError:
setattr(cls, fn_name,
ProxyDelegate(fn_name, cls._proxies[fn_name]))
setattr(self, fn_name,
ProxyDelegate(fn_name, self._proxies[fn_name]))


class PassThroughProxy(object):
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ def __getitem__(self, key):
elif key in _deprecated_ignore_map:
version, alt_key = _deprecated_ignore_map[key]
cbook.warn_deprecated(
version, key, obj_type, alternative=alt_key)
version, key, obj_type="rcparam", alternative=alt_key)
return dict.__getitem__(self, alt_key) if alt_key else None

elif key == 'examples.directory':
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/gridspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import numpy as np

import matplotlib as mpl
from matplotlib import _pylab_helpers, tight_layout, rcParams
from matplotlib import _pylab_helpers, cbook, tight_layout, rcParams
from matplotlib.transforms import Bbox
import matplotlib._layoutbox as layoutbox

Expand Down
20 changes: 10 additions & 10 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,7 @@ class _Style(object):
where actual styles are declared as subclass of it, and it
provides some helper functions.
"""
def __new__(self, stylename, **kw):
def __new__(cls, stylename, **kw):
"""
return the instance of the subclass with the given style name.
"""
Expand All @@ -1869,7 +1869,7 @@ def __new__(self, stylename, **kw):
_list = stylename.replace(" ", "").split(",")
_name = _list[0].lower()
try:
_cls = self._style_list[_name]
_cls = cls._style_list[_name]
except KeyError:
raise ValueError("Unknown style : %s" % stylename)

Expand All @@ -1883,29 +1883,29 @@ def __new__(self, stylename, **kw):
return _cls(**_args)

@classmethod
def get_styles(klass):
def get_styles(cls):
"""
A class method which returns a dictionary of available styles.
"""
return klass._style_list
return cls._style_list

@classmethod
def pprint_styles(klass):
def pprint_styles(cls):
"""
A class method which returns a string of the available styles.
"""
return _pprint_styles(klass._style_list)
return _pprint_styles(cls._style_list)

@classmethod
def register(klass, name, style):
def register(cls, name, style):
"""
Register a new style.
"""

if not issubclass(style, klass._Base):
if not issubclass(style, cls._Base):
raise ValueError("%s must be a subclass of %s" % (style,
klass._Base))
klass._style_list[name] = style
cls._Base))
cls._style_list[name] = style


def _register_style(style_list, cls=None, *, name=None):
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/sphinxext/plot_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def remove_coding(text):
Remove the coding comment, which six.exec\_ doesn't like.
"""
cbook.warn_deprecated('3.0', name='remove_coding', removal='3.1')
sub_re = re.compile("^#\s*-\*-\s*coding:\s*.*-\*-$", flags=re.MULTILINE)
sub_re = re.compile(r"^#\s*-\*-\s*coding:\s*.*-\*-$", flags=re.MULTILINE)
return sub_re.sub("", text)

#------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def __init__(self, fps=None, codec=None, bitrate=None,
pass

@classmethod
def isAvailable(self):
def isAvailable(cls):
return True


Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from matplotlib.font_manager import (
findfont, FontProperties, fontManager, json_dump, json_load, get_font,
get_fontconfig_fonts, is_opentype_cff_font, fontManager as fm)
get_fontconfig_fonts, is_opentype_cff_font)
from matplotlib import rc_context

has_fclist = shutil.which('fc-list') is not None
Expand Down Expand Up @@ -67,7 +67,7 @@ def test_otf():
if os.path.exists(fname):
assert is_opentype_cff_font(fname)

otf_files = [f for f in fm.ttffiles if 'otf' in f]
otf_files = [f for f in fontManager.ttffiles if 'otf' in f]
for f in otf_files:
with open(f, 'rb') as fd:
res = fd.read(4) == b'OTTO'
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ def test_complete():

def test_no_pyplot():
# tests pickle-ability of a figure not created with pyplot
from matplotlib.backends.backend_pdf import FigureCanvasPdf as fc
from matplotlib.backends.backend_pdf import FigureCanvasPdf
from matplotlib.figure import Figure

fig = Figure()
_ = fc(fig)
_ = FigureCanvasPdf(fig)
ax = fig.add_subplot(1, 1, 1)
ax.plot([1, 2, 3], [1, 2, 3])
pickle.dump(fig, BytesIO(), pickle.HIGHEST_PROTOCOL)
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/tight_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ def auto_adjust_subplotpars(

return kwargs


def get_renderer(fig):
if fig._cachedRenderer:
renderer = fig._cachedRenderer
Expand Down
Loading