Skip to content

Commit

Permalink
🎨 Optimize some codes
Browse files Browse the repository at this point in the history
  • Loading branch information
AirportR committed May 5, 2024
1 parent ea0c166 commit 6d7a73f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 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://").rstrip("/").split(":")
paddr = parsed[0]
pport = int(parsed[1])

Expand Down
2 changes: 1 addition & 1 deletion utils/cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,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/websocket/ws_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ async def main():
if not isinstance(bindaddr, str):
logger.error("绑定地址解析错误,请重试!")
sys.exit()
ba = bindaddr.lstrip('http:').strip('/').split(':')
ba = bindaddr.removeprefix('http:').strip('/').split(':')
try:
if len(ba) != 2:
logger.error("绑定地址解析错误,请重试!")
Expand Down

0 comments on commit 6d7a73f

Please sign in to comment.