Skip to content

Commit 413f8fa

Browse files
chore(types): fix mypy checks (#2520)
1 parent d20dd28 commit 413f8fa

File tree

21 files changed

+60
-73
lines changed
  • gapic
    • ads-templates/%namespace/%name/%version/%sub/services/%service/transports
    • templates
  • tests/integration/goldens
    • asset
    • credentials
      • google/iam/credentials_v1/services/iam_credentials/transports
    • eventarc
    • logging_internal
      • google/cloud/logging_v2/services
        • config_service_v2/transports
        • logging_service_v2/transports
        • metrics_service_v2/transports
    • logging
      • google/cloud/logging_v2/services
        • config_service_v2/transports
        • logging_service_v2/transports
        • metrics_service_v2/transports
    • redis_selective
    • redis

21 files changed

+60
-73
lines changed

gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/base.py.j2

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ class {{ service.name }}Transport(abc.ABC):
9898
host += ':443'
9999
self._host = host
100100

101-
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
102-
103101
# Save the scopes.
104102
self._scopes = scopes
105103

@@ -114,11 +112,12 @@ class {{ service.name }}Transport(abc.ABC):
114112
if credentials_file is not None:
115113
credentials, _ = google.auth.load_credentials_from_file(
116114
credentials_file,
117-
**scopes_kwargs,
118-
quota_project_id=quota_project_id
115+
scopes=scopes,
116+
quota_project_id=quota_project_id,
117+
default_scopes=self.AUTH_SCOPES,
119118
)
120119
elif credentials is None and not self._ignore_credentials:
121-
credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id)
120+
credentials, _ = google.auth.default(scopes=scopes, quota_project_id=quota_project_id, default_scopes=self.AUTH_SCOPES)
122121

123122
# If the credentials are service account credentials, then always try to use self signed JWT.
124123
if always_use_jwt_access and isinstance(credentials, service_account.Credentials) and hasattr(service_account.Credentials, "with_always_use_jwt_access"):

gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/base.py.j2

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ class {{ service.name }}Transport(abc.ABC):
108108
self._extended_operations_services: Dict[str, Any] = {}
109109
{% endif %}
110110

111-
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
112-
113111
# Save the scopes.
114112
self._scopes = scopes
115113
if not hasattr(self, "_ignore_credentials"):
@@ -123,11 +121,12 @@ class {{ service.name }}Transport(abc.ABC):
123121
if credentials_file is not None:
124122
credentials, _ = google.auth.load_credentials_from_file(
125123
credentials_file,
126-
**scopes_kwargs,
127-
quota_project_id=quota_project_id
124+
scopes=scopes,
125+
quota_project_id=quota_project_id,
126+
default_scopes=self.AUTH_SCOPES,
128127
)
129128
elif credentials is None and not self._ignore_credentials:
130-
credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id)
129+
credentials, _ = google.auth.default(scopes=scopes, quota_project_id=quota_project_id, default_scopes=self.AUTH_SCOPES)
131130
# Don't apply audience if the credentials file passed from user.
132131
if hasattr(credentials, "with_gdch_audience"):
133132
credentials = credentials.with_gdch_audience(api_audience if api_audience else host)

gapic/templates/mypy.ini.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[mypy]
2-
python_version = 3.7
2+
python_version = 3.14
33
namespace_packages = True

tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/base.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ def __init__(
8585
be used for service account credentials.
8686
"""
8787

88-
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
89-
9088
# Save the scopes.
9189
self._scopes = scopes
9290
if not hasattr(self, "_ignore_credentials"):
@@ -100,11 +98,12 @@ def __init__(
10098
if credentials_file is not None:
10199
credentials, _ = google.auth.load_credentials_from_file(
102100
credentials_file,
103-
**scopes_kwargs,
104-
quota_project_id=quota_project_id
101+
scopes=scopes,
102+
quota_project_id=quota_project_id,
103+
default_scopes=self.AUTH_SCOPES,
105104
)
106105
elif credentials is None and not self._ignore_credentials:
107-
credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id)
106+
credentials, _ = google.auth.default(scopes=scopes, quota_project_id=quota_project_id, default_scopes=self.AUTH_SCOPES)
108107
# Don't apply audience if the credentials file passed from user.
109108
if hasattr(credentials, "with_gdch_audience"):
110109
credentials = credentials.with_gdch_audience(api_audience if api_audience else host)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[mypy]
2-
python_version = 3.7
2+
python_version = 3.14
33
namespace_packages = True

tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/base.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ def __init__(
8282
be used for service account credentials.
8383
"""
8484

85-
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
86-
8785
# Save the scopes.
8886
self._scopes = scopes
8987
if not hasattr(self, "_ignore_credentials"):
@@ -97,11 +95,12 @@ def __init__(
9795
if credentials_file is not None:
9896
credentials, _ = google.auth.load_credentials_from_file(
9997
credentials_file,
100-
**scopes_kwargs,
101-
quota_project_id=quota_project_id
98+
scopes=scopes,
99+
quota_project_id=quota_project_id,
100+
default_scopes=self.AUTH_SCOPES,
102101
)
103102
elif credentials is None and not self._ignore_credentials:
104-
credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id)
103+
credentials, _ = google.auth.default(scopes=scopes, quota_project_id=quota_project_id, default_scopes=self.AUTH_SCOPES)
105104
# Don't apply audience if the credentials file passed from user.
106105
if hasattr(credentials, "with_gdch_audience"):
107106
credentials = credentials.with_gdch_audience(api_audience if api_audience else host)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[mypy]
2-
python_version = 3.7
2+
python_version = 3.14
33
namespace_packages = True

tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/base.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ def __init__(
9393
be used for service account credentials.
9494
"""
9595

96-
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
97-
9896
# Save the scopes.
9997
self._scopes = scopes
10098
if not hasattr(self, "_ignore_credentials"):
@@ -108,11 +106,12 @@ def __init__(
108106
if credentials_file is not None:
109107
credentials, _ = google.auth.load_credentials_from_file(
110108
credentials_file,
111-
**scopes_kwargs,
112-
quota_project_id=quota_project_id
109+
scopes=scopes,
110+
quota_project_id=quota_project_id,
111+
default_scopes=self.AUTH_SCOPES,
113112
)
114113
elif credentials is None and not self._ignore_credentials:
115-
credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id)
114+
credentials, _ = google.auth.default(scopes=scopes, quota_project_id=quota_project_id, default_scopes=self.AUTH_SCOPES)
116115
# Don't apply audience if the credentials file passed from user.
117116
if hasattr(credentials, "with_gdch_audience"):
118117
credentials = credentials.with_gdch_audience(api_audience if api_audience else host)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[mypy]
2-
python_version = 3.7
2+
python_version = 3.14
33
namespace_packages = True

tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/base.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ def __init__(
8888
be used for service account credentials.
8989
"""
9090

91-
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
92-
9391
# Save the scopes.
9492
self._scopes = scopes
9593
if not hasattr(self, "_ignore_credentials"):
@@ -103,11 +101,12 @@ def __init__(
103101
if credentials_file is not None:
104102
credentials, _ = google.auth.load_credentials_from_file(
105103
credentials_file,
106-
**scopes_kwargs,
107-
quota_project_id=quota_project_id
104+
scopes=scopes,
105+
quota_project_id=quota_project_id,
106+
default_scopes=self.AUTH_SCOPES,
108107
)
109108
elif credentials is None and not self._ignore_credentials:
110-
credentials, _ = google.auth.default(**scopes_kwargs, quota_project_id=quota_project_id)
109+
credentials, _ = google.auth.default(scopes=scopes, quota_project_id=quota_project_id, default_scopes=self.AUTH_SCOPES)
111110
# Don't apply audience if the credentials file passed from user.
112111
if hasattr(credentials, "with_gdch_audience"):
113112
credentials = credentials.with_gdch_audience(api_audience if api_audience else host)

0 commit comments

Comments
 (0)