chore: improve usage of striping prefix or suffix of string with Ruff 0.6.5 (#8392)
This commit is contained in:
@@ -30,7 +30,7 @@ class AddWorksheetRecordTool(BuiltinTool):
|
||||
elif not host.startswith(("http://", "https://")):
|
||||
return self.create_text_message("Invalid parameter Host Address")
|
||||
else:
|
||||
host = f"{host[:-1] if host.endswith('/') else host}/api"
|
||||
host = f"{host.removesuffix('/')}/api"
|
||||
|
||||
url = f"{host}/v2/open/worksheet/addRow"
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
@@ -29,7 +29,7 @@ class DeleteWorksheetRecordTool(BuiltinTool):
|
||||
elif not host.startswith(("http://", "https://")):
|
||||
return self.create_text_message("Invalid parameter Host Address")
|
||||
else:
|
||||
host = f"{host[:-1] if host.endswith('/') else host}/api"
|
||||
host = f"{host.removesuffix('/')}/api"
|
||||
|
||||
url = f"{host}/v2/open/worksheet/deleteRow"
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
@@ -27,7 +27,7 @@ class GetWorksheetFieldsTool(BuiltinTool):
|
||||
elif not host.startswith(("http://", "https://")):
|
||||
return self.create_text_message("Invalid parameter Host Address")
|
||||
else:
|
||||
host = f"{host[:-1] if host.endswith('/') else host}/api"
|
||||
host = f"{host.removesuffix('/')}/api"
|
||||
|
||||
url = f"{host}/v2/open/worksheet/getWorksheetInfo"
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
@@ -38,7 +38,7 @@ class GetWorksheetPivotDataTool(BuiltinTool):
|
||||
elif not host.startswith(("http://", "https://")):
|
||||
return self.create_text_message("Invalid parameter Host Address")
|
||||
else:
|
||||
host = f"{host[:-1] if host.endswith('/') else host}/api"
|
||||
host = f"{host.removesuffix('/')}/api"
|
||||
|
||||
url = f"{host}/report/getPivotData"
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
@@ -30,7 +30,7 @@ class ListWorksheetRecordsTool(BuiltinTool):
|
||||
elif not (host.startswith("http://") or host.startswith("https://")):
|
||||
return self.create_text_message("Invalid parameter Host Address")
|
||||
else:
|
||||
host = f"{host[:-1] if host.endswith('/') else host}/api"
|
||||
host = f"{host.removesuffix('/')}/api"
|
||||
|
||||
url_fields = f"{host}/v2/open/worksheet/getWorksheetInfo"
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
@@ -24,7 +24,7 @@ class ListWorksheetsTool(BuiltinTool):
|
||||
elif not (host.startswith("http://") or host.startswith("https://")):
|
||||
return self.create_text_message("Invalid parameter Host Address")
|
||||
else:
|
||||
host = f"{host[:-1] if host.endswith('/') else host}/api"
|
||||
host = f"{host.removesuffix('/')}/api"
|
||||
url = f"{host}/v1/open/app/get"
|
||||
|
||||
result_type = tool_parameters.get("result_type", "")
|
||||
|
||||
@@ -33,7 +33,7 @@ class UpdateWorksheetRecordTool(BuiltinTool):
|
||||
elif not host.startswith(("http://", "https://")):
|
||||
return self.create_text_message("Invalid parameter Host Address")
|
||||
else:
|
||||
host = f"{host[:-1] if host.endswith('/') else host}/api"
|
||||
host = f"{host.removesuffix('/')}/api"
|
||||
|
||||
url = f"{host}/v2/open/worksheet/editRow"
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
Reference in New Issue
Block a user