Skip to content

No need to fake sets with dicts anymore. #9490

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

Merged
merged 1 commit into from
Oct 20, 2017
Merged
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
11 changes: 5 additions & 6 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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')
Expand All @@ -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)
Expand Down