
                         R    d Z ddlmZ ddlmZ ddlmZ ddlZddlZ G d de      Zy)z?Utilities for computing copy operations from command arguments.    )absolute_import)division)unicode_literalsNc                   R    e Zd ZdZdZd Zed        Zed        Zd Z	d Z
d Zd	 Zy
)Pathz@Wrapper to help with dealing with local and GCS paths uniformly.z{sep}\.+({sep}|$)c                     || _         y Npath)selfr   s     /lib/googlecloudsdk/command_lib/storage/paths.py__init__zPath.__init__    s	    DI    c                 8    | j                   j                  d      S )Nzgs://)r   
startswithr   s    r   	is_remotezPath.is_remote#   s    99((r   c                     | j                   r| j                  j                  d      S | j                  j                  t        j                        S N/)r   r   endswithossepr   s    r   is_dir_likezPath.is_dir_like'   s7    ~~YY$$99bff%%r   c                     | j                   r9t        | j                  j                  d      dz   |j	                  d      z         S t        t
        j                  j                  | j                  |            S r   )r   r   r   rstriplstripr   join)r   parts     r   Joinz	Path.Join-   sT    ~~$))""3'#-C0@@AATYY-..r   c                    | j                   rd}n6t        j                  dk(  rt        j                  dz  nt        j                  }t	        t        j                  t        j                  j                  |      | j                               S )Nr   nt   )r   )r   r   namer   boolresearchr   _INVALID_PATH_FORMATformatr   )r   r   s     r   
IsPathSafezPath.IsPathSafe2   sh    ~~c ''T/BFFQJrvvcBII!!((S(1		   r   c                     | j                   S r	   r
   r   s    r   __str__zPath.__str__<       99r   c                     | j                   S r	   r
   r   s    r   __repr__zPath.__repr__?   r-   r   N)__name__
__module____qualname____doc__r(   r   propertyr   r   r    r*   r,   r/    r   r   r   r      sL    H- ) ) & &
/
r   r   )	r3   
__future__r   r   r   r   r&   objectr   r5   r   r   <module>r8      s(     F &  ' 
 	%6 %r   