Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3289825

Browse filesBrowse files
author
klaus
committed
OrderedDict instead of sorting
1 parent cb5893d commit 3289825
Copy full SHA for 3289825

File tree

Expand file treeCollapse file tree

4 files changed

+15
-27
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+15
-27
lines changed

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4+
from collections import OrderedDict
5+
46
from matplotlib.externals import six
57
from matplotlib.externals.six.moves import xrange
68

7-
from collections import OrderedDict
89
import itertools
910
import warnings
1011
import math
@@ -17,7 +18,7 @@
1718

1819
from matplotlib import cbook
1920
from matplotlib.cbook import (_check_1d, _string_to_bool, iterable,
20-
index_of, get_label, sorted_itervalues)
21+
index_of, get_label)
2122
from matplotlib import docstring
2223
import matplotlib.colors as mcolors
2324
import matplotlib.lines as mlines
@@ -3686,7 +3687,7 @@ def get_children(self):
36863687
children.extend(self.lines)
36873688
children.extend(self.texts)
36883689
children.extend(self.artists)
3689-
children.extend(sorted_itervalues(self.spines))
3690+
children.extend(six.itervalues(self.spines))
36903691
children.append(self.xaxis)
36913692
children.append(self.yaxis)
36923693
children.append(self.title)

‎lib/matplotlib/backends/backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_svg.py
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4+
from collections import OrderedDict
5+
46
from matplotlib.externals import six
57
from matplotlib.externals.six.moves import xrange
68
from matplotlib.externals.six import unichr
79

810
import os, base64, tempfile, gzip, io, sys, codecs, re
9-
from collections import OrderedDict
1011

1112
import numpy as np
1213

@@ -17,8 +18,7 @@
1718
from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
1819
FigureManagerBase, FigureCanvasBase
1920
from matplotlib.backends.backend_mixed import MixedModeRenderer
20-
from matplotlib.cbook import (is_string_like, is_writable_file_like, maxdict,
21-
sorted_iteritems, sorted_itervalues)
21+
from matplotlib.cbook import is_string_like, is_writable_file_like, maxdict
2222
from matplotlib.colors import rgb2hex
2323
from matplotlib.figure import Figure
2424
from matplotlib.font_manager import findfont, FontProperties, get_font
@@ -359,7 +359,7 @@ def _write_hatches(self):
359359
HATCH_SIZE = 72
360360
writer = self.writer
361361
writer.start('defs')
362-
for ((path, face, stroke), oid) in sorted_itervalues(self._hatchd):
362+
for ((path, face, stroke), oid) in six.itervalues(self._hatchd):
363363
writer.start(
364364
'pattern',
365365
id=oid,
@@ -470,7 +470,7 @@ def _write_clips(self):
470470
return
471471
writer = self.writer
472472
writer.start('defs')
473-
for clip, oid in sorted_itervalues(self._clipd):
473+
for clip, oid in six.itervalues(self._clipd):
474474
writer.start('clipPath', id=oid)
475475
if len(clip) == 2:
476476
clippath, clippath_trans = clip
@@ -489,7 +489,7 @@ def _write_svgfonts(self):
489489

490490
writer = self.writer
491491
writer.start('defs')
492-
for font_fname, chars in sorted_iteritems(self._fonts):
492+
for font_fname, chars in six.iteritems(self._fonts):
493493
font = get_font(font_fname)
494494
font.set_size(72, 72)
495495
sfnt = font.get_sfnt()
@@ -918,7 +918,7 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath, mtext=None):
918918

919919
if glyph_map_new:
920920
writer.start('defs')
921-
for char_id, glyph_path in sorted_iteritems(glyph_map_new):
921+
for char_id, glyph_path in six.iteritems(glyph_map_new):
922922
path = Path(*glyph_path)
923923
path_data = self._convert_path(path, simplify=False)
924924
writer.element('path', id=char_id, d=path_data)
@@ -961,7 +961,7 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath, mtext=None):
961961
# used.
962962
if glyph_map_new:
963963
writer.start('defs')
964-
for char_id, glyph_path in sorted_iteritems(glyph_map_new):
964+
for char_id, glyph_path in six.iteritems(glyph_map_new):
965965
char_id = self._adjust_char_id(char_id)
966966
# Some characters are blank
967967
if not len(glyph_path[0]):
@@ -1105,7 +1105,7 @@ def _draw_text_as_text(self, gc, x, y, s, prop, angle, ismath, mtext=None):
11051105
fontset = self._fonts.setdefault(font.fname, set())
11061106
fontset.add(thetext)
11071107

1108-
for style, chars in sorted_iteritems(spans):
1108+
for style, chars in six.iteritems(spans):
11091109
chars.sort()
11101110

11111111
same_y = True

‎lib/matplotlib/cbook.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook.py
-14Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,17 +2491,3 @@ def __exit__(self, exc_type, exc_value, traceback):
24912491
os.rmdir(path)
24922492
except OSError:
24932493
pass
2494-
2495-
2496-
def sorted_iteritems(a):
2497-
"""
2498-
Iterate over the items of a dictionary in an order defined by the keys
2499-
"""
2500-
return ((k,v) for k,v in sorted(six.iteritems(a)))
2501-
2502-
2503-
def sorted_itervalues(a):
2504-
"""
2505-
Iterate over the values of a dictionary in an order defined by the keys
2506-
"""
2507-
return (v for k,v in sorted_iteritems(a))

‎lib/matplotlib/textpath.py

Copy file name to clipboardExpand all lines: lib/matplotlib/textpath.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from __future__ import (absolute_import, division, print_function,
44
unicode_literals)
55

6+
from collections import OrderedDict
7+
68
from matplotlib.externals import six
79
from matplotlib.externals.six.moves import zip
810

@@ -20,7 +22,6 @@
2022
from matplotlib.font_manager import FontProperties, get_font
2123
from matplotlib.transforms import Affine2D
2224
from matplotlib.externals.six.moves.urllib.parse import quote as urllib_quote
23-
from collections import OrderedDict
2425

2526

2627
class TextToPath(object):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.