From 7e89f782484c8a2672b6ce28e25c05c5e6b2239f Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Fri, 20 Oct 2017 08:57:17 -0700 Subject: [PATCH] No need to fake sets with dicts anymore. --- lib/matplotlib/font_manager.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index 9602db76c9fd..7e586f61502a 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -220,7 +220,7 @@ def win32InstalledFonts(directory=None, fontext='ttf'): fontext = get_fontext_synonyms(fontext) - key, items = None, {} + key, items = None, set() for fontdir in MSFontDirectories: try: local = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, fontdir) @@ -239,7 +239,7 @@ def win32InstalledFonts(directory=None, fontext='ttf'): direc = os.path.join(directory, direc) direc = os.path.abspath(direc).lower() if os.path.splitext(direc)[1][1:] in fontext: - items[direc] = 1 + items.add(direc) except EnvironmentError: continue except WindowsError: @@ -550,14 +550,14 @@ def createFontList(fontfiles, fontext='ttf'): fontlist = [] # Add fonts from list of known font files. - seen = {} + seen = set() for fpath in fontfiles: - verbose.report('createFontDict: %s' % (fpath), 'debug') + verbose.report('createFontDict: %s' % fpath, 'debug') fname = os.path.split(fpath)[1] if fname in seen: continue else: - seen[fname] = 1 + seen.add(fname) if fontext == 'afm': try: fh = open(fpath, 'rb') @@ -583,7 +583,6 @@ def createFontList(fontfiles, fontext='ttf'): continue except UnicodeError: verbose.report("Cannot handle unicode filenames") - # print >> sys.stderr, 'Bad file is', fpath continue except IOError: verbose.report("IO error - cannot open font file %s" % fpath)