Lines Matching full:spec
16 # as bug fixes (deviation from the spec is a compatibility, usability
17 # bug) and will be backported. At this point the spec is stabilizing
137 __version__ = '1.70' # Highest version of the spec this complies with
379 # Map conditions (per the spec) to signals
3662 spec = _parse_format_specifier(specifier, _localeconv=_localeconv)
3666 sign = _format_sign(self._sign, spec)
3668 return _format_align(sign, body, spec)
3671 if spec['type'] is None:
3672 spec['type'] = ['g', 'G'][context.capitals]
3675 if spec['type'] == '%':
3680 precision = spec['precision']
3682 if spec['type'] in 'eE':
3684 elif spec['type'] in 'fF%':
3686 elif spec['type'] in 'gG' and len(self._int) > precision:
3690 if not self and self._exp > 0 and spec['type'] in 'fF%':
3695 if spec['type'] in 'eE':
3700 elif spec['type'] in 'fF%':
3702 elif spec['type'] in 'gG':
3722 return _format_number(self._sign, intpart, fracpart, exp, spec)
5871 # of the spec.
6040 def _format_align(sign, body, spec):
6043 format specifier dictionary 'spec' (as produced by
6050 minimumwidth = spec['minimumwidth']
6051 fill = spec['fill']
6054 align = spec['align']
6068 if spec['unicode']:
6096 def _insert_thousands_sep(digits, spec, min_width=1):
6099 spec is a dictionary whose keys should include 'thousands_sep' and
6113 sep = spec['thousands_sep']
6114 grouping = spec['grouping']
6133 def _format_sign(is_negative, spec):
6138 elif spec['sign'] in ' +':
6139 return spec['sign']
6143 def _format_number(is_negative, intpart, fracpart, exp, spec):
6150 spec: dictionary resulting from parsing the format specifier
6152 This function uses the information in spec to:
6161 sign = _format_sign(is_negative, spec)
6164 fracpart = spec['decimal_point'] + fracpart
6166 if exp != 0 or spec['type'] in 'eE':
6167 echar = {'E': 'E', 'e': 'e', 'G': 'E', 'g': 'e'}[spec['type']]
6169 if spec['type'] == '%':
6172 if spec['zeropad']:
6173 min_width = spec['minimumwidth'] - len(fracpart) - len(sign)
6176 intpart = _insert_thousands_sep(intpart, spec, min_width)
6178 return _format_align(sign, intpart+fracpart, spec)