Skip to content

Commit

Permalink
📝 Optimize some codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
AirportR committed Apr 24, 2024
1 parent d15d9a8 commit 071f14e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion addons/builtin/ssh22.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def fetch_ssh(collector, session: aiohttp.ClientSession, proxy: str = None
paddr = conn._proxy_host
pport = conn._proxy_port
else:
parsed = proxy.lstrip("http://").rstrip("/").split(":")
parsed = proxy.removeprefix("http://").removesuffix("/").split(":")
paddr = parsed[0]
pport = int(parsed[1])
mysocket = socks.socksocket(type=socket.SOCK_STREAM)
Expand Down
1 change: 0 additions & 1 deletion botmodule/init_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def parse_bot_proxy():
api_id = botconfig.get('api_id', None)
api_hash = botconfig.get('api_hash', None)
bot_token = botconfig.get('bot_token', None)
CLASH_PATH = config.get_clash_path() # 为代理客户端运行路径
USER_TARGET = config.getuser() # 这是用户列表,从配置文件读取
BOT_PROXY = parse_bot_proxy()

Expand Down
2 changes: 1 addition & 1 deletion utils/cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,7 @@ def unzip_targz(input_file: Union[str, Path], output_path: Union[str, Path]) ->
"""解压 tar.gz 文件, 返回解压后的文件名称列表"""
unzip_files = []
try:
temp_path = str(input_file).rstrip(".gz")
temp_path = str(input_file).removesuffix(".gz")
path = Path(input_file)
path2 = Path(output_path)
with gzip.open(path, 'rb') as f_in, open(temp_path, 'wb') as f_out:
Expand Down
2 changes: 1 addition & 1 deletion utils/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -2114,6 +2114,6 @@ def get_end_colors(_speedvalue, default_end_color='#C0C0C0'):

def check_path(maybe_path: str, num: int = 1) -> str:
if os.path.exists(maybe_path):
new_path = maybe_path.rstrip(".png").rstrip(f"({num-1})") + f"({num})" + ".png"
new_path = maybe_path.removesuffix(".png").rstrip(f"({num-1})") + f"({num})" + ".png"
return check_path(new_path, num+1)
return maybe_path

0 comments on commit 071f14e

Please sign in to comment.