
                         d    S r SSKJr  SSKJr  SSKJr  SSKrSS jrSS jrS rS	 r	\\S
.r
S rg)a0  Debug resource transforms and symbols dict.

NOTICE: Each TransformFoo() method is the implementation of a foo() transform
function. Even though the implementation here is in Python the usage in resource
projection and filter expressions is language agnostic. This affects the
Pythonicness of the Transform*() methods:
  (1) The docstrings are used to generate external user documentation.
  (2) The method prototypes are included in the documentation. In particular the
      prototype formal parameter names are stylized for the documentation.
  (3) The types of some args, like r, are not fixed until runtime. Other args
      may have either a base type value or string representation of that type.
      It is up to the transform implementation to silently do the string=>type
      conversions. That's why you may see e.g. int(arg) in some of the methods.
  (4) Unless it is documented to do so, a transform function must not raise any
      exceptions. The `undefined' arg is used to handle all unusual conditions,
      including ones that would raise exceptions.
    )absolute_import)division)unicode_literalsNc                 P    [        X5      u  p#U(       a  SR                  X#5      $ U$ )a%  Returns a full description of the status of a logpoint or snapshot.

Status will be one of ACTIVE, COMPLETED, or a verbose error description. If
the status is an error, there will be additional information available in the
status field of the object.

Args:
  r: a JSON-serializable object
  undefined: Returns this value if the resource is not a valid status.

Returns:
  One of ACTIVE, COMPLETED, or a verbose error description.

Example:
  `--format="table(id, location, full_status())"`:::
  Displays the full status in the third table problem.
z{0}: {1})_TransformStatusesformat)r	undefinedshort_statusfull_statuss       .lib/googlecloudsdk/api_lib/debug/transforms.pyTransformFullStatusr   )   s+    $ 1>,\77    c                      [        X5      u  p#U$ )a  Returns a short description of the status of a logpoint or snapshot.

Status will be one of ACTIVE, COMPLETED, or a short error description. If
the status is an error, there will be additional information available in the
status field of the object.

Args:
  r: a JSON-serializable object
  undefined: Returns this value if the resource is not a valid status.

Returns:
  One of ACTIVE, COMPLETED, or an error description.

Example:
  `--format="table(id, location, short_status())"`:::
  Displays the short status in the third table problem.
)r   )r	   r
   r   _s       r   TransformShortStatusr   B   s    $ 'q4/,	r   c                 T   Un[        U [        5      (       a  U R                  S5      (       d  gU R                  S5      nU(       a+  [        U[        5      (       a  UR                  S5      (       d  gUR                  S5      nUR                  S5      nU(       a!  SR                  U5      R	                  S	S
5      nU(       a9  UR                  S5      nUR                  S5      =(       d    / n U[        Xg5      4$ US4$ ! [        [        4 a    USR                  U5      4s $ f = f)a  Returns a full description of the status of a logpoint or snapshot.

Status will be one of ACTIVE, COMPLETED, or a verbose error description. If
the status is an error, there will be additional information available in the
status field of the object.

Args:
  r: a JSON-serializable object
  undefined: Returns this value if the resource is not a valid status.

Returns:
  String, String - The first string will be a short error description,
  and the second a more detailed description.
isFinalState)ACTIVENstatusisError)	COMPLETEDNrefersTodescriptionz	{0}_ERRORBREAKPOINT_ r   
parameterszMalformed status message: {0}N)
isinstancedictgetr   replace_SubstituteErrorParams
IndexErrorKeyError)r	   r
   r   r   	refers_tor   fmtparamss           r   r   r   X   s    ,455  UU8_FFD11I9N9N

:&I**]+K ''	2::="MlOOH%c|,2fL3C@@@ 
t	 (# L<CCFKKKLs   0D #D'&D'c                 ^    U(       d  U $ [         R                  " SSU 5      R                  " U6 $ )ae  Replaces $N with the Nth param in fmt.

Args:
  fmt: A format string which may contain substitutions of the form $N, where
    N is any decimal integer between 0 and len(params) - 1.
  params: A set of parameters to substitute in place of the $N string.
Returns:
  A string containing fmt with each $N substring replaced with its
  corresponding parameter.
z
\$([0-9]+)z{\1})resubr   )r&   r'   s     r   r"   r"   |   s*     
J	w	,	3	3V	<<r   )r   r   c                      [         $ )z;Returns the debug specific resource transform symbol table.)_TRANSFORMS r   r   GetTransformsr.      s    	r   )UNKNOWN_ERROR)__doc__
__future__r   r   r   r)   r   r   r   r"   r,   r.   r-   r   r   <module>r2      sA    $ '  ' 	2,!H=" '(r   