Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-yaml
- id: check-json
- id: check-xml
- id: check-yaml
args: [--unsafe] # allow !!python/name:... tags in mkdocs.yml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ select = [
]
extend-ignore = ["PIE790"]
mccabe.max-complexity = 13
per-file-ignores."scheduler/models/args.py" = ["DJ012", "INT001"]
per-file-ignores."scheduler/models/args.py" = ["DJ012"]
per-file-ignores."scheduler/models/ephemeral_models.py" = ["DJ008"]
per-file-ignores."scheduler/models/task.py" = ["DJ001", "DJ012"]

Expand Down
14 changes: 4 additions & 10 deletions scheduler/models/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,8 @@ class ArgType(models.TextChoices):

def clean(self) -> None:
if self.arg_type not in ARG_TYPE_TYPES_DICT:
raise ValidationError(
{
"arg_type": ValidationError(
_(f"Could not parse {self.arg_type}, options are: {ARG_TYPE_TYPES_DICT.keys()}"), code="invalid"
)
}
)
msg = _("Could not parse %s, options are: %s") % (self.arg_type, ARG_TYPE_TYPES_DICT.keys())
raise ValidationError({"arg_type": ValidationError(msg, code="invalid")})
try:
if self.arg_type == "callable":
utils.callable_func(self.val)
Expand All @@ -57,9 +52,8 @@ def clean(self) -> None:
elif self.arg_type == "int":
int(self.val)
except Exception:
raise ValidationError(
{"arg_type": ValidationError(_(f"Could not parse {self.val} as {self.arg_type}"), code="invalid")}
)
msg = _("Could not parse %s as %s") % (self.val, self.arg_type)
raise ValidationError({"arg_type": ValidationError(msg, code="invalid")})

def save(self, **kwargs: Any) -> None:
super(BaseTaskArg, self).save(**kwargs)
Expand Down
Loading