diff --git a/odoo-stubs/tools/mail.pyi b/odoo-stubs/tools/mail.pyi index 25ff0fe..3b772bf 100644 --- a/odoo-stubs/tools/mail.pyi +++ b/odoo-stubs/tools/mail.pyi @@ -1,50 +1,55 @@ -from lxml.html import clean -from typing import Any +from email.message import Message +from re import Pattern +from typing import FrozenSet, Literal -_logger: Any -tags_to_kill: Any -tags_to_remove: Any -allowed_tags: Any -safe_attrs: Any +from lxml.etree import _Element +from lxml.html import clean +from markupsafe import Markup + +tags_to_kill: list[str] +tags_to_remove: list[str] +allowed_tags: FrozenSet +safe_attrs: FrozenSet class _Cleaner(clean.Cleaner): - _style_re: Any - _style_whitelist: Any + _style_re: Pattern + _style_whitelist: list[str] strip_classes: bool sanitize_style: bool - def __call__(self, doc) -> None: ... - def tag_quote(self, el): ... - def strip_class(self, el) -> None: ... - def parse_style(self, el) -> None: ... + def __call__(self, doc: _Element) -> None: ... + def tag_quote(self, el: _Element) -> None: ... + def strip_class(self, el: _Element) -> None: ... + def parse_style(self, el: _Element) -> None: ... -def html_sanitize(src, silent: bool = ..., sanitize_tags: bool = ..., sanitize_attributes: bool = ..., sanitize_style: bool = ..., sanitize_form: bool = ..., strip_style: bool = ..., strip_classes: bool = ...): ... +def html_sanitize(src: str, silent: bool = ..., sanitize_tags: bool = ..., sanitize_attributes: bool = ..., sanitize_style: bool = ..., + sanitize_form: bool = ..., strip_style: bool = ..., strip_classes: bool = ...) -> Markup: ... URL_REGEX: str TEXT_URL_REGEX: str -HTML_TAG_URL_REGEX: Any +HTML_TAG_URL_REGEX: str -def validate_url(url): ... -def is_html_empty(html_content): ... -def html_keep_url(text): ... -def html2plaintext(html, body_id: Any | None = ..., encoding: str = ...): ... -def plaintext2html(text, container_tag: bool = ...): ... -def append_content_to_html(html, content, plaintext: bool = ..., preserve: bool = ..., container_tag: bool = ...): ... -def prepend_html_content(html_body, html_content): ... +def validate_url(url: str) -> str: ... +def is_html_empty(html_content: str) -> bool: ... +def html_keep_url(text: str) -> str: ... +def html2plaintext(html: str, body_id: str | None = ..., encoding: str = ...) -> str: ... +def plaintext2html(text: str, container_tag: str = ...) -> Markup: ... +def append_content_to_html(html: str, content: str, plaintext: bool = ..., preserve: bool = ..., container_tag: str = ...) -> Markup: ... +def prepend_html_content(html_body: str, html_content: str) -> str: ... -email_re: Any -single_email_re: Any -mail_header_msgid_re: Any -email_addr_escapes_re: Any +email_re: Pattern +single_email_re: Pattern +mail_header_msgid_re: Pattern +email_addr_escapes_re: Pattern -def generate_tracking_message_id(res_id): ... -def email_split_tuples(text): ... -def email_split(text): ... -def email_split_and_format(text): ... -def email_normalize(text): ... -def email_domain_extract(email): ... -def email_domain_normalize(domain): ... -def url_domain_extract(url): ... -def email_escape_char(email_address): ... -def decode_message_header(message, header, separator: str = ...): ... -def formataddr(pair, charset: str = ...): ... -def encapsulate_email(old_email, new_email): ... +def generate_tracking_message_id(res_id: str) -> str: ... +def email_split_tuples(text: str) -> list[str]: ... +def email_split(text: str) -> list[str]: ... +def email_split_and_format(text: str) -> list[str]: ... +def email_normalize(text: str) -> str | Literal[False]: ... +def email_domain_extract(email: str) -> str | Literal[False]: ... +def email_domain_normalize(domain: str) -> str | Literal[False]: ... +def url_domain_extract(url: str) -> str | Literal[False]: ... +def email_escape_char(email_address: str) -> str: ... +def decode_message_header(message: Message, header: str, separator: str = ...) -> str: ... +def formataddr(pair: tuple[str, str], charset: str = ...) -> str: ... +def encapsulate_email(old_email: str, new_email: str) -> str: ...