Skip to content

Commit aa759df

Browse files
committed
Fix baseline, basedpyright hanging up when scanning app deps leftover
from manual test/debugging
1 parent 2f47e29 commit aa759df

8 files changed

Lines changed: 20 additions & 159 deletions

File tree

‎.basedpyright/baseline.json‎

Lines changed: 0 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
{
22
"files": {
3-
"./examples/ai_custom_search_app/bin/agentic_reporting_csc.py": [
4-
{
5-
"code": "reportUnnecessaryTypeIgnoreComment",
6-
"range": {
7-
"startColumn": 33,
8-
"endColumn": 62,
9-
"lineCount": 1
10-
}
11-
}
12-
],
133
"./splunklib/__init__.py": [
144
{
155
"code": "reportUnknownParameterType",
@@ -82,114 +72,6 @@
8272
}
8373
}
8474
],
85-
"./splunklib/ai/engines/langchain.py": [
86-
{
87-
"code": "reportUnnecessaryTypeIgnoreComment",
88-
"range": {
89-
"startColumn": 79,
90-
"endColumn": 104,
91-
"lineCount": 1
92-
}
93-
},
94-
{
95-
"code": "reportUnnecessaryTypeIgnoreComment",
96-
"range": {
97-
"startColumn": 79,
98-
"endColumn": 104,
99-
"lineCount": 1
100-
}
101-
},
102-
{
103-
"code": "reportUnnecessaryTypeIgnoreComment",
104-
"range": {
105-
"startColumn": 69,
106-
"endColumn": 94,
107-
"lineCount": 1
108-
}
109-
},
110-
{
111-
"code": "reportUnnecessaryTypeIgnoreComment",
112-
"range": {
113-
"startColumn": 59,
114-
"endColumn": 84,
115-
"lineCount": 1
116-
}
117-
},
118-
{
119-
"code": "reportUnnecessaryTypeIgnoreComment",
120-
"range": {
121-
"startColumn": 88,
122-
"endColumn": 113,
123-
"lineCount": 1
124-
}
125-
},
126-
{
127-
"code": "reportUnnecessaryTypeIgnoreComment",
128-
"range": {
129-
"startColumn": 89,
130-
"endColumn": 114,
131-
"lineCount": 1
132-
}
133-
}
134-
],
135-
"./splunklib/ai/serialized_service.py": [
136-
{
137-
"code": "reportPrivateUsage",
138-
"range": {
139-
"startColumn": 30,
140-
"endColumn": 39,
141-
"lineCount": 1
142-
}
143-
},
144-
{
145-
"code": "reportUnnecessaryTypeIgnoreComment",
146-
"range": {
147-
"startColumn": 99,
148-
"endColumn": 122,
149-
"lineCount": 1
150-
}
151-
},
152-
{
153-
"code": "reportUnnecessaryTypeIgnoreComment",
154-
"range": {
155-
"startColumn": 88,
156-
"endColumn": 111,
157-
"lineCount": 1
158-
}
159-
},
160-
{
161-
"code": "reportUnnecessaryTypeIgnoreComment",
162-
"range": {
163-
"startColumn": 88,
164-
"endColumn": 111,
165-
"lineCount": 1
166-
}
167-
},
168-
{
169-
"code": "reportUnnecessaryTypeIgnoreComment",
170-
"range": {
171-
"startColumn": 96,
172-
"endColumn": 119,
173-
"lineCount": 1
174-
}
175-
},
176-
{
177-
"code": "reportUnnecessaryTypeIgnoreComment",
178-
"range": {
179-
"startColumn": 121,
180-
"endColumn": 139,
181-
"lineCount": 1
182-
}
183-
},
184-
{
185-
"code": "reportUnnecessaryTypeIgnoreComment",
186-
"range": {
187-
"startColumn": 98,
188-
"endColumn": 121,
189-
"lineCount": 1
190-
}
191-
}
192-
],
19375
"./splunklib/ai/tools.py": [
19476
{
19577
"code": "reportUnknownArgumentType",
@@ -41374,16 +41256,6 @@
4137441256
}
4137541257
}
4137641258
],
41377-
"./tests/unit/ai/testdata/tool_defining_tools.py": [
41378-
{
41379-
"code": "reportUnusedFunction",
41380-
"range": {
41381-
"startColumn": 8,
41382-
"endColumn": 12,
41383-
"lineCount": 1
41384-
}
41385-
}
41386-
],
4138741259
"./tests/unit/modularinput/modularinput_testlib.py": [
4138841260
{
4138941261
"code": "reportUnknownParameterType",

‎.github/workflows/cd.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
id: get-version
5151
run: echo "version=$(uv version --short)" >> "$GITHUB_OUTPUT"
5252
- name: Build packages for distribution
53-
run: uv build
53+
run: make build
5454
- name: Run AppInspect
5555
if: startsWith(github.ref, 'refs/tags/') == true
5656
uses: $/.github/actions/run-appinspect

‎Makefile‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@ lint: lint-python lint-gh-actions lint-makefile
3636
lint-gh-actions:
3737
uvx zizmor --pedantic --strict-collection ./.github
3838

39-
# --fix-only never fails on unfixable violations, so some rules need to be
40-
# enforced with a separate `ruff check`.
4139
.PHONY: lint-python
4240
lint-python:
4341
$(UV_RUN_CMD) ruff check --fix-only $(if $(CI),--exit-non-zero-on-fix)
44-
$(UV_RUN_CMD) ruff check --select N
4542
$(UV_RUN_CMD) ruff format $(if $(CI),--check)
4643
$(UV_RUN_CMD) basedpyright
4744

‎examples/ai_custom_search_app/bin/agentic_reporting_csc.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from splunklib.searchcommands import (
3535
Configuration,
3636
Option,
37-
dispatch, # pyright: ignore[reportPrivateLocalImportUsage]
37+
dispatch,
3838
validators,
3939
)
4040
from splunklib.searchcommands.eventing_command import EventingCommand

‎pyproject.toml‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ junit_family = "xunit2"
9393
omit = ["docs/*", "tests/*", "examples/*", "scripts/*"]
9494

9595
[tool.basedpyright]
96-
exclude = [".venv"]
96+
exclude = ["**/bin/lib", "build"]
9797
allowedUntypedLibraries = ["splunklib"]
9898
reportAny = false
9999
reportExplicitAny = false
@@ -128,9 +128,10 @@ ignore = [
128128
[tool.ruff.lint.isort]
129129
combine-as-imports = true
130130

131+
[tool.ruff.format]
132+
docstring-code-format = true
133+
131134
[tool.ruff.lint.pep8-naming]
132-
# Grandfathered legacy names (mostly public API kept for backwards compatibility).
133-
# Remove entries as names get fixed; do not add new ones without approval.
134135
extend-ignore-names = [
135136
"_buildInternalAIModel",
136137
"_InvalidMessagesException",
@@ -199,6 +200,3 @@ extend-ignore-names = [
199200
"updateInfo",
200201
"versionSearch",
201202
]
202-
203-
[tool.ruff.format]
204-
docstring-code-format = true

‎splunklib/ai/engines/langchain.py‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,9 @@ async def awrap_tool_call(
301301
assert resp.artifact is None, "artifact is already populated"
302302

303303
if resp.name.startswith(AGENT_PREFIX):
304-
resp.artifact = SubagentFailureResult(
305-
error_message=str(resp.content) # pyright: ignore[reportUnknownArgumentType]
306-
)
304+
resp.artifact = SubagentFailureResult(error_message=str(resp.content))
307305
else:
308-
resp.artifact = ToolFailureResult(
309-
error_message=str(resp.content) # pyright: ignore[reportUnknownArgumentType]
310-
)
306+
resp.artifact = ToolFailureResult(error_message=str(resp.content))
311307

312308
return resp
313309

@@ -1247,12 +1243,10 @@ def _convert_tool_message_from_lc(
12471243
name=message.name.removeprefix(TOOL_STRATEGY_TOOL_PREFIX),
12481244
call_id=message.tool_call_id,
12491245
status=message.status,
1250-
content=str(message.content), # pyright: ignore[reportUnknownArgumentType]
1246+
content=str(message.content),
12511247
)
12521248

1253-
assert isinstance(message.artifact, ToolResult) or isinstance(
1254-
message.artifact, ToolFailureResult
1255-
)
1249+
assert isinstance(message.artifact, (ToolResult, ToolFailureResult))
12561250

12571251
tool_type: ToolType = (
12581252
ToolType.LOCAL if message.name.startswith(LOCAL_TOOL_PREFIX) else ToolType.REMOTE
@@ -1284,7 +1278,7 @@ def _convert_model_result_from_lc(model_response: LC_ModelCallResult) -> ModelRe
12841278
call_id=m.tool_call_id,
12851279
name=m.name.removeprefix(TOOL_STRATEGY_TOOL_PREFIX) if m.name else "",
12861280
status=m.status,
1287-
content=str(m.content), # pyright: ignore[reportUnknownArgumentType]
1281+
content=str(m.content),
12881282
)
12891283
for m in model_response.result
12901284
if isinstance(m, LC_ToolMessage)
@@ -1298,7 +1292,7 @@ def _convert_model_result_from_lc(model_response: LC_ModelCallResult) -> ModelRe
12981292
additional_kwargs = cast(dict[str, Any], ai_message.additional_kwargs)
12991293
return ModelResponse(
13001294
message=AIMessage(
1301-
content=_map_content_from_langchain(ai_message.content), # pyright: ignore[reportUnknownArgumentType]
1295+
content=_map_content_from_langchain(ai_message.content),
13021296
calls=[
13031297
_map_tool_call_from_langchain(tc)
13041298
for tc in ai_message.tool_calls
@@ -1706,7 +1700,7 @@ def _map_message_from_langchain(message: LC_BaseMessage) -> BaseMessage:
17061700
match message:
17071701
case LC_AIMessage():
17081702
return AIMessage(
1709-
content=_map_content_from_langchain(message.content), # pyright: ignore[reportUnknownArgumentType]
1703+
content=_map_content_from_langchain(message.content),
17101704
calls=[
17111705
_map_tool_call_from_langchain(tc)
17121706
for tc in message.tool_calls

‎splunklib/ai/registry.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ async def _call_tool(self, name: str, arguments: dict[str, Any]) -> types.CallTo
325325
)
326326
except BaseExceptionGroup as e:
327327
# Re-raise the first exception.
328-
raise e.exceptions[0]
328+
raise e.exceptions[0] from e
329329

330330
def _input_schema(self, func: Callable[_P, _R]) -> dict[str, Any]:
331331
"""

‎splunklib/ai/serialized_service.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from pydantic import BaseModel, Field
1919

20-
from splunklib.binding import _spliturl
20+
from splunklib.binding import _spliturl # pyright: ignore[reportPrivateUsage]
2121
from splunklib.client import Service, connect
2222

2323

@@ -32,11 +32,11 @@ class SerializedService(BaseModel):
3232
@classmethod
3333
def from_service(cls, service: Service) -> Self:
3434
return cls(
35-
management_url=f"{service.scheme}://{service.host}:{service.port}", # pyright: ignore[reportUnknownMemberType]
36-
username=service.username if service.username else None, # pyright: ignore[reportUnknownMemberType, reportUnknownArgumentType]
37-
password=service.password if service.password else None, # pyright: ignore[reportUnknownMemberType, reportUnknownArgumentType]
38-
token=service.token if isinstance(service.token, str) else None, # pyright: ignore[reportUnknownMemberType, reportArgumentType]
39-
bearer_token=service.bearerToken if service.bearerToken else None, # pyright: ignore[reportUnknownMemberType, reportUnknownArgumentType]
35+
management_url=f"{service.scheme}://{service.host}:{service.port}",
36+
username=service.username if service.username else None, # pyright: ignore[reportUnknownArgumentType]
37+
password=service.password if service.password else None, # pyright: ignore[reportUnknownArgumentType]
38+
token=service.token if isinstance(service.token, str) else None,
39+
bearer_token=service.bearerToken if service.bearerToken else None, # pyright: ignore[reportUnknownArgumentType]
4040
auth_cookies=(
4141
service.get_cookies() if len(service.get_cookies()) != 0 else None # pyright: ignore[reportUnknownArgumentType]
4242
),

0 commit comments

Comments
 (0)