Lines Matching refs:spec

12 # as bug fixes (deviation from the spec is a compatibility, usability
13 # bug) and will be backported. At this point the spec is stabilizing
152 __version__ = '1.70' # Highest version of the spec this complies with
425 # Map conditions (per the spec) to signals
3776 spec = _parse_format_specifier(specifier, _localeconv=_localeconv)
3780 sign = _format_sign(self._sign, spec)
3782 if spec['type'] == '%':
3784 return _format_align(sign, body, spec)
3787 if spec['type'] is None:
3788 spec['type'] = ['g', 'G'][context.capitals]
3791 if spec['type'] == '%':
3796 precision = spec['precision']
3798 if spec['type'] in 'eE':
3800 elif spec['type'] in 'fF%':
3802 elif spec['type'] in 'gG' and len(self._int) > precision:
3806 if not self and self._exp > 0 and spec['type'] in 'fF%':
3808 if not self and spec['no_neg_0'] and self._sign:
3815 if spec['type'] in 'eE':
3820 elif spec['type'] in 'fF%':
3822 elif spec['type'] in 'gG':
3842 return _format_number(adjusted_sign, intpart, fracpart, exp, spec)
6101 # of the spec.
6268 def _format_align(sign, body, spec):
6271 format specifier dictionary 'spec' (as produced by
6276 minimumwidth = spec['minimumwidth']
6277 fill = spec['fill']
6280 align = spec['align']
6318 def _insert_thousands_sep(digits, spec, min_width=1):
6321 spec is a dictionary whose keys should include 'thousands_sep' and
6335 sep = spec['thousands_sep']
6336 grouping = spec['grouping']
6355 def _format_sign(is_negative, spec):
6360 elif spec['sign'] in ' +':
6361 return spec['sign']
6365 def _format_number(is_negative, intpart, fracpart, exp, spec):
6372 spec: dictionary resulting from parsing the format specifier
6374 This function uses the information in spec to:
6383 sign = _format_sign(is_negative, spec)
6385 if fracpart or spec['alt']:
6386 fracpart = spec['decimal_point'] + fracpart
6388 if exp != 0 or spec['type'] in 'eE':
6389 echar = {'E': 'E', 'e': 'e', 'G': 'E', 'g': 'e'}[spec['type']]
6391 if spec['type'] == '%':
6394 if spec['zeropad']:
6395 min_width = spec['minimumwidth'] - len(fracpart) - len(sign)
6398 intpart = _insert_thousands_sep(intpart, spec, min_width)
6400 return _format_align(sign, intpart+fracpart, spec)