diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index a3f072fae..99c331272 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -27,7 +27,6 @@ "stubs/auth0-python", "stubs/Authlib", "stubs/aws-xray-sdk", - "stubs/beautifulsoup4", "stubs/boltons", "stubs/braintree", "stubs/cffi", diff --git a/stubs/beautifulsoup4/METADATA.toml b/stubs/beautifulsoup4/METADATA.toml deleted file mode 100644 index b2eb4a77b..000000000 --- a/stubs/beautifulsoup4/METADATA.toml +++ /dev/null @@ -1,9 +0,0 @@ -version = "4.12.*" -upstream_repository = "https://git.launchpad.net/beautifulsoup/tree" -requires = ["types-html5lib"] -partial_stub = true -obsolete_since = "4.13.0" # Released on 2025-02-02 - -[tool.stubtest] -ignore_missing_stub = true -extras = ["html5lib", "lxml"] diff --git a/stubs/beautifulsoup4/bs4/__init__.pyi b/stubs/beautifulsoup4/bs4/__init__.pyi deleted file mode 100644 index 2bbbfc78d..000000000 --- a/stubs/beautifulsoup4/bs4/__init__.pyi +++ /dev/null @@ -1,82 +0,0 @@ -from _typeshed import SupportsRead -from collections.abc import Iterator, Sequence -from typing import Any -from typing_extensions import Self - -from .builder import ParserRejectedMarkup as ParserRejectedMarkup, TreeBuilder, XMLParsedAsHTMLWarning as XMLParsedAsHTMLWarning -from .element import ( - CData as CData, - Comment as Comment, - Declaration as Declaration, - Doctype as Doctype, - NavigableString as NavigableString, - PageElement as PageElement, - ProcessingInstruction as ProcessingInstruction, - ResultSet as ResultSet, - Script as Script, - SoupStrainer as SoupStrainer, - Stylesheet as Stylesheet, - Tag as Tag, - TemplateString as TemplateString, -) -from .formatter import Formatter - -class GuessedAtParserWarning(UserWarning): ... -class MarkupResemblesLocatorWarning(UserWarning): ... - -class BeautifulSoup(Tag): - ROOT_TAG_NAME: str - DEFAULT_BUILDER_FEATURES: list[str] - ASCII_SPACES: str - NO_PARSER_SPECIFIED_WARNING: str - element_classes: Any - builder: TreeBuilder - is_xml: bool - known_xml: bool | None - parse_only: SoupStrainer | None - markup: str - def __init__( - self, - markup: str | bytes | SupportsRead[str] | SupportsRead[bytes] = "", - features: str | Sequence[str] | None = None, - builder: TreeBuilder | type[TreeBuilder] | None = None, - parse_only: SoupStrainer | None = None, - from_encoding: str | None = None, - exclude_encodings: Sequence[str] | None = None, - element_classes: dict[type[PageElement], type[Any]] | None = None, - **kwargs, - ) -> None: ... - def __copy__(self) -> Self: ... - hidden: bool - current_data: Any - currentTag: Any - tagStack: Any - open_tag_counter: Any - preserve_whitespace_tag_stack: Any - string_container_stack: Any - def reset(self) -> None: ... - def new_tag(self, name, namespace=None, nsprefix=None, attrs={}, sourceline=None, sourcepos=None, **kwattrs) -> Tag: ... - def string_container(self, base_class=None): ... - def new_string(self, s, subclass=None): ... - def insert_before(self, *args) -> None: ... - def insert_after(self, *args) -> None: ... - def popTag(self): ... - def pushTag(self, tag) -> None: ... - def endData(self, containerClass=None) -> None: ... - def object_was_parsed(self, o, parent=None, most_recent_element=None) -> None: ... - def handle_starttag( - self, name, namespace, nsprefix, attrs, sourceline=None, sourcepos=None, namespaces: dict[str, str] | None = None - ): ... - def handle_endtag(self, name, nsprefix=None) -> None: ... - def handle_data(self, data) -> None: ... - def decode( # type: ignore[override] - self, - pretty_print: bool = False, - eventual_encoding: str = "utf-8", - formatter: str | Formatter = "minimal", - iterator: Iterator[PageElement] | None = None, - ): ... # missing some arguments - -class BeautifulStoneSoup(BeautifulSoup): ... -class StopParsing(Exception): ... -class FeatureNotFound(ValueError): ... diff --git a/stubs/beautifulsoup4/bs4/builder/__init__.pyi b/stubs/beautifulsoup4/bs4/builder/__init__.pyi deleted file mode 100644 index 0399fb520..000000000 --- a/stubs/beautifulsoup4/bs4/builder/__init__.pyi +++ /dev/null @@ -1,64 +0,0 @@ -from typing import Any - -class TreeBuilderRegistry: - builders_for_feature: Any - builders: Any - def __init__(self) -> None: ... - def register(self, treebuilder_class) -> None: ... - def lookup(self, *features): ... - -class TreeBuilder: - NAME: str - ALTERNATE_NAMES: Any - features: Any - is_xml: bool - picklable: bool - empty_element_tags: Any - DEFAULT_CDATA_LIST_ATTRIBUTES: Any - DEFAULT_PRESERVE_WHITESPACE_TAGS: Any - DEFAULT_STRING_CONTAINERS: Any - USE_DEFAULT: Any - TRACKS_LINE_NUMBERS: bool - soup: Any - cdata_list_attributes: Any - preserve_whitespace_tags: Any - store_line_numbers: Any - string_containers: Any - def __init__( - self, multi_valued_attributes=..., preserve_whitespace_tags=..., store_line_numbers=..., string_containers=... - ) -> None: ... - def initialize_soup(self, soup) -> None: ... - def reset(self) -> None: ... - def can_be_empty_element(self, tag_name): ... - def feed(self, markup) -> None: ... - def prepare_markup( - self, markup, user_specified_encoding=None, document_declared_encoding=None, exclude_encodings=None - ) -> None: ... - def test_fragment_to_document(self, fragment): ... - def set_up_substitutions(self, tag): ... - -class SAXTreeBuilder(TreeBuilder): - def feed(self, markup) -> None: ... - def close(self) -> None: ... - def startElement(self, name, attrs) -> None: ... - def endElement(self, name) -> None: ... - def startElementNS(self, nsTuple, nodeName, attrs) -> None: ... - def endElementNS(self, nsTuple, nodeName) -> None: ... - def startPrefixMapping(self, prefix, nodeValue) -> None: ... - def endPrefixMapping(self, prefix) -> None: ... - def characters(self, content) -> None: ... - def startDocument(self) -> None: ... - def endDocument(self) -> None: ... - -class HTMLTreeBuilder(TreeBuilder): - empty_element_tags: Any - block_elements: Any - DEFAULT_STRING_CONTAINERS: Any - DEFAULT_CDATA_LIST_ATTRIBUTES: Any - DEFAULT_PRESERVE_WHITESPACE_TAGS: Any - def set_up_substitutions(self, tag): ... - -class ParserRejectedMarkup(Exception): - def __init__(self, message_or_exception) -> None: ... - -class XMLParsedAsHTMLWarning(UserWarning): ... diff --git a/stubs/beautifulsoup4/bs4/builder/_html5lib.pyi b/stubs/beautifulsoup4/bs4/builder/_html5lib.pyi deleted file mode 100644 index 412d1afa7..000000000 --- a/stubs/beautifulsoup4/bs4/builder/_html5lib.pyi +++ /dev/null @@ -1,76 +0,0 @@ -from _typeshed import Incomplete -from typing import Any - -from bs4.builder import HTMLTreeBuilder -from html5lib.treebuilders import base as treebuilder_base - -class HTML5TreeBuilder(HTMLTreeBuilder): - NAME: str - features: Any - TRACKS_LINE_NUMBERS: bool - user_specified_encoding: Any - def prepare_markup( # type: ignore[override] # user_specified_encoding doesn't have a default - self, - markup, - user_specified_encoding, - document_declared_encoding: Incomplete | None = ..., - exclude_encodings: Incomplete | None = ..., - ) -> None: ... - def feed(self, markup) -> None: ... - underlying_builder: Any - def create_treebuilder(self, namespaceHTMLElements): ... - def test_fragment_to_document(self, fragment): ... - -class TreeBuilderForHtml5lib(treebuilder_base.TreeBuilder): - soup: Any - parser: Any - store_line_numbers: Any - def __init__( - self, namespaceHTMLElements, soup: Incomplete | None = ..., store_line_numbers: bool = ..., **kwargs - ) -> None: ... - def documentClass(self): ... - def insertDoctype(self, token) -> None: ... - def elementClass(self, name, namespace): ... - def commentClass(self, data): ... - def fragmentClass(self): ... - def appendChild(self, node) -> None: ... - def getDocument(self): ... - def getFragment(self): ... - def testSerializer(self, element): ... - -class AttrList: - element: Any - attrs: Any - def __init__(self, element) -> None: ... - def __iter__(self): ... - def __setitem__(self, name, value) -> None: ... - def items(self): ... - def keys(self): ... - def __len__(self) -> int: ... - def __getitem__(self, name): ... - def __contains__(self, name): ... - -class Element(treebuilder_base.Node): - element: Any - soup: Any - namespace: Any - def __init__(self, element, soup, namespace) -> None: ... - def appendChild(self, node) -> None: ... - def getAttributes(self): ... - def setAttributes(self, attributes) -> None: ... - attributes: Any - def insertText(self, data, insertBefore: Incomplete | None = ...) -> None: ... - def insertBefore(self, node, refNode) -> None: ... - def removeChild(self, node) -> None: ... - def reparentChildren(self, new_parent) -> None: ... - def cloneNode(self): ... - def hasContent(self): ... - def getNameTuple(self): ... - @property - def nameTuple(self): ... - -class TextNode(Element): - element: Any - soup: Any - def __init__(self, element, soup) -> None: ... - def cloneNode(self) -> None: ... diff --git a/stubs/beautifulsoup4/bs4/builder/_htmlparser.pyi b/stubs/beautifulsoup4/bs4/builder/_htmlparser.pyi deleted file mode 100644 index fc912e5ee..000000000 --- a/stubs/beautifulsoup4/bs4/builder/_htmlparser.pyi +++ /dev/null @@ -1,34 +0,0 @@ -from html.parser import HTMLParser -from typing import Any - -from bs4.builder import HTMLTreeBuilder - -class BeautifulSoupHTMLParser(HTMLParser): - IGNORE: str - REPLACE: str - on_duplicate_attribute: Any - already_closed_empty_element: Any - def __init__(self, *args, **kwargs) -> None: ... - def handle_startendtag(self, name, attrs) -> None: ... - def handle_starttag(self, name, attrs, handle_empty_element: bool = True) -> None: ... - def handle_endtag(self, name, check_already_closed: bool = True) -> None: ... - def handle_data(self, data) -> None: ... - def handle_charref(self, name) -> None: ... - def handle_entityref(self, name) -> None: ... - def handle_comment(self, data) -> None: ... - def handle_decl(self, data) -> None: ... - def unknown_decl(self, data) -> None: ... - def handle_pi(self, data) -> None: ... - -class HTMLParserTreeBuilder(HTMLTreeBuilder): - is_xml: bool - picklable: bool - NAME: Any - features: Any - TRACKS_LINE_NUMBERS: bool - parser_args: Any - def __init__(self, parser_args=None, parser_kwargs=None, **kwargs) -> None: ... - def prepare_markup( - self, markup, user_specified_encoding=None, document_declared_encoding=None, exclude_encodings=None - ) -> None: ... - def feed(self, markup) -> None: ... diff --git a/stubs/beautifulsoup4/bs4/builder/_lxml.pyi b/stubs/beautifulsoup4/bs4/builder/_lxml.pyi deleted file mode 100644 index 849088929..000000000 --- a/stubs/beautifulsoup4/bs4/builder/_lxml.pyi +++ /dev/null @@ -1,45 +0,0 @@ -from typing import Any - -from bs4.builder import HTMLTreeBuilder, TreeBuilder - -class LXMLTreeBuilderForXML(TreeBuilder): - DEFAULT_PARSER_CLASS: Any - is_xml: bool - processing_instruction_class: Any - NAME: str - ALTERNATE_NAMES: Any - features: Any - CHUNK_SIZE: int - DEFAULT_NSMAPS: Any - DEFAULT_NSMAPS_INVERTED: Any - def initialize_soup(self, soup) -> None: ... - def default_parser(self, encoding): ... - def parser_for(self, encoding): ... - empty_element_tags: Any - soup: Any - nsmaps: Any - def __init__(self, parser=None, empty_element_tags=None, **kwargs) -> None: ... - def prepare_markup( # type: ignore[override] # the order of the parameters is different - self, markup, user_specified_encoding=None, exclude_encodings=None, document_declared_encoding=None - ) -> None: ... - parser: Any - def feed(self, markup) -> None: ... - def close(self) -> None: ... - def start(self, name, attrs, nsmap={}) -> None: ... - def end(self, name) -> None: ... - def pi(self, target, data) -> None: ... - def data(self, content) -> None: ... - def doctype(self, name, pubid, system) -> None: ... - def comment(self, content) -> None: ... - def test_fragment_to_document(self, fragment): ... - -class LXMLTreeBuilder(HTMLTreeBuilder, LXMLTreeBuilderForXML): - NAME: Any - ALTERNATE_NAMES: Any - features: Any - is_xml: bool - processing_instruction_class: Any - def default_parser(self, encoding): ... - parser: Any - def feed(self, markup) -> None: ... - def test_fragment_to_document(self, fragment): ... diff --git a/stubs/beautifulsoup4/bs4/dammit.pyi b/stubs/beautifulsoup4/bs4/dammit.pyi deleted file mode 100644 index 0a63da49f..000000000 --- a/stubs/beautifulsoup4/bs4/dammit.pyi +++ /dev/null @@ -1,85 +0,0 @@ -from _typeshed import Incomplete -from collections.abc import Iterable, Iterator -from logging import Logger -from typing import Any, Literal - -def chardet_dammit(s): ... - -xml_encoding: str -html_meta: str -encoding_res: Any - -class EntitySubstitution: - CHARACTER_TO_HTML_ENTITY: Any - HTML_ENTITY_TO_CHARACTER: Any - CHARACTER_TO_HTML_ENTITY_RE: Any - CHARACTER_TO_XML_ENTITY: Any - BARE_AMPERSAND_OR_BRACKET: Any - AMPERSAND_OR_BRACKET: Any - @classmethod - def quoted_attribute_value(cls, value): ... - @classmethod - def substitute_xml(cls, value, make_quoted_attribute: bool = False): ... - @classmethod - def substitute_xml_containing_entities(cls, value, make_quoted_attribute: bool = False): ... - @classmethod - def substitute_html(cls, s): ... - -class EncodingDetector: - known_definite_encodings: list[str] - user_encodings: list[str] - exclude_encodings: set[str] - chardet_encoding: Incomplete | None - is_html: bool - declared_encoding: str | None - markup: Any - sniffed_encoding: str | None - def __init__( - self, - markup, - known_definite_encodings: Iterable[str] | None = None, - is_html: bool = False, - exclude_encodings: list[str] | None = None, - user_encodings: list[str] | None = None, - override_encodings: list[str] | None = None, - ) -> None: ... - @property - def encodings(self) -> Iterator[str]: ... - @classmethod - def strip_byte_order_mark(cls, data): ... - @classmethod - def find_declared_encoding(cls, markup, is_html: bool = False, search_entire_document: bool = False) -> str | None: ... - -class UnicodeDammit: - CHARSET_ALIASES: dict[str, str] - ENCODINGS_WITH_SMART_QUOTES: list[str] - smart_quotes_to: Literal["ascii", "xml", "html"] | None - tried_encodings: list[tuple[str, str]] - contains_replacement_characters: bool - is_html: bool - log: Logger - detector: EncodingDetector - markup: Any - unicode_markup: str - original_encoding: Incomplete | None - def __init__( - self, - markup, - known_definite_encodings: list[str] | None = [], - smart_quotes_to: Literal["ascii", "xml", "html"] | None = None, - is_html: bool = False, - exclude_encodings: list[str] | None = [], - user_encodings: list[str] | None = None, - override_encodings: list[str] | None = None, - ) -> None: ... - @property - def declared_html_encoding(self) -> str | None: ... - def find_codec(self, charset: str) -> str | None: ... - MS_CHARS: dict[bytes, str | tuple[str, ...]] - MS_CHARS_TO_ASCII: dict[bytes, str] - WINDOWS_1252_TO_UTF8: dict[int, bytes] - MULTIBYTE_MARKERS_AND_SIZES: list[tuple[int, int, int]] - FIRST_MULTIBYTE_MARKER: int - LAST_MULTIBYTE_MARKER: int - @classmethod - def detwingle(cls, in_bytes: bytes, main_encoding: str = "utf8", embedded_encoding: str = "windows-1252") -> bytes: ... diff --git a/stubs/beautifulsoup4/bs4/diagnose.pyi b/stubs/beautifulsoup4/bs4/diagnose.pyi deleted file mode 100644 index ccb7a01dd..000000000 --- a/stubs/beautifulsoup4/bs4/diagnose.pyi +++ /dev/null @@ -1,22 +0,0 @@ -from html.parser import HTMLParser - -def diagnose(data) -> None: ... -def lxml_trace(data, html: bool = True, **kwargs) -> None: ... - -class AnnouncingParser(HTMLParser): - def handle_starttag(self, name, attrs) -> None: ... - def handle_endtag(self, name) -> None: ... - def handle_data(self, data) -> None: ... - def handle_charref(self, name) -> None: ... - def handle_entityref(self, name) -> None: ... - def handle_comment(self, data) -> None: ... - def handle_decl(self, data) -> None: ... - def unknown_decl(self, data) -> None: ... - def handle_pi(self, data) -> None: ... - -def htmlparser_trace(data) -> None: ... -def rword(length: int = 5): ... -def rsentence(length: int = 4): ... -def rdoc(num_elements: int = 1000): ... -def benchmark_parsers(num_elements: int = 100000) -> None: ... -def profile(num_elements: int = 100000, parser: str = "lxml") -> None: ... diff --git a/stubs/beautifulsoup4/bs4/element.pyi b/stubs/beautifulsoup4/bs4/element.pyi deleted file mode 100644 index 47eb80b5b..000000000 --- a/stubs/beautifulsoup4/bs4/element.pyi +++ /dev/null @@ -1,391 +0,0 @@ -from _typeshed import ReadableBuffer -from collections.abc import Callable, Iterable, Iterator -from re import Pattern -from typing import Any, Literal, TypeVar, overload -from typing_extensions import Self, TypeAlias - -from . import BeautifulSoup -from .builder import TreeBuilder -from .formatter import Formatter, _EntitySubstitution - -DEFAULT_OUTPUT_ENCODING: str -nonwhitespace_re: Pattern[str] -whitespace_re: Pattern[str] -PYTHON_SPECIFIC_ENCODINGS: set[str] - -class NamespacedAttribute(str): - def __new__(cls, prefix: str, name: str | None = None, namespace: str | None = None) -> Self: ... - -class AttributeValueWithCharsetSubstitution(str): ... - -class CharsetMetaAttributeValue(AttributeValueWithCharsetSubstitution): - def __new__(cls, original_value): ... - def encode(self, encoding: str) -> str: ... # type: ignore[override] # incompatible with str - -class ContentMetaAttributeValue(AttributeValueWithCharsetSubstitution): - CHARSET_RE: Pattern[str] - def __new__(cls, original_value): ... - def encode(self, encoding: str) -> str: ... # type: ignore[override] # incompatible with str - -_T = TypeVar("_T") -_PageElementT = TypeVar("_PageElementT", bound=PageElement) -_SimpleStrainable: TypeAlias = str | bool | None | bytes | Pattern[str] | Callable[[str], bool] | Callable[[Tag], bool] -_Strainable: TypeAlias = _SimpleStrainable | Iterable[_SimpleStrainable] -_SimpleNormalizedStrainable: TypeAlias = str | bool | None | Pattern[str] | Callable[[str], bool] | Callable[[Tag], bool] -_NormalizedStrainable: TypeAlias = _SimpleNormalizedStrainable | Iterable[_SimpleNormalizedStrainable] - -class PageElement: - parent: Tag | None - previous_element: PageElement | None - next_element: PageElement | None - next_sibling: PageElement | None - previous_sibling: PageElement | None - def setup( - self, - parent: Tag | None = None, - previous_element: PageElement | None = None, - next_element: PageElement | None = None, - previous_sibling: PageElement | None = None, - next_sibling: PageElement | None = None, - ) -> None: ... - def format_string(self, s: str, formatter: Formatter | str | None) -> str: ... - def formatter_for_name(self, formatter: Formatter | str | _EntitySubstitution): ... - nextSibling: PageElement | None - previousSibling: PageElement | None - @property - def stripped_strings(self) -> Iterator[str]: ... - def get_text(self, separator: str = "", strip: bool = False, types: tuple[type[NavigableString], ...] = ...) -> str: ... - getText = get_text - @property - def text(self) -> str: ... - def replace_with(self, *args: PageElement | str) -> Self: ... - replaceWith = replace_with - def unwrap(self) -> Self: ... - replace_with_children = unwrap - replaceWithChildren = unwrap - def wrap(self, wrap_inside: _PageElementT) -> _PageElementT: ... - def extract(self, _self_index: int | None = None) -> Self: ... - def insert(self, position: int, new_child: PageElement | str) -> None: ... - def append(self, tag: PageElement | str) -> None: ... - def extend(self, tags: Iterable[PageElement | str]) -> None: ... - def insert_before(self, *args: PageElement | str) -> None: ... - def insert_after(self, *args: PageElement | str) -> None: ... - def find_next( - self, - name: _Strainable | SoupStrainer | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - string: _Strainable | None = None, - **kwargs: _Strainable, - ) -> Tag | NavigableString | None: ... - findNext = find_next - def find_all_next( - self, - name: _Strainable | SoupStrainer | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - string: _Strainable | None = None, - limit: int | None = None, - **kwargs: _Strainable, - ) -> ResultSet[PageElement]: ... - findAllNext = find_all_next - def find_next_sibling( - self, - name: _Strainable | SoupStrainer | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - string: _Strainable | None = None, - **kwargs: _Strainable, - ) -> Tag | NavigableString | None: ... - findNextSibling = find_next_sibling - def find_next_siblings( - self, - name: _Strainable | SoupStrainer | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - string: _Strainable | None = None, - limit: int | None = None, - **kwargs: _Strainable, - ) -> ResultSet[PageElement]: ... - findNextSiblings = find_next_siblings - fetchNextSiblings = find_next_siblings - def find_previous( - self, - name: _Strainable | SoupStrainer | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - string: _Strainable | None = None, - **kwargs: _Strainable, - ) -> Tag | NavigableString | None: ... - findPrevious = find_previous - def find_all_previous( - self, - name: _Strainable | SoupStrainer | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - string: _Strainable | None = None, - limit: int | None = None, - **kwargs: _Strainable, - ) -> ResultSet[PageElement]: ... - findAllPrevious = find_all_previous - fetchPrevious = find_all_previous - def find_previous_sibling( - self, - name: _Strainable | SoupStrainer | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - string: _Strainable | None = None, - **kwargs: _Strainable, - ) -> Tag | NavigableString | None: ... - findPreviousSibling = find_previous_sibling - def find_previous_siblings( - self, - name: _Strainable | SoupStrainer | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - string: _Strainable | None = None, - limit: int | None = None, - **kwargs: _Strainable, - ) -> ResultSet[PageElement]: ... - findPreviousSiblings = find_previous_siblings - fetchPreviousSiblings = find_previous_siblings - def find_parent( - self, - name: _Strainable | SoupStrainer | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - **kwargs: _Strainable, - ) -> Tag | None: ... - findParent = find_parent - def find_parents( - self, - name: _Strainable | SoupStrainer | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - limit: int | None = None, - **kwargs: _Strainable, - ) -> ResultSet[Tag]: ... - findParents = find_parents - fetchParents = find_parents - @property - def next(self) -> Tag | NavigableString | None: ... - @property - def previous(self) -> Tag | NavigableString | None: ... - @property - def next_elements(self) -> Iterable[PageElement]: ... - @property - def next_siblings(self) -> Iterable[PageElement]: ... - @property - def previous_elements(self) -> Iterable[PageElement]: ... - @property - def previous_siblings(self) -> Iterable[PageElement]: ... - @property - def parents(self) -> Iterable[Tag]: ... - @property - def decomposed(self) -> bool: ... - def nextGenerator(self) -> Iterable[PageElement]: ... - def nextSiblingGenerator(self) -> Iterable[PageElement]: ... - def previousGenerator(self) -> Iterable[PageElement]: ... - def previousSiblingGenerator(self) -> Iterable[PageElement]: ... - def parentGenerator(self) -> Iterable[Tag]: ... - -class NavigableString(str, PageElement): - PREFIX: str - SUFFIX: str - known_xml: bool | None - def __new__(cls, value: str | ReadableBuffer) -> Self: ... - def __copy__(self) -> Self: ... - def __getnewargs__(self) -> tuple[str]: ... - def output_ready(self, formatter: Formatter | str | None = "minimal") -> str: ... - @property - def name(self) -> None: ... - @property - def strings(self) -> Iterable[str]: ... - -class PreformattedString(NavigableString): - PREFIX: str - SUFFIX: str - def output_ready(self, formatter: Formatter | str | None = None) -> str: ... - -class CData(PreformattedString): - PREFIX: str - SUFFIX: str - -class ProcessingInstruction(PreformattedString): - PREFIX: str - SUFFIX: str - -class XMLProcessingInstruction(ProcessingInstruction): - PREFIX: str - SUFFIX: str - -class Comment(PreformattedString): - PREFIX: str - SUFFIX: str - -class Declaration(PreformattedString): - PREFIX: str - SUFFIX: str - -class Doctype(PreformattedString): - @classmethod - def for_name_and_ids(cls, name: str | None, pub_id: str, system_id: str) -> Doctype: ... - PREFIX: str - SUFFIX: str - -class Stylesheet(NavigableString): ... -class Script(NavigableString): ... -class TemplateString(NavigableString): ... - -class Tag(PageElement): - parser_class: type[BeautifulSoup] | None - name: str - namespace: str | None - prefix: str | None - sourceline: int | None - sourcepos: int | None - known_xml: bool | None - attrs: dict[str, str | Any] - contents: list[PageElement] - hidden: bool - can_be_empty_element: bool | None - cdata_list_attributes: list[str] | None - preserve_whitespace_tags: list[str] | None - def __init__( - self, - parser: BeautifulSoup | None = None, - builder: TreeBuilder | None = None, - name: str | None = None, - namespace: str | None = None, - prefix: str | None = None, - attrs: dict[str, str] | None = None, - parent: Tag | None = None, - previous: PageElement | None = None, - is_xml: bool | None = None, - sourceline: int | None = None, - sourcepos: int | None = None, - can_be_empty_element: bool | None = None, - cdata_list_attributes: list[str] | None = None, - preserve_whitespace_tags: list[str] | None = None, - interesting_string_types: type[NavigableString] | tuple[type[NavigableString], ...] | None = None, - namespaces: dict[str, str] | None = None, - ) -> None: ... - parserClass: type[BeautifulSoup] | None - def __copy__(self) -> Self: ... - @property - def is_empty_element(self) -> bool: ... - @property - def isSelfClosing(self) -> bool: ... - @property - def string(self) -> str | None: ... - @string.setter - def string(self, string: str) -> None: ... - DEFAULT_INTERESTING_STRING_TYPES: tuple[type[NavigableString], ...] - @property - def strings(self) -> Iterable[str]: ... - def decompose(self) -> None: ... - def clear(self, decompose: bool = False) -> None: ... - def smooth(self) -> None: ... - def index(self, element: PageElement) -> int: ... - @overload - def get(self, key: str, default: None = None) -> str | list[str] | None: ... - @overload - def get(self, key: str, default: _T) -> str | list[str] | _T: ... - @overload - def get_attribute_list(self, key: str, default: None = None) -> list[str | None]: ... - @overload - def get_attribute_list(self, key: str, default: list[_T]) -> list[str | _T]: ... - @overload - def get_attribute_list(self, key: str, default: _T) -> list[str | _T]: ... - def has_attr(self, key: str) -> bool: ... - def __hash__(self) -> int: ... - def __getitem__(self, key: str) -> str | list[str]: ... - def __iter__(self) -> Iterator[PageElement]: ... - def __len__(self) -> int: ... - def __contains__(self, x: object) -> bool: ... - def __bool__(self) -> bool: ... - def __setitem__(self, key: str, value: str | list[str]) -> None: ... - def __delitem__(self, key: str) -> None: ... - def __getattr__(self, tag: str) -> Tag | None: ... - def __eq__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - def __unicode__(self) -> str: ... - def encode( - self, - encoding: str = "utf-8", - indent_level: int | None = None, - 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: Literal["html", "html5", "minimal"] | Formatter | None = "minimal", - iterator: Iterator[PageElement] | None = None, - ) -> str: ... - @overload - def prettify(self, encoding: str, formatter: Literal["html", "html5", "minimal"] | Formatter | None = "minimal") -> bytes: ... - @overload - 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: Literal["html", "html5", "minimal"] | Formatter | None = "minimal", - ) -> str: ... - def encode_contents( - 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( - self, - name: _Strainable | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - recursive: bool = True, - string: _Strainable | None = None, - **kwargs: _Strainable, - ) -> Tag | NavigableString | None: ... - findChild = find - def find_all( - self, - name: _Strainable | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - recursive: bool = True, - string: _Strainable | None = None, - limit: int | None = None, - **kwargs: _Strainable, - ) -> ResultSet[Any]: ... - __call__ = find_all - findAll = find_all - findChildren = find_all - @property - def children(self) -> Iterable[PageElement]: ... - @property - def descendants(self) -> Iterable[PageElement]: ... - def select_one( - self, selector: str, namespaces=None, *, flags: int = ..., custom: dict[str, str] | None = ... - ) -> Tag | None: ... - def select( - self, selector: str, namespaces=None, limit: int | None = None, *, flags: int = ..., custom: dict[str, str] | None = ... - ) -> ResultSet[Tag]: ... - def childGenerator(self) -> Iterable[PageElement]: ... - def recursiveChildGenerator(self) -> Iterable[PageElement]: ... - def has_key(self, key: str) -> bool: ... - -class SoupStrainer: - name: _NormalizedStrainable - attrs: dict[str, _NormalizedStrainable] - string: _NormalizedStrainable - def __init__( - self, - name: _Strainable | None = None, - attrs: dict[str, _Strainable] | _Strainable = {}, - string: _Strainable | None = None, - **kwargs: _Strainable, - ) -> None: ... - def search_tag(self, markup_name: Tag | str | None = None, markup_attrs={}): ... - searchTag = search_tag - def search(self, markup: PageElement | Iterable[PageElement]): ... - -class ResultSet(list[_PageElementT]): - source: SoupStrainer - @overload - def __init__(self, source: SoupStrainer) -> None: ... - @overload - def __init__(self, source: SoupStrainer, result: Iterable[_PageElementT]) -> None: ... diff --git a/stubs/beautifulsoup4/bs4/formatter.pyi b/stubs/beautifulsoup4/bs4/formatter.pyi deleted file mode 100644 index b6e4facd4..000000000 --- a/stubs/beautifulsoup4/bs4/formatter.pyi +++ /dev/null @@ -1,50 +0,0 @@ -from collections.abc import Callable -from typing_extensions import TypeAlias - -from .dammit import EntitySubstitution as EntitySubstitution - -_EntitySubstitution: TypeAlias = Callable[[str], str] - -class Formatter(EntitySubstitution): - HTML: str - XML: str - HTML_DEFAULTS: dict[str, set[str]] - language: str | None - entity_substitution: _EntitySubstitution - void_element_close_prefix: str | None - cdata_containing_tags: list[str] - empty_attributes_are_booleans: bool - def __init__( - self, - language: str | None = None, - entity_substitution: _EntitySubstitution | None = None, - void_element_close_prefix: str | None = "/", - cdata_containing_tags: list[str] | None = None, - empty_attributes_are_booleans: bool = False, - indent: int = 1, - ) -> None: ... - def substitute(self, ns: str) -> str: ... - def attribute_value(self, value: str) -> str: ... - def attributes(self, tag): ... - -class HTMLFormatter(Formatter): - REGISTRY: dict[str, HTMLFormatter] - def __init__( - self, - entity_substitution: _EntitySubstitution | None = ..., - void_element_close_prefix: str | None = ..., - cdata_containing_tags: list[str] | None = ..., - empty_attributes_are_booleans: bool = False, - indent: int = 1, - ) -> None: ... - -class XMLFormatter(Formatter): - REGISTRY: dict[str, XMLFormatter] - def __init__( - self, - entity_substitution: _EntitySubstitution | None = ..., - void_element_close_prefix: str | None = ..., - cdata_containing_tags: list[str] | None = ..., - empty_attributes_are_booleans: bool = False, - indent: int = 1, - ) -> None: ...