Talking about https://docs.pyfilesystem.org/en/latest/reference/walk.html#fs.walk.BoundWalker.dirs and maybe walk.files is affected as well.
The documentation talks about (emphasis by me):
dirs(path='/', **kwargs)
Walk a filesystem, yielding ABSOLUTE paths to directories.
and
filter_dirs (list, optional) – A list of patterns that will be used to match directories PATHS. The walk will only open directories that match at least one of these patterns.
This gives me the impression that the filters are applied to the absolute paths.
While in fact, if I understood and investigated correctly, these patterns match the directory NAMES. Here's an example to show that behavior:
with MemoryFS() as myfs:
myfs.makedirs('/foo/bar')
print('-------------------')
for path in myfs.walk.dirs():
print(path)
print('-------------------')
for path in myfs.walk.dirs(filter_dirs=['*bar*']):
print(path)
print('-------------------')
Actual output:
-------------------
/foo
/foo/bar
-------------------
-------------------
Expected output:
-------------------
/foo
/foo/bar
-------------------
/foo/bar
-------------------
This is probably not a bug in the code. However, the documentation is misleading and my question would be how I can get to my desired behavior.
Talking about https://docs.pyfilesystem.org/en/latest/reference/walk.html#fs.walk.BoundWalker.dirs and maybe
walk.filesis affected as well.The documentation talks about (emphasis by me):
and
This gives me the impression that the filters are applied to the absolute paths.
While in fact, if I understood and investigated correctly, these patterns match the directory NAMES. Here's an example to show that behavior:
Actual output:
Expected output:
This is probably not a bug in the code. However, the documentation is misleading and my question would be how I can get to my desired behavior.