Skip to content

Commit e71f993

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5f2a114 commit e71f993

2 files changed

Lines changed: 9 additions & 26 deletions

File tree

src/decoupler/_skills/install.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
import argparse
2525
import shutil
2626
import sys
27-
2827
from pathlib import Path
2928

30-
3129
SKILL_NAME = "decoupler"
3230

3331

@@ -40,7 +38,6 @@ def _bundled_skill_dir() -> Path:
4038
The ``data/`` directory containing the bundled ``SKILL.md`` and
4139
``references/``.
4240
"""
43-
4441
return Path(__file__).resolve().parent / "data"
4542

4643

@@ -52,7 +49,6 @@ def _default_dest() -> Path:
5249
dest : pathlib.Path
5350
``~/.claude/skills/decoupler``.
5451
"""
55-
5652
return Path.home() / ".claude" / "skills" / SKILL_NAME
5753

5854

@@ -78,28 +74,22 @@ def install_skill(dest: Path | None = None, force: bool = False) -> Path:
7874
dest : pathlib.Path
7975
The directory the skill was installed into.
8076
"""
81-
8277
src = _bundled_skill_dir()
8378
if not (src / "SKILL.md").is_file():
8479
raise FileNotFoundError(
85-
"Bundled skill not found at {}. The package may be installed "
86-
"without its skill data.".format(src)
80+
f"Bundled skill not found at {src}. The package may be installed without its skill data."
8781
)
8882

8983
if dest is None:
9084
dest = _default_dest()
9185

9286
if dest.exists():
9387
if not force:
94-
raise FileExistsError(
95-
"{} already exists. Re-run with --force to overwrite.".format(dest)
96-
)
88+
raise FileExistsError(f"{dest} already exists. Re-run with --force to overwrite.")
9789
shutil.rmtree(dest)
9890

9991
dest.parent.mkdir(parents=True, exist_ok=True)
100-
shutil.copytree(
101-
src, dest, ignore=shutil.ignore_patterns(".ipynb_checkpoints", "__pycache__")
102-
)
92+
shutil.copytree(src, dest, ignore=shutil.ignore_patterns(".ipynb_checkpoints", "__pycache__"))
10393
return dest
10494

10595

@@ -116,7 +106,6 @@ def main(argv: list[str] | None = None) -> int:
116106
code : int
117107
Process exit code; 0 on success and 1 on a handled error.
118108
"""
119-
120109
parser = argparse.ArgumentParser(
121110
prog="decoupler-install-skills",
122111
description="Install the decoupler Agent Skill for Claude Code.",
@@ -127,9 +116,7 @@ def main(argv: list[str] | None = None) -> int:
127116
default=None,
128117
help="Destination directory (default: ~/.claude/skills/decoupler).",
129118
)
130-
parser.add_argument(
131-
"--force", action="store_true", help="Overwrite an existing installation."
132-
)
119+
parser.add_argument("--force", action="store_true", help="Overwrite an existing installation.")
133120
parser.add_argument(
134121
"--print-path",
135122
action="store_true",
@@ -144,10 +131,10 @@ def main(argv: list[str] | None = None) -> int:
144131
try:
145132
dest = install_skill(dest=args.dest, force=args.force)
146133
except (FileExistsError, FileNotFoundError) as e:
147-
print("error: {}".format(e), file=sys.stderr)
134+
print(f"error: {e}", file=sys.stderr)
148135
return 1
149136

150-
print("Installed decoupler skill to {}".format(dest))
137+
print(f"Installed decoupler skill to {dest}")
151138
print("It will be available to Claude Code in your next session.")
152139
return 0
153140

tests/test_install_skills.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import re
22
import subprocess
33
import sys
4-
54
from pathlib import Path
65

76
import pytest
@@ -13,7 +12,6 @@
1312
install_skill,
1413
)
1514

16-
1715
###
1816
# Helpers
1917

@@ -67,9 +65,9 @@ def test_internal_links_all_resolve():
6765
for f in [data / "SKILL.md", *refs.glob("*.md")]:
6866
for target in _link_targets(f.read_text()):
6967
if target not in existing:
70-
broken.append("{} -> {}".format(f.name, target))
68+
broken.append(f"{f.name} -> {target}")
7169

72-
assert broken == [], "broken internal links: {}".format(broken)
70+
assert broken == [], f"broken internal links: {broken}"
7371

7472

7573
###
@@ -154,9 +152,7 @@ def test_console_script_print_path():
154152
if not exe.exists():
155153
pytest.skip("decoupler-install-skills entry point is not installed")
156154

157-
result = subprocess.run(
158-
[str(exe), "--print-path"], capture_output=True, text=True
159-
)
155+
result = subprocess.run([str(exe), "--print-path"], capture_output=True, text=True)
160156

161157
assert result.returncode == 0
162158
assert result.stdout.strip().endswith("data")

0 commit comments

Comments
 (0)