Some file utilities live in dvc.utils.fs while some other in dvc.utils.__init__. I suggest grouping them in a single place.
Also, some of them accept Path-like objects, i.e. Path, PurePath, PathInfo, etc and some do not. This makes people guess at the call site whether they need to wrap arguments into fspath(), fspath_py35() or none. So I propose that our file utilities will always accept that, this way we will concentrate those wrapper call in one place and remove the guessing part, at least for our own functions, calling os.path.*() will still need wrapping as long as we use Python 3.5-.
Some file utilities live in
dvc.utils.fswhile some other indvc.utils.__init__. I suggest grouping them in a single place.Also, some of them accept Path-like objects, i.e.
Path,PurePath,PathInfo, etc and some do not. This makes people guess at the call site whether they need to wrap arguments intofspath(),fspath_py35()or none. So I propose that our file utilities will always accept that, this way we will concentrate those wrapper call in one place and remove the guessing part, at least for our own functions, callingos.path.*()will still need wrapping as long as we use Python 3.5-.dvc.utils.fs(Fixed by Move fs utilities to fs.py from __init__.py #3093 )get_inode#2673 Verify ifget_mtime_and_sizecan take both Path objects and strings #2698 Ensurecontains_symlink_up_toaccept both str and Path-like objects #2740 Ensurefile_md5accept str and Path-like objects #2746 Ensurecopyfileaccepts str and Path-like objects #2752 Ensuremakedirsaccepts str and Path-like objects #2757 Ensuremoveaccepts str and Path-like objects #2769 Ensureremoveaccepts str and Path-like objects #2795 Write test fortmp_fnameto check if it accepts Path-like and str objects #2808 Write test forwalk_filesto check if it accepts Path-like and str objects #3035 Ensurerelpathaccepts str and Path-like objects #3037 )