Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

Commit ff43aa0

Browse files
chore: use gapic-generator-python 0.53.4 (#52)
- [ ] Regenerate this pull request now. docs: list oneofs in docstring fix(deps): require google-api-core >= 1.28.0 fix(deps): drop packaging dependency committer: busunkim96@ PiperOrigin-RevId: 406468269 Source-Link: googleapis/googleapis@83d81b0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2ff001fbacb9e77e71d734de5f955c05fdae8526 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmZmMDAxZmJhY2I5ZTc3ZTcxZDczNGRlNWY5NTVjMDVmZGFlODUyNiJ9
1 parent ffacc6b commit ff43aa0

File tree

8 files changed

+40
-146
lines changed

8 files changed

+40
-146
lines changed

google/cloud/shell_v1/services/cloud_shell_service/async_client.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@
1919
from typing import Dict, Sequence, Tuple, Type, Union
2020
import pkg_resources
2121

22-
import google.api_core.client_options as ClientOptions # type: ignore
22+
from google.api_core.client_options import ClientOptions # type: ignore
2323
from google.api_core import exceptions as core_exceptions # type: ignore
2424
from google.api_core import gapic_v1 # type: ignore
2525
from google.api_core import retry as retries # type: ignore
2626
from google.auth import credentials as ga_credentials # type: ignore
2727
from google.oauth2 import service_account # type: ignore
2828

29+
OptionalRetry = Union[retries.Retry, object]
30+
2931
from google.api_core import operation # type: ignore
3032
from google.api_core import operation_async # type: ignore
3133
from google.cloud.shell_v1.types import cloudshell
@@ -174,18 +176,18 @@ def __init__(
174176

175177
async def get_environment(
176178
self,
177-
request: cloudshell.GetEnvironmentRequest = None,
179+
request: Union[cloudshell.GetEnvironmentRequest, dict] = None,
178180
*,
179181
name: str = None,
180-
retry: retries.Retry = gapic_v1.method.DEFAULT,
182+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
181183
timeout: float = None,
182184
metadata: Sequence[Tuple[str, str]] = (),
183185
) -> cloudshell.Environment:
184186
r"""Gets an environment. Returns NOT_FOUND if the environment does
185187
not exist.
186188
187189
Args:
188-
request (:class:`google.cloud.shell_v1.types.GetEnvironmentRequest`):
190+
request (Union[google.cloud.shell_v1.types.GetEnvironmentRequest, dict]):
189191
The request object. Request message for
190192
[GetEnvironment][google.cloud.shell.v1.CloudShellService.GetEnvironment].
191193
name (:class:`str`):
@@ -262,9 +264,9 @@ async def get_environment(
262264

263265
async def start_environment(
264266
self,
265-
request: cloudshell.StartEnvironmentRequest = None,
267+
request: Union[cloudshell.StartEnvironmentRequest, dict] = None,
266268
*,
267-
retry: retries.Retry = gapic_v1.method.DEFAULT,
269+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
268270
timeout: float = None,
269271
metadata: Sequence[Tuple[str, str]] = (),
270272
) -> operation_async.AsyncOperation:
@@ -278,7 +280,7 @@ async def start_environment(
278280
StartEnvironmentResponse in its response field.
279281
280282
Args:
281-
request (:class:`google.cloud.shell_v1.types.StartEnvironmentRequest`):
283+
request (Union[google.cloud.shell_v1.types.StartEnvironmentRequest, dict]):
282284
The request object. Request message for
283285
[StartEnvironment][google.cloud.shell.v1.CloudShellService.StartEnvironment].
284286
retry (google.api_core.retry.Retry): Designation of what errors, if any,
@@ -329,9 +331,9 @@ async def start_environment(
329331

330332
async def authorize_environment(
331333
self,
332-
request: cloudshell.AuthorizeEnvironmentRequest = None,
334+
request: Union[cloudshell.AuthorizeEnvironmentRequest, dict] = None,
333335
*,
334-
retry: retries.Retry = gapic_v1.method.DEFAULT,
336+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
335337
timeout: float = None,
336338
metadata: Sequence[Tuple[str, str]] = (),
337339
) -> operation_async.AsyncOperation:
@@ -342,7 +344,7 @@ async def authorize_environment(
342344
authenticate.
343345
344346
Args:
345-
request (:class:`google.cloud.shell_v1.types.AuthorizeEnvironmentRequest`):
347+
request (Union[google.cloud.shell_v1.types.AuthorizeEnvironmentRequest, dict]):
346348
The request object. Request message for
347349
[AuthorizeEnvironment][google.cloud.shell.v1.CloudShellService.AuthorizeEnvironment].
348350
retry (google.api_core.retry.Retry): Designation of what errors, if any,
@@ -392,9 +394,9 @@ async def authorize_environment(
392394

393395
async def add_public_key(
394396
self,
395-
request: cloudshell.AddPublicKeyRequest = None,
397+
request: Union[cloudshell.AddPublicKeyRequest, dict] = None,
396398
*,
397-
retry: retries.Retry = gapic_v1.method.DEFAULT,
399+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
398400
timeout: float = None,
399401
metadata: Sequence[Tuple[str, str]] = (),
400402
) -> operation_async.AsyncOperation:
@@ -404,7 +406,7 @@ async def add_public_key(
404406
error with ALREADY_EXISTS.
405407
406408
Args:
407-
request (:class:`google.cloud.shell_v1.types.AddPublicKeyRequest`):
409+
request (Union[google.cloud.shell_v1.types.AddPublicKeyRequest, dict]):
408410
The request object. Request message for
409411
[AddPublicKey][google.cloud.shell.v1.CloudShellService.AddPublicKey].
410412
retry (google.api_core.retry.Retry): Designation of what errors, if any,
@@ -456,9 +458,9 @@ async def add_public_key(
456458

457459
async def remove_public_key(
458460
self,
459-
request: cloudshell.RemovePublicKeyRequest = None,
461+
request: Union[cloudshell.RemovePublicKeyRequest, dict] = None,
460462
*,
461-
retry: retries.Retry = gapic_v1.method.DEFAULT,
463+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
462464
timeout: float = None,
463465
metadata: Sequence[Tuple[str, str]] = (),
464466
) -> operation_async.AsyncOperation:
@@ -468,7 +470,7 @@ async def remove_public_key(
468470
present, this will error with NOT_FOUND.
469471
470472
Args:
471-
request (:class:`google.cloud.shell_v1.types.RemovePublicKeyRequest`):
473+
request (Union[google.cloud.shell_v1.types.RemovePublicKeyRequest, dict]):
472474
The request object. Request message for
473475
[RemovePublicKey][google.cloud.shell.v1.CloudShellService.RemovePublicKey].
474476
retry (google.api_core.retry.Retry): Designation of what errors, if any,

google/cloud/shell_v1/services/cloud_shell_service/client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
from google.auth.exceptions import MutualTLSChannelError # type: ignore
3131
from google.oauth2 import service_account # type: ignore
3232

33+
OptionalRetry = Union[retries.Retry, object]
34+
3335
from google.api_core import operation # type: ignore
3436
from google.api_core import operation_async # type: ignore
3537
from google.cloud.shell_v1.types import cloudshell
@@ -360,7 +362,7 @@ def get_environment(
360362
request: Union[cloudshell.GetEnvironmentRequest, dict] = None,
361363
*,
362364
name: str = None,
363-
retry: retries.Retry = gapic_v1.method.DEFAULT,
365+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
364366
timeout: float = None,
365367
metadata: Sequence[Tuple[str, str]] = (),
366368
) -> cloudshell.Environment:
@@ -438,7 +440,7 @@ def start_environment(
438440
self,
439441
request: Union[cloudshell.StartEnvironmentRequest, dict] = None,
440442
*,
441-
retry: retries.Retry = gapic_v1.method.DEFAULT,
443+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
442444
timeout: float = None,
443445
metadata: Sequence[Tuple[str, str]] = (),
444446
) -> operation.Operation:
@@ -506,7 +508,7 @@ def authorize_environment(
506508
self,
507509
request: Union[cloudshell.AuthorizeEnvironmentRequest, dict] = None,
508510
*,
509-
retry: retries.Retry = gapic_v1.method.DEFAULT,
511+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
510512
timeout: float = None,
511513
metadata: Sequence[Tuple[str, str]] = (),
512514
) -> operation.Operation:
@@ -570,7 +572,7 @@ def add_public_key(
570572
self,
571573
request: Union[cloudshell.AddPublicKeyRequest, dict] = None,
572574
*,
573-
retry: retries.Retry = gapic_v1.method.DEFAULT,
575+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
574576
timeout: float = None,
575577
metadata: Sequence[Tuple[str, str]] = (),
576578
) -> operation.Operation:
@@ -635,7 +637,7 @@ def remove_public_key(
635637
self,
636638
request: Union[cloudshell.RemovePublicKeyRequest, dict] = None,
637639
*,
638-
retry: retries.Retry = gapic_v1.method.DEFAULT,
640+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
639641
timeout: float = None,
640642
metadata: Sequence[Tuple[str, str]] = (),
641643
) -> operation.Operation:

google/cloud/shell_v1/services/cloud_shell_service/transports/base.py

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#
1616
import abc
1717
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18-
import packaging.version
1918
import pkg_resources
2019

2120
import google.auth # type: ignore
@@ -37,15 +36,6 @@
3736
except pkg_resources.DistributionNotFound:
3837
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
3938

40-
try:
41-
# google.auth.__version__ was added in 1.26.0
42-
_GOOGLE_AUTH_VERSION = google.auth.__version__
43-
except AttributeError:
44-
try: # try pkg_resources if it is available
45-
_GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version
46-
except pkg_resources.DistributionNotFound: # pragma: NO COVER
47-
_GOOGLE_AUTH_VERSION = None
48-
4939

5040
class CloudShellServiceTransport(abc.ABC):
5141
"""Abstract transport class for CloudShellService."""
@@ -95,7 +85,7 @@ def __init__(
9585
host += ":443"
9686
self._host = host
9787

98-
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
88+
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9989

10090
# Save the scopes.
10191
self._scopes = scopes
@@ -128,29 +118,6 @@ def __init__(
128118
# Save the credentials.
129119
self._credentials = credentials
130120

131-
# TODO(busunkim): This method is in the base transport
132-
# to avoid duplicating code across the transport classes. These functions
133-
# should be deleted once the minimum required versions of google-auth is increased.
134-
135-
# TODO: Remove this function once google-auth >= 1.25.0 is required
136-
@classmethod
137-
def _get_scopes_kwargs(
138-
cls, host: str, scopes: Optional[Sequence[str]]
139-
) -> Dict[str, Optional[Sequence[str]]]:
140-
"""Returns scopes kwargs to pass to google-auth methods depending on the google-auth version"""
141-
142-
scopes_kwargs = {}
143-
144-
if _GOOGLE_AUTH_VERSION and (
145-
packaging.version.parse(_GOOGLE_AUTH_VERSION)
146-
>= packaging.version.parse("1.25.0")
147-
):
148-
scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES}
149-
else:
150-
scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES}
151-
152-
return scopes_kwargs
153-
154121
def _prep_wrapped_messages(self, client_info):
155122
# Precompute the wrapped methods.
156123
self._wrapped_methods = {
@@ -194,7 +161,7 @@ def close(self):
194161
raise NotImplementedError()
195162

196163
@property
197-
def operations_client(self) -> operations_v1.OperationsClient:
164+
def operations_client(self):
198165
"""Return the client designed to process long-running operations."""
199166
raise NotImplementedError()
200167

google/cloud/shell_v1/services/cloud_shell_service/transports/grpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __init__(
119119
self._grpc_channel = None
120120
self._ssl_channel_credentials = ssl_channel_credentials
121121
self._stubs: Dict[str, Callable] = {}
122-
self._operations_client = None
122+
self._operations_client: Optional[operations_v1.OperationsClient] = None
123123

124124
if api_mtls_endpoint:
125125
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)

google/cloud/shell_v1/services/cloud_shell_service/transports/grpc_asyncio.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from google.api_core import operations_v1 # type: ignore
2222
from google.auth import credentials as ga_credentials # type: ignore
2323
from google.auth.transport.grpc import SslCredentials # type: ignore
24-
import packaging.version
2524

2625
import grpc # type: ignore
2726
from grpc.experimental import aio # type: ignore
@@ -166,7 +165,7 @@ def __init__(
166165
self._grpc_channel = None
167166
self._ssl_channel_credentials = ssl_channel_credentials
168167
self._stubs: Dict[str, Callable] = {}
169-
self._operations_client = None
168+
self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
170169

171170
if api_mtls_endpoint:
172171
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@
2929
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
3030
# Until this issue is closed
3131
# https://github.com/googleapis/google-cloud-python/issues/10566
32-
"google-api-core[grpc] >= 1.26.0, <3.0.0dev",
32+
"google-api-core[grpc] >= 1.28.0, <3.0.0dev",
3333
"proto-plus >= 1.15.0",
34-
"packaging >= 14.3",
3534
]
3635

3736
package_root = os.path.abspath(os.path.dirname(__file__))

testing/constraints-3.6.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,5 @@
55
#
66
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
77
# Then this file should have foo==1.14.0
8-
google-api-core==1.26.0
8+
google-api-core==1.28.0
99
proto-plus==1.15.0
10-
packaging==14.3
11-
google-auth==1.24.0 # TODO: remove when google-auth>=1.25.0 is transitively required through google-auth

0 commit comments

Comments
 (0)