Commit f2536ae
authored
fix: fix mypy (#15531)
Towards #15104
This PR addresses the following mypy failure for
`google-cloud-bigquery-storage`:
```
(py3142) partheniou@partheniou-vm-3:~/git/google-cloud-python/packages/google-cloud-bigquery-storage$ nox -s mypy-3.14
nox > Running session mypy-3.14
nox > Creating virtual environment (virtualenv) using python3.14 in .nox/mypy-3-14
nox > python -m pip install 'mypy<1.16.0' types-requests types-protobuf
nox > python -m pip install .
nox > mypy -p google
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/gapic_types.py:25: error: Skipping analyzing "proto": module is installed, but missing library stubs or py.typed marker [import-untyped]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/gapic_types.py:25: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta/__init__.py:87: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1alpha/__init__.py:87: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/reader.py:23: error: Cannot find implementation or library stub for module named "fastavro" [import-not-found]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/reader.py:27: error: Skipping analyzing "google.rpc.error_details_pb2": module is installed, but missing library stubs or py.typed marker [import-untyped]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/reader.py:27: error: Skipping analyzing "google.rpc": module is installed, but missing library stubs or py.typed marker [import-untyped]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/reader.py:30: error: Library stubs not installed for "pandas" [import-untyped]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/reader.py:30: note: Hint: "python3 -m pip install pandas-stubs"
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/reader.py:30: note: (or run "mypy --install-types" to install all missing stub packages)
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/reader.py:34: error: Cannot find implementation or library stub for module named "pyarrow" [import-not-found]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/__init__.py:98: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/__init__.py:98: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:28: error: Skipping analyzing "grpc": module is installed, but missing library stubs or py.typed marker [import-untyped]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:58: error: Incompatible return value type (got "BaseException", expected "Exception") [return-value]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:112: error: Need type annotation for "_close_callbacks" (hint: "_close_callbacks: list[<type>] = ...") [var-annotated]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:115: error: Need type annotation for "_closed_connection" (hint: "_closed_connection: dict[<type>, <type>] = ...") [var-annotated]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:160: error: Incompatible types in assignment (expression has type "str", variable has type "None") [assignment]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:260: error: Need type annotation for "_queue" [var-annotated]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:319: error: Incompatible types in assignment (expression has type "BidiRpc", variable has type "None") [assignment]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:333: error: "None" has no attribute "add_done_callback" [attr-defined]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:335: error: Incompatible types in assignment (expression has type "BackgroundConsumer", variable has type "None") [assignment]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:336: error: "None" has no attribute "start" [attr-defined]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:345: error: "None" has no attribute "is_active" [attr-defined]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:364: error: "None" has no attribute "is_active" [attr-defined]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:395: error: Incompatible types in assignment (expression has type "str", variable has type "None") [assignment]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:432: error: "None" has no attribute "send" [attr-defined]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:450: error: "None" has no attribute "stop" [attr-defined]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1/writer.py:470: error: Incompatible types in assignment (expression has type "Exception", variable has type "StreamClosedError") [assignment]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:28: error: Skipping analyzing "grpc": module is installed, but missing library stubs or py.typed marker [import-untyped]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:57: error: Incompatible return value type (got "BaseException", expected "Exception") [return-value]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:88: error: Need type annotation for "_close_callbacks" (hint: "_close_callbacks: list[<type>] = ...") [var-annotated]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:89: error: Need type annotation for "_futures_queue" [var-annotated]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:154: error: Incompatible types in assignment (expression has type "str", variable has type "None") [assignment]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:159: error: Incompatible types in assignment (expression has type "BidiRpc", variable has type "None") [assignment]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:173: error: "None" has no attribute "add_done_callback" [attr-defined]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:175: error: Incompatible types in assignment (expression has type "BackgroundConsumer", variable has type "None") [assignment]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:176: error: "None" has no attribute "start" [attr-defined]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:185: error: "None" has no attribute "is_active" [attr-defined]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:204: error: "None" has no attribute "is_active" [attr-defined]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:254: error: "None" has no attribute "send" [attr-defined]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:305: error: "None" has no attribute "stop" [attr-defined]
.nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/bigquery_storage_v1beta2/writer.py:326: error: Incompatible types in assignment (expression has type "Exception", variable has type "StreamClosedError") [assignment]
Found 36 errors in 4 files (checked 87 source files)
nox > Command mypy -p google failed with exit code 1
nox > Session mypy-3.14 failed.
```1 parent c5ee986 commit f2536aeCopy full SHA for f2536ae
6 files changed
+43-37Lines changed: 43 additions & 37 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- packages/google-cloud-bigquery-storage
- google/cloud
- bigquery_storage_v1beta2
- bigquery_storage_v1
- tests/unit
Expand file treeCollapse file tree
Open diff view settings
Collapse file
packages/google-cloud-bigquery-storage/google/cloud/bigquery_storage_v1/gapic_types.py
Copy file name to clipboardExpand all lines: packages/google-cloud-bigquery-storage/google/cloud/bigquery_storage_v1/gapic_types.py+2-1Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
22 | 22 | |
23 | 23 | |
24 | 24 | |
25 | | - |
| 25 | + |
| 26 | + |
26 | 27 | |
27 | 28 | |
28 | 29 | |
|
Collapse file
packages/google-cloud-bigquery-storage/google/cloud/bigquery_storage_v1/reader.py
Copy file name to clipboardExpand all lines: packages/google-cloud-bigquery-storage/google/cloud/bigquery_storage_v1/reader.py+7-9Lines changed: 7 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
22 | 22 | |
23 | 23 | |
24 | 24 | |
25 | | - |
| 25 | + |
26 | 26 | |
27 | | - |
| 27 | + |
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
| 32 | + |
37 | 33 | |
38 | 34 | |
39 | | - |
| 35 | + |
| 36 | + |
| 37 | + |
40 | 38 | |
41 | | - |
| 39 | + |
42 | 40 | |
43 | 41 | |
44 | 42 | |
|
Collapse file
packages/google-cloud-bigquery-storage/google/cloud/bigquery_storage_v1/writer.py
Copy file name to clipboardExpand all lines: packages/google-cloud-bigquery-storage/google/cloud/bigquery_storage_v1/writer.py+17-14Lines changed: 17 additions & 14 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
20 | 20 | |
21 | 21 | |
22 | 22 | |
23 | | - |
| 23 | + |
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | 27 | |
28 | | - |
| 28 | + |
29 | 29 | |
30 | 30 | |
31 | 31 | |
| ||
44 | 44 | |
45 | 45 | |
46 | 46 | |
47 | | - |
| 47 | + |
48 | 48 | |
49 | 49 | |
50 | 50 | |
| ||
109 | 109 | |
110 | 110 | |
111 | 111 | |
112 | | - |
| 112 | + |
113 | 113 | |
114 | 114 | |
115 | | - |
| 115 | + |
116 | 116 | |
117 | | - |
| 117 | + |
118 | 118 | |
119 | 119 | |
120 | 120 | |
| ||
156 | 156 | |
157 | 157 | |
158 | 158 | |
159 | | - |
| 159 | + |
160 | 160 | |
161 | 161 | |
162 | 162 | |
| ||
211 | 211 | |
212 | 212 | |
213 | 213 | |
214 | | - |
| 214 | + |
215 | 215 | |
216 | 216 | |
217 | 217 | |
| ||
254 | 254 | |
255 | 255 | |
256 | 256 | |
257 | | - |
258 | | - |
259 | | - |
260 | | - |
| 257 | + |
| 258 | + |
| 259 | + |
| 260 | + |
261 | 261 | |
262 | 262 | |
263 | 263 | |
| ||
429 | 429 | |
430 | 430 | |
431 | 431 | |
432 | | - |
| 432 | + |
| 433 | + |
433 | 434 | |
434 | 435 | |
435 | 436 | |
| ||
447 | 448 | |
448 | 449 | |
449 | 450 | |
450 | | - |
| 451 | + |
| 452 | + |
451 | 453 | |
452 | 454 | |
453 | 455 | |
| ||
462 | 464 | |
463 | 465 | |
464 | 466 | |
| 467 | + |
465 | 468 | |
466 | 469 | |
467 | 470 | |
|
Collapse file
packages/google-cloud-bigquery-storage/google/cloud/bigquery_storage_v1beta2/writer.py
Copy file name to clipboardExpand all lines: packages/google-cloud-bigquery-storage/google/cloud/bigquery_storage_v1beta2/writer.py+13-10Lines changed: 13 additions & 10 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
20 | 20 | |
21 | 21 | |
22 | 22 | |
23 | | - |
| 23 | + |
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | 27 | |
28 | | - |
| 28 | + |
29 | 29 | |
30 | 30 | |
31 | 31 | |
| ||
43 | 43 | |
44 | 44 | |
45 | 45 | |
46 | | - |
| 46 | + |
47 | 47 | |
48 | 48 | |
49 | 49 | |
| ||
85 | 85 | |
86 | 86 | |
87 | 87 | |
88 | | - |
89 | | - |
| 88 | + |
| 89 | + |
90 | 90 | |
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | 94 | |
95 | 95 | |
96 | | - |
97 | | - |
| 96 | + |
| 97 | + |
98 | 98 | |
99 | 99 | |
100 | | - |
| 100 | + |
101 | 101 | |
102 | 102 | |
103 | 103 | |
| ||
251 | 251 | |
252 | 252 | |
253 | 253 | |
254 | | - |
| 254 | + |
| 255 | + |
255 | 256 | |
256 | 257 | |
257 | 258 | |
| ||
302 | 303 | |
303 | 304 | |
304 | 305 | |
305 | | - |
| 306 | + |
| 307 | + |
306 | 308 | |
307 | 309 | |
308 | 310 | |
| ||
318 | 320 | |
319 | 321 | |
320 | 322 | |
| 323 | + |
321 | 324 | |
322 | 325 | |
323 | 326 | |
|
Collapse file
packages/google-cloud-bigquery-storage/noxfile.py
Copy file name to clipboardExpand all lines: packages/google-cloud-bigquery-storage/noxfile.py+2-1Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
112 | 112 | |
113 | 113 | |
114 | 114 | |
| 115 | + |
115 | 116 | |
116 | | - |
| 117 | + |
117 | 118 | |
118 | 119 | |
119 | 120 | |
|
Collapse file
packages/google-cloud-bigquery-storage/tests/unit/test_writer_v1.py
Copy file name to clipboardExpand all lines: packages/google-cloud-bigquery-storage/tests/unit/test_writer_v1.py+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
66 | 66 | |
67 | 67 | |
68 | 68 | |
69 | | - |
| 69 | + |
70 | 70 | |
71 | 71 | |
72 | 72 | |
| ||
229 | 229 | |
230 | 230 | |
231 | 231 | |
232 | | - |
| 232 | + |
233 | 233 | |
234 | 234 | |
235 | 235 | |
|
0 commit comments