summaryrefslogtreecommitdiffstats
path: root/Lib/string.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-46307: Add string.Template.get_identifiers() method (GH-30493)Ben Kehoe2022-01-111-0/+29
| | | | | Add `string.Template.get_identifiers()` method that returns the identifiers within the template. By default, raises an error if it encounters an invalid identifier (like `substitute()`). The keyword-only argument `raise_on_invalid` can be set to `False` to ignore invalid identifiers (like `safe_substitute()`). Automerge-Triggered-By: GH:warsaw
* bpo-45225: use map function instead of genexpr in capwords (GH-28342)speedrun-program2021-09-161-1/+1
|
* bpo-38208: Simplify string.Template by using __init_subclass__(). (GH-16256)Serhiy Storchaka2019-10-211-24/+22
|
* bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700)Serhiy Storchaka2019-06-011-32/+9
|
* 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
|