Skip to content

Conversation

@sakgoyal
Copy link

@sakgoyal sakgoyal commented Nov 5, 2025

Description

Fixes some type issues with ruff complaining that self is not there.

Copilot AI review requested due to automatic review settings November 5, 2025 22:45
@sakgoyal sakgoyal requested a review from a team as a code owner November 5, 2025 22:45
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the func attribute in the Subcommand class from a typed class attribute to a method stub with proper type annotations. This change provides better type safety and clarity for subcommand implementations.

  • Changed func from a Callable type annotation to a method stub with explicit parameter types
  • Removed unused Callable import from the typing module

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"""

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.
"""

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.

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.
@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 67.33%. Comparing base (61a4c73) to head (f84f3ba).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
beets/ui/__init__.py 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6146      +/-   ##
==========================================
- Coverage   67.34%   67.33%   -0.01%     
==========================================
  Files         136      136              
  Lines       18492    18492              
  Branches     3134     3135       +1     
==========================================
- Hits        12453    12452       -1     
  Misses       5370     5370              
- Partials      669      670       +1     
Files with missing lines Coverage Δ
beets/ui/__init__.py 82.16% <50.00%> (-0.15%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@semohr
Copy link
Contributor

semohr commented Nov 6, 2025

Thank you for the PR!

Since this seems to be your first contribution to beets, you might want to have a quick look at our contribution guide and the developer documentation to get familiar with our workflow and coding conventions. This should help you fix the failing workflows.

We're thrilled to have you contributing, welcome to the community!


Can you extend your description a bit? Where and how did the warning/error occur? It is hard to follow the changes without a bit more information.

@semohr semohr self-assigned this Nov 6, 2025
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