gh-134082: modernize string.Formatter class docstring (#134125)

fixup Formatter class docstring
This commit is contained in:
Bénédikt Tran 2025-05-18 10:10:54 +02:00 committed by GitHub
parent 4e9005d32f
commit 22e4a40d90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -191,16 +191,14 @@ class Template:
######################################################################## ########################################################################
# the Formatter class # The Formatter class (PEP 3101).
# see PEP 3101 for details and purpose of this class #
# The hard parts are reused from the C implementation. They're exposed as "_"
# prefixed methods of str.
# The overall parser is implemented in _string.formatter_parser. # The overall parser is implemented in _string.formatter_parser.
# The field name parser is implemented in _string.formatter_field_name_split # The field name parser is implemented in _string.formatter_field_name_split.
class Formatter: class Formatter:
"""See PEP 3101 for details and purpose of this class."""
def format(self, format_string, /, *args, **kwargs): def format(self, format_string, /, *args, **kwargs):
return self.vformat(format_string, args, kwargs) return self.vformat(format_string, args, kwargs)
@ -293,7 +291,6 @@ class Formatter:
Return an iterable that contains tuples of the form Return an iterable that contains tuples of the form
(literal_text, field_name, format_spec, conversion). (literal_text, field_name, format_spec, conversion).
*field_name* can be None, in which case there's no object *field_name* can be None, in which case there's no object
to format and output; otherwise, it is looked up and to format and output; otherwise, it is looked up and
formatted with *format_spec* and *conversion*. formatted with *format_spec* and *conversion*.