]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Fix up some Python2-isms using pyupgrade
authorAarni Koskela <akx@iki.fi>
Tue, 10 May 2022 07:51:08 +0000 (10:51 +0300)
committerAarni Koskela <akx@iki.fi>
Tue, 10 May 2022 10:42:16 +0000 (12:42 +0200)
49 files changed:
babel/__init__.py
babel/core.py
babel/dates.py
babel/languages.py
babel/lists.py
babel/localedata.py
babel/localtime/__init__.py
babel/localtime/_unix.py
babel/messages/__init__.py
babel/messages/catalog.py
babel/messages/checkers.py
babel/messages/extract.py
babel/messages/frontend.py
babel/messages/jslexer.py
babel/messages/mofile.py
babel/messages/plurals.py
babel/messages/pofile.py
babel/numbers.py
babel/plural.py
babel/support.py
babel/units.py
babel/util.py
docs/conf.py
scripts/dump_data.py
scripts/dump_global.py
scripts/import_cldr.py
scripts/make-release.py
setup.py
tests/messages/test_catalog.py
tests/messages/test_checkers.py
tests/messages/test_extract.py
tests/messages/test_frontend.py
tests/messages/test_js_extract.py
tests/messages/test_jslexer.py
tests/messages/test_mofile.py
tests/messages/test_plurals.py
tests/messages/test_pofile.py
tests/test_core.py
tests/test_date_intervals.py
tests/test_dates.py
tests/test_day_periods.py
tests/test_languages.py
tests/test_lists.py
tests/test_localedata.py
tests/test_numbers.py
tests/test_plural.py
tests/test_smoke.py
tests/test_support.py
tests/test_util.py

index 90a15cf7bf51920de27af5cbb2c4ddb1b3850d44..1e0830a60486046bf16060f0eed0b3cb6c5b60fa 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 """
     babel
     ~~~~~
index 67387ac1962b4e92ebf27bb3098b5adb41670090..9393c239434cbad84313cd6ac0b934fd0cf8afdf 100644 (file)
@@ -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')
index 74fc6db71cd114fb3d562da17709c6ad3c1c97bb..6e049e906835285aa61fb849d32f98befdee98b2 100644 (file)
@@ -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))
index 09743670508f60e517b4106b0ca67dbb6a549125..cac59c162df90af1786f6966df8c0e690879129b 100644 (file)
@@ -1,4 +1,3 @@
-# -- encoding: UTF-8 --
 from babel.core import get_global
 
 
index 431acd806801ff2beec5bff695e71f5cd57b2c71..11cc7d72574144f5667407a6cae66071edd68f91 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 """
     babel.lists
     ~~~~~~~~~~~
index 9461e8451401642de7a2440e1a16363d624716d9..14e6bcdf4bff1be4e148468834ae39b7434890f4 100644 (file)
@@ -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,
index 537ceb5206023334536152362fb098144e59d2f1..7e626a0f1ffa717d44aebb2bb2ee2ea4c0c4eaab 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 """
     babel.localtime
     ~~~~~~~~~~~~~~~
index c2194694cdc03575d404c093f822b0bec61eaf00..28b25339421119c6b3b54550ab539b1378f5af42 100644 (file)
@@ -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:
index 58466c678e0837a11861256a435e3e2a8e379e0c..ad4fd346d52f595e2ae14ba971c2161fac9e3c38 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 """
     babel.messages
     ~~~~~~~~~~~~~~
index 228b10b710a0ec651efae87213d9cb870d5b4927..564b2c7c85e3e265d3c9c22a8399691427484c74 100644 (file)
@@ -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):
index b79bd825729308292cd35feff273030d33d32bd8..4292c02d3cecf366949e70010efcde652668ef9e 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 """
     babel.messages.checkers
     ~~~~~~~~~~~~~~~~~~~~~~~
index c23a924b3c0ac0285d1143d2f2f1e57a4b9f379d..c95f1cbc9aec256adabd99c89c5f239efd8a50e8 100644 (file)
@@ -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,
index 73e4212850095daa98178df90219ad15c156df32..6e09d1095fa4e210fa022f24acf5857551809f9c 100644 (file)
@@ -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))
 
index ef30c993e7bce63405d07e591d71570469438319..c1c25575cd3136998a31743513eee93a4cb49939 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 """
     babel.messages.jslexer
     ~~~~~~~~~~~~~~~~~~~~~~
index 901f98d1bb79a1f44398ff6ed84ecae57fade9a2..82845740810b8d3309ad0e134e3c95ab7a4f02b7 100644 (file)
@@ -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:
index 52711a2953d2a72b5b25ad5cf08d6b556bf811b9..8722566dc751f5359de3b5f953cbe45c8d821ed1 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 """
     babel.messages.plurals
     ~~~~~~~~~~~~~~~~~~~~~~
index bd29e731aa9d14dbf3ee38c5e3c73c23e7b34601..b94274df2b3803bcbc3b14cecaa737b581236f9b 100644 (file)
@@ -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)):
index 904ebbeef30976d4b355df938bf9ff3b72ae85a0..b8971bcbc6cd71c1edae39712a5c05faf25e0645 100644 (file)
@@ -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):
index f06e90e4555a6b0df6a0cb92fc34a1d9c67b244a..d3dc22d3265efc69b0ff2dc230648c830af02999 100644 (file)
@@ -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.
     """
index a22bffcdc680805832c0c139d052a37274685e53..dbd914e4a95e6de1d59a7d98bfb5de3f57364659 100644 (file)
@@ -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
index bec8676aa8ef4655b4b3b8c1e15d29cc466060df..8a9ec7d38f30d823d067bd187576ca40d3fbfc48 100644 (file)
@@ -1,5 +1,3 @@
-# -- encoding: UTF-8 --
-
 from babel.core import Locale
 from babel.numbers import format_decimal, LC_NUMERIC
 
