Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Album.items() / LibModel.items() conflict #4412

Merged
merged 2 commits into from
Aug 21, 2022
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions beets/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,11 @@ def _getters(cls):
def items(self):
"""Return an iterable over the items associated with this
album.

This method conflicts with :meth:`LibModel.items`, which is
inherited from :meth:`beets.dbcore.Model.items`.
Since :meth:`Album.items` predates these methods, and is
likely to be used by plugins, we keep this interface as-is.
"""
return self._db.items(dbcore.MatchQuery('album_id', self.id))

Expand Down
6 changes: 6 additions & 0 deletions docs/dev/library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ synchronized (via load or store) with the database.

.. automethod:: items

.. note::
The :py:meth:`Album.items` method is not inherited from
:py:meth:`LibModel.items` for historical reasons.

govynnus marked this conversation as resolved.
Show resolved Hide resolved
.. automethod:: get

Item
Expand Down Expand Up @@ -207,6 +211,8 @@ metadata field.

.. automethod:: item_dir

.. automethod:: items

Albums extend the normal model interface to also forward changes to their
items:

Expand Down