def StorageUrlFromString(url_str):
  """Static factory function for creating a StorageUrl from a string."""

  scheme = _GetSchemeFromUrlString(url_str)

  if scheme not in ('file', 's3', 'gs'):
    raise InvalidUrlError('Unrecognized scheme "%s"' % scheme)
  if scheme == 'file':
    path = _GetPathFromUrlString(url_str)
    is_stream = (path == '-')
    return _FileUrl(url_str, is_stream=is_stream)
  return _CloudUrl(url_str)
dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/storage_url.py/StorageUrlFromString/original