- repo: https://github.com/pre-commit/pre-commit-hooks
sha: 97b88d9610bcc03982ddac33caba98bb2b751f5f
hooks:
- - id: trailing-whitespace
- - id: end-of-file-fixer
- id: autopep8-wrapper
exclude: (docs/conf.py|tests/messages/data/)
+ - id: check-added-large-files
- id: check-docstring-first
exclude: (docs/conf.py)
- id: check-json
- - id: check-added-large-files
- id: check-yaml
- id: debug-statements
+ - id: end-of-file-fixer
+ - id: flake8
+ exclude: (docs/conf.py|babel/messages/__init__.py|babel/__init__.py|babel/_compat.py|tests/messages/data|scripts/import_cldr.py)
- id: name-tests-test
args: ['--django']
exclude: (tests/messages/data/)
- id: requirements-txt-fixer
+ - id: trailing-whitespace
:type: `unicode`"""
return self.get_display_name(Locale('en'))
- #{ General Locale Display Names
+ # { General Locale Display Names
@property
def languages(self):
"""
return self._data['variants']
- #{ Number Formatting
+ # { Number Formatting
@property
def currencies(self):
"""
return self._data['scientific_formats']
- #{ Calendar Information and Date Formatting
+ # { Calendar Information and Date Formatting
@property
def periods(self):
if lines and not lines[-1]:
del lines[-1]
lines[-1] += '\n'
- return u'""\n' + u'\n'.join([(prefix + escape(l)) for l in lines])
+ return u'""\n' + u'\n'.join([(prefix + escape(line)) for line in lines])
def write_po(fileobj, catalog, width=76, no_location=False, omit_header=False,
value += ('0' * (min - len(value)))
if max == 0 or (min == 0 and int(value) == 0):
return ''
- width = len(value)
while len(value) > min and value[-1] == '0':
value = value[:-1]
return get_decimal_symbol(locale) + value
import re
import textwrap
from babel._compat import izip, imap
+import pytz as _pytz
+from babel import localtime
missing = object()
return ZERO
-import pytz as _pytz
-from babel import localtime
-
# Export the localtime functionality here because that's
# where it was in the past.
UTC = _pytz.utc
match = re.search('^Version\s+(.*)', line.strip())
if match is None:
continue
- length = len(match.group(1))
version = match.group(1).strip()
if lineiter.next().count('-') != len(match.group(0)):
continue
assert msg3.string == (u'Salat', u'Salate')
assert msg3.locations == [('util.py', 42)]
- assert not 'head' in cat
+ assert 'head' not in cat
assert list(cat.obsolete.values())[0].id == 'head'
cat.update(template, update_header_comment=True)
# individuals. For the exact contribution history, see the revision
# history and logs, available at http://babel.edgewall.org/log/.
-import doctest
-import unittest
import pytest
-from babel import core, Locale
+from babel import core
from babel.core import default_locale, Locale
assert en_US == en_US_2
assert en_US != fi_FI
assert not (en_US != en_US_2)
- assert None != en_US
+ assert en_US is not None
assert en_US != bad_en_US
assert fi_FI != bad_en_US
import calendar
from datetime import date, datetime, time, timedelta
-import types
import unittest
from pytz import timezone
self.assertEqual('4', fmt['c']) # friday is first day of week
def test_pattern_day_of_week(self):
- dt = datetime(2016,2,6)
+ dt = datetime(2016, 2, 6)
fmt = dates.DateTimeFormat(dt, locale='en_US')
self.assertEqual('7', fmt['c'])
self.assertEqual('Sat', fmt['ccc'])
self.assertEqual('6', fmt['e'])
self.assertEqual('06', fmt['ee'])
-
def test_fractional_seconds(self):
t = time(8, 3, 9, 799)
fmt = dates.DateTimeFormat(t, locale='en_US')
# individuals. For the exact contribution history, see the revision
# history and logs, available at http://babel.edgewall.org/log/.
-import doctest
import unittest
import random
from operator import methodcaller
commands = make clean-cldr test
[pep8]
-ignore = E501,E731
+ignore = E501,E731,W503
[flake8]
-ignore = E501,E731
+ignore = E501,E731,W503