-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add missing stdlib xml stubs #5895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 34 commits
8cafdb1
5a5cf8f
c4b9db9
e6f6276
4763b63
eb857cb
75e8f6a
fcae477
8f9eb70
703e571
358c5f3
c58349f
59ae776
a57cdbf
27fbb2d
78c9a17
dfee4d3
37bd617
2c4513b
233d0a4
4e7e466
54144e0
f57027e
195264a
1b26ae2
a1490be
74b6f04
1fbc51e
39a636c
31135d3
0a7a0e9
5a3a27a
d3b2e47
e6d883e
8ef92d5
5379d82
eddde00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,26 +1,44 @@ | ||||||
| from typing import IO, Any | ||||||
| from typing import IO, Any, Sequence, Tuple, Union | ||||||
| from typing_extensions import Literal | ||||||
| from xml.dom.minidom import Document, DOMImplementation, Element, Text | ||||||
| from xml.sax.handler import ContentHandler | ||||||
| from xml.sax.xmlreader import XMLReader | ||||||
|
|
||||||
| START_ELEMENT: str | ||||||
| END_ELEMENT: str | ||||||
| COMMENT: str | ||||||
| START_DOCUMENT: str | ||||||
| END_DOCUMENT: str | ||||||
| PROCESSING_INSTRUCTION: str | ||||||
| IGNORABLE_WHITESPACE: str | ||||||
| CHARACTERS: str | ||||||
| START_ELEMENT: Literal["START_ELEMENT"] | ||||||
| END_ELEMENT: Literal["END_ELEMENT"] | ||||||
| COMMENT: Literal["COMMENT"] | ||||||
| START_DOCUMENT: Literal["START_DOCUMENT"] | ||||||
| END_DOCUMENT: Literal["END_DOCUMENT"] | ||||||
| PROCESSING_INSTRUCTION: Literal["PROCESSING_INSTRUCTION"] | ||||||
| IGNORABLE_WHITESPACE: Literal["IGNORABLE_WHITESPACE"] | ||||||
| CHARACTERS: Literal["CHARACTERS"] | ||||||
|
|
||||||
| DocumentFactory = Union[DOMImplementation, None] | ||||||
| Node = Union[Document, Element, Text] | ||||||
|
|
||||||
| Event = Tuple[ | ||||||
| Literal[ | ||||||
| Literal["START_ELEMENT"], | ||||||
| Literal["END_ELEMENT"], | ||||||
| Literal["COMMENT"], | ||||||
| Literal["START_DOCUMENT"], | ||||||
| Literal["END_DOCUMENT"], | ||||||
| Literal["PROCESSING_INSTRUCTION"], | ||||||
| Literal["IGNORABLE_WHITESPACE"], | ||||||
| Literal["CHARACTERS"], | ||||||
| ], | ||||||
| Node, | ||||||
| ] | ||||||
|
|
||||||
| class PullDOM(ContentHandler): | ||||||
| document: Any | None | ||||||
| documentFactory: Any | ||||||
| document: Union[Document, None] | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use the new union syntax:
Suggested change
(It doesn't work yet for the type aliases above.)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When i use the new union syntax, some of the checks fail. Is that normal? |
||||||
| documentFactory: DocumentFactory | ||||||
| firstEvent: Any | ||||||
| lastEvent: Any | ||||||
| elementStack: Any | ||||||
| push: Any | ||||||
| pending_events: Any | ||||||
| def __init__(self, documentFactory: Any | None = ...) -> None: ... | ||||||
| def pop(self): ... | ||||||
| elementStack: Sequence[Any] | ||||||
| pending_events: Sequence[Any] | ||||||
| def __init__(self, documentFactory: DocumentFactory = ...) -> None: ... | ||||||
| def pop(self) -> Element: ... | ||||||
| def setDocumentLocator(self, locator) -> None: ... | ||||||
| def startPrefixMapping(self, prefix, uri) -> None: ... | ||||||
| def endPrefixMapping(self, prefix) -> None: ... | ||||||
|
|
@@ -48,12 +66,12 @@ class DOMEventStream: | |||||
| bufsize: int | ||||||
| def __init__(self, stream: IO[bytes], parser: XMLReader, bufsize: int) -> None: ... | ||||||
| pulldom: Any | ||||||
| def reset(self) -> None: ... | ||||||
| def __getitem__(self, pos): ... | ||||||
| def __next__(self): ... | ||||||
| def __iter__(self): ... | ||||||
| def expandNode(self, node) -> None: ... | ||||||
| def getEvent(self): ... | ||||||
| def getEvent(self) -> Event: ... | ||||||
| def expandNode(self, node: Node) -> None: ... | ||||||
| def reset(self) -> None: ... | ||||||
| def clear(self) -> None: ... | ||||||
|
|
||||||
| class SAX2DOM(PullDOM): | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these are not available at runtime, they should be prefixed with
_.(Same for
Event.)