You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Typo in method name: contains_branch_separately #30474
This should be spelled contains_branch_separately (separate not seperate).
Since this is a public API method, I propose:
Rename the method to contains_branch_separately (correct spelling)
Create an alias from the old contains_branch_seperately spelling to the new method for backwards compatibility
Add a deprecation warning when the old name is used
Update any internal uses and documentation to use the correct spelling
Happy to prepare a PR for this if that makes sense!
Code for reproduction
# Copied from lib/matplotlib/transforms.pydefcontains_branch_seperately(self, other_transform):
""" Return whether the given branch is a sub-tree of this transform on each separate dimension. A common use for this method is to identify if a transform is a blended transform containing an Axes' data transform. e.g.:: x_isdata, y_isdata = trans.contains_branch_seperately(ax.transData) """ifself.output_dims!=2:
raiseValueError('contains_branch_seperately only supports ''transforms with 2 output dimensions')
# for a non-blended transform each separate dimension is the same, so# just return the appropriate shape.return (self.contains_branch(other_transform), ) *2
Actual outcome
Code runs as expected, but method name contains a typo.
Expected outcome
Method name should be correctly spelled as contains_branch_separately
Additional information
No response
Operating system
No response
Matplotlib Version
Current main branch, as of a3fcf0b (25 August 2025)
It has been misspelled for 13 years (it does not look like this is a US vs UK difference) without notice so I'm not sure of the practical cost of leaving it as-is.
Did you find this because you spelled it correctly and get a name error or via a tool that searches for misspellings in function names?
My current thinking is that this is technically wrong, but mostly harmless (function names are full of nonsense words and tab-complete hides a lot of sins) where as if we go through deprecation cycle there is a chance we will break someone due to a completely non-functional API change.
The most I would want to do is correct the spelling, add the the misspelling as a copy, fix internal usage, and only document the correct spelling in the docs, but leave the misspelling there without warning forever.
I found it after having PR #30286 merged, which corrected a whitespace error, so it got me hunting for other misspellings and things of that nature.
I agree that it’s not the highest priority thing in the world and also appreciate the friction that deprecations introduce. Your proposed approach sounds very reasonable:
Use contains_branch_separately (correct spelling) as the primary method
Keep contains_branch_seperately as a permanent alias without deprecation warning
Update internal usage to the correct spelling
Document only the correct spelling
Something like this?
- def contains_branch_seperately(self, other_transform):+ def contains_branch_separately(self, other_transform):
"""
Return whether the given branch is a sub-tree of this transform on
each separate dimension.
A common use for this method is to identify if a transform is a blended
transform containing an Axes' data transform. e.g.::
- x_isdata, y_isdata = trans.contains_branch_seperately(ax.transData)+ x_isdata, y_isdata = trans.contains_branch_separately(ax.transData)
"""
if self.output_dims != 2:
- raise ValueError('contains_branch_seperately only supports '+ raise ValueError('contains_branch_separately only supports '
'transforms with 2 output dimensions')
# for a non-blended transform each separate dimension is the same, so
# just return the appropriate shape.
return (self.contains_branch(other_transform), ) * 2
++# Permanent alias for backwards compatibility (historical typo)+contains_branch_seperately = contains_branch_separately
(Plus relevant documentation fixes.)
Happy to prepare a PR if this sounds reasonable to you.
changed the title [-][Bug]: Typo in method name: contains_branch_seperately[/-][+][Bug]: Typo in method name: contains_branch_separately[/+]on Aug 28, 2025
Activity
tacaswell commentedon Aug 26, 2025
It has been misspelled for 13 years (it does not look like this is a US vs UK difference) without notice so I'm not sure of the practical cost of leaving it as-is.
Did you find this because you spelled it correctly and get a name error or via a tool that searches for misspellings in function names?
My current thinking is that this is technically wrong, but mostly harmless (function names are full of nonsense words and tab-complete hides a lot of sins) where as if we go through deprecation cycle there is a chance we will break someone due to a completely non-functional API change.
The most I would want to do is correct the spelling, add the the misspelling as a copy, fix internal usage, and only document the correct spelling in the docs, but leave the misspelling there without warning forever.
brchristian commentedon Aug 26, 2025
I found it after having PR #30286 merged, which corrected a whitespace error, so it got me hunting for other misspellings and things of that nature.
I agree that it’s not the highest priority thing in the world and also appreciate the friction that deprecations introduce. Your proposed approach sounds very reasonable:
contains_branch_separately(correct spelling) as the primary methodcontains_branch_seperatelyas a permanent alias without deprecation warningSomething like this?
(Plus relevant documentation fixes.)
Happy to prepare a PR if this sounds reasonable to you.
tacaswell commentedon Aug 26, 2025
Yes, I would review and merge a PR that did that.
Fix spelling error in `contains_branch_seperately` method name
Fix spelling error in `contains_branch_seperately` method name
Fix spelling error in `contains_branch_seperately` method name
brchristian commentedon Aug 26, 2025
I've prepared a PR for your review here: #30475.
Fix spelling error in `contains_branch_seperately` method name
Fix spelling error in `contains_branch_seperately` method name
Fix spelling error in `contains_branch_seperately` method name
Fix spelling error in `contains_branch_seperately` method name
[-][Bug]: Typo in method name: contains_branch_seperately[/-][+][Bug]: Typo in method name: contains_branch_separately[/+]Fix spelling error in `contains_branch_seperately` method name
Fix spelling error in `contains_branch_seperately` method name