8000 MNT: simplify legacy python codepath · matplotlib/matplotlib@ceaa7de · GitHub
[go: up one dir, main page]

Skip to content

Commit ceaa7de

Browse files
committed
MNT: simplify legacy python codepath
1 parent bf6816d commit ceaa7de

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

lib/matplotlib/cbook.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,23 +1016,13 @@ def mkdirs(newdir, mode=0o777):
10161016
if six.PY3:
10171017
os.makedirs(newdir, mode=mode, exist_ok=True)
10181018
return
1019-
1020-
1021-
def _make_leaf(newdir, mode):
1022-
if os.path.exists(newdir):
1023-
return
1024-
try:
1025-
os.makedirs(thispart, mode)
1026-
except OSError as err:
1027-
# Reraise the error unless it's about an already existing directory
1028-
if err.errno != errno.EEXIST or not os.path.isdir(newdir):
1029-
raise
1030-
1031-
parts = os.path.split(newdir)
1032-
for i in range(1, len(parts) + 1):
1033-
thispart = os.path.join(*parts[:i])
1034-
_make_leaf(thispart, mode)
1035-
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
10361026

10371027
class GetRealpathAndStat(object):
10381028
def __init__(self):

0 commit comments

Comments
 (0)
0