Skip to content

Makes filepaths os agnostic#3

Open
A-Fisk wants to merge 1 commit intopaulbrodersen:masterfrom
A-Fisk:master
Open

Makes filepaths os agnostic#3
A-Fisk wants to merge 1 commit intopaulbrodersen:masterfrom
A-Fisk:master

Conversation

@A-Fisk
Copy link

@A-Fisk A-Fisk commented Jul 18, 2019

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.

Fills out _get_pathlib_object
Renames _get_pathlib_object as _sanitize_file_path
@paulbrodersen
Copy link
Owner

paulbrodersen commented Aug 5, 2019

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants