chore: fix unnecessary string concatation in single line (#8311)

This commit is contained in:
Bowen Liang
2024-09-13 14:24:49 +08:00
committed by GitHub
parent 08c486452f
commit 6613b8f2e0
30 changed files with 46 additions and 49 deletions

View File

@@ -14,7 +14,7 @@ class GaodeProvider(BuiltinToolProviderController):
try:
response = requests.get(
url="https://restapi.amap.com/v3/geocode/geo?address={address}&key={apikey}" "".format(
url="https://restapi.amap.com/v3/geocode/geo?address={address}&key={apikey}".format(
address=urllib.parse.quote("广东省广州市天河区广州塔"), apikey=credentials.get("api_key")
)
)

View File

@@ -27,7 +27,7 @@ class GaodeRepositoriesTool(BuiltinTool):
city_response = s.request(
method="GET",
headers={"Content-Type": "application/json; charset=utf-8"},
url="{url}/config/district?keywords={keywords}" "&subdistrict=0&extensions=base&key={apikey}" "".format(
url="{url}/config/district?keywords={keywords}&subdistrict=0&extensions=base&key={apikey}".format(
url=api_domain, keywords=city, apikey=self.runtime.credentials.get("api_key")
),
)

View File

@@ -39,7 +39,7 @@ class GithubRepositoriesTool(BuiltinTool):
response = s.request(
method="GET",
headers=headers,
url=f"{api_domain}/search/repositories?" f"q={quote(query)}&sort=stars&per_page={top_n}&order=desc",
url=f"{api_domain}/search/repositories?q={quote(query)}&sort=stars&per_page={top_n}&order=desc",
)
response_data = response.json()
if response.status_code == 200 and isinstance(response_data.get("items"), list):

View File

@@ -51,7 +51,7 @@ class PubMedAPIWrapper(BaseModel):
try:
# Retrieve the top-k results for the query
docs = [
f"Published: {result['pub_date']}\nTitle: {result['title']}\n" f"Summary: {result['summary']}"
f"Published: {result['pub_date']}\nTitle: {result['title']}\nSummary: {result['summary']}"
for result in self.load(query[: self.ARXIV_MAX_QUERY_LENGTH])
]
@@ -97,7 +97,7 @@ class PubMedAPIWrapper(BaseModel):
if e.code == 429 and retry < self.max_retry:
# Too Many Requests error
# wait for an exponentially increasing amount of time
print(f"Too Many Requests, " f"waiting for {self.sleep_time:.2f} seconds...")
print(f"Too Many Requests, waiting for {self.sleep_time:.2f} seconds...")
time.sleep(self.sleep_time)
self.sleep_time *= 2
retry += 1

View File

@@ -39,7 +39,7 @@ class TwilioAPIWrapper(BaseModel):
try:
from twilio.rest import Client
except ImportError:
raise ImportError("Could not import twilio python package. " "Please install it with `pip install twilio`.")
raise ImportError("Could not import twilio python package. Please install it with `pip install twilio`.")
account_sid = values.get("account_sid")
auth_token = values.get("auth_token")
values["from_number"] = values.get("from_number")