summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--babel/__init__.py1
-rw-r--r--babel/core.py3
-rw-r--r--babel/dates.py12
-rw-r--r--babel/languages.py1
-rw-r--r--babel/lists.py1
-rw-r--r--babel/localedata.py3
-rw-r--r--babel/localtime/__init__.py1
-rw-r--r--babel/localtime/_unix.py4
-rw-r--r--babel/messages/__init__.py1
-rw-r--r--babel/messages/catalog.py11
-rw-r--r--babel/messages/checkers.py1
-rw-r--r--babel/messages/extract.py6
-rw-r--r--babel/messages/frontend.py10
-rw-r--r--babel/messages/jslexer.py1
-rw-r--r--babel/messages/mofile.py5
-rw-r--r--babel/messages/plurals.py1
-rw-r--r--babel/messages/pofile.py10
-rw-r--r--babel/numbers.py5
-rw-r--r--babel/plural.py11
-rw-r--r--babel/support.py11
-rw-r--r--babel/units.py2
-rw-r--r--babel/util.py1
-rw-r--r--docs/conf.py1
-rwxr-xr-xscripts/dump_data.py1
-rwxr-xr-xscripts/dump_global.py1
-rwxr-xr-xscripts/import_cldr.py13
-rwxr-xr-xscripts/make-release.py1
-rwxr-xr-xsetup.py2
-rw-r--r--tests/messages/test_catalog.py1
-rw-r--r--tests/messages/test_checkers.py1
-rw-r--r--tests/messages/test_extract.py1
-rw-r--r--tests/messages/test_frontend.py9
-rw-r--r--tests/messages/test_js_extract.py1
-rw-r--r--tests/messages/test_jslexer.py2
-rw-r--r--tests/messages/test_mofile.py1
-rw-r--r--tests/messages/test_plurals.py1
-rw-r--r--tests/messages/test_pofile.py1
-rw-r--r--tests/test_core.py1
-rw-r--r--tests/test_date_intervals.py3
-rw-r--r--tests/test_dates.py1
-rw-r--r--tests/test_day_periods.py1
-rw-r--r--tests/test_languages.py1
-rw-r--r--tests/test_lists.py1
-rw-r--r--tests/test_localedata.py1
-rw-r--r--tests/test_numbers.py1
-rw-r--r--tests/test_plural.py1
-rw-r--r--tests/test_smoke.py1
-rw-r--r--tests/test_support.py1
-rw-r--r--tests/test_util.py1
49 files changed, 47 insertions, 106 deletions
diff --git a/babel/__init__.py b/babel/__init__.py
index 90a15cf..1e0830a 100644
--- a/babel/__init__.py
+++ b/babel/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel
~~~~~
diff --git a/babel/core.py b/babel/core.py
index 67387ac..9393c23 100644
--- a/babel/core.py
+++ b/babel/core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.core
~~~~~~~~~~
@@ -105,7 +104,7 @@ class UnknownLocaleError(Exception):
self.identifier = identifier
-class Locale(object):
+class Locale:
"""Representation of a specific locale.
>>> locale = Locale('en', 'US')
diff --git a/babel/dates.py b/babel/dates.py
index 74fc6db..6e049e9 100644
--- a/babel/dates.py
+++ b/babel/dates.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.dates
~~~~~~~~~~~
@@ -16,7 +15,6 @@
:license: BSD, see LICENSE for more details.
"""
-from __future__ import division
import re
import warnings
@@ -262,7 +260,7 @@ def get_next_timezone_transition(zone=None, dt=None):
)
-class TimezoneTransition(object):
+class TimezoneTransition:
"""A helper object that represents the return value from
:func:`get_next_timezone_transition`.
@@ -1207,7 +1205,7 @@ def parse_date(string, locale=LC_TIME, format='medium'):
indexes = [(year_idx, 'Y'), (month_idx, 'M'), (day_idx, 'D')]
indexes.sort()
- indexes = dict([(item[1], idx) for idx, item in enumerate(indexes)])
+ indexes = {item[1]: idx for idx, item in enumerate(indexes)}
# FIXME: this currently only supports numbers, but should also support month
# names, both in the requested locale, and english
@@ -1253,7 +1251,7 @@ def parse_time(string, locale=LC_TIME, format='medium'):
indexes = [(hour_idx, 'H'), (min_idx, 'M'), (sec_idx, 'S')]
indexes.sort()
- indexes = dict([(item[1], idx) for idx, item in enumerate(indexes)])
+ indexes = {item[1]: idx for idx, item in enumerate(indexes)}
# TODO: support time zones
@@ -1274,7 +1272,7 @@ def parse_time(string, locale=LC_TIME, format='medium'):
return time(hour, minute, second)
-class DateTimePattern(object):
+class DateTimePattern:
def __init__(self, pattern, format):
self.pattern = pattern
@@ -1299,7 +1297,7 @@ class DateTimePattern(object):
return self % DateTimeFormat(datetime, locale)
-class DateTimeFormat(object):
+class DateTimeFormat:
def __init__(self, value, locale):
assert isinstance(value, (date, datetime, time))
diff --git a/babel/languages.py b/babel/languages.py
index 0974367..cac59c1 100644
--- a/babel/languages.py
+++ b/babel/languages.py
@@ -1,4 +1,3 @@
-# -- encoding: UTF-8 --
from babel.core import get_global
diff --git a/babel/lists.py b/babel/lists.py
index 431acd8..11cc7d7 100644
--- a/babel/lists.py
+++ b/babel/lists.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.lists
~~~~~~~~~~~
diff --git a/babel/localedata.py b/babel/localedata.py
index 9461e84..14e6bcd 100644
--- a/babel/localedata.py
+++ b/babel/localedata.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.localedata
~~~~~~~~~~~~~~~~
@@ -184,7 +183,7 @@ def merge(dict1, dict2):
dict1[key] = val1
-class Alias(object):
+class Alias:
"""Representation of an alias in the locale data.
An alias is a value that refers to some other part of the locale data,
diff --git a/babel/localtime/__init__.py b/babel/localtime/__init__.py
index 537ceb5..7e626a0 100644
--- a/babel/localtime/__init__.py
+++ b/babel/localtime/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.localtime
~~~~~~~~~~~~~~~
diff --git a/babel/localtime/_unix.py b/babel/localtime/_unix.py
index c219469..28b2533 100644
--- a/babel/localtime/_unix.py
+++ b/babel/localtime/_unix.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import with_statement
import os
import re
import sys
@@ -107,7 +105,7 @@ def _get_localzone(_root='/'):
tzpath = os.path.join(_root, filename)
if not os.path.exists(tzpath):
continue
- with open(tzpath, 'rt') as tzfile:
+ with open(tzpath) as tzfile:
for line in tzfile:
match = timezone_re.match(line)
if match is not None:
diff --git a/babel/messages/__init__.py b/babel/messages/__init__.py
index 58466c6..ad4fd34 100644
--- a/babel/messages/__init__.py
+++ b/babel/messages/__init__.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.messages
~~~~~~~~~~~~~~
diff --git a/babel/messages/catalog.py b/babel/messages/catalog.py
index 228b10b..564b2c7 100644
--- a/babel/messages/catalog.py
+++ b/babel/messages/catalog.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.messages.catalog
~~~~~~~~~~~~~~~~~~~~~~
@@ -69,7 +68,7 @@ def _parse_datetime_header(value):
return dt
-class Message(object):
+class Message:
"""Representation of a single message in a catalog."""
def __init__(self, id, string=u'', locations=(), flags=(), auto_comments=(),
@@ -227,7 +226,7 @@ DEFAULT_HEADER = u"""\
#"""
-class Catalog(object):
+class Catalog:
"""Representation of a message catalog."""
def __init__(self, locale=None, domain=None, header_comment=DEFAULT_HEADER,
@@ -755,10 +754,10 @@ class Catalog(object):
# Prepare for fuzzy matching
fuzzy_candidates = []
if not no_fuzzy_matching:
- fuzzy_candidates = dict([
- (self._key_for(msgid), messages[msgid].context)
+ fuzzy_candidates = {
+ self._key_for(msgid): messages[msgid].context
for msgid in messages if msgid and messages[msgid].string
- ])
+ }
fuzzy_matches = set()
def _merge(message, oldkey, newkey):
diff --git a/babel/messages/checkers.py b/babel/messages/checkers.py
index b79bd82..4292c02 100644
--- a/babel/messages/checkers.py
+++ b/babel/messages/checkers.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.messages.checkers
~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/babel/messages/extract.py b/babel/messages/extract.py
index c23a924..c95f1cb 100644
--- a/babel/messages/extract.py
+++ b/babel/messages/extract.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.messages.extract
~~~~~~~~~~~~~~~~~~~~~~
@@ -163,7 +162,7 @@ def extract_from_dir(
for filename in filenames:
filepath = os.path.join(root, filename).replace(os.sep, '/')
- for message_tuple in check_and_call_extract_file(
+ yield from check_and_call_extract_file(
filepath,
method_map,
options_map,
@@ -172,8 +171,7 @@ def extract_from_dir(
comment_tags,
strip_comment_tags,
dirpath=absname,
- ):
- yield message_tuple
+ )
def check_and_call_extract_file(filepath, method_map, options_map,
diff --git a/babel/messages/frontend.py b/babel/messages/frontend.py
index 73e4212..6e09d10 100644
--- a/babel/messages/frontend.py
+++ b/babel/messages/frontend.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.messages.frontend
~~~~~~~~~~~~~~~~~~~~~~~
@@ -8,7 +7,6 @@
:copyright: (c) 2013-2022 by the Babel Team.
:license: BSD, see LICENSE for more details.
"""
-from __future__ import print_function
import fnmatch
import logging
@@ -883,7 +881,7 @@ class update_catalog(Command):
return
-class CommandLineInterface(object):
+class CommandLineInterface:
"""Command-line interface.
This class provides a simple command-line interface to the message
@@ -937,7 +935,7 @@ class CommandLineInterface(object):
self._configure_logging(options.loglevel)
if options.list_locales:
identifiers = localedata.locale_identifiers()
- longest = max([len(identifier) for identifier in identifiers])
+ longest = max(len(identifier) for identifier in identifiers)
identifiers.sort()
format = u'%%-%ds %%s' % (longest + 1)
for identifier in identifiers:
@@ -974,7 +972,7 @@ class CommandLineInterface(object):
def _help(self):
print(self.parser.format_help())
print("commands:")
- longest = max([len(command) for command in self.commands])
+ longest = max(len(command) for command in self.commands)
format = " %%-%ds %%s" % max(8, longest + 1)
commands = sorted(self.commands.items())
for name, description in commands:
@@ -1094,7 +1092,7 @@ def parse_mapping(fileobj, filename=None):
if section == 'extractors':
extractors = dict(parser.items(section))
else:
- method, pattern = [part.strip() for part in section.split(':', 1)]
+ method, pattern = (part.strip() for part in section.split(':', 1))
method_map.append((pattern, method))
options_map[pattern] = dict(parser.items(section))
diff --git a/babel/messages/jslexer.py b/babel/messages/jslexer.py
index ef30c99..c1c2557 100644
--- a/babel/messages/jslexer.py
+++ b/babel/messages/jslexer.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.messages.jslexer
~~~~~~~~~~~~~~~~~~~~~~
diff --git a/babel/messages/mofile.py b/babel/messages/mofile.py
index 901f98d..8284574 100644
--- a/babel/messages/mofile.py
+++ b/babel/messages/mofile.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.messages.mofile
~~~~~~~~~~~~~~~~~~~~~
@@ -48,7 +47,7 @@ def read_mo(fileobj):
version, msgcount, origidx, transidx = unpack('>4I', buf[4:20])
ii = '>II'
else:
- raise IOError(0, 'Bad magic number', filename)
+ raise OSError(0, 'Bad magic number', filename)
# Now put all messages from the .mo file buffer into the catalog
# dictionary
@@ -61,7 +60,7 @@ def read_mo(fileobj):
msg = buf[moff:mend]
tmsg = buf[toff:tend]
else:
- raise IOError(0, 'File is corrupt', filename)
+ raise OSError(0, 'File is corrupt', filename)
# See if we're looking at GNU .mo conventions for metadata
if mlen == 0:
diff --git a/babel/messages/plurals.py b/babel/messages/plurals.py
index 52711a2..8722566 100644
--- a/babel/messages/plurals.py
+++ b/babel/messages/plurals.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.messages.plurals
~~~~~~~~~~~~~~~~~~~~~~
diff --git a/babel/messages/pofile.py b/babel/messages/pofile.py
index bd29e73..b94274d 100644
--- a/babel/messages/pofile.py
+++ b/babel/messages/pofile.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.messages.pofile
~~~~~~~~~~~~~~~~~~~~~
@@ -10,7 +9,6 @@
:license: BSD, see LICENSE for more details.
"""
-from __future__ import print_function
import os
import re
@@ -75,13 +73,13 @@ def denormalize(string):
class PoFileError(Exception):
"""Exception thrown by PoParser when an invalid po file is encountered."""
def __init__(self, message, catalog, line, lineno):
- super(PoFileError, self).__init__('{message} on {lineno}'.format(message=message, lineno=lineno))
+ super().__init__(f'{message} on {lineno}')
self.catalog = catalog
self.line = line
self.lineno = lineno
-class _NormalizedString(object):
+class _NormalizedString:
def __init__(self, *args):
self._strs = []
@@ -128,7 +126,7 @@ class _NormalizedString(object):
-class PoFileParser(object):
+class PoFileParser:
"""Support class to read messages from a ``gettext`` PO (portable object) file
and add them to a `Catalog`
@@ -170,7 +168,7 @@ class PoFileParser(object):
"""
self.translations.sort()
if len(self.messages) > 1:
- msgid = tuple([m.denormalize() for m in self.messages])
+ msgid = tuple(m.denormalize() for m in self.messages)
else:
msgid = self.messages[0].denormalize()
if isinstance(msgid, (list, tuple)):
diff --git a/babel/numbers.py b/babel/numbers.py
index 904ebbe..b8971bc 100644
--- a/babel/numbers.py
+++ b/babel/numbers.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.numbers
~~~~~~~~~~~~~
@@ -661,7 +660,7 @@ class NumberFormatError(ValueError):
"""Exception raised when a string cannot be parsed into a number."""
def __init__(self, message, suggestions=None):
- super(NumberFormatError, self).__init__(message)
+ super().__init__(message)
#: a list of properly formatted numbers derived from the invalid input
self.suggestions = suggestions
@@ -872,7 +871,7 @@ def parse_pattern(pattern):
exp_prec, exp_plus)
-class NumberPattern(object):
+class NumberPattern:
def __init__(self, pattern, prefix, suffix, grouping,
int_prec, frac_prec, exp_prec, exp_plus):
diff --git a/babel/plural.py b/babel/plural.py
index f06e90e..d3dc22d 100644
--- a/babel/plural.py
+++ b/babel/plural.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.numbers
~~~~~~~~~~~~~
@@ -75,7 +74,7 @@ def extract_operands(source):
return n, i, v, w, f, t, c, e
-class PluralRule(object):
+class PluralRule:
"""Represents a set of language pluralization rules. The constructor
accepts a list of (tag, expr) tuples or a dict of `CLDR rules`_. The
resulting object is callable and accepts one parameter with a positive or
@@ -149,9 +148,9 @@ class PluralRule(object):
{'one': 'n is 1'}
"""
_compile = _UnicodeCompiler().compile
- return dict([(tag, _compile(ast)) for tag, ast in self.abstract])
+ return {tag: _compile(ast) for tag, ast in self.abstract}
- tags = property(lambda x: frozenset([i[0] for i in x.abstract]), doc="""
+ tags = property(lambda x: frozenset(i[0] for i in x.abstract), doc="""
A set of explicitly defined tags in this rule. The implicit default
``'other'`` rules is not part of this set unless there is an explicit
rule for it.""")
@@ -385,7 +384,7 @@ def negate(rv):
return 'not', (rv,)
-class _Parser(object):
+class _Parser:
"""Internal parser. This class can translate a single rule into an abstract
tree of tuples. It implements the following grammar::
@@ -521,7 +520,7 @@ def _unary_compiler(tmpl):
compile_zero = lambda x: '0'
-class _Compiler(object):
+class _Compiler:
"""The compilers are able to transform the expressions into multiple
output formats.
"""
diff --git a/babel/support.py b/babel/support.py
index a22bffc..dbd914e 100644
--- a/babel/support.py
+++ b/babel/support.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.support
~~~~~~~~~~~~~
@@ -22,7 +21,7 @@ from babel.numbers import format_decimal, format_currency, \
format_percent, format_scientific
-class Format(object):
+class Format:
"""Wrapper class providing the various date and number formatting functions
bound to a specific locale and time-zone.
@@ -129,7 +128,7 @@ class Format(object):
return format_scientific(number, locale=self.locale)
-class LazyProxy(object):
+class LazyProxy:
"""Class for proxy objects that delegate to a specified function to evaluate
the actual object.
@@ -288,7 +287,7 @@ class LazyProxy(object):
)
-class NullTranslations(gettext.NullTranslations, object):
+class NullTranslations(gettext.NullTranslations):
DEFAULT_DOMAIN = None
@@ -304,7 +303,7 @@ class NullTranslations(gettext.NullTranslations, object):
# some *gettext methods (including '.gettext()') rely on the attributes.
self._catalog = {}
self.plural = lambda n: int(n != 1)
- super(NullTranslations, self).__init__(fp=fp)
+ super().__init__(fp=fp)
self.files = list(filter(None, [getattr(fp, 'name', None)]))
self.domain = self.DEFAULT_DOMAIN
self._domains = {}
@@ -534,7 +533,7 @@ class Translations(NullTranslations, gettext.GNUTranslations):
:param fp: the file-like object the translation should be read from
:param domain: the message domain (default: 'messages')
"""
- super(Translations, self).__init__(fp=fp)
+ super().__init__(fp=fp)
self.domain = domain or self.DEFAULT_DOMAIN
ugettext = gettext.GNUTranslations.gettext
diff --git a/babel/units.py b/babel/units.py
index bec8676..8a9ec7d 100644
--- a/babel/units.py
+++ b/babel/units.py
@@ -1,5 +1,3 @@
-# -- encoding: UTF-8 --
-
from babel.core import Locale
from babel.numbers import format_decimal, LC_NUMERIC
diff --git a/babel/util.py b/babel/util.py
index 2cac553..f628844 100644
--- a/babel/util.py
+++ b/babel/util.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
babel.util
~~~~~~~~~~
diff --git a/docs/conf.py b/docs/conf.py
index 8f583fa..0acdc0a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Babel documentation build configuration file, created by
# sphinx-quickstart on Wed Jul 3 17:53:01 2013.
diff --git a/scripts/dump_data.py b/scripts/dump_data.py
index 3edd971..e419050 100755
--- a/scripts/dump_data.py
+++ b/scripts/dump_data.py
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/scripts/dump_global.py b/scripts/dump_global.py
index 2938b25..6696415 100755
--- a/scripts/dump_global.py
+++ b/scripts/dump_global.py
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/scripts/import_cldr.py b/scripts/import_cldr.py
index 6fe9b8b..dbeb1b6 100755
--- a/scripts/import_cldr.py
+++ b/scripts/import_cldr.py
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
@@ -301,8 +300,8 @@ def parse_global(srcdir, sup):
all_currencies[cur_code].add(region_code)
region_currencies.sort(key=_currency_sort_key)
territory_currencies[region_code] = region_currencies
- global_data['all_currencies'] = dict([
- (currency, tuple(sorted(regions))) for currency, regions in all_currencies.items()])
+ global_data['all_currencies'] = {
+ currency: tuple(sorted(regions)) for currency, regions in all_currencies.items()}
# Explicit parent locales
for paternity in sup.findall('.//parentLocales/parentLocale'):
@@ -343,7 +342,7 @@ def _process_local_datas(sup, srcdir, destdir, force=False, dump_json=False):
region_items = sorted(regions.items())
for group, territory_list in region_items:
for territory in territory_list:
- containers = territory_containment.setdefault(territory, set([]))
+ containers = territory_containment.setdefault(territory, set())
if group in territory_containment:
containers |= territory_containment[group]
containers.add(group)
@@ -964,10 +963,10 @@ def parse_day_period_rules(tree):
type = rule.attrib["type"]
if type in ("am", "pm"): # These fixed periods are handled separately by `get_period_id`
continue
- rule = _compact_dict(dict(
- (key, _time_to_seconds_past_midnight(rule.attrib.get(key)))
+ rule = _compact_dict({
+ key: _time_to_seconds_past_midnight(rule.attrib.get(key))
for key in ("after", "at", "before", "from", "to")
- ))
+ })
for locale in locales:
dest_list = day_periods.setdefault(locale, {}).setdefault(ruleset_type, {}).setdefault(type, [])
dest_list.append(rule)
diff --git a/scripts/make-release.py b/scripts/make-release.py
index f780f0d..d8963f2 100755
--- a/scripts/make-release.py
+++ b/scripts/make-release.py
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
"""
make-release
~~~~~~~~~~~~
diff --git a/setup.py b/setup.py
index e081219..5cde802 100755
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
import subprocess
import sys
diff --git a/tests/messages/test_catalog.py b/tests/messages/test_catalog.py
index 830cabf..f320236 100644
--- a/tests/messages/test_catalog.py
+++ b/tests/messages/test_catalog.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/tests/messages/test_checkers.py b/tests/messages/test_checkers.py
index b709d4b..2ae5946 100644
--- a/tests/messages/test_checkers.py
+++ b/tests/messages/test_checkers.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/tests/messages/test_extract.py b/tests/messages/test_extract.py
index fb9599d..3ed71de 100644
--- a/tests/messages/test_extract.py
+++ b/tests/messages/test_extract.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/tests/messages/test_frontend.py b/tests/messages/test_frontend.py
index 4ed30ec..bacb0e2 100644
--- a/tests/messages/test_frontend.py
+++ b/tests/messages/test_frontend.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
@@ -1194,7 +1193,7 @@ compiling catalog %s to %s
'-o', po_file,
'-i', tmpl_file
])
- with open(po_file, "r") as infp:
+ with open(po_file) as infp:
catalog = read_po(infp)
assert len(catalog) == 3
@@ -1210,7 +1209,7 @@ compiling catalog %s to %s
'-o', po_file,
'-i', tmpl_file])
- with open(po_file, "r") as infp:
+ with open(po_file) as infp:
catalog = read_po(infp)
assert len(catalog) == 4 # Catalog was updated
@@ -1288,7 +1287,7 @@ compiling catalog %s to %s
'-o', po_file,
'-i', tmpl_file])
- with open(po_file, "r") as infp:
+ with open(po_file) as infp:
catalog = read_po(infp)
assert len(catalog) == 3
@@ -1305,7 +1304,7 @@ compiling catalog %s to %s
'-o', po_file,
'-i', tmpl_file])
- with open(po_file, "r") as infp:
+ with open(po_file) as infp:
catalog = read_po(infp)
assert len(catalog) == 4 # Catalog was updated
diff --git a/tests/messages/test_js_extract.py b/tests/messages/test_js_extract.py
index 73b16a9..72c5211 100644
--- a/tests/messages/test_js_extract.py
+++ b/tests/messages/test_js_extract.py
@@ -1,4 +1,3 @@
-# -- encoding: UTF-8 --
from io import BytesIO
import pytest
from babel.messages import extract
diff --git a/tests/messages/test_jslexer.py b/tests/messages/test_jslexer.py
index b70621f..35204ee 100644
--- a/tests/messages/test_jslexer.py
+++ b/tests/messages/test_jslexer.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
from babel.messages import jslexer
diff --git a/tests/messages/test_mofile.py b/tests/messages/test_mofile.py
index 93f3689..bf6ef5e 100644
--- a/tests/messages/test_mofile.py
+++ b/tests/messages/test_mofile.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/tests/messages/test_plurals.py b/tests/messages/test_plurals.py
index 0d20541..df17fd8 100644
--- a/tests/messages/test_plurals.py
+++ b/tests/messages/test_plurals.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/tests/messages/test_pofile.py b/tests/messages/test_pofile.py
index b154c09..632efe7 100644
--- a/tests/messages/test_pofile.py
+++ b/tests/messages/test_pofile.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/tests/test_core.py b/tests/test_core.py
index 53578f8..529a424 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/tests/test_date_intervals.py b/tests/test_date_intervals.py
index 4f42170..dc3ae34 100644
--- a/tests/test_date_intervals.py
+++ b/tests/test_date_intervals.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
import datetime
from babel import dates
diff --git a/tests/test_dates.py b/tests/test_dates.py
index 9367466..6a24ed4 100644
--- a/tests/test_dates.py
+++ b/tests/test_dates.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/tests/test_day_periods.py b/tests/test_day_periods.py
index 52cbc5e..414c0f6 100644
--- a/tests/test_day_periods.py
+++ b/tests/test_day_periods.py
@@ -1,4 +1,3 @@
-# -- encoding: UTF-8 --
from datetime import time
import babel.dates as dates
diff --git a/tests/test_languages.py b/tests/test_languages.py
index 32f0d67..41fcc9e 100644
--- a/tests/test_languages.py
+++ b/tests/test_languages.py
@@ -1,4 +1,3 @@
-# -- encoding: UTF-8 --
from babel.languages import get_official_languages, get_territory_language_info
diff --git a/tests/test_lists.py b/tests/test_lists.py
index e843a63..e51f18b 100644
--- a/tests/test_lists.py
+++ b/tests/test_lists.py
@@ -1,4 +1,3 @@
-# coding=utf-8
import pytest
from babel import lists
diff --git a/tests/test_localedata.py b/tests/test_localedata.py
index e93309b..8c4e40e 100644
--- a/tests/test_localedata.py
+++ b/tests/test_localedata.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/tests/test_numbers.py b/tests/test_numbers.py
index 3fab394..bac6c61 100644
--- a/tests/test_numbers.py
+++ b/tests/test_numbers.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/tests/test_plural.py b/tests/test_plural.py
index b0230c7..4210033 100644
--- a/tests/test_plural.py
+++ b/tests/test_plural.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/tests/test_smoke.py b/tests/test_smoke.py
index 052c1cb..aed676a 100644
--- a/tests/test_smoke.py
+++ b/tests/test_smoke.py
@@ -1,4 +1,3 @@
-# -- encoding: UTF-8 --
"""
These tests do not verify any results and should not be run when
looking at improving test coverage. They just verify that basic
diff --git a/tests/test_support.py b/tests/test_support.py
index 6e4c44b..a4fa326 100644
--- a/tests/test_support.py
+++ b/tests/test_support.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.
diff --git a/tests/test_util.py b/tests/test_util.py
index 43076ad..e6a19d5 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
# All rights reserved.