]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Replace OrderedDict with just dict (#1149)
authorTomas R. <tomas.roun8@gmail.com>
Sun, 10 Nov 2024 20:39:04 +0000 (21:39 +0100)
committerGitHub <noreply@github.com>
Sun, 10 Nov 2024 20:39:04 +0000 (22:39 +0200)
babel/messages/catalog.py
babel/messages/frontend.py
babel/util.py

index ecf6f91d4d7f08d0f29e8dd4f89cd19b62ad89fa..cff22f9b5b9165ebf5bf733727a82da523f7e705 100644 (file)
@@ -11,7 +11,6 @@ from __future__ import annotations
 
 import datetime
 import re
-from collections import OrderedDict
 from collections.abc import Iterable, Iterator
 from copy import copy
 from difflib import SequenceMatcher
@@ -317,7 +316,7 @@ class Catalog:
         self.domain = domain
         self.locale = locale
         self._header_comment = header_comment
-        self._messages: OrderedDict[str | tuple[str, str], Message] = OrderedDict()
+        self._messages: dict[str | tuple[str, str], Message] = {}
 
         self.project = project or 'PROJECT'
         self.version = version or 'VERSION'
@@ -344,7 +343,7 @@ class Catalog:
         self.fuzzy = fuzzy
 
         # Dictionary of obsolete messages
-        self.obsolete: OrderedDict[str | tuple[str, str], Message] = OrderedDict()
+        self.obsolete: dict[str | tuple[str, str], Message] = {}
         self._num_plurals = None
         self._plural_expr = None
 
@@ -829,7 +828,7 @@ class Catalog:
         """
         messages = self._messages
         remaining = messages.copy()
-        self._messages = OrderedDict()
+        self._messages = {}
 
         # Prepare for fuzzy matching
         fuzzy_candidates = {}
index 7a9ce385f4368a1b56c9ffb4d08a473e7f786daa..9017ec5a8b2646cf2c71d4ecef3c184bf839b1c5 100644 (file)
@@ -20,7 +20,6 @@ import shutil
 import sys
 import tempfile
 import warnings
-from collections import OrderedDict
 from configparser import RawConfigParser
 from io import StringIO
 from typing import BinaryIO, Iterable, Literal
@@ -1019,7 +1018,6 @@ def parse_mapping_cfg(fileobj, filename=None):
     options_map = {}
 
     parser = RawConfigParser()
-    parser._sections = OrderedDict(parser._sections)  # We need ordered sections
     parser.read_file(fileobj, filename)
 
     for section in parser.sections():
index db82d7361457bd4669368d344f773ac55f709026..180afa093518eb6b209780b81fe4e3f9d7d5926d 100644 (file)
@@ -10,7 +10,6 @@
 from __future__ import annotations
 
 import codecs
-import collections
 import datetime
 import os
 import re
@@ -231,7 +230,7 @@ def wraptext(text: str, width: int = 70, initial_indent: str = '', subsequent_in
 
 
 # TODO (Babel 3.x): Remove this re-export
-odict = collections.OrderedDict
+odict = dict
 
 
 class FixedOffsetTimezone(datetime.tzinfo):