paulbrodersen / somnotate

Automated polysomnography for experimental animal research
GNU General Public License v3.0
14 stars 7 forks source link

Makes filepaths os agnostic #3

Open A-Fisk opened 5 years ago

A-Fisk commented 5 years ago

Fills out _get_pathlib_object Renames _get_pathlib_object as _sanitize_file_path

Pathlib will already determine the os that it's being run on and should return the correct Path type for the os when converted to 'str()'

Haven't had a chance to test this as I'm not on the computer I was using for scoring, not sure best way to test it?

Also, not the best when it comes to documentation, any tips welcome.

paulbrodersen commented 5 years ago

Looks good in as much as it does everything what I said it should do. However, I don't think that my specifications were particularly bright to begin with. Specifically, checking if the file/parent directory exists is probably superfluous, as the the read/write function being wrapped will do that anyway. So I would suggest scrapping the if/elif/else block. This would also make the function only do one thing (convert paths) rather than two things (convert paths and check for their existence), which iMO is desirable.

What do you think?