Python babel 模块,numbers() 实例源码
我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用babel.numbers()。
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def __init__(self, label=None, validators=None, places=unset_value, rounding=None, **kwargs):
super(DecimalField, self).__init__(label, validators, **kwargs)
if self.use_locale and (places is not unset_value or rounding is not None):
raise TypeError("When using locale-aware numbers,'places' and 'rounding' are ignored.")
if places is unset_value:
places = 2
self.places = places
self.rounding = rounding
def _extract_indices(self, prefix, formdata):
"""
Yield indices of any keys with given prefix.
formdata must be an object which will produce keys when iterated. For
example,if field 'foo' contains keys 'foo-0-bar','foo-1-baz',then
the numbers 0 and 1 will be yielded,but not neccesarily in order.
"""
offset = len(prefix) + 1
for k in formdata:
if k.startswith(prefix):
k = k[offset:].split('-', 1)[0]
if k.isdigit():
yield int(k)
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _extract_indices(self, 1)[0]
if k.isdigit():
yield int(k)
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _extract_indices(self, 1)[0]
if k.isdigit():
yield int(k)
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _extract_indices(self, 1)[0]
if k.isdigit():
yield int(k)
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _extract_indices(self, 1)[0]
if k.isdigit():
yield int(k)
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _extract_indices(self, 1)[0]
if k.isdigit():
yield int(k)
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _extract_indices(self, 1)[0]
if k.isdigit():
yield int(k)
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _extract_indices(self, 1)[0]
if k.isdigit():
yield int(k)
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _extract_indices(self, 1)[0]
if k.isdigit():
yield int(k)
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')
def _extract_indices(self, 1)[0]
if k.isdigit():
yield int(k)
def _init_babel(self):
try:
from babel import numbers
self.babel_numbers = numbers
except ImportError:
raise ImportError('Using locale-aware decimals requires the babel library.')