Commit 2f3c098
authored
fix: Address mypy typing errors in v2 SDK (#157)
Fix all mypy errors due to incorrect typing after the SDK v2 merge
(#135).
Logic changes should be minimal, this is mostly to change type hints
where a `httpx.Response` is used instead of a `requests.Response`, etc.
I removed some `form_utils.py` functions where we no longer need to
convert a httpx request back to Requests. There's more we can cleanup in
here, but let's get the V2 migration settled first.
Add mypy to `make lint` so that we can cath these errors before merging.
The publish job runs a full linter suite, and these changes made it to
main but broke the publish job.
Also, remove the Patch Custom Code step that I added to the generate.
This broke the job. There are some minor changes to the Speakeasy code
on the main branch. In the short term, this means we'll have to run
`make patch-custom-code` whenever we regenerate.
# To verify
Make sure you can lint and run the tests locally. `make lint` and `make
test`. You can also verify that the pdf split behavior has not changed
with a call to your local server:
```
from unstructured_client import UnstructuredClient
from unstructured_client.models import shared, operations
import json
filename = "_sample_docs/layout-parser-paper.pdf"
s = UnstructuredClient(
server_url="http://localhost:8000",
)
with open(filename, "rb") as f:
files=shared.Files(
content=f,
file_name=filename,
)
req = operations.PartitionRequest(
shared.PartitionParameters(
files=files,
strategy="fast",
split_pdf_page_range=[4,8],
),
)
resp = s.general.partition(req)
print(json.dumps(resp.elements, indent=4))
```1 parent 793145e commit 2f3c098
File tree
7 files changed
+80
-176
lines changed- .github/workflows
- _test_unstructured_client/unit
- src/unstructured_client/_hooks/custom
7 files changed
+80
-176
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | 129 | | |
181 | 130 | | |
182 | 131 | | |
| |||
362 | 311 | | |
363 | 312 | | |
364 | 313 | | |
365 | | - | |
| 314 | + | |
366 | 315 | | |
367 | 316 | | |
368 | 317 | | |
369 | 318 | | |
370 | 319 | | |
371 | | - | |
| 320 | + | |
372 | 321 | | |
373 | 322 | | |
374 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
143 | | - | |
| 144 | + | |
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
| |||
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
221 | | - | |
222 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
223 | 225 | | |
224 | | - | |
| 226 | + | |
| 227 | + | |
225 | 228 | | |
226 | 229 | | |
227 | 230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 11 | + | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
| |||
51 | 49 | | |
52 | 50 | | |
53 | 51 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | 52 | | |
80 | 53 | | |
81 | 54 | | |
82 | | - | |
| 55 | + | |
83 | 56 | | |
84 | 57 | | |
85 | 58 | | |
86 | | - | |
| 59 | + | |
87 | 60 | | |
88 | 61 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 62 | + | |
98 | 63 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
113 | 70 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
119 | 74 | | |
120 | 75 | | |
121 | 76 | | |
122 | | - | |
123 | | - | |
| 77 | + | |
| 78 | + | |
124 | 79 | | |
125 | 80 | | |
126 | 81 | | |
| |||
129 | 84 | | |
130 | 85 | | |
131 | 86 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
136 | 91 | | |
137 | 92 | | |
138 | 93 | | |
| |||
157 | 112 | | |
158 | 113 | | |
159 | 114 | | |
160 | | - | |
| 115 | + | |
161 | 116 | | |
162 | 117 | | |
163 | 118 | | |
| |||
0 commit comments