# Path: apitools/base/py/buffered_stream.py
# class BufferedStream(object):
#   def __init__(self, stream, start, size):
#   def __str__(self):
#   def __len__(self):
#   def stream_exhausted(self):
#   def stream_end_position(self):
#   def _bytes_remaining(self):
#   def read(self, size=None):  # pylint: disable=invalid-name
# 
# 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/http_wrapper.py
# RESUME_INCOMPLETE = 308
# TOO_MANY_REQUESTS = 429
# _REDIRECT_STATUS_CODES = (
#     http_client.MOVED_PERMANENTLY,
#     http_client.FOUND,
#     http_client.SEE_OTHER,
#     http_client.TEMPORARY_REDIRECT,
#     RESUME_INCOMPLETE,
# )
# def _Httplib2Debuglevel(http_request, level, http=None):
#   def __init__(self, url='', http_method='GET', headers=None, body=''):
#   def loggable_body(self):
#   def loggable_body(self, value):
#   def body(self):
#   def body(self, value):
#   def __len__(self):
#   def length(self):
#     def ProcessContentRange(content_range):
#   def status_code(self):
#   def retry_after(self):
#   def is_redirect(self):
# def CheckResponse(response):
# def RebuildHttpConnections(http):
# def RethrowExceptionHandler(*unused_args):
# def HandleExceptionsAndRebuildHttpConnections(retry_args):
# def MakeRequest(http, http_request, retries=7, redirections=5,
#                 retry_func=HandleExceptionsAndRebuildHttpConnections,
#                 check_response_func=CheckResponse):
# def _MakeRequestNoRetry(http, http_request, redirections=5,
#                         check_response_func=CheckResponse):
# def GetHttp(**kwds):
# class Request(object):
# class Response(collections.namedtuple(
#     'HttpResponse', ['info', 'content', 'request_url'])):
# 
# Path: apitools/base/py/stream_slice.py
# class StreamSlice(object):
#   def __init__(self, stream, max_bytes):
#   def __str__(self):
#   def __len__(self):
#   def __nonzero__(self):
#   def length(self):
#   def read(self, size=None):  # pylint: disable=missing-docstring
# 
# Path: apitools/base/py/util.py
# _RESERVED_URI_CHARS = r":/?#[]@!$&'()*+,;="
# def DetectGae():
# def DetectGce():
# def NormalizeScopes(scope_spec):
# def Typecheck(arg, arg_type, msg=None):
# def ExpandRelativePath(method_config, params, relative_path=None):
# def CalculateWaitForRetry(retry_attempt, max_wait=60):
# def AcceptableMimeType(accept_patterns, mime_type):
#   def MimeTypeMatches(pattern, mime_type):
# def MapParamNames(params, request_type):
# def MapRequestParams(params, request_type):


import email.generator as email_generator
import email.mime.multipart as mime_multipart
import email.mime.nonmultipart as mime_nonmultipart
import io
import json
import mimetypes
import os
import StringIO
import threading
import six
from six.moves import http_client
from apitools.base.py import buffered_stream
from apitools.base.py import exceptions
from apitools.base.py import http_wrapper
from apitools.base.py import stream_slice
from apitools.base.py import util
    self.auto_transfer = auto_transfer
    self.chunksize = chunksize or 1048576

  def __repr__(self):
    return str(self)

  @property
  def close_stream(self):
    return self.__close_stream

  @property
  def http(self):
    return self.__http

  @property
  def bytes_http(self):
    return self.__bytes_http or self.http

  @bytes_http.setter
  def bytes_http(self, value):
    self.__bytes_http = value

  @property
  def num_retries(self):
    return self.__num_retries

  @num_retries.setter
  def num_retries(self, value):
    util.Typecheck(value, six.integer_types)
    if value < 0:

# Path: apitools/base/py/buffered_stream.py
# class BufferedStream(object):
#   def __init__(self, stream, start, size):
#   def __str__(self):
#   def __len__(self):
#   def stream_exhausted(self):
#   def stream_end_position(self):
#   def _bytes_remaining(self):
#   def read(self, size=None):  # pylint: disable=invalid-name
# 
# 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/http_wrapper.py
# RESUME_INCOMPLETE = 308
# TOO_MANY_REQUESTS = 429
# _REDIRECT_STATUS_CODES = (
#     http_client.MOVED_PERMANENTLY,
#     http_client.FOUND,
#     http_client.SEE_OTHER,
#     http_client.TEMPORARY_REDIRECT,
#     RESUME_INCOMPLETE,
# )
# def _Httplib2Debuglevel(http_request, level, http=None):
#   def __init__(self, url='', http_method='GET', headers=None, body=''):
#   def loggable_body(self):
#   def loggable_body(self, value):
#   def body(self):
#   def body(self, value):
#   def __len__(self):
#   def length(self):
#     def ProcessContentRange(content_range):
#   def status_code(self):
#   def retry_after(self):
#   def is_redirect(self):
# def CheckResponse(response):
# def RebuildHttpConnections(http):
# def RethrowExceptionHandler(*unused_args):
# def HandleExceptionsAndRebuildHttpConnections(retry_args):
# def MakeRequest(http, http_request, retries=7, redirections=5,
#                 retry_func=HandleExceptionsAndRebuildHttpConnections,
#                 check_response_func=CheckResponse):
# def _MakeRequestNoRetry(http, http_request, redirections=5,
#                         check_response_func=CheckResponse):
# def GetHttp(**kwds):
# class Request(object):
# class Response(collections.namedtuple(
#     'HttpResponse', ['info', 'content', 'request_url'])):
# 
# Path: apitools/base/py/stream_slice.py
# class StreamSlice(object):
#   def __init__(self, stream, max_bytes):
#   def __str__(self):
#   def __len__(self):
#   def __nonzero__(self):
#   def length(self):
#   def read(self, size=None):  # pylint: disable=missing-docstring
# 
# Path: apitools/base/py/util.py
# _RESERVED_URI_CHARS = r":/?#[]@!$&'()*+,;="
# def DetectGae():
# def DetectGce():
# def NormalizeScopes(scope_spec):
# def Typecheck(arg, arg_type, msg=None):
# def ExpandRelativePath(method_config, params, relative_path=None):
# def CalculateWaitForRetry(retry_attempt, max_wait=60):
# def AcceptableMimeType(accept_patterns, mime_type):
#   def MimeTypeMatches(pattern, mime_type):
# def MapParamNames(params, request_type):
# def MapRequestParams(params, request_type):


# Path: apitools/base/py/transfer.py
import email.generator as email_generator
import email.mime.multipart as mime_multipart
import email.mime.nonmultipart as mime_nonmultipart
import io
import json
import mimetypes
import os
import StringIO
import threading
import six
from six.moves import http_client
from apitools.base.py import buffered_stream
from apitools.base.py import exceptions
from apitools.base.py import http_wrapper
from apitools.base.py import stream_slice
from apitools.base.py import util

    self.auto_transfer = auto_transfer
    self.chunksize = chunksize or 1048576

  def __repr__(self):
    return str(self)

  @property
  def close_stream(self):
    return self.__close_stream

  @property
  def http(self):
    return self.__http

  @property
  def bytes_http(self):
    return self.__bytes_http or self.http

  @bytes_http.setter
  def bytes_http(self, value):
    self.__bytes_http = value

  @property
  def num_retries(self):
    return self.__num_retries

  @num_retries.setter
  def num_retries(self, value):
    util.Typecheck(value, six.integer_types)
    if value < 0:

      raise exceptions.InvalidDataError(