Call path.assert_is_directory before walking.
This commit is contained in:
parent
19afbc2105
commit
23fe4d1d1e
1 changed files with 4 additions and 0 deletions
|
@ -834,6 +834,9 @@ def walk(
|
|||
If 'flat', yield individual files and directories one by one.
|
||||
If 'nested', yield tuple(root, directories, files) like os.walk does,
|
||||
except using pathclass.Path objects for everything.
|
||||
|
||||
raises pathclass.NotDirectory if the starting path is not an existing
|
||||
directory.
|
||||
'''
|
||||
if not yield_directories and not yield_files:
|
||||
raise ValueError('yield_directories and yield_files cannot both be False.')
|
||||
|
@ -869,6 +872,7 @@ def walk(
|
|||
glob_directories = set(glob_directories)
|
||||
|
||||
path = pathclass.Path(path)
|
||||
path.assert_is_directory()
|
||||
path.correct_case()
|
||||
|
||||
def handle_exclusion(whitelist, blacklist, basename, abspath):
|
||||
|
|
Loading…
Reference in a new issue