index 2cac55336946389896584eab7dad2594587bbc9c..f628844ab7e3fea30a37de65dc3633b0c7959b21 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 """
     babel.util
     ~~~~~~~~~~
index 8f583fa83365985a1b60acf135596c9dcf820754..0acdc0a1bcb3381d8b042a43e13f2d5100a19136 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Babel documentation build configuration file, created by
 # sphinx-quickstart on Wed Jul  3 17:53:01 2013.
index 3edd971f01d99fa5971b523740a24a5fab718823..e41905000f5f2f6f05a9c118a6953bec8f0686e8 100755 (executable)
@@ -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.
index 2938b259bb0207c17abd1a551d5d1cf3dbe11c9a..6696415e6e468900c76e2993e003d1058913ce17 100755 (executable)
@@ -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.
index 6fe9b8bd5e96e44539317f07c8d2c7a280c78552..dbeb1b630d3b447473243db9b42c74c19a7f0692 100755 (executable)
@@ -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)
index f780f0d970d3673c8b200a371ce79c8cd3eee8ef..d8963f2cb001a32c7d07d063546f8fbc8db12e92 100755 (executable)
@@ -1,5 +1,4 @@
 #!/usr/bin/env python
-# -*- coding: utf-8 -*-
 """
     make-release
     ~~~~~~~~~~~~
index e081219e6a75aa647d3b22e6d006998a5fe04bf2..5cde8022dd4425e0209ca15dbecec00df24ef83c 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
 import subprocess
 import sys
 
index 830cabf1ba6cb25e702af3daaeb5d0e63268e1a2..f3202362035b1d1f736b76c831d0df29c3d87601 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.
index b709d4b7e17aa8cc0f085fdf6737f189c9f8c945..2ae5946790a6b3b4c7697afa871dad407be010d5 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.
index fb9599db6cf93e71d5637309732ab90259f59256..3ed71de44fc962febd90b07d3f1224d825446ba2 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.
index 4ed30ec5a858ec2e9f9d638f30c17aec223541b7..bacb0e2d40319fe1180e3d3c2be9df4c89df8d8a 100644 (file)
@@ -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
 
index 73b16a934656e8bdafa751628db4c13c37d96263..72c521144ce0b1ae0786b9b7958f2955877902a7 100644 (file)
@@ -1,4 +1,3 @@
-# -- encoding: UTF-8 --
 from io import BytesIO
 import pytest
 from babel.messages import extract
index b70621fc61538746bde8cc315caaa4519c742423..35204eee064d0ef5c16bab909329165da63bf209 100644 (file)
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
 from babel.messages import jslexer
 
 
index 93f3689a3f8dd5f2537e8df85b15f0ff063e7a9a..bf6ef5eb09425a2e44b79b9b7010e7d4c0a25a60 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.
index 0d205411d18a60daf48f1ce005752fe1c75bba7f..df17fd86697d8b5e5c8b521de54eea0dc2fa30cb 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.
index b154c0909b601967281e6a9bbf359558a75fdaa1..632efe7b63280e9896872a9b0455f7975aa290a5 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.
index 53578f81f6efb4a7b7a6d1fa47dda7500d7e7f93..529a424a00472a6753af9d0998ab6f5f6647fea4 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.
index 4f421705430d158cdcf595adb21a3756eba35548..dc3ae346f10b0617b8a0644f4f03db8479fc859d 100644 (file)
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
 import datetime
 
 from babel import dates
index 936746698a79b4e2237cea51f38c7e669eb75440..6a24ed40ccf4806e1583df2ac53bdb41ec029deb 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.
index 52cbc5e4f3c918c3ea1e82d7d99b11f72f2a6eeb..414c0f6e5f15fefbb5ae677f0dea5b06b937047c 100644 (file)
@@ -1,4 +1,3 @@
-# -- encoding: UTF-8 --
 from datetime import time
 
 import babel.dates as dates
index 32f0d67d56f043fb4d8f7e9181278b070a066801..41fcc9e83a64ca39968e8de4b671fc9a5bc0973a 100644 (file)
@@ -1,4 +1,3 @@
-# -- encoding: UTF-8 --
 from babel.languages import get_official_languages, get_territory_language_info
 
 
index e843a6358490eb0108a9028fc3c185d3f143aa70..e51f18b236abf20a4469eb52048a4e3f4b0e64eb 100644 (file)
@@ -1,4 +1,3 @@
-# coding=utf-8
 import pytest
 
 from babel import lists
index e93309bd419efc76b1ccadf4d47c804a949af372..8c4e40ec8f6ac665e9280350e6a7bea9398fa158 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.
index 3fab394df7068a51ef4dd05f8e26afc2f3c90a88..bac6c61c9759c1f3816e8bef76020edaa0e629f7 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.
index b0230c79a2e4836d7d6977311c673b70e0eb1546..42100332410358ea13f1464cbd69369b024194dd 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.
index 052c1cb4c2bc4c3e0820855b1fe324cd2c8a9491..aed676a16191557053ad9a8880de67e3d5e969c0 100644 (file)
@@ -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
index 6e4c44b19b535ee7805bb5ac45b3dca60e7f52a3..a4fa3267a21e11fbf37bc7993d768d9f7886bf9e 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.
index 43076ad93bdbc3fc3f9eee35030090366b195049..e6a19d51a4d99fab9b0b7ef67722cbd2a5b6e112 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # Copyright (C) 2007-2011 Edgewall Software, 2013-2022 the Babel team
 # All rights reserved.