mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-07 18:30:57 +08:00
Re-organize directory structure (#4971)
See discussion in #2491 Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
This commit is contained in:
2
stubs/bleach/METADATA.toml
Normal file
2
stubs/bleach/METADATA.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
version = "0.1"
|
||||
python2 = true
|
||||
27
stubs/bleach/bleach/__init__.pyi
Normal file
27
stubs/bleach/bleach/__init__.pyi
Normal file
@@ -0,0 +1,27 @@
|
||||
from typing import Any, Container, Iterable, Optional, Text
|
||||
|
||||
from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS, Linker as Linker, _Callback
|
||||
from bleach.sanitizer import (
|
||||
ALLOWED_ATTRIBUTES as ALLOWED_ATTRIBUTES,
|
||||
ALLOWED_PROTOCOLS as ALLOWED_PROTOCOLS,
|
||||
ALLOWED_STYLES as ALLOWED_STYLES,
|
||||
ALLOWED_TAGS as ALLOWED_TAGS,
|
||||
Cleaner as Cleaner,
|
||||
)
|
||||
|
||||
__releasedate__: Text
|
||||
__version__: Text
|
||||
VERSION: Any # packaging.version.Version
|
||||
|
||||
def clean(
|
||||
text: Text,
|
||||
tags: Container[Text] = ...,
|
||||
attributes: Any = ...,
|
||||
styles: Container[Text] = ...,
|
||||
protocols: Container[Text] = ...,
|
||||
strip: bool = ...,
|
||||
strip_comments: bool = ...,
|
||||
) -> Text: ...
|
||||
def linkify(
|
||||
text: Text, callbacks: Iterable[_Callback] = ..., skip_tags: Optional[Container[Text]] = ..., parse_email: bool = ...
|
||||
) -> Text: ...
|
||||
6
stubs/bleach/bleach/callbacks.pyi
Normal file
6
stubs/bleach/bleach/callbacks.pyi
Normal file
@@ -0,0 +1,6 @@
|
||||
from typing import Any, MutableMapping, Text
|
||||
|
||||
_Attrs = MutableMapping[Any, Text]
|
||||
|
||||
def nofollow(attrs: _Attrs, new: bool = ...) -> _Attrs: ...
|
||||
def target_blank(attrs: _Attrs, new: bool = ...) -> _Attrs: ...
|
||||
31
stubs/bleach/bleach/linkifier.pyi
Normal file
31
stubs/bleach/bleach/linkifier.pyi
Normal file
@@ -0,0 +1,31 @@
|
||||
from typing import Any, Container, Iterable, List, MutableMapping, Optional, Pattern, Protocol, Text
|
||||
|
||||
_Attrs = MutableMapping[Any, Text]
|
||||
|
||||
class _Callback(Protocol):
|
||||
def __call__(self, attrs: _Attrs, new: bool = ...) -> _Attrs: ...
|
||||
|
||||
DEFAULT_CALLBACKS: List[_Callback]
|
||||
|
||||
TLDS: List[Text]
|
||||
|
||||
def build_url_re(tlds: Iterable[Text] = ..., protocols: Iterable[Text] = ...) -> Pattern[Text]: ...
|
||||
|
||||
URL_RE: Pattern[Text]
|
||||
PROTO_RE: Pattern[Text]
|
||||
EMAIL_RE: Pattern[Text]
|
||||
|
||||
class Linker(object):
|
||||
def __init__(
|
||||
self,
|
||||
callbacks: Iterable[_Callback] = ...,
|
||||
skip_tags: Optional[Container[Text]] = ...,
|
||||
parse_email: bool = ...,
|
||||
url_re: Pattern[Text] = ...,
|
||||
email_re: Pattern[Text] = ...,
|
||||
recognized_tags: Optional[Container[Text]] = ...,
|
||||
) -> None: ...
|
||||
def linkify(self, text: Text) -> Text: ...
|
||||
|
||||
class LinkifyFilter(object): # TODO: derives from html5lib.Filter
|
||||
def __getattr__(self, item: str) -> Any: ... # incomplete
|
||||
34
stubs/bleach/bleach/sanitizer.pyi
Normal file
34
stubs/bleach/bleach/sanitizer.pyi
Normal file
@@ -0,0 +1,34 @@
|
||||
from typing import Any, Callable, Container, Dict, Iterable, List, Optional, Pattern, Text, Union
|
||||
|
||||
ALLOWED_TAGS: List[Text]
|
||||
ALLOWED_ATTRIBUTES: Dict[Text, List[Text]]
|
||||
ALLOWED_STYLES: List[Text]
|
||||
ALLOWED_PROTOCOLS: List[Text]
|
||||
|
||||
INVISIBLE_CHARACTERS: Text
|
||||
INVISIBLE_CHARACTERS_RE: Pattern[Text]
|
||||
INVISIBLE_REPLACEMENT_CHAR: Text
|
||||
|
||||
# A html5lib Filter class
|
||||
_Filter = Any
|
||||
|
||||
class Cleaner(object):
|
||||
def __init__(
|
||||
self,
|
||||
tags: Container[Text] = ...,
|
||||
attributes: Any = ...,
|
||||
styles: Container[Text] = ...,
|
||||
protocols: Container[Text] = ...,
|
||||
strip: bool = ...,
|
||||
strip_comments: bool = ...,
|
||||
filters: Optional[Iterable[_Filter]] = ...,
|
||||
) -> None: ...
|
||||
def clean(self, text: Text) -> Text: ...
|
||||
|
||||
_AttributeFilter = Callable[[Text, Text, Text], bool]
|
||||
_AttributeDict = Dict[Text, Union[Container[Text], _AttributeFilter]]
|
||||
|
||||
def attribute_filter_factory(attributes: Union[_AttributeFilter, _AttributeDict, Container[Text]]) -> _AttributeFilter: ...
|
||||
|
||||
class BleachSanitizerFilter(object): # TODO: derives from html5lib.sanitizer.Filter
|
||||
def __getattr__(self, item: str) -> Any: ... # incomplete
|
||||
8
stubs/bleach/bleach/utils.pyi
Normal file
8
stubs/bleach/bleach/utils.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
from collections import OrderedDict
|
||||
from typing import Any, Mapping, Text, overload
|
||||
|
||||
def force_unicode(text: Text) -> Text: ...
|
||||
@overload
|
||||
def alphabetize_attributes(attrs: None) -> None: ...
|
||||
@overload
|
||||
def alphabetize_attributes(attrs: Mapping[Any, Text]) -> OrderedDict[Any, Text]: ...
|
||||
Reference in New Issue
Block a user