Skip to content

Commit b8eb2d8

Browse files
committed
Remove 2.6 workaround for missing WeakSet
1 parent a88fc21 commit b8eb2d8

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

lib/matplotlib/backends/backend_pgf.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -235,31 +235,14 @@ def get_latex_manager():
235235
LatexManagerFactory.previous_instance = new_inst
236236
return new_inst
237237

238-
class WeakSet(object):
239-
# TODO: Poor man's weakref.WeakSet.
240-
# Remove this once python 2.6 support is dropped from matplotlib.
241-
242-
def __init__(self):
243-
self.weak_key_dict = weakref.WeakKeyDictionary()
244-
245-
def add(self, item):
246-
self.weak_key_dict[item] = None
247-
248-
def discard(self, item):
249-
if item in self.weak_key_dict:
250-
del self.weak_key_dict[item]
251-
252-
def __iter__(self):
253-
return six.iterkeys(self.weak_key_dict)
254-
255238

256239
class LatexManager(object):
257240
"""
258241
The LatexManager opens an instance of the LaTeX application for
259242
determining the metrics of text elements. The LaTeX environment can be
260243
modified by setting fonts and/or a custem preamble in the rc parameters.
261244
"""
262-
_unclean_instances = WeakSet()
245+
_unclean_instances = weakref.WeakSet()
263246

264247
@staticmethod
265248
def _build_latex_header():

0 commit comments

Comments
 (0)