# Path: gslib/storage_url.py
# PROVIDER_REGEX = re.compile(r'(?P<provider>[^:]*)://$')
# BUCKET_REGEX = re.compile(r'(?P<provider>[^:]*)://(?P<bucket>[^/]*)/{0,1}$')
# OBJECT_REGEX = re.compile(
#     r'(?P<provider>[^:]*)://(?P<bucket>[^/]*)/(?P<object>.*)')
# GS_GENERATION_REGEX = re.compile(r'(?P<object>.+)#(?P<generation>[0-9]+)$')
# S3_VERSION_REGEX = re.compile(r'(?P<object>.+)#(?P<version_id>.+)$')
# FILE_OBJECT_REGEX = re.compile(r'([^:]*://)(?P<filepath>.*)')
# WILDCARD_REGEX = re.compile(r'[*?\[\]]')
# class StorageUrl(object):
# class _FileUrl(StorageUrl):
# class _CloudUrl(StorageUrl):
#   def Clone(self):
#   def IsFileUrl(self):
#   def IsCloudUrl(self):
#   def IsStream():
#   def IsFifo(self):
#   def CreatePrefixUrl(self, wildcard_suffix=None):
#   def _WarnIfUnsupportedDoubleWildcard(self):
#   def url_string(self):
#   def versionless_url_string(self):
#   def __eq__(self, other):
#   def __hash__(self):
#   def __init__(self, url_string, is_stream=False, is_fifo=False):
#   def Clone(self):
#   def IsFileUrl(self):
#   def IsCloudUrl(self):
#   def IsStream(self):
#   def IsFifo(self):
#   def IsDirectory(self):
#   def CreatePrefixUrl(self, wildcard_suffix=None):
#   def url_string(self):
#   def versionless_url_string(self):
#   def __str__(self):
#   def __init__(self, url_string):
#   def Clone(self):
#   def IsFileUrl(self):
#   def IsCloudUrl(self):
#   def IsStream(self):
#   def IsFifo(self):
#   def IsBucket(self):
#   def IsObject(self):
#   def HasGeneration(self):
#   def IsProvider(self):
#   def CreatePrefixUrl(self, wildcard_suffix=None):
#   def bucket_url_string(self):
#   def url_string(self):
#   def versionless_url_string(self):
#   def __str__(self):
# def GetSchemeFromUrlString(url_str):
# def IsKnownUrlScheme(scheme_str):
# def _GetPathFromUrlString(url_str):
# def ContainsWildcard(url_string):
# def GenerationFromUrlAndString(url, generation):
# def HaveFileUrls(args_to_check):
# def HaveProviderUrls(args_to_check):
# def IsCloudSubdirPlaceholder(url, blr=None):
# def IsFileUrlString(url_str):
# def StorageUrlFromString(url_str):
# def StripOneSlash(url_str):
# def UrlsAreForSingleProvider(url_args):
# 
# 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


import os
import sys
from gslib import storage_url
from gslib.exception import InvalidUrlError
from gslib.tests.testcase import base
from unittest import mock
    self.assertFalse(storage_url.IsFileUrlString('s3://abc'))

  def test_storage_url_from_string(self):
    url = storage_url.StorageUrlFromString('abc')
    self.assertTrue(url.IsFileUrl())
    self.assertEquals('abc', url.object_name)

    url = storage_url.StorageUrlFromString('file://abc/123')
    self.assertTrue(url.IsFileUrl())
    self.assertEquals('abc%s123' % os.sep, url.object_name)

    url = storage_url.StorageUrlFromString('gs://abc/123/456')
    self.assertTrue(url.IsCloudUrl())
    self.assertEquals('abc', url.bucket_name)
    self.assertEquals('123/456', url.object_name)

    url = storage_url.StorageUrlFromString('gs://abc///:/')
    self.assertTrue(url.IsCloudUrl())
    self.assertEquals('abc', url.bucket_name)
    self.assertEquals('//:/', url.object_name)

    url = storage_url.StorageUrlFromString('s3://abc/123/456')
    self.assertTrue(url.IsCloudUrl())
    self.assertEquals('abc', url.bucket_name)
    self.assertEquals('123/456', url.object_name)

  def test_raises_error_for_too_many_slashes_after_scheme(self):
    with self.assertRaises(InvalidUrlError):
      storage_url.StorageUrlFromString('gs:///')


