Files
tryton/tryton/__init__.py
T
Cédric Krier 49a54593ce Fix flake8 errors and warnings
We add the flake8 configuration used so we ensure everyone uses the same.
We remove the usage of __all__ for non public API.
When possible, we rationalize the class name according to its __name__ and module.

issue9082
review297061002
2020-03-01 12:33:54 +01:00

41 lines
1.3 KiB
Python

# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
__version__ = "5.5.0"
import gi
import locale
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
gi.require_foreign('cairo')
try:
gi.require_version('GtkSpell', '3.0')
except ValueError:
pass
try:
# Import earlier otherwise there is a segmentation fault on MSYS2
import goocalendar # noqa: F401
except ImportError:
pass
if not hasattr(locale, 'localize'):
def localize(formatted, grouping=False, monetary=False):
if '.' in formatted:
seps = 0
parts = formatted.split('.')
if grouping:
parts[0], seps = locale._group(parts[0], monetary=monetary)
decimal_point = locale.localeconv()[
monetary and 'mon_decimal_point' or 'decimal_point']
formatted = decimal_point.join(parts)
if seps:
formatted = locale._strip_padding(formatted, seps)
else:
seps = 0
if grouping:
formatted, seps = locale._group(formatted, monetary=monetary)
if seps:
formatted = locale._strip_padding(formatted, seps)
return formatted
setattr(locale, 'localize', localize)