comparison libervia/backend/plugins/plugin_misc_text_syntaxes.py @ 4380:2e3ce128973c

minor type update and unused import removal.
author Goffi <goffi@goffi.org>
date Fri, 04 Jul 2025 12:28:40 +0200
parents 111dce64dcb5
children
comparison
equal deleted inserted replaced
4379:79d463e3fdeb 4380:2e3ce128973c
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 from functools import partial 20 from functools import partial
21 from html import escape 21 from html import escape
22 import re 22 import re
23 from typing import Set
24 23
25 from twisted.internet import defer 24 from twisted.internet import defer
26 from twisted.internet.threads import deferToThread 25 from twisted.internet.threads import deferToThread
27 26
28 from libervia.backend.core import exceptions 27 from libervia.backend.core import exceptions
377 376
378 Remove styles not in the whitelist, or where the value doesn't match the regex 377 Remove styles not in the whitelist, or where the value doesn't match the regex
379 @param styles_raw: CSS styles 378 @param styles_raw: CSS styles
380 @return: cleaned styles 379 @return: cleaned styles
381 """ 380 """
382 styles: List[str] = styles_raw.split(";") 381 styles: list[str] = styles_raw.split(";")
383 cleaned_styles = [] 382 cleaned_styles = []
384 for style in styles: 383 for style in styles:
385 try: 384 try:
386 key, value = style.split(":") 385 key, value = style.split(":")
387 except ValueError: 386 except ValueError: