Skip to content

Commit

Permalink
[SingletonQuery] correct superclass typing
Browse files Browse the repository at this point in the history
I had misinterpreted the pattern type for this query to be 'NoReturn',
thinking that it accepted no pattern at all (even so, I should have
typed it as 'None').  However, it does accept a pattern, and uses it to
decide whether to select only singletons or none at all.

See <beetbox#5282 (comment)>.
  • Loading branch information
Arav K. committed Jun 12, 2024
1 parent 549fea1 commit c7ca2ef
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions beets/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import time
import unicodedata
from functools import cached_property
from typing import NoReturn

from mediafile import MediaFile, UnreadableFileError

Expand All @@ -50,7 +49,7 @@
# Library-specific query types.


class SingletonQuery(dbcore.FieldQuery[NoReturn]):
class SingletonQuery(dbcore.FieldQuery[str]):
"""This query is responsible for the 'singleton' lookup.
It is based on the FieldQuery and constructs a SQL clause
Expand All @@ -61,7 +60,7 @@ class SingletonQuery(dbcore.FieldQuery[NoReturn]):
and singleton:false, singleton:0 are handled consistently.
"""

def __new__(cls, field, value, *args, **kwargs):
def __new__(cls, field: str, value: str, *args, **kwargs):
query = dbcore.query.NoneQuery("album_id")
if util.str2bool(value):
return query
Expand Down

0 comments on commit c7ca2ef

Please sign in to comment.