Skip to content

Commit 941efd4

Browse files
committed
Fix formatting and other misc code tweaks.
1 parent 1adfc85 commit 941efd4

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

lib/matplotlib/__init__.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,14 @@ def _is_writable_dir(p):
213213
p is a string pointing to a putative writable dir -- return True p
214214
is such a string, else False
215215
"""
216-
try: p + '' # test is string like
217-
except TypeError: return False
216+
try:
217+
p + '' # test is string like
218+
except TypeError:
219+
return False
218220
try:
219221
return os.access(p, os.W_OK)
220-
except OSError: return False
222+
except OSError:
223+
return False
221224

222225
class Verbose:
223226
"""
@@ -644,7 +647,7 @@ def matplotlib_fname():
644647
645648
"""
646649

647-
oldname = os.path.join( os.getcwd(), '.matplotlibrc')
650+
oldname = os.path.join(os.getcwd(), '.matplotlibrc')
648651
if os.path.exists(oldname):
649652
print("""\
650653
WARNING: Old rc filename ".matplotlibrc" found in working dir
@@ -658,7 +661,7 @@ def matplotlib_fname():
658661
home = get_home()
659662
configdir = get_configdir()
660663
if home:
661-
oldname = os.path.join( home, '.matplotlibrc')
664+
oldname = os.path.join(home, '.matplotlibrc')
662665
if os.path.exists(oldname):
663666
if configdir is not None:
664667
newname = os.path.join(configdir, 'matplotlibrc')
@@ -676,8 +679,7 @@ def matplotlib_fname():
676679
WARNING: Could not rename old rc file "%s": a suitable configuration directory
677680
could not be found.""" % oldname, file=sys.stderr)
678681

679-
680-
fname = os.path.join( os.getcwd(), 'matplotlibrc')
682+
fname = os.path.join(os.getcwd(), 'matplotlibrc')
681683
if os.path.exists(fname): return fname
682684

683685
if 'MATPLOTLIBRC' in os.environ:
@@ -689,8 +691,8 @@ def matplotlib_fname():
689691

690692
if configdir is not None:
691693
fname = os.path.join(configdir, 'matplotlibrc')
692-
if os.path.exists(fname): return fname
693-
694+
if os.path.exists(fname):
695+
return fname
694696

695697
path = get_data_path() # guaranteed to exist or raise
696698
fname = os.path.join(path, 'matplotlibrc')

lib/matplotlib/texmanager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class TexManager:
161161

162162
def __init__(self):
163163

164-
if not self.texcache:
164+
if self.texcache is None:
165165
raise RuntimeError(
166166
('Cannot create TexManager, as there is no cache directory '
167167
'available'))

0 commit comments

Comments
 (0)