@@ -220,7 +220,7 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
220
220
221
221
fontext = get_fontext_synonyms (fontext )
222
222
223
- key , items = None , {}
223
+ key , items = None , set ()
224
224
for fontdir in MSFontDirectories :
225
225
try :
226
226
local = winreg .OpenKey (winreg .HKEY_LOCAL_MACHINE , fontdir )
@@ -239,7 +239,7 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
239
239
direc = os .path .join (directory , direc )
240
240
direc = os .path .abspath (direc ).lower ()
241
241
if os .path .splitext (direc )[1 ][1 :] in fontext :
242
- items [ direc ] = 1
242
+ items . add ( direc )
243
243
except EnvironmentError :
244
244
continue
245
245
except WindowsError :
@@ -550,14 +550,14 @@ def createFontList(fontfiles, fontext='ttf'):
550
550
551
551
fontlist = []
552
552
# Add fonts from list of known font files.
553
- seen = {}
553
+ seen = set ()
554
554
for fpath in fontfiles :
555
- verbose .report ('createFontDict: %s' % ( fpath ) , 'debug' )
555
+ verbose .report ('createFontDict: %s' % fpath , 'debug' )
556
556
fname = os .path .split (fpath )[1 ]
557
557
if fname in seen :
558
558
continue
559
559
else :
560
- seen [ fname ] = 1
560
+ seen . add ( fname )
561
561
if fontext == 'afm' :
562
562
try :
563
563
fh = open (fpath , 'rb' )
@@ -583,7 +583,6 @@ def createFontList(fontfiles, fontext='ttf'):
583
583
continue
584
584
except UnicodeError :
585
585
verbose .report ("Cannot handle unicode filenames" )
586
- # print >> sys.stderr, 'Bad file is', fpath
587
586
continue
588
587
except IOError :
589
588
verbose .report ("IO error - cannot open font file %s" % fpath )
0 commit comments