Skip to content

Commit

Permalink
Replace OrderedDict with just dict (#1149)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasr8 authored Nov 10, 2024
1 parent 313277a commit 0005c85
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
7 changes: 3 additions & 4 deletions babel/messages/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import datetime
import re
from collections import OrderedDict
from collections.abc import Iterable, Iterator
from copy import copy
from difflib import SequenceMatcher
Expand Down Expand Up @@ -317,7 +316,7 @@ def __init__(
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'
Expand All @@ -344,7 +343,7 @@ def __init__(
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

Expand Down Expand Up @@ -829,7 +828,7 @@ def update(
"""
messages = self._messages
remaining = messages.copy()
self._messages = OrderedDict()
self._messages = {}

# Prepare for fuzzy matching
fuzzy_candidates = {}
Expand Down
2 changes: 0 additions & 2 deletions babel/messages/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import sys
import tempfile
import warnings
from collections import OrderedDict
from configparser import RawConfigParser
from io import StringIO
from typing import BinaryIO, Iterable, Literal
Expand Down Expand Up @@ -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():
Expand Down
3 changes: 1 addition & 2 deletions babel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from __future__ import annotations

import codecs
import collections
import datetime
import os
import re
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 0005c85

Please sign in to comment.