Skip to content

Make Delegate classes proper ABCs with abstract methods#602

Merged
gnachman merged 1 commit intognachman:masterfrom
mkusaka:fix/delegate-abc
Mar 2, 2026
Merged

Make Delegate classes proper ABCs with abstract methods#602
gnachman merged 1 commit intognachman:masterfrom
mkusaka:fix/delegate-abc

Conversation

@mkusaka
Copy link
Contributor

@mkusaka mkusaka commented Mar 2, 2026

Summary

All four Delegate classes in the Python API use @abc.abstractmethod on their methods but don't inherit from abc.ABC, so the decorator has no effect — subclasses are not required to implement the methods.

Additionally, tmux.Delegate had @abc.abstractmethod as a class decorator (which is a no-op) instead of on individual methods.

Changes:

  • tmux.Delegate: Remove misplaced @abc.abstractmethod class decorator, inherit from abc.ABC, add @abc.abstractmethod to each method
  • Session.Delegate: Inherit from abc.ABC
  • Tab.Delegate: Inherit from abc.ABC
  • Window.Delegate: Inherit from abc.ABC
  • Add ... (ellipsis) as method body to all abstract methods

The only subclass (App) already implements all required methods across all four Delegates.

All four Delegate classes (tmux.Delegate, Session.Delegate,
Tab.Delegate, Window.Delegate) used @abc.abstractmethod on methods
but did not inherit from abc.ABC, so the decorator had no effect.

- Add abc.ABC as base class to all four Delegate classes
- Add ellipsis (...) as method body for all abstract methods
- Remove misplaced @abc.abstractmethod class decorator from
  tmux.Delegate and add it to individual methods instead

The only subclass (App) already implements all required methods.
@gnachman gnachman merged commit 54bd855 into gnachman:master Mar 2, 2026
2 checks passed
@mkusaka mkusaka deleted the fix/delegate-abc branch March 3, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants