@@ -44,29 +44,23 @@ def wrapper(path, *args, **kwargs):
4444
4545@functools .singledispatch
4646@wrapper
47- def mkpath (name : pathlib .Path , mode = 0o777 , verbose = True , dry_run = False ):
47+ def mkpath (name : pathlib .Path , mode = 0o777 , verbose = True , dry_run = False ) -> None :
4848 """Create a directory and any missing ancestor directories.
4949
5050 If the directory already exists (or if 'name' is the empty string, which
5151 means the current directory, which of course exists), then do nothing.
5252 Raise DistutilsFileError if unable to create some directory along the way
5353 (eg. some sub-path exists, but is a file rather than a directory).
5454 If 'verbose' is true, log the directory created.
55- Return the list of directories actually created.
5655 """
5756 if verbose and not name .is_dir ():
5857 log .info ("creating %s" , name )
5958
60- ancestry = itertools .chain ((name ,), name .parents )
61- missing = list (path for path in ancestry if not path .is_dir ())
62-
6359 try :
6460 dry_run or name .mkdir (mode = mode , parents = True , exist_ok = True )
6561 except OSError as exc :
6662 raise DistutilsFileError (f"could not create '{ name } ': { exc .args [- 1 ]} " )
6763
68- return list (map (str , missing ))
69-
7064
7165@mkpath .register
7266def _ (name : str , * args , ** kwargs ):
0 commit comments