Das Argument "Attribute" zu "sauber" hat einen inkompatiblen Typ [arg-Typ] [geschlossen]Python

Python-Programme
Anonymous
 Das Argument "Attribute" zu "sauber" hat einen inkompatiblen Typ [arg-Typ] [geschlossen]

Post by Anonymous »

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 
Wert Es wird erwartet, dass er _attributes entspricht (Quelle: https://github.com/python/typeshed/blob ... buteFilter: TypeAlias = Callable[[str, str, str], bool]
_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 ?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post