summaryrefslogtreecommitdiff
path: root/babel/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'babel/util.py')
-rw-r--r--babel/util.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/babel/util.py b/babel/util.py
index d25ec53..a5403e6 100644
--- a/babel/util.py
+++ b/babel/util.py
@@ -11,19 +11,20 @@ from __future__ import annotations
import codecs
import collections
+import datetime
import os
import re
import textwrap
-from babel import localtime, dates
-
from collections.abc import Generator, Iterable
-import datetime
from typing import IO, Any, TypeVar
+from babel import dates, localtime
+
missing = object()
_T = TypeVar("_T")
+
def distinct(iterable: Iterable[_T]) -> Generator[_T, None, None]:
"""Yield all items in an iterable collection that are distinct.
@@ -43,6 +44,7 @@ def distinct(iterable: Iterable[_T]) -> Generator[_T, None, None]:
yield item
seen.add(item)
+
# Regexp to match python magic encoding line
PYTHON_MAGIC_COMMENT_re = re.compile(
br'[ \t\f]* \# .* coding[=:][ \t]*([-\w.]+)', re.VERBOSE)