# Copyright 2020 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for EngineClient."""
import datetime
from unittest import mock
import pytest
from google.api_core import exceptions
from google.protobuf.field_mask_pb2 import FieldMask
from google.protobuf.timestamp_pb2 import Timestamp
from cirq.google.engine.engine_client import EngineClient, EngineException
from cirq.google.engine.client import quantum
from cirq.google.engine.client.quantum_v1alpha1 import enums as qenums
from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes


def setup_mock_(client_constructor):
    grpc_client = mock.Mock()
    client_constructor.return_value = grpc_client
    return grpc_client


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_create_program(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    result = qtypes.QuantumProgram(name='projects/proj/programs/prog')
    grpc_client.create_quantum_program.return_value = result

    code = qtypes.any_pb2.Any()
    labels = {'hello': 'world'}
    client = EngineClient()
    assert client.create_program('proj', 'prog', code, 'A program',
                                 labels) == ('prog', result)
    assert grpc_client.create_quantum_program.call_args[0] == (
        'projects/proj',
        qtypes.QuantumProgram(name='projects/proj/programs/prog',
                              code=code,
                              description='A program',
                              labels=labels), False)

    assert client.create_program('proj', 'prog', code,
                                 'A program') == ('prog', result)
    assert grpc_client.create_quantum_program.call_args[0] == (
        'projects/proj',
        qtypes.QuantumProgram(name='projects/proj/programs/prog',
                              code=code,
                              description='A program'), False)

    assert client.create_program('proj', 'prog', code,
                                 labels=labels) == ('prog', result)
    assert grpc_client.create_quantum_program.call_args[0] == (
        'projects/proj',
        qtypes.QuantumProgram(name='projects/proj/programs/prog',
                              code=code,
                              labels=labels), False)

    assert client.create_program('proj', 'prog', code) == ('prog', result)
    assert grpc_client.create_quantum_program.call_args[0] == (
        'projects/proj',
        qtypes.QuantumProgram(name='projects/proj/programs/prog',
                              code=code), False)

    assert client.create_program('proj', program_id=None,
                                 code=code) == ('prog', result)
    assert grpc_client.create_quantum_program.call_args[0] == (
        'projects/proj', qtypes.QuantumProgram(code=code), False)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_get_program(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    result = qtypes.QuantumProgram(name='projects/proj/programs/prog')
    grpc_client.get_quantum_program.return_value = result

    client = EngineClient()
    assert client.get_program('proj', 'prog', False) == result
    assert grpc_client.get_quantum_program.call_args[0] == (
        'projects/proj/programs/prog', False)

    assert client.get_program('proj', 'prog', True) == result
    assert grpc_client.get_quantum_program.call_args[0] == (
        'projects/proj/programs/prog', True)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_list_program(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    results = [
        qtypes.QuantumProgram(name='projects/proj/programs/prog1'),
        qtypes.QuantumProgram(name='projects/proj/programs/prog2')
    ]
    grpc_client.list_quantum_programs.return_value = results

    client = EngineClient()
    assert client.list_programs(project_id='proj') == results
    assert grpc_client.list_quantum_programs.call_args[0] == ('projects/proj',)
    assert grpc_client.list_quantum_programs.call_args[1] == {
        'filter_': '',
    }


# yapf: disable
@pytest.mark.parametrize(
    'expected_filter, created_after, created_before, labels',
    [
        ('',
            None,
            None,
            None),
        ('create_time >= 2020-09-01',
            datetime.date(2020, 9, 1),
            None,
            None),
        ('create_time >= 1598918400',
            datetime.datetime(2020, 9, 1, 0, 0, 0,
                              tzinfo=datetime.timezone.utc),
            None,
            None),
        ('create_time <= 2020-10-01',
            None,
            datetime.date(2020, 10, 1),
            None),
        ('create_time >= 2020-09-01 AND create_time <= 1598918410',
            datetime.date(2020, 9, 1),
            datetime.datetime(2020, 9, 1, 0, 0, 10,
                            tzinfo=datetime.timezone.utc),
            None),
        ('labels.color:red AND labels.shape:*',
            None,
            None,
            {
            'color': 'red',
            'shape': '*'
            },
        ),
        ('create_time >= 2020-08-01 AND '
         'create_time <= 1598918400 AND '
         'labels.color:red AND labels.shape:*',
            datetime.date(2020, 8, 1),
            datetime.datetime(2020, 9, 1, tzinfo=datetime.timezone.utc),
            {
            'color': 'red',
            'shape': '*'
            },
        ),
    ])
# yapf: enable
@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_list_program_filters(client_constructor, expected_filter,
                              created_before, created_after, labels):
    grpc_client = setup_mock_(client_constructor)
    client = EngineClient()
    client.list_programs(project_id='proj',
                         created_before=created_before,
                         created_after=created_after,
                         has_labels=labels)
    assert grpc_client.list_quantum_programs.call_args[1] == {
        'filter_': expected_filter,
    }


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_list_program_filters_invalid_type(client_constructor):
    with pytest.raises(ValueError, match=""):
        EngineClient().list_programs(project_id='proj',
                                     created_before="Unsupported date/time")


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_set_program_description(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    result = qtypes.QuantumProgram(name='projects/proj/programs/prog')
    grpc_client.update_quantum_program.return_value = result

    client = EngineClient()
    assert client.set_program_description('proj', 'prog', 'A program') == result
    assert grpc_client.update_quantum_program.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumProgram(name='projects/proj/programs/prog',
                              description='A program'),
        qtypes.field_mask_pb2.FieldMask(paths=['description']))

    assert client.set_program_description('proj', 'prog', '') == result
    assert grpc_client.update_quantum_program.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumProgram(name='projects/proj/programs/prog'),
        qtypes.field_mask_pb2.FieldMask(paths=['description']))


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_set_program_labels(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    grpc_client.get_quantum_program.return_value = qtypes.QuantumProgram(
        labels={
            'color': 'red',
            'weather': 'sun',
            'run': '1'
        },
        label_fingerprint='hash')
    result = qtypes.QuantumProgram(name='projects/proj/programs/prog')
    grpc_client.update_quantum_program.return_value = result

    client = EngineClient()
    labels = {'hello': 'world', 'color': 'blue', 'run': '1'}
    assert client.set_program_labels('proj', 'prog', labels) == result
    assert grpc_client.update_quantum_program.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumProgram(name='projects/proj/programs/prog',
                              labels=labels,
                              label_fingerprint='hash'),
        qtypes.field_mask_pb2.FieldMask(paths=['labels']))

    assert client.set_program_labels('proj', 'prog', {}) == result
    assert grpc_client.update_quantum_program.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumProgram(name='projects/proj/programs/prog',
                              label_fingerprint='hash'),
        qtypes.field_mask_pb2.FieldMask(paths=['labels']))


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_add_program_labels(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    existing = qtypes.QuantumProgram(labels={
        'color': 'red',
        'weather': 'sun',
        'run': '1'
    },
                                     label_fingerprint='hash')
    grpc_client.get_quantum_program.return_value = existing
    result = qtypes.QuantumProgram(name='projects/proj/programs/prog')
    grpc_client.update_quantum_program.return_value = result

    client = EngineClient()
    assert client.add_program_labels('proj', 'prog',
                                     {'color': 'red'}) == existing
    assert grpc_client.update_quantum_program.call_count == 0

    assert client.add_program_labels('proj', 'prog',
                                     {'hello': 'world'}) == result
    assert grpc_client.update_quantum_program.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumProgram(name='projects/proj/programs/prog',
                              labels={
                                  'color': 'red',
                                  'weather': 'sun',
                                  'run': '1',
                                  'hello': 'world'
                              },
                              label_fingerprint='hash'),
        qtypes.field_mask_pb2.FieldMask(paths=['labels']))

    assert client.add_program_labels('proj', 'prog', {
        'hello': 'world',
        'color': 'blue'
    }) == result
    assert grpc_client.update_quantum_program.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumProgram(name='projects/proj/programs/prog',
                              labels={
                                  'color': 'blue',
                                  'weather': 'sun',
                                  'run': '1',
                                  'hello': 'world'
                              },
                              label_fingerprint='hash'),
        qtypes.field_mask_pb2.FieldMask(paths=['labels']))


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_remove_program_labels(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    existing = qtypes.QuantumProgram(labels={
        'color': 'red',
        'weather': 'sun',
        'run': '1'
    },
                                     label_fingerprint='hash')
    grpc_client.get_quantum_program.return_value = existing
    result = qtypes.QuantumProgram(name='projects/proj/programs/prog')
    grpc_client.update_quantum_program.return_value = result

    client = EngineClient()
    assert client.remove_program_labels('proj', 'prog', ['other']) == existing
    assert grpc_client.update_quantum_program.call_count == 0

    assert client.remove_program_labels('proj', 'prog',
                                        ['hello', 'weather']) == result
    assert grpc_client.update_quantum_program.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumProgram(name='projects/proj/programs/prog',
                              labels={
                                  'color': 'red',
                                  'run': '1',
                              },
                              label_fingerprint='hash'),
        qtypes.field_mask_pb2.FieldMask(paths=['labels']))

    assert client.remove_program_labels('proj', 'prog',
                                        ['color', 'weather', 'run']) == result
    assert grpc_client.update_quantum_program.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumProgram(name='projects/proj/programs/prog',
                              label_fingerprint='hash'),
        qtypes.field_mask_pb2.FieldMask(paths=['labels']))


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_delete_program(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    client = EngineClient()
    assert not client.delete_program('proj', 'prog')
    assert grpc_client.delete_quantum_program.call_args[0] == (
        'projects/proj/programs/prog', False)

    assert not client.delete_program('proj', 'prog', delete_jobs=True)
    assert grpc_client.delete_quantum_program.call_args[0] == (
        'projects/proj/programs/prog', True)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_create_job(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    result = qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0')
    grpc_client.create_quantum_job.return_value = result

    run_context = qtypes.any_pb2.Any()
    labels = {'hello': 'world'}
    client = EngineClient()
    assert client.create_job('proj', 'prog', 'job0', ['processor0'],
                             run_context, 10, 'A job',
                             labels) == ('job0', result)
    assert grpc_client.create_quantum_job.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumJob(
            name='projects/proj/programs/prog/jobs/job0',
            run_context=run_context,
            scheduling_config=qtypes.SchedulingConfig(
                priority=10,
                processor_selector=qtypes.SchedulingConfig.ProcessorSelector(
                    processor_names=['projects/proj/processors/processor0'])),
            description='A job',
            labels=labels), False)

    assert client.create_job(
        'proj',
        'prog',
        'job0',
        ['processor0'],
        run_context,
        10,
        'A job',
    ) == ('job0', result)
    assert grpc_client.create_quantum_job.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumJob(
            name='projects/proj/programs/prog/jobs/job0',
            run_context=run_context,
            scheduling_config=qtypes.SchedulingConfig(
                priority=10,
                processor_selector=qtypes.SchedulingConfig.ProcessorSelector(
                    processor_names=['projects/proj/processors/processor0'])),
            description='A job'), False)

    assert client.create_job('proj',
                             'prog',
                             'job0', ['processor0'],
                             run_context,
                             10,
                             labels=labels) == ('job0', result)
    assert grpc_client.create_quantum_job.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumJob(
            name='projects/proj/programs/prog/jobs/job0',
            run_context=run_context,
            scheduling_config=qtypes.SchedulingConfig(
                priority=10,
                processor_selector=qtypes.SchedulingConfig.ProcessorSelector(
                    processor_names=['projects/proj/processors/processor0'])),
            labels=labels), False)

    assert client.create_job('proj', 'prog', 'job0', ['processor0'],
                             run_context, 10) == ('job0', result)
    assert grpc_client.create_quantum_job.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumJob(
            name='projects/proj/programs/prog/jobs/job0',
            run_context=run_context,
            scheduling_config=qtypes.SchedulingConfig(
                priority=10,
                processor_selector=qtypes.SchedulingConfig.ProcessorSelector(
                    processor_names=['projects/proj/processors/processor0'])),
        ), False)

    assert client.create_job('proj',
                             'prog',
                             job_id=None,
                             processor_ids=['processor0'],
                             run_context=run_context,
                             priority=10) == ('job0', result)
    assert grpc_client.create_quantum_job.call_args[0] == (
        'projects/proj/programs/prog',
        qtypes.QuantumJob(
            run_context=run_context,
            scheduling_config=qtypes.SchedulingConfig(
                priority=10,
                processor_selector=qtypes.SchedulingConfig.ProcessorSelector(
                    processor_names=['projects/proj/processors/processor0'])),
        ), False)

    with pytest.raises(ValueError, match='priority must be between 0 and 1000'):
        client.create_job('proj',
                          'prog',
                          job_id=None,
                          processor_ids=['processor0'],
                          run_context=run_context,
                          priority=5000)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_get_job(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    result = qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0')
    grpc_client.get_quantum_job.return_value = result

    client = EngineClient()
    assert client.get_job('proj', 'prog', 'job0', False) == result
    assert grpc_client.get_quantum_job.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0', False)

    assert client.get_job('proj', 'prog', 'job0', True) == result
    assert grpc_client.get_quantum_job.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0', True)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_set_job_description(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    result = qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0')
    grpc_client.update_quantum_job.return_value = result

    client = EngineClient()
    assert client.set_job_description('proj', 'prog', 'job0', 'A job') == result
    assert grpc_client.update_quantum_job.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0',
        qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0',
                          description='A job'),
        qtypes.field_mask_pb2.FieldMask(paths=['description']))

    assert client.set_job_description('proj', 'prog', 'job0', '') == result
    assert grpc_client.update_quantum_job.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0',
        qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0'),
        qtypes.field_mask_pb2.FieldMask(paths=['description']))


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_set_job_labels(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    grpc_client.get_quantum_job.return_value = qtypes.QuantumJob(
        labels={
            'color': 'red',
            'weather': 'sun',
            'run': '1'
        },
        label_fingerprint='hash')
    result = qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0')
    grpc_client.update_quantum_job.return_value = result

    client = EngineClient()
    labels = {'hello': 'world', 'color': 'blue', 'run': '1'}
    assert client.set_job_labels('proj', 'prog', 'job0', labels) == result
    assert grpc_client.update_quantum_job.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0',
        qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0',
                          labels=labels,
                          label_fingerprint='hash'),
        qtypes.field_mask_pb2.FieldMask(paths=['labels']))

    assert client.set_job_labels('proj', 'prog', 'job0', {}) == result
    assert grpc_client.update_quantum_job.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0',
        qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0',
                          label_fingerprint='hash'),
        qtypes.field_mask_pb2.FieldMask(paths=['labels']))


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_add_job_labels(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    existing = qtypes.QuantumJob(labels={
        'color': 'red',
        'weather': 'sun',
        'run': '1'
    },
                                 label_fingerprint='hash')
    grpc_client.get_quantum_job.return_value = existing
    result = qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0')
    grpc_client.update_quantum_job.return_value = result

    client = EngineClient()
    assert client.add_job_labels('proj', 'prog', 'job0',
                                 {'color': 'red'}) == existing
    assert grpc_client.update_quantum_job.call_count == 0

    assert client.add_job_labels('proj', 'prog', 'job0',
                                 {'hello': 'world'}) == result
    assert grpc_client.update_quantum_job.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0',
        qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0',
                          labels={
                              'color': 'red',
                              'weather': 'sun',
                              'run': '1',
                              'hello': 'world'
                          },
                          label_fingerprint='hash'),
        qtypes.field_mask_pb2.FieldMask(paths=['labels']))

    assert client.add_job_labels('proj', 'prog', 'job0', {
        'hello': 'world',
        'color': 'blue'
    }) == result
    assert grpc_client.update_quantum_job.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0',
        qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0',
                          labels={
                              'color': 'blue',
                              'weather': 'sun',
                              'run': '1',
                              'hello': 'world'
                          },
                          label_fingerprint='hash'),
        qtypes.field_mask_pb2.FieldMask(paths=['labels']))


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_remove_job_labels(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    existing = qtypes.QuantumJob(labels={
        'color': 'red',
        'weather': 'sun',
        'run': '1'
    },
                                 label_fingerprint='hash')
    grpc_client.get_quantum_job.return_value = existing
    result = qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0')
    grpc_client.update_quantum_job.return_value = result

    client = EngineClient()
    assert client.remove_job_labels('proj', 'prog', 'job0',
                                    ['other']) == existing
    assert grpc_client.update_quantum_program.call_count == 0

    assert client.remove_job_labels('proj', 'prog', 'job0',
                                    ['hello', 'weather']) == result
    assert grpc_client.update_quantum_job.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0',
        qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0',
                          labels={
                              'color': 'red',
                              'run': '1',
                          },
                          label_fingerprint='hash'),
        qtypes.field_mask_pb2.FieldMask(paths=['labels']))

    assert client.remove_job_labels('proj', 'prog', 'job0',
                                    ['color', 'weather', 'run']) == result
    assert grpc_client.update_quantum_job.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0',
        qtypes.QuantumJob(name='projects/proj/programs/prog/jobs/job0',
                          label_fingerprint='hash'),
        qtypes.field_mask_pb2.FieldMask(paths=['labels']))


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_delete_job(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    client = EngineClient()
    assert not client.delete_job('proj', 'prog', 'job0')
    assert grpc_client.delete_quantum_job.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0',)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_cancel_job(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    client = EngineClient()
    assert not client.cancel_job('proj', 'prog', 'job0')
    assert grpc_client.cancel_quantum_job.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0',)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_job_results(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    result = qtypes.QuantumResult(
        parent='projects/proj/programs/prog/jobs/job0')
    grpc_client.get_quantum_result.return_value = result

    client = EngineClient()
    assert client.get_job_results('proj', 'prog', 'job0') == result
    assert grpc_client.get_quantum_result.call_args[0] == (
        'projects/proj/programs/prog/jobs/job0',)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_list_jobs(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    results = [
        qtypes.QuantumJob(name='projects/proj/programs/prog1/jobs/job1'),
        qtypes.QuantumJob(name='projects/proj/programs/prog1/jobs/job2')
    ]
    grpc_client.list_quantum_jobs.return_value = results

    client = EngineClient()
    assert client.list_jobs(project_id='proj', program_id='prog1') == results
    assert grpc_client.list_quantum_jobs.call_args[0] == (
        'projects/proj/programs/prog1',)
    assert grpc_client.list_quantum_jobs.call_args[1] == {
        'filter_': '',
    }

    assert client.list_jobs(project_id='proj') == results
    assert grpc_client.list_quantum_jobs.call_args[0] == (
        'projects/proj/programs/-',)
    assert grpc_client.list_quantum_jobs.call_args[1] == {
        'filter_': '',
    }


# yapf: disable
@pytest.mark.parametrize(
    'expected_filter, '
        'created_after, '
        'created_before, '
        'labels, '
        'execution_states',
    [
        ('',
            None,
            None,
            None,
            None),
        ('create_time >= 2020-09-01',
            datetime.date(2020, 9, 1),
            None,
            None,
            None),
        ('create_time >= 1598918400',
            datetime.datetime(2020, 9, 1, 0, 0, 0,
                              tzinfo=datetime.timezone.utc),
            None,
            None,
            None),
        ('create_time <= 2020-10-01',
            None,
            datetime.date(2020, 10, 1),
            None,
            None),
        ('create_time >= 2020-09-01 AND create_time <= 1598918410',
            datetime.date(2020, 9, 1),
            datetime.datetime(2020, 9, 1, 0, 0, 10,
                            tzinfo=datetime.timezone.utc),
            None,
            None),
        ('labels.color:red AND labels.shape:*',
            None,
            None,
            {
            'color': 'red',
            'shape': '*'
            },
            None
        ),
        ('(execution_status.state = FAILURE OR '
         'execution_status.state = CANCELLED)',
            None,
            None,
            None,
            [quantum.enums.ExecutionStatus.State.FAILURE,
             quantum.enums.ExecutionStatus.State.CANCELLED,]
        ),
        ('create_time >= 2020-08-01 AND '
         'create_time <= 1598918400 AND '
         'labels.color:red AND labels.shape:* AND '
         '(execution_status.state = SUCCESS)',
            datetime.date(2020, 8, 1),
            datetime.datetime(2020, 9, 1, tzinfo=datetime.timezone.utc),
            {
            'color': 'red',
            'shape': '*'
            },
            [quantum.enums.ExecutionStatus.State.SUCCESS,],
        ),
    ])
# yapf: enable
@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_list_jobs_filters(client_constructor, expected_filter, created_before,
                           created_after, labels, execution_states):
    grpc_client = setup_mock_(client_constructor)
    client = EngineClient()
    client.list_jobs(project_id='proj',
                     program_id='prog',
                     created_before=created_before,
                     created_after=created_after,
                     has_labels=labels,
                     execution_states=execution_states)
    assert grpc_client.list_quantum_jobs.call_args[1] == {
        'filter_': expected_filter,
    }


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_list_processors(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    results = [
        qtypes.QuantumProcessor(name='projects/proj/processor/processor0'),
        qtypes.QuantumProcessor(name='projects/proj/processor/processor1')
    ]
    grpc_client.list_quantum_processors.return_value = results

    client = EngineClient()
    assert client.list_processors('proj') == results
    assert grpc_client.list_quantum_processors.call_args[0] == (
        'projects/proj',)
    assert grpc_client.list_quantum_processors.call_args[1] == {
        'filter_': '',
    }


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_get_processor(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    result = qtypes.QuantumProcessor(name='projects/proj/processors/processor0')
    grpc_client.get_quantum_processor.return_value = result

    client = EngineClient()
    assert client.get_processor('proj', 'processor0') == result
    assert grpc_client.get_quantum_processor.call_args[0] == (
        'projects/proj/processors/processor0',)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_list_calibrations(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    results = [
        qtypes.QuantumCalibration(
            name='projects/proj/processor/processor0/calibrations/123456'),
        qtypes.QuantumCalibration(
            name='projects/proj/processor/processor1/calibrations/224466')
    ]
    grpc_client.list_quantum_calibrations.return_value = results

    client = EngineClient()
    assert client.list_calibrations('proj', 'processor0') == results
    assert grpc_client.list_quantum_calibrations.call_args[0] == (
        'projects/proj/processors/processor0',)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_get_calibration(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    result = qtypes.QuantumCalibration(
        name='projects/proj/processors/processor0/calibrations/123456')
    grpc_client.get_quantum_calibration.return_value = result

    client = EngineClient()
    assert client.get_calibration('proj', 'processor0', 123456) == result
    assert grpc_client.get_quantum_calibration.call_args[0] == (
        'projects/proj/processors/processor0/calibrations/123456',)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_get_current_calibration(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    result = qtypes.QuantumCalibration(
        name='projects/proj/processors/processor0/calibrations/123456')
    grpc_client.get_quantum_calibration.return_value = result

    client = EngineClient()
    assert client.get_current_calibration('proj', 'processor0') == result
    assert grpc_client.get_quantum_calibration.call_args[0] == (
        'projects/proj/processors/processor0/calibrations/current',)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_get_current_calibration_does_not_exist(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    grpc_client.get_quantum_calibration.side_effect = exceptions.NotFound(
        'not found')

    client = EngineClient()
    assert client.get_current_calibration('proj', 'processor0') is None
    assert grpc_client.get_quantum_calibration.call_args[0] == (
        'projects/proj/processors/processor0/calibrations/current',)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_get_current_calibration_error(client_constructor):
    grpc_client = setup_mock_(client_constructor)

    grpc_client.get_quantum_calibration.side_effect = exceptions.BadRequest(
        'boom')

    client = EngineClient()
    with pytest.raises(EngineException, match='boom'):
        client.get_current_calibration('proj', 'processor0')


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_api_doesnt_retry_not_found_errors(client_constructor):
    grpc_client = setup_mock_(client_constructor)
    grpc_client.get_quantum_program.side_effect = exceptions.NotFound(
        'not found')

    client = EngineClient()
    with pytest.raises(EngineException, match='not found'):
        client.get_program('proj', 'prog', False)
    assert grpc_client.get_quantum_program.call_count == 1


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_api_retry_5xx_errors(client_constructor):
    grpc_client = setup_mock_(client_constructor)
    grpc_client.get_quantum_program.side_effect = exceptions.ServiceUnavailable(
        'internal error')

    client = EngineClient(max_retry_delay_seconds=1)
    with pytest.raises(TimeoutError,
                       match='Reached max retry attempts.*internal error'):
        client.get_program('proj', 'prog', False)
    assert grpc_client.get_quantum_program.call_count > 1


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_create_reservation(client_constructor):
    grpc_client = setup_mock_(client_constructor)
    start = datetime.datetime.fromtimestamp(1000000000)
    end = datetime.datetime.fromtimestamp(1000003600)
    users = ['jeff@google.com']
    result = qtypes.QuantumReservation(
        name='projects/proj/processors/processor0/reservations/papar-party-44',
        start_time=Timestamp(seconds=1000000000),
        end_time=Timestamp(seconds=1000003600),
        whitelisted_users=users,
    )
    grpc_client.create_quantum_reservation.return_value = result

    client = EngineClient()
    assert client.create_reservation('proj', 'processor0', start, end,
                                     users) == result
    assert grpc_client.create_quantum_reservation.call_count == 1
    kwargs = grpc_client.create_quantum_reservation.call_args[1]
    # The outgoing argument will not have the resource name
    result.name = ''
    assert kwargs == {
        'parent': 'projects/proj/processors/processor0',
        'quantum_reservation': result
    }


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_cancel_reservation(client_constructor):
    grpc_client = setup_mock_(client_constructor)
    name = 'projects/proj/processors/processor0/reservations/papar-party-44'
    result = qtypes.QuantumReservation(
        name=name,
        start_time=Timestamp(seconds=1000000000),
        end_time=Timestamp(seconds=1000002000),
        whitelisted_users=['jeff@google.com'],
    )
    grpc_client.cancel_quantum_reservation.return_value = result

    client = EngineClient()
    assert (client.cancel_reservation('proj', 'processor0',
                                      'papar-party-44') == result)
    kwargs = grpc_client.cancel_quantum_reservation.call_args[1]
    assert kwargs == {
        'name': name,
    }


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_delete_reservation(client_constructor):
    grpc_client = setup_mock_(client_constructor)
    name = 'projects/proj/processors/processor0/reservations/papar-party-44'
    result = qtypes.QuantumReservation(
        name=name,
        start_time=Timestamp(seconds=1000000000),
        end_time=Timestamp(seconds=1000002000),
        whitelisted_users=['jeff@google.com'],
    )
    grpc_client.delete_quantum_reservation.return_value = result

    client = EngineClient()
    assert (client.delete_reservation('proj', 'processor0',
                                      'papar-party-44') == result)
    kwargs = grpc_client.delete_quantum_reservation.call_args[1]
    assert kwargs == {
        'name': name,
    }


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_get_reservation(client_constructor):
    grpc_client = setup_mock_(client_constructor)
    name = 'projects/proj/processors/processor0/reservations/papar-party-44'
    result = qtypes.QuantumReservation(
        name=name,
        start_time=Timestamp(seconds=1000000000),
        end_time=Timestamp(seconds=1000002000),
        whitelisted_users=['jeff@google.com'],
    )
    grpc_client.get_quantum_reservation.return_value = result

    client = EngineClient()
    assert (client.get_reservation('proj', 'processor0',
                                   'papar-party-44') == result)
    kwargs = grpc_client.get_quantum_reservation.call_args[1]
    assert kwargs == {
        'name': name,
    }


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_get_reservation_not_found(client_constructor):
    grpc_client = setup_mock_(client_constructor)
    name = 'projects/proj/processors/processor0/reservations/papar-party-44'
    grpc_client.get_quantum_reservation.side_effect = exceptions.NotFound(
        'not found')

    client = EngineClient()
    assert (client.get_reservation('proj', 'processor0',
                                   'papar-party-44') == None)
    kwargs = grpc_client.get_quantum_reservation.call_args[1]
    assert kwargs == {
        'name': name,
    }


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_get_reservation_exception(client_constructor):
    grpc_client = setup_mock_(client_constructor)
    grpc_client.get_quantum_reservation.side_effect = exceptions.BadRequest(
        'boom')

    client = EngineClient()
    with pytest.raises(EngineException, match='boom'):
        client.get_reservation('proj', 'processor0', 'goog')


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_list_reservation(client_constructor):
    grpc_client = setup_mock_(client_constructor)
    name = 'projects/proj/processors/processor0/reservations/papar-party-44'
    results = [
        qtypes.QuantumReservation(
            name=name,
            start_time=Timestamp(seconds=1000000000),
            end_time=Timestamp(seconds=1000002000),
            whitelisted_users=['jeff@google.com'],
        ),
        qtypes.QuantumReservation(
            name=name,
            start_time=Timestamp(seconds=1200000000),
            end_time=Timestamp(seconds=1200002000),
            whitelisted_users=['dstrain@google.com'],
        ),
    ]
    grpc_client.list_quantum_reservations.return_value = results

    client = EngineClient()
    assert (client.list_reservations('proj', 'processor0') == results)


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_update_reservation(client_constructor):
    grpc_client = setup_mock_(client_constructor)
    name = 'projects/proj/processors/processor0/reservations/papar-party-44'
    result = qtypes.QuantumReservation(
        name=name,
        start_time=Timestamp(seconds=1000001000),
        end_time=Timestamp(seconds=1000002000),
        whitelisted_users=['jeff@google.com'],
    )
    grpc_client.update_quantum_reservation.return_value = result

    client = EngineClient()
    assert (client.update_reservation(
        'proj',
        'processor0',
        'papar-party-44',
        start=datetime.datetime.fromtimestamp(1000001000),
        end=datetime.datetime.fromtimestamp(1000002000),
        whitelisted_users=['jeff@google.com'],
    ) == result)
    kwargs = grpc_client.update_quantum_reservation.call_args[1]
    assert kwargs == {
        'name':
        name,
        'quantum_reservation':
        result,
        'update_mask':
        FieldMask(paths=['start_time', 'end_time', 'whitelisted_users'])
    }


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_update_reservation_remove_all_users(client_constructor):
    grpc_client = setup_mock_(client_constructor)
    name = 'projects/proj/processors/processor0/reservations/papar-party-44'
    result = qtypes.QuantumReservation(
        name=name,
        whitelisted_users=[],
    )
    grpc_client.update_quantum_reservation.return_value = result

    client = EngineClient()
    assert (client.update_reservation(
        'proj',
        'processor0',
        'papar-party-44',
        whitelisted_users=[],
    ) == result)
    kwargs = grpc_client.update_quantum_reservation.call_args[1]
    assert kwargs == {
        'name': name,
        'quantum_reservation': result,
        'update_mask': FieldMask(paths=['whitelisted_users'])
    }


@mock.patch.object(quantum, 'QuantumEngineServiceClient', autospec=True)
def test_list_time_slots(client_constructor):
    grpc_client = setup_mock_(client_constructor)
    results = [
        qtypes.QuantumTimeSlot(
            processor_name='potofgold',
            start_time=Timestamp(seconds=1000020000),
            end_time=Timestamp(seconds=1000040000),
            slot_type=qenums.QuantumTimeSlot.TimeSlotType.MAINTENANCE,
            maintenance_config=qtypes.QuantumTimeSlot.MaintenanceConfig(
                title='Testing',
                description='Testing some new configuration.',
            ),
        ),
        qtypes.QuantumTimeSlot(
            processor_name='potofgold',
            start_time=Timestamp(seconds=1000010000),
            end_time=Timestamp(seconds=1000020000),
            slot_type=qenums.QuantumTimeSlot.TimeSlotType.RESERVATION,
            reservation_config=qtypes.QuantumTimeSlot.ReservationConfig(
                project_id='super_secret_quantum'),
        )
    ]
    grpc_client.list_quantum_time_slots.return_value = results

    client = EngineClient()
    assert (client.list_time_slots('proj', 'processor0') == results)

[((1222, 1293), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (1239, 1293), False, 'from unittest import mock\n'), ((3338, 3409), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (3355, 3409), False, 'from unittest import mock\n'), ((4003, 4074), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (4020, 4074), False, 'from unittest import mock\n'), ((6020, 6091), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (6037, 6091), False, 'from unittest import mock\n'), ((6613, 6684), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (6630, 6684), False, 'from unittest import mock\n'), ((6931, 7002), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (6948, 7002), False, 'from unittest import mock\n'), ((7949, 8020), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (7966, 8020), False, 'from unittest import mock\n'), ((9317, 9388), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (9334, 9388), False, 'from unittest import mock\n'), ((11437, 11508), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (11454, 11508), False, 'from unittest import mock\n'), ((13165, 13236), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (13182, 13236), False, 'from unittest import mock\n'), ((13708, 13779), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (13725, 13779), False, 'from unittest import mock\n'), ((17933, 18004), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (17950, 18004), False, 'from unittest import mock\n'), ((18616, 18687), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (18633, 18687), False, 'from unittest import mock\n'), ((19652, 19723), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (19669, 19723), False, 'from unittest import mock\n'), ((21030, 21101), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (21047, 21101), False, 'from unittest import mock\n'), ((23104, 23175), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (23121, 23175), False, 'from unittest import mock\n'), ((24858, 24929), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (24875, 24929), False, 'from unittest import mock\n'), ((25220, 25291), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (25237, 25291), False, 'from unittest import mock\n'), ((25582, 25653), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (25599, 25653), False, 'from unittest import mock\n'), ((26105, 26176), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (26122, 26176), False, 'from unittest import mock\n'), ((28963, 29034), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (28980, 29034), False, 'from unittest import mock\n'), ((29644, 29715), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (29661, 29715), False, 'from unittest import mock\n'), ((30319, 30390), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (30336, 30390), False, 'from unittest import mock\n'), ((30834, 30905), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (30851, 30905), False, 'from unittest import mock\n'), ((31529, 31600), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (31546, 31600), False, 'from unittest import mock\n'), ((32111, 32182), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (32128, 32182), False, 'from unittest import mock\n'), ((32702, 32773), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (32719, 32773), False, 'from unittest import mock\n'), ((33228, 33299), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (33245, 33299), False, 'from unittest import mock\n'), ((33652, 33723), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (33669, 33723), False, 'from unittest import mock\n'), ((34131, 34202), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (34148, 34202), False, 'from unittest import mock\n'), ((34689, 34760), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (34706, 34760), False, 'from unittest import mock\n'), ((35817, 35888), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (35834, 35888), False, 'from unittest import mock\n'), ((36615, 36686), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (36632, 36686), False, 'from unittest import mock\n'), ((37413, 37484), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (37430, 37484), False, 'from unittest import mock\n'), ((38196, 38267), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (38213, 38267), False, 'from unittest import mock\n'), ((38811, 38882), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (38828, 38882), False, 'from unittest import mock\n'), ((39230, 39301), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (39247, 39301), False, 'from unittest import mock\n'), ((40121, 40192), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (40138, 40192), False, 'from unittest import mock\n'), ((41226, 41297), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (41243, 41297), False, 'from unittest import mock\n'), ((42050, 42121), 'unittest.mock.patch.object', 'mock.patch.object', (['quantum', '"""QuantumEngineServiceClient"""'], {'autospec': '(True)'}), "(quantum, 'QuantumEngineServiceClient', autospec=True)\n", (42067, 42121), False, 'from unittest import mock\n'), ((1134, 1145), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (1143, 1145), False, 'from unittest import mock\n'), ((1403, 1460), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""'}), "(name='projects/proj/programs/prog')\n", (1424, 1460), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((1534, 1554), 'cirq.google.engine.client.quantum_v1alpha1.types.any_pb2.Any', 'qtypes.any_pb2.Any', ([], {}), '()\n', (1552, 1554), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((1600, 1614), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (1612, 1614), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((3516, 3573), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""'}), "(name='projects/proj/programs/prog')\n", (3537, 3573), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((3646, 3660), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (3658, 3660), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((4401, 4415), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (4413, 4415), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((6292, 6306), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (6304, 6306), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((7121, 7178), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""'}), "(name='projects/proj/programs/prog')\n", (7142, 7178), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((7254, 7268), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (7266, 7268), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((8172, 8278), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'labels': "{'color': 'red', 'weather': 'sun', 'run': '1'}", 'label_fingerprint': '"""hash"""'}), "(labels={'color': 'red', 'weather': 'sun', 'run': '1'},\n    label_fingerprint='hash')\n", (8193, 8278), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((8351, 8408), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""'}), "(name='projects/proj/programs/prog')\n", (8372, 8408), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((8484, 8498), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (8496, 8498), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((9504, 9610), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'labels': "{'color': 'red', 'weather': 'sun', 'run': '1'}", 'label_fingerprint': '"""hash"""'}), "(labels={'color': 'red', 'weather': 'sun', 'run': '1'},\n    label_fingerprint='hash')\n", (9525, 9610), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((9747, 9804), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""'}), "(name='projects/proj/programs/prog')\n", (9768, 9804), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((9880, 9894), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (9892, 9894), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((11627, 11733), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'labels': "{'color': 'red', 'weather': 'sun', 'run': '1'}", 'label_fingerprint': '"""hash"""'}), "(labels={'color': 'red', 'weather': 'sun', 'run': '1'},\n    label_fingerprint='hash')\n", (11648, 11733), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((11870, 11927), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""'}), "(name='projects/proj/programs/prog')\n", (11891, 11927), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((12003, 12017), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (12015, 12017), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((13346, 13360), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (13358, 13360), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((13885, 13948), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""'}), "(name='projects/proj/programs/prog/jobs/job0')\n", (13902, 13948), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((14025, 14045), 'cirq.google.engine.client.quantum_v1alpha1.types.any_pb2.Any', 'qtypes.any_pb2.Any', ([], {}), '()\n', (14043, 14045), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((14091, 14105), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (14103, 14105), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((18107, 18170), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""'}), "(name='projects/proj/programs/prog/jobs/job0')\n", (18124, 18170), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((18239, 18253), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (18251, 18253), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((18802, 18865), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""'}), "(name='projects/proj/programs/prog/jobs/job0')\n", (18819, 18865), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((18937, 18951), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (18949, 18951), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((19867, 19969), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'labels': "{'color': 'red', 'weather': 'sun', 'run': '1'}", 'label_fingerprint': '"""hash"""'}), "(labels={'color': 'red', 'weather': 'sun', 'run': '1'},\n    label_fingerprint='hash')\n", (19884, 19969), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((20042, 20105), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""'}), "(name='projects/proj/programs/prog/jobs/job0')\n", (20059, 20105), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((20177, 20191), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (20189, 20191), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((21213, 21315), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'labels': "{'color': 'red', 'weather': 'sun', 'run': '1'}", 'label_fingerprint': '"""hash"""'}), "(labels={'color': 'red', 'weather': 'sun', 'run': '1'},\n    label_fingerprint='hash')\n", (21230, 21315), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((21444, 21507), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""'}), "(name='projects/proj/programs/prog/jobs/job0')\n", (21461, 21507), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((21579, 21593), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (21591, 21593), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((23290, 23392), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'labels': "{'color': 'red', 'weather': 'sun', 'run': '1'}", 'label_fingerprint': '"""hash"""'}), "(labels={'color': 'red', 'weather': 'sun', 'run': '1'},\n    label_fingerprint='hash')\n", (23307, 23392), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((23521, 23584), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""'}), "(name='projects/proj/programs/prog/jobs/job0')\n", (23538, 23584), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((23656, 23670), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (23668, 23670), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((25035, 25049), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (25047, 25049), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((25397, 25411), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (25409, 25411), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((25760, 25828), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumResult', 'qtypes.QuantumResult', ([], {'parent': '"""projects/proj/programs/prog/jobs/job0"""'}), "(parent='projects/proj/programs/prog/jobs/job0')\n", (25780, 25828), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((25909, 25923), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (25921, 25923), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((26508, 26522), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (26520, 26522), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((29247, 29261), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (29259, 29261), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((30063, 30077), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (30075, 30077), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((30499, 30566), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProcessor', 'qtypes.QuantumProcessor', ([], {'name': '"""projects/proj/processors/processor0"""'}), "(name='projects/proj/processors/processor0')\n", (30522, 30566), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((30641, 30655), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (30653, 30655), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((31327, 31341), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (31339, 31341), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((31711, 31805), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumCalibration', 'qtypes.QuantumCalibration', ([], {'name': '"""projects/proj/processors/processor0/calibrations/123456"""'}), "(name=\n    'projects/proj/processors/processor0/calibrations/123456')\n", (31736, 31805), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((31886, 31900), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (31898, 31900), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((32301, 32395), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumCalibration', 'qtypes.QuantumCalibration', ([], {'name': '"""projects/proj/processors/processor0/calibrations/123456"""'}), "(name=\n    'projects/proj/processors/processor0/calibrations/123456')\n", (32326, 32395), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((32476, 32490), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (32488, 32490), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((32948, 32980), 'google.api_core.exceptions.NotFound', 'exceptions.NotFound', (['"""not found"""'], {}), "('not found')\n", (32967, 32980), False, 'from google.api_core import exceptions\n'), ((33004, 33018), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (33016, 33018), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((33465, 33494), 'google.api_core.exceptions.BadRequest', 'exceptions.BadRequest', (['"""boom"""'], {}), "('boom')\n", (33486, 33494), False, 'from google.api_core import exceptions\n'), ((33518, 33532), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (33530, 33532), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((33888, 33920), 'google.api_core.exceptions.NotFound', 'exceptions.NotFound', (['"""not found"""'], {}), "('not found')\n", (33907, 33920), False, 'from google.api_core import exceptions\n'), ((33944, 33958), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (33956, 33958), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((34354, 34401), 'google.api_core.exceptions.ServiceUnavailable', 'exceptions.ServiceUnavailable', (['"""internal error"""'], {}), "('internal error')\n", (34383, 34401), False, 'from google.api_core import exceptions\n'), ((34425, 34464), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {'max_retry_delay_seconds': '(1)'}), '(max_retry_delay_seconds=1)\n', (34437, 34464), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((34872, 34915), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['(1000000000)'], {}), '(1000000000)\n', (34903, 34915), False, 'import datetime\n'), ((34926, 34969), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['(1000003600)'], {}), '(1000003600)\n', (34957, 34969), False, 'import datetime\n'), ((35338, 35352), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (35350, 35352), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((36354, 36368), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (36366, 36368), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((37152, 37166), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (37164, 37166), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((37944, 37958), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (37956, 37958), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((38505, 38537), 'google.api_core.exceptions.NotFound', 'exceptions.NotFound', (['"""not found"""'], {}), "('not found')\n", (38524, 38537), False, 'from google.api_core import exceptions\n'), ((38561, 38575), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (38573, 38575), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((39043, 39072), 'google.api_core.exceptions.BadRequest', 'exceptions.BadRequest', (['"""boom"""'], {}), "('boom')\n", (39064, 39072), False, 'from google.api_core import exceptions\n'), ((39096, 39110), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (39108, 39110), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((40032, 40046), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (40044, 40046), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((40658, 40672), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (40670, 40672), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((41504, 41562), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumReservation', 'qtypes.QuantumReservation', ([], {'name': 'name', 'whitelisted_users': '[]'}), '(name=name, whitelisted_users=[])\n', (41529, 41562), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((41665, 41679), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (41677, 41679), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((43145, 43159), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (43157, 43159), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((4193, 4251), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog1"""'}), "(name='projects/proj/programs/prog1')\n", (4214, 4251), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((4261, 4319), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog2"""'}), "(name='projects/proj/programs/prog2')\n", (4282, 4319), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((6758, 6793), 'pytest.raises', 'pytest.raises', (['ValueError'], {'match': '""""""'}), "(ValueError, match='')\n", (6771, 6793), False, 'import pytest\n'), ((17603, 17673), 'pytest.raises', 'pytest.raises', (['ValueError'], {'match': '"""priority must be between 0 and 1000"""'}), "(ValueError, match='priority must be between 0 and 1000')\n", (17616, 17673), False, 'import pytest\n'), ((26292, 26356), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog1/jobs/job1"""'}), "(name='projects/proj/programs/prog1/jobs/job1')\n", (26309, 26356), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((26366, 26430), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog1/jobs/job2"""'}), "(name='projects/proj/programs/prog1/jobs/job2')\n", (26383, 26430), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((29837, 29903), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProcessor', 'qtypes.QuantumProcessor', ([], {'name': '"""projects/proj/processor/processor0"""'}), "(name='projects/proj/processor/processor0')\n", (29860, 29903), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((29913, 29979), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProcessor', 'qtypes.QuantumProcessor', ([], {'name': '"""projects/proj/processor/processor1"""'}), "(name='projects/proj/processor/processor1')\n", (29936, 29979), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((31029, 31122), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumCalibration', 'qtypes.QuantumCalibration', ([], {'name': '"""projects/proj/processor/processor0/calibrations/123456"""'}), "(name=\n    'projects/proj/processor/processor0/calibrations/123456')\n", (31054, 31122), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((31140, 31233), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumCalibration', 'qtypes.QuantumCalibration', ([], {'name': '"""projects/proj/processor/processor1/calibrations/224466"""'}), "(name=\n    'projects/proj/processor/processor1/calibrations/224466')\n", (31165, 31233), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((33542, 33586), 'pytest.raises', 'pytest.raises', (['EngineException'], {'match': '"""boom"""'}), "(EngineException, match='boom')\n", (33555, 33586), False, 'import pytest\n'), ((33968, 34017), 'pytest.raises', 'pytest.raises', (['EngineException'], {'match': '"""not found"""'}), "(EngineException, match='not found')\n", (33981, 34017), False, 'import pytest\n'), ((34474, 34553), 'pytest.raises', 'pytest.raises', (['TimeoutError'], {'match': '"""Reached max retry attempts.*internal error"""'}), "(TimeoutError, match='Reached max retry attempts.*internal error')\n", (34487, 34553), False, 'import pytest\n'), ((39120, 39164), 'pytest.raises', 'pytest.raises', (['EngineException'], {'match': '"""boom"""'}), "(EngineException, match='boom')\n", (39133, 39164), False, 'import pytest\n'), ((1841, 1953), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""', 'code': 'code', 'description': '"""A program"""', 'labels': 'labels'}), "(name='projects/proj/programs/prog', code=code,\n    description='A program', labels=labels)\n", (1862, 1953), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((2267, 2364), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""', 'code': 'code', 'description': '"""A program"""'}), "(name='projects/proj/programs/prog', code=code,\n    description='A program')\n", (2288, 2364), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((2650, 2738), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""', 'code': 'code', 'labels': 'labels'}), "(name='projects/proj/programs/prog', code=code, labels\n    =labels)\n", (2671, 2738), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((2975, 3043), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""', 'code': 'code'}), "(name='projects/proj/programs/prog', code=code)\n", (2996, 3043), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((3294, 3326), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'code': 'code'}), '(code=code)\n', (3315, 3326), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((4880, 4905), 'datetime.date', 'datetime.date', (['(2020)', '(9)', '(1)'], {}), '(2020, 9, 1)\n', (4893, 4905), False, 'import datetime\n'), ((4994, 5062), 'datetime.datetime', 'datetime.datetime', (['(2020)', '(9)', '(1)', '(0)', '(0)', '(0)'], {'tzinfo': 'datetime.timezone.utc'}), '(2020, 9, 1, 0, 0, 0, tzinfo=datetime.timezone.utc)\n', (5011, 5062), False, 'import datetime\n'), ((5199, 5225), 'datetime.date', 'datetime.date', (['(2020)', '(10)', '(1)'], {}), '(2020, 10, 1)\n', (5212, 5225), False, 'import datetime\n'), ((5326, 5351), 'datetime.date', 'datetime.date', (['(2020)', '(9)', '(1)'], {}), '(2020, 9, 1)\n', (5339, 5351), False, 'import datetime\n'), ((5365, 5434), 'datetime.datetime', 'datetime.datetime', (['(2020)', '(9)', '(1)', '(0)', '(0)', '(10)'], {'tzinfo': 'datetime.timezone.utc'}), '(2020, 9, 1, 0, 0, 10, tzinfo=datetime.timezone.utc)\n', (5382, 5434), False, 'import datetime\n'), ((5804, 5829), 'datetime.date', 'datetime.date', (['(2020)', '(8)', '(1)'], {}), '(2020, 8, 1)\n', (5817, 5829), False, 'import datetime\n'), ((5843, 5902), 'datetime.datetime', 'datetime.datetime', (['(2020)', '(9)', '(1)'], {'tzinfo': 'datetime.timezone.utc'}), '(2020, 9, 1, tzinfo=datetime.timezone.utc)\n', (5860, 5902), False, 'import datetime\n'), ((7461, 7548), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""', 'description': '"""A program"""'}), "(name='projects/proj/programs/prog', description=\n    'A program')\n", (7482, 7548), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((7583, 7637), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['description']"}), "(paths=['description'])\n", (7614, 7637), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((7823, 7880), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""'}), "(name='projects/proj/programs/prog')\n", (7844, 7880), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((7890, 7944), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['description']"}), "(paths=['description'])\n", (7921, 7944), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((8742, 8844), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""', 'labels': 'labels', 'label_fingerprint': '"""hash"""'}), "(name='projects/proj/programs/prog', labels=labels,\n    label_fingerprint='hash')\n", (8763, 8844), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((8910, 8959), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['labels']"}), "(paths=['labels'])\n", (8941, 8959), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((9140, 9228), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""', 'label_fingerprint': '"""hash"""'}), "(name='projects/proj/programs/prog', label_fingerprint\n    ='hash')\n", (9161, 9228), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((9263, 9312), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['labels']"}), "(paths=['labels'])\n", (9294, 9312), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((10309, 10473), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""', 'labels': "{'color': 'red', 'weather': 'sun', 'run': '1', 'hello': 'world'}", 'label_fingerprint': '"""hash"""'}), "(name='projects/proj/programs/prog', labels={'color':\n    'red', 'weather': 'sun', 'run': '1', 'hello': 'world'},\n    label_fingerprint='hash')\n", (10330, 10473), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((10703, 10752), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['labels']"}), "(paths=['labels'])\n", (10734, 10752), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((10988, 11153), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""', 'labels': "{'color': 'blue', 'weather': 'sun', 'run': '1', 'hello': 'world'}", 'label_fingerprint': '"""hash"""'}), "(name='projects/proj/programs/prog', labels={'color':\n    'blue', 'weather': 'sun', 'run': '1', 'hello': 'world'},\n    label_fingerprint='hash')\n", (11009, 11153), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((11383, 11432), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['labels']"}), "(paths=['labels'])\n", (11414, 11432), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((12399, 12523), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""', 'labels': "{'color': 'red', 'run': '1'}", 'label_fingerprint': '"""hash"""'}), "(name='projects/proj/programs/prog', labels={'color':\n    'red', 'run': '1'}, label_fingerprint='hash')\n", (12420, 12523), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((12690, 12739), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['labels']"}), "(paths=['labels'])\n", (12721, 12739), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((12988, 13076), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumProgram', 'qtypes.QuantumProgram', ([], {'name': '"""projects/proj/programs/prog"""', 'label_fingerprint': '"""hash"""'}), "(name='projects/proj/programs/prog', label_fingerprint\n    ='hash')\n", (13009, 13076), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((13111, 13160), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['labels']"}), "(paths=['labels'])\n", (13142, 13160), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((19150, 19239), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""', 'description': '"""A job"""'}), "(name='projects/proj/programs/prog/jobs/job0', description\n    ='A job')\n", (19167, 19239), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((19270, 19324), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['description']"}), "(paths=['description'])\n", (19301, 19324), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((19520, 19583), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""'}), "(name='projects/proj/programs/prog/jobs/job0')\n", (19537, 19583), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((19593, 19647), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['description']"}), "(paths=['description'])\n", (19624, 19647), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((20445, 20554), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""', 'labels': 'labels', 'label_fingerprint': '"""hash"""'}), "(name='projects/proj/programs/prog/jobs/job0', labels=\n    labels, label_fingerprint='hash')\n", (20462, 20554), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((20611, 20660), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['labels']"}), "(paths=['labels'])\n", (20642, 20660), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((20851, 20944), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""', 'label_fingerprint': '"""hash"""'}), "(name='projects/proj/programs/prog/jobs/job0',\n    label_fingerprint='hash')\n", (20868, 20944), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((20976, 21025), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['labels']"}), "(paths=['labels'])\n", (21007, 21025), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((22010, 22181), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""', 'labels': "{'color': 'red', 'weather': 'sun', 'run': '1', 'hello': 'world'}", 'label_fingerprint': '"""hash"""'}), "(name='projects/proj/programs/prog/jobs/job0', labels={\n    'color': 'red', 'weather': 'sun', 'run': '1', 'hello': 'world'},\n    label_fingerprint='hash')\n", (22027, 22181), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((22382, 22431), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['labels']"}), "(paths=['labels'])\n", (22413, 22431), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((22677, 22849), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""', 'labels': "{'color': 'blue', 'weather': 'sun', 'run': '1', 'hello': 'world'}", 'label_fingerprint': '"""hash"""'}), "(name='projects/proj/programs/prog/jobs/job0', labels={\n    'color': 'blue', 'weather': 'sun', 'run': '1', 'hello': 'world'},\n    label_fingerprint='hash')\n", (22694, 22849), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((23050, 23099), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['labels']"}), "(paths=['labels'])\n", (23081, 23099), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((24098, 24229), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""', 'labels': "{'color': 'red', 'run': '1'}", 'label_fingerprint': '"""hash"""'}), "(name='projects/proj/programs/prog/jobs/job0', labels={\n    'color': 'red', 'run': '1'}, label_fingerprint='hash')\n", (24115, 24229), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((24375, 24424), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['labels']"}), "(paths=['labels'])\n", (24406, 24424), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((24679, 24772), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumJob', 'qtypes.QuantumJob', ([], {'name': '"""projects/proj/programs/prog/jobs/job0"""', 'label_fingerprint': '"""hash"""'}), "(name='projects/proj/programs/prog/jobs/job0',\n    label_fingerprint='hash')\n", (24696, 24772), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((24804, 24853), 'cirq.google.engine.client.quantum_v1alpha1.types.field_mask_pb2.FieldMask', 'qtypes.field_mask_pb2.FieldMask', ([], {'paths': "['labels']"}), "(paths=['labels'])\n", (24835, 24853), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((27342, 27367), 'datetime.date', 'datetime.date', (['(2020)', '(9)', '(1)'], {}), '(2020, 9, 1)\n', (27355, 27367), False, 'import datetime\n'), ((27474, 27542), 'datetime.datetime', 'datetime.datetime', (['(2020)', '(9)', '(1)', '(0)', '(0)', '(0)'], {'tzinfo': 'datetime.timezone.utc'}), '(2020, 9, 1, 0, 0, 0, tzinfo=datetime.timezone.utc)\n', (27491, 27542), False, 'import datetime\n'), ((27697, 27723), 'datetime.date', 'datetime.date', (['(2020)', '(10)', '(1)'], {}), '(2020, 10, 1)\n', (27710, 27723), False, 'import datetime\n'), ((27842, 27867), 'datetime.date', 'datetime.date', (['(2020)', '(9)', '(1)'], {}), '(2020, 9, 1)\n', (27855, 27867), False, 'import datetime\n'), ((27881, 27950), 'datetime.datetime', 'datetime.datetime', (['(2020)', '(9)', '(1)', '(0)', '(0)', '(10)'], {'tzinfo': 'datetime.timezone.utc'}), '(2020, 9, 1, 0, 0, 10, tzinfo=datetime.timezone.utc)\n', (27898, 27950), False, 'import datetime\n'), ((28687, 28712), 'datetime.date', 'datetime.date', (['(2020)', '(8)', '(1)'], {}), '(2020, 8, 1)\n', (28700, 28712), False, 'import datetime\n'), ((28726, 28785), 'datetime.datetime', 'datetime.datetime', (['(2020)', '(9)', '(1)'], {'tzinfo': 'datetime.timezone.utc'}), '(2020, 9, 1, tzinfo=datetime.timezone.utc)\n', (28743, 28785), False, 'import datetime\n'), ((35141, 35170), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000000000)'}), '(seconds=1000000000)\n', (35150, 35170), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((35189, 35218), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000003600)'}), '(seconds=1000003600)\n', (35198, 35218), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((36143, 36172), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000000000)'}), '(seconds=1000000000)\n', (36152, 36172), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((36191, 36220), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000002000)'}), '(seconds=1000002000)\n', (36200, 36220), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((36941, 36970), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000000000)'}), '(seconds=1000000000)\n', (36950, 36970), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((36989, 37018), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000002000)'}), '(seconds=1000002000)\n', (36998, 37018), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((37736, 37765), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000000000)'}), '(seconds=1000000000)\n', (37745, 37765), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((37784, 37813), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000002000)'}), '(seconds=1000002000)\n', (37793, 37813), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((40447, 40476), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000001000)'}), '(seconds=1000001000)\n', (40456, 40476), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((40495, 40524), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000002000)'}), '(seconds=1000002000)\n', (40504, 40524), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((41152, 41216), 'google.protobuf.field_mask_pb2.FieldMask', 'FieldMask', ([], {'paths': "['start_time', 'end_time', 'whitelisted_users']"}), "(paths=['start_time', 'end_time', 'whitelisted_users'])\n", (41161, 41216), False, 'from google.protobuf.field_mask_pb2 import FieldMask\n'), ((42002, 42040), 'google.protobuf.field_mask_pb2.FieldMask', 'FieldMask', ([], {'paths': "['whitelisted_users']"}), "(paths=['whitelisted_users'])\n", (42011, 42040), False, 'from google.protobuf.field_mask_pb2 import FieldMask\n'), ((6803, 6817), 'cirq.google.engine.engine_client.EngineClient', 'EngineClient', ([], {}), '()\n', (6815, 6817), False, 'from cirq.google.engine.engine_client import EngineClient, EngineException\n'), ((39573, 39602), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000000000)'}), '(seconds=1000000000)\n', (39582, 39602), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((39625, 39654), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000002000)'}), '(seconds=1000002000)\n', (39634, 39654), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((39799, 39828), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1200000000)'}), '(seconds=1200000000)\n', (39808, 39828), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((39851, 39880), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1200002000)'}), '(seconds=1200002000)\n', (39860, 39880), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((40790, 40833), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['(1000001000)'], {}), '(1000001000)\n', (40821, 40833), False, 'import datetime\n'), ((40847, 40890), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['(1000002000)'], {}), '(1000002000)\n', (40878, 40890), False, 'import datetime\n'), ((42329, 42358), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000020000)'}), '(seconds=1000020000)\n', (42338, 42358), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((42381, 42410), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000040000)'}), '(seconds=1000040000)\n', (42390, 42410), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((42514, 42623), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumTimeSlot.MaintenanceConfig', 'qtypes.QuantumTimeSlot.MaintenanceConfig', ([], {'title': '"""Testing"""', 'description': '"""Testing some new configuration."""'}), "(title='Testing', description=\n    'Testing some new configuration.')\n", (42554, 42623), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((42773, 42802), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000010000)'}), '(seconds=1000010000)\n', (42782, 42802), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((42825, 42854), 'google.protobuf.timestamp_pb2.Timestamp', 'Timestamp', ([], {'seconds': '(1000020000)'}), '(seconds=1000020000)\n', (42834, 42854), False, 'from google.protobuf.timestamp_pb2 import Timestamp\n'), ((42958, 43033), 'cirq.google.engine.client.quantum_v1alpha1.types.QuantumTimeSlot.ReservationConfig', 'qtypes.QuantumTimeSlot.ReservationConfig', ([], {'project_id': '"""super_secret_quantum"""'}), "(project_id='super_secret_quantum')\n", (42998, 43033), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((14627, 14730), 'cirq.google.engine.client.quantum_v1alpha1.types.SchedulingConfig.ProcessorSelector', 'qtypes.SchedulingConfig.ProcessorSelector', ([], {'processor_names': "['projects/proj/processors/processor0']"}), "(processor_names=[\n    'projects/proj/processors/processor0'])\n", (14668, 14730), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((15336, 15439), 'cirq.google.engine.client.quantum_v1alpha1.types.SchedulingConfig.ProcessorSelector', 'qtypes.SchedulingConfig.ProcessorSelector', ([], {'processor_names': "['projects/proj/processors/processor0']"}), "(processor_names=[\n    'projects/proj/processors/processor0'])\n", (15377, 15439), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((16106, 16209), 'cirq.google.engine.client.quantum_v1alpha1.types.SchedulingConfig.ProcessorSelector', 'qtypes.SchedulingConfig.ProcessorSelector', ([], {'processor_names': "['projects/proj/processors/processor0']"}), "(processor_names=[\n    'projects/proj/processors/processor0'])\n", (16147, 16209), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((16739, 16842), 'cirq.google.engine.client.quantum_v1alpha1.types.SchedulingConfig.ProcessorSelector', 'qtypes.SchedulingConfig.ProcessorSelector', ([], {'processor_names': "['projects/proj/processors/processor0']"}), "(processor_names=[\n    'projects/proj/processors/processor0'])\n", (16780, 16842), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n'), ((17453, 17556), 'cirq.google.engine.client.quantum_v1alpha1.types.SchedulingConfig.ProcessorSelector', 'qtypes.SchedulingConfig.ProcessorSelector', ([], {'processor_names': "['projects/proj/processors/processor0']"}), "(processor_names=[\n    'projects/proj/processors/processor0'])\n", (17494, 17556), True, 'from cirq.google.engine.client.quantum_v1alpha1 import types as qtypes\n')]