Das Argument "Attribute" zu "sauber" hat einen inkompatiblen Typ [arg-Typ] [geschlossen]
Posted: 01 Feb 2025, 10:11
Code: Select all
import bleach
a = {
'a': True,
'b': ['text'],
'c': []
}
b = a.copy();
bleach.clean( # line 11
'string', tags=tag_names, attributes=b, strip=True)
< /code>
Aus Zeile 11 < /p>
Argument "Attribute" zu "Clean" hat inkompatibler Typ "dict [str,
Union [bool, list [str]]] "; Erwartete "Union [Callable [[Str, str, str],
bool], Union [dict [str, Union [List [Str], Callable [[Str, Str, Str],
bool] ]], dict [str, list [str]], dict [str, Callable [[str, str, str],
bool]], list [str]] "[arg-type] < /p >
Hier ist Bleach https://pypi.org/project/bleach/
In Stubs -Attributen
_AttributeDict: TypeAlias = dict[str, list[str] | _AttributeFilter] | dict[str, list[str]] | dict[str, _AttributeFilter]
_Attributes: TypeAlias = _AttributeFilter | _AttributeDict | list[str]
[/code]
Wie soll ich die Annotate -Variable a ?