Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-128508: Add some docstrings to xml.dom.minidom#128477
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
Open
srinivasreddy wants to merge 38 commits into python:mainChoose a base branch from srinivasreddy:gh-63882-doc_strings
base:main
Could not load branches
Branch not found: {{refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
+43 −3
Open
Changes from all commits
Commits
Show all changes
38 commits Select commit Hold shift + click to select a range
21bb374 Update and Add docstrings for functions and methods in minidom.py module
srinivasreddy f16761b Update Lib/xml/dom/minidom.py
srinivasreddy eb0208b Update Lib/xml/dom/minidom.py
srinivasreddy f4f6334 Update Lib/xml/dom/minidom.py
srinivasreddy 70617ea Add `check-readthedocs` pre-commit hook (#128453)
sobolevn 90b344f gh-128152: Argument Clinic: ignore pre-processor directives inside C …
erlend-aasland 34c317a GH-127381: pathlib ABCs: remove `PathBase.move()` and `move_into()` (…
barneygale 5f7ba82 Docs: mark up json.dump() using parameter list (#128482)
erlend-aasland 23d11be pathlib tests: create `walk()` test hierarchy without using class und…
barneygale e6a8d38 gh-126719: Clarify math.fmod docs (#127741)
StanFromIreland 1592145 Docs: amend json.dump() post gh-128482 (#128489)
erlend-aasland 1a8ee69 gh-127954: Document PyObject_DelItemString (#127986)
rruuaanng 61c3e8a gh-127553: Remove outdated TODO comment in _pydatetime (#127564)
bombs-kim 69f8e4b gh-115765: Document and enforce Autoconf 2.72 requirement (#128502)
erlend-aasland 7f767cd gh-128437: Add `BOLT_COMMON_FLAGS` with `-update-debug-sections` (gh-…
zanieb 2f8b072 gh-128137: Update PyASCIIObject to handle interned field with the ato…
corona10 539b638 gh-128504: Upgrade doctest to ubuntu-24.04 (#128506)
Damien-Chen a4c5f4f Docs: fix `MessageDefect` references in email.policy docs (#128468)
c612744 gh-98188: Fix EmailMessage.get_payload to decode data when CTE value …
RanKKI b0a9129 Revert __repr__ change
srinivasreddy 3f71f1f Merge branch 'main' into gh-63882-doc_strings
srinivasreddy 8b7ff8e Update the docstring for _clone_node(...)
srinivasreddy afa51ef Update docstring for cloneNode(...)
srinivasreddy 14bb77e Update docstrings for cloneNode(...)
srinivasreddy a4840f3 Convert doc string to imperative mode
srinivasreddy 38be045 Update docstring as recommended by argument clinic
srinivasreddy cca0fda Update docstring as recommended by argument clinic
srinivasreddy 8df6795 Undo removing comment
srinivasreddy 727af86 Update docstrings as it was done in argument clinic
srinivasreddy 2da171f Add space back
srinivasreddy ecb4a54 Update doc strings
srinivasreddy 8b63730 Update Lib/xml/dom/minidom.py
srinivasreddy 49a12e6 Update Lib/xml/dom/minidom.py
srinivasreddy 298a20f Merge branch 'main' into gh-63882-doc_strings
srinivasreddy b97d812 Address review comments
srinivasreddy 19d245c Update docstrings
srinivasreddy 7b1666d Update Lib/xml/dom/minidom.py
srinivasreddy c68cb4d Merge branch 'main' into gh-63882-doc_strings
srinivasreddy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -32,6 +32,10 @@ | ||
| class Node(xml.dom.Node): | ||
| """Base class representing a node in the DOM tree. | ||
| Provides core properties and methods that all DOM nodes must implement. | ||
| """ | ||
| namespaceURI = None # this is non-null only for elements and attributes | ||
| parentNode = None | ||
| ownerDocument = None | ||
| @@ -44,6 +48,7 @@ def __bool__(self): | ||
| return True | ||
| def toxml(self, encoding=None, standalone=None): | ||
| """Generate a string representation of a DOM.""" | ||
| return self.toprettyxml("", "", encoding, standalone) | ||
| def toprettyxml(self, indent="\t", newl="\n", encoding=None, | ||
| @@ -80,6 +85,14 @@ def _get_lastChild(self): | ||
| return self.childNodes[-1] | ||
| def insertBefore(self, newChild, refChild): | ||
| """Insert a new DOM Node before an existing Node. | ||
srinivasreddy marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| newChild | ||
| The new node to insert | ||
| refChild | ||
| The existing node that will be the next sibling of newChild. | ||
| If None, newChild is appended to the end. | ||
| """ | ||
| if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE: | ||
| for c in tuple(newChild.childNodes): | ||
| self.insertBefore(c, refChild) | ||
| @@ -112,6 +125,7 @@ def insertBefore(self, newChild, refChild): | ||
| return newChild | ||
| def appendChild(self, node): | ||
| """Append a child node to an existing node.""" | ||
| if node.nodeType == self.DOCUMENT_FRAGMENT_NODE: | ||
| for c in tuple(node.childNodes): | ||
| self.appendChild(c) | ||
| @@ -129,6 +143,7 @@ def appendChild(self, node): | ||
| return node | ||
| def replaceChild(self, newChild, oldChild): | ||
| """Replace child node *oldChild* with *newChild*.""" | ||
| if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE: | ||
| refChild = oldChild.nextSibling | ||
| self.removeChild(oldChild) | ||
| @@ -161,6 +176,7 @@ def replaceChild(self, newChild, oldChild): | ||
| return oldChild | ||
| def removeChild(self, oldChild): | ||
| """Remove an existing child.""" | ||
| try: | ||
| self.childNodes.remove(oldChild) | ||
| except ValueError: | ||
| @@ -177,6 +193,12 @@ def removeChild(self, oldChild): | ||
| return oldChild | ||
| def normalize(self): | ||
| """Transform this node into its normalized form. | ||
| Remove empty exclusive Text nodes and concatenate data of | ||
| remaining contiguous exclusive Text nodes into the first of | ||
| their nodes. | ||
| """ | ||
| L = [] | ||
| for child in self.childNodes: | ||
| if child.nodeType == Node.TEXT_NODE: | ||
| @@ -204,6 +226,12 @@ def normalize(self): | ||
| self.childNodes[:] = L | ||
| def cloneNode(self, deep): | ||
| """Create and return a duplicate of this node. | ||
| deep | ||
| If True, recursively clone this node's descendants. | ||
| If False, clone only this node. | ||
| """ | ||
| return _clone_node(self, deep, self.ownerDocument or self) | ||
| def isSupported(self, feature, version): | ||
| @@ -1341,6 +1369,12 @@ def _get_internalSubset(self): | ||
| return self.internalSubset | ||
| def cloneNode(self, deep): | ||
| """Create and return a duplicate of this node. | ||
| deep | ||
| If True, recursively clone this node's descendants. | ||
| If False, clone only this node. | ||
| """ | ||
| if self.ownerDocument is None: | ||
| # it's ok | ||
| clone = DocumentType(None) | ||
| @@ -1903,9 +1937,15 @@ def renameNode(self, n, namespaceURI, name): | ||
| def _clone_node(node, deep, newOwnerDocument): | ||
| """ | ||
| Clone a node and give it the new owner document. | ||
| Called by Node.cloneNode and Document.importNode | ||
| """Create and return a clone of a DOM node. | ||
| node | ||
| The DOM node to clone. | ||
| deep | ||
| If True, recursively clone the node's descendants. | ||
| If False, only clone the node itself. | ||
| newOwnerDocument | ||
| The document that will own the cloned node. | ||
| """ | ||
| if node.ownerDocument.isSameNode(newOwnerDocument): | ||
| operation = xml.dom.UserDataHandler.NODE_CLONED | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.