# Path: gslib/exception.py
# class InvalidUrlError(Exception):
#   """Exception raised when URL is invalid."""
# 
#   def __init__(self, message):
#     Exception.__init__(self, message)
#     self.message = message
# 
#   def __repr__(self):
#     return str(self)
# 
#   def __str__(self):
#     return 'InvalidUrlError: %s' % self.message
# 
# Path: gslib/utils/boto_util.py
# def GetMaxRetryDelay():
#   return config.getint('Boto', 'max_retry_delay', 32)
# 
# Path: gslib/utils/boto_util.py
# def GetNumRetries():
#   return config.getint('Boto', 'num_retries', 23)


import errno
import random
import re
import socket
import time
import six
from six.moves import urllib
from six.moves import http_client
from boto import config
from boto import UserAgent
from boto.connection import AWSAuthConnection
from boto.exception import ResumableTransferDisposition
from boto.exception import ResumableUploadException
from gslib.exception import InvalidUrlError
from gslib.utils.boto_util import GetMaxRetryDelay
from gslib.utils.boto_util import GetNumRetries
from gslib.utils.constants import XML_PROGRESS_CALLBACKS
from gslib.utils.constants import UTF8
      num_cb: (optional) If a callback is specified with the cb parameter, this
              parameter determines the granularity of the callback by defining
              the maximum number of times the callback will be called during the
              file transfer. Providing a negative integer will cause your
              callback to be called with each buffer read.

    Raises:
      ResumableUploadException if a problem occurs during the transfer.
    """

    if not headers:
      headers = {}
    # If Content-Type header is present and set to None, remove it.
    # This is gsutil's way of asking boto to refrain from auto-generating
    # that header.
    content_type = 'Content-Type'
    if content_type in headers and headers[content_type] is None:
      del headers[content_type]

    if canned_acl:
      headers[key.provider.acl_header] = canned_acl

    headers['User-Agent'] = UserAgent

    file_length = size
    debug = key.bucket.connection.debug

    # Use num-retries from constructor if one was provided; else check
    # for a value specified in the boto config file; else default to 5.
    if self.num_retries is None:

# Path: gslib/exception.py
# class InvalidUrlError(Exception):
#   """Exception raised when URL is invalid."""
# 
#   def __init__(self, message):
#     Exception.__init__(self, message)
#     self.message = message
# 
#   def __repr__(self):
#     return str(self)
# 
#   def __str__(self):
#     return 'InvalidUrlError: %s' % self.message
# 
# Path: gslib/utils/boto_util.py
# def GetMaxRetryDelay():
#   return config.getint('Boto', 'max_retry_delay', 32)
# 
# Path: gslib/utils/boto_util.py
# def GetNumRetries():
#   return config.getint('Boto', 'num_retries', 23)


# Path: gslib/boto_resumable_upload.py
import errno
import random
import re
import socket
import time
import six
from six.moves import urllib
from six.moves import http_client
from boto import config
from boto import UserAgent
from boto.connection import AWSAuthConnection
from boto.exception import ResumableTransferDisposition
from boto.exception import ResumableUploadException
from gslib.exception import InvalidUrlError
from gslib.utils.boto_util import GetMaxRetryDelay
from gslib.utils.boto_util import GetNumRetries
from gslib.utils.constants import XML_PROGRESS_CALLBACKS
from gslib.utils.constants import UTF8

      num_cb: (optional) If a callback is specified with the cb parameter, this
              parameter determines the granularity of the callback by defining
              the maximum number of times the callback will be called during the
              file transfer. Providing a negative integer will cause your
              callback to be called with each buffer read.

    Raises:
      ResumableUploadException if a problem occurs during the transfer.
    """

    if not headers:
      headers = {}
    # If Content-Type header is present and set to None, remove it.
    # This is gsutil's way of asking boto to refrain from auto-generating
    # that header.
    content_type = 'Content-Type'
    if content_type in headers and headers[content_type] is None:
      del headers[content_type]

    if canned_acl:
      headers[key.provider.acl_header] = canned_acl

    headers['User-Agent'] = UserAgent

    file_length = size
    debug = key.bucket.connection.debug

    # Use num-retries from constructor if one was provided; else check
    # for a value specified in the boto config file; else default to 5.
    if self.num_retries is None:

      self.num_retries = GetNumRetries()