Skip to content

Commit dbfcf69

Browse files
committed
Use wraps for notify_info_yielded decorator
1 parent 2ec7b44 commit dbfcf69

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

beets/plugins.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,14 @@ def notify_info_yielded(event: str) -> Callable[[IterF[P, Ret]], IterF[P, Ret]]:
491491
'send'.
492492
"""
493493

494-
def decorator(generator: IterF[P, Ret]) -> IterF[P, Ret]:
495-
def decorated(*args: P.args, **kwargs: P.kwargs) -> Iterator[Ret]:
496-
for v in generator(*args, **kwargs):
494+
def decorator(func: IterF[P, Ret]) -> IterF[P, Ret]:
495+
@wraps(func)
496+
def wrapper(*args: P.args, **kwargs: P.kwargs) -> Iterator[Ret]:
497+
for v in func(*args, **kwargs):
497498
send(event, info=v)
498499
yield v
499500

500-
return decorated
501+
return wrapper
501502

502503
return decorator
503504

@@ -694,7 +695,7 @@ def sanitize_pairs(
694695
... )
695696
[('foo', 'baz'), ('foo', 'bar'), ('key', 'value'), ('foo', 'foobar')]
696697
"""
697-
pairs_all: list[tuple[str, str]] = list(pairs_all)
698+
pairs_all = list(pairs_all)
698699
seen: set[tuple[str, str]] = set()
699700
others = [x for x in pairs_all if x not in pairs]
700701
res: list[tuple[str, str]] = []

0 commit comments

Comments
 (0)