Skip to content

Commit

Permalink
Remove the now useless locale_patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolashainaux committed Jun 22, 2018
1 parent 940f857 commit 6dbe85d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 127 deletions.
4 changes: 2 additions & 2 deletions mathmakerlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

from . import required, exceptions, config, constants
from . import locale_patch, calculus, core, geometry, LaTeX
from . import calculus, core, geometry, LaTeX

__all__ = ['required', 'config', 'LaTeX', 'exceptions', 'constants',
'locale_patch', 'core', 'calculus', 'geometry']
'core', 'calculus', 'geometry']

__version_info__ = (0, 7, 0)
__dev__ = 0
Expand Down
8 changes: 1 addition & 7 deletions mathmakerlib/calculus/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from decimal import Decimal, ROUND_DOWN, ROUND_HALF_UP

from mathmakerlib import required
from mathmakerlib import locale_patch # noqa
from mathmakerlib.calculus.unit import physical_quantity
from mathmakerlib.calculus.tools import is_number, is_integer
from mathmakerlib.core.signed import Signed
Expand Down Expand Up @@ -358,20 +357,15 @@ def sign(self):
else:
return Sign('+')

def imprint(self, start_expr=True, variant='latex', mod_locale=None):
def imprint(self, start_expr=True, variant='latex'):
extra_sign = ''
if not start_expr and self >= 0:
extra_sign = '+'
if variant == 'latex':
if mod_locale is not None:
restore_values = locale.setting_values()
locale.setlocale(locale.LC_ALL, mod_locale)
self_str = locale.format(
'%.{}f'.format(
self.fracdigits_nb(ignore_trailing_zeros=False)),
Decimal(self))
if mod_locale is not None:
locale.setlocale(*restore_values)

elif variant == 'user_input':
self_str = Decimal.__str__(self)
Expand Down
62 changes: 0 additions & 62 deletions mathmakerlib/locale_patch.py

This file was deleted.

54 changes: 0 additions & 54 deletions tests/02_core/locale_patch_test.py

This file was deleted.

2 changes: 0 additions & 2 deletions tests/03_calculus/04_number_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,10 @@ def test_printing():
"""Check printing is correct."""
assert Number('8.6').printed == '8.6'
assert Number('8.60').printed == '8.60'
assert Number('8.6').imprint(mod_locale=LOCALE_US) == '8.6'
locale.setlocale(locale.LC_ALL, LOCALE_FR)
assert locale.str(Decimal('8.6')) == '8,6'
assert Number('8.6').printed == '8,6'
assert Number('8.6').uiprinted == '8.6'
assert Number('8.6').imprint(mod_locale=LOCALE_US) == '8.6'
assert Number('8.6').printed == '8,6'
assert Number('8.6', unit='cm').printed == r'\SI{8,6}{cm}'
locale.setlocale(locale.LC_ALL, LOCALE_US)
Expand Down

0 comments on commit 6dbe85d

Please sign in to comment.