Return an iterator of DirEntry objects for given path.
path can be specified as either str, bytes, or a path-like object. If
path is bytes, the names of yielded DirEntry objects will also be bytes;
in all other circumstances they will be str.
If path is None, uses the path='.'.
3.6: Added support for the context manager protocol and the close() method. If a scandir() iterator is neither exhausted nor explicitly closed a ResourceWarning will be emitted in its destructor. The function accepts a path-like object.
3.7: Added support for file descriptors on Unix.
3.15: os.scandir(-1) now fails with OSError(errno.EBADF) rather than listing the current directory.