[mod] comprehensive revision of the searxng_extra/update/ scripts

- pylint all scripts
- fix some errors reported by pyright
- from searx.data import data_dir (Path.open)
- fix import from pygments.formatters.html

NOTE: none functional changes!

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2024-03-10 15:33:23 +01:00 committed by Markus Heiser
parent 0ffec440b2
commit ce4aaf6cad
10 changed files with 51 additions and 61 deletions

View file

@ -1,14 +1,16 @@
#!/usr/bin/env python
# lint: pylint
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Update pygments style
Call this script after each upgrade of pygments
"""
# pylint: disable=too-few-public-methods
from pathlib import Path
import pygments
from pygments.formatters import HtmlFormatter
from pygments.formatters.html import HtmlFormatter
from searx import searx_dir
@ -41,7 +43,7 @@ END_DARK_THEME = """
"""
class Formatter(HtmlFormatter):
class Formatter(HtmlFormatter): # pylint: disable=missing-class-docstring
@property
def _pre_style(self):
return 'line-height: 100%;'
@ -67,5 +69,5 @@ def generat_css(light_style, dark_style) -> str:
if __name__ == '__main__':
print("update: %s" % LESS_FILE)
with open(LESS_FILE, 'w') as f:
with LESS_FILE.open('w', encoding='utf8') as f:
f.write(generat_css('default', 'lightbulb'))