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 e14f98e

Browse filesBrowse files
authored
Merge pull request #9490 from anntzer/set-for-dict
No need to fake sets with dicts anymore.
2 parents 6798266 + 7e89f78 commit e14f98e
Copy full SHA for e14f98e

File tree

Expand file treeCollapse file tree

1 file changed

+5
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-6
lines changed

‎lib/matplotlib/font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/font_manager.py
+5-6Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
220220

221221
fontext = get_fontext_synonyms(fontext)
222222

223-
key, items = None, {}
223+
key, items = None, set()
224224
for fontdir in MSFontDirectories:
225225
try:
226226
local = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, fontdir)
@@ -239,7 +239,7 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
239239
direc = os.path.join(directory, direc)
240240
direc = os.path.abspath(direc).lower()
241241
if os.path.splitext(direc)[1][1:] in fontext:
242-
items[direc] = 1
242+
items.add(direc)
243243
except EnvironmentError:
244244
continue
245245
except WindowsError:
@@ -550,14 +550,14 @@ def createFontList(fontfiles, fontext='ttf'):
550550

551551
fontlist = []
552552
# Add fonts from list of known font files.
553-
seen = {}
553+
seen = set()
554554
for fpath in fontfiles:
555-
verbose.report('createFontDict: %s' % (fpath), 'debug')
555+
verbose.report('createFontDict: %s' % fpath, 'debug')
556556
fname = os.path.split(fpath)[1]
557557
if fname in seen:
558558
continue
559559
else:
560-
seen[fname] = 1
560+
seen.add(fname)
561561
if fontext == 'afm':
562562
try:
563563
fh = open(fpath, 'rb')
@@ -583,7 +583,6 @@ def createFontList(fontfiles, fontext='ttf'):
583583
continue
584584
except UnicodeError:
585585
verbose.report("Cannot handle unicode filenames")
586-
# print >> sys.stderr, 'Bad file is', fpath
587586
continue
588587
except IOError:
589588
verbose.report("IO error - cannot open font file %s" % fpath)

0 commit comments

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