Add explanatory docstring

This commit is contained in:
Šarūnas Nejus 2023-04-09 18:18:34 +01:00
parent 724b06a77d
commit 699e12bd88
No known key found for this signature in database
GPG key ID: DD28F6704DBE3435

View file

@ -45,6 +45,15 @@ log = logging.getLogger('beets')
# Library-specific query types.
class SingletonQuery(dbcore.FieldQuery):
"""This query is responsible for the 'singleton' lookup.
It is based on the FieldQuery and constructs a SQL clause
'album_id is NULL' which yields the same result as the previous filter
in Python but is more performant since it's done in SQL.
Using util.str2bool ensures that lookups like singleton:true, singleton:1
and singleton:false, singleton:0 are handled consistently.
"""
def __new__(cls, field, value, *args, **kwargs):
query = dbcore.query.NoneQuery('album_id')
if util.str2bool(value):