Skip to content
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

Use pathlib for handling file paths and manipulation #74

Merged
merged 2 commits into from
May 4, 2020

Conversation

IrishPrime
Copy link
Owner

Add support for pathlib and use it to handle generating file paths
and extracting information from them rather than os.path.

Add a nielsen.files module which handles most of the underlying file
operations (making calls out to shutil for things like chown and
move). This abstraction allows not only for more reusable code, but
smaller functions to test and removes the overhead of a lot of context
for the API level functions (most notably organize_file).

Favor returning Path objects from API functions that modify files in
some way. Returning the most up-to-date version of the Path object
allows the API to be more composable and extendable.

Use an intermediate value for defining the filename format for processed
files. This opens up possibilities for customization.

Resolves #71.

Resolves #73.

Add support for `pathlib` and use it to handle generating file paths
and extracting information from them rather than `os.path`.

Add a `nielsen.files` module which handles most of the underlying file
operations (making calls out to `shutil` for things like `chown` and
`move`). This abstraction allows not only for more reusable code, but
smaller functions to test and removes the overhead of a lot of context
for the API level functions (most notably `organize_file`).

Favor returning `Path` objects from API functions which modify files in
some way. Returning the most up-to-date version of the `Path` object
allows the API to be more composable and extendable.

Resolves #73.
@IrishPrime IrishPrime merged commit 8566efc into master May 4, 2020
@IrishPrime IrishPrime deleted the 73-use-pathlib branch May 4, 2020 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use pathlib for file operations Invalid cross-device link
1 participant