1- from typing import Any , Callable , Container , Dict , Iterable , List , Pattern , Text , Union
1+ from collections .abc import Callable , Container , Iterable
2+ from typing import Any , Dict , List , Pattern , Union
23
34from .html5lib_shim import BleachHTMLParser , BleachHTMLSerializer , SanitizerFilter
45
5- ALLOWED_TAGS : list [Text ]
6- ALLOWED_ATTRIBUTES : dict [Text , list [Text ]]
7- ALLOWED_STYLES : list [Text ]
8- ALLOWED_PROTOCOLS : list [Text ]
6+ ALLOWED_TAGS : list [str ]
7+ ALLOWED_ATTRIBUTES : dict [str , list [str ]]
8+ ALLOWED_STYLES : list [str ]
9+ ALLOWED_PROTOCOLS : list [str ]
910
10- INVISIBLE_CHARACTERS : Text
11- INVISIBLE_CHARACTERS_RE : Pattern [Text ]
12- INVISIBLE_REPLACEMENT_CHAR : Text
11+ INVISIBLE_CHARACTERS : str
12+ INVISIBLE_CHARACTERS_RE : Pattern [str ]
13+ INVISIBLE_REPLACEMENT_CHAR : str
1314
1415# A html5lib Filter class
1516_Filter = Any
1617
1718class Cleaner (object ):
18- tags : Container [Text ]
19+ tags : Container [str ]
1920 attributes : _Attributes
20- styles : Container [Text ]
21- protocols : Container [Text ]
21+ styles : Container [str ]
22+ protocols : Container [str ]
2223 strip : bool
2324 strip_comments : bool
2425 filters : Iterable [_Filter ]
@@ -27,19 +28,19 @@ class Cleaner(object):
2728 serializer : BleachHTMLSerializer
2829 def __init__ (
2930 self ,
30- tags : Container [Text ] = ...,
31+ tags : Container [str ] = ...,
3132 attributes : _Attributes = ...,
32- styles : Container [Text ] = ...,
33- protocols : Container [Text ] = ...,
33+ styles : Container [str ] = ...,
34+ protocols : Container [str ] = ...,
3435 strip : bool = ...,
3536 strip_comments : bool = ...,
3637 filters : Iterable [_Filter ] | None = ...,
3738 ) -> None : ...
38- def clean (self , text : Text ) -> Text : ...
39+ def clean (self , text : str ) -> str : ...
3940
40- _AttributeFilter = Callable [[Text , Text , Text ], bool ]
41- _AttributeDict = Union [Dict [Text , Union [List [Text ], _AttributeFilter ]], Dict [Text , List [Text ]], Dict [Text , _AttributeFilter ]]
42- _Attributes = Union [_AttributeFilter , _AttributeDict , List [Text ]]
41+ _AttributeFilter = Callable [[str , str , str ], bool ]
42+ _AttributeDict = Union [Dict [str , Union [List [str ], _AttributeFilter ]], Dict [str , List [str ]], Dict [str , _AttributeFilter ]]
43+ _Attributes = Union [_AttributeFilter , _AttributeDict , List [str ]]
4344
4445def attribute_filter_factory (attributes : _Attributes ) -> _AttributeFilter : ...
4546
0 commit comments