Commit Graph

116 Commits

Author SHA1 Message Date
Jacob Walls d717be04dc
gh-83122: Deprecate testing element truth values in `ElementTree` (#31149)
When testing element truth values, emit a DeprecationWarning in all implementations.

This had emitted a FutureWarning in the rarely used python-only implementation since ~2.7 and has always been documented as a behavior not to rely on.

Matching an element in a tree search but having it test False can be unexpected. Raising the warning enables making the choice to finally raise an exception for this ambiguous behavior in the future.
2023-01-22 17:16:48 -08:00
Stanley 286e3c76a9
gh-99087: Add missing newline for prompts in docs (GH-98993)
Add newline for prompts so copying to REPL does not cause errors.
2022-12-08 19:31:19 -08:00
Martin Fischer 2cdd57f119
bpo-46879: Fix incorrect sphinx object names in doc (GH-31615)
API members documented in sphinx have an object name, which allow the
documentation to be linked from other projects. Sphinx calculates the
object name by prefixing the current module name to the directive
argument, e.g:

.. module:: foo
.. function:: bar.baz

becomes foo.bar.baz. Since these anchors aren't displayed in the
documentation, some mistakes have crept in, namely the Python stdlib
documentation currently contains the objects:

* asyncio.asyncio.subprocess.DEVNULL
* asyncio.asyncio.subprocess.PIPE
* asyncio.asyncio.subprocess.STDOUT
* asyncio.asyncio.subprocess.Process
* multiprocessing.sharedctypes.multiprocessing.Manager
* xml.etree.ElementTree.xml.etree.ElementInclude

This commit fixes this by making use of the :module: option which
without an argument makes sphinx take the directive argument as is
for the object name (avoiding the prefixing of the current module
name that led to these broken object names).

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-05-19 17:34:58 +02:00
E-Paine e9f66aedf4
Remove effbot urls (GH-26308) 2021-05-22 14:09:54 +02:00
Ammar Askar 97e8b1eaea
bpo-40624: Add support for the XPath != operator in xml.etree (GH-22147) 2020-11-09 08:02:39 +01:00
scoder 40db798692
bpo-41892: Clarify that an example in the ElementTree docs explicitly avoids modifying an XML tree while iterating over it. (GH-22464) 2020-10-04 19:13:46 -04:00
Serhiy Storchaka ec88e1bca8
bpo-36543: Revert "bpo-36543: Remove the xml.etree.cElementTree module." (GH-20117)
* Revert "bpo-36543: Remove the xml.etree.cElementTree module. (GH-19108)"

This reverts commit b33e52511a.
2020-06-10 17:39:12 +02:00
Shantanu 301f0d4ff9
bpo-33187: Document 3.9 changes to xml.etree.ElementInclude.include (GH-20438)
Looks like the merging of bpo-33187 and bpo-20928 was racy, resulting in
this change going undocumented.
2020-06-08 16:11:44 +02:00
Serhiy Storchaka 138ccbb022
bpo-38738: Fix formatting of True and False. (GH-17083)
* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.
* "Returns <bool>" is replaced with "Return <bool>".
2019-11-12 16:57:03 +02:00
Anjali Bansal 97b817eae3 bpo-33187: Document ElementInclude (XInclude) support in ElementTree (GH-8861) 2019-09-11 15:09:53 +01:00
Serhiy Storchaka f02ea6225b
bpo-36543: Remove old-deprecated ElementTree features. (GH-12707)
Remove methods Element.getchildren(), Element.getiterator() and
ElementTree.getiterator() and the xml.etree.cElementTree module.
2019-09-01 11:18:35 +03:00
Stefan Behnel b5d3ceea48
bpo-14465: Add an indent() function to xml.etree.ElementTree to pretty-print XML trees (GH-15200) 2019-08-23 16:44:25 +02:00
Stefan Behnel a3697db010
bpo-34160: explain how to deal with attribute order in ElementTree (GH-14867)
* Fix the formatting in the documentation of the tostring() functions.

* bpo-34160: Document that the tostring() and tostringlist() functions also preserve the attribute order now.

* bpo-34160: Add an explanation of how users should deal with the attribute order.
2019-07-24 20:22:50 +02:00
Stefan Behnel 47541689cc
bpo-28238: Implement "{*}tag" and "{ns}*" wildcard tag selection support for ElementPath, and extend the surrounding tests and docs. (GH-12997) 2019-05-03 20:58:16 +02:00
Stefan Behnel e1d5dd645d
bpo-13611: C14N 2.0 implementation for ElementTree (GH-12966)
* Implement C14N 2.0 as a new canonicalize() function in ElementTree.

Missing features:
- prefix renaming in XPath expressions (tag and attribute text is supported)
- preservation of original prefixes given redundant namespace declarations
2019-05-01 22:34:13 +02:00
Stefan Behnel dde3eebdaa
bpo-36676: Namespace prefix aware parsing support for the ET.XMLParser target (GH-12885)
* bpo-36676: Implement namespace prefix aware parsing support for the XMLParser target in ElementTree.
2019-05-01 21:49:58 +02:00
Stefan Behnel 43851a202c
bpo-36673: Implement comment/PI parsing support for the TreeBuilder in ElementTree. (#12883)
* bpo-36673: Implement comment/PI parsing support for the TreeBuilder in ElementTree.

* bpo-36673: Rewrite the comment/PI factory handling for the TreeBuilder in "_elementtree" to make it use the same factories as the ElementTree module, and to make it explicit when the comments/PIs are inserted into the tree and when they are not (which is the default).
2019-05-01 21:20:38 +02:00
Stefan Behnel e8113f51a8
bpo-30485: Change the prefix for defining the default namespace in ElementPath from None to '' since there is existing code that uses that and it's more convenient to have an all-string-keys dict (e.g. when sorting items etc.). (#12860) 2019-04-18 19:05:03 +02:00
Stefan Behnel e9927e1820
bpo-30485: support a default prefix mapping in ElementPath by passing None as prefix (#1823) 2019-04-14 10:09:09 +02:00
Bernt Røskar Brenna ffca16e25a bpo-36227: ElementTree.tostring() default_namespace and xml_declaration arguments (GH-12225)
Add new keyword arguments "default_namespace" and "xml_declaration" to functions ET.tostring() and ET.tostringlist(), as known from ElementTree.write().
2019-04-14 10:07:02 +02:00
Manjusaka e5458bdb6a bpo-28235: Fix xml.etree.ElementTree.fromstring docs (GH-11903) 2019-02-21 19:33:57 -05:00
Raymond Hettinger e3685fd5fd
bpo-34160: Preserve user specified order of Element attributes (GH-10163) 2018-10-28 11:18:22 -07:00
Serhiy Storchaka 02ec92fa7b
bpo-29209: Remove old-deprecated features in ElementTree. (GH-6769)
Also make getchildren() and getiterator() emitting
a DeprecationWarning instead of PendingDeprecationWarning.
2018-07-24 12:03:34 +03:00
sblondon 8d1f2f4038 bpo-32800: Update link to w3c doc for xml default namespaces (GH-5609)
The new link is given in a red box on the old page.
2018-02-10 17:39:43 -05:00
scoder 101a5e84ac bpo-31648: Improve ElementPath (#3835)
* Allow whitespace inside of ElementPath predicates.
* Add ElementPath predicate support for text comparison of the current node, like "[.='text']".
2017-09-30 16:35:21 +03:00
Serhiy Storchaka d97b7dc94b bpo-30380: Fix Sphinx 1.6.1 warnings. (#1613)
* Use explicit numbering for footnotes referred by explicit number.
* Restore missed footnote reference in stdtypes.rst.
* Fix literal strings formatting in howto/urllib2.rst.
* Update susp-ignored.csv for zipapp.rst.
* Fix suspicious mark up in Misc/NEWS.
2017-05-16 23:18:09 +03:00
Serhiy Storchaka a97cd2eb17 Issue #19795: Mark up True and False as literal text instead of bold. 2016-10-19 16:43:42 +03:00
Terry Jan Reedy fa089b9b0b Issue #22558: Add remaining doc links to source code for Python-coded modules.
Reformat header above separator line (added if missing) to a common format.
Patch by Yoni Lavi.
2016-06-11 15:02:54 -04:00
Serhiy Storchaka dba903993a Issue #23921: Standardized documentation whitespace formatting.
Original patch by James Edwards.
2016-05-10 12:01:23 +03:00
Serhiy Storchaka 6dff0205b7 Issue #26736: Used HTTPS for external links in the documentation if possible. 2016-05-07 10:49:07 +03:00
Martin Panter 6245cb3c01 Correct “an” → “a” with “Unicode”, “user”, “UTF”, etc
This affects documentation, code comments, and a debugging messages.
2016-04-15 02:14:19 +00:00
Georg Brandl adeffcc2f9 Closes #26444: typo fixes. 2016-02-26 19:13:47 +01:00
Martin Panter d21e0b52f1 Issue #25161: Add full stops in documentation; patch by Takase Arihiro 2015-10-10 10:36:22 +00:00
Ned Deily eca0445733 Issue #24079: Improve description of the text and tail attributes for
ElementTree Element objects.  Initial patch by Martin Panter.
2015-08-17 22:11:17 -04:00
Raymond Hettinger c43a666ba2 Issue #23729: Improve docs for ElementTree namespace parsing 2015-03-30 20:29:28 -07:00
Raymond Hettinger f6e31b79a8 Issue 23729: Document ElementTree namespace handling and fix an omission in the XPATH predicate table. 2015-03-22 15:29:09 -07:00
Georg Brandl b7354a65ce Fixing broken links in doc, part 4: some more breaks and redirects 2014-10-29 10:57:37 +01:00
Eli Bendersky 0bd22d4277 Issue #20375: Clarify ET's parsing of comments and processing instructions.
Based on patch by Nikolaus Rath.
2014-04-03 06:14:38 -07:00
Raymond Hettinger 1e1e601bd1 Minor readability improvement. 2014-03-29 11:50:08 -07:00
Larry Hastings 3732ed2414 Merge in all documentation changes since branching 3.4.0rc1. 2014-03-15 21:13:56 -07:00
Serhiy Storchaka 303718c3d7 Fix empty strings to empty bytes objects. 2014-02-06 21:11:33 +02:00
Serhiy Storchaka 5e028ae09e Fix empty strings to empty bytes objects. 2014-02-06 21:10:41 +02:00
R David Murray 410d320703 whatsnew: XMLPullParser, plus some doc updates.
I was confused by the text saying that read_events "iterated", since it
actually returns an iterator (that's what a generator does) that the
caller must then iterate.  So I tidied up the language.  I'm not sure
what the sentence "Events provided in a previous call to read_events()
will not be yielded again." is trying to convey, so I didn't try to fix that.

Also fixed a couple more news items.
2014-01-04 23:52:50 -05:00
R David Murray 575fb31955 shelf in with stmt, fish/csh in venv, ElementTree short_empty_elements keyword.
Also added versionadded for for fish/csh, fixed indentation of versionadded
for ElementTree.write, and make the behavior of shelf as a context manager
explicit in the docs.
2013-12-25 23:21:03 -05:00
Eli Bendersky 2915dd7103 Issue #19452: Clarify the documentation of iterparse w.r.t. events argument.
In 3.3 iterparse accepts a tuple in events (the C accelerator enforces this).
This limitation was lifted in Python 3.4
2013-10-31 05:53:39 -07:00
Georg Brandl 834a73bf4f merge with 3.3 2013-10-06 09:23:19 +02:00
Georg Brandl bdaee3ac95 Fix: Element.text is an attribute, not a method (report by Cameron Laird on docs@) 2013-10-06 09:23:03 +02:00
Nick Coghlan 4cc2afa0ec Close #18990: remove root attribute from XMLPullParser
- this was an internal implementation detail for iterparse
- this has been changed to use a new private method instead
- XMLPullParser.close docs are now more explicit about not
  returning a root element and instead direct users towards
  read_events
- also added missing docstrings and clarified some details
  related to exactly *when* events are consumed from the
  internal queue

(Initial patch by Stefan Behnel)
2013-09-28 23:50:35 +10:00
Eli Bendersky 2c68e300e5 Fix XMLPullParser documentation to say "non-blocking" instead of "asynchronous".
The latter is more ambiguous.

Related to issue #17741
2013-08-31 07:37:23 -07:00
Eli Bendersky b586934f0e Issue #17741: Rename IncrementalParser and its methods.
The new names are hopefully more descriptive and consistent. If you feel you
don't agree with this change, *please* read issue 17741 first - there's a lot of
discussion in there.
2013-08-30 05:51:20 -07:00