-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed up functions that use audeer.path() #136
Comments
Puhh, I wasn't expecting that things would become so complicated :) I am a bit afraid we will add a lot of new complexity here and it will become difficult for a user to predict the outcome of certain functions. E.g. with #139 if we have the following files: $ touch a.txt
$ ln -s a.txt b.txt This can happen: audeer.basename_wo_ext('b.txt')
but: audeer.basename_wo_ext(audeer.path('b.txt'))
Before it would at least return The only solution would be to expose |
Or we keep |
I was also thinking about this as well. There seems to be only a few function like |
In places where we think it's crucial we can explicitly call |
I created #140 to set |
This is now handled by #140 which changes the default of |
In #132 we introduced the
follow_symlink
argumet toaudeer.path()
which does not convert symlinks into the actual links, which makes it much faster.I checked all functions, that use
audeer.path()
and add a discussion here, how we might handle applying the changes there too:audeer.basename_wo_ext()
: I would silently usefollow_symlink=False
as the current behavior for symlinks feels like a bug for me (the returned name might be different if the basename of the link is different from the file name) Not follow symlinks in Ensure basename_wo_ext() #139audeer.common_directory()
: I'm not sure what the wanted behavior is here. At the moment it would first convert symlink, which meansa/b/c
andd/e/f
can have a common directory if at least some it is a link. If this is the desired behavior, we should not change it or addfollow_symlink
as an argument.audeer.create_archive()
: it is possible to silently usefollow_symlink=False
. It would introduce a breaking change as a user can then no longer include symlinks in thefiles
argument that are outside ofroot
, but just link into sub-folders ofroot
.audeer.download_url()
we can silently usefollow_symlink=False
. The only breaking change is that it then would return a symlink instead of the real path (Do now follow symlinks in download_url() #135)audeer.extract_archive()
: we should be able to silently usefollow_symlink=False
without any breaking change (Don't convert symlinks in audeer.extract_archive() #138)audeer.extract_archives()
: we should be able to silently usefollow_symlink=False
without any breaking change (Don't convert symlinks in audeer.extract_archive() #138)audeer.file_extension()
: we need to add afollow_symlink
argument and pass it on toaudeer.path()
as it leads to different outputs. Or we could argue as withaudeer.basename_wo_ext()
that the current behavior is more a bug than a feature and change to usefollow_symlink=False
audeer.list_dir_names()
: I would add afollow_symlink
option as the output is directly affected or do nothingaudeer.list_file_names()
: I would add afollow_symlink
option as the output is directly affected or do nothingaudeer.mkdir()
: we could silently usefollow_symlink=False
, but it would change the return value. Maybe we can skip it as speed is anyway not an issue here as we have to do an hard disc operation anywayaudeer.md5()
: we would need to addfollow_symlink=False
as an option as it directly influences the return value. If we add it here, we also need to add it ataudeer.list_file_names()
audeer.replace_file_extension()
: I would propose to silently usefollow_symlink=False
here. The current behavior seems to have a bug for symlinks, as it might replace a different file extension than the user expects.audeer.rmdir()
:we should be able to silently usewe cannot change the current implementation asfollow_symlink=False
rmdir()
does not work on symlinks (TST: test for symbolic link in audeer.rmdir() #137)audeer.touch()
: we could silently usefollow_symlink
. It would be a breaking change as it changes the return value for a symlinkThe text was updated successfully, but these errors were encountered: