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

Skip to content

Commit 04975c7

Browse files
committed
Merge pull request #4263 from montefra/py26_format
MNT : change format strings for py26 compatibility
2 parents 8a270fc + 0a66aee commit 04975c7

15 files changed

+23
-21
lines changed

doc/make.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,20 +161,21 @@ def all():
161161
with open(link, 'r') as content:
162162
delete = target == content.read()
163163
if delete:
164-
symlink_warnings.append('deleted: doc/{}'.format(link))
164+
symlink_warnings.append('deleted: doc/{0}'.format(link))
165165
os.unlink(link)
166166
else:
167-
raise RuntimeError("doc/{} should be a directory or symlink -- it isn't")
167+
raise RuntimeError("doc/{0} should be a directory or symlink -- it"
168+
" isn't")
168169
if not os.path.exists(link):
169170
if hasattr(os, 'symlink'):
170171
os.symlink(target, link)
171172
else:
172-
symlink_warnings.append('files copied to {}'.format(link))
173+
symlink_warnings.append('files copied to {0}'.format(link))
173174
shutil.copytree(os.path.join(link, '..', target), link)
174175

175176
if sys.platform == 'win32' and len(symlink_warnings) > 0:
176-
print('The following items related to symlinks will show up '+
177-
'as spurious changes in your \'git status\':\n\t{}'
177+
print('The following items related to symlinks will show up '
178+
'as spurious changes in your \'git status\':\n\t{0}'
178179
.format('\n\t'.join(symlink_warnings)))
179180

180181
parser = argparse.ArgumentParser(description='Build matplotlib docs')

examples/pylab_examples/contour_corner_mask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
plt.subplot(1, 2, i+1)
2525
cs = plt.contourf(x, y, z, corner_mask=corner_mask)
2626
plt.contour(cs, colors='k')
27-
plt.title('corner_mask = {}'.format(corner_mask))
27+
plt.title('corner_mask = {0}'.format(corner_mask))
2828

2929
# Plot grid.
3030
plt.grid(c='k', ls='-', alpha=0.3)

examples/pylab_examples/legend_demo3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Plot the lines y=x**n for n=1..4.
77
ax = plt.subplot(2, 1, 1)
88
for n in range(1, 5):
9-
plt.plot(x, x**n, label="n={}".format(n))
9+
plt.plot(x, x**n, label="n={0}".format(n))
1010
plt.legend(loc="upper left", bbox_to_anchor=[0, 1],
1111
ncol=2, shadow=True, title="Legend", fancybox=True)
1212
ax.get_legend().get_title().set_color("red")

examples/specialty_plots/topographic_hillshading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
# Label rows and columns
5656
for ax, ve in zip(axes[0], [0.1, 1, 10]):
57-
ax.set_title('{}'.format(ve), size=18)
57+
ax.set_title('{0}'.format(ve), size=18)
5858
for ax, mode in zip(axes[:, 0], ['Hillshade', 'hsv', 'overlay', 'soft']):
5959
ax.set_ylabel(mode, size=18)
6060

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def set_fileo(self, fname):
281281
try:
282282
fileo = open(fname, 'w')
283283
except IOError:
284-
raise ValueError('Verbose object could not open log file "{}"'
284+
raise ValueError('Verbose object could not open log file "{0}"'
285285
' for writing.\nCheck your matplotlibrc '
286286
'verbose.fileo setting'.format(fname))
287287
else:

lib/matplotlib/animation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
693693
"'savefig_kwargs' as it is only currently supported "
694694
"with the writers 'ffmpeg_file' and 'mencoder_file' "
695695
"(writer used: "
696-
"'{}').".format(
696+
"'{0}').".format(
697697
writer if isinstance(writer, six.string_types)
698698
else writer.__class__.__name__))
699699
savefig_kwargs.pop('bbox_inches')

lib/matplotlib/backends/backend_nbagg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ def connection_info():
7474
result = []
7575
for manager in Gcf.get_all_fig_managers():
7676
fig = manager.canvas.figure
77-
result.append('{} - {}'.format((fig.get_label() or
77+
result.append('{0} - {0}'.format((fig.get_label() or
7878
"Figure {0}".format(manager.num)),
7979
manager.web_sockets))
80-
result.append('Figures pending show: {}'.format(len(Gcf._activeQue)))
80+
result.append('Figures pending show: {0}'.format(len(Gcf._activeQue)))
8181
return '\n'.join(result)
8282

8383

lib/matplotlib/backends/backend_webagg_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,10 @@ def handle_event(self, event):
329329
self._force_full = True
330330
self.draw_idle()
331331
else:
332-
handler = getattr(self, 'handle_{}'.format(e_type), None)
332+
handler = getattr(self, 'handle_{0}'.format(e_type), None)
333333
if handler is None:
334334
import warnings
335-
warnings.warn('Unhandled message type {}. {}'.format(
335+
warnings.warn('Unhandled message type {0}. {1}'.format(
336336
e_type, event))
337337
else:
338338
return handler(event)

lib/matplotlib/colors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ def shade_rgb(self, rgb, elevation, fraction=1., blend_mode='hsv',
17091709
try:
17101710
blend = blend_mode(rgb, intensity, **kwargs)
17111711
except TypeError:
1712-
msg = '"blend_mode" must be callable or one of {}'
1712+
msg = '"blend_mode" must be callable or one of {0}'
17131713
raise ValueError(msg.format(lookup.keys))
17141714

17151715
# Only apply result where hillshade intensity isn't masked

lib/matplotlib/markers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ def set_marker(self, marker):
244244
Path(marker)
245245
self._marker_function = self._set_vertices
246246
except ValueError:
247-
raise ValueError('Unrecognized marker style {}'.format(marker))
247+
raise ValueError('Unrecognized marker style'
248+
' {0}'.format(marker))
248249

249250
self._marker = marker
250251
self._recache()

lib/matplotlib/mlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2553,7 +2553,7 @@ def key_desc(name):
25532553

25542554
dt2 = r2.dtype[name]
25552555
if dt1 != dt2:
2556-
msg = "The '{}' fields in arrays 'r1' and 'r2' must have the same"
2556+
msg = "The '{0}' fields in arrays 'r1' and 'r2' must have the same"
25572557
msg += " dtype."
25582558
raise ValueError(msg.format(name))
25592559
if dt1.num > dt2.num:

lib/matplotlib/patheffects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _update_gc(self, gc, new_gc_dict):
5656
for k, v in six.iteritems(new_gc_dict):
5757
set_method = getattr(gc, 'set_' + k, None)
5858
if set_method is None or not six.callable(set_method):
59-
raise AttributeError('Unknown property {}'.format(k))
59+
raise AttributeError('Unknown property {0}'.format(k))
6060
set_method(v)
6161
return gc
6262

lib/matplotlib/tests/test_coding_standards.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def assert_pep8_conformance(module=matplotlib, exclude_files=None,
152152
raise ValueError('Some exclude patterns were unnecessary as the '
153153
'files they pointed to either passed the PEP8 '
154154
'tests or do not point to a file:\n '
155-
'{}'.format('\n '.join(unexpectedly_good)))
155+
'{0}'.format('\n '.join(unexpectedly_good)))
156156

157157

158158
def test_pep8_conformance_installed_files():

lib/matplotlib/tests/test_patheffects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_PathEffect_points_to_pixels():
9797

9898
assert isinstance(pe_renderer, path_effects.PathEffectRenderer), (
9999
'Expected a PathEffectRendere instance, got '
100-
'a {} instance.'.format(type(pe_renderer)))
100+
'a {0} instance.'.format(type(pe_renderer)))
101101

102102
# Confirm that using a path effects renderer maintains point sizes
103103
# appropriately. Otherwise rendered font would be the wrong size.

lib/matplotlib/tri/tripcolor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def tripcolor(ax, *args, **kwargs):
6666

6767
if shading not in ['flat', 'gouraud']:
6868
raise ValueError("shading must be one of ['flat', 'gouraud'] "
69-
"not {}".format(shading))
69+
"not {0}".format(shading))
7070

7171
tri, args, kwargs = Triangulation.get_from_args_and_kwargs(*args, **kwargs)
7272

0 commit comments

Comments
 (0)