MCPcopy
hub / github.com/beetbox/beets / wrapper

Function wrapper

beets/metadata_plugins.py:89–108  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

87
88 @wraps(func)
89 def wrapper(*args, **kwargs) -> Iterator[Ret]:
90 # Run plugin methods concurrently for faster I/O-bound lookups.
91 with ThreadPoolExecutor() as executor:
92 futures = {
93 executor.submit(
94 # Evaluate iterator with list such that results are ready when
95 # future.result() is called.
96 materialize,
97 plugin,
98 method_name,
99 *args,
100 **kwargs,
101 ): plugin
102 for plugin in find_metadata_source_plugins()
103 }
104
105 for future in as_completed(futures):
106 plugin = futures[future]
107 with maybe_handle_plugin_error(plugin, method_name):
108 yield from filter(None, future.result())
109
110 return wrapper
111

Callers

nothing calls this directly

Calls 3

submitMethod · 0.80

Tested by

no test coverage detected