Open mikewaters opened 7 years ago
scandir()
is supposed to return a list of DirEntry. listdir()
returns strings. I was able to hack around it with this, though I have no idea if this is the best way to convert the strings to DirEntry-ish things:
from artifactory import _ArtifactoryAccessor
def scandir(self, pathobj):
for x in _ArtifactoryAccessor.listdir(self, pathobj):
yield pathobj.joinpath(x)
_ArtifactoryAccessor.scandir = scandir
Perhaps worth noting, in case it is used elsewhere:
the DirEntry
objects hold both the filenames as well as the full path - as two separate attributes. This version obviously doesn't provide both, only yielding the full paths, as that is the output of os.listdir()
.
Hi,
It appears that globbing behavior in Pathlib has changed/optimized to use
scandir
in 3.6: https://bugs.python.org/issue26032Trivially implementing
scandir
on_ArtifactoryAccessor
results in a second failure, so this may be more than just adding a new method that wrapslistdir
.