Skip to content

Commit 583748a

Browse files
committed
STY: some whitespace cleanups
1 parent 65e2b9b commit 583748a

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

lib/matplotlib/font_manager.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,13 @@
124124
MSFolders = \
125125
r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
126126

127-
MSFontDirectories = [
127+
128+
MSFontDirectories = [
128129
r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts',
129130
r'SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts']
130131

131-
X11FontDirectories = [
132+
133+
X11FontDirectories = [
132134
# an old standard installation point
133135
"/usr/X11R6/lib/X11/fonts/TTF/",
134136
"/usr/X11/lib/X11/fonts",
@@ -158,6 +160,7 @@
158160
path = os.path.join(home, '.fonts')
159161
X11FontDirectories.append(path)
160162

163+
161164
def get_fontext_synonyms(fontext):
162165
"""
163166
Return a list of file extensions extensions that are synonyms for
@@ -167,6 +170,7 @@ def get_fontext_synonyms(fontext):
167170
'otf': ('ttf', 'otf'),
168171
'afm': ('afm',)}[fontext]
169172

173+
170174
def list_fonts(directory, extensions):
171175
"""
172176
Return a list of all fonts matching any of the extensions,
@@ -176,6 +180,7 @@ def list_fonts(directory, extensions):
176180
for ext in extensions])
177181
return cbook.listFiles(directory, pattern)
178182

183+
179184
def win32FontDirectory():
180185
"""
181186
Return the user-specified font directory for Win32. This is
@@ -188,21 +193,22 @@ def win32FontDirectory():
188193
try:
189194
from six.moves import winreg
190195
except ImportError:
191-
pass # Fall through to default
196+
pass # Fall through to default
192197
else:
193198
try:
194199
user = winreg.OpenKey(winreg.HKEY_CURRENT_USER, MSFolders)
195200
try:
196201
try:
197202
return winreg.QueryValueEx(user, 'Fonts')[0]
198203
except OSError:
199-
pass # Fall through to default
204+
pass # Fall through to default
200205
finally:
201206
winreg.CloseKey(user)
202207
except OSError:
203-
pass # Fall through to default
208+
pass # Fall through to default
204209
return os.path.join(os.environ['WINDIR'], 'Fonts')
205210

211+
206212
def win32InstalledFonts(directory=None, fontext='ttf'):
207213
"""
208214
Search for fonts in the specified font directory, or use the
@@ -248,6 +254,7 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
248254
winreg.CloseKey(local)
249255
return None
250256

257+
251258
def OSXInstalledFonts(directories=None, fontext='ttf'):
252259
"""
253260
Get list of font files on OS X - ignores font suffix by default.
@@ -265,6 +272,7 @@ def OSXInstalledFonts(directories=None, fontext='ttf'):
265272
files.extend(list_fonts(path, fontext))
266273
return files
267274

275+
268276
def get_fontconfig_fonts(fontext='ttf'):
269277
"""
270278
Grab a list of all the fonts that are being tracked by fontconfig
@@ -294,11 +302,12 @@ def get_fontconfig_fonts(fontext='ttf'):
294302
except UnicodeDecodeError:
295303
continue
296304
if (os.path.splitext(fname)[1][1:] in fontext and
297-
os.path.exists(fname)):
305+
os.path.exists(fname)):
298306
fontfiles[fname] = 1
299307

300308
return fontfiles
301309

310+
302311
def findSystemFonts(fontpaths=None, fontext='ttf'):
303312
"""
304313
Search for fonts in the specified font paths. If no paths are
@@ -338,7 +347,9 @@ def findSystemFonts(fontpaths=None, fontext='ttf'):
338347
for fname in files:
339348
fontfiles[os.path.abspath(fname)] = 1
340349

341-
return [fname for fname in six.iterkeys(fontfiles) if os.path.exists(fname)]
350+
return [fname for fname in six.iterkeys(fontfiles)
351+
if os.path.exists(fname)]
352+
342353

343354
def weight_as_number(weight):
344355
"""
@@ -421,7 +432,6 @@ def ttfFontProperty(font):
421432
else:
422433
style = 'normal'
423434

424-
425435
# Variants are: small-caps and normal (default)
426436

427437
# !!!! Untested
@@ -453,8 +463,8 @@ def ttfFontProperty(font):
453463
# Relative stretches are: wider, narrower
454464
# Child value is: inherit
455465

456-
if sfnt4.find('narrow') >= 0 or sfnt4.find('condensed') >= 0 or \
457-
sfnt4.find('cond') >= 0:
466+
if (sfnt4.find('narrow') >= 0 or sfnt4.find('condensed') >= 0 or
467+
sfnt4.find('cond') >= 0):
458468
stretch = 'condensed'
459469
elif sfnt4.find('demi cond') >= 0:
460470
stretch = 'semi-condensed'

0 commit comments

Comments
 (0)