
                         V    d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZ G d de      Zy)	a  Class that holds state for instantiating StorageUri objects.

The StorageUri func defined in this class uses that state
(bucket_storage_uri_class and debug) needed plus gsutil default flag values to
instantiate this frequently constructed object with just one param for most
cases.
    )absolute_import)print_function)division)unicode_literalsNc                       e Zd ZdZd Zd Zy)StorageUriBuilderz+Class for instantiating StorageUri objects.c                      || _         || _        y)zInitializes the builder.

    Args:
      debug: Debug level to pass in to boto connection (range 0..3).
      bucket_storage_uri_class: Class to instantiate for cloud StorageUris.
                                Settable for testing/mocking.
    N)bucket_storage_uri_classdebug)selfr   r
   s      ,platform/gsutil/gslib/storage_uri_builder.py__init__zStorageUriBuilder.__init__"   s     %=D!DJ    c                 `    t        j                  |d| j                  d| j                  d      S )zInstantiates StorageUri using class state and gsutil default flag values.

    Args:
      uri_str: StorageUri naming bucket or object.

    Returns:
      boto.StorageUri for given uri_str.

    Raises:
      InvalidUriError: if uri_str not valid.
    fileF)r   validater
   suppress_consec_slashes)botostorage_urir   r
   )r   uri_strs     r   
StorageUrizStorageUriBuilder.StorageUri-   s3     jj!%!>!> %' 'r   N)__name__
__module____qualname____doc__r   r    r   r   r   r      s    3	'r   r   )	r   
__future__r   r   r   r   r   objectr   r   r   r   <module>r      s'    ' %  '  '  'r   