summaryrefslogtreecommitdiff
path: root/Lib/string.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-31672: Restore the former behavior when override flags in Template. (#5099)Serhiy Storchaka2018-01-041-4/+1
| | | | Overriding flags to 0 will make the default pattern matching only lower case letters.
* bpo-31672 - Add one last minor clarification for idpattern (#4483)Barry Warsaw2017-11-211-4/+7
| | | Add one last minor clarification for idpattern
* bpo-31672: Fix string.Template accidentally matched non-ASCII identifiers ↵INADA Naoki2017-10-131-1/+5
| | | | | | | | | | | (GH-3872) Pattern `[a-z]` with `IGNORECASE` flag can match to some non-ASCII characters. Straightforward solution for this is using `IGNORECASE | ASCII` flag. But users may subclass `Template` and override only `idpattern`. So we want to avoid changing `Template.flags`. So this commit uses local flag `-i` for `idpattern` and change `[a-z]` to `[a-zA-Z]`.
* bpo-1198569: Allow string.Template braced pattern to be different (#3288)Barry Warsaw2017-09-041-1/+3
| | | | | | | | * bpo-1198569: Allow the braced pattern to be different ``string.Template`` subclasses can optionally define ``braceidpattern`` if they want to specify different placeholder patterns inside and outside the braces. If None (the default) it falls back to ``idpattern``.
* Issue #29193: A format string argument for string.Formatter.format()Serhiy Storchaka2017-01-131-8/+2
| | | | is now positional-only.
* #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-081-1/+1
| | | | | | | And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.
* Closes #26809: Merge with 3.5Zachary Ware2016-06-041-3/+7
|\
| * Issue #26809: Add __all__ to string module. Patch by Emanuel BarryZachary Ware2016-06-041-3/+7
| |
* | Issue #25034: Merge from 3.5.Eric V. Smith2015-09-291-5/+6
|\ \ | |/
| * Issue #25034: Merge from 3.4.Eric V. Smith2015-09-291-5/+6
| |\
| | * Fixed issue #25034: Fix string.Formatter problem with auto-numberingEric V. Smith2015-09-291-5/+6
| | | | | | | | | | | | and nested format_specs. Patch by Anthon van der Neut.
| * | Reverting my previous commit.Yury Selivanov2015-05-301-2/+7
|/ / | | | | | | Something went horribly wrong when I was doing `hg rebase`.
* | Issue #24309: Removed Python 2 idioms.Serhiy Storchaka2015-05-281-7/+2
| |
* | Issue #23671: string.Template now allows to specify the "self" parameter asSerhiy Storchaka2015-03-241-3/+26
|\ \ | |/ | | | | | | keyword argument. string.Formatter now allows to specify the "self" and the "format_string" parameters as keyword arguments.
| * Issue #23671: string.Template now allows to specify the "self" parameter asSerhiy Storchaka2015-03-241-3/+23
|/ | | | | keyword argument. string.Formatter now allows to specify the "self" and the "format_string" parameters as keyword arguments.
* Issue #13598: Add auto-numbering of replacement fields to string.Formatter.Eric V. Smith2014-04-141-2/+21
|
* Merge #13579: teach string.Formatter about 'a'.R David Murray2012-08-191-4/+6
|\ | | | | | | Patch by Francisco Martín Brugué.
| * #13579: teach string.Formatter about 'a'.R David Murray2012-08-191-4/+6
| | | | | | | | Patch by Francisco Martín Brugué.
* | #13012: use splitlines(keepends=True/False) instead of splitlines(0/1).Ezio Melotti2011-09-281-1/+1
| |
* | Issue #11297: Add collections.ChainMap()Raymond Hettinger2011-02-261-3/+3
| |
* | Factor-out common code for helper classes.Raymond Hettinger2011-02-221-19/+3
|/
* #9418: first step of moving private string methods to _string module.Georg Brandl2010-10-141-4/+6
|
* Issue #1686: Fix string.Template when overriding the pattern attribute.Florent Xicluna2010-09-181-9/+3
|
* typoFlorent Xicluna2010-09-061-2/+2
|
* #6630: allow customizing flags for compiling string.Template.idpattern.Georg Brandl2010-07-291-1/+2
|
* Merged revisions 75070 via svnmerge fromEzio Melotti2009-09-261-4/+6
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r75070 | ezio.melotti | 2009-09-26 14:20:53 +0300 (Sat, 26 Sep 2009) | 1 line #7000: document "sep" in capwords. Add a few tests ........
* remove string.maketransBenjamin Peterson2009-06-281-22/+0
|
* #4351: more appropriate DeprecationWarning stacklevelsPhilip Jenvey2009-05-081-1/+1
|
* Add bytes/bytearray.maketrans() to mirror str.maketrans(), and deprecateGeorg Brandl2009-04-121-0/+3
| | | | string.maketrans() which actually works on bytes. (Also closes #5675.)
* #4361: fix string.py docstring, clarify that only ASCII characters are in ↵Georg Brandl2008-11-221-9/+9
| | | | its constants.
* Merged revisions 67154,67157-67159,67175-67176,67189,67224-67227,67234 via ↵Benjamin Peterson2008-11-161-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r67154 | hirokazu.yamamoto | 2008-11-07 21:46:17 -0600 (Fri, 07 Nov 2008) | 1 line Issue #4071: ntpath.abspath returned an empty string for long unicode path. ........ r67157 | georg.brandl | 2008-11-08 05:47:44 -0600 (Sat, 08 Nov 2008) | 2 lines Don't use "HOWTO" as the title for all howto .tex files. ........ r67158 | georg.brandl | 2008-11-08 05:48:20 -0600 (Sat, 08 Nov 2008) | 2 lines Update "Documenting" a bit. Concentrate on Python-specifics. ........ r67159 | georg.brandl | 2008-11-08 06:52:25 -0600 (Sat, 08 Nov 2008) | 2 lines Fix warning. ........ r67175 | benjamin.peterson | 2008-11-08 19:44:32 -0600 (Sat, 08 Nov 2008) | 1 line update link ........ r67176 | benjamin.peterson | 2008-11-08 19:52:32 -0600 (Sat, 08 Nov 2008) | 1 line fix comment ........ r67189 | benjamin.peterson | 2008-11-11 15:56:06 -0600 (Tue, 11 Nov 2008) | 1 line use correct name ........ r67224 | georg.brandl | 2008-11-15 02:10:04 -0600 (Sat, 15 Nov 2008) | 2 lines #4324: fix getlocale() argument. ........ r67225 | brett.cannon | 2008-11-15 16:33:25 -0600 (Sat, 15 Nov 2008) | 1 line Clarify the docs for the 'strict' argument to httplib.HTTPConnection. ........ r67226 | brett.cannon | 2008-11-15 16:40:44 -0600 (Sat, 15 Nov 2008) | 4 lines The docs for httplib.HTTPConnection.putheader() have claimed for quite a while that their could be an arbitrary number of values passed in. Turns out the code did not match that. The code now matches the docs. ........ r67227 | georg.brandl | 2008-11-16 02:00:17 -0600 (Sun, 16 Nov 2008) | 2 lines #4316: fix configure.in markup problem. ........ r67234 | benjamin.peterson | 2008-11-16 11:54:55 -0600 (Sun, 16 Nov 2008) | 1 line run autoconf ........
* Rename buffer -> bytearray.Guido van Rossum2007-11-211-1/+1
|
* Merging the py3k-pep3137 branch back into the py3k branch.Guido van Rossum2007-11-061-3/+3
| | | | | | | | | | | | | | No detailed change log; just check out the change log for the py3k-pep3137 branch. The most obvious changes: - str8 renamed to bytes (PyString at the C level); - bytes renamed to buffer (PyBytes at the C level); - PyString and PyUnicode are no longer compatible. I.e. we now have an immutable bytes type and a mutable bytes type. The behavior of PyString was modified quite a bit, to make it more bytes-like. Some changes are still on the to-do list.
* Changed some ValueError's to KeyError and IndexError.Eric Smith2007-09-041-3/+13
| | | | | | | | | Corrected code for invalid conversion specifier. Added tests to verify. Modified string.Formatter to correctly expand format_spec's, and added a limit to recursion depth. Added _vformat() method to support both of these.
* Removed used_args param from string.Formatter.get_field. It was left in by ↵Eric Smith2007-09-021-4/+2
| | | | mistake from an earlier edit.
* string.maketrans() now produces translation tables for bytes.translate() -- ↵Georg Brandl2007-08-311-21/+14
| | | | | | wrong module? Fix all remaining instances that did bad things with the new str.translate().
* Changed signature of string.Formatter.get_field, per suggestion byEric Smith2007-08-311-7/+5
| | | | | | Ron Adam. Added test case for using all parameters in string.Formatter.
* Raise statement normalization in Lib/.Collin Winter2007-08-301-1/+1
|
* Revert r57685 (weird merge result).Collin Winter2007-08-291-1/+0
|
* (no commit message)Collin Winter2007-08-291-0/+1
|
* Modified parsing of format strings, so that we always returnEric Smith2007-08-291-4/+13
| | | | | | | | | | | | | | | | | | a tuple (literal, field_name, format_spec, conversion). literal will always be a string, but might be of zero length. field_name will be None if there is no markup text format_spec will be a (possibly zero length) string if field_name is non-None conversion will be a one character string, or None This makes the Formatter class, and especially it's parse() method, easier to understand. Suggestion was by Jim Jewett, inspired by the "tail" of an elementtree node. Also, fixed a reference leak in fieldnameiter_next.
* Simplified tuple returned by string._formatter_parser to only haveEric Smith2007-08-281-24/+58
| | | | | | | 4 elements. No need for old is_markup element, the same information is indicated by literal_string being None. Factored string.Formatter class to make subclasses easier to write.
* PEP 3101: Removed _formatter_xxx routines from sysmodule, and made them ↵Eric Smith2007-08-271-6/+4
| | | | unicode methods instead (per GvR suggestion).
* PEP 3101: Completed string.Formatter class. Reimplemented field_name to ↵Eric Smith2007-08-261-7/+35
| | | | object transformation.
* Implementation of PEP 3101, Advanced String Formatting.Eric Smith2007-08-251-0/+39
| | | | | | | | | | | | | | | Known issues: The string.Formatter class, as discussed in the PEP, is incomplete. Error handling needs to conform to the PEP. Need to fix this warning that I introduced in Python/formatter_unicode.c: Objects/stringlib/unicodedefs.h:26: warning: `STRINGLIB_CMP' defined but not used Need to make sure sign formatting is correct, more tests needed. Need to remove '()' sign formatting, left over from an earlier version of the PEP.
* Remove string.{letters,lowercase,uppercase}.Martin v. Löwis2007-08-141-6/+3
|
* Merged revisions 56125-56153 via svnmerge fromGuido van Rossum2007-07-031-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r56127 | georg.brandl | 2007-06-30 09:32:49 +0200 (Sat, 30 Jun 2007) | 2 lines Fix a place where floor division would be in order. ........ r56135 | guido.van.rossum | 2007-07-01 06:13:54 +0200 (Sun, 01 Jul 2007) | 28 lines Make map() and filter() identical to itertools.imap() and .ifilter(), respectively. I fixed two bootstrap issues, due to the dynamic import of itertools: 1. Starting python requires that map() and filter() are not used until site.py has added build/lib.<arch> to sys.path. 2. Building python requires that setup.py and distutils and everything they use is free of map() and filter() calls. Beyond this, I only fixed the tests in test_builtin.py. Others, please help fixing the remaining tests that are now broken! The fixes are usually simple: a. map(None, X) -> list(X) b. map(F, X) -> list(map(F, X)) c. map(lambda x: F(x), X) -> [F(x) for x in X] d. filter(F, X) -> list(filter(F, X)) e. filter(lambda x: P(x), X) -> [x for x in X if P(x)] Someone, please also contribute a fixer for 2to3 to do this. It can leave map()/filter() calls alone that are already inside a list() or sorted() call or for-loop. Only in rare cases have I seen code that depends on map() of lists of different lengths going to the end of the longest, or on filter() of a string or tuple returning an object of the same type; these will need more thought to fix. ........ r56136 | guido.van.rossum | 2007-07-01 06:22:01 +0200 (Sun, 01 Jul 2007) | 3 lines Make it so that test_decimal fails instead of hangs, to help automated test runners. ........ r56139 | georg.brandl | 2007-07-01 18:20:58 +0200 (Sun, 01 Jul 2007) | 2 lines Fix a few test cases after the map->imap change. ........ r56142 | neal.norwitz | 2007-07-02 06:38:12 +0200 (Mon, 02 Jul 2007) | 1 line Get a bunch more tests passing after converting map/filter to return iterators. ........ r56147 | guido.van.rossum | 2007-07-02 15:32:02 +0200 (Mon, 02 Jul 2007) | 4 lines Fix the remaining failing unit tests (at least on OSX). Also tweaked urllib2 so it doesn't raise socket.gaierror when all network interfaces are turned off. ........
* Merged revisions 55342-55406 via svnmerge fromGuido van Rossum2007-05-171-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55360 | guido.van.rossum | 2007-05-15 14:57:59 -0700 (Tue, 15 May 2007) | 2 lines obcheckin. ........ r55361 | guido.van.rossum | 2007-05-15 14:59:18 -0700 (Tue, 15 May 2007) | 2 lines Get rid of strop module. ........ r55367 | brett.cannon | 2007-05-15 21:06:28 -0700 (Tue, 15 May 2007) | 2 lines Remove the 'pure' module. ........ r55369 | brett.cannon | 2007-05-15 21:07:31 -0700 (Tue, 15 May 2007) | 2 lines Remove the lib-old directory (already empty). ........ r55370 | neal.norwitz | 2007-05-15 21:30:40 -0700 (Tue, 15 May 2007) | 1 line Get rid of a bunch more references to strop ........ r55374 | brett.cannon | 2007-05-15 21:39:00 -0700 (Tue, 15 May 2007) | 2 lines Complete the removal of IRIX-specific modules. ........ r55379 | brett.cannon | 2007-05-15 22:31:54 -0700 (Tue, 15 May 2007) | 2 lines Update removed IRIX modules based on what is gone from removing plat-irix6. ........ r55388 | brett.cannon | 2007-05-16 14:34:52 -0700 (Wed, 16 May 2007) | 2 lines Clean up the docstring for the compiler resource. ........ r55406 | brett.cannon | 2007-05-17 11:05:37 -0700 (Thu, 17 May 2007) | 2 lines Remove BaseException.message (deprecated in Python 2.6). ........
* Merged revisions 55007-55179 via svnmerge fromGuido van Rossum2007-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55077 | guido.van.rossum | 2007-05-02 11:54:37 -0700 (Wed, 02 May 2007) | 2 lines Use the new print syntax, at least. ........ r55142 | fred.drake | 2007-05-04 21:27:30 -0700 (Fri, 04 May 2007) | 1 line remove old cruftiness ........ r55143 | fred.drake | 2007-05-04 21:52:16 -0700 (Fri, 04 May 2007) | 1 line make this work with the new Python ........ r55162 | neal.norwitz | 2007-05-06 22:29:18 -0700 (Sun, 06 May 2007) | 1 line Get asdl code gen working with Python 2.3. Should continue to work with 3.0 ........ r55164 | neal.norwitz | 2007-05-07 00:00:38 -0700 (Mon, 07 May 2007) | 1 line Verify checkins to p3yk (sic) branch go to 3000 list. ........ r55166 | neal.norwitz | 2007-05-07 00:12:35 -0700 (Mon, 07 May 2007) | 1 line Fix this test so it runs again by importing warnings_test properly. ........ r55167 | neal.norwitz | 2007-05-07 01:03:22 -0700 (Mon, 07 May 2007) | 8 lines So long xrange. range() now supports values that are outside -sys.maxint to sys.maxint. floats raise a TypeError. This has been sitting for a long time. It probably has some problems and needs cleanup. Objects/rangeobject.c now uses 4-space indents since it is almost completely new. ........ r55171 | guido.van.rossum | 2007-05-07 10:21:26 -0700 (Mon, 07 May 2007) | 4 lines Fix two tests that were previously depending on significant spaces at the end of a line (and before that on Python 2.x print behavior that has no exact equivalent in 3.0). ........
* Remove functions in string module that are also string methods. Also remove:Neal Norwitz2007-04-171-322/+2
| | | | | * all calls to functions in the string module (except maketrans) * everything from stropmodule except for maketrans() which is still used