Skip to content

Commit 4483115

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

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tools/rename_template.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@
88

99
PACKAGE_ROOT = Path(__file__).absolute().parent.parent
1010

11+
1112
@functools.lru_cache()
1213
def load_gitignore(repo):
13-
gitignore = repo / '.gitignore'
14+
gitignore = repo / ".gitignore"
1415
ignore = [fnmatch.translate(".git/"), fnmatch.translate(Path(__file__).name)]
1516
if gitignore.exists():
1617
ignore.extend(
1718
fnmatch.translate(line.strip())
1819
for line in gitignore.read_text().splitlines()
19-
if line.strip() and not line[0] == '#'
20+
if line.strip() and not line[0] == "#"
2021
)
21-
return re.compile('|'.join(ignore))
22+
return re.compile("|".join(ignore))
23+
2224

2325
cmd, new_name, *_ = sys.argv
2426

@@ -31,7 +33,7 @@ def load_gitignore(repo):
3133

3234
root = Path(root)
3335
for src in list(dirs):
34-
if 'TODO' in src:
36+
if "TODO" in src:
3537
dst = src.replace("TODO", new_name)
3638
print(f"Renaming: {root / src} -> {root / dst}")
3739
os.rename(root / src, root / dst)
@@ -40,6 +42,6 @@ def load_gitignore(repo):
4042
for fname in files:
4143
f = root / fname
4244
text = Path.read_text(root / fname)
43-
if 'TODO' in text:
45+
if "TODO" in text:
4446
print(f"Rewriting: {root / fname}")
4547
Path.write_text(root / fname, text.replace("TODO", new_name))

0 commit comments

Comments
 (0)