Skip to content

Commit 7855a4a

Browse files
Fix wiki.py (#136)
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
1 parent 609f936 commit 7855a4a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

AllUp_utils/wiki.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,16 @@ def pull(title: str, split_line=False):
3939
return ""
4040

4141

42+
def extract_after_last_colon(s):
43+
last_colon_index = s.rfind(":")
44+
return s[last_colon_index + 1 :] if last_colon_index != -1 else s
45+
46+
4247
def push(title: str, content_id: str, content: str):
43-
open(f"{title}.wikitext", "w").write(content)
48+
with open(
49+
f"{extract_after_last_colon(title)}.wikitext", "w", encoding="utf-8"
50+
) as f:
51+
f.write(content)
4452
if MAIN_REPO_BRANCH or TEST_DISPATCH:
4553
wiki.edit(title, content, "Edit via AllUp-Satwiki")
4654
if TEST_PR:

0 commit comments

Comments
 (0)