Skip to content

Commit

Permalink
Fix formatting and other misc code tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgiuca-google committed Apr 16, 2013
1 parent 1adfc85 commit 941efd4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 11 additions & 9 deletions lib/matplotlib/__init__.py
Expand Up @@ -213,11 +213,14 @@ def _is_writable_dir(p):
p is a string pointing to a putative writable dir -- return True p
is such a string, else False
"""
try: p + '' # test is string like
except TypeError: return False
try:
p + '' # test is string like
except TypeError:
return False
try:
return os.access(p, os.W_OK)
except OSError: return False
except OSError:
return False

class Verbose:
"""
Expand Down Expand Up @@ -644,7 +647,7 @@ def matplotlib_fname():
"""

oldname = os.path.join( os.getcwd(), '.matplotlibrc')
oldname = os.path.join(os.getcwd(), '.matplotlibrc')
if os.path.exists(oldname):
print("""\
WARNING: Old rc filename ".matplotlibrc" found in working dir
Expand All @@ -658,7 +661,7 @@ def matplotlib_fname():
home = get_home()
configdir = get_configdir()
if home:
oldname = os.path.join( home, '.matplotlibrc')
oldname = os.path.join(home, '.matplotlibrc')
if os.path.exists(oldname):
if configdir is not None:
newname = os.path.join(configdir, 'matplotlibrc')
Expand All @@ -676,8 +679,7 @@ def matplotlib_fname():
WARNING: Could not rename old rc file "%s": a suitable configuration directory
could not be found.""" % oldname, file=sys.stderr)


fname = os.path.join( os.getcwd(), 'matplotlibrc')
fname = os.path.join(os.getcwd(), 'matplotlibrc')
if os.path.exists(fname): return fname

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

if configdir is not None:
fname = os.path.join(configdir, 'matplotlibrc')
if os.path.exists(fname): return fname

if os.path.exists(fname):
return fname

path = get_data_path() # guaranteed to exist or raise
fname = os.path.join(path, 'matplotlibrc')
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/texmanager.py
Expand Up @@ -161,7 +161,7 @@ class TexManager:

def __init__(self):

if not self.texcache:
if self.texcache is None:
raise RuntimeError(
('Cannot create TexManager, as there is no cache directory '
'available'))
Expand Down

0 comments on commit 941efd4

Please sign in to comment.