-
Notifications
You must be signed in to change notification settings - Fork 2k
lastgenre: Finalize type hints in plugin #6239
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
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.
663b09d to
d89a3cc
Compare
39bfc3d to
59e1c53
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6239 +/- ##
=======================================
Coverage 68.22% 68.22%
=======================================
Files 138 138
Lines 18791 18792 +1
Branches 3167 3167
=======================================
+ Hits 12820 12821 +1
Misses 5298 5298
Partials 673 673
🚀 New features to boost your workflow:
|
semohr
left a comment
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.
Seems like a no brainier to me! Thanks for the additions.
|
Thanks for this! There are still a couple of missing types, would you mind adding them? $ mypy beetsplug/lastgenre --strict --allow-untyped-call --pretty
beetsplug/lastgenre/__init__.py:96: error: Function is missing a return type annotation [no-untyped-def]
def __init__(self):
^
beetsplug/lastgenre/__init__.py:96: note: Use "-> None" if function does not return a value
beetsplug/lastgenre/__init__.py:168: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
def _tunelog(self, msg, *args, **kwargs) -> None:
^
beetsplug/lastgenre/__init__.py:336: error: Returning Any from function declared to return "str" [no-any-return]
return self.config["separator"].as_str().join(formatted)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
beetsplug/lastgenre/__init__.py:379: error: Function is missing a return type annotation [no-untyped-def]
def _try_resolve_stage(stage_label: str, keep_genres, new_genres):
^
beetsplug/lastgenre/__init__.py:379: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
def _try_resolve_stage(stage_label: str, keep_genres, new_genres):
^
beetsplug/lastgenre/__init__.py:416: error: Returning Any from function declared to return "tuple[str | None, ...]" [no-any-return]
return result
^~~~~~~~~~~~~
beetsplug/lastgenre/__init__.py:423: error: Returning Any from function declared to return "tuple[str | None, ...]" [no-any-return]
return result
^~~~~~~~~~~~~
beetsplug/lastgenre/__init__.py:474: error: Returning Any from function declared to return "tuple[str | None, ...]" [no-any-return]
return result
^~~~~~~~~~~~~
beetsplug/lastgenre/__init__.py:582: error: Function is missing a type annotation [no-untyped-def]
def lastgenre_func(lib, opts, args):
^
beetsplug/lastgenre/__init__.py:592: error: Function is missing a type annotation for one or more arguments [no-untyped-def]
def imported(self, session, task) -> None:
^
Found 10 errors in 1 file (checked 1 source file) |
59e1c53 to
6b465d8
Compare
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.
Thanks for this!
There are still a couple of missing types, would you mind adding them?
Many thanks for pointing that out @snejus . Added all of them and used that handy mypy command to check.
Do we usually add a changelog entry when we only add/finalize types in a plugin/code-part?
No need :) |
d9d868f to
75ea776
Compare
d89a3cc to
46bb0ac
Compare
46bb0ac to
28dc78b
Compare
75ea776 to
12d4263
Compare
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 completes the type hint coverage for the lastgenre plugin by adding type annotations to previously untyped methods and helper functions.
- Adds type hints to utility functions (
flatten_tree,find_parents) - Adds type hints to plugin lifecycle methods (
__init__,setup,commands,imported) - Adds type hints to internal helper methods (
_tunelog,_get_depth,_sort_by_depth,_try_resolve_stage,_tags_for) - Adds inline variable type annotations for better type clarity (
_genre_cache,obj_to_query,res,tags)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fdc6197 to
940d4df
Compare
to finally reach full type hint coverage in the plugin!
940d4df to
b8c7c87
Compare
Description
Add type hints to the few remaining methods and helpers that didn't have them already.
To Do
Documentation.Changelog.