-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Move queries and types to respective modules #5775
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
base: master
Are you sure you want to change the base?
Conversation
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. |
There was a problem hiding this 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 improves the modularity and organization of query and type definitions by relocating them from the legacy library module into separate modules within beets.dbcore. In addition, tests and dependent modules (such as those in beetsplug and beets.ui) are updated to reference the new locations.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/test_query.py | Refactored tests to use pytest fixtures and parametrize cases in the new TestPathQuery class. |
test/test_library.py | Removed legacy tests for library-specific type parsing. |
beetsplug/web/init.py | Updated import of PathQuery to use the relocated definition in beets.dbcore.query. |
beetsplug/types.py | Updated usage of DateType to types.DATE and removed legacy imports from beets.library. |
beetsplug/spotify.py | Replaced DateType instantiation with types.DATE for Spotify tags. |
beetsplug/playlist.py | Updated imports to source BLOB_TYPE and InQuery from beets.dbcore.query. |
beetsplug/mpdstats.py | Updated date field and query usage; note a key name change in item_types mapping. |
beetsplug/metasync/itunes.py | Replaced DateType with types.DATE. |
beetsplug/metasync/amarok.py | Replaced DateType with types.DATE in query definitions. |
beetsplug/deezer.py | Changed reference of DateType to types.DATE. |
beets/util/init.py | Introduced human_seconds_short function to replace the version previously in beets.ui. |
beets/ui/commands.py | Updated tag formatting to call util.human_seconds_short instead of ui.human_seconds_short. |
beets/ui/init.py | Removed the legacy human_seconds_short function. |
beets/library.py | Removed legacy query and type definitions (SingletonQuery, PathQuery, DateType, PathType, MusicalKey, DurationType) and updated references to their new locations. |
beets/dbcore/types.py | Incorporated type definitions (DateType, MusicalKey, DurationType, etc.) now sourced from the dbcore layer. |
beets/dbcore/query.py | Moved query definitions (e.g., PathQuery, SingletonQuery) into the beets.dbcore.query module. |
Comments suppressed due to low confidence (1)
beetsplug/mpdstats.py:325
- The key 'last_played' appears to have been mistakenly renamed to 'last_playtypes'. This typo may result in incorrect metadata handling; please revert the key name to 'last_played' to maintain consistency.
"last_playtypes": types.DATE,
49f6be1
to
39cc0ee
Compare
39cc0ee
to
c8cb902
Compare
And remove `force_implicit_query_detection` attribute from `PathQuery` class.
The case_sensitive parameter was only used in tests, which now use monkeypatch to control the behavior of util.case_sensitive() instead. This simplifies the PathQuery initialization logic while maintaining test coverage.
c8cb902
to
219aed9
Compare
This PR moves query and type definitions away from
library.py
todbcore
to improve modularity and organization.Key Changes:
PathQuery
andSingletonQuery
moved frombeets.library
tobeets.dbcore.query
.DateType
,PathType
(and its variantsNullPathType
),MusicalKey
, andDurationType
moved frombeets.library
tobeets.dbcore.types
.BLOB_TYPE
definition was moved frombeets.library
tobeets.dbcore.query
and then referenced inbeets.dbcore.types
.human_seconds_short
utility function was moved frombeets.ui
tobeets.util
due to circular dependency.PathQueryTest
class intest/test_query.py
has been rewritten to usepytest.mark.parametrize
for more concise and readable test cases.