# 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_retries: Number of times to retry the upload making no progress.
                   This count resets every time we make progress, so the upload
                   can span many more than this number of retries.
    """
    if resume_url:
      self._SetUploadUrl(resume_url)
    else:
      self.upload_url = None
    self.num_retries = num_retries
    self.service_has_bytes = 0  # Byte count at last service check.
    # Save upload_start_point in instance state so caller can find how
    # much was transferred by this ResumableUploadHandler (across retries).
    self.upload_start_point = None
    self.tracker_callback = tracker_callback
    self.logger = logger

  def _SetUploadUrl(self, url):
    """Saves URL and resets upload state.

    Called when we start a new resumable upload or get a new tracker
    URL for the upload.

    Args:
      url: URL string for the upload.

    Raises InvalidUrlError if URL is syntactically invalid.
    """
    parse_result = urllib.parse.urlparse(url)
    if (parse_result.scheme.lower() not in ['http', 'https'] or
        not parse_result.netloc):

# 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_retries: Number of times to retry the upload making no progress.
                   This count resets every time we make progress, so the upload
                   can span many more than this number of retries.
    """
    if resume_url:
      self._SetUploadUrl(resume_url)
    else:
      self.upload_url = None
    self.num_retries = num_retries
    self.service_has_bytes = 0  # Byte count at last service check.
    # Save upload_start_point in instance state so caller can find how
    # much was transferred by this ResumableUploadHandler (across retries).
    self.upload_start_point = None
    self.tracker_callback = tracker_callback
    self.logger = logger

  def _SetUploadUrl(self, url):
    """Saves URL and resets upload state.

    Called when we start a new resumable upload or get a new tracker
    URL for the upload.

    Args:
      url: URL string for the upload.

    Raises InvalidUrlError if URL is syntactically invalid.
    """
    parse_result = urllib.parse.urlparse(url)
    if (parse_result.scheme.lower() not in ['http', 'https'] or
        not parse_result.netloc):

      raise InvalidUrlError('Invalid upload URL (%s)' % url)