Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1f4c286

Browse filesBrowse files
authored
fix: fix mypy errors (#15494)
Towards #15104 This is needed to unblock #15457 . See follow up issue googleapis/proto-plus-python#558 for the `prerelease` presubmit failure. See the following mypy failure for `google-cloud-monitoring` ``` 2026-01-16T21:21:02.1088102Z nox > Running session mypy-3.14 2026-01-16T21:21:02.1093302Z nox > Creating virtual environment (virtualenv) using python3.14 in .nox/mypy-3-14 2026-01-16T21:21:02.3445193Z nox > python -m pip install 'mypy<1.16.0' types-requests types-protobuf 2026-01-16T21:21:05.5617360Z nox > python -m pip install . 2026-01-16T21:21:10.8264379Z nox > mypy -p google 2026-01-16T21:21:26.4063416Z .nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/monitoring_v3/__init__.py:232: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked] 2026-01-16T21:21:26.4393843Z .nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/monitoring_v3/_dataframe.py:20: error: Library stubs not installed for "pandas" [import-untyped] 2026-01-16T21:21:26.4396224Z .nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/monitoring_v3/_dataframe.py:20: note: Hint: "python3 -m pip install pandas-stubs" 2026-01-16T21:21:26.4398337Z .nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/monitoring_v3/_dataframe.py:20: note: (or run "mypy --install-types" to install all missing stub packages) 2026-01-16T21:21:26.4400993Z .nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/monitoring_v3/_dataframe.py:20: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports ``` See the following mypy failure for `google-cloud-org-policy` ``` 2026-01-16T21:25:54.1998139Z nox > Running session mypy-3.14 2026-01-16T21:25:54.2002997Z nox > Creating virtual environment (virtualenv) using python3.14 in .nox/mypy-3-14 2026-01-16T21:25:54.4531153Z nox > python -m pip install 'mypy<1.16.0' types-requests types-protobuf 2026-01-16T21:25:57.9686970Z nox > python -m pip install . 2026-01-16T21:26:03.3150701Z nox > mypy -p google 2026-01-16T21:26:13.7960116Z .nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/orgpolicy/v1/__init__.py:26: error: Need type annotation for "names" (hint: "names: list[<type>] = ...") [var-annotated] ``` See the following mypy failure for `google-cloud-speech` ``` .nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/speech_v1p1beta1/__init__.py:131: 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/speech_v1p1beta1/__init__.py:172: error: Name "SpeechClient" already defined (possibly by an import) [no-redef] .nox/mypy-3-14/lib/python3.14/site-packages/google/cloud/speech_v1p1beta1/__init__.py:172: error: Definition of "streaming_recognize" in base class "SpeechHelpers" is incompatible with definition in base class "SpeechClient" [misc] ``` See the following failure for `google-cloud-vision` ``` 2026-01-16T21:48:11.3461545Z nox > mypy -p google 2026-01-16T21:48:23.0397649Z google/cloud/vision_helpers/__init__.py:18: error: Skipping analyzing "proto": module is installed, but missing library stubs or py.typed marker [import-untyped] 2026-01-16T21:48:23.0399910Z google/cloud/vision_helpers/__init__.py:18: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports ```
1 parent ca15a7e commit 1f4c286
Copy full SHA for 1f4c286

7 files changed

+40-21Lines changed: 40 additions & 21 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.librarian/generator-input/client-post-processing/integrate-isolated-handwritten-code.yaml‎

Copy file name to clipboardExpand all lines: .librarian/generator-input/client-post-processing/integrate-isolated-handwritten-code.yaml
+20-16Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ replacements:
131131
count: 1
132132
- paths: [
133133
packages/google-cloud-speech/google/cloud/speech_v1/__init__.py,
134+
packages/google-cloud-speech/google/cloud/speech_v1p1beta1/__init__.py,
134135
]
135136
before: |
136137
\)
@@ -140,24 +141,16 @@ replacements:
140141
)
141142
142143
from google.cloud.speech_v1.helpers import SpeechHelpers\n\n
143-
class SpeechClient(SpeechHelpers, SpeechClient):
144-
__doc__ = SpeechClient.__doc__\n\n
145-
__all__ = (
146-
count: 1
147-
- paths: [
148-
packages/google-cloud-speech/google/cloud/speech_v1p1beta1/__init__.py,
149-
]
150-
before: |
151-
\)\n
152-
__all__ = \(
153-
after: |
154-
)\n
155-
from google.cloud.speech_v1.helpers import SpeechHelpers
156-
\n
157-
class SpeechClient(SpeechHelpers, SpeechClient):
144+
# This class merges the auto-generated GAPIC client with handwritten helper methods.
145+
# We ignore [misc] because mypy is flagging that both parent classes have a method
146+
# named `streaming_recognize`,
147+
# but their type signatures don't match.
148+
# We ignore [no-redef] because of the name shadow with SpeechClient. We don't want
149+
# to expose the GAPIC client without the helpers.
150+
class SpeechClient(SpeechHelpers, SpeechClient): # type: ignore[no-redef, misc]
158151
__doc__ = SpeechClient.__doc__\n\n
159152
__all__ = (
160-
count: 1
153+
count: 2
161154
- paths: [
162155
packages/google-cloud-speech/google/cloud/speech/__init__.py,
163156
]
@@ -301,3 +294,14 @@ replacements:
301294
"pandas-stubs",
302295
)
303296
count: 1
297+
- paths: [
298+
packages/google-cloud-monitoring/noxfile.py,
299+
]
300+
before: |
301+
"types-protobuf",
302+
\ \)
303+
after: |
304+
"types-protobuf",
305+
"pandas-stubs",
306+
)
307+
count: 1
Collapse file

