From 03b2dc3d966db77010e123d0646faec112a5e3e4 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 13 Jan 2025 13:10:48 +0200 Subject: [PATCH] Ensure imported names are in __all__; sort __all__s --- babel/__init__.py | 1 + babel/core.py | 11 +++++++++-- babel/messages/catalog.py | 8 +++++++- pyproject.toml | 21 +++++++++++---------- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/babel/__init__.py b/babel/__init__.py index 9a1ef4ba..ff9c533a 100644 --- a/babel/__init__.py +++ b/babel/__init__.py @@ -30,6 +30,7 @@ __version__ = '2.16.0' __all__ = [ 'Locale', 'UnknownLocaleError', + '__version__', 'default_locale', 'get_locale_identifier', 'negotiate_locale', diff --git a/babel/core.py b/babel/core.py index a3ebb40e..7df32c98 100644 --- a/babel/core.py +++ b/babel/core.py @@ -18,8 +18,15 @@ from typing import TYPE_CHECKING, Any from babel import localedata from babel.plural import PluralRule -__all__ = ['UnknownLocaleError', 'Locale', 'default_locale', 'negotiate_locale', - 'parse_locale'] +__all__ = [ + 'Locale', + 'UnknownLocaleError', + 'default_locale', + 'get_global', + 'get_locale_identifier', + 'negotiate_locale', + 'parse_locale', +] if TYPE_CHECKING: from typing_extensions import Literal, TypeAlias diff --git a/babel/messages/catalog.py b/babel/messages/catalog.py index 272ec654..67d4dbe2 100644 --- a/babel/messages/catalog.py +++ b/babel/messages/catalog.py @@ -29,7 +29,13 @@ if TYPE_CHECKING: _MessageID: TypeAlias = str | tuple[str, ...] | list[str] -__all__ = ['Message', 'Catalog', 'TranslationError'] +__all__ = [ + 'DEFAULT_HEADER', + 'PYTHON_FORMAT', + 'Catalog', + 'Message', + 'TranslationError', +] def get_close_matches(word, possibilities, n=3, cutoff=0.6): """A modified version of ``difflib.get_close_matches``. diff --git a/pyproject.toml b/pyproject.toml index ba0e4771..2e23f7a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,20 +8,21 @@ extend-exclude = [ select = [ "B", "C", - "COM", + "COM", # Trailing commas "E", "F", - "I", - "SIM300", - "UP", + "I", # import sorting + "SIM300", # Yoda conditions + "UP", # upgrades + "RUF022", # unsorted __all__ ] ignore = [ - "C901", # Complexity - "E501", # Line length - "E731", # Do not assign a lambda expression (we use them on purpose) - "E741", # Ambiguous variable name - "UP012", # "utf-8" is on purpose - "UP031", # A bunch of places where % formatting is better + "C901", # Complexity + "E501", # Line length + "E731", # Do not assign a lambda expression (we use them on purpose) + "E741", # Ambiguous variable name + "UP012", # "utf-8" is on purpose + "UP031", # A bunch of places where % formatting is better ] [tool.ruff.lint.per-file-ignores] -- 2.47.2