Skip to content

Commit 981f912

Browse files
committed
Fix CI lint errors
1 parent 4d3deca commit 981f912

4 files changed

Lines changed: 28 additions & 27 deletions

File tree

examples/demo_semantic_search.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ def run_demo(use_local: bool, lambda_url: str, api_key: str | None) -> None:
184184
print("Error: STACKONE_API_KEY required for production mode")
185185
print("Use --local flag for local Lambda mode")
186186
exit(1)
187+
assert api_key is not None # narrowing for type checker
187188
sem_client = SemanticSearchClient(api_key=api_key)
188189
semantic_search = sem_client.search
189190
client = None
@@ -216,7 +217,7 @@ def run_demo(use_local: bool, lambda_url: str, api_key: str | None) -> None:
216217
query = demo["query"]
217218
why = demo["why"]
218219

219-
print(f"\n [{i}/{len(DEMO_QUERIES)}] Query: \"{query}\"")
220+
print(f'\n [{i}/{len(DEMO_QUERIES)}] Query: "{query}"')
220221
print(f" Why interesting: {why}")
221222
print()
222223

@@ -243,7 +244,7 @@ def run_demo(use_local: bool, lambda_url: str, api_key: str | None) -> None:
243244
s_name = sem_names[j] if j < len(sem_names) else ""
244245
s_score = sem_scores[j] if j < len(sem_scores) else ""
245246
l_display = f" {l_name[:w]:<{w}}"
246-
s_display = f" {s_name[:w - 8]:<{w - 8}} ({s_score})" if s_name else ""
247+
s_display = f" {s_name[: w - 8]:<{w - 8}} ({s_score})" if s_name else ""
247248
print(f"{l_display} |{s_display}")
248249

249250
input("\n Press Enter for next query...")

stackone_ai/semantic_search.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ def search(
108108
data = response.json()
109109
return SemanticSearchResponse(**data)
110110
except httpx.HTTPStatusError as e:
111-
raise SemanticSearchError(
112-
f"API error: {e.response.status_code} - {e.response.text}"
113-
) from e
111+
raise SemanticSearchError(f"API error: {e.response.status_code} - {e.response.text}") from e
114112
except httpx.RequestError as e:
115113
raise SemanticSearchError(f"Request failed: {e}") from e
116114
except Exception as e:

tests/benchmark_search.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,12 @@ def fetch_all_actions(self) -> list[SemanticSearchResult]:
171171
seen: dict[str, SemanticSearchResult] = {}
172172
for query in broad_queries:
173173
try:
174-
data = self._invoke({
175-
"type": "search",
176-
"payload": {"query": query, "top_k": 500},
177-
})
174+
data = self._invoke(
175+
{
176+
"type": "search",
177+
"payload": {"query": query, "top_k": 500},
178+
}
179+
)
178180
for r in data.get("results", []):
179181
name = r.get("action_name", "")
180182
if name and name not in seen:

tests/test_semantic_search.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -593,12 +593,14 @@ def make_tool(name: str) -> StackOneTool:
593593
_api_key="test-key",
594594
)
595595

596-
tools = Tools([
597-
make_tool("bamboohr_create_employee"),
598-
make_tool("bamboohr_list_employees"),
599-
make_tool("hibob_create_employee"),
600-
make_tool("slack_send_message"),
601-
])
596+
tools = Tools(
597+
[
598+
make_tool("bamboohr_create_employee"),
599+
make_tool("bamboohr_list_employees"),
600+
make_tool("hibob_create_employee"),
601+
make_tool("slack_send_message"),
602+
]
603+
)
602604

603605
connectors = tools.get_connectors()
604606

@@ -623,12 +625,14 @@ def make_tool(name: str) -> StackOneTool:
623625
_api_key="test-key",
624626
)
625627

626-
tools = Tools([
627-
make_tool("bamboohr_create_employee"),
628-
make_tool("bamboohr_list_employees"),
629-
make_tool("hibob_create_employee"),
630-
make_tool("slack_send_message"),
631-
])
628+
tools = Tools(
629+
[
630+
make_tool("bamboohr_create_employee"),
631+
make_tool("bamboohr_list_employees"),
632+
make_tool("hibob_create_employee"),
633+
make_tool("slack_send_message"),
634+
]
635+
)
632636

633637
# Filter by single connector
634638
bamboo_tools = tools.filter_by_connector(["bamboohr"])
@@ -647,9 +651,7 @@ def test_filter_by_connector_case_insensitive(self) -> None:
647651
tool = StackOneTool(
648652
description="Creates employee",
649653
parameters=ToolParameters(type="object", properties={}),
650-
_execute_config=ExecuteConfig(
651-
name="bamboohr_create_employee", method="POST", url="", headers={}
652-
),
654+
_execute_config=ExecuteConfig(name="bamboohr_create_employee", method="POST", url="", headers={}),
653655
_api_key="test-key",
654656
)
655657
tools = Tools([tool])
@@ -666,9 +668,7 @@ def test_filter_by_connector_returns_new_tools(self) -> None:
666668
tool = StackOneTool(
667669
description="Creates employee",
668670
parameters=ToolParameters(type="object", properties={}),
669-
_execute_config=ExecuteConfig(
670-
name="bamboohr_create_employee", method="POST", url="", headers={}
671-
),
671+
_execute_config=ExecuteConfig(name="bamboohr_create_employee", method="POST", url="", headers={}),
672672
_api_key="test-key",
673673
)
674674
tools = Tools([tool])

0 commit comments

Comments
 (0)