# 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
    self.__stream = stream
    self.__start_pos = start
    self.__buffer_pos = 0
    self.__buffered_data = self.__stream.read(size)
    self.__stream_at_end = len(self.__buffered_data) < size
    self.__end_pos = self.__start_pos + len(self.__buffered_data)

  def __str__(self):
    return ('Buffered stream %s from position %s-%s with %s '
            'bytes remaining' % (self.__stream, self.__start_pos,
                                 self.__end_pos, self._bytes_remaining))

  def __len__(self):
    return len(self.__buffered_data)

  @property
  def stream_exhausted(self):
    return self.__stream_at_end

  @property
  def stream_end_position(self):
    return self.__end_pos

  @property
  def _bytes_remaining(self):
    return len(self.__buffered_data) - self.__buffer_pos

  def read(self, size=None):  # pylint: disable=invalid-name
    """Reads from the buffer."""
    if size is None or size < 0:

# 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/buffered_stream.py
from apitools.base.py import exceptions

    self.__stream = stream
    self.__start_pos = start
    self.__buffer_pos = 0
    self.__buffered_data = self.__stream.read(size)
    self.__stream_at_end = len(self.__buffered_data) < size
    self.__end_pos = self.__start_pos + len(self.__buffered_data)

  def __str__(self):
    return ('Buffered stream %s from position %s-%s with %s '
            'bytes remaining' % (self.__stream, self.__start_pos,
                                 self.__end_pos, self._bytes_remaining))

  def __len__(self):
    return len(self.__buffered_data)

  @property
  def stream_exhausted(self):
    return self.__stream_at_end

  @property
  def stream_end_position(self):
    return self.__end_pos

  @property
  def _bytes_remaining(self):
    return len(self.__buffered_data) - self.__buffer_pos

  def read(self, size=None):  # pylint: disable=invalid-name
    """Reads from the buffer."""
    if size is None or size < 0:

      raise exceptions.NotYetImplementedError(