-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Refactored move functions for clarity according to #2682 #2687
Conversation
The move functions in library.py and manipule_files in importer.py where changed to use a single parameter for the file operation instead of multiple boolean flags. A typo in the documentation of the Album.move and Item.move functions confusing True and False when describing the store parameter was fixed as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic! The new interfaces look great. And the improvements to various docstrings are welcome changes too.
I did a full review and everything looks good. I added just one comment inline reflecting a flake8 warning.
and session.lib.directory in util.ancestry(old_path): | ||
if (operation != MoveOperation.MOVE | ||
and self.replaced_items[item] | ||
and session.lib.directory in util.ancestry(old_path)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flake8 has a (pretty annoying) suggestion here: it wants the and
s to go on the line preceding, rather than the line following. Like this:
if (operation != MoveOperation.MOVE and
self.replaced_items[item] and
session.lib.directory in util.ancestry(old_path)):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know about that flake8 warning, I did see it when running tox. Though I decided to ignore it as it is a bug. [1] [2] [3] [4]
PEP8 was updated to allow both styles and even states breaking before (like I did) as the preferred style for new code. [5]
For those reasons I suggest we ignore this bogus warning by adding the following line to the flake8 configuration in tox.ini
:
ignore = W503
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it; thanks for digging! I agree: let’s ignore this warning. Would you mind adding that ignore flag to this PR?
This fixes the W503 warnings and possibly other, unwanted errors and warnings in the future.
I did some more digging and found out a few more things. The W503 bug is already fixed as it's added to the default ignore list but you have a ignore option configured in On a side note: It might be worth thinking about cleaning up the tox and flake8 config. The multiple flake8 commands with different |
Indeed; that is a little dumb. Thanks for investigating, and for adding the seemingly-redundant ignore to our config. I’ve merged the PR—it’s looking great! It’s true that we’re a little more thorough than we probably need to be with our tox config for flake8; I’m not sure if the multiple versions for flake8 have ever caught anything that one run would not. However, my general philosophy is that having more tox configs that we really need is probably OK—as long as we keep our default set of environments (and the Travis runs) trimmed to a reasonable set. But if it’s getting unnecessarily confusing, I wouldn’t object to a rethink there. |
The move functions in library.py and manipule_files in importer.py where
changed to use a single parameter for the file operation instead of
multiple boolean flags.
A typo in the documentation of the Album.move and Item.move functions
confusing True and False when describing the store parameter was fixed
as well.