Skip to content

Commit

Permalink
Merge pull request #641 from taskcluster/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
chore: pre-commit autoupdate
  • Loading branch information
jcristau authored Feb 10, 2025
2 parents e5a2d89 + c6cf4b2 commit d9c772f
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
exclude: template
- id: check-added-large-files
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.9.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -26,7 +26,7 @@ repos:
- id: yamllint
exclude: template
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
entry: codespell -I .codespell-ignore-words.txt
Expand Down
12 changes: 6 additions & 6 deletions src/taskgraph/actions/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,18 @@ def register_callback_action(
def register_callback(cb):
assert isinstance(name, str), "name must be a string"
assert isinstance(order, int), "order must be an integer"
assert callable(schema) or is_json(
schema
), "schema must be a JSON compatible object"
assert callable(schema) or is_json(schema), (
"schema must be a JSON compatible object"
)
assert isinstance(cb, FunctionType), "callback must be a function"
# Allow for json-e > 25 chars in the symbol.
if "$" not in symbol:
assert 1 <= len(symbol) <= 25, "symbol must be between 1 and 25 characters"
assert isinstance(symbol, str), "symbol must be a string"

assert not mem[
"registered"
], "register_callback_action must be used as decorator"
assert not mem["registered"], (
"register_callback_action must be used as decorator"
)
assert cb_name not in callbacks, f"callback name {cb_name} is not unique"

def action_builder(parameters, graph_config, decision_task_id):
Expand Down
3 changes: 1 addition & 2 deletions src/taskgraph/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ def register(self):
def vcs_root(self):
if path.split(self.root_dir)[-1:] != ["taskcluster"]:
raise Exception(
"Not guessing path to vcs root. "
"Graph config in non-standard location."
"Not guessing path to vcs root. Graph config in non-standard location."
)
return os.path.dirname(self.root_dir)

Expand Down
4 changes: 2 additions & 2 deletions src/taskgraph/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def logfile(spec):
"--tasks-regex",
"--tasks",
default=None,
help="only return tasks with labels matching this regular " "expression.",
help="only return tasks with labels matching this regular expression.",
)
@argument(
"--exclude-key",
Expand Down Expand Up @@ -757,7 +757,7 @@ def action_callback(options):
"--parameters",
"-p",
default="",
help="parameters file (.yml or .json; see " "`taskcluster/docs/parameters.rst`)`",
help="parameters file (.yml or .json; see `taskcluster/docs/parameters.rst`)`",
)
@argument("--task-id", default=None, help="TaskId to which the action applies")
@argument(
Expand Down
3 changes: 1 addition & 2 deletions src/taskgraph/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,7 @@ def file_url(self, path, pretty=False):
)
else:
raise ParameterMismatch(
"Don't know how to determine file URL for non-github"
f"repo: {repo}"
f"Don't know how to determine file URL for non-githubrepo: {repo}"
)
else:
raise RuntimeError(
Expand Down
2 changes: 1 addition & 1 deletion src/taskgraph/transforms/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def create_fetch_url_task(config, name, fetch):
]

if fetch.get("strip-components"):
args.extend(["--strip-components", f'{fetch["strip-components"]}'])
args.extend(["--strip-components", f"{fetch['strip-components']}"])

if fetch.get("add-prefix"):
args.extend(["--add-prefix", fetch["add-prefix"]])
Expand Down
8 changes: 4 additions & 4 deletions src/taskgraph/transforms/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def _run_task_suffix():


UNKNOWN_GROUP_NAME = (
"Treeherder group {} (from {}) has no name; " "add it to taskcluster/config.yml"
"Treeherder group {} (from {}) has no name; add it to taskcluster/config.yml"
)

V2_ROUTE_TEMPLATES = [
Expand Down Expand Up @@ -372,9 +372,9 @@ def build_docker_worker_payload(config, task, task_def):
if "in-tree" in image:
name = image["in-tree"]
docker_image_task = "docker-image-" + image["in-tree"]
assert "docker-image" not in task.get(
"dependencies", ()
), "docker-image key in dependencies object is reserved"
assert "docker-image" not in task.get("dependencies", ()), (
"docker-image key in dependencies object is reserved"
)
task.setdefault("dependencies", {})["docker-image"] = docker_image_task

image = {
Expand Down
6 changes: 3 additions & 3 deletions src/taskgraph/util/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

def group_by(name, schema=None):
def wrapper(func):
assert (
name not in GROUP_BY_MAP
), f"duplicate group_by function name {name} ({func} and {GROUP_BY_MAP[name]})"
assert name not in GROUP_BY_MAP, (
f"duplicate group_by function name {name} ({func} and {GROUP_BY_MAP[name]})"
)
GROUP_BY_MAP[name] = func
func.schema = schema
return func
Expand Down
3 changes: 1 addition & 2 deletions src/taskgraph/util/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ def parse_volumes(image):
v = line.split(None, 1)[1]
if v.startswith(b"["):
raise ValueError(
"cannot parse array syntax for VOLUME; "
"convert to multiple entries"
"cannot parse array syntax for VOLUME; convert to multiple entries"
)

volumes |= {volume.decode("utf-8") for volume in v.split()}
Expand Down
6 changes: 3 additions & 3 deletions src/taskgraph/util/set_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

def set_name(name, schema=None):
def wrapper(func):
assert (
name not in SET_NAME_MAP
), f"duplicate set_name function name {name} ({func} and {SET_NAME_MAP[name]})"
assert name not in SET_NAME_MAP, (
f"duplicate set_name function name {name} ({func} and {SET_NAME_MAP[name]})"
)
SET_NAME_MAP[name] = func
func.schema = schema
return func
Expand Down
6 changes: 3 additions & 3 deletions test/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ def test_load_tasks_for_kind(monkeypatch):
)
def test_default_loader(config, expected_transforms):
loader = Kind("", "", config, {})._get_loader()
assert (
loader is default_loader
), "Default Kind loader should be taskgraph.loader.default.loader"
assert loader is default_loader, (
"Default Kind loader should be taskgraph.loader.default.loader"
)
loader("", "", config, {}, [])

assert config["transforms"] == expected_transforms
Expand Down
8 changes: 4 additions & 4 deletions test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ def test_init_taskgraph(mocker, tmp_path, project_root, repo_with_upstream):
config.write_text(
dedent(
f"""
cookiecutters_dir: {d / 'cookiecutters'}
replay_dir: {d / 'replay'}
cookiecutters_dir: {d / "cookiecutters"}
replay_dir: {d / "replay"}
"""
)
)
Expand Down Expand Up @@ -302,8 +302,8 @@ def test_init_taskgraph_unsupported(mocker, tmp_path, repo_with_upstream):
config.write_text(
dedent(
f"""
cookiecutters_dir: {d / 'cookiecutters'}
replay_dir: {d / 'replay'}
cookiecutters_dir: {d / "cookiecutters"}
replay_dir: {d / "replay"}
"""
)
)
Expand Down
4 changes: 3 additions & 1 deletion test/test_scripts_fetch_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,6 @@ def test_should_repack_archive(
orig, dest, strip_components, add_prefix
)
== expected
), f"Failed for orig: {orig}, dest: {dest}, strip_components: {strip_components}, add_prefix: {add_prefix}, expected {expected} but received {not expected}"
), (
f"Failed for orig: {orig}, dest: {dest}, strip_components: {strip_components}, add_prefix: {add_prefix}, expected {expected} but received {not expected}"
)

0 comments on commit d9c772f

Please sign in to comment.