坏re
This commit is contained in:
parent
954fbed754
commit
0858085df7
@ -4,14 +4,6 @@ import requests
|
|||||||
import traceback
|
import traceback
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
have_regexrs = False
|
|
||||||
try:
|
|
||||||
import regexrs
|
|
||||||
have_regexrs = True
|
|
||||||
except ImportError:
|
|
||||||
print("未找到 regexrs 模块, 将回退到字符串 in 操作")
|
|
||||||
have_regexrs = False
|
|
||||||
|
|
||||||
# import PIL
|
# import PIL
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, TypeVar, Optional, Tuple, List
|
from typing import TYPE_CHECKING, TypeVar, Optional, Tuple, List
|
||||||
@ -24,7 +16,7 @@ else:
|
|||||||
IcaNewMessage = TypeVar("NewMessage")
|
IcaNewMessage = TypeVar("NewMessage")
|
||||||
IcaClient = TypeVar("IcaClient")
|
IcaClient = TypeVar("IcaClient")
|
||||||
|
|
||||||
_version_ = "2.6.0-rs"
|
_version_ = "2.7.0-rs"
|
||||||
backend_version = "unknown"
|
backend_version = "unknown"
|
||||||
|
|
||||||
def format_data_size(data_bytes: float) -> str:
|
def format_data_size(data_bytes: float) -> str:
|
||||||
@ -233,11 +225,11 @@ def bmcl_rank(msg: IcaNewMessage, client: IcaClient, name: str) -> None:
|
|||||||
r['index'] = i
|
r['index'] = i
|
||||||
# 搜索是否有这个名字的节点
|
# 搜索是否有这个名字的节点
|
||||||
names: List[str] = [r["name"].lower() for r in rank_data]
|
names: List[str] = [r["name"].lower() for r in rank_data]
|
||||||
try:
|
# try:
|
||||||
import regexrs
|
# import regexrs
|
||||||
pattern = regexrs.compile(name)
|
# pattern = regexrs.compile(name)
|
||||||
finds = [pattern.match(n) for n in names]
|
# finds = [pattern.match(n) for n in names]
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
finds = [name.lower() in n for n in names]
|
finds = [name.lower() in n for n in names]
|
||||||
if not any(finds):
|
if not any(finds):
|
||||||
reply = msg.reply_with(f"未找到名为{name}的节点")
|
reply = msg.reply_with(f"未找到名为{name}的节点")
|
||||||
|
Loading…
Reference in New Issue
Block a user