Replace Incomplete | None = None in third party stubs (#14063)

This commit is contained in:
Sebastian Rittau
2025-05-15 21:37:43 +02:00
committed by GitHub
parent acc51542c9
commit 126768408a
488 changed files with 2259 additions and 4044 deletions
+1 -2
View File
@@ -1,4 +1,3 @@
from _typeshed import Incomplete
from typing import Any
baseChar: str
@@ -44,7 +43,7 @@ class InfosetFilter:
replaceFormFeedCharacters: bool = True,
preventSingleQuotePubid: bool = False,
) -> None: ...
def coerceAttribute(self, name, namespace: Incomplete | None = None): ...
def coerceAttribute(self, name, namespace=None): ...
def coerceElement(self, name): ...
def coerceComment(self, data): ...
def coerceCharacters(self, data): ...
+2 -2
View File
@@ -1,4 +1,4 @@
from _typeshed import Incomplete, SupportsRead
from _typeshed import SupportsRead
from codecs import CodecInfo
from typing import Any, Protocol, overload
from typing_extensions import TypeAlias
@@ -62,7 +62,7 @@ class HTMLUnicodeInputStream:
def openStream(self, source): ...
def position(self) -> tuple[int, int]: ...
def char(self): ...
def readChunk(self, chunkSize: Incomplete | None = None): ...
def readChunk(self, chunkSize=None): ...
def characterErrorsUCS4(self, data) -> None: ...
def characterErrorsUCS2(self, data) -> None: ...
def charsUntil(self, characters, opposite: bool = False): ...
+2 -3
View File
@@ -1,4 +1,3 @@
from _typeshed import Incomplete
from typing import Any
from ._inputstream import _InputStream
@@ -14,11 +13,11 @@ class HTMLTokenizer:
state: Any
escape: bool
currentToken: Any
def __init__(self, stream: _InputStream, parser: Incomplete | None = None, **kwargs) -> None: ...
def __init__(self, stream: _InputStream, parser=None, **kwargs) -> None: ...
tokenQueue: Any
def __iter__(self): ...
def consumeNumberEntity(self, isHex): ...
def consumeEntity(self, allowedChar: Incomplete | None = None, fromAttribute: bool = False) -> None: ...
def consumeEntity(self, allowedChar=None, fromAttribute: bool = False) -> None: ...
def processEntityInAttribute(self, allowedChar) -> None: ...
def emitCurrentToken(self) -> None: ...
def dataState(self): ...
+1 -2
View File
@@ -1,10 +1,9 @@
from _typeshed import Incomplete
from abc import ABCMeta
from collections.abc import Mapping
from typing import Any
class Trie(Mapping[Any, Any], metaclass=ABCMeta):
def keys(self, prefix: Incomplete | None = None): ...
def keys(self, prefix=None): ...
def has_keys_with_prefix(self, prefix): ...
def longest_prefix(self, prefix): ...
def longest_prefix_item(self, prefix): ...
+1 -3
View File
@@ -1,5 +1,3 @@
from _typeshed import Incomplete
from ._base import Trie as ABCTrie
class Trie(ABCTrie):
@@ -8,5 +6,5 @@ class Trie(ABCTrie):
def __len__(self) -> int: ...
def __iter__(self): ...
def __getitem__(self, key): ...
def keys(self, prefix: Incomplete | None = None): ...
def keys(self, prefix=None): ...
def has_keys_with_prefix(self, prefix): ...
+1 -2
View File
@@ -1,4 +1,3 @@
from _typeshed import Incomplete
from collections.abc import Mapping
from typing import Any
@@ -8,7 +7,7 @@ class MethodDispatcher(dict[Any, Any]):
default: Any
def __init__(self, items=()) -> None: ...
def __getitem__(self, key): ...
def __get__(self, instance, owner: Incomplete | None = None): ...
def __get__(self, instance, owner=None): ...
class BoundMethodDispatcher(Mapping[Any, Any]):
instance: Any
+3 -5
View File
@@ -21,9 +21,7 @@ class HTMLParser:
tree: Any
errors: list[Incomplete]
phases: Any
def __init__(
self, tree: Incomplete | None = None, strict: bool = False, namespaceHTMLElements: bool = True, debug: bool = False
) -> None: ...
def __init__(self, tree=None, strict: bool = False, namespaceHTMLElements: bool = True, debug: bool = False) -> None: ...
firstStartTag: bool
log: Any
compatMode: str
@@ -42,7 +40,7 @@ class HTMLParser:
def mainLoop(self) -> None: ...
def parse(self, stream: _InputStream, scripting: bool = ..., **kwargs): ...
def parseFragment(self, stream: _InputStream, *args, **kwargs): ...
def parseError(self, errorcode: str = "XXX-undefined-error", datavars: Incomplete | None = None) -> None: ...
def parseError(self, errorcode: str = "XXX-undefined-error", datavars=None) -> None: ...
def adjustMathMLAttributes(self, token) -> None: ...
def adjustSVGAttributes(self, token) -> None: ...
def adjustForeignAttributes(self, token) -> None: ...
@@ -53,6 +51,6 @@ class HTMLParser:
def getPhases(debug): ...
def adjust_attributes(token, replacements) -> None: ...
def impliedTagToken(name, type: str = "EndTag", attributes: Incomplete | None = None, selfClosing: bool = False): ...
def impliedTagToken(name, type: str = "EndTag", attributes=None, selfClosing: bool = False): ...
class ParseError(Exception): ...
+2 -2
View File
@@ -32,8 +32,8 @@ class HTMLSerializer:
def encode(self, string): ...
def encodeStrict(self, string): ...
encoding: Any
def serialize(self, treewalker, encoding: Incomplete | None = None) -> Generator[Incomplete, None, None]: ...
def render(self, treewalker, encoding: Incomplete | None = None): ...
def serialize(self, treewalker, encoding=None) -> Generator[Incomplete, None, None]: ...
def render(self, treewalker, encoding=None): ...
def serializeError(self, data: str = "XXX ERROR MESSAGE NEEDED") -> None: ...
class SerializeError(Exception): ...
@@ -1,6 +1,5 @@
from _typeshed import Incomplete
from typing import Any
treeBuilderCache: Any
def getTreeBuilder(treeType, implementation: Incomplete | None = None, **kwargs): ...
def getTreeBuilder(treeType, implementation=None, **kwargs): ...
@@ -1,4 +1,3 @@
from _typeshed import Incomplete
from typing import Any
Marker: Any
@@ -12,7 +11,7 @@ class Node:
childNodes: Any
def __init__(self, name) -> None: ...
def appendChild(self, node) -> None: ...
def insertText(self, data, insertBefore: Incomplete | None = None) -> None: ...
def insertText(self, data, insertBefore=None) -> None: ...
def insertBefore(self, node, refNode) -> None: ...
def removeChild(self, node) -> None: ...
def reparentChildren(self, newParent) -> None: ...
@@ -38,19 +37,19 @@ class TreeBuilder:
insertFromTable: bool
document: Any
def reset(self) -> None: ...
def elementInScope(self, target, variant: Incomplete | None = None): ...
def elementInScope(self, target, variant=None): ...
def reconstructActiveFormattingElements(self) -> None: ...
def clearActiveFormattingElements(self) -> None: ...
def elementInActiveFormattingElements(self, name): ...
def insertRoot(self, token) -> None: ...
def insertDoctype(self, token) -> None: ...
def insertComment(self, token, parent: Incomplete | None = None) -> None: ...
def insertComment(self, token, parent=None) -> None: ...
def createElement(self, token): ...
def insertElementNormal(self, token): ...
def insertElementTable(self, token): ...
def insertText(self, data, parent: Incomplete | None = None) -> None: ...
def insertText(self, data, parent=None) -> None: ...
def getTableMisnestedNodePosition(self): ...
def generateImpliedEndTags(self, exclude: Incomplete | None = None) -> None: ...
def generateImpliedEndTags(self, exclude=None) -> None: ...
def getDocument(self): ...
def getFragment(self): ...
def testSerializer(self, node) -> None: ...
@@ -1,4 +1,3 @@
from _typeshed import Incomplete
from typing import Any
from . import base
@@ -39,7 +38,7 @@ class TreeBuilder(base.TreeBuilder):
def getDocument(self): ...
def getFragment(self): ...
def insertDoctype(self, token) -> None: ...
def insertCommentInitial(self, data, parent: Incomplete | None = None) -> None: ...
def insertCommentMain(self, data, parent: Incomplete | None = None) -> None: ...
def insertCommentInitial(self, data, parent=None) -> None: ...
def insertCommentMain(self, data, parent=None) -> None: ...
document: Any
def insertRoot(self, token) -> None: ...
@@ -1,4 +1,2 @@
from _typeshed import Incomplete
def getTreeWalker(treeType, implementation: Incomplete | None = None, **kwargs): ...
def getTreeWalker(treeType, implementation=None, **kwargs): ...
def pprint(walker): ...
+1 -2
View File
@@ -1,4 +1,3 @@
from _typeshed import Incomplete
from typing import Any
DOCUMENT: Any
@@ -19,7 +18,7 @@ class TreeWalker:
def endTag(self, namespace, name): ...
def text(self, data) -> None: ...
def comment(self, data): ...
def doctype(self, name, publicId: Incomplete | None = None, systemId: Incomplete | None = None): ...
def doctype(self, name, publicId=None, systemId=None): ...
def entity(self, name): ...
def unknown(self, nodeType): ...