Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1312)

Unified Diff: Lib/string.py

Issue 9418: Move _formatter_* methods from string type into _string module
Patch Set: Created 2 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Modules/config.c.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Lib/string.py
===================================================================
--- Lib/string.py (Revision 83219)
+++ Lib/string.py (Arbeitskopie)
@@ -14,6 +14,8 @@
"""
+import _string
+
# Some strings for ctype-style character classification
whitespace = ' \t\n\r\v\f'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
@@ -175,8 +177,8 @@
# The hard parts are reused from the C implementation. They're exposed as "_"
# prefixed methods of str and unicode.
-# The overall parser is implemented in str._formatter_parser.
-# The field name parser is implemented in str._formatter_field_name_split
+# The overall parser is implemented in _string.formatter_parser.
+# The field name parser is implemented in _string.formatter_field_name_split
class Formatter:
def format(self, format_string, *args, **kwargs):
@@ -256,7 +258,7 @@
# if field_name is not None, it is looked up, formatted
# with format_spec and conversion and then used
def parse(self, format_string):
- return format_string._formatter_parser()
+ return _string.formatter_parser(format_string)
# given a field_name, find the object it references.
@@ -265,7 +267,7 @@
# used_args: a set of which args have been used
# args, kwargs: as passed in to vformat
def get_field(self, field_name, args, kwargs):
- first, rest = field_name._formatter_field_name_split()
+ first, rest = _string.formatter_field_name_split(field_name)
obj = self.get_value(first, args, kwargs)
« no previous file with comments | « no previous file | Modules/config.c.in » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7