-
Notifications
You must be signed in to change notification settings - Fork 548
Adding isort #310
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
Adding isort #310
Conversation
captum/insights/api.py
Outdated
| for inputs, additional_forward_args, label in _batched_generator( | ||
| # Type ignore for issue with passing union to function taking generic | ||
| # https://github.com/python/mypy/issues/1533 | ||
| for inputs, additional_args, label in _batched_generator( # type: ignore |
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.
These changes were necessary to fix mypy failures on master due to merging with the common type hints. additional_forward_args was renamed to additional_args since the "type: ignore" made the line too long causing flake8 errors.
CC: @edward-io
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.
could we do:
for (
inputs,
additional_forward_args,
label,
) in _batched_generator( # type: ignore
instead?
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.
Sure, I figured a single line is more concise, but this works too, will update, thanks!
facebook-github-bot
left a comment
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.
@vivekmig has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
edward-io
left a comment
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.
Looks good to me, though I didn't review all 86 files. Minor comments, LGTM.
captum/insights/api.py
Outdated
| for inputs, additional_forward_args, label in _batched_generator( | ||
| # Type ignore for issue with passing union to function taking generic | ||
| # https://github.com/python/mypy/issues/1533 | ||
| for inputs, additional_args, label in _batched_generator( # type: ignore |
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.
could we do:
for (
inputs,
additional_forward_args,
label,
) in _batched_generator( # type: ignore
instead?
facebook-github-bot
left a comment
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.
@vivekmig has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
facebook-github-bot
left a comment
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.
@vivekmig has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: This applies isort to alphabetize import ordering. We also add an isort check to CircleCI to ensure that import ordering is maintained in future PRs. This required adding an isort config that is compatible with black, which was found here: https://github.com/psf/black This also adds a type: ignore for an issue caused by merging Insights type fixes with type hints for common. Pull Request resolved: meta-pytorch#310 Reviewed By: orionr Differential Revision: D20206324 Pulled By: vivekmig fbshipit-source-id: 48cce82d60a9a6f7384211e7aae2ffb4c0c85772
This applies isort to alphabetize import ordering. We also add an isort check to CircleCI to ensure that import ordering is maintained in future PRs. This required adding an isort config that is compatible with black, which was found here: https://github.com/psf/black
This also adds a type: ignore for an issue caused by merging Insights type fixes with type hints for common.