# Path: google/cloud/datastore/helpers.py
# def _get_meaning(value_pb, is_list=False):
# def _new_value_pb(entity_pb, name):
# def entity_from_protobuf(pb):
# def _set_pb_meaning_from_entity(entity, name, value, value_pb, is_list=False):
# def entity_to_protobuf(entity):
# def get_read_options(eventual, transaction_id):
# def key_from_protobuf(pb):
# def _pb_attr_value(val):
# def _get_value_from_value_pb(pb):
# def _set_protobuf_value(value_pb, val):
#     def __init__(self, latitude, longitude):
#     def to_protobuf(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
# class GeoPoint(object):
# 
# Path: google/cloud/datastore_v1/types/datastore.py
# class LookupRequest(proto.Message):
# class LookupResponse(proto.Message):
# class RunQueryRequest(proto.Message):
# class RunQueryResponse(proto.Message):
# class BeginTransactionRequest(proto.Message):
# class BeginTransactionResponse(proto.Message):
# class RollbackRequest(proto.Message):
# class RollbackResponse(proto.Message):
# class CommitRequest(proto.Message):
#     class Mode(proto.Enum):
# class CommitResponse(proto.Message):
# class AllocateIdsRequest(proto.Message):
# class AllocateIdsResponse(proto.Message):
# class ReserveIdsRequest(proto.Message):
# class ReserveIdsResponse(proto.Message):
# class Mutation(proto.Message):
# class MutationResult(proto.Message):
# class ReadOptions(proto.Message):
#     class ReadConsistency(proto.Enum):
# class TransactionOptions(proto.Message):
#     class ReadWrite(proto.Message):
#     class ReadOnly(proto.Message):
#         MODE_UNSPECIFIED = 0
#         TRANSACTIONAL = 1
#         NON_TRANSACTIONAL = 2
#         READ_CONSISTENCY_UNSPECIFIED = 0
#         STRONG = 1
#         EVENTUAL = 2


from google.cloud.datastore import helpers
from google.cloud.datastore_v1.types import datastore as _datastore_pb2

        self._status = self._ABORTED

    def __enter__(self):
        self.begin()
        # NOTE: We make sure begin() succeeds before pushing onto the stack.
        self._client._push_batch(self)
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        try:
            if exc_type is None:
                self.commit()
            else:
                self.rollback()
        finally:
            self._client._pop_batch()


def _assign_entity_to_pb(entity_pb, entity):
    """Copy ``entity`` into ``entity_pb``.

    Helper method for ``Batch.put``.

    :type entity_pb: :class:`.entity_pb2.Entity`
    :param entity_pb: The entity owned by a mutation.

    :type entity: :class:`google.cloud.datastore.entity.Entity`
    :param entity: The entity being updated within the batch / transaction.
    """

# Path: google/cloud/datastore/helpers.py
# def _get_meaning(value_pb, is_list=False):
# def _new_value_pb(entity_pb, name):
# def entity_from_protobuf(pb):
# def _set_pb_meaning_from_entity(entity, name, value, value_pb, is_list=False):
# def entity_to_protobuf(entity):
# def get_read_options(eventual, transaction_id):
# def key_from_protobuf(pb):
# def _pb_attr_value(val):
# def _get_value_from_value_pb(pb):
# def _set_protobuf_value(value_pb, val):
#     def __init__(self, latitude, longitude):
#     def to_protobuf(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
# class GeoPoint(object):
# 
# Path: google/cloud/datastore_v1/types/datastore.py
# class LookupRequest(proto.Message):
# class LookupResponse(proto.Message):
# class RunQueryRequest(proto.Message):
# class RunQueryResponse(proto.Message):
# class BeginTransactionRequest(proto.Message):
# class BeginTransactionResponse(proto.Message):
# class RollbackRequest(proto.Message):
# class RollbackResponse(proto.Message):
# class CommitRequest(proto.Message):
#     class Mode(proto.Enum):
# class CommitResponse(proto.Message):
# class AllocateIdsRequest(proto.Message):
# class AllocateIdsResponse(proto.Message):
# class ReserveIdsRequest(proto.Message):
# class ReserveIdsResponse(proto.Message):
# class Mutation(proto.Message):
# class MutationResult(proto.Message):
# class ReadOptions(proto.Message):
#     class ReadConsistency(proto.Enum):
# class TransactionOptions(proto.Message):
#     class ReadWrite(proto.Message):
#     class ReadOnly(proto.Message):
#         MODE_UNSPECIFIED = 0
#         TRANSACTIONAL = 1
#         NON_TRANSACTIONAL = 2
#         READ_CONSISTENCY_UNSPECIFIED = 0
#         STRONG = 1
#         EVENTUAL = 2


# Path: google/cloud/datastore/batch.py
from google.cloud.datastore import helpers
from google.cloud.datastore_v1.types import datastore as _datastore_pb2


        self._status = self._ABORTED

    def __enter__(self):
        self.begin()
        # NOTE: We make sure begin() succeeds before pushing onto the stack.
        self._client._push_batch(self)
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        try:
            if exc_type is None:
                self.commit()
            else:
                self.rollback()
        finally:
            self._client._pop_batch()


def _assign_entity_to_pb(entity_pb, entity):
    """Copy ``entity`` into ``entity_pb``.

    Helper method for ``Batch.put``.

    :type entity_pb: :class:`.entity_pb2.Entity`
    :param entity_pb: The entity owned by a mutation.

    :type entity: :class:`google.cloud.datastore.entity.Entity`
    :param entity: The entity being updated within the batch / transaction.
    """

    bare_entity_pb = helpers.entity_to_protobuf(entity)