stubs: [BeautifulSoup] fix incomplete type specs for formatter (#11885)

This commit is contained in:
Kanishk Pachauri
2024-05-10 14:15:44 +05:30
committed by GitHub
parent 38569b6bb4
commit 864dee36fb

View File

@@ -1,7 +1,7 @@
from _typeshed import Incomplete, ReadableBuffer
from collections.abc import Callable, Iterable, Iterator
from re import Pattern
from typing import Any, TypeVar, overload
from typing import Any, Literal, TypeVar, overload
from typing_extensions import Self, TypeAlias
from . import BeautifulSoup
@@ -295,25 +295,33 @@ class Tag(PageElement):
self,
encoding: str = "utf-8",
indent_level: int | None = None,
formatter: str | Formatter = "minimal",
formatter: Literal["html", "html5", "minimal"] | Formatter | None = "minimal",
errors: str = "xmlcharrefreplace",
) -> bytes: ...
def decode(
self,
indent_level: int | None = None,
eventual_encoding: str = "utf-8",
formatter: str | Formatter = "minimal",
formatter: Literal["html", "html5", "minimal"] | Formatter | None = "minimal",
iterator: Iterator[PageElement] | None = None,
) -> str: ...
@overload
def prettify(self, encoding: str, formatter: str | Formatter = "minimal") -> bytes: ...
def prettify(self, encoding: str, formatter: Literal["html", "html5", "minimal"] | Formatter | None = "minimal") -> bytes: ...
@overload
def prettify(self, encoding: None = None, formatter: str | Formatter = "minimal") -> str: ...
def prettify(
self, encoding: None = None, formatter: Literal["html", "html5", "minimal"] | Formatter | None = "minimal"
) -> str: ...
def decode_contents(
self, indent_level: int | None = None, eventual_encoding: str = "utf-8", formatter: str | Formatter = "minimal"
self,
indent_level: int | None = None,
eventual_encoding: str = "utf-8",
formatter: Literal["html", "html5", "minimal"] | Formatter | None = "minimal",
) -> str: ...
def encode_contents(
self, indent_level: int | None = None, encoding: str = "utf-8", formatter: str | Formatter = "minimal"
self,
indent_level: int | None = None,
encoding: str = "utf-8",
formatter: Literal["html", "html5", "minimal"] | Formatter | None = "minimal",
) -> bytes: ...
def renderContents(self, encoding: str = "utf-8", prettyPrint: bool = False, indentLevel: int = 0) -> bytes: ...
def find(