Skip to content

Commit 78e2826

Browse files
Fix ruff rule INT001 for i18n services (#317)
* Fix ruff rule INT001 for i18n services * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent f93e614 commit 78e2826

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v6.0.0
44
hooks:
5-
- id: check-yaml
65
- id: check-json
76
- id: check-xml
7+
- id: check-yaml
8+
args: [--unsafe] # allow !!python/name:... tags in mkdocs.yml
89
- id: end-of-file-fixer
910
- id: trailing-whitespace
1011
- repo: https://github.com/astral-sh/ruff-pre-commit

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ select = [
150150
]
151151
extend-ignore = ["PIE790"]
152152
mccabe.max-complexity = 13
153-
per-file-ignores."scheduler/models/args.py" = ["DJ012", "INT001"]
153+
per-file-ignores."scheduler/models/args.py" = ["DJ012"]
154154
per-file-ignores."scheduler/models/ephemeral_models.py" = ["DJ008"]
155155
per-file-ignores."scheduler/models/task.py" = ["DJ001", "DJ012"]
156156

scheduler/models/args.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,8 @@ class ArgType(models.TextChoices):
3939

4040
def clean(self) -> None:
4141
if self.arg_type not in ARG_TYPE_TYPES_DICT:
42-
raise ValidationError(
43-
{
44-
"arg_type": ValidationError(
45-
_(f"Could not parse {self.arg_type}, options are: {ARG_TYPE_TYPES_DICT.keys()}"), code="invalid"
46-
)
47-
}
48-
)
42+
msg = _("Could not parse %s, options are: %s") % (self.arg_type, ARG_TYPE_TYPES_DICT.keys())
43+
raise ValidationError({"arg_type": ValidationError(msg, code="invalid")})
4944
try:
5045
if self.arg_type == "callable":
5146
utils.callable_func(self.val)
@@ -57,9 +52,8 @@ def clean(self) -> None:
5752
elif self.arg_type == "int":
5853
int(self.val)
5954
except Exception:
60-
raise ValidationError(
61-
{"arg_type": ValidationError(_(f"Could not parse {self.val} as {self.arg_type}"), code="invalid")}
62-
)
55+
msg = _("Could not parse %s as %s") % (self.val, self.arg_type)
56+
raise ValidationError({"arg_type": ValidationError(msg, code="invalid")})
6357

6458
def save(self, **kwargs: Any) -> None:
6559
super(BaseTaskArg, self).save(**kwargs)

0 commit comments

Comments
 (0)