
    E                     l    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ddlmZ ddl	m
Z
 ddlmZ d	 Zd
 Zy)z$Path Utilities for storage commands.    )absolute_import)division)unicode_literalsN)storage_url)
properties)	platformsc                  @    t        t        j                  dd            S )z<Generates random integer for making file paths not conflict.   l    d(	 )strrandomrandint     3lib/googlecloudsdk/command_lib/storage/path_util.pygenerate_random_int_for_pathr      s     
V^^Av&	''r   c                    t        | j                  t        j                        rPt        j                  j                         r2t        j                  j                  j                  j                         s| S t        j                  |       }t        j                  |j                  j                        |j                  _        |S )a  Returns the resource with invalid characters replaced.

  The invalid characters are only replaced if the resource URL is a FileUrl
  and the platform is Windows. This is required because Cloud URLs may have
  certain characters that are not allowed in file paths on Windows.

  Args:
    resource (Resource): The resource.

  Returns:
    The resource with invalid characters replaced from the path.
  )
isinstancer   FileUrlr   OperatingSystem	IsWindowsr   VALUESstorage,convert_incompatible_windows_path_charactersGetBoolcopydeepcopyMakePathWindowsCompatibleresource_name)resourcesanitized_resources     r   "sanitize_file_resource_for_windowsr!   $   s     h**K,?,?@''113''TT\\^ O}}X.))

(
(
6
6   .
 
r   )__doc__
__future__r   r   r   r   r   "googlecloudsdk.command_lib.storager   googlecloudsdk.corer   googlecloudsdk.core.utilr   r   r!   r   r   r   <module>r'      s,     + &  '   : * .(r   