-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add warning for bad justify
input, in circuit_drawer
#12458
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
Add warning for bad justify
input, in circuit_drawer
#12458
Conversation
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the following people are relevant to this code:
|
justify
input, in circuit_drawer
justify
input, in circuit_drawer
…g for default value
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the following people are relevant to this code:
|
justify
input, in circuit_drawer
justify
input, in circuit_drawer
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.
Thanks! This looks good to me 🚀 I'll be OOO till the 15th, so will defer to others to finish review.
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Currently, tests are not passing due to a I had a couple of quick ideas, but it requires moving this function definition, to places, where it doesn't feel right.. Update: Regex check has been removed, for the sake of not complicating this more! 👍 |
@GuillermoAbadLopez
-- I talked more to @1ucian0 and @kevinsung we decided to indeed go back to using For example, imagine we want to change the default of So, please go back to using Pardon the back-and-forth and thank you for persistence on this issue! |
That makes a lot of sense, found something, thanks! 👍 |
No worries at all, we should do what its best for the stack, in the end! I'll change it, but it might take a bit, since I'm going OOO for a couple of days 👍
|
Pull Request Test Coverage Report for Build 9584452045Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Last suggestions addressed!
|
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.
Thank you! @Qiskit/terra-core @1ucian0 can you please merge?
Pull Request Test Coverage Report for Build 9741924018Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
* add warning for bad justify input in circuit_drawer * change justify after raising error * typo indentation + improving warning string * Undo max_lenght limit by autoformater (120 > 105) * Make lines fullfill 105 max lenght requirement * Solve regex matching parenthesis problem and don't trigger the wanring for default value * Change justify default value to "left", & add deprecation wrapper * Change and extend warnings tests * Solve various layers of same argument DeprecationWarning * Added a clarification comment for the solution, about multiple deprecationwarnings * Ignore cyclic import error, as above * Apply suggestions from code review Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com> * Apply suggestions from code review * Improve DeprecationWarning readability, and fix warning checks tests * Remove `_is_valid_justify_arg` from `@deprecate_arg`, for solving circular import * in `deprecate_arg` change `since` to "1.2.0" * black formater suggestion * negate conditions for `predicate` in `@deprecate_arg` * remove `pending=True`, since then warning is not raised * change qiskit version on tests * remove assert Regex for DeprecationWarning * Add release note, and remove two undesired changes in imports * changing release note naming from "_" to "-" * Add extra line in the end, for lint * Redid release file from start, with shorter name, and correct spacings * Remove final spaces in all lines... * Try without deprecations_visualization section.. * Solve, bad Sphinx spacing, go back to deprecations_visualization * Go back to `None` as default value * Simplifying deprecation logic * Remove unused imports and changed missing default value * Improve docstring for public methods * Improve error readbility and testing of it with regex --------- Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
CHECKS:
Summary current state:
PR originally tackling #12089, to raise a warning for bad
justify
argument inputs.The relevant code changes of this PR (+ after first review), are:
justify
, to"left"
(previouslyNone
).DeprecationWarning
, saying we will error for wrongjustify
arguments in the future.Corner cases now working better:
If the user manually passes
justify=None
(which ends asjustify="left"
) we raise a warning, which before since itwas the default value, we couldn't...If the user manually passes any
justify
that passes as Trueif justify:
, but which is not astring
. Since before we would have donejustify.lower()
to it, getting a non-personalized error message:'X'object has no attribute 'lower'
...OUTDATED original Summary (before first review):
(before changing the default value
None
to"left"
, when only awarning
was raised [except forNone
])PR tackling #12089, where I have added a warning, for when the
justify
argument is not in the three accepted cases"left"
,"right"
and"none"
.