Skip to content

Commit e228340

Browse files
senecameekspavoljuhas
authored andcommitted
Make implicit Optional type hints in Quantum Engine PEP 484 compliant (#6640)
* implicit optional type hints PEP 484 compliant * rm type ignore * add type ignore back * mypy
1 parent 9bf365e commit e228340

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/async_client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from google.api_core import gapic_v1
3535
from google.api_core import retry as retries
3636
from google.auth import credentials as ga_credentials
37-
from google.oauth2 import service_account # type: ignore
37+
from google.oauth2 import service_account
3838

3939
try:
4040
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -172,7 +172,7 @@ def transport(self) -> QuantumEngineServiceTransport:
172172
def __init__(
173173
self,
174174
*,
175-
credentials: ga_credentials.Credentials = None,
175+
credentials: Optional[ga_credentials.Credentials] = None,
176176
transport: Union[str, QuantumEngineServiceTransport] = "grpc_asyncio",
177177
client_options: Optional[ClientOptions] = None,
178178
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,

cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from google.auth.transport import mtls
2828
from google.auth.transport.grpc import SslCredentials
2929
from google.auth.exceptions import MutualTLSChannelError
30-
from google.oauth2 import service_account # type: ignore
30+
from google.oauth2 import service_account
3131

3232
try:
3333
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]

cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from google.api_core import gapic_v1
2424
from google.api_core import retry as retries
2525
from google.auth import credentials as ga_credentials
26-
from google.oauth2 import service_account # type: ignore
26+
from google.oauth2 import service_account
2727

2828
from cirq_google.cloud.quantum_v1alpha1.types import engine
2929
from cirq_google.cloud.quantum_v1alpha1.types import quantum
@@ -48,7 +48,7 @@ def __init__(
4848
self,
4949
*,
5050
host: str = DEFAULT_HOST,
51-
credentials: ga_credentials.Credentials = None,
51+
credentials: Optional[ga_credentials.Credentials] = None,
5252
credentials_file: Optional[str] = None,
5353
scopes: Optional[Sequence[str]] = None,
5454
quota_project_id: Optional[str] = None,

cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/grpc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __init__(
120120

121121
if channel:
122122
# Ignore credentials if a channel was passed.
123-
credentials = False
123+
credentials = None
124124
# If a channel was explicitly provided, set it.
125125
self._grpc_channel = channel
126126
self._ssl_channel_credentials = None

cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/grpc_asyncio.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class QuantumEngineServiceGrpcAsyncIOTransport(QuantumEngineServiceTransport):
5151
def create_channel(
5252
cls,
5353
host: str = 'quantum.googleapis.com',
54-
credentials: ga_credentials.Credentials = None,
54+
credentials: Optional[ga_credentials.Credentials] = None,
5555
credentials_file: Optional[str] = None,
5656
scopes: Optional[Sequence[str]] = None,
5757
quota_project_id: Optional[str] = None,
@@ -94,7 +94,7 @@ def __init__(
9494
self,
9595
*,
9696
host: str = 'quantum.googleapis.com',
97-
credentials: ga_credentials.Credentials = None,
97+
credentials: Optional[ga_credentials.Credentials] = None,
9898
credentials_file: Optional[str] = None,
9999
scopes: Optional[Sequence[str]] = None,
100100
channel: Optional[aio.Channel] = None,
@@ -166,7 +166,7 @@ def __init__(
166166

167167
if channel:
168168
# Ignore credentials if a channel was passed.
169-
credentials = False
169+
credentials = None
170170
# If a channel was explicitly provided, set it.
171171
self._grpc_channel = channel
172172
self._ssl_channel_credentials = None

0 commit comments

Comments
 (0)