Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Description
We should be able to callos.scandir() frompathlib.Path.iterdir() and construct results based on theos.DirEntry.path string.
Currently we callos.listdir() and_make_child_relpath(), which returns a fully parsed/normalized string; particularly, it sets_str,_drv,_root and_tail_cached.
It's probably not worth the expense of setting_drv,_root and_tail_cached - they're only useful when paths are subsequently deconstructed withPurePath methods, which isn't particularly common. Itis worth setting_str, and happilyos.DirEntry.path provides a string that's very nearly normalized to pathlib's standards.
Also discussed here:https://discuss.python.org/t/is-there-a-pathlib-equivalent-of-os-scandir/46626/21