‎packages/google-cloud-monitoring/google/cloud/monitoring_v3/_dataframe.py‎

Copy file name to clipboardExpand all lines: packages/google-cloud-monitoring/google/cloud/monitoring_v3/_dataframe.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
try:
2020
import pandas
2121
except ImportError: # pragma: NO COVER
22-
pandas = None
22+
pandas = None # type: ignore[assignment]
2323

2424
from google.cloud import monitoring_v3
2525

Collapse file

‎packages/google-cloud-monitoring/noxfile.py‎

Copy file name to clipboardExpand all lines: packages/google-cloud-monitoring/noxfile.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def mypy(session):
101101
"mypy<1.16.0",
102102
"types-requests",
103103
"types-protobuf",
104+
"pandas-stubs",
104105
)
105106
session.install(".")
106107
session.run(
Collapse file

‎packages/google-cloud-org-policy/google/cloud/orgpolicy/v1/__init__.py‎

Copy file name to clipboardExpand all lines: packages/google-cloud-org-policy/google/cloud/orgpolicy/v1/__init__.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717

1818
from __future__ import absolute_import
1919

20+
from typing import List
21+
2022
from google.api_core.protobuf_helpers import get_messages
2123

2224
from google.cloud.orgpolicy.v1 import orgpolicy_pb2
2325

2426
_modules = [orgpolicy_pb2]
2527

26-
names = []
28+
names: List[str] = []
2729

2830
for module in _modules:
2931
for name, message in get_messages(module).items():
Collapse file

‎packages/google-cloud-speech/google/cloud/speech_v1/__init__.py‎

Copy file name to clipboardExpand all lines: packages/google-cloud-speech/google/cloud/speech_v1/__init__.py
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,13 @@ def _get_version(dependency_name):
169169
from google.cloud.speech_v1.helpers import SpeechHelpers
170170

171171

172-
class SpeechClient(SpeechHelpers, SpeechClient):
172+
# This class merges the auto-generated GAPIC client with handwritten helper methods.
173+
# We ignore [misc] because mypy is flagging that both parent classes have a method
174+
# named `streaming_recognize`,
175+
# but their type signatures don't match.
176+
# We ignore [no-redef] because of the name shadow with SpeechClient. We don't want
177+
# to expose the GAPIC client without the helpers.
178+
class SpeechClient(SpeechHelpers, SpeechClient): # type: ignore[no-redef, misc]
173179
__doc__ = SpeechClient.__doc__
174180

175181

Collapse file

‎packages/google-cloud-speech/google/cloud/speech_v1p1beta1/__init__.py‎

Copy file name to clipboardExpand all lines: packages/google-cloud-speech/google/cloud/speech_v1p1beta1/__init__.py
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,13 @@ def _get_version(dependency_name):
169169
from google.cloud.speech_v1.helpers import SpeechHelpers
170170

171171

172-
class SpeechClient(SpeechHelpers, SpeechClient):
172+
# This class merges the auto-generated GAPIC client with handwritten helper methods.
173+
# We ignore [misc] because mypy is flagging that both parent classes have a method
174+
# named `streaming_recognize`,
175+
# but their type signatures don't match.
176+
# We ignore [no-redef] because of the name shadow with SpeechClient. We don't want
177+
# to expose the GAPIC client without the helpers.
178+
class SpeechClient(SpeechHelpers, SpeechClient): # type: ignore[no-redef, misc]
173179
__doc__ = SpeechClient.__doc__
174180

175181

Collapse file

‎packages/google-cloud-vision/google/cloud/vision_helpers/__init__.py‎

Copy file name to clipboardExpand all lines: packages/google-cloud-vision/google/cloud/vision_helpers/__init__.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from __future__ import absolute_import
1616

1717
from google.api_core import protobuf_helpers as protobuf
18-
import proto
18+
import proto # type: ignore
1919

2020

2121
class VisionHelpers(object):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.