mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Fix sourcery-ai comments
This commit is contained in:
parent
e90738a6e2
commit
51c971f089
2 changed files with 13 additions and 5 deletions
|
|
@ -633,14 +633,16 @@ def send(event: EventType, **arguments: Any) -> list[Any]:
|
|||
|
||||
|
||||
def feat_tokens(
|
||||
for_artist: bool = True, custom_feat_words: list[str] = []
|
||||
for_artist: bool = True, custom_feat_words: list[str] | None = None
|
||||
) -> str:
|
||||
"""Return a regular expression that matches phrases like "featuring"
|
||||
that separate a main artist or a song title from secondary artists.
|
||||
The `for_artist` option determines whether the regex should be
|
||||
suitable for matching artist fields (the default) or title fields.
|
||||
"""
|
||||
feat_words = ["ft", "featuring", "feat", "feat.", "ft."] + custom_feat_words
|
||||
feat_words = ["ft", "featuring", "feat", "feat.", "ft."]
|
||||
if isinstance(custom_feat_words, list):
|
||||
feat_words += custom_feat_words
|
||||
if for_artist:
|
||||
feat_words += ["with", "vs", "and", "con", "&"]
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
def split_on_feat(
|
||||
artist: str, for_artist: bool = True, custom_feat_words: list[str] = []
|
||||
artist: str,
|
||||
for_artist: bool = True,
|
||||
custom_feat_words: list[str] | None = None,
|
||||
) -> tuple[str, str | None]:
|
||||
"""Given an artist string, split the "main" artist from any artist
|
||||
on the right-hand side of a string like "feat". Return the main
|
||||
|
|
@ -46,7 +48,9 @@ def split_on_feat(
|
|||
return parts
|
||||
|
||||
|
||||
def contains_feat(title: str, custom_feat_words: list[str] = []) -> bool:
|
||||
def contains_feat(
|
||||
title: str, custom_feat_words: list[str] | None = None
|
||||
) -> bool:
|
||||
"""Determine whether the title contains a "featured" marker."""
|
||||
return bool(
|
||||
re.search(
|
||||
|
|
@ -60,7 +64,9 @@ def contains_feat(title: str, custom_feat_words: list[str] = []) -> bool:
|
|||
|
||||
|
||||
def find_feat_part(
|
||||
artist: str, albumartist: str | None, custom_feat_words: list[str] = []
|
||||
artist: str,
|
||||
albumartist: str | None,
|
||||
custom_feat_words: list[str] | None = None,
|
||||
) -> str | None:
|
||||
"""Attempt to find featured artists in the item's artist fields and
|
||||
return the results. Returns None if no featured artist found.
|
||||
|
|
|
|||
Loading…
Reference in a new issue