beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.92k stars 1.82k forks source link

Improved NamedTuple declaration #5393

Closed amogus07 closed 2 months ago

amogus07 commented 2 months ago

Description

Utilize a new way of declaring NamedTuples, which allows for typechecking as well. Maybe the latter is now redundant in other places, but I'm not that familiar with the codebase yet, so I just changed the declarations (and hopefully used the correct types). While I was at it, I also ran poetry update, but I'll revert poetry.lock in case I wasn't supposed to do that. This is my first commit here, so I hope I didn't do anything wrong...

To Do

github-actions[bot] commented 2 months ago

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.

amogus07 commented 2 months ago

I like this update!

Just checked and it seems like there's one replacements that's been left out?

image

Which types should be used here?

amogus07 commented 2 months ago

uhhhh… can't reproduce this locally?!

amogus07 commented 2 months ago

@snejus What should I do now? Can you reproduce it?

snejus commented 2 months ago

dict is only supported from Python 3.9 onwards, so try using typing.Dict instead. Also, I think you may want to use str type for the key instead of Any, Dict[str, Any].

@snejus What should I do now? Can you reproduce it?

You should be able to reproduce it in Python 3.8.