Skip to content

Commit 6204403

Browse files
authored
Turn on combine-as-imports in Ruff (#75)
* Turn on `combine-as-imports` in `ruff.isort`, copy fixes from tool collision PR * Fix tests * Fix tests #2 * Add pytest cache * Fix tests #3
1 parent 6a6178b commit 6204403

7 files changed

Lines changed: 177 additions & 525 deletions

File tree

.basedpyright/baseline.json

Lines changed: 0 additions & 308 deletions
Original file line numberDiff line numberDiff line change
@@ -82,280 +82,6 @@
8282
}
8383
}
8484
],
85-
"./splunklib/ai/engines/langchain.py": [
86-
{
87-
"code": "reportDeprecated",
88-
"range": {
89-
"startColumn": 24,
90-
"endColumn": 33,
91-
"lineCount": 1
92-
}
93-
},
94-
{
95-
"code": "reportUnknownVariableType",
96-
"range": {
97-
"startColumn": 29,
98-
"endColumn": 41,
99-
"lineCount": 1
100-
}
101-
},
102-
{
103-
"code": "reportUnusedImport",
104-
"range": {
105-
"startColumn": 52,
106-
"endColumn": 62,
107-
"lineCount": 1
108-
}
109-
},
110-
{
111-
"code": "reportMissingTypeArgument",
112-
"range": {
113-
"startColumn": 12,
114-
"endColumn": 30,
115-
"lineCount": 1
116-
}
117-
},
118-
{
119-
"code": "reportUnknownArgumentType",
120-
"range": {
121-
"startColumn": 12,
122-
"endColumn": 42,
123-
"lineCount": 1
124-
}
125-
},
126-
{
127-
"code": "reportUnknownArgumentType",
128-
"range": {
129-
"startColumn": 28,
130-
"endColumn": 43,
131-
"lineCount": 1
132-
}
133-
},
134-
{
135-
"code": "reportUnknownArgumentType",
136-
"range": {
137-
"startColumn": 28,
138-
"endColumn": 43,
139-
"lineCount": 1
140-
}
141-
},
142-
{
143-
"code": "reportAssignmentType",
144-
"range": {
145-
"startColumn": 25,
146-
"endColumn": 50,
147-
"lineCount": 1
148-
}
149-
},
150-
{
151-
"code": "reportArgumentType",
152-
"range": {
153-
"startColumn": 16,
154-
"endColumn": 38,
155-
"lineCount": 1
156-
}
157-
},
158-
{
159-
"code": "reportAttributeAccessIssue",
160-
"range": {
161-
"startColumn": 31,
162-
"endColumn": 38,
163-
"lineCount": 1
164-
}
165-
},
166-
{
167-
"code": "reportUnknownArgumentType",
168-
"range": {
169-
"startColumn": 45,
170-
"endColumn": 47,
171-
"lineCount": 1
172-
}
173-
},
174-
{
175-
"code": "reportUnknownVariableType",
176-
"range": {
177-
"startColumn": 53,
178-
"endColumn": 55,
179-
"lineCount": 1
180-
}
181-
},
182-
{
183-
"code": "reportAttributeAccessIssue",
184-
"range": {
185-
"startColumn": 74,
186-
"endColumn": 84,
187-
"lineCount": 1
188-
}
189-
},
190-
{
191-
"code": "reportUnknownVariableType",
192-
"range": {
193-
"startColumn": 11,
194-
"endColumn": 5,
195-
"lineCount": 3
196-
}
197-
},
198-
{
199-
"code": "reportArgumentType",
200-
"range": {
201-
"startColumn": 17,
202-
"endColumn": 80,
203-
"lineCount": 1
204-
}
205-
},
206-
{
207-
"code": "reportUnusedParameter",
208-
"range": {
209-
"startColumn": 28,
210-
"endColumn": 33,
211-
"lineCount": 1
212-
}
213-
},
214-
{
215-
"code": "reportRedeclaration",
216-
"range": {
217-
"startColumn": 18,
218-
"endColumn": 22,
219-
"lineCount": 1
220-
}
221-
},
222-
{
223-
"code": "reportUnknownParameterType",
224-
"range": {
225-
"startColumn": 21,
226-
"endColumn": 27,
227-
"lineCount": 1
228-
}
229-
},
230-
{
231-
"code": "reportMissingParameterType",
232-
"range": {
233-
"startColumn": 21,
234-
"endColumn": 27,
235-
"lineCount": 1
236-
}
237-
},
238-
{
239-
"code": "reportUnknownArgumentType",
240-
"range": {
241-
"startColumn": 18,
242-
"endColumn": 22,
243-
"lineCount": 1
244-
}
245-
},
246-
{
247-
"code": "reportUnknownArgumentType",
248-
"range": {
249-
"startColumn": 28,
250-
"endColumn": 43,
251-
"lineCount": 1
252-
}
253-
},
254-
{
255-
"code": "reportUnknownArgumentType",
256-
"range": {
257-
"startColumn": 44,
258-
"endColumn": 59,
259-
"lineCount": 1
260-
}
261-
},
262-
{
263-
"code": "reportUnknownArgumentType",
264-
"range": {
265-
"startColumn": 45,
266-
"endColumn": 60,
267-
"lineCount": 1
268-
}
269-
},
270-
{
271-
"code": "reportUnnecessaryComparison",
272-
"range": {
273-
"startColumn": 13,
274-
"endColumn": 14,
275-
"lineCount": 1
276-
}
277-
},
278-
{
279-
"code": "reportUnreachable",
280-
"range": {
281-
"startColumn": 12,
282-
"endColumn": 77,
283-
"lineCount": 1
284-
}
285-
},
286-
{
287-
"code": "reportUnknownParameterType",
288-
"range": {
289-
"startColumn": 8,
290-
"endColumn": 13,
291-
"lineCount": 1
292-
}
293-
},
294-
{
295-
"code": "reportMissingTypeArgument",
296-
"range": {
297-
"startColumn": 15,
298-
"endColumn": 28,
299-
"lineCount": 1
300-
}
301-
},
302-
{
303-
"code": "reportUnusedParameter",
304-
"range": {
305-
"startColumn": 30,
306-
"endColumn": 37,
307-
"lineCount": 1
308-
}
309-
},
310-
{
311-
"code": "reportUnknownArgumentType",
312-
"range": {
313-
"startColumn": 19,
314-
"endColumn": 30,
315-
"lineCount": 1
316-
}
317-
},
318-
{
319-
"code": "reportUnknownParameterType",
320-
"range": {
321-
"startColumn": 4,
322-
"endColumn": 9,
323-
"lineCount": 1
324-
}
325-
},
326-
{
327-
"code": "reportMissingTypeArgument",
328-
"range": {
329-
"startColumn": 11,
330-
"endColumn": 24,
331-
"lineCount": 1
332-
}
333-
},
334-
{
335-
"code": "reportUnknownArgumentType",
336-
"range": {
337-
"startColumn": 26,
338-
"endColumn": 58,
339-
"lineCount": 1
340-
}
341-
},
342-
{
343-
"code": "reportPrivateUsage",
344-
"range": {
345-
"startColumn": 13,
346-
"endColumn": 22,
347-
"lineCount": 1
348-
}
349-
},
350-
{
351-
"code": "reportArgumentType",
352-
"range": {
353-
"startColumn": 28,
354-
"endColumn": 41,
355-
"lineCount": 1
356-
}
357-
}
358-
],
35985
"./splunklib/ai/hooks.py": [
36086
{
36187
"code": "reportDeprecated",
@@ -30656,40 +30382,6 @@
3065630382
}
3065730383
}
3065830384
],
30659-
"./tests/integration/ai/test_middleware.py": [
30660-
{
30661-
"code": "reportUnusedParameter",
30662-
"range": {
30663-
"startColumn": 12,
30664-
"endColumn": 19,
30665-
"lineCount": 1
30666-
}
30667-
},
30668-
{
30669-
"code": "reportUnusedParameter",
30670-
"range": {
30671-
"startColumn": 34,
30672-
"endColumn": 41,
30673-
"lineCount": 1
30674-
}
30675-
},
30676-
{
30677-
"code": "reportUnusedParameter",
30678-
"range": {
30679-
"startColumn": 34,
30680-
"endColumn": 41,
30681-
"lineCount": 1
30682-
}
30683-
},
30684-
{
30685-
"code": "reportUnusedParameter",
30686-
"range": {
30687-
"startColumn": 38,
30688-
"endColumn": 45,
30689-
"lineCount": 1
30690-
}
30691-
}
30692-
],
3069330385
"./tests/integration/ai/test_registry.py": [
3069430386
{
3069530387
"code": "reportUnknownArgumentType",

.github/workflows/test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
python-version: ${{ matrix.python-version }}
2121
- name: Install dependencies
2222
run: python -m pip install '.[openai]' --group test
23+
2324
- name: Set up .env
2425
run: cp .env.template .env
2526
- name: Write internal AI secrets to .env
@@ -35,6 +36,15 @@ jobs:
3536
INTERNAL_AI_CLIENT_SECRET: ${{ secrets.INTERNAL_AI_CLIENT_SECRET }}
3637
INTERNAL_AI_TOKEN_URL: ${{ secrets.INTERNAL_AI_TOKEN_URL }}
3738
INTERNAL_AI_BASE_URL: ${{ secrets.INTERNAL_AI_BASE_URL }}
39+
40+
- name: Restore pytest cache
41+
uses: actions/cache@565629816435f6c0b50676926c9b05c254113c0c
42+
with:
43+
path: .pytest_cache
44+
key: pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-${{ github.sha }}
45+
restore-keys: |
46+
pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-
47+
pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-
3848
- name: Run unit tests
3949
run: make test-unit
4050
- name: Run entire test suite

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,23 @@ docs:
2828

2929
.PHONY: test
3030
test:
31-
python -m pytest ./tests
31+
# Previously failing tests go first
32+
python -m pytest --ff ./tests
3233

3334
.PHONY: test-unit
3435
test-unit:
35-
python -m pytest ./tests/unit
36+
# Previously failing tests go first
37+
python -m pytest --ff ./tests/unit
3638

3739
.PHONY: test-integration
3840
test-integration:
39-
python -m pytest ./tests/integration ./tests/system
41+
# Previously failing tests go first
42+
python -m pytest --ff ./tests/integration ./tests/system
4043

4144
.PHONY: test-ai
4245
test-ai:
43-
python -m pytest ./tests/integration/ai ./tests/unit/ai
46+
# Previously failing tests go first
47+
python -m pytest --ff ./tests/integration/ai ./tests/unit/ai
4448

4549
.PHONY: docker-up
4650
docker-up:

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,6 @@ select = [
9595
"UP", # pyupgrade
9696
"RUF", # ruff-specific rules
9797
]
98+
99+
[tool.ruff.lint.isort]
100+
combine-as-imports = true

0 commit comments

Comments
 (0)