Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 151db47

Browse files
committed
MNT: slightly re-arrange logic
1 parent ceaa7de commit 151db47

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/matplotlib/cbook.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,16 +1013,15 @@ def mkdirs(newdir, mode=0o777):
10131013
> chmod MODE NEWDIR
10141014
"""
10151015
# this functionality is now in core python as of 3.2
1016+
# LPY DROP
10161017
if six.PY3:
10171018
os.makedirs(newdir, mode=mode, exist_ok=True)
1018-
return
1019-
# LPY DROP
1020-
# the rest of this function can be removed when we drop legacy python
1021-
try:
1022-
os.makedirs(newdir, mode=mode)
1023-
except OSError as exception:
1024-
if exception.errno != errno.EEXIST:
1025-
raise
1019+
else:
1020+
try:
1021+
os.makedirs(newdir, mode=mode)
1022+
except OSError as exception:
1023+
if exception.errno != errno.EEXIST:
1024+
raise
10261025

10271026
class GetRealpathAndStat(object):
10281027
def __init__(self):

0 commit comments

Comments
 (0)