from collections.abc import Callable
from typing import Any
import re

from bs4 import BeautifulSoup, NavigableString, Tag

ALLOWED_URL_SCHEMES: list[str]
PROTOCOL_RE: re.Pattern[str]

def check_url(url_string: str) -> str | None: ...
def attribute_rule(allowed_attrs: dict[str, Any]) -> Callable[[Tag], None]: ...

allow_without_attributes: Callable[[Tag], None]
DEFAULT_ELEMENT_RULES: dict[str, Callable[[Tag], None]]

class Whitelister:
    element_rules: dict[str, Callable[[Tag], None]]
    def clean(self, html: str) -> str: ...
    def clean_node(self, doc: BeautifulSoup, node: Any) -> None: ...
    def clean_string_node(self, doc: BeautifulSoup, node: NavigableString) -> None: ...
    def clean_tag_node(self, doc: BeautifulSoup, tag: Tag) -> None: ...
    def clean_unknown_node(self, doc: BeautifulSoup, node: Any) -> None: ...
