quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.28k stars 1.02k forks source link

Type errors in quantum engine api code #6638

Closed maffoo closed 5 months ago

maffoo commented 5 months ago

CI failed on https://github.com/quantumlib/Cirq/pull/6637 due to type errors in quantum engine service code, even though the PR did not touch any of this code:

cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/base.py:26: error: Unused "type: ignore" comment
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/base.py:51: error: Incompatible default for argument "credentials" (default has type "None", argument has type "Credentials")  [assignment]
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/base.py:51: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/base.py:51: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/grpc.py:1[23](https://github.com/quantumlib/Cirq/actions/runs/9411740279/job/25925500812?pr=6637#step:5:24): error: Incompatible types in assignment (expression has type "bool", variable has type "Optional[Credentials]")  [assignment]
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/grpc.py:152: error: Argument "credentials" to "__init__" of "QuantumEngineServiceTransport" has incompatible type "Optional[Credentials]"; expected "Credentials"  [arg-type]
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/grpc_asyncio.py:54: error: Incompatible default for argument "credentials" (default has type "None", argument has type "Credentials")  [assignment]
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/grpc_asyncio.py:54: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/grpc_asyncio.py:54: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/grpc_asyncio.py:97: error: Incompatible default for argument "credentials" (default has type "None", argument has type "Credentials")  [assignment]
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/grpc_asyncio.py:97: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/grpc_asyncio.py:97: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/transports/grpc_asyncio.py:169: error: Incompatible types in assignment (expression has type "bool", variable has type "Credentials")  [assignment]
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/client.py:30: error: Unused "type: ignore" comment
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/client.py:411: error: Argument "credentials" to "QuantumEngineServiceTransport" has incompatible type "Optional[Credentials]"; expected "Credentials"  [arg-type]
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/async_client.py:37: error: Unused "type: ignore" comment
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/async_client.py:175: error: Incompatible default for argument "credentials" (default has type "None", argument has type "Credentials")  [assignment]
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/async_client.py:175: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
cirq-google/cirq_google/cloud/quantum_v1alpha1/services/quantum_engine_service/async_client.py:175: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
Found 11 errors in 5 files (checked 1106 source files)

Full CI logs are here: https://github.com/quantumlib/Cirq/actions/runs/9411740279/job/25925500812?pr=6637