Skip to content

Conversation

@brchristian
Copy link
Contributor

@brchristian brchristian commented Aug 26, 2025

Fixes #30474.

PR summary

This PR fixes a long-standing spelling error in the contains_branch_seperately method name, which should be contains_branch_separately.

In order to maintain backwards compatibility, aliases maintain the old spelling for legacy use. (Per discussion in #30474 with @tacaswell it was reasoned that this was preferable to deprecation.)

Type hints and internal references are updated to the new spelling accordingly.

PR checklist

@brchristian brchristian force-pushed the fix_method_name_typo branch from 7b37286 to 93c4bc3 Compare August 28, 2025 18:43
@QuLogic QuLogic changed the title Fix spelling error in contains_branch_seperately method name Fix spelling error in contains_branch_separately method name Aug 28, 2025
@QuLogic
Copy link
Member

QuLogic commented Aug 28, 2025

I'll also rename the PR title, as people tend to want to open PRs to 'fix' the changelog on intentional typos.

@brchristian
Copy link
Contributor Author

Thanks for the review, and great points!

I've updated the alias to an actual method, like so:

    def contains_branch_seperately(self, other_transform):
        """Permanent alias for backwards compatibility (historical typo)."""
        return self.contains_branch_separately(other_transform)

As you note, this means we no longer need additional aliases in child classes or mixins.

When I tried to remove the alias completely from transforms.pyi, the CI tests failed. But we should be able to do it pretty minimally. Instead of duplicating the type hints, I simplified that down to a single line:

contains_branch_seperately = contains_branch_separately  # Alias (historical typo)

And I removed the code from BlendedMixin in transforms.pyi.

That seems to make CI happy, and I think that's about as minimal as it can get in transforms.pyi, but of course LMK if you prefer a different solution. (One alternative could be a @no_type_check decorator in transforms.py, for instance.) I'm of course totally happy to change it up if you prefer something else.

@QuLogic
Copy link
Member

QuLogic commented Aug 29, 2025

When I tried to remove the alias completely from transforms.pyi, the CI tests failed. But we should be able to do it pretty minimally. Instead of duplicating the type hints, I simplified that down to a single line:

Ah, good point, I forgot we check for consistency. This is fine as it is.

@brchristian brchristian force-pushed the fix_method_name_typo branch from 93c4bc3 to b478bb6 Compare August 29, 2025 04:40
Fixes matplotlib#30474.

This PR fixes a long-standing spelling error in the `contains_branch_seperately` method name, which should be `contains_branch_separately`.

In order to maintain backwards compatibility, aliases maintain the old spelling for legacy use.

Type hints and internal references are updated to the new spelling accordingly.
@brchristian brchristian force-pushed the fix_method_name_typo branch from b478bb6 to a6267f7 Compare August 29, 2025 04:41
@QuLogic QuLogic added this to the v3.11.0 milestone Aug 29, 2025
@timhoffm timhoffm merged commit 5d89f35 into matplotlib:main Sep 2, 2025
40 checks passed
@brchristian brchristian deleted the fix_method_name_typo branch September 2, 2025 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Typo in method name: contains_branch_separately

4 participants