# Path: gslib/storage_url.py
# PROVIDER_REGEX = re.compile(r'(?P<provider>[^:]*)://$')
# BUCKET_REGEX = re.compile(r'(?P<provider>[^:]*)://(?P<bucket>[^/]*)/{0,1}$')
# OBJECT_REGEX = re.compile(
#     r'(?P<provider>[^:]*)://(?P<bucket>[^/]*)/(?P<object>.*)')
# GS_GENERATION_REGEX = re.compile(r'(?P<object>.+)#(?P<generation>[0-9]+)$')
# S3_VERSION_REGEX = re.compile(r'(?P<object>.+)#(?P<version_id>.+)$')
# FILE_OBJECT_REGEX = re.compile(r'([^:]*://)(?P<filepath>.*)')
# WILDCARD_REGEX = re.compile(r'[*?\[\]]')
# class StorageUrl(object):
# class _FileUrl(StorageUrl):
# class _CloudUrl(StorageUrl):
#   def Clone(self):
#   def IsFileUrl(self):
#   def IsCloudUrl(self):
#   def IsStream():
#   def IsFifo(self):
#   def CreatePrefixUrl(self, wildcard_suffix=None):
#   def _WarnIfUnsupportedDoubleWildcard(self):
#   def url_string(self):
#   def versionless_url_string(self):
#   def __eq__(self, other):
#   def __hash__(self):
#   def __init__(self, url_string, is_stream=False, is_fifo=False):
#   def Clone(self):
#   def IsFileUrl(self):
#   def IsCloudUrl(self):
#   def IsStream(self):
#   def IsFifo(self):
#   def IsDirectory(self):
#   def CreatePrefixUrl(self, wildcard_suffix=None):
#   def url_string(self):
#   def versionless_url_string(self):
#   def __str__(self):
#   def __init__(self, url_string):
#   def Clone(self):
#   def IsFileUrl(self):
#   def IsCloudUrl(self):
#   def IsStream(self):
#   def IsFifo(self):
#   def IsBucket(self):
#   def IsObject(self):
#   def HasGeneration(self):
#   def IsProvider(self):
#   def CreatePrefixUrl(self, wildcard_suffix=None):
#   def bucket_url_string(self):
#   def url_string(self):
#   def versionless_url_string(self):
#   def __str__(self):
# def GetSchemeFromUrlString(url_str):
# def IsKnownUrlScheme(scheme_str):
# def _GetPathFromUrlString(url_str):
# def ContainsWildcard(url_string):
# def GenerationFromUrlAndString(url, generation):
# def HaveFileUrls(args_to_check):
# def HaveProviderUrls(args_to_check):
# def IsCloudSubdirPlaceholder(url, blr=None):
# def IsFileUrlString(url_str):
# def StorageUrlFromString(url_str):
# def StripOneSlash(url_str):
# def UrlsAreForSingleProvider(url_args):
# 
# 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/tests/test_storage_url.py
import os
import sys
from gslib import storage_url
from gslib.exception import InvalidUrlError
from gslib.tests.testcase import base
from unittest import mock

    self.assertFalse(storage_url.IsFileUrlString('s3://abc'))

  def test_storage_url_from_string(self):
    url = storage_url.StorageUrlFromString('abc')
    self.assertTrue(url.IsFileUrl())
    self.assertEquals('abc', url.object_name)

    url = storage_url.StorageUrlFromString('file://abc/123')
    self.assertTrue(url.IsFileUrl())
    self.assertEquals('abc%s123' % os.sep, url.object_name)

    url = storage_url.StorageUrlFromString('gs://abc/123/456')
    self.assertTrue(url.IsCloudUrl())
    self.assertEquals('abc', url.bucket_name)
    self.assertEquals('123/456', url.object_name)

    url = storage_url.StorageUrlFromString('gs://abc///:/')
    self.assertTrue(url.IsCloudUrl())
    self.assertEquals('abc', url.bucket_name)
    self.assertEquals('//:/', url.object_name)

    url = storage_url.StorageUrlFromString('s3://abc/123/456')
    self.assertTrue(url.IsCloudUrl())
    self.assertEquals('abc', url.bucket_name)
    self.assertEquals('123/456', url.object_name)

  def test_raises_error_for_too_many_slashes_after_scheme(self):
    with self.assertRaises(InvalidUrlError):
      storage_url.StorageUrlFromString('gs:///')


    with self.assertRaises(InvalidUrlError):