From 5731b6b700f648bef71fc217a2ae3911d26790f4 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Thu, 7 Oct 2021 18:41:56 +0200 Subject: [PATCH] [mod] searx.plugins.prepare_package_resources() - use generators Signed-off-by: Markus Heiser --- searx/plugins/__init__.py | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/searx/plugins/__init__.py b/searx/plugins/__init__.py index dd18ff3d5..91636fe33 100644 --- a/searx/plugins/__init__.py +++ b/searx/plugins/__init__.py @@ -59,7 +59,6 @@ def sync_resource(base_path, resource_path, name, target_dir, plugin_dir): def prepare_package_resources(plugin, plugin_module_name): - # pylint: disable=consider-using-generator plugin_base_path = dirname(abspath(plugin.__file__)) plugin_dir = plugin_module_name @@ -80,24 +79,19 @@ def prepare_package_resources(plugin, plugin_module_name): if hasattr(plugin, "js_dependencies"): resources.extend(map(basename, plugin.js_dependencies)) - plugin.js_dependencies = tuple( - [ - sync_resource( - plugin_base_path, x, plugin_module_name, target_dir, plugin_dir - ) - for x in plugin.js_dependencies - ] - ) + plugin.js_dependencies = ([ + sync_resource( + plugin_base_path, x, plugin_module_name, target_dir, plugin_dir + ) for x in plugin.js_dependencies + ]) + if hasattr(plugin, "css_dependencies"): resources.extend(map(basename, plugin.css_dependencies)) - plugin.css_dependencies = tuple( - [ - sync_resource( - plugin_base_path, x, plugin_module_name, target_dir, plugin_dir - ) - for x in plugin.css_dependencies - ] - ) + plugin.css_dependencies = ([ + sync_resource( + plugin_base_path, x, plugin_module_name, target_dir, plugin_dir + ) for x in plugin.css_dependencies + ]) for f in listdir(target_dir): if basename(f) not in resources: