Python locale.LC_NUMERIC Examples
The following are 30
code examples of locale.LC_NUMERIC().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
locale
, or try the search function
.
Example #1
Source File: _locales.py From coffeegrindsize with MIT License | 5 votes |
def __enter__(self): if self.tst_locale is None: pytest.skip("No French locale available") locale.setlocale(locale.LC_NUMERIC, locale=self.tst_locale)
Example #2
Source File: _locales.py From pySINDy with MIT License | 5 votes |
def teardown(self): locale.setlocale(locale.LC_NUMERIC, locale=self.cur_locale)
Example #3
Source File: _locales.py From pySINDy with MIT License | 5 votes |
def __enter__(self): if self.tst_locale is None: raise SkipTest("No French locale available") locale.setlocale(locale.LC_NUMERIC, locale=self.tst_locale)
Example #4
Source File: _locales.py From pySINDy with MIT License | 5 votes |
def __exit__(self, type, value, traceback): locale.setlocale(locale.LC_NUMERIC, locale=self.cur_locale)
Example #5
Source File: test_locale.py From ironpython3 with Apache License 2.0 | 5 votes |
def setUpClass(cls): if sys.platform == 'darwin': import os tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US") if int(os.uname().release.split('.')[0]) < 10: # The locale test work fine on OSX 10.6, I (ronaldoussoren) # haven't had time yet to verify if tests work on OSX 10.5 # (10.4 is known to be bad) raise unittest.SkipTest("Locale support on MacOSX is minimal") elif sys.platform.startswith("win"): tlocs = ("En", "English") else: tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US.US-ASCII", "en_US") try: oldlocale = locale.setlocale(locale.LC_NUMERIC) for tloc in tlocs: try: locale.setlocale(locale.LC_NUMERIC, tloc) except locale.Error: continue break else: raise unittest.SkipTest("Test locale not supported " "(tried %s)" % (', '.join(tlocs))) cls.enUS_locale = tloc finally: locale.setlocale(locale.LC_NUMERIC, oldlocale)
Example #6
Source File: test_locale.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_setlocale_category(self): locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_TIME) locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_COLLATE) locale.setlocale(locale.LC_MONETARY) locale.setlocale(locale.LC_NUMERIC) # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345)
Example #7
Source File: test_locale.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def get_enUS_locale(): global enUS_locale if sys.platform == 'darwin': import os tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US") if int(os.uname()[2].split('.')[0]) < 10: # The locale test work fine on OSX 10.6, I (ronaldoussoren) # haven't had time yet to verify if tests work on OSX 10.5 # (10.4 is known to be bad) raise unittest.SkipTest("Locale support on MacOSX is minimal") if sys.platform.startswith("win"): tlocs = ("En", "English") else: tlocs = ("en_US.UTF-8", "en_US.US-ASCII", "en_US") oldlocale = locale.setlocale(locale.LC_NUMERIC) for tloc in tlocs: try: locale.setlocale(locale.LC_NUMERIC, tloc) except locale.Error: continue break else: raise unittest.SkipTest( "Test locale not supported (tried %s)" % (', '.join(tlocs))) enUS_locale = tloc locale.setlocale(locale.LC_NUMERIC, oldlocale)
Example #8
Source File: test_locale.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_setlocale_category(self): locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_TIME) locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_COLLATE) locale.setlocale(locale.LC_MONETARY) locale.setlocale(locale.LC_NUMERIC) # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345)
Example #9
Source File: test_locale.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def setUpClass(cls): if sys.platform == 'darwin': import os tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US") if int(os.uname().release.split('.')[0]) < 10: # The locale test work fine on OSX 10.6, I (ronaldoussoren) # haven't had time yet to verify if tests work on OSX 10.5 # (10.4 is known to be bad) raise unittest.SkipTest("Locale support on MacOSX is minimal") elif sys.platform.startswith("win"): tlocs = ("En", "English") else: tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US.US-ASCII", "en_US") try: oldlocale = locale.setlocale(locale.LC_NUMERIC) for tloc in tlocs: try: locale.setlocale(locale.LC_NUMERIC, tloc) except locale.Error: continue break else: raise unittest.SkipTest("Test locale not supported " "(tried %s)" % (', '.join(tlocs))) cls.enUS_locale = tloc finally: locale.setlocale(locale.LC_NUMERIC, oldlocale)
Example #10
Source File: test_locale.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_setlocale_category(self): locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_TIME) locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_COLLATE) locale.setlocale(locale.LC_MONETARY) locale.setlocale(locale.LC_NUMERIC) # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345)
Example #11
Source File: test_locale.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def get_enUS_locale(): global enUS_locale if sys.platform == 'darwin': import os tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US") if int(os.uname()[2].split('.')[0]) < 10: # The locale test work fine on OSX 10.6, I (ronaldoussoren) # haven't had time yet to verify if tests work on OSX 10.5 # (10.4 is known to be bad) raise unittest.SkipTest("Locale support on MacOSX is minimal") if sys.platform.startswith("win"): tlocs = ("En", "English") else: tlocs = ("en_US.UTF-8", "en_US.US-ASCII", "en_US") oldlocale = locale.setlocale(locale.LC_NUMERIC) for tloc in tlocs: try: locale.setlocale(locale.LC_NUMERIC, tloc) except locale.Error: continue break else: raise unittest.SkipTest( "Test locale not supported (tried %s)" % (', '.join(tlocs))) enUS_locale = tloc locale.setlocale(locale.LC_NUMERIC, oldlocale)
Example #12
Source File: test_locale.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_setlocale_category(self): locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_TIME) locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_COLLATE) locale.setlocale(locale.LC_MONETARY) locale.setlocale(locale.LC_NUMERIC) # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345)
Example #13
Source File: _locales.py From coffeegrindsize with MIT License | 5 votes |
def find_comma_decimal_point_locale(): """See if platform has a decimal point as comma locale. Find a locale that uses a comma instead of a period as the decimal point. Returns ------- old_locale: str Locale when the function was called. new_locale: {str, None) First French locale found, None if none found. """ if sys.platform == 'win32': locales = ['FRENCH'] else: locales = ['fr_FR', 'fr_FR.UTF-8', 'fi_FI', 'fi_FI.UTF-8'] old_locale = locale.getlocale(locale.LC_NUMERIC) new_locale = None try: for loc in locales: try: locale.setlocale(locale.LC_NUMERIC, loc) new_locale = loc break except locale.Error: pass finally: locale.setlocale(locale.LC_NUMERIC, locale=old_locale) return old_locale, new_locale
Example #14
Source File: _locales.py From coffeegrindsize with MIT License | 5 votes |
def setup(self): if self.tst_locale is None: pytest.skip("No French locale available") locale.setlocale(locale.LC_NUMERIC, locale=self.tst_locale)
Example #15
Source File: _locales.py From coffeegrindsize with MIT License | 5 votes |
def teardown(self): locale.setlocale(locale.LC_NUMERIC, locale=self.cur_locale)
Example #16
Source File: _locales.py From pySINDy with MIT License | 5 votes |
def setup(self): if self.tst_locale is None: raise SkipTest("No French locale available") locale.setlocale(locale.LC_NUMERIC, locale=self.tst_locale)
Example #17
Source File: _locales.py From coffeegrindsize with MIT License | 5 votes |
def __exit__(self, type, value, traceback): locale.setlocale(locale.LC_NUMERIC, locale=self.cur_locale)
Example #18
Source File: _locales.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def find_comma_decimal_point_locale(): """See if platform has a decimal point as comma locale. Find a locale that uses a comma instead of a period as the decimal point. Returns ------- old_locale: str Locale when the function was called. new_locale: {str, None) First French locale found, None if none found. """ if sys.platform == 'win32': locales = ['FRENCH'] else: locales = ['fr_FR', 'fr_FR.UTF-8', 'fi_FI', 'fi_FI.UTF-8'] old_locale = locale.getlocale(locale.LC_NUMERIC) new_locale = None try: for loc in locales: try: locale.setlocale(locale.LC_NUMERIC, loc) new_locale = loc break except locale.Error: pass finally: locale.setlocale(locale.LC_NUMERIC, locale=old_locale) return old_locale, new_locale
Example #19
Source File: _locales.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def setup(self): if self.tst_locale is None: raise SkipTest("No French locale available") locale.setlocale(locale.LC_NUMERIC, locale=self.tst_locale)
Example #20
Source File: _locales.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def teardown(self): locale.setlocale(locale.LC_NUMERIC, locale=self.cur_locale)
Example #21
Source File: _locales.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def __enter__(self): if self.tst_locale is None: raise SkipTest("No French locale available") locale.setlocale(locale.LC_NUMERIC, locale=self.tst_locale)
Example #22
Source File: _locales.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def __exit__(self, type, value, traceback): locale.setlocale(locale.LC_NUMERIC, locale=self.cur_locale)
Example #23
Source File: test_locale.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def get_enUS_locale(): global enUS_locale if sys.platform == 'darwin': import os tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US") if int(os.uname()[2].split('.')[0]) < 10: # The locale test work fine on OSX 10.6, I (ronaldoussoren) # haven't had time yet to verify if tests work on OSX 10.5 # (10.4 is known to be bad) raise unittest.SkipTest("Locale support on MacOSX is minimal") if sys.platform.startswith("win"): tlocs = ("En", "English") else: tlocs = ("en_US.UTF-8", "en_US.US-ASCII", "en_US") oldlocale = locale.setlocale(locale.LC_NUMERIC) for tloc in tlocs: try: locale.setlocale(locale.LC_NUMERIC, tloc) except locale.Error: continue break else: raise unittest.SkipTest( "Test locale not supported (tried %s)" % (', '.join(tlocs))) enUS_locale = tloc locale.setlocale(locale.LC_NUMERIC, oldlocale)
Example #24
Source File: test_locale.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_setlocale_category(self): locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_TIME) locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_COLLATE) locale.setlocale(locale.LC_MONETARY) locale.setlocale(locale.LC_NUMERIC) # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345)
Example #25
Source File: _locales.py From twitter-stock-recommendation with MIT License | 5 votes |
def find_comma_decimal_point_locale(): """See if platform has a decimal point as comma locale. Find a locale that uses a comma instead of a period as the decimal point. Returns ------- old_locale: str Locale when the function was called. new_locale: {str, None) First French locale found, None if none found. """ if sys.platform == 'win32': locales = ['FRENCH'] else: locales = ['fr_FR', 'fr_FR.UTF-8', 'fi_FI', 'fi_FI.UTF-8'] old_locale = locale.getlocale(locale.LC_NUMERIC) new_locale = None try: for loc in locales: try: locale.setlocale(locale.LC_NUMERIC, loc) new_locale = loc break except locale.Error: pass finally: locale.setlocale(locale.LC_NUMERIC, locale=old_locale) return old_locale, new_locale
Example #26
Source File: _locales.py From twitter-stock-recommendation with MIT License | 5 votes |
def setup(self): if self.tst_locale is None: raise SkipTest("No French locale available") locale.setlocale(locale.LC_NUMERIC, locale=self.tst_locale)
Example #27
Source File: _locales.py From twitter-stock-recommendation with MIT License | 5 votes |
def teardown(self): locale.setlocale(locale.LC_NUMERIC, locale=self.cur_locale)
Example #28
Source File: _locales.py From twitter-stock-recommendation with MIT License | 5 votes |
def __enter__(self): if self.tst_locale is None: raise SkipTest("No French locale available") locale.setlocale(locale.LC_NUMERIC, locale=self.tst_locale)
Example #29
Source File: _locales.py From twitter-stock-recommendation with MIT License | 5 votes |
def __exit__(self, type, value, traceback): locale.setlocale(locale.LC_NUMERIC, locale=self.cur_locale)
Example #30
Source File: _locales.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def __exit__(self, type, value, traceback): locale.setlocale(locale.LC_NUMERIC, locale=self.cur_locale)