Skip to content

Commit 03b2dc3

Browse files
committed
Ensure imported names are in __all__; sort __all__s
1 parent 4793079 commit 03b2dc3

4 files changed

Lines changed: 28 additions & 13 deletions

File tree

babel/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
__all__ = [
3131
'Locale',
3232
'UnknownLocaleError',
33+
'__version__',
3334
'default_locale',
3435
'get_locale_identifier',
3536
'negotiate_locale',

babel/core.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,15 @@
1818
from babel import localedata
1919
from babel.plural import PluralRule
2020

21-
__all__ = ['UnknownLocaleError', 'Locale', 'default_locale', 'negotiate_locale',
22-
'parse_locale']
21+
__all__ = [
22+
'Locale',
23+
'UnknownLocaleError',
24+
'default_locale',
25+
'get_global',
26+
'get_locale_identifier',
27+
'negotiate_locale',
28+
'parse_locale',
29+
]
2330

2431
if TYPE_CHECKING:
2532
from typing_extensions import Literal, TypeAlias

babel/messages/catalog.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@
2929

3030
_MessageID: TypeAlias = str | tuple[str, ...] | list[str]
3131

32-
__all__ = ['Message', 'Catalog', 'TranslationError']
32+
__all__ = [
33+
'DEFAULT_HEADER',
34+
'PYTHON_FORMAT',
35+
'Catalog',
36+
'Message',
37+
'TranslationError',
38+
]
3339

3440
def get_close_matches(word, possibilities, n=3, cutoff=0.6):
3541
"""A modified version of ``difflib.get_close_matches``.

pyproject.toml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@ extend-exclude = [
88
select = [
99
"B",
1010
"C",
11-
"COM",
11+
"COM", # Trailing commas
1212
"E",
1313
"F",
14-
"I",
15-
"SIM300",
16-
"UP",
14+
"I", # import sorting
15+
"SIM300", # Yoda conditions
16+
"UP", # upgrades
17+
"RUF022", # unsorted __all__
1718
]
1819
ignore = [
19-
"C901", # Complexity
20-
"E501", # Line length
21-
"E731", # Do not assign a lambda expression (we use them on purpose)
22-
"E741", # Ambiguous variable name
23-
"UP012", # "utf-8" is on purpose
24-
"UP031", # A bunch of places where % formatting is better
20+
"C901", # Complexity
21+
"E501", # Line length
22+
"E731", # Do not assign a lambda expression (we use them on purpose)
23+
"E741", # Ambiguous variable name
24+
"UP012", # "utf-8" is on purpose
25+
"UP031", # A bunch of places where % formatting is better
2526
]
2627

2728
[tool.ruff.lint.per-file-ignores]

0 commit comments

Comments
 (0)