diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2021-10-07 18:41:56 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2021-10-07 18:41:56 +0200 |
commit | 5731b6b700f648bef71fc217a2ae3911d26790f4 (patch) | |
tree | b9b6793169b589ef0457ebd010bb190fe0160576 /searx/plugins | |
parent | aa5a5147b2a9c08f84c29a8bd2707bd0f170b3d8 (diff) | |
download | searxng-5731b6b700f648bef71fc217a2ae3911d26790f4.tar.gz searxng-5731b6b700f648bef71fc217a2ae3911d26790f4.zip |
[mod] searx.plugins.prepare_package_resources() - use generators
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/plugins')
-rw-r--r-- | searx/plugins/__init__.py | 28 |
1 files 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: |