
                         .    S r SSKrSSKr " S S\5      rg)z?Utilities for computing copy operations from command arguments.    Nc                   Z    \ rS rSrSrSrS r\S 5       r\S 5       r	S r
S rS	 rS
 rSrg)Path   z@Wrapper to help with dealing with local and GCS paths uniformly.z{sep}\.+({sep}|$)c                     Xl         g Npath)selfr	   s     /lib/googlecloudsdk/command_lib/storage/paths.py__init__Path.__init__   s    I    c                 8    U R                   R                  S5      $ )Nzgs://)r	   
startswithr
   s    r   	is_remotePath.is_remote    s    99((r   c                     U R                   (       a  U R                  R                  S5      $ U R                  R                  [        R                  5      $ N/)r   r	   endswithossepr   s    r   is_dir_likePath.is_dir_like$   s7    ~~YY$$99bff%%r   c                     U R                   (       a9  [        U R                  R                  S5      S-   UR	                  S5      -   5      $ [        [
        R                  R                  U R                  U5      5      $ r   )r   r   r	   rstriplstripr   join)r
   parts     r   Join	Path.Join*   sT    ~~$))""3'#-C0@@AATYY-..r   c                 ,   U R                   (       a  SnO7[        R                  S:X  a  [        R                  S-  O[        R                  n[	        [
        R                  " [        R                  R                  US9U R                  5      5      (       + $ )Nr   nt   )r   )r   r   namer   boolresearchr   _INVALID_PATH_FORMATformatr	   )r
   r   s     r   
IsPathSafePath.IsPathSafe/   sh    ~~c ''T/BFFQJrvvcBII!!((S(1		   r   c                     U R                   $ r   r   r   s    r   __str__Path.__str__9       99r   c                     U R                   $ r   r   r   s    r   __repr__Path.__repr__<   r1   r   r   N)__name__
__module____qualname____firstlineno____doc__r*   r   propertyr   r   r!   r,   r/   r3   __static_attributes__ r   r   r   r      sL    H- ) ) & &
/
r   r   )r9   r   r(   objectr   r<   r   r   <module>r>      s     F 
 	%6 %r   