From 0858085df7e1f8df7d16bed6ae3089ec8fab0430 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Tue, 4 Jun 2024 00:02:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9D=8Fre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ica-rs/plugins/bmcl.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/ica-rs/plugins/bmcl.py b/ica-rs/plugins/bmcl.py index 9722165..8e71558 100644 --- a/ica-rs/plugins/bmcl.py +++ b/ica-rs/plugins/bmcl.py @@ -4,14 +4,6 @@ import requests import traceback import urllib.parse -have_regexrs = False -try: - import regexrs - have_regexrs = True -except ImportError: - print("未找到 regexrs 模块, 将回退到字符串 in 操作") - have_regexrs = False - # import PIL from typing import TYPE_CHECKING, TypeVar, Optional, Tuple, List @@ -24,7 +16,7 @@ else: IcaNewMessage = TypeVar("NewMessage") IcaClient = TypeVar("IcaClient") -_version_ = "2.6.0-rs" +_version_ = "2.7.0-rs" backend_version = "unknown" def format_data_size(data_bytes: float) -> str: @@ -233,12 +225,12 @@ def bmcl_rank(msg: IcaNewMessage, client: IcaClient, name: str) -> None: r['index'] = i # 搜索是否有这个名字的节点 names: List[str] = [r["name"].lower() for r in rank_data] - try: - import regexrs - pattern = regexrs.compile(name) - finds = [pattern.match(n) for n in names] - except Exception as e: - finds = [name.lower() in n for n in names] + # try: + # import regexrs + # pattern = regexrs.compile(name) + # finds = [pattern.match(n) for n in names] + # except Exception as e: + finds = [name.lower() in n for n in names] if not any(finds): reply = msg.reply_with(f"未找到名为{name}的节点") client.send_message(reply)