Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions beets/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from difflib import SequenceMatcher
from functools import cache
from itertools import chain
from typing import Any, Callable, Literal
from typing import Any, Literal

import confuse

Expand Down Expand Up @@ -1258,7 +1258,7 @@ class Subcommand:
invoked by a SubcommandOptionParser.
"""

func: Callable[[library.Library, optparse.Values, list[str]], Any]
def func(self, lib: library.Library, opts: optparse.Values, args: list[str]): ...
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting func to an instance method will break all existing usage. Throughout the codebase, standalone functions without a self parameter are assigned to func (e.g., list_cmd.func = list_func where list_func(lib, opts, args) has no self). When called as subcommand.func(lib, suboptions, subargs) at line 1611, these functions won't receive the correct arguments. Consider using a protocol or keeping the original Callable type annotation to maintain compatibility with both attribute assignment and method overriding patterns.

Suggested change
def func(self, lib: library.Library, opts: optparse.Values, args: list[str]): ...
func: Callable[[library.Library, optparse.Values, list[str]], Any]

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement has no effect.

Suggested change
def func(self, lib: library.Library, opts: optparse.Values, args: list[str]): ...
def func(self, lib: library.Library, opts: optparse.Values, args: list[str]):
raise NotImplementedError("Subclasses must implement the func() method.")

Copilot uses AI. Check for mistakes.

def __init__(self, name, parser=None, help="", aliases=(), hide=False):
"""Creates a new subcommand. name is the primary way to invoke
Expand Down
Loading