You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

976 lines
34 KiB

Merged revisions 80605-80609,80642-80646,80651-80652,80674,80684-80686,80748,80852,80854,80870,80872-80873,80907,80915-80916,80951-80952,80976-80977,80985,81038-81040,81042,81053,81070,81104-81105,81114,81125,81245,81285,81402,81463,81516,81562-81563,81567,81593,81635,81680-81681,81684,81801,81888,81931-81933,81939-81942,81963,81984,81991,82120,82188,82264-82267 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r80605 | andrew.kuchling | 2010-04-28 19:22:16 -0500 (Wed, 28 Apr 2010) | 1 line Add various items ........ r80606 | andrew.kuchling | 2010-04-28 20:44:30 -0500 (Wed, 28 Apr 2010) | 6 lines Fix doubled 'the'. Markup fixes to use :exc:, :option: in a few places. (Glitch: unittest.main's -c ends up a link to the Python interpreter's -c option. Should we skip using :option: for that switch, or disable the auto-linking somehow?) ........ r80607 | andrew.kuchling | 2010-04-28 20:45:41 -0500 (Wed, 28 Apr 2010) | 1 line Add various unittest items ........ r80608 | benjamin.peterson | 2010-04-28 22:18:05 -0500 (Wed, 28 Apr 2010) | 1 line update pypy description ........ r80609 | benjamin.peterson | 2010-04-28 22:30:59 -0500 (Wed, 28 Apr 2010) | 1 line update pypy url ........ r80642 | andrew.kuchling | 2010-04-29 19:49:09 -0500 (Thu, 29 Apr 2010) | 1 line Always add space after RFC; reword paragraph ........ r80643 | andrew.kuchling | 2010-04-29 19:52:31 -0500 (Thu, 29 Apr 2010) | 6 lines Reword paragraph to make its meaning clearer. Antoine Pitrou: is my version of the paragraph still correct? R. David Murray: is this more understandable than the previous version? ........ r80644 | andrew.kuchling | 2010-04-29 20:02:15 -0500 (Thu, 29 Apr 2010) | 1 line Fix typos ........ r80645 | andrew.kuchling | 2010-04-29 20:32:47 -0500 (Thu, 29 Apr 2010) | 1 line Markup fix; clarify by adding 'in that order' ........ r80646 | andrew.kuchling | 2010-04-29 20:33:40 -0500 (Thu, 29 Apr 2010) | 1 line Add various items; rearrange unittest section a bit ........ r80651 | andrew.kuchling | 2010-04-30 08:46:55 -0500 (Fri, 30 Apr 2010) | 1 line Minor grammar re-wording ........ r80652 | andrew.kuchling | 2010-04-30 08:47:34 -0500 (Fri, 30 Apr 2010) | 1 line Add item ........ r80674 | andrew.kuchling | 2010-04-30 20:19:16 -0500 (Fri, 30 Apr 2010) | 1 line Add various items ........ r80684 | andrew.kuchling | 2010-05-01 07:05:52 -0500 (Sat, 01 May 2010) | 1 line Minor grammar fix ........ r80685 | andrew.kuchling | 2010-05-01 07:06:51 -0500 (Sat, 01 May 2010) | 1 line Describe memoryview ........ r80686 | antoine.pitrou | 2010-05-01 07:16:39 -0500 (Sat, 01 May 2010) | 4 lines Fix attribution. Travis didn't do much and he did a bad work. (yes, this is a sensitive subject, sorry) ........ r80748 | andrew.kuchling | 2010-05-03 20:24:22 -0500 (Mon, 03 May 2010) | 1 line Add some more items; the urlparse change is added twice ........ r80852 | andrew.kuchling | 2010-05-05 20:09:47 -0500 (Wed, 05 May 2010) | 1 line Reword paragraph; fix filename, which should be pyconfig.h ........ r80854 | andrew.kuchling | 2010-05-05 20:10:56 -0500 (Wed, 05 May 2010) | 1 line Add various items ........ r80870 | andrew.kuchling | 2010-05-06 09:14:09 -0500 (Thu, 06 May 2010) | 1 line Describe ElementTree 1.3; rearrange new-module sections; describe dict views as sets; small edits and items ........ r80872 | andrew.kuchling | 2010-05-06 12:21:59 -0500 (Thu, 06 May 2010) | 1 line Add 2 items; record ideas for two initial sections; clarify wording ........ r80873 | andrew.kuchling | 2010-05-06 12:27:57 -0500 (Thu, 06 May 2010) | 1 line Change section title; point to unittest2 ........ r80907 | andrew.kuchling | 2010-05-06 20:45:14 -0500 (Thu, 06 May 2010) | 1 line Add a new section on the development plan; add an item ........ r80915 | antoine.pitrou | 2010-05-07 05:15:51 -0500 (Fri, 07 May 2010) | 3 lines Fix some markup and a class name. Also, wrap a long line. ........ r80916 | andrew.kuchling | 2010-05-07 06:30:47 -0500 (Fri, 07 May 2010) | 1 line Re-word text ........ r80951 | andrew.kuchling | 2010-05-07 20:15:26 -0500 (Fri, 07 May 2010) | 1 line Add two items ........ r80952 | andrew.kuchling | 2010-05-07 20:35:55 -0500 (Fri, 07 May 2010) | 1 line Get accents correct ........ r80976 | andrew.kuchling | 2010-05-08 08:28:03 -0500 (Sat, 08 May 2010) | 1 line Add logging.dictConfig example; give up on writing a Ttk example ........ r80977 | andrew.kuchling | 2010-05-08 08:29:46 -0500 (Sat, 08 May 2010) | 1 line Markup fixes ........ r80985 | andrew.kuchling | 2010-05-08 10:39:46 -0500 (Sat, 08 May 2010) | 7 lines Write summary of the 2.7 release; rewrite the future section some more; mention PYTHONWARNINGS env. var; tweak some examples for readability. And with this commit, the "What's New" is done... except for a complete read-through to polish the text, and fixing any reported errors, but those tasks can easily wait until after beta2. ........ r81038 | benjamin.peterson | 2010-05-09 16:09:40 -0500 (Sun, 09 May 2010) | 1 line finish clause ........ r81039 | andrew.kuchling | 2010-05-10 09:18:27 -0500 (Mon, 10 May 2010) | 1 line Markup fix; re-word a sentence ........ r81040 | andrew.kuchling | 2010-05-10 09:20:12 -0500 (Mon, 10 May 2010) | 1 line Use title case ........ r81042 | andrew.kuchling | 2010-05-10 10:03:35 -0500 (Mon, 10 May 2010) | 1 line Link to unittest2 article ........ r81053 | florent.xicluna | 2010-05-10 14:59:22 -0500 (Mon, 10 May 2010) | 2 lines Add a link on maketrans(). ........ r81070 | andrew.kuchling | 2010-05-10 18:13:41 -0500 (Mon, 10 May 2010) | 1 line Fix typo ........ r81104 | andrew.kuchling | 2010-05-11 19:38:44 -0500 (Tue, 11 May 2010) | 1 line Revision pass: lots of edits, typo fixes, rearrangements ........ r81105 | andrew.kuchling | 2010-05-11 19:40:47 -0500 (Tue, 11 May 2010) | 1 line Let's call this done ........ r81114 | andrew.kuchling | 2010-05-12 08:56:07 -0500 (Wed, 12 May 2010) | 1 line Grammar fix ........ r81125 | andrew.kuchling | 2010-05-12 13:56:48 -0500 (Wed, 12 May 2010) | 1 line #8696: add documentation for logging.config.dictConfig (PEP 391) ........ r81245 | andrew.kuchling | 2010-05-16 18:31:16 -0500 (Sun, 16 May 2010) | 1 line Add cross-reference to later section ........ r81285 | vinay.sajip | 2010-05-18 03:16:27 -0500 (Tue, 18 May 2010) | 1 line Fixed minor typo in ReST markup. ........ r81402 | vinay.sajip | 2010-05-21 12:41:34 -0500 (Fri, 21 May 2010) | 1 line Updated logging documentation with more dictConfig information. ........ r81463 | georg.brandl | 2010-05-22 03:17:23 -0500 (Sat, 22 May 2010) | 1 line #8785: less confusing description of regex.find*. ........ r81516 | andrew.kuchling | 2010-05-25 08:34:08 -0500 (Tue, 25 May 2010) | 1 line Add three items ........ r81562 | andrew.kuchling | 2010-05-27 08:22:53 -0500 (Thu, 27 May 2010) | 1 line Rewrite wxWidgets section ........ r81563 | andrew.kuchling | 2010-05-27 08:30:09 -0500 (Thu, 27 May 2010) | 1 line Remove top-level 'General Questions' section, pushing up the questions it contains ........ r81567 | andrew.kuchling | 2010-05-27 16:29:59 -0500 (Thu, 27 May 2010) | 1 line Add item ........ r81593 | georg.brandl | 2010-05-29 03:46:18 -0500 (Sat, 29 May 2010) | 1 line #8616: add new turtle demo "nim". ........ r81635 | georg.brandl | 2010-06-01 02:25:23 -0500 (Tue, 01 Jun 2010) | 1 line Put docs for RegexObject.search() before RegexObject.match() to mirror re.search() and re.match() order. ........ r81680 | vinay.sajip | 2010-06-03 17:34:42 -0500 (Thu, 03 Jun 2010) | 1 line Issue #8890: Documentation changed to avoid reference to temporary files. ........ r81681 | sean.reifschneider | 2010-06-03 20:51:26 -0500 (Thu, 03 Jun 2010) | 2 lines Issue8810: Clearing up docstring for tzinfo.utcoffset. ........ r81684 | vinay.sajip | 2010-06-04 08:41:02 -0500 (Fri, 04 Jun 2010) | 1 line Issue #8890: Documentation changed to avoid reference to temporary files - other cases covered. ........ r81801 | andrew.kuchling | 2010-06-07 08:38:40 -0500 (Mon, 07 Jun 2010) | 1 line #8875: Remove duplicated paragraph ........ r81888 | andrew.kuchling | 2010-06-10 20:54:58 -0500 (Thu, 10 Jun 2010) | 1 line Add a few more items ........ r81931 | georg.brandl | 2010-06-12 01:26:54 -0500 (Sat, 12 Jun 2010) | 1 line Fix punctuation. ........ r81932 | georg.brandl | 2010-06-12 01:28:58 -0500 (Sat, 12 Jun 2010) | 1 line Document that an existing directory raises in mkdir(). ........ r81933 | georg.brandl | 2010-06-12 01:45:33 -0500 (Sat, 12 Jun 2010) | 1 line Update version in README. ........ r81939 | georg.brandl | 2010-06-12 04:45:01 -0500 (Sat, 12 Jun 2010) | 1 line Use newer toctree syntax. ........ r81940 | georg.brandl | 2010-06-12 04:45:28 -0500 (Sat, 12 Jun 2010) | 1 line Add document on how to build. ........ r81941 | georg.brandl | 2010-06-12 04:45:58 -0500 (Sat, 12 Jun 2010) | 1 line Fix gratuitous indentation. ........ r81942 | georg.brandl | 2010-06-12 04:46:03 -0500 (Sat, 12 Jun 2010) | 1 line Update README. ........ r81963 | andrew.kuchling | 2010-06-12 15:00:55 -0500 (Sat, 12 Jun 2010) | 1 line Grammar fix ........ r81984 | georg.brandl | 2010-06-14 10:58:39 -0500 (Mon, 14 Jun 2010) | 1 line #8993: fix reference. ........ r81991 | andrew.kuchling | 2010-06-14 19:38:58 -0500 (Mon, 14 Jun 2010) | 1 line Add another bunch of items ........ r82120 | andrew.kuchling | 2010-06-20 16:45:45 -0500 (Sun, 20 Jun 2010) | 1 line Note that Python 3.x isn't covered; add forward ref. for UTF-8; note error in 2.5 and up ........ r82188 | benjamin.peterson | 2010-06-23 19:02:46 -0500 (Wed, 23 Jun 2010) | 1 line remove reverted changed ........ r82264 | georg.brandl | 2010-06-27 05:47:47 -0500 (Sun, 27 Jun 2010) | 1 line Confusing punctuation. ........ r82265 | georg.brandl | 2010-06-27 05:49:23 -0500 (Sun, 27 Jun 2010) | 1 line Use designated syntax for optional grammar element. ........ r82266 | georg.brandl | 2010-06-27 05:51:44 -0500 (Sun, 27 Jun 2010) | 1 line Fix URL. ........ r82267 | georg.brandl | 2010-06-27 05:55:38 -0500 (Sun, 27 Jun 2010) | 1 line Two typos. ........
16 years ago
Merged revisions 80605-80609,80642-80646,80651-80652,80674,80684-80686,80748,80852,80854,80870,80872-80873,80907,80915-80916,80951-80952,80976-80977,80985,81038-81040,81042,81053,81070,81104-81105,81114,81125,81245,81285,81402,81463,81516,81562-81563,81567,81593,81635,81680-81681,81684,81801,81888,81931-81933,81939-81942,81963,81984,81991,82120,82188,82264-82267 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r80605 | andrew.kuchling | 2010-04-28 19:22:16 -0500 (Wed, 28 Apr 2010) | 1 line Add various items ........ r80606 | andrew.kuchling | 2010-04-28 20:44:30 -0500 (Wed, 28 Apr 2010) | 6 lines Fix doubled 'the'. Markup fixes to use :exc:, :option: in a few places. (Glitch: unittest.main's -c ends up a link to the Python interpreter's -c option. Should we skip using :option: for that switch, or disable the auto-linking somehow?) ........ r80607 | andrew.kuchling | 2010-04-28 20:45:41 -0500 (Wed, 28 Apr 2010) | 1 line Add various unittest items ........ r80608 | benjamin.peterson | 2010-04-28 22:18:05 -0500 (Wed, 28 Apr 2010) | 1 line update pypy description ........ r80609 | benjamin.peterson | 2010-04-28 22:30:59 -0500 (Wed, 28 Apr 2010) | 1 line update pypy url ........ r80642 | andrew.kuchling | 2010-04-29 19:49:09 -0500 (Thu, 29 Apr 2010) | 1 line Always add space after RFC; reword paragraph ........ r80643 | andrew.kuchling | 2010-04-29 19:52:31 -0500 (Thu, 29 Apr 2010) | 6 lines Reword paragraph to make its meaning clearer. Antoine Pitrou: is my version of the paragraph still correct? R. David Murray: is this more understandable than the previous version? ........ r80644 | andrew.kuchling | 2010-04-29 20:02:15 -0500 (Thu, 29 Apr 2010) | 1 line Fix typos ........ r80645 | andrew.kuchling | 2010-04-29 20:32:47 -0500 (Thu, 29 Apr 2010) | 1 line Markup fix; clarify by adding 'in that order' ........ r80646 | andrew.kuchling | 2010-04-29 20:33:40 -0500 (Thu, 29 Apr 2010) | 1 line Add various items; rearrange unittest section a bit ........ r80651 | andrew.kuchling | 2010-04-30 08:46:55 -0500 (Fri, 30 Apr 2010) | 1 line Minor grammar re-wording ........ r80652 | andrew.kuchling | 2010-04-30 08:47:34 -0500 (Fri, 30 Apr 2010) | 1 line Add item ........ r80674 | andrew.kuchling | 2010-04-30 20:19:16 -0500 (Fri, 30 Apr 2010) | 1 line Add various items ........ r80684 | andrew.kuchling | 2010-05-01 07:05:52 -0500 (Sat, 01 May 2010) | 1 line Minor grammar fix ........ r80685 | andrew.kuchling | 2010-05-01 07:06:51 -0500 (Sat, 01 May 2010) | 1 line Describe memoryview ........ r80686 | antoine.pitrou | 2010-05-01 07:16:39 -0500 (Sat, 01 May 2010) | 4 lines Fix attribution. Travis didn't do much and he did a bad work. (yes, this is a sensitive subject, sorry) ........ r80748 | andrew.kuchling | 2010-05-03 20:24:22 -0500 (Mon, 03 May 2010) | 1 line Add some more items; the urlparse change is added twice ........ r80852 | andrew.kuchling | 2010-05-05 20:09:47 -0500 (Wed, 05 May 2010) | 1 line Reword paragraph; fix filename, which should be pyconfig.h ........ r80854 | andrew.kuchling | 2010-05-05 20:10:56 -0500 (Wed, 05 May 2010) | 1 line Add various items ........ r80870 | andrew.kuchling | 2010-05-06 09:14:09 -0500 (Thu, 06 May 2010) | 1 line Describe ElementTree 1.3; rearrange new-module sections; describe dict views as sets; small edits and items ........ r80872 | andrew.kuchling | 2010-05-06 12:21:59 -0500 (Thu, 06 May 2010) | 1 line Add 2 items; record ideas for two initial sections; clarify wording ........ r80873 | andrew.kuchling | 2010-05-06 12:27:57 -0500 (Thu, 06 May 2010) | 1 line Change section title; point to unittest2 ........ r80907 | andrew.kuchling | 2010-05-06 20:45:14 -0500 (Thu, 06 May 2010) | 1 line Add a new section on the development plan; add an item ........ r80915 | antoine.pitrou | 2010-05-07 05:15:51 -0500 (Fri, 07 May 2010) | 3 lines Fix some markup and a class name. Also, wrap a long line. ........ r80916 | andrew.kuchling | 2010-05-07 06:30:47 -0500 (Fri, 07 May 2010) | 1 line Re-word text ........ r80951 | andrew.kuchling | 2010-05-07 20:15:26 -0500 (Fri, 07 May 2010) | 1 line Add two items ........ r80952 | andrew.kuchling | 2010-05-07 20:35:55 -0500 (Fri, 07 May 2010) | 1 line Get accents correct ........ r80976 | andrew.kuchling | 2010-05-08 08:28:03 -0500 (Sat, 08 May 2010) | 1 line Add logging.dictConfig example; give up on writing a Ttk example ........ r80977 | andrew.kuchling | 2010-05-08 08:29:46 -0500 (Sat, 08 May 2010) | 1 line Markup fixes ........ r80985 | andrew.kuchling | 2010-05-08 10:39:46 -0500 (Sat, 08 May 2010) | 7 lines Write summary of the 2.7 release; rewrite the future section some more; mention PYTHONWARNINGS env. var; tweak some examples for readability. And with this commit, the "What's New" is done... except for a complete read-through to polish the text, and fixing any reported errors, but those tasks can easily wait until after beta2. ........ r81038 | benjamin.peterson | 2010-05-09 16:09:40 -0500 (Sun, 09 May 2010) | 1 line finish clause ........ r81039 | andrew.kuchling | 2010-05-10 09:18:27 -0500 (Mon, 10 May 2010) | 1 line Markup fix; re-word a sentence ........ r81040 | andrew.kuchling | 2010-05-10 09:20:12 -0500 (Mon, 10 May 2010) | 1 line Use title case ........ r81042 | andrew.kuchling | 2010-05-10 10:03:35 -0500 (Mon, 10 May 2010) | 1 line Link to unittest2 article ........ r81053 | florent.xicluna | 2010-05-10 14:59:22 -0500 (Mon, 10 May 2010) | 2 lines Add a link on maketrans(). ........ r81070 | andrew.kuchling | 2010-05-10 18:13:41 -0500 (Mon, 10 May 2010) | 1 line Fix typo ........ r81104 | andrew.kuchling | 2010-05-11 19:38:44 -0500 (Tue, 11 May 2010) | 1 line Revision pass: lots of edits, typo fixes, rearrangements ........ r81105 | andrew.kuchling | 2010-05-11 19:40:47 -0500 (Tue, 11 May 2010) | 1 line Let's call this done ........ r81114 | andrew.kuchling | 2010-05-12 08:56:07 -0500 (Wed, 12 May 2010) | 1 line Grammar fix ........ r81125 | andrew.kuchling | 2010-05-12 13:56:48 -0500 (Wed, 12 May 2010) | 1 line #8696: add documentation for logging.config.dictConfig (PEP 391) ........ r81245 | andrew.kuchling | 2010-05-16 18:31:16 -0500 (Sun, 16 May 2010) | 1 line Add cross-reference to later section ........ r81285 | vinay.sajip | 2010-05-18 03:16:27 -0500 (Tue, 18 May 2010) | 1 line Fixed minor typo in ReST markup. ........ r81402 | vinay.sajip | 2010-05-21 12:41:34 -0500 (Fri, 21 May 2010) | 1 line Updated logging documentation with more dictConfig information. ........ r81463 | georg.brandl | 2010-05-22 03:17:23 -0500 (Sat, 22 May 2010) | 1 line #8785: less confusing description of regex.find*. ........ r81516 | andrew.kuchling | 2010-05-25 08:34:08 -0500 (Tue, 25 May 2010) | 1 line Add three items ........ r81562 | andrew.kuchling | 2010-05-27 08:22:53 -0500 (Thu, 27 May 2010) | 1 line Rewrite wxWidgets section ........ r81563 | andrew.kuchling | 2010-05-27 08:30:09 -0500 (Thu, 27 May 2010) | 1 line Remove top-level 'General Questions' section, pushing up the questions it contains ........ r81567 | andrew.kuchling | 2010-05-27 16:29:59 -0500 (Thu, 27 May 2010) | 1 line Add item ........ r81593 | georg.brandl | 2010-05-29 03:46:18 -0500 (Sat, 29 May 2010) | 1 line #8616: add new turtle demo "nim". ........ r81635 | georg.brandl | 2010-06-01 02:25:23 -0500 (Tue, 01 Jun 2010) | 1 line Put docs for RegexObject.search() before RegexObject.match() to mirror re.search() and re.match() order. ........ r81680 | vinay.sajip | 2010-06-03 17:34:42 -0500 (Thu, 03 Jun 2010) | 1 line Issue #8890: Documentation changed to avoid reference to temporary files. ........ r81681 | sean.reifschneider | 2010-06-03 20:51:26 -0500 (Thu, 03 Jun 2010) | 2 lines Issue8810: Clearing up docstring for tzinfo.utcoffset. ........ r81684 | vinay.sajip | 2010-06-04 08:41:02 -0500 (Fri, 04 Jun 2010) | 1 line Issue #8890: Documentation changed to avoid reference to temporary files - other cases covered. ........ r81801 | andrew.kuchling | 2010-06-07 08:38:40 -0500 (Mon, 07 Jun 2010) | 1 line #8875: Remove duplicated paragraph ........ r81888 | andrew.kuchling | 2010-06-10 20:54:58 -0500 (Thu, 10 Jun 2010) | 1 line Add a few more items ........ r81931 | georg.brandl | 2010-06-12 01:26:54 -0500 (Sat, 12 Jun 2010) | 1 line Fix punctuation. ........ r81932 | georg.brandl | 2010-06-12 01:28:58 -0500 (Sat, 12 Jun 2010) | 1 line Document that an existing directory raises in mkdir(). ........ r81933 | georg.brandl | 2010-06-12 01:45:33 -0500 (Sat, 12 Jun 2010) | 1 line Update version in README. ........ r81939 | georg.brandl | 2010-06-12 04:45:01 -0500 (Sat, 12 Jun 2010) | 1 line Use newer toctree syntax. ........ r81940 | georg.brandl | 2010-06-12 04:45:28 -0500 (Sat, 12 Jun 2010) | 1 line Add document on how to build. ........ r81941 | georg.brandl | 2010-06-12 04:45:58 -0500 (Sat, 12 Jun 2010) | 1 line Fix gratuitous indentation. ........ r81942 | georg.brandl | 2010-06-12 04:46:03 -0500 (Sat, 12 Jun 2010) | 1 line Update README. ........ r81963 | andrew.kuchling | 2010-06-12 15:00:55 -0500 (Sat, 12 Jun 2010) | 1 line Grammar fix ........ r81984 | georg.brandl | 2010-06-14 10:58:39 -0500 (Mon, 14 Jun 2010) | 1 line #8993: fix reference. ........ r81991 | andrew.kuchling | 2010-06-14 19:38:58 -0500 (Mon, 14 Jun 2010) | 1 line Add another bunch of items ........ r82120 | andrew.kuchling | 2010-06-20 16:45:45 -0500 (Sun, 20 Jun 2010) | 1 line Note that Python 3.x isn't covered; add forward ref. for UTF-8; note error in 2.5 and up ........ r82188 | benjamin.peterson | 2010-06-23 19:02:46 -0500 (Wed, 23 Jun 2010) | 1 line remove reverted changed ........ r82264 | georg.brandl | 2010-06-27 05:47:47 -0500 (Sun, 27 Jun 2010) | 1 line Confusing punctuation. ........ r82265 | georg.brandl | 2010-06-27 05:49:23 -0500 (Sun, 27 Jun 2010) | 1 line Use designated syntax for optional grammar element. ........ r82266 | georg.brandl | 2010-06-27 05:51:44 -0500 (Sun, 27 Jun 2010) | 1 line Fix URL. ........ r82267 | georg.brandl | 2010-06-27 05:55:38 -0500 (Sun, 27 Jun 2010) | 1 line Two typos. ........
16 years ago
Merged revisions 80605-80609,80642-80646,80651-80652,80674,80684-80686,80748,80852,80854,80870,80872-80873,80907,80915-80916,80951-80952,80976-80977,80985,81038-81040,81042,81053,81070,81104-81105,81114,81125,81245,81285,81402,81463,81516,81562-81563,81567,81593,81635,81680-81681,81684,81801,81888,81931-81933,81939-81942,81963,81984,81991,82120,82188,82264-82267 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r80605 | andrew.kuchling | 2010-04-28 19:22:16 -0500 (Wed, 28 Apr 2010) | 1 line Add various items ........ r80606 | andrew.kuchling | 2010-04-28 20:44:30 -0500 (Wed, 28 Apr 2010) | 6 lines Fix doubled 'the'. Markup fixes to use :exc:, :option: in a few places. (Glitch: unittest.main's -c ends up a link to the Python interpreter's -c option. Should we skip using :option: for that switch, or disable the auto-linking somehow?) ........ r80607 | andrew.kuchling | 2010-04-28 20:45:41 -0500 (Wed, 28 Apr 2010) | 1 line Add various unittest items ........ r80608 | benjamin.peterson | 2010-04-28 22:18:05 -0500 (Wed, 28 Apr 2010) | 1 line update pypy description ........ r80609 | benjamin.peterson | 2010-04-28 22:30:59 -0500 (Wed, 28 Apr 2010) | 1 line update pypy url ........ r80642 | andrew.kuchling | 2010-04-29 19:49:09 -0500 (Thu, 29 Apr 2010) | 1 line Always add space after RFC; reword paragraph ........ r80643 | andrew.kuchling | 2010-04-29 19:52:31 -0500 (Thu, 29 Apr 2010) | 6 lines Reword paragraph to make its meaning clearer. Antoine Pitrou: is my version of the paragraph still correct? R. David Murray: is this more understandable than the previous version? ........ r80644 | andrew.kuchling | 2010-04-29 20:02:15 -0500 (Thu, 29 Apr 2010) | 1 line Fix typos ........ r80645 | andrew.kuchling | 2010-04-29 20:32:47 -0500 (Thu, 29 Apr 2010) | 1 line Markup fix; clarify by adding 'in that order' ........ r80646 | andrew.kuchling | 2010-04-29 20:33:40 -0500 (Thu, 29 Apr 2010) | 1 line Add various items; rearrange unittest section a bit ........ r80651 | andrew.kuchling | 2010-04-30 08:46:55 -0500 (Fri, 30 Apr 2010) | 1 line Minor grammar re-wording ........ r80652 | andrew.kuchling | 2010-04-30 08:47:34 -0500 (Fri, 30 Apr 2010) | 1 line Add item ........ r80674 | andrew.kuchling | 2010-04-30 20:19:16 -0500 (Fri, 30 Apr 2010) | 1 line Add various items ........ r80684 | andrew.kuchling | 2010-05-01 07:05:52 -0500 (Sat, 01 May 2010) | 1 line Minor grammar fix ........ r80685 | andrew.kuchling | 2010-05-01 07:06:51 -0500 (Sat, 01 May 2010) | 1 line Describe memoryview ........ r80686 | antoine.pitrou | 2010-05-01 07:16:39 -0500 (Sat, 01 May 2010) | 4 lines Fix attribution. Travis didn't do much and he did a bad work. (yes, this is a sensitive subject, sorry) ........ r80748 | andrew.kuchling | 2010-05-03 20:24:22 -0500 (Mon, 03 May 2010) | 1 line Add some more items; the urlparse change is added twice ........ r80852 | andrew.kuchling | 2010-05-05 20:09:47 -0500 (Wed, 05 May 2010) | 1 line Reword paragraph; fix filename, which should be pyconfig.h ........ r80854 | andrew.kuchling | 2010-05-05 20:10:56 -0500 (Wed, 05 May 2010) | 1 line Add various items ........ r80870 | andrew.kuchling | 2010-05-06 09:14:09 -0500 (Thu, 06 May 2010) | 1 line Describe ElementTree 1.3; rearrange new-module sections; describe dict views as sets; small edits and items ........ r80872 | andrew.kuchling | 2010-05-06 12:21:59 -0500 (Thu, 06 May 2010) | 1 line Add 2 items; record ideas for two initial sections; clarify wording ........ r80873 | andrew.kuchling | 2010-05-06 12:27:57 -0500 (Thu, 06 May 2010) | 1 line Change section title; point to unittest2 ........ r80907 | andrew.kuchling | 2010-05-06 20:45:14 -0500 (Thu, 06 May 2010) | 1 line Add a new section on the development plan; add an item ........ r80915 | antoine.pitrou | 2010-05-07 05:15:51 -0500 (Fri, 07 May 2010) | 3 lines Fix some markup and a class name. Also, wrap a long line. ........ r80916 | andrew.kuchling | 2010-05-07 06:30:47 -0500 (Fri, 07 May 2010) | 1 line Re-word text ........ r80951 | andrew.kuchling | 2010-05-07 20:15:26 -0500 (Fri, 07 May 2010) | 1 line Add two items ........ r80952 | andrew.kuchling | 2010-05-07 20:35:55 -0500 (Fri, 07 May 2010) | 1 line Get accents correct ........ r80976 | andrew.kuchling | 2010-05-08 08:28:03 -0500 (Sat, 08 May 2010) | 1 line Add logging.dictConfig example; give up on writing a Ttk example ........ r80977 | andrew.kuchling | 2010-05-08 08:29:46 -0500 (Sat, 08 May 2010) | 1 line Markup fixes ........ r80985 | andrew.kuchling | 2010-05-08 10:39:46 -0500 (Sat, 08 May 2010) | 7 lines Write summary of the 2.7 release; rewrite the future section some more; mention PYTHONWARNINGS env. var; tweak some examples for readability. And with this commit, the "What's New" is done... except for a complete read-through to polish the text, and fixing any reported errors, but those tasks can easily wait until after beta2. ........ r81038 | benjamin.peterson | 2010-05-09 16:09:40 -0500 (Sun, 09 May 2010) | 1 line finish clause ........ r81039 | andrew.kuchling | 2010-05-10 09:18:27 -0500 (Mon, 10 May 2010) | 1 line Markup fix; re-word a sentence ........ r81040 | andrew.kuchling | 2010-05-10 09:20:12 -0500 (Mon, 10 May 2010) | 1 line Use title case ........ r81042 | andrew.kuchling | 2010-05-10 10:03:35 -0500 (Mon, 10 May 2010) | 1 line Link to unittest2 article ........ r81053 | florent.xicluna | 2010-05-10 14:59:22 -0500 (Mon, 10 May 2010) | 2 lines Add a link on maketrans(). ........ r81070 | andrew.kuchling | 2010-05-10 18:13:41 -0500 (Mon, 10 May 2010) | 1 line Fix typo ........ r81104 | andrew.kuchling | 2010-05-11 19:38:44 -0500 (Tue, 11 May 2010) | 1 line Revision pass: lots of edits, typo fixes, rearrangements ........ r81105 | andrew.kuchling | 2010-05-11 19:40:47 -0500 (Tue, 11 May 2010) | 1 line Let's call this done ........ r81114 | andrew.kuchling | 2010-05-12 08:56:07 -0500 (Wed, 12 May 2010) | 1 line Grammar fix ........ r81125 | andrew.kuchling | 2010-05-12 13:56:48 -0500 (Wed, 12 May 2010) | 1 line #8696: add documentation for logging.config.dictConfig (PEP 391) ........ r81245 | andrew.kuchling | 2010-05-16 18:31:16 -0500 (Sun, 16 May 2010) | 1 line Add cross-reference to later section ........ r81285 | vinay.sajip | 2010-05-18 03:16:27 -0500 (Tue, 18 May 2010) | 1 line Fixed minor typo in ReST markup. ........ r81402 | vinay.sajip | 2010-05-21 12:41:34 -0500 (Fri, 21 May 2010) | 1 line Updated logging documentation with more dictConfig information. ........ r81463 | georg.brandl | 2010-05-22 03:17:23 -0500 (Sat, 22 May 2010) | 1 line #8785: less confusing description of regex.find*. ........ r81516 | andrew.kuchling | 2010-05-25 08:34:08 -0500 (Tue, 25 May 2010) | 1 line Add three items ........ r81562 | andrew.kuchling | 2010-05-27 08:22:53 -0500 (Thu, 27 May 2010) | 1 line Rewrite wxWidgets section ........ r81563 | andrew.kuchling | 2010-05-27 08:30:09 -0500 (Thu, 27 May 2010) | 1 line Remove top-level 'General Questions' section, pushing up the questions it contains ........ r81567 | andrew.kuchling | 2010-05-27 16:29:59 -0500 (Thu, 27 May 2010) | 1 line Add item ........ r81593 | georg.brandl | 2010-05-29 03:46:18 -0500 (Sat, 29 May 2010) | 1 line #8616: add new turtle demo "nim". ........ r81635 | georg.brandl | 2010-06-01 02:25:23 -0500 (Tue, 01 Jun 2010) | 1 line Put docs for RegexObject.search() before RegexObject.match() to mirror re.search() and re.match() order. ........ r81680 | vinay.sajip | 2010-06-03 17:34:42 -0500 (Thu, 03 Jun 2010) | 1 line Issue #8890: Documentation changed to avoid reference to temporary files. ........ r81681 | sean.reifschneider | 2010-06-03 20:51:26 -0500 (Thu, 03 Jun 2010) | 2 lines Issue8810: Clearing up docstring for tzinfo.utcoffset. ........ r81684 | vinay.sajip | 2010-06-04 08:41:02 -0500 (Fri, 04 Jun 2010) | 1 line Issue #8890: Documentation changed to avoid reference to temporary files - other cases covered. ........ r81801 | andrew.kuchling | 2010-06-07 08:38:40 -0500 (Mon, 07 Jun 2010) | 1 line #8875: Remove duplicated paragraph ........ r81888 | andrew.kuchling | 2010-06-10 20:54:58 -0500 (Thu, 10 Jun 2010) | 1 line Add a few more items ........ r81931 | georg.brandl | 2010-06-12 01:26:54 -0500 (Sat, 12 Jun 2010) | 1 line Fix punctuation. ........ r81932 | georg.brandl | 2010-06-12 01:28:58 -0500 (Sat, 12 Jun 2010) | 1 line Document that an existing directory raises in mkdir(). ........ r81933 | georg.brandl | 2010-06-12 01:45:33 -0500 (Sat, 12 Jun 2010) | 1 line Update version in README. ........ r81939 | georg.brandl | 2010-06-12 04:45:01 -0500 (Sat, 12 Jun 2010) | 1 line Use newer toctree syntax. ........ r81940 | georg.brandl | 2010-06-12 04:45:28 -0500 (Sat, 12 Jun 2010) | 1 line Add document on how to build. ........ r81941 | georg.brandl | 2010-06-12 04:45:58 -0500 (Sat, 12 Jun 2010) | 1 line Fix gratuitous indentation. ........ r81942 | georg.brandl | 2010-06-12 04:46:03 -0500 (Sat, 12 Jun 2010) | 1 line Update README. ........ r81963 | andrew.kuchling | 2010-06-12 15:00:55 -0500 (Sat, 12 Jun 2010) | 1 line Grammar fix ........ r81984 | georg.brandl | 2010-06-14 10:58:39 -0500 (Mon, 14 Jun 2010) | 1 line #8993: fix reference. ........ r81991 | andrew.kuchling | 2010-06-14 19:38:58 -0500 (Mon, 14 Jun 2010) | 1 line Add another bunch of items ........ r82120 | andrew.kuchling | 2010-06-20 16:45:45 -0500 (Sun, 20 Jun 2010) | 1 line Note that Python 3.x isn't covered; add forward ref. for UTF-8; note error in 2.5 and up ........ r82188 | benjamin.peterson | 2010-06-23 19:02:46 -0500 (Wed, 23 Jun 2010) | 1 line remove reverted changed ........ r82264 | georg.brandl | 2010-06-27 05:47:47 -0500 (Sun, 27 Jun 2010) | 1 line Confusing punctuation. ........ r82265 | georg.brandl | 2010-06-27 05:49:23 -0500 (Sun, 27 Jun 2010) | 1 line Use designated syntax for optional grammar element. ........ r82266 | georg.brandl | 2010-06-27 05:51:44 -0500 (Sun, 27 Jun 2010) | 1 line Fix URL. ........ r82267 | georg.brandl | 2010-06-27 05:55:38 -0500 (Sun, 27 Jun 2010) | 1 line Two typos. ........
16 years ago
Merged revisions 59921-59932 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line Speed-up and simplify code urlparse's result objects. ........ r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line Bug #1790: update link; remove outdated paragraph ........ r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines Raise an error instead of crashing with a segfault when a NULL function pointer is called. Will backport to release25-maint. ........ r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines Fix a potential 'SystemError: NULL result without error'. NULL may be a valid return value from PyLong_AsVoidPtr. Will backport to release25-maint. ........ r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line Update the opcode docs for STORE_MAP and BUILD_MAP ........ r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines Issue 1780: Allow leading and trailing whitespace in Decimal constructor, when constructing from a string. Disallow trailing newlines in Context.create_decimal. ........ r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines Move OSError docs to exceptions doc, remove obsolete descriptions from os docs, rework posix docs. ........ r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines Patch #1700288: Method cache optimization, by Armin Rigo, ported to 2.6 by Kevin Jacobs. ........ r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines Fix editing glitch. ........
18 years ago
Merged revisions 59921-59932 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r59923 | raymond.hettinger | 2008-01-11 19:04:55 +0100 (Fri, 11 Jan 2008) | 1 line Speed-up and simplify code urlparse's result objects. ........ r59924 | andrew.kuchling | 2008-01-11 20:33:24 +0100 (Fri, 11 Jan 2008) | 1 line Bug #1790: update link; remove outdated paragraph ........ r59925 | thomas.heller | 2008-01-11 20:34:06 +0100 (Fri, 11 Jan 2008) | 5 lines Raise an error instead of crashing with a segfault when a NULL function pointer is called. Will backport to release25-maint. ........ r59927 | thomas.heller | 2008-01-11 21:29:19 +0100 (Fri, 11 Jan 2008) | 4 lines Fix a potential 'SystemError: NULL result without error'. NULL may be a valid return value from PyLong_AsVoidPtr. Will backport to release25-maint. ........ r59928 | raymond.hettinger | 2008-01-12 00:25:18 +0100 (Sat, 12 Jan 2008) | 1 line Update the opcode docs for STORE_MAP and BUILD_MAP ........ r59929 | mark.dickinson | 2008-01-12 02:56:00 +0100 (Sat, 12 Jan 2008) | 4 lines Issue 1780: Allow leading and trailing whitespace in Decimal constructor, when constructing from a string. Disallow trailing newlines in Context.create_decimal. ........ r59930 | georg.brandl | 2008-01-12 11:53:29 +0100 (Sat, 12 Jan 2008) | 3 lines Move OSError docs to exceptions doc, remove obsolete descriptions from os docs, rework posix docs. ........ r59931 | georg.brandl | 2008-01-12 14:47:57 +0100 (Sat, 12 Jan 2008) | 3 lines Patch #1700288: Method cache optimization, by Armin Rigo, ported to 2.6 by Kevin Jacobs. ........ r59932 | georg.brandl | 2008-01-12 17:11:09 +0100 (Sat, 12 Jan 2008) | 2 lines Fix editing glitch. ........
18 years ago
Merged revisions 59703-59773 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r59704 | christian.heimes | 2008-01-04 04:15:05 +0100 (Fri, 04 Jan 2008) | 1 line Moved include "Python.h" in front of other imports to silence a warning. ........ r59706 | raymond.hettinger | 2008-01-04 04:22:53 +0100 (Fri, 04 Jan 2008) | 10 lines Minor fix-ups to named tuples: * Make the _replace() method respect subclassing. * Using property() to make _fields read-only wasn't a good idea. It caused len(Point._fields) to fail. * Add note to _cast() about length checking and alternative with the star-operator. ........ r59707 | jeffrey.yasskin | 2008-01-04 09:01:23 +0100 (Fri, 04 Jan 2008) | 3 lines Make math.{floor,ceil}({int,long}) return float again for backwards compatibility after r59671 made them return integral types. ........ r59709 | christian.heimes | 2008-01-04 14:21:07 +0100 (Fri, 04 Jan 2008) | 1 line Bug #1713: posixpath.ismount() claims symlink to a mountpoint is a mountpoint. ........ r59712 | lars.gustaebel | 2008-01-04 15:00:33 +0100 (Fri, 04 Jan 2008) | 5 lines Issue #1735: TarFile.extractall() now correctly sets directory permissions and times. (will backport to 2.5) ........ r59714 | andrew.kuchling | 2008-01-04 15:47:17 +0100 (Fri, 04 Jan 2008) | 1 line Update links to bug/patch tracker ........ r59716 | christian.heimes | 2008-01-04 16:23:30 +0100 (Fri, 04 Jan 2008) | 1 line Added interface to Windows' WSAIoctl and a simple example for a network sniffer. ........ r59717 | christian.heimes | 2008-01-04 16:29:00 +0100 (Fri, 04 Jan 2008) | 1 line And here is the rest of Hirokazu Yamamoto's patch for VS6.0 support. Thanks Hiro! ........ r59719 | christian.heimes | 2008-01-04 16:34:06 +0100 (Fri, 04 Jan 2008) | 1 line Reverted last transaction. It's the wrong branch. ........ r59721 | christian.heimes | 2008-01-04 16:48:06 +0100 (Fri, 04 Jan 2008) | 1 line socket.ioctl is only available on Windows ........ r59722 | andrew.kuchling | 2008-01-04 19:24:41 +0100 (Fri, 04 Jan 2008) | 1 line Fix markup ........ r59723 | andrew.kuchling | 2008-01-04 19:25:05 +0100 (Fri, 04 Jan 2008) | 1 line Fix markup ........ r59725 | guido.van.rossum | 2008-01-05 01:59:59 +0100 (Sat, 05 Jan 2008) | 3 lines Patch #1725 by Mark Dickinson, fixes incorrect conversion of -1e1000 and adds errors for -0x. ........ r59726 | guido.van.rossum | 2008-01-05 02:21:57 +0100 (Sat, 05 Jan 2008) | 2 lines Patch #1698 by Senthil: allow '@' in username when parsed by urlparse.py. ........ r59727 | raymond.hettinger | 2008-01-05 02:35:43 +0100 (Sat, 05 Jan 2008) | 1 line Improve namedtuple's _cast() method with a docstring, new name, and error-checking. ........ r59728 | raymond.hettinger | 2008-01-05 03:17:24 +0100 (Sat, 05 Jan 2008) | 1 line Add error-checking to namedtuple's _replace() method. ........ r59730 | fred.drake | 2008-01-05 05:38:38 +0100 (Sat, 05 Jan 2008) | 2 lines clean up a comment ........ r59731 | jeffrey.yasskin | 2008-01-05 09:47:13 +0100 (Sat, 05 Jan 2008) | 11 lines Continue rolling back pep-3141 changes that changed behavior from 2.5. This round included: * Revert round to its 2.6 behavior (half away from 0). * Because round, floor, and ceil always return float again, it's no longer necessary to have them delegate to __xxx___, so I've ripped that out of their implementations and the Real ABC. This also helps in implementing types that work in both 2.6 and 3.0: you return int from the __xxx__ methods, and let it get enabled by the version upgrade. * Make pow(-1, .5) raise a ValueError again. ........ r59736 | andrew.kuchling | 2008-01-05 16:13:49 +0100 (Sat, 05 Jan 2008) | 1 line Fix comment typo ........ r59738 | thomas.heller | 2008-01-05 18:15:44 +0100 (Sat, 05 Jan 2008) | 1 line Add myself. ........ r59739 | georg.brandl | 2008-01-05 18:49:17 +0100 (Sat, 05 Jan 2008) | 2 lines Fix C++-style comment. ........ r59742 | georg.brandl | 2008-01-05 20:28:16 +0100 (Sat, 05 Jan 2008) | 2 lines Remove with_statement future imports from 2.6 docs. ........ r59743 | georg.brandl | 2008-01-05 20:29:45 +0100 (Sat, 05 Jan 2008) | 2 lines Simplify index entries; fix #1712. ........ r59744 | georg.brandl | 2008-01-05 20:44:22 +0100 (Sat, 05 Jan 2008) | 2 lines Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst. ........ r59749 | georg.brandl | 2008-01-05 21:29:13 +0100 (Sat, 05 Jan 2008) | 2 lines Revert socket.rst to unix-eol. ........ r59750 | georg.brandl | 2008-01-05 21:33:46 +0100 (Sat, 05 Jan 2008) | 2 lines Set native svn:eol-style property for text files. ........ r59752 | georg.brandl | 2008-01-05 21:46:29 +0100 (Sat, 05 Jan 2008) | 2 lines #1719: capitalization error in "UuidCreate". ........ r59753 | georg.brandl | 2008-01-05 22:02:25 +0100 (Sat, 05 Jan 2008) | 2 lines Repair markup. ........ r59754 | georg.brandl | 2008-01-05 22:10:50 +0100 (Sat, 05 Jan 2008) | 2 lines Use markup. ........ r59757 | christian.heimes | 2008-01-05 22:35:52 +0100 (Sat, 05 Jan 2008) | 1 line Final adjustments for #1601 ........ r59758 | guido.van.rossum | 2008-01-05 23:19:06 +0100 (Sat, 05 Jan 2008) | 3 lines Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'. Fix by John Nagle. ........ r59759 | guido.van.rossum | 2008-01-05 23:20:01 +0100 (Sat, 05 Jan 2008) | 2 lines Add John Nagle (of issue #1637). ........ r59765 | raymond.hettinger | 2008-01-06 10:02:24 +0100 (Sun, 06 Jan 2008) | 1 line Small code simplification. Forgot that classmethods can be called from intances. ........ r59766 | martin.v.loewis | 2008-01-06 11:09:48 +0100 (Sun, 06 Jan 2008) | 2 lines Use vcbuild for VS 2009. ........ r59767 | martin.v.loewis | 2008-01-06 12:03:43 +0100 (Sun, 06 Jan 2008) | 2 lines Package using VS 2008. ........ r59768 | martin.v.loewis | 2008-01-06 12:13:16 +0100 (Sun, 06 Jan 2008) | 2 lines Don't try to package msvcr90 for the moment. ........ r59769 | georg.brandl | 2008-01-06 15:17:36 +0100 (Sun, 06 Jan 2008) | 4 lines #1696393: don't check for '.' and '..' in ntpath.walk since they aren't returned from os.listdir anymore. Reported by Michael Haggerty. ........ r59770 | georg.brandl | 2008-01-06 15:27:15 +0100 (Sun, 06 Jan 2008) | 3 lines #1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir. Reported by Jesse Towner. ........ r59771 | georg.brandl | 2008-01-06 15:33:52 +0100 (Sun, 06 Jan 2008) | 2 lines #1591: Clarify docstring of Popen3. ........ r59772 | georg.brandl | 2008-01-06 16:30:34 +0100 (Sun, 06 Jan 2008) | 2 lines #1680: fix context manager example function name. ........ r59773 | georg.brandl | 2008-01-06 16:34:57 +0100 (Sun, 06 Jan 2008) | 2 lines #1755097: document default values for [].sort() and sorted(). ........
18 years ago
Merged revisions 59465-59487 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r59467 | georg.brandl | 2007-12-11 17:32:49 +0100 (Tue, 11 Dec 2007) | 2 lines Add another GHOP contributor. ........ r59468 | kurt.kaiser | 2007-12-11 20:35:12 +0100 (Tue, 11 Dec 2007) | 3 lines IDLE_tabbedpages.071101.patch Tal Einat Cosmetic changes, one bug. Remove tabpage.py, replaced by tabbedpages.py ........ r59471 | gerhard.haering | 2007-12-11 22:07:40 +0100 (Tue, 11 Dec 2007) | 9 lines Forward-port of commit 59184. - Backported a workaround for a bug in SQLite 3.2.x/3.3.x versions where a statement recompilation with no bound parameters lead to a segfault - Backported a fix necessary because of an SQLite API change in version 3.5. This prevents segfaults when executing empty queries, like our test suite does ........ r59475 | christian.heimes | 2007-12-12 19:09:06 +0100 (Wed, 12 Dec 2007) | 1 line Fixed a nasty problem in the xxmodule.c ........ r59478 | raymond.hettinger | 2007-12-13 01:08:37 +0100 (Thu, 13 Dec 2007) | 1 line Fix bug 1604. deque.__init__() did not clear existing contents like list.__init__. Not a backport candidate. ........ r59480 | alexandre.vassalotti | 2007-12-13 18:58:23 +0100 (Thu, 13 Dec 2007) | 2 lines Fix issue #1313119: urlparse "caches" parses regardless of encoding ........ r59482 | christian.heimes | 2007-12-13 20:23:16 +0100 (Thu, 13 Dec 2007) | 1 line Fixed bug #1613: Makefile's VPATH feature is broken ........ r59484 | guido.van.rossum | 2007-12-13 21:50:10 +0100 (Thu, 13 Dec 2007) | 3 lines Patch #1608. Someone with access to autoconf 2.61 or higher needs to run it and check in the resulting configure file. ........ r59485 | thomas.heller | 2007-12-13 22:20:29 +0100 (Thu, 13 Dec 2007) | 1 line Ran autoconf. ........ r59486 | raymond.hettinger | 2007-12-13 23:55:52 +0100 (Thu, 13 Dec 2007) | 1 line Simplify implementation of __replace__() ........ r59487 | raymond.hettinger | 2007-12-14 00:52:59 +0100 (Fri, 14 Dec 2007) | 1 line Small speedup ........
18 years ago
  1. """Parse (absolute and relative) URLs.
  2. urlparse module is based upon the following RFC specifications.
  3. RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding
  4. and L. Masinter, January 2005.
  5. RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter
  6. and L.Masinter, December 1999.
  7. RFC 2396: "Uniform Resource Identifiers (URI)": Generic Syntax by T.
  8. Berners-Lee, R. Fielding, and L. Masinter, August 1998.
  9. RFC 2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zawinski, July 1998.
  10. RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June
  11. 1995.
  12. RFC 1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M.
  13. McCahill, December 1994
  14. RFC 3986 is considered the current standard and any future changes to
  15. urlparse module should conform with it. The urlparse module is
  16. currently not entirely compliant with this RFC due to defacto
  17. scenarios for parsing, and for backward compatibility purposes, some
  18. parsing quirks from older RFCs are retained. The testcases in
  19. test_urlparse.py provides a good indicator of parsing behavior.
  20. """
  21. import sys
  22. import collections
  23. __all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
  24. "urlsplit", "urlunsplit", "urlencode", "parse_qs",
  25. "parse_qsl", "quote", "quote_plus", "quote_from_bytes",
  26. "unquote", "unquote_plus", "unquote_to_bytes"]
  27. # A classification of schemes ('' means apply by default)
  28. uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap',
  29. 'wais', 'file', 'https', 'shttp', 'mms',
  30. 'prospero', 'rtsp', 'rtspu', '', 'sftp']
  31. uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet',
  32. 'imap', 'wais', 'file', 'mms', 'https', 'shttp',
  33. 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '',
  34. 'svn', 'svn+ssh', 'sftp', 'nfs', 'git', 'git+ssh']
  35. non_hierarchical = ['gopher', 'hdl', 'mailto', 'news',
  36. 'telnet', 'wais', 'imap', 'snews', 'sip', 'sips']
  37. uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',
  38. 'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',
  39. 'mms', '', 'sftp']
  40. uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms',
  41. 'gopher', 'rtsp', 'rtspu', 'sip', 'sips', '']
  42. uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news',
  43. 'nntp', 'wais', 'https', 'shttp', 'snews',
  44. 'file', 'prospero', '']
  45. # Characters valid in scheme names
  46. scheme_chars = ('abcdefghijklmnopqrstuvwxyz'
  47. 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  48. '0123456789'
  49. '+-.')
  50. # XXX: Consider replacing with functools.lru_cache
  51. MAX_CACHE_SIZE = 20
  52. _parse_cache = {}
  53. def clear_cache():
  54. """Clear the parse cache and the quoters cache."""
  55. _parse_cache.clear()
  56. _safe_quoters.clear()
  57. # Helpers for bytes handling
  58. # For 3.2, we deliberately require applications that
  59. # handle improperly quoted URLs to do their own
  60. # decoding and encoding. If valid use cases are
  61. # presented, we may relax this by using latin-1
  62. # decoding internally for 3.3
  63. _implicit_encoding = 'ascii'
  64. _implicit_errors = 'strict'
  65. def _noop(obj):
  66. return obj
  67. def _encode_result(obj, encoding=_implicit_encoding,
  68. errors=_implicit_errors):
  69. return obj.encode(encoding, errors)
  70. def _decode_args(args, encoding=_implicit_encoding,
  71. errors=_implicit_errors):
  72. return tuple(x.decode(encoding, errors) if x else '' for x in args)
  73. def _coerce_args(*args):
  74. # Invokes decode if necessary to create str args
  75. # and returns the coerced inputs along with
  76. # an appropriate result coercion function
  77. # - noop for str inputs
  78. # - encoding function otherwise
  79. str_input = isinstance(args[0], str)
  80. for arg in args[1:]:
  81. # We special-case the empty string to support the
  82. # "scheme=''" default argument to some functions
  83. if arg and isinstance(arg, str) != str_input:
  84. raise TypeError("Cannot mix str and non-str arguments")
  85. if str_input:
  86. return args + (_noop,)
  87. return _decode_args(args) + (_encode_result,)
  88. # Result objects are more helpful than simple tuples
  89. class _ResultMixinStr(object):
  90. """Standard approach to encoding parsed results from str to bytes"""
  91. __slots__ = ()
  92. def encode(self, encoding='ascii', errors='strict'):
  93. return self._encoded_counterpart(*(x.encode(encoding, errors) for x in self))
  94. class _ResultMixinBytes(object):
  95. """Standard approach to decoding parsed results from bytes to str"""
  96. __slots__ = ()
  97. def decode(self, encoding='ascii', errors='strict'):
  98. return self._decoded_counterpart(*(x.decode(encoding, errors) for x in self))
  99. class _NetlocResultMixinBase(object):
  100. """Shared methods for the parsed result objects containing a netloc element"""
  101. __slots__ = ()
  102. @property
  103. def username(self):
  104. return self._userinfo[0]
  105. @property
  106. def password(self):
  107. return self._userinfo[1]
  108. @property
  109. def hostname(self):
  110. hostname = self._hostinfo[0]
  111. if not hostname:
  112. hostname = None
  113. elif hostname is not None:
  114. hostname = hostname.lower()
  115. return hostname
  116. @property
  117. def port(self):
  118. port = self._hostinfo[1]
  119. if port is not None:
  120. port = int(port, 10)
  121. return port
  122. class _NetlocResultMixinStr(_NetlocResultMixinBase, _ResultMixinStr):
  123. __slots__ = ()
  124. @property
  125. def _userinfo(self):
  126. netloc = self.netloc
  127. userinfo, have_info, hostinfo = netloc.rpartition('@')
  128. if have_info:
  129. username, have_password, password = userinfo.partition(':')
  130. if not have_password:
  131. password = None
  132. else:
  133. username = password = None
  134. return username, password
  135. @property
  136. def _hostinfo(self):
  137. netloc = self.netloc
  138. _, _, hostinfo = netloc.rpartition('@')
  139. _, have_open_br, bracketed = hostinfo.partition('[')
  140. if have_open_br:
  141. hostname, _, port = bracketed.partition(']')
  142. _, have_port, port = port.partition(':')
  143. else:
  144. hostname, have_port, port = hostinfo.partition(':')
  145. if not have_port:
  146. port = None
  147. return hostname, port
  148. class _NetlocResultMixinBytes(_NetlocResultMixinBase, _ResultMixinBytes):
  149. __slots__ = ()
  150. @property
  151. def _userinfo(self):
  152. netloc = self.netloc
  153. userinfo, have_info, hostinfo = netloc.rpartition(b'@')
  154. if have_info:
  155. username, have_password, password = userinfo.partition(b':')
  156. if not have_password:
  157. password = None
  158. else:
  159. username = password = None
  160. return username, password
  161. @property
  162. def _hostinfo(self):
  163. netloc = self.netloc
  164. _, _, hostinfo = netloc.rpartition(b'@')
  165. _, have_open_br, bracketed = hostinfo.partition(b'[')
  166. if have_open_br:
  167. hostname, _, port = bracketed.partition(b']')
  168. _, have_port, port = port.partition(b':')
  169. else:
  170. hostname, have_port, port = hostinfo.partition(b':')
  171. if not have_port:
  172. port = None
  173. return hostname, port
  174. from collections import namedtuple
  175. _DefragResultBase = namedtuple('DefragResult', 'url fragment')
  176. _SplitResultBase = namedtuple('SplitResult', 'scheme netloc path query fragment')
  177. _ParseResultBase = namedtuple('ParseResult', 'scheme netloc path params query fragment')
  178. # For backwards compatibility, alias _NetlocResultMixinStr
  179. # ResultBase is no longer part of the documented API, but it is
  180. # retained since deprecating it isn't worth the hassle
  181. ResultBase = _NetlocResultMixinStr
  182. # Structured result objects for string data
  183. class DefragResult(_DefragResultBase, _ResultMixinStr):
  184. __slots__ = ()
  185. def geturl(self):
  186. if self.fragment:
  187. return self.url + '#' + self.fragment
  188. else:
  189. return self.url
  190. class SplitResult(_SplitResultBase, _NetlocResultMixinStr):
  191. __slots__ = ()
  192. def geturl(self):
  193. return urlunsplit(self)
  194. class ParseResult(_ParseResultBase, _NetlocResultMixinStr):
  195. __slots__ = ()
  196. def geturl(self):
  197. return urlunparse(self)
  198. # Structured result objects for bytes data
  199. class DefragResultBytes(_DefragResultBase, _ResultMixinBytes):
  200. __slots__ = ()
  201. def geturl(self):
  202. if self.fragment:
  203. return self.url + b'#' + self.fragment
  204. else:
  205. return self.url
  206. class SplitResultBytes(_SplitResultBase, _NetlocResultMixinBytes):
  207. __slots__ = ()
  208. def geturl(self):
  209. return urlunsplit(self)
  210. class ParseResultBytes(_ParseResultBase, _NetlocResultMixinBytes):
  211. __slots__ = ()
  212. def geturl(self):
  213. return urlunparse(self)
  214. # Set up the encode/decode result pairs
  215. def _fix_result_transcoding():
  216. _result_pairs = (
  217. (DefragResult, DefragResultBytes),
  218. (SplitResult, SplitResultBytes),
  219. (ParseResult, ParseResultBytes),
  220. )
  221. for _decoded, _encoded in _result_pairs:
  222. _decoded._encoded_counterpart = _encoded
  223. _encoded._decoded_counterpart = _decoded
  224. _fix_result_transcoding()
  225. del _fix_result_transcoding
  226. def urlparse(url, scheme='', allow_fragments=True):
  227. """Parse a URL into 6 components:
  228. <scheme>://<netloc>/<path>;<params>?<query>#<fragment>
  229. Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
  230. Note that we don't break the components up in smaller bits
  231. (e.g. netloc is a single string) and we don't expand % escapes."""
  232. url, scheme, _coerce_result = _coerce_args(url, scheme)
  233. tuple = urlsplit(url, scheme, allow_fragments)
  234. scheme, netloc, url, query, fragment = tuple
  235. if scheme in uses_params and ';' in url:
  236. url, params = _splitparams(url)
  237. else:
  238. params = ''
  239. result = ParseResult(scheme, netloc, url, params, query, fragment)
  240. return _coerce_result(result)
  241. def _splitparams(url):
  242. if '/' in url:
  243. i = url.find(';', url.rfind('/'))
  244. if i < 0:
  245. return url, ''
  246. else:
  247. i = url.find(';')
  248. return url[:i], url[i+1:]
  249. def _splitnetloc(url, start=0):
  250. delim = len(url) # position of end of domain part of url, default is end
  251. for c in '/?#': # look for delimiters; the order is NOT important
  252. wdelim = url.find(c, start) # find first of this delim
  253. if wdelim >= 0: # if found
  254. delim = min(delim, wdelim) # use earliest delim position
  255. return url[start:delim], url[delim:] # return (domain, rest)
  256. def urlsplit(url, scheme='', allow_fragments=True):
  257. """Parse a URL into 5 components:
  258. <scheme>://<netloc>/<path>?<query>#<fragment>
  259. Return a 5-tuple: (scheme, netloc, path, query, fragment).
  260. Note that we don't break the components up in smaller bits
  261. (e.g. netloc is a single string) and we don't expand % escapes."""
  262. url, scheme, _coerce_result = _coerce_args(url, scheme)
  263. allow_fragments = bool(allow_fragments)
  264. key = url, scheme, allow_fragments, type(url), type(scheme)
  265. cached = _parse_cache.get(key, None)
  266. if cached:
  267. return _coerce_result(cached)
  268. if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth
  269. clear_cache()
  270. netloc = query = fragment = ''
  271. i = url.find(':')
  272. if i > 0:
  273. if url[:i] == 'http': # optimize the common case
  274. scheme = url[:i].lower()
  275. url = url[i+1:]
  276. if url[:2] == '//':
  277. netloc, url = _splitnetloc(url, 2)
  278. if (('[' in netloc and ']' not in netloc) or
  279. (']' in netloc and '[' not in netloc)):
  280. raise ValueError("Invalid IPv6 URL")
  281. if allow_fragments and '#' in url:
  282. url, fragment = url.split('#', 1)
  283. if '?' in url:
  284. url, query = url.split('?', 1)
  285. v = SplitResult(scheme, netloc, url, query, fragment)
  286. _parse_cache[key] = v
  287. return _coerce_result(v)
  288. for c in url[:i]:
  289. if c not in scheme_chars:
  290. break
  291. else:
  292. try:
  293. # make sure "url" is not actually a port number (in which case
  294. # "scheme" is really part of the path
  295. _testportnum = int(url[i+1:])
  296. except ValueError:
  297. scheme, url = url[:i].lower(), url[i+1:]
  298. if url[:2] == '//':
  299. netloc, url = _splitnetloc(url, 2)
  300. if (('[' in netloc and ']' not in netloc) or
  301. (']' in netloc and '[' not in netloc)):
  302. raise ValueError("Invalid IPv6 URL")
  303. if allow_fragments and scheme in uses_fragment and '#' in url:
  304. url, fragment = url.split('#', 1)
  305. if scheme in uses_query and '?' in url:
  306. url, query = url.split('?', 1)
  307. v = SplitResult(scheme, netloc, url, query, fragment)
  308. _parse_cache[key] = v
  309. return _coerce_result(v)
  310. def urlunparse(components):
  311. """Put a parsed URL back together again. This may result in a
  312. slightly different, but equivalent URL, if the URL that was parsed
  313. originally had redundant delimiters, e.g. a ? with an empty query
  314. (the draft states that these are equivalent)."""
  315. scheme, netloc, url, params, query, fragment, _coerce_result = (
  316. _coerce_args(*components))
  317. if params:
  318. url = "%s;%s" % (url, params)
  319. return _coerce_result(urlunsplit((scheme, netloc, url, query, fragment)))
  320. def urlunsplit(components):
  321. """Combine the elements of a tuple as returned by urlsplit() into a
  322. complete URL as a string. The data argument can be any five-item iterable.
  323. This may result in a slightly different, but equivalent URL, if the URL that
  324. was parsed originally had unnecessary delimiters (for example, a ? with an
  325. empty query; the RFC states that these are equivalent)."""
  326. scheme, netloc, url, query, fragment, _coerce_result = (
  327. _coerce_args(*components))
  328. if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
  329. if url and url[:1] != '/': url = '/' + url
  330. url = '//' + (netloc or '') + url
  331. if scheme:
  332. url = scheme + ':' + url
  333. if query:
  334. url = url + '?' + query
  335. if fragment:
  336. url = url + '#' + fragment
  337. return _coerce_result(url)
  338. def urljoin(base, url, allow_fragments=True):
  339. """Join a base URL and a possibly relative URL to form an absolute
  340. interpretation of the latter."""
  341. if not base:
  342. return url
  343. if not url:
  344. return base
  345. base, url, _coerce_result = _coerce_args(base, url)
  346. bscheme, bnetloc, bpath, bparams, bquery, bfragment = \
  347. urlparse(base, '', allow_fragments)
  348. scheme, netloc, path, params, query, fragment = \
  349. urlparse(url, bscheme, allow_fragments)
  350. if scheme != bscheme or scheme not in uses_relative:
  351. return _coerce_result(url)
  352. if scheme in uses_netloc:
  353. if netloc:
  354. return _coerce_result(urlunparse((scheme, netloc, path,
  355. params, query, fragment)))
  356. netloc = bnetloc
  357. if path[:1] == '/':
  358. return _coerce_result(urlunparse((scheme, netloc, path,
  359. params, query, fragment)))
  360. if not path and not params:
  361. path = bpath
  362. params = bparams
  363. if not query:
  364. query = bquery
  365. return _coerce_result(urlunparse((scheme, netloc, path,
  366. params, query, fragment)))
  367. segments = bpath.split('/')[:-1] + path.split('/')
  368. # XXX The stuff below is bogus in various ways...
  369. if segments[-1] == '.':
  370. segments[-1] = ''
  371. while '.' in segments:
  372. segments.remove('.')
  373. while 1:
  374. i = 1
  375. n = len(segments) - 1
  376. while i < n:
  377. if (segments[i] == '..'
  378. and segments[i-1] not in ('', '..')):
  379. del segments[i-1:i+1]
  380. break
  381. i = i+1
  382. else:
  383. break
  384. if segments == ['', '..']:
  385. segments[-1] = ''
  386. elif len(segments) >= 2 and segments[-1] == '..':
  387. segments[-2:] = ['']
  388. return _coerce_result(urlunparse((scheme, netloc, '/'.join(segments),
  389. params, query, fragment)))
  390. def urldefrag(url):
  391. """Removes any existing fragment from URL.
  392. Returns a tuple of the defragmented URL and the fragment. If
  393. the URL contained no fragments, the second element is the
  394. empty string.
  395. """
  396. url, _coerce_result = _coerce_args(url)
  397. if '#' in url:
  398. s, n, p, a, q, frag = urlparse(url)
  399. defrag = urlunparse((s, n, p, a, q, ''))
  400. else:
  401. frag = ''
  402. defrag = url
  403. return _coerce_result(DefragResult(defrag, frag))
  404. def unquote_to_bytes(string):
  405. """unquote_to_bytes('abc%20def') -> b'abc def'."""
  406. # Note: strings are encoded as UTF-8. This is only an issue if it contains
  407. # unescaped non-ASCII characters, which URIs should not.
  408. if not string:
  409. # Is it a string-like object?
  410. string.split
  411. return b''
  412. if isinstance(string, str):
  413. string = string.encode('utf-8')
  414. res = string.split(b'%')
  415. if len(res) == 1:
  416. return string
  417. string = res[0]
  418. for item in res[1:]:
  419. try:
  420. string += bytes([int(item[:2], 16)]) + item[2:]
  421. except ValueError:
  422. string += b'%' + item
  423. return string
  424. def unquote(string, encoding='utf-8', errors='replace'):
  425. """Replace %xx escapes by their single-character equivalent. The optional
  426. encoding and errors parameters specify how to decode percent-encoded
  427. sequences into Unicode characters, as accepted by the bytes.decode()
  428. method.
  429. By default, percent-encoded sequences are decoded with UTF-8, and invalid
  430. sequences are replaced by a placeholder character.
  431. unquote('abc%20def') -> 'abc def'.
  432. """
  433. if string == '':
  434. return string
  435. res = string.split('%')
  436. if len(res) == 1:
  437. return string
  438. if encoding is None:
  439. encoding = 'utf-8'
  440. if errors is None:
  441. errors = 'replace'
  442. # pct_sequence: contiguous sequence of percent-encoded bytes, decoded
  443. pct_sequence = b''
  444. string = res[0]
  445. for item in res[1:]:
  446. try:
  447. if not item:
  448. raise ValueError
  449. pct_sequence += bytes.fromhex(item[:2])
  450. rest = item[2:]
  451. if not rest:
  452. # This segment was just a single percent-encoded character.
  453. # May be part of a sequence of code units, so delay decoding.
  454. # (Stored in pct_sequence).
  455. continue
  456. except ValueError:
  457. rest = '%' + item
  458. # Encountered non-percent-encoded characters. Flush the current
  459. # pct_sequence.
  460. string += pct_sequence.decode(encoding, errors) + rest
  461. pct_sequence = b''
  462. if pct_sequence:
  463. # Flush the final pct_sequence
  464. string += pct_sequence.decode(encoding, errors)
  465. return string
  466. def parse_qs(qs, keep_blank_values=False, strict_parsing=False,
  467. encoding='utf-8', errors='replace'):
  468. """Parse a query given as a string argument.
  469. Arguments:
  470. qs: percent-encoded query string to be parsed
  471. keep_blank_values: flag indicating whether blank values in
  472. percent-encoded queries should be treated as blank strings.
  473. A true value indicates that blanks should be retained as
  474. blank strings. The default false value indicates that
  475. blank values are to be ignored and treated as if they were
  476. not included.
  477. strict_parsing: flag indicating what to do with parsing errors.
  478. If false (the default), errors are silently ignored.
  479. If true, errors raise a ValueError exception.
  480. encoding and errors: specify how to decode percent-encoded sequences
  481. into Unicode characters, as accepted by the bytes.decode() method.
  482. """
  483. dict = {}
  484. pairs = parse_qsl(qs, keep_blank_values, strict_parsing,
  485. encoding=encoding, errors=errors)
  486. for name, value in pairs:
  487. if name in dict:
  488. dict[name].append(value)
  489. else:
  490. dict[name] = [value]
  491. return dict
  492. def parse_qsl(qs, keep_blank_values=False, strict_parsing=False,
  493. encoding='utf-8', errors='replace'):
  494. """Parse a query given as a string argument.
  495. Arguments:
  496. qs: percent-encoded query string to be parsed
  497. keep_blank_values: flag indicating whether blank values in
  498. percent-encoded queries should be treated as blank strings. A
  499. true value indicates that blanks should be retained as blank
  500. strings. The default false value indicates that blank values
  501. are to be ignored and treated as if they were not included.
  502. strict_parsing: flag indicating what to do with parsing errors. If
  503. false (the default), errors are silently ignored. If true,
  504. errors raise a ValueError exception.
  505. encoding and errors: specify how to decode percent-encoded sequences
  506. into Unicode characters, as accepted by the bytes.decode() method.
  507. Returns a list, as G-d intended.
  508. """
  509. qs, _coerce_result = _coerce_args(qs)
  510. pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
  511. r = []
  512. for name_value in pairs:
  513. if not name_value and not strict_parsing:
  514. continue
  515. nv = name_value.split('=', 1)
  516. if len(nv) != 2:
  517. if strict_parsing:
  518. raise ValueError("bad query field: %r" % (name_value,))
  519. # Handle case of a control-name with no equal sign
  520. if keep_blank_values:
  521. nv.append('')
  522. else:
  523. continue
  524. if len(nv[1]) or keep_blank_values:
  525. name = nv[0].replace('+', ' ')
  526. name = unquote(name, encoding=encoding, errors=errors)
  527. name = _coerce_result(name)
  528. value = nv[1].replace('+', ' ')
  529. value = unquote(value, encoding=encoding, errors=errors)
  530. value = _coerce_result(value)
  531. r.append((name, value))
  532. return r
  533. def unquote_plus(string, encoding='utf-8', errors='replace'):
  534. """Like unquote(), but also replace plus signs by spaces, as required for
  535. unquoting HTML form values.
  536. unquote_plus('%7e/abc+def') -> '~/abc def'
  537. """
  538. string = string.replace('+', ' ')
  539. return unquote(string, encoding, errors)
  540. _ALWAYS_SAFE = frozenset(b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  541. b'abcdefghijklmnopqrstuvwxyz'
  542. b'0123456789'
  543. b'_.-')
  544. _ALWAYS_SAFE_BYTES = bytes(_ALWAYS_SAFE)
  545. _safe_quoters = {}
  546. class Quoter(collections.defaultdict):
  547. """A mapping from bytes (in range(0,256)) to strings.
  548. String values are percent-encoded byte values, unless the key < 128, and
  549. in the "safe" set (either the specified safe set, or default set).
  550. """
  551. # Keeps a cache internally, using defaultdict, for efficiency (lookups
  552. # of cached keys don't call Python code at all).
  553. def __init__(self, safe):
  554. """safe: bytes object."""
  555. self.safe = _ALWAYS_SAFE.union(safe)
  556. def __repr__(self):
  557. # Without this, will just display as a defaultdict
  558. return "<Quoter %r>" % dict(self)
  559. def __missing__(self, b):
  560. # Handle a cache miss. Store quoted string in cache and return.
  561. res = chr(b) if b in self.safe else '%{:02X}'.format(b)
  562. self[b] = res
  563. return res
  564. def quote(string, safe='/', encoding=None, errors=None):
  565. """quote('abc def') -> 'abc%20def'
  566. Each part of a URL, e.g. the path info, the query, etc., has a
  567. different set of reserved characters that must be quoted.
  568. RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists
  569. the following reserved characters.
  570. reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
  571. "$" | ","
  572. Each of these characters is reserved in some component of a URL,
  573. but not necessarily in all of them.
  574. By default, the quote function is intended for quoting the path
  575. section of a URL. Thus, it will not encode '/'. This character
  576. is reserved, but in typical usage the quote function is being
  577. called on a path where the existing slash characters are used as
  578. reserved characters.
  579. string and safe may be either str or bytes objects. encoding must
  580. not be specified if string is a str.
  581. The optional encoding and errors parameters specify how to deal with
  582. non-ASCII characters, as accepted by the str.encode method.
  583. By default, encoding='utf-8' (characters are encoded with UTF-8), and
  584. errors='strict' (unsupported characters raise a UnicodeEncodeError).
  585. """
  586. if isinstance(string, str):
  587. if not string:
  588. return string
  589. if encoding is None:
  590. encoding = 'utf-8'
  591. if errors is None:
  592. errors = 'strict'
  593. string = string.encode(encoding, errors)
  594. else:
  595. if encoding is not None:
  596. raise TypeError("quote() doesn't support 'encoding' for bytes")
  597. if errors is not None:
  598. raise TypeError("quote() doesn't support 'errors' for bytes")
  599. return quote_from_bytes(string, safe)
  600. def quote_plus(string, safe='', encoding=None, errors=None):
  601. """Like quote(), but also replace ' ' with '+', as required for quoting
  602. HTML form values. Plus signs in the original string are escaped unless
  603. they are included in safe. It also does not have safe default to '/'.
  604. """
  605. # Check if ' ' in string, where string may either be a str or bytes. If
  606. # there are no spaces, the regular quote will produce the right answer.
  607. if ((isinstance(string, str) and ' ' not in string) or
  608. (isinstance(string, bytes) and b' ' not in string)):
  609. return quote(string, safe, encoding, errors)
  610. if isinstance(safe, str):
  611. space = ' '
  612. else:
  613. space = b' '
  614. string = quote(string, safe + space, encoding, errors)
  615. return string.replace(' ', '+')
  616. def quote_from_bytes(bs, safe='/'):
  617. """Like quote(), but accepts a bytes object rather than a str, and does
  618. not perform string-to-bytes encoding. It always returns an ASCII string.
  619. quote_from_bytes(b'abc def\xab') -> 'abc%20def%AB'
  620. """
  621. if not isinstance(bs, (bytes, bytearray)):
  622. raise TypeError("quote_from_bytes() expected bytes")
  623. if not bs:
  624. return ''
  625. if isinstance(safe, str):
  626. # Normalize 'safe' by converting to bytes and removing non-ASCII chars
  627. safe = safe.encode('ascii', 'ignore')
  628. else:
  629. safe = bytes([c for c in safe if c < 128])
  630. if not bs.rstrip(_ALWAYS_SAFE_BYTES + safe):
  631. return bs.decode()
  632. try:
  633. quoter = _safe_quoters[safe]
  634. except KeyError:
  635. _safe_quoters[safe] = quoter = Quoter(safe).__getitem__
  636. return ''.join([quoter(char) for char in bs])
  637. def urlencode(query, doseq=False, safe='', encoding=None, errors=None):
  638. """Encode a sequence of two-element tuples or dictionary into a URL query string.
  639. If any values in the query arg are sequences and doseq is true, each
  640. sequence element is converted to a separate parameter.
  641. If the query arg is a sequence of two-element tuples, the order of the
  642. parameters in the output will match the order of parameters in the
  643. input.
  644. The query arg may be either a string or a bytes type. When query arg is a
  645. string, the safe, encoding and error parameters are sent the quote_plus for
  646. encoding.
  647. """
  648. if hasattr(query, "items"):
  649. query = query.items()
  650. else:
  651. # It's a bother at times that strings and string-like objects are
  652. # sequences.
  653. try:
  654. # non-sequence items should not work with len()
  655. # non-empty strings will fail this
  656. if len(query) and not isinstance(query[0], tuple):
  657. raise TypeError
  658. # Zero-length sequences of all types will get here and succeed,
  659. # but that's a minor nit. Since the original implementation
  660. # allowed empty dicts that type of behavior probably should be
  661. # preserved for consistency
  662. except TypeError:
  663. ty, va, tb = sys.exc_info()
  664. raise TypeError("not a valid non-string sequence "
  665. "or mapping object").with_traceback(tb)
  666. l = []
  667. if not doseq:
  668. for k, v in query:
  669. if isinstance(k, bytes):
  670. k = quote_plus(k, safe)
  671. else:
  672. k = quote_plus(str(k), safe, encoding, errors)
  673. if isinstance(v, bytes):
  674. v = quote_plus(v, safe)
  675. else:
  676. v = quote_plus(str(v), safe, encoding, errors)
  677. l.append(k + '=' + v)
  678. else:
  679. for k, v in query:
  680. if isinstance(k, bytes):
  681. k = quote_plus(k, safe)
  682. else:
  683. k = quote_plus(str(k), safe, encoding, errors)
  684. if isinstance(v, bytes):
  685. v = quote_plus(v, safe)
  686. l.append(k + '=' + v)
  687. elif isinstance(v, str):
  688. v = quote_plus(v, safe, encoding, errors)
  689. l.append(k + '=' + v)
  690. else:
  691. try:
  692. # Is this a sufficient test for sequence-ness?
  693. x = len(v)
  694. except TypeError:
  695. # not a sequence
  696. v = quote_plus(str(v), safe, encoding, errors)
  697. l.append(k + '=' + v)
  698. else:
  699. # loop over the sequence
  700. for elt in v:
  701. if isinstance(elt, bytes):
  702. elt = quote_plus(elt, safe)
  703. else:
  704. elt = quote_plus(str(elt), safe, encoding, errors)
  705. l.append(k + '=' + elt)
  706. return '&'.join(l)
  707. # Utilities to parse URLs (most of these return None for missing parts):
  708. # unwrap('<URL:type://host/path>') --> 'type://host/path'
  709. # splittype('type:opaquestring') --> 'type', 'opaquestring'
  710. # splithost('//host[:port]/path') --> 'host[:port]', '/path'
  711. # splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'
  712. # splitpasswd('user:passwd') -> 'user', 'passwd'
  713. # splitport('host:port') --> 'host', 'port'
  714. # splitquery('/path?query') --> '/path', 'query'
  715. # splittag('/path#tag') --> '/path', 'tag'
  716. # splitattr('/path;attr1=value1;attr2=value2;...') ->
  717. # '/path', ['attr1=value1', 'attr2=value2', ...]
  718. # splitvalue('attr=value') --> 'attr', 'value'
  719. # urllib.parse.unquote('abc%20def') -> 'abc def'
  720. # quote('abc def') -> 'abc%20def')
  721. def to_bytes(url):
  722. """to_bytes(u"URL") --> 'URL'."""
  723. # Most URL schemes require ASCII. If that changes, the conversion
  724. # can be relaxed.
  725. # XXX get rid of to_bytes()
  726. if isinstance(url, str):
  727. try:
  728. url = url.encode("ASCII").decode()
  729. except UnicodeError:
  730. raise UnicodeError("URL " + repr(url) +
  731. " contains non-ASCII characters")
  732. return url
  733. def unwrap(url):
  734. """unwrap('<URL:type://host/path>') --> 'type://host/path'."""
  735. url = str(url).strip()
  736. if url[:1] == '<' and url[-1:] == '>':
  737. url = url[1:-1].strip()
  738. if url[:4] == 'URL:': url = url[4:].strip()
  739. return url
  740. _typeprog = None
  741. def splittype(url):
  742. """splittype('type:opaquestring') --> 'type', 'opaquestring'."""
  743. global _typeprog
  744. if _typeprog is None:
  745. import re
  746. _typeprog = re.compile('^([^/:]+):')
  747. match = _typeprog.match(url)
  748. if match:
  749. scheme = match.group(1)
  750. return scheme.lower(), url[len(scheme) + 1:]
  751. return None, url
  752. _hostprog = None
  753. def splithost(url):
  754. """splithost('//host[:port]/path') --> 'host[:port]', '/path'."""
  755. global _hostprog
  756. if _hostprog is None:
  757. import re
  758. _hostprog = re.compile('^//([^/?]*)(.*)$')
  759. match = _hostprog.match(url)
  760. if match:
  761. host_port = match.group(1)
  762. path = match.group(2)
  763. if path and not path.startswith('/'):
  764. path = '/' + path
  765. return host_port, path
  766. return None, url
  767. _userprog = None
  768. def splituser(host):
  769. """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'."""
  770. global _userprog
  771. if _userprog is None:
  772. import re
  773. _userprog = re.compile('^(.*)@(.*)$')
  774. match = _userprog.match(host)
  775. if match: return match.group(1, 2)
  776. return None, host
  777. _passwdprog = None
  778. def splitpasswd(user):
  779. """splitpasswd('user:passwd') -> 'user', 'passwd'."""
  780. global _passwdprog
  781. if _passwdprog is None:
  782. import re
  783. _passwdprog = re.compile('^([^:]*):(.*)$',re.S)
  784. match = _passwdprog.match(user)
  785. if match: return match.group(1, 2)
  786. return user, None
  787. # splittag('/path#tag') --> '/path', 'tag'
  788. _portprog = None
  789. def splitport(host):
  790. """splitport('host:port') --> 'host', 'port'."""
  791. global _portprog
  792. if _portprog is None:
  793. import re
  794. _portprog = re.compile('^(.*):([0-9]+)$')
  795. match = _portprog.match(host)
  796. if match: return match.group(1, 2)
  797. return host, None
  798. _nportprog = None
  799. def splitnport(host, defport=-1):
  800. """Split host and port, returning numeric port.
  801. Return given default port if no ':' found; defaults to -1.
  802. Return numerical port if a valid number are found after ':'.
  803. Return None if ':' but not a valid number."""
  804. global _nportprog
  805. if _nportprog is None:
  806. import re
  807. _nportprog = re.compile('^(.*):(.*)$')
  808. match = _nportprog.match(host)
  809. if match:
  810. host, port = match.group(1, 2)
  811. try:
  812. if not port: raise ValueError("no digits")
  813. nport = int(port)
  814. except ValueError:
  815. nport = None
  816. return host, nport
  817. return host, defport
  818. _queryprog = None
  819. def splitquery(url):
  820. """splitquery('/path?query') --> '/path', 'query'."""
  821. global _queryprog
  822. if _queryprog is None:
  823. import re
  824. _queryprog = re.compile('^(.*)\?([^?]*)$')
  825. match = _queryprog.match(url)
  826. if match: return match.group(1, 2)
  827. return url, None
  828. _tagprog = None
  829. def splittag(url):
  830. """splittag('/path#tag') --> '/path', 'tag'."""
  831. global _tagprog
  832. if _tagprog is None:
  833. import re
  834. _tagprog = re.compile('^(.*)#([^#]*)$')
  835. match = _tagprog.match(url)
  836. if match: return match.group(1, 2)
  837. return url, None
  838. def splitattr(url):
  839. """splitattr('/path;attr1=value1;attr2=value2;...') ->
  840. '/path', ['attr1=value1', 'attr2=value2', ...]."""
  841. words = url.split(';')
  842. return words[0], words[1:]
  843. _valueprog = None
  844. def splitvalue(attr):
  845. """splitvalue('attr=value') --> 'attr', 'value'."""
  846. global _valueprog
  847. if _valueprog is None:
  848. import re
  849. _valueprog = re.compile('^([^=]*)=(.*)$')
  850. match = _valueprog.match(attr)
  851. if match: return match.group(1, 2)
  852. return attr, None