chore: apply flake8-comprehensions Ruff rules to improve collection comprehensions (#5652)

Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
Bowen Liang 2024-06-27 11:21:31 +08:00 • committed by GitHub
commit dcb72e0067
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
58 changed files with 123 additions and 136 deletions

View file

@ -43,7 +43,7 @@ class GetMarkdownTool(BuiltinTool):
Invoke the SerplyApi tool.
"""
url = tool_parameters["url"]
location = tool_parameters.get("location", None)
location = tool_parameters.get("location")
api_key = self.runtime.credentials["serply_api_key"]
result = SerplyApi(api_key).run(url, location=location)

View file

@ -55,7 +55,7 @@ class SerplyApi:
f"Employer: {job['employer']}",
f"Location: {job['location']}",
f"Link: {job['link']}",
f"""Highest: {", ".join([h for h in job["highlights"]])}""",
f"""Highest: {", ".join(list(job["highlights"]))}""",
"---",
])
)
@ -78,7 +78,7 @@ class JobSearchTool(BuiltinTool):
query = tool_parameters["query"]
gl = tool_parameters.get("gl", "us")
hl = tool_parameters.get("hl", "en")
location = tool_parameters.get("location", None)
location = tool_parameters.get("location")
api_key = self.runtime.credentials["serply_api_key"]
result = SerplyApi(api_key).run(query, gl=gl, hl=hl, location=location)

View file

@ -80,7 +80,7 @@ class NewsSearchTool(BuiltinTool):
query = tool_parameters["query"]
gl = tool_parameters.get("gl", "us")
hl = tool_parameters.get("hl", "en")
location = tool_parameters.get("location", None)
location = tool_parameters.get("location")
api_key = self.runtime.credentials["serply_api_key"]
result = SerplyApi(api_key).run(query, gl=gl, hl=hl, location=location)

View file

@ -83,7 +83,7 @@ class ScholarSearchTool(BuiltinTool):
query = tool_parameters["query"]
gl = tool_parameters.get("gl", "us")
hl = tool_parameters.get("hl", "en")
location = tool_parameters.get("location", None)
location = tool_parameters.get("location")
api_key = self.runtime.credentials["serply_api_key"]
result = SerplyApi(api_key).run(query, gl=gl, hl=hl, location=location)