Properly type db on the model, sort out generic types issues#5545
Merged
snejus merged 8 commits intofix-legalize-pathfrom Dec 19, 2024
Merged
Properly type db on the model, sort out generic types issues#5545snejus merged 8 commits intofix-legalize-pathfrom
snejus merged 8 commits intofix-legalize-pathfrom
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. |
wisp3rwind
reviewed
Dec 10, 2024
Member
wisp3rwind
left a comment
There was a problem hiding this comment.
Woohoo, this really looks like the pieces are falling into place for wrapping up typings of beets' core 🎉
I left a few small nitpicks, overall this is looking great!
wisp3rwind
approved these changes
Dec 10, 2024
Member
wisp3rwind
left a comment
There was a problem hiding this comment.
Looks good to me! Feel free to merge this after addressing the question of where the SmartArtistSort should go.
snejus
added a commit
that referenced
this pull request
Dec 19, 2024
Thanks to @wisp3rwind's suggestion this PR adds types to the relationship between `Model`, `Database` and `Library`. Then I worked through the rest of the issues found in the edited files. Most of this involved providing type parameters for generic types (or defining defaults, rather 😉). There `queryparse` module had a somewhat significant issue where the sorting construction logic only expected to receive `FieldSort` subclasses, while `SmartArtistSort` was not one. Thus `SmartArtistSort` has now been forced to behave and is a `FieldSort` subclass. It's also been moved to `query.py` module which is where the rest of sorts are defined.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks to @wisp3rwind's suggestion this PR adds types to the relationship between
Model,DatabaseandLibrary.Then I worked through the rest of the issues found in the edited files. Most of this involved providing type parameters for generic types (or defining defaults, rather 😉).
There
queryparsemodule had a somewhat significant issue where the sorting construction logic only expected to receiveFieldSortsubclasses, whileSmartArtistSortwas not one. ThusSmartArtistSorthas now been forced to behave and is aFieldSortsubclass. It's also been moved toquery.pymodule which is where the rest of sorts are defined.