-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add deprecation messages for unused kwargs in FancyArrowPatch #11224
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4060,6 +4060,20 @@ def __init__(self, posA=None, posB=None, | |
Valid kwargs are: | ||
%(Patch)s | ||
""" | ||
if arrow_transmuter is not None: | ||
cbook.warn_deprecated( | ||
3.0, | ||
message=('The "arrow_transmuter" keyword argument is not used,' | ||
' and will be removed in Matplotlib 3.1'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can do something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dstansby, did you want to do this, or should I just merge as is? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the message looks fine as is then can it be merged as is? |
||
name='arrow_transmuter', | ||
obj_type='keyword argument') | ||
if connector is not None: | ||
cbook.warn_deprecated( | ||
3.0, | ||
message=('The "connector" keyword argument is not used,' | ||
' and will be removed in Matplotlib 3.1'), | ||
name='connector', | ||
obj_type='keyword argument') | ||
Patch.__init__(self, **kwargs) | ||
|
||
if posA is not None and posB is not None and path is None: | ||
|
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.
Minor style thing: I would not do this explicitly on a separate line, but rather:
warnings.warn('\n' + message, ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be display 10000 ed to describe this comment to others. Learn more.
I'm actually quite strongly -1 on embedding explicit newlines in warnings and error messages.
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.
Why, out of interest?
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.
Because you are making assumptions about the width of the window of the output (most of the time a normal linewrap will just work as well); moreover people can for example capture warnings into the logging system (logging.captureWarnings) and do all kinds of custom formatting of the message there as well.
Not going to block the PR over that, just giving my opinion though.
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 think of it as making assumptions about the maximum number of characters that should reasonably fit on one line, with the linebreak making the message as a whole more readable. I'd be inclined to say that if advanced users want to do custom formatting then it's much easier to remove line breaks than try and work out where to put them in.