sebleblanc [Tue, 3 Dec 2019 04:45:42 +0000 (04:45 +0000)]
Hardcode "ignore" method
The "ignore" method used to force the opening of the file. Some editors (emacs) create symbolic links to use as synchronization locks. Those links have an extension that matches the opened file, but the links themselves do not point to an existing file, thus causing Babel to attempt to open a file that does not exist.
This fix skips opening of a file altogether when using the method "ignore" in the mapping file.
Miro Hrončok [Thu, 14 Mar 2019 18:54:42 +0000 (19:54 +0100)]
Fix conftest.py compatibility with pytest 4.3
While pytest in tox.ini is explicitly set to be 3.3.2, in Fedora 31
we are about to update to a newer version of pytest.
In order to be able to test babel, we need pytest 4.3 support.
This adds support for pytest 4.3 without breaking support for 3.3.2.
Jon Dufresne [Thu, 11 Oct 2018 03:34:09 +0000 (20:34 -0700)]
Remove unnecessary compat shim 'binary_type'
The bytes type is available on all supported Pythons. On Python 2, it is
an alias of str, same as binary_type. By removing the shim, makes the
code more forward compatible.
mondeja [Sat, 13 Oct 2018 12:49:30 +0000 (14:49 +0200)]
Avoid KeyError trying to get data on WindowsXP
I've found this issue trying to compile documentation with Sphinx on WindowsXP with `make html` command. Some data dictionaries are void on my machine, so using lazy 'get' on those can prevent next `KeyError`:
```
C:\Path\to\my\project\doc>make html
{'MapID': '8,9', 'Index': 165, 'Std': 'Hora estándar árabe', 'Display': '(GMT+04
:00) Abu Dhabi, Muscat', 'TZI': b'\x10\xff\xff\xff\x00\x00\x00\x00\xc4\xff\xff\x
ff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x
00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'Dlt': 'Hora de verano árab
e'}
{'MapID': '-1,71', 'Index': 158, 'Std': 'Hora estándar árabe D', 'Display': '(GM
T+03:00) Baghdad', 'TZI': b'L\xff\xff\xff\x00\x00\x00\x00\xc4\xff\xff\xff\x00\x0
0\n\x00\x00\x00\x01\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\
x01\x00\x03\x00\x00\x00\x00\x00\x00\x00', 'Dlt': 'Hora de verano árabe'}
{'MapID': '12,13', 'Index': 195, 'Std': 'Hora estándar de Asia C.', 'Display': '
(GMT+06:00) Astana, Dhaka', 'TZI': b'\x98\xfe\xff\xff\x00\x00\x00\x00\xc4\xff\xf
f\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0
0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'Dlt': 'Hora de verano d
e Asia C.'}
{}
Traceback (most recent call last):
File "c:\python34\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "c:\python34\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python34\Scripts\sphinx-build.exe\__main__.py", line 5, in <module>
File "c:\python34\lib\site-packages\sphinx\cmd\build.py", line 25, in <module>
from sphinx.application import Sphinx
File "c:\python34\lib\site-packages\sphinx\application.py", line 29, in <modul
e>
from sphinx.config import Config, check_unicode
File "c:\python34\lib\site-packages\sphinx\config.py", line 28, in <module>
from sphinx.util.i18n import format_date
File "c:\python34\lib\site-packages\sphinx\util\i18n.py", line 20, in <module>
import babel.dates
File "c:\python34\lib\site-packages\babel\dates.py", line 29, in <module>
from babel.util import UTC, LOCALTZ
File "c:\python34\lib\site-packages\babel\util.py", line 19, in <module>
from babel import localtime
File "c:\python34\lib\site-packages\babel\localtime\__init__.py", line 74, in
<module>
LOCALTZ = get_localzone()
File "c:\python34\lib\site-packages\babel\localtime\__init__.py", line 70, in
get_localzone
return _get_localzone()
File "c:\python34\lib\site-packages\babel\localtime\_win32.py", line 97, in _g
et_localzone
return pytz.timezone(get_localzone_name())
File "c:\python34\lib\site-packages\babel\localtime\_win32.py", line 70, in ge
t_localzone_name
if data['Std'] == tzwin:
KeyError: 'Std'
```
Luke Plant [Thu, 7 Jun 2018 12:21:19 +0000 (15:21 +0300)]
Simplify format_currency code by pulling out/using helpers.
In detail:
1. Use the already existing get_currency_name function which does
the plural form logic already.
2. Create a similar `get_currency_unit_pattern` function.
This function could be useful if someone wanted to write
something very similar to the _format_currency_long_name
functionality but with some different customizations,
so it is now publicly documented.
3. Simplify the _format_currency_long_name function - it
is now much flatter.
4. Add more tests to ensure certain cases are really covered.
(e.g. different unit patterns depending on the count)
An upshot of the changes is that we have reduced (and made more consistent)
the number of places where we need to peek into `Locale._data` -
get_currency_name and get_currency_unit_pattern are the only places that
babel.numbers does this.
Aarni Koskela [Mon, 28 May 2018 09:12:23 +0000 (12:12 +0300)]
import_cldr: ignore formatting rules for non-Latin numbering systems
Previously the script could have inadvertently merged formatting rules between numbering systems due to the XML selectors used. This makes sure only Latin rules are used for the time being. When support for other numbering systems is properly added (see #470), these checks can be changed.
Aarni Koskela [Mon, 7 May 2018 10:01:25 +0000 (13:01 +0300)]
Restore force_frac to NumberPattern.apply(), as deprecated
This retains backwards compatibility (at least as far as the function's
signature is concerned) with users that are using NumberPattern.apply()
directly.