| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
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
|
|
|
|
| |
Overriding flags to 0 will make the default pattern matching only
lower case letters.
|
|
|
|
|
|
|
|
|
|
|
| |
(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 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``.
|
|
|
|
| |
is now positional-only.
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| | |
and nested format_specs. Patch by Anthon van der Neut.
|
| |
| |
| |
| |
| |
| |
| |
| | |
As noted in the comment, while the order of the items in the attributes is not
technically guaranteed, after all this time there is almost certainly user
code out there that relies on it, so we might as well test for it.
Patch by Chalmer Lowe.
|
| |
| |
| |
| |
| |
| |
| | |
I have compared output between pre- and post-patch runs of these tests
to make sure there's nothing missing and nothing broken, on both
Windows and Linux. The only differences I found were actually tests
that were previously *not* run.
|
|\ \
| |/
| |
| |
| | |
keyword argument. string.Formatter now allows to specify the "self" and
the "format_string" parameters as keyword arguments.
|
|/
|
|
|
| |
keyword argument. string.Formatter now allows to specify the "self" and
the "format_string" parameters as keyword arguments.
|
| |
|
|\
| |
| |
| | |
Patch by Francisco Martín Brugué.
|
| |
| |
| |
| | |
Patch by Francisco Martín Brugué.
|
| | |
|
| |
| |
| |
| | |
(closes #11505)
|
|\ \
| |/ |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r75074 | ezio.melotti | 2009-09-26 15:33:22 +0300 (Sat, 26 Sep 2009) | 9 lines
Merged revisions 75070 via svnmerge from
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
........
................
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r75072 | ezio.melotti | 2009-09-26 15:19:30 +0300 (Sat, 26 Sep 2009) | 1 line
string.capwords is still around, adding back the tests
........
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
........
|
|/ |
|
|
|
|
| |
string.maketrans() which actually works on bytes. (Also closes #5675.)
|
| |
|
|
|
|
|
|
| |
wrong module?
Fix all remaining instances that did bad things with the new str.translate().
|
|
|
|
|
|
| |
Ron Adam.
Added test case for using all parameters in string.Formatter.
|
|
|
|
|
| |
Made format_spec parameter to builtin format optional, defaults to
empty string. Added test cases.
|
|
|
|
| |
object transformation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
* all calls to functions in the string module (except maketrans)
* everything from stropmodule except for maketrans() which is still used
|
|
|
|
| |
(Rough first cut.)
|
|
|
|
|
|
| |
(a) "except E, V" -> "except E as V"
(b) V is now limited to a simple name (local variable)
(c) V is now deleted at the end of the except block
|
|
|
|
|
|
|
|
| |
[ 1327110 ] wrong TypeError traceback in generator expressions
by removing the code that can stomp on the users' TypeError raised by the
iterable argument to ''.join() -- PySequence_Fast (now?) gives a perfectly
reasonable message itself. Also, a couple of tests.
|
|
|
|
|
|
| |
it can be used for str and unicode. Drop the test for
"".join([s]) is s
because this is an implementation detail (and doesn't work for unicode)
|
|
|
|
|
|
|
| |
(Patch contributed by Nick Coghlan.)
Now joining string subtypes will always return a string.
Formerly, if there were only one item, it was returned unchanged.
|
|
|
|
|
|
|
|
|
|
| |
and test_support.run_classtests() into run_unittest()
and use it wherever possible.
Also don't use "from test.test_support import ...", but
"from test import test_support" in a few spots.
From SF patch #662807.
|
|
|
|
|
|
|
| |
between str, unicode, UserString and the string module
as possible. This increases code coverage in stringobject.c
from 83% to 86% and should help keep the string classes
in sync in the future. From SF patch #662807
|
| |
|
| |
|
|
|
|
|
| |
Python 2.2.x backport candidate. (This bug has been around since
Python 1.6.)
|
|
|
|
|
| |
Closes SF Bug #592573 where inplace add mutated a UserString.
Added unittests to verify the bug is cleared.
|
|
|
|
| |
string of longer than 1 character.
|
|
|
|
|
|
|
|
|
|
|
| |
imports e.g. test_support must do so using an absolute package name
such as "import test.test_support" or "from test import test_support".
This also updates the README in Lib/test, and gets rid of the
duplicate data dirctory in Lib/test/data (replaced by
Lib/email/test/data).
Now Tim and Jack can have at it. :)
|
| |
|
|
|
|
|
|
|
|
|
| |
If a str or unicode method returns the original object,
make sure that for str and unicode subclasses the original
will not be returned.
This should prevent SF bug http://www.python.org/sf/460020
from reappearing.
|
|
|
|
|
|
| |
module and from string methods.
This closes patch "[ #490811 ] Jython and test_string".
|