# Path: apitools/base/py/exceptions.py
# class Error(Exception):
# class TypecheckError(Error, TypeError):
# class NotFoundError(Error):
# class UserError(Error):
# class InvalidDataError(Error):
# class CommunicationError(Error):
# class HttpError(CommunicationError):
# class InvalidUserInputError(InvalidDataError):
# class InvalidDataFromServerError(InvalidDataError, CommunicationError):
# class BatchError(Error):
# class ConfigurationError(Error):
# class GeneratedClientError(Error):
# class ConfigurationValueError(UserError):
# class ResourceUnavailableError(Error):
# class CredentialsError(Error):
# class TransferError(CommunicationError):
# class TransferRetryError(TransferError):
# class TransferInvalidError(TransferError):
# class RequestError(CommunicationError):
# class RetryAfterError(HttpError):
# class BadStatusCodeError(HttpError):
# class NotYetImplementedError(GeneratedClientError):
# class StreamExhausted(Error):
#   def __init__(self, response, content, url):
#   def __str__(self):
#   def status_code(self):
#   def FromResponse(cls, http_response):
#   def __init__(self, response, content, url, retry_after):
#   def FromResponse(cls, http_response):


from apitools.base.py import exceptions
  @property
  def length(self):
    # For 32-bit python2.x, len() cannot exceed a 32-bit number.
    return self.__max_bytes

  def read(self, size=None):  # pylint: disable=missing-docstring
    """Read at most size bytes from this slice.

    Compared to other streams, there is one case where we may
    unexpectedly raise an exception on read: if the underlying stream
    is exhausted (i.e. returns no bytes on read), and the size of this
    slice indicates we should still be able to read more bytes, we
    raise exceptions.StreamExhausted.

    Args:
      size: If provided, read no more than size bytes from the stream.

    Returns:
      The bytes read from this slice.

    Raises:
      exceptions.StreamExhausted

    """
    if size is not None:
      read_size = min(size, self.__remaining_bytes)
    else:
      read_size = self.__remaining_bytes
    data = self.__stream.read(read_size)
    if read_size > 0 and not data:

# Path: apitools/base/py/exceptions.py
# class Error(Exception):
# class TypecheckError(Error, TypeError):
# class NotFoundError(Error):
# class UserError(Error):
# class InvalidDataError(Error):
# class CommunicationError(Error):
# class HttpError(CommunicationError):
# class InvalidUserInputError(InvalidDataError):
# class InvalidDataFromServerError(InvalidDataError, CommunicationError):
# class BatchError(Error):
# class ConfigurationError(Error):
# class GeneratedClientError(Error):
# class ConfigurationValueError(UserError):
# class ResourceUnavailableError(Error):
# class CredentialsError(Error):
# class TransferError(CommunicationError):
# class TransferRetryError(TransferError):
# class TransferInvalidError(TransferError):
# class RequestError(CommunicationError):
# class RetryAfterError(HttpError):
# class BadStatusCodeError(HttpError):
# class NotYetImplementedError(GeneratedClientError):
# class StreamExhausted(Error):
#   def __init__(self, response, content, url):
#   def __str__(self):
#   def status_code(self):
#   def FromResponse(cls, http_response):
#   def __init__(self, response, content, url, retry_after):
#   def FromResponse(cls, http_response):


# Path: apitools/base/py/stream_slice.py
from apitools.base.py import exceptions

  @property
  def length(self):
    # For 32-bit python2.x, len() cannot exceed a 32-bit number.
    return self.__max_bytes

  def read(self, size=None):  # pylint: disable=missing-docstring
    """Read at most size bytes from this slice.

    Compared to other streams, there is one case where we may
    unexpectedly raise an exception on read: if the underlying stream
    is exhausted (i.e. returns no bytes on read), and the size of this
    slice indicates we should still be able to read more bytes, we
    raise exceptions.StreamExhausted.

    Args:
      size: If provided, read no more than size bytes from the stream.

    Returns:
      The bytes read from this slice.

    Raises:
      exceptions.StreamExhausted

    """
    if size is not None:
      read_size = min(size, self.__remaining_bytes)
    else:
      read_size = self.__remaining_bytes
    data = self.__stream.read(read_size)
    if read_size > 0 and not data:

      raise exceptions.StreamExhausted(