/third_party/python/Objects/stringlib/ |
D | unicode_format.h | 498 render_field(PyObject *fieldobj, SubString *format_spec, _PyUnicodeWriter *writer) in render_field() argument 520 err = formatter(writer, fieldobj, format_spec->str, in render_field() 521 format_spec->start, format_spec->end); in render_field() 527 if (format_spec->str) in render_field() 528 format_spec_object = PyUnicode_Substring(format_spec->str, in render_field() 529 format_spec->start, in render_field() 530 format_spec->end); in render_field() 552 parse_field(SubString *str, SubString *field_name, SubString *format_spec, in parse_field() argument 563 SubString_init(format_spec, NULL, 0, 0); in parse_field() 617 format_spec->str = str->str; in parse_field() [all …]
|
/third_party/python/Objects/clinic/ |
D | complexobject.c.h | 50 complex___format___impl(PyComplexObject *self, PyObject *format_spec); 56 PyObject *format_spec; in complex___format__() local 65 format_spec = arg; in complex___format__() 66 return_value = complex___format___impl(self, format_spec); in complex___format__()
|
D | typeobject.c.h | 189 object___format___impl(PyObject *self, PyObject *format_spec); 195 PyObject *format_spec; in object___format__() local 204 format_spec = arg; in object___format__() 205 return_value = object___format___impl(self, format_spec); in object___format__()
|
D | floatobject.c.h | 369 float___format___impl(PyObject *self, PyObject *format_spec); 375 PyObject *format_spec; in float___format__() local 384 format_spec = arg; in float___format__() 385 return_value = float___format___impl(self, format_spec); in float___format__()
|
D | longobject.c.h | 68 int___format___impl(PyObject *self, PyObject *format_spec); 74 PyObject *format_spec; in int___format__() local 83 format_spec = arg; in int___format__() 84 return_value = int___format___impl(self, format_spec); in int___format__()
|
D | unicodeobject.c.h | 1222 unicode___format___impl(PyObject *self, PyObject *format_spec); 1228 PyObject *format_spec; in unicode___format__() local 1237 format_spec = arg; in unicode___format__() 1238 return_value = unicode___format___impl(self, format_spec); in unicode___format__()
|
/third_party/python/Lib/ |
D | string.py | 174 for literal_text, field_name, format_spec, conversion in \ 212 format_spec, auto_arg_index = self._vformat( 213 format_spec, args, kwargs, 218 result.append(self.format_field(obj, format_spec)) 234 def format_field(self, value, format_spec): argument 235 return format(value, format_spec)
|
D | enum.py | 764 def __format__(self, format_spec): argument 781 return cls.__format__(val, format_spec)
|
/third_party/markupsafe/ |
D | __init__.py | 216 def __html_format__(self, format_spec: str) -> "Markup": 217 if format_spec: 230 def format_field(self, value: t.Any, format_spec: str) -> str: 232 rv = value.__html_format__(format_spec) 234 if format_spec: 244 rv = string.Formatter.format_field(self, value, str(format_spec))
|
/third_party/python/Python/ |
D | formatter_unicode.c | 165 parse_internal_render_format_spec(PyObject *format_spec, in parse_internal_render_format_spec() argument 172 int kind = PyUnicode_KIND(format_spec); in parse_internal_render_format_spec() 173 const void *data = PyUnicode_DATA(format_spec); in parse_internal_render_format_spec() 228 consumed = get_integer(format_spec, &pos, end, &format->width); in parse_internal_render_format_spec() 265 consumed = get_integer(format_spec, &pos, end, &format->precision); in parse_internal_render_format_spec() 1430 PyObject *format_spec, in _PyUnicode_FormatAdvancedWriter() argument 1447 if (!parse_internal_render_format_spec(format_spec, start, end, in _PyUnicode_FormatAdvancedWriter() 1466 PyObject *format_spec, in _PyLong_FormatAdvancedWriter() argument 1483 if (!parse_internal_render_format_spec(format_spec, start, end, in _PyLong_FormatAdvancedWriter() 1528 PyObject *format_spec, in _PyFloat_FormatAdvancedWriter() argument [all …]
|
/third_party/python/Lib/test/ |
D | test_types.py | 227 def test(i, format_spec, result): argument 230 assert type(format_spec) == str 231 self.assertEqual(i.__format__(format_spec), result) 370 for format_spec in ([chr(x) for x in range(ord('a'), ord('z')+1)] + 372 if not format_spec in 'bcdoxXeEfFgGn%': 373 self.assertRaises(ValueError, 0 .__format__, format_spec) 374 self.assertRaises(ValueError, 1 .__format__, format_spec) 375 self.assertRaises(ValueError, (-1) .__format__, format_spec) 379 for format_spec in 'eEfFgG%': 381 self.assertEqual(value.__format__(format_spec), [all …]
|
D | test_long.py | 706 for format_spec in ([chr(x) for x in range(ord('a'), ord('z')+1)] + 708 if not format_spec in 'bcdoxXeEfFgGn%': 709 self.assertRaises(ValueError, format, 0, format_spec) 710 self.assertRaises(ValueError, format, 1, format_spec) 711 self.assertRaises(ValueError, format, -1, format_spec) 712 self.assertRaises(ValueError, format, 2**100, format_spec) 713 self.assertRaises(ValueError, format, -(2**100), format_spec) 717 for format_spec in 'eEfFgG%': 719 self.assertEqual(format(value, format_spec), 720 format(float(value), format_spec))
|
D | test_string.py | 126 def format_field(self, value, format_spec): argument 127 return format(value(), format_spec) 152 field_name, _, format_spec = field[1:].partition(':') 153 yield '', field_name, format_spec, None
|
D | test_float.py | 732 for format_spec in ([chr(x) for x in range(ord('a'), ord('z')+1)] + 734 if not format_spec in 'eEfFgGn%': 735 self.assertRaises(ValueError, format, 0.0, format_spec) 736 self.assertRaises(ValueError, format, 1.0, format_spec) 737 self.assertRaises(ValueError, format, -1.0, format_spec) 738 self.assertRaises(ValueError, format, 1e100, format_spec) 739 self.assertRaises(ValueError, format, -1e100, format_spec) 740 self.assertRaises(ValueError, format, 1e-100, format_spec) 741 self.assertRaises(ValueError, format, -1e-100, format_spec)
|
D | test_unicode.py | 1038 def __format__(self, format_spec): argument 1039 if format_spec == 'd': 1041 return object.__format__(self, format_spec) 1044 def __format__(self, format_spec): argument 1045 return self.strftime(format_spec) 1048 def __format__(self, format_spec): argument 1049 return int.__format__(self * 2, format_spec)
|
/third_party/python/Parser/ |
D | string_parser.c | 535 expr_ty format_spec = NULL; /* Optional format specifier. */ in fstring_find_expr() local 770 format_spec = fstring_parse(p, str, end, raw, recurse_lvl+1, in fstring_find_expr() 772 if (!format_spec) { in fstring_find_expr() 788 if (*expr_text && format_spec == NULL && conversion == -1) { in fstring_find_expr() 796 format_spec, first_token->lineno, in fstring_find_expr()
|
D | Python.asdl | 77 | FormattedValue(expr value, int conversion, expr? format_spec)
|
/third_party/python/Python/clinic/ |
D | bltinmodule.c.h | 88 builtin_format_impl(PyObject *module, PyObject *value, PyObject *format_spec); 95 PyObject *format_spec = NULL; in builtin_format() local 111 format_spec = args[1]; in builtin_format() 113 return_value = builtin_format_impl(module, value, format_spec); in builtin_format()
|
/third_party/python/Include/ |
D | complexobject.h | 61 PyObject *format_spec,
|
D | floatobject.h | 110 PyObject *format_spec,
|
D | longobject.h | 196 PyObject *format_spec,
|
/third_party/python/Doc/library/ |
D | string.rst | 117 (*literal_text*, *field_name*, *format_spec*, *conversion*). This is used 125 field, then the values of *field_name*, *format_spec* and *conversion* 170 .. method:: format_field(value, format_spec) 209 replacement_field: "{" [`field_name`] ["!" `conversion`] [":" `format_spec`] "}" 216 format_spec: <described in the next section> 222 preceded by an exclamation point ``'!'``, and a *format_spec*, which is preceded 272 The *format_spec* field contains a specification of how the value should be 275 mini-language" or interpretation of the *format_spec*. 280 A *format_spec* field can also include nested replacement fields within it. 284 format_spec are substituted before the *format_spec* string is interpreted. [all …]
|
/third_party/python/Objects/ |
D | abstract.c | 767 PyObject_Format(PyObject *obj, PyObject *format_spec) in PyObject_Format() argument 774 if (format_spec != NULL && !PyUnicode_Check(format_spec)) { in PyObject_Format() 777 Py_TYPE(format_spec)->tp_name); in PyObject_Format() 782 if (format_spec == NULL || PyUnicode_GET_LENGTH(format_spec) == 0) { in PyObject_Format() 793 if (format_spec == NULL) { in PyObject_Format() 795 format_spec = empty; in PyObject_Format() 811 result = PyObject_CallOneArg(meth, format_spec); in PyObject_Format()
|
D | complexobject.c | 679 complex___format___impl(PyComplexObject *self, PyObject *format_spec) in complex___format___impl() argument 688 format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); in complex___format___impl()
|
/third_party/python/Include/internal/ |
D | pycore_ast_state.h | 187 PyObject *format_spec; member
|