Skip to content

Commit

Permalink
refactor: convert string with anomalous backslash into a raw string (#29
Browse files Browse the repository at this point in the history
)

Backslash is present in the literal string but is not a valid escape sequence. If it is intended to be an escape sequence, use the correct escape characters. If it is intended to be a literal backslash, it can either be replaced with with an escaped backslash `\\`, or you can add an `r` prefix to make it a "raw" string.

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
  • Loading branch information
deepsource-autofix[bot] authored Jan 9, 2024
1 parent 75e2ac5 commit 89cb0df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/plugins/ncm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ async def music_reply_rule(event: Union[GroupMessageEvent, PrivateMessageEvent])
rule=Rule(music_set_rule),
block=False)
'''功能设置'''
music_regex = on_regex("(song|url)\?id=([0-9]+)(|&)",
music_regex = on_regex(r"(song|url)\?id=([0-9]+)(|&)",
block=False)
'''歌曲id识别'''
playlist_regex = on_regex("playlist\?id=([0-9]+)&",
playlist_regex = on_regex(r"playlist\?id=([0-9]+)&",
block=False)
'''歌单识别'''
music_reply = on_message(
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/ncm/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ async def download(self, ids: list, check=False, lid=0, is_zip=False): # 下载
url = data[i]["url"]
nid = data[i]["id"]
filename = f"{name[i]}.{data[i]['type']}"
filename = re.sub('[\/:*?"<>|]', "-", filename)
filename = re.sub(r'[\/:*?"<>|]', "-", filename)
file = Path.cwd().joinpath("music").joinpath(filename)
config = {
"id": int(nid),
Expand Down

0 comments on commit 89cb0df

Please sign in to comment.