summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2018-01-16 15:23:11 +0200
committerGitHub <noreply@github.com>2018-01-16 15:23:11 +0200
commit9e1ec18d7aff94295c65254c21356de37116ca14 (patch)
tree2b35782c5a00307b144243f1380715a48ab43d07
parent9f0ac5a0eb8301c955bfbd5a758516a2def5381e (diff)
parent6126d3bb3be6d51f8676638f9475e0048c44a494 (diff)
downloadbabel-9e1ec18d7aff94295c65254c21356de37116ca14.tar.gz
Merge pull request #546 from hugovk/rm-eol
Drop support for EOL Python 2.6 and 3.3
-rw-r--r--.travis.yml8
-rw-r--r--babel/dates.py4
-rw-r--r--babel/languages.py2
-rw-r--r--babel/messages/catalog.py8
-rw-r--r--babel/messages/checkers.py6
-rw-r--r--babel/messages/frontend.py2
-rw-r--r--babel/numbers.py4
-rw-r--r--babel/plural.py2
-rw-r--r--docs/dev.rst3
-rwxr-xr-xsetup.py3
-rw-r--r--tests/messages/test_catalog.py2
-rw-r--r--tests/messages/test_extract.py4
-rw-r--r--tests/messages/test_frontend.py32
-rw-r--r--tests/test_languages.py4
-rw-r--r--tests/test_localedata.py4
-rw-r--r--tests/test_numbers.py16
-rw-r--r--tests/test_support.py2
-rw-r--r--tox.ini2
18 files changed, 44 insertions, 64 deletions
diff --git a/.travis.yml b/.travis.yml
index f9469c9..b819e3e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,12 +12,6 @@ cache:
matrix:
include:
- os: linux
- python: 2.6
- - os: linux
- python: 2.6
- env:
- - CDECIMAL=m3-cdecimal
- - os: linux
python: 2.7
- os: linux
python: 2.7
@@ -28,8 +22,6 @@ matrix:
- os: linux
python: pypy3
- os: linux
- python: 3.3
- - os: linux
python: 3.4
- os: linux
python: 3.5
diff --git a/babel/dates.py b/babel/dates.py
index 3a075eb..1cc7962 100644
--- a/babel/dates.py
+++ b/babel/dates.py
@@ -521,7 +521,7 @@ def get_timezone_location(dt_or_tzinfo=None, locale=LC_TIME, return_city=False):
territory = 'ZZ' # invalid/unknown
territory_name = locale.territories[territory]
if not return_city and territory and len(get_global('territory_zones').get(territory, [])) == 1:
- return region_format % (territory_name)
+ return region_format % territory_name
# Otherwise, include the city in the output
fallback_format = locale.zone_formats['fallback']
@@ -1303,7 +1303,7 @@ class DateTimeFormat(object):
elif char == 'H':
return self.value.hour
elif char == 'h':
- return (self.value.hour % 12 or 12)
+ return self.value.hour % 12 or 12
elif char == 'm':
return self.value.minute
elif char == 'a':
diff --git a/babel/languages.py b/babel/languages.py
index 40f5d98..0513d00 100644
--- a/babel/languages.py
+++ b/babel/languages.py
@@ -26,7 +26,7 @@ def get_official_languages(territory, regional=False, de_facto=False):
"""
territory = str(territory).upper()
- allowed_stati = set(("official",))
+ allowed_stati = {"official"}
if regional:
allowed_stati.add("official_regional")
if de_facto:
diff --git a/babel/messages/catalog.py b/babel/messages/catalog.py
index fd40058..b293e3c 100644
--- a/babel/messages/catalog.py
+++ b/babel/messages/catalog.py
@@ -120,8 +120,8 @@ class Message(object):
"""Compare Messages, taking into account plural ids"""
def values_to_compare(obj):
if isinstance(obj, Message) and obj.pluralizable:
- return (obj.id[0], obj.context or '')
- return (obj.id, obj.context or '')
+ return obj.id[0], obj.context or ''
+ return obj.id, obj.context or ''
return cmp(values_to_compare(self), values_to_compare(other))
def __gt__(self, other):
@@ -531,7 +531,7 @@ class Catalog(object):
buf.append('%s: %s' % (name, value))
flags = set()
if self.fuzzy:
- flags |= set(['fuzzy'])
+ flags |= {'fuzzy'}
yield Message(u'', '\n'.join(buf), flags=flags)
for key in self._messages:
yield self._messages[key]
@@ -762,7 +762,7 @@ class Catalog(object):
message.string = message.string[0]
message.flags |= oldmsg.flags
if fuzzy:
- message.flags |= set([u'fuzzy'])
+ message.flags |= {u'fuzzy'}
self[message.id] = message
for message in template:
diff --git a/babel/messages/checkers.py b/babel/messages/checkers.py
index c4669c5..a1e6e8d 100644
--- a/babel/messages/checkers.py
+++ b/babel/messages/checkers.py
@@ -17,9 +17,9 @@ from babel._compat import string_types, izip
#: list of format chars that are compatible to each other
_string_format_compatibilities = [
- set(['i', 'd', 'u']),
- set(['x', 'X']),
- set(['f', 'F', 'g', 'G'])
+ {'i', 'd', 'u'},
+ {'x', 'X'},
+ {'f', 'F', 'g', 'G'}
]
diff --git a/babel/messages/frontend.py b/babel/messages/frontend.py
index 388c14b..b573a97 100644
--- a/babel/messages/frontend.py
+++ b/babel/messages/frontend.py
@@ -978,7 +978,7 @@ def parse_mapping(fileobj, filename=None):
method = extractors[method]
method_map[idx] = (pattern, method)
- return (method_map, options_map)
+ return method_map, options_map
def parse_keywords(strings=[]):
diff --git a/babel/numbers.py b/babel/numbers.py
index 1f77bcd..73ff816 100644
--- a/babel/numbers.py
+++ b/babel/numbers.py
@@ -20,16 +20,16 @@
# - http://www.unicode.org/reports/tr35/ (Appendix G.6)
import re
from datetime import date as date_, datetime as datetime_
-from itertools import chain
import warnings
from babel.core import default_locale, Locale, get_global
from babel._compat import decimal, string_types
-from babel.localedata import locale_identifiers
try:
+ # Python 2
long
except NameError:
+ # Python 3
long = int
diff --git a/babel/plural.py b/babel/plural.py
index a23f8b5..06f349e 100644
--- a/babel/plural.py
+++ b/babel/plural.py
@@ -241,7 +241,7 @@ def to_gettext(rule):
"""
rule = PluralRule.parse(rule)
- used_tags = rule.tags | set([_fallback_tag])
+ used_tags = rule.tags | {_fallback_tag}
_compile = _GettextCompiler().compile
_get_index = [tag for tag in _plural_tags if tag in used_tags].index
diff --git a/docs/dev.rst b/docs/dev.rst
index afc8b12..0ff033f 100644
--- a/docs/dev.rst
+++ b/docs/dev.rst
@@ -30,9 +30,8 @@ Python Versions
At the moment the following Python versions should be supported:
-* Python 2.6
* Python 2.7
-* Python 3.3 and up
+* Python 3.4 and up
* PyPy tracking 2.7 and 3.2 and up
While PyPy does not currently support 3.3, it does support traditional
diff --git a/setup.py b/setup.py
index 684c387..8e268e1 100755
--- a/setup.py
+++ b/setup.py
@@ -45,10 +45,8 @@ setup(
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
@@ -56,6 +54,7 @@ setup(
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Libraries :: Python Modules',
],
+ python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
packages=['babel', 'babel.messages', 'babel.localtime'],
include_package_data=True,
install_requires=[
diff --git a/tests/messages/test_catalog.py b/tests/messages/test_catalog.py
index 2d2880c..07ed724 100644
--- a/tests/messages/test_catalog.py
+++ b/tests/messages/test_catalog.py
@@ -101,7 +101,7 @@ class CatalogTestCase(unittest.TestCase):
def test_update_message_changed_to_simple(self):
cat = catalog.Catalog()
- cat.add((u'foo' u'foos'), (u'Voh', u'Vöhs'))
+ cat.add(u'foo' u'foos', (u'Voh', u'Vöhs'))
tmpl = catalog.Catalog()
tmpl.add(u'foo')
cat.update(tmpl)
diff --git a/tests/messages/test_extract.py b/tests/messages/test_extract.py
index 873439d..17b090f 100644
--- a/tests/messages/test_extract.py
+++ b/tests/messages/test_extract.py
@@ -178,7 +178,7 @@ msg2 = ngettext(\"\"\"elvis\"\"\", 'elvises', count)
messages = list(extract.extract_python(buf,
extract.DEFAULT_KEYWORDS.keys(),
[], {}))
- self.assertEqual([(1, '_', (u'pylons'), []),
+ self.assertEqual([(1, '_', u'pylons', []),
(2, 'ngettext', (u'elvis', u'elvises', None), []),
(3, 'ngettext', (u'elvis', u'elvises', None), [])],
messages)
@@ -350,7 +350,7 @@ n = ngettext('foo')
self.assertEqual((None, u'hello', u'there'), messages[2][2])
self.assertEqual((None, None), messages[3][2])
self.assertEqual(None, messages[4][2])
- self.assertEqual(('foo'), messages[5][2])
+ self.assertEqual('foo', messages[5][2])
def test_utf8_message(self):
buf = BytesIO(u"""
diff --git a/tests/messages/test_frontend.py b/tests/messages/test_frontend.py
index 20904a3..10325fe 100644
--- a/tests/messages/test_frontend.py
+++ b/tests/messages/test_frontend.py
@@ -1140,7 +1140,7 @@ msgstr[2] ""
assert not os.path.isfile(mo_file), 'Expected no file at %r' % mo_file
self.assertEqual("""\
catalog %s is marked as fuzzy, skipping
-""" % (po_file), sys.stderr.getvalue())
+""" % po_file, sys.stderr.getvalue())
def test_compile_fuzzy_catalog(self):
po_file = self._po_file('de_DE')
@@ -1343,26 +1343,14 @@ def test_extract_keyword_args_384(split, arg_name):
"extract -F babel-django.cfg --add-comments Translators: -o django232.pot %s ." % kwarg_text
)
assert isinstance(cmdinst, extract_messages)
- assert set(cmdinst.keywords.keys()) == set((
- '_',
- 'dgettext',
- 'dngettext',
- 'gettext',
- 'gettext_lazy',
- 'gettext_noop',
- 'N_',
- 'ngettext',
- 'ngettext_lazy',
- 'npgettext',
- 'npgettext_lazy',
- 'pgettext',
- 'pgettext_lazy',
- 'ugettext',
- 'ugettext_lazy',
- 'ugettext_noop',
- 'ungettext',
- 'ungettext_lazy',
- ))
+ assert set(cmdinst.keywords.keys()) == {'_', 'dgettext', 'dngettext',
+ 'gettext', 'gettext_lazy',
+ 'gettext_noop', 'N_', 'ngettext',
+ 'ngettext_lazy', 'npgettext',
+ 'npgettext_lazy', 'pgettext',
+ 'pgettext_lazy', 'ugettext',
+ 'ugettext_lazy', 'ugettext_noop',
+ 'ungettext', 'ungettext_lazy'}
@pytest.mark.parametrize("kwarg,expected", [
@@ -1384,7 +1372,7 @@ def test_extract_distutils_keyword_arg_388(kwarg, expected):
assert set(cmdinst.keywords.keys()) == set(expected)
# Test the comma-separated comment argument while we're at it:
- assert set(cmdinst.add_comments) == set(("Bar", "Foo"))
+ assert set(cmdinst.add_comments) == {"Bar", "Foo"}
def test_update_catalog_boolean_args():
diff --git a/tests/test_languages.py b/tests/test_languages.py
index 594149f..23af26d 100644
--- a/tests/test_languages.py
+++ b/tests/test_languages.py
@@ -11,4 +11,6 @@ def test_official_languages():
def test_get_language_info():
- assert set(get_territory_language_info("HU").keys()) == set(("hu", "en", "de", "ro", "hr", "sk", "sl"))
+ assert set(get_territory_language_info("HU").keys()) == {"hu", "en", "de",
+ "ro", "hr", "sk",
+ "sl"}
diff --git a/tests/test_localedata.py b/tests/test_localedata.py
index 6954d38..f678d5b 100644
--- a/tests/test_localedata.py
+++ b/tests/test_localedata.py
@@ -96,12 +96,12 @@ def test_mixedcased_locale():
def test_locale_argument_acceptance():
# Testing None input.
normalized_locale = localedata.normalize_locale(None)
- assert normalized_locale == None
+ assert normalized_locale is None
locale_exist = localedata.exists(None)
assert locale_exist == False
# # Testing list input.
normalized_locale = localedata.normalize_locale(['en_us', None])
- assert normalized_locale == None
+ assert normalized_locale is None
locale_exist = localedata.exists(['en_us', None])
assert locale_exist == False
diff --git a/tests/test_numbers.py b/tests/test_numbers.py
index 48a260b..2795b0f 100644
--- a/tests/test_numbers.py
+++ b/tests/test_numbers.py
@@ -177,7 +177,7 @@ def test_list_currencies():
list_currencies('yo!')
assert excinfo.value.args[0] == "expected only letters, got 'yo!'"
- assert list_currencies(locale='pa_Arab') == set(['PKR', 'INR', 'EUR'])
+ assert list_currencies(locale='pa_Arab') == {'PKR', 'INR', 'EUR'}
assert list_currencies(locale='kok') == set([])
assert len(list_currencies()) == 296
@@ -206,13 +206,13 @@ def test_is_currency():
def test_normalize_currency():
assert normalize_currency('EUR') == 'EUR'
assert normalize_currency('eUr') == 'EUR'
- assert normalize_currency('FUU') == None
- assert normalize_currency('') == None
- assert normalize_currency(None) == None
- assert normalize_currency(' EUR ') == None
- assert normalize_currency(' ') == None
- assert normalize_currency([]) == None
- assert normalize_currency(set()) == None
+ assert normalize_currency('FUU') is None
+ assert normalize_currency('') is None
+ assert normalize_currency(None) is None
+ assert normalize_currency(' EUR ') is None
+ assert normalize_currency(' ') is None
+ assert normalize_currency([]) is None
+ assert normalize_currency(set()) is None
def test_get_currency_name():
diff --git a/tests/test_support.py b/tests/test_support.py
index f2a99b7..6f9fb32 100644
--- a/tests/test_support.py
+++ b/tests/test_support.py
@@ -358,4 +358,4 @@ def test_catalog_merge_files():
t2._catalog["bar"] = "quux"
t1.merge(t2)
assert t1.files == ["pro.mo"]
- assert set(t1._catalog.keys()) == set(('', 'foo', 'bar'))
+ assert set(t1._catalog.keys()) == {'', 'foo', 'bar'}
diff --git a/tox.ini b/tox.ini
index b71dec7..33d1ab8 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py26, py27, pypy, py33, py34, py35, py36, pypy3, py26-cdecimal, py27-cdecimal
+envlist = py27, pypy, py34, py35, py36, pypy3, py27-cdecimal
[testenv]
deps =