@@ -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