Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace OrderedDict with just dict #1149

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading