Skip to content

Properly type db on the model, sort out generic types issues#5545

Merged
snejus merged 8 commits intofix-legalize-pathfrom
fix-types-in-general
Dec 19, 2024
Merged

Properly type db on the model, sort out generic types issues#5545
snejus merged 8 commits intofix-legalize-pathfrom
fix-types-in-general

Conversation

@snejus
Copy link
Member

@snejus snejus commented Dec 10, 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.

@snejus snejus self-assigned this Dec 10, 2024
@snejus snejus requested a review from wisp3rwind December 10, 2024 16:36
@github-actions
Copy link

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.

Copy link
Member

@wisp3rwind wisp3rwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Member

@wisp3rwind wisp3rwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Feel free to merge this after addressing the question of where the SmartArtistSort should go.

@snejus snejus merged commit fe0083b into fix-legalize-path Dec 19, 2024
@snejus snejus deleted the fix-types-in-general branch December 19, 2024 16:36
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants