# 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'])):


import collections
import email.generator as generator
import email.mime.multipart as mime_multipart
import email.mime.nonmultipart as mime_nonmultipart
import email.parser as email_parser
import itertools
import StringIO
import time
import urllib
import urlparse
import uuid
from six.moves import http_client
from apitools.base.py import exceptions
from apitools.base.py import http_wrapper
  def _ConvertIdToHeader(self, request_id):
    """Convert an id to a Content-ID header value.

    Args:
      request_id: String identifier for a individual request.

    Returns:
      A Content-ID header with the id_ encoded into it. A UUID is prepended to
      the value because Content-ID headers are supposed to be universally
      unique.
    """
    return '<%s+%s>' % (self.__base_id, urllib.quote(request_id))

  @staticmethod
  def _ConvertHeaderToId(header):
    """Convert a Content-ID header value to an id.

    Presumes the Content-ID header conforms to the format that
    _ConvertIdToHeader() returns.

    Args:
      header: A string indicating the Content-ID header value.

    Returns:
      The extracted id value.

    Raises:
      BatchError if the header is not in the expected format.
    """
    if not (header.startswith('<') or header.endswith('>')):

# 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/batch.py
import collections
import email.generator as generator
import email.mime.multipart as mime_multipart
import email.mime.nonmultipart as mime_nonmultipart
import email.parser as email_parser
import itertools
import StringIO
import time
import urllib
import urlparse
import uuid
from six.moves import http_client
from apitools.base.py import exceptions
from apitools.base.py import http_wrapper

  def _ConvertIdToHeader(self, request_id):
    """Convert an id to a Content-ID header value.

    Args:
      request_id: String identifier for a individual request.

    Returns:
      A Content-ID header with the id_ encoded into it. A UUID is prepended to
      the value because Content-ID headers are supposed to be universally
      unique.
    """
    return '<%s+%s>' % (self.__base_id, urllib.quote(request_id))

  @staticmethod
  def _ConvertHeaderToId(header):
    """Convert a Content-ID header value to an id.

    Presumes the Content-ID header conforms to the format that
    _ConvertIdToHeader() returns.

    Args:
      header: A string indicating the Content-ID header value.

    Returns:
      The extracted id value.

    Raises:
      BatchError if the header is not in the expected format.
    """
    if not (header.startswith('<') or header.endswith('>')):

      raise exceptions.BatchError('Invalid value for Content-ID: %s' % header)