
    E                     l    S r SSKJr  SSKJr  SSKJr  SSKrSSKrSSKJr  SSK	J
r
  SSKJr  S	 rS
 rg)z$Path Utilities for storage commands.    )absolute_import)division)unicode_literalsN)storage_url)
properties)	platformsc                  B    [        [        R                  " SS5      5      $ )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                    [        U R                  [        R                  5      (       aZ  [        R                  R                  5       (       a7  [        R                  R                  R                  R                  5       (       d  U $ [        R                  " U 5      n[        R                  " UR                  R                  5      UR                  l        U$ )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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   