Skip to content

Commit 5b8f200

Browse files
committed
2 parents 339d29a + d75c3af commit 5b8f200

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repos:
3131
hooks:
3232
- id: yamllint
3333
- repo: https://github.com/astral-sh/ruff-pre-commit
34-
rev: v0.15.4
34+
rev: v0.15.5
3535
hooks:
3636
- id: ruff-check
3737
args:

weblate/checks/flags.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
from weblate.trans.defines import VARIANT_KEY_LENGTH
2828

2929
if TYPE_CHECKING:
30-
from collections.abc import Generator, Iterator
30+
from collections.abc import Callable, Generator, Iterator
31+
32+
from django_stubs_ext import StrOrPromise
3133

3234

3335
def discard_flag_validation(name: str) -> None:
@@ -41,14 +43,18 @@ def discard_flag_validation(name: str) -> None:
4143
raise ValueError(msg)
4244

4345

44-
PLAIN_FLAGS = {
45-
v.enable_string: v.name
46-
for k, v in CHECKS.items()
47-
if v.default_disabled and not v.param_type
46+
PLAIN_FLAGS: dict[str, StrOrPromise] = {
47+
check.enable_string: check.name
48+
for check in CHECKS.values()
49+
if check.default_disabled and not check.param_type
50+
}
51+
TYPED_FLAGS: dict[str, StrOrPromise] = {
52+
check.enable_string: check.name for check in CHECKS.values() if check.param_type
4853
}
49-
TYPED_FLAGS = {v.enable_string: v.name for k, v in CHECKS.items() if v.param_type}
50-
TYPED_FLAGS_ARGS = {
51-
v.enable_string: v.param_type for k, v in CHECKS.items() if v.param_type
54+
TYPED_FLAGS_ARGS: dict[str, Callable[[tuple[str, ...]], Any]] = {
55+
check.enable_string: check.param_type
56+
for check in CHECKS.values()
57+
if check.param_type
5258
}
5359

5460
PLAIN_FLAGS["rst-text"] = gettext_lazy("RST text")

0 commit comments

Comments
 (0)