Drop Python 3.8 branches (#13776)

This commit is contained in:
Sebastian Rittau
2025-04-03 10:35:36 +02:00
committed by GitHub
parent 1e43190554
commit 30b16c168d
117 changed files with 1023 additions and 2639 deletions
+42 -86
View File
@@ -1,4 +1,3 @@
import sys
import xml.dom
from _collections_abc import dict_keys, dict_values
from _typeshed import Incomplete, ReadableBuffer, SupportsRead, SupportsWrite
@@ -88,71 +87,39 @@ class Node(xml.dom.Node):
@property
def localName(self) -> str | None: ... # non-null only for Element and Attr
def __bool__(self) -> Literal[True]: ...
if sys.version_info >= (3, 9):
@overload
def toxml(self, encoding: str, standalone: bool | None = None) -> bytes: ...
@overload
def toxml(self, encoding: None = None, standalone: bool | None = None) -> str: ...
@overload
def toprettyxml(
self,
indent: str = "\t",
newl: str = "\n",
# Handle any case where encoding is not provided or where it is passed with None
encoding: None = None,
standalone: bool | None = None,
) -> str: ...
@overload
def toprettyxml(
self,
indent: str,
newl: str,
# Handle cases where encoding is passed as str *positionally*
encoding: str,
standalone: bool | None = None,
) -> bytes: ...
@overload
def toprettyxml(
self,
indent: str = "\t",
newl: str = "\n",
# Handle all cases where encoding is passed as a keyword argument; because standalone
# comes after, it will also have to be a keyword arg if encoding is
*,
encoding: str,
standalone: bool | None = None,
) -> bytes: ...
else:
@overload
def toxml(self, encoding: str) -> bytes: ...
@overload
def toxml(self, encoding: None = None) -> str: ...
@overload
def toprettyxml(
self,
indent: str = "\t",
newl: str = "\n",
# Handle any case where encoding is not provided or where it is passed with None
encoding: None = None,
) -> str: ...
@overload
def toprettyxml(
self,
indent: str,
newl: str,
# Handle cases where encoding is passed as str *positionally*
encoding: str,
) -> bytes: ...
@overload
def toprettyxml(
self,
indent: str = "\t",
newl: str = "\n",
# Handle all cases where encoding is passed as a keyword argument
*,
encoding: str,
) -> bytes: ...
@overload
def toxml(self, encoding: str, standalone: bool | None = None) -> bytes: ...
@overload
def toxml(self, encoding: None = None, standalone: bool | None = None) -> str: ...
@overload
def toprettyxml(
self,
indent: str = "\t",
newl: str = "\n",
# Handle any case where encoding is not provided or where it is passed with None
encoding: None = None,
standalone: bool | None = None,
) -> str: ...
@overload
def toprettyxml(
self,
indent: str,
newl: str,
# Handle cases where encoding is passed as str *positionally*
encoding: str,
standalone: bool | None = None,
) -> bytes: ...
@overload
def toprettyxml(
self,
indent: str = "\t",
newl: str = "\n",
# Handle all cases where encoding is passed as a keyword argument; because standalone
# comes after, it will also have to be a keyword arg if encoding is
*,
encoding: str,
standalone: bool | None = None,
) -> bytes: ...
def hasChildNodes(self) -> bool: ...
def insertBefore( # type: ignore[misc]
self: _NodesWithChildren, # pyright: ignore[reportGeneralTypeIssues]
@@ -657,26 +624,15 @@ class Document(Node, DocumentLS):
def getElementsByTagNameNS(self, namespaceURI: str | None, localName: str) -> NodeList[Element]: ...
def isSupported(self, feature: str, version: str | None) -> bool: ...
def importNode(self, node: _ImportableNodeVar, deep: bool) -> _ImportableNodeVar: ...
if sys.version_info >= (3, 9):
def writexml(
self,
writer: SupportsWrite[str],
indent: str = "",
addindent: str = "",
newl: str = "",
encoding: str | None = None,
standalone: bool | None = None,
) -> None: ...
else:
def writexml(
self,
writer: SupportsWrite[str],
indent: str = "",
addindent: str = "",
newl: str = "",
encoding: Incomplete | None = None,
) -> None: ...
def writexml(
self,
writer: SupportsWrite[str],
indent: str = "",
addindent: str = "",
newl: str = "",
encoding: str | None = None,
standalone: bool | None = None,
) -> None: ...
@overload
def renameNode(self, n: Element, namespaceURI: str, name: str) -> Element: ...
@overload
+3 -10
View File
@@ -1,4 +1,3 @@
import sys
from _typeshed import FileDescriptorOrPath
from typing import Final, Literal, Protocol, overload
from xml.etree.ElementTree import Element
@@ -13,8 +12,7 @@ XINCLUDE: Final[str]
XINCLUDE_INCLUDE: Final[str]
XINCLUDE_FALLBACK: Final[str]
if sys.version_info >= (3, 9):
DEFAULT_MAX_INCLUSION_DEPTH: Final = 6
DEFAULT_MAX_INCLUSION_DEPTH: Final = 6
class FatalIncludeError(SyntaxError): ...
@@ -22,11 +20,6 @@ class FatalIncludeError(SyntaxError): ...
def default_loader(href: FileDescriptorOrPath, parse: Literal["xml"], encoding: str | None = None) -> Element: ...
@overload
def default_loader(href: FileDescriptorOrPath, parse: Literal["text"], encoding: str | None = None) -> str: ...
def include(elem: Element, loader: _Loader | None = None, base_url: str | None = None, max_depth: int | None = 6) -> None: ...
if sys.version_info >= (3, 9):
def include(elem: Element, loader: _Loader | None = None, base_url: str | None = None, max_depth: int | None = 6) -> None: ...
class LimitedRecursiveIncludeError(FatalIncludeError): ...
else:
def include(elem: Element, loader: _Loader | None = None) -> None: ...
class LimitedRecursiveIncludeError(FatalIncludeError): ...
+2 -13
View File
@@ -15,6 +15,7 @@ __all__ = [
"canonicalize",
"fromstring",
"fromstringlist",
"indent",
"iselement",
"iterparse",
"parse",
@@ -34,9 +35,6 @@ __all__ = [
"register_namespace",
]
if sys.version_info >= (3, 9):
__all__ += ["indent"]
_T = TypeVar("_T")
_FileRead: TypeAlias = FileDescriptorOrPath | SupportsRead[bytes] | SupportsRead[str]
_FileWriteC14N: TypeAlias = FileDescriptorOrPath | SupportsWrite[bytes]
@@ -138,9 +136,6 @@ class Element(Generic[_Tag]):
# Doesn't really exist in earlier versions, where __len__ is called implicitly instead
@deprecated("Testing an element's truth value is deprecated.")
def __bool__(self) -> bool: ...
if sys.version_info < (3, 9):
def getchildren(self) -> list[Element]: ...
def getiterator(self, tag: str | None = None) -> list[Element]: ...
def SubElement(parent: Element, tag: str, attrib: dict[str, str] = ..., **extra: str) -> Element: ...
def Comment(text: str | None = None) -> _CallableElement: ...
@@ -165,9 +160,6 @@ class ElementTree(Generic[_Root]):
def getroot(self) -> _Root: ...
def parse(self, source: _FileRead, parser: XMLParser | None = None) -> Element: ...
def iter(self, tag: str | None = None) -> Generator[Element, None, None]: ...
if sys.version_info < (3, 9):
def getiterator(self, tag: str | None = None) -> list[Element]: ...
def find(self, path: str, namespaces: dict[str, str] | None = None) -> Element | None: ...
@overload
def findtext(self, path: str, default: None = None, namespaces: dict[str, str] | None = None) -> str | None: ...
@@ -254,10 +246,7 @@ def tostringlist(
short_empty_elements: bool = True,
) -> list[Any]: ...
def dump(elem: Element | ElementTree[Any]) -> None: ...
if sys.version_info >= (3, 9):
def indent(tree: Element | ElementTree[Any], space: str = " ", level: int = 0) -> None: ...
def indent(tree: Element | ElementTree[Any], space: str = " ", level: int = 0) -> None: ...
def parse(source: _FileRead, parser: XMLParser[Any] | None = None) -> ElementTree[Element]: ...
# This class is defined inside the body of iterparse
+1 -5
View File
@@ -53,11 +53,7 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
) -> None: ...
@overload
def setProperty(self, name: str, value: object) -> None: ...
if sys.version_info >= (3, 9):
def feed(self, data: str | ReadableBuffer, isFinal: bool = False) -> None: ...
else:
def feed(self, data: str | ReadableBuffer, isFinal: _BoolType = 0) -> None: ...
def feed(self, data: str | ReadableBuffer, isFinal: bool = False) -> None: ...
def flush(self) -> None: ...
def close(self) -> None: ...
def reset(self) -> None: ...