
    	                     ~    d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 dZ G d	 d
e
j                        Zy)z:Utilities for displaying workflows for cloud build v2 API.    )absolute_import)division)unicode_literals)pipeline_output_util)yaml)custom_printer_baseworkflowc                   "    e Zd ZdZd Zd Zd Zy)WorkflowPrinterz'Print a Workflow in YAML with comments.c                    d|v r$|j                  d      }| j                  ||      }nbd|v r1d|d   v r*|d   j                  d      }|d= | j                  ||      }n-d|v r)|j                  d      }t        j                  |      |d<   |j	                  di       }|rt        j
                  |      |d<   t        j                  |d      }t        j                  |j                  d            S )	z6Apply formatting to the workflow for describe command.pipelineSpecYamlpipelineSpecgeneratedYamlpipelineRefparamsT
round_trip
)pop_updateWorkflowSpecr   TransformRefgetTransformParamsSpecr   dumpr   Linessplit)selfr	   yaml_strrefr   s        @lib/googlecloudsdk/api_lib/cloudbuild/v2/workflow_output_util.py_WorkflowDisplayLinesz%WorkflowPrinter._WorkflowDisplayLines   s    X%01h))(H=h("x77.)--o>h
>
"))(H=h	(	"LL'c 4 A A# Fh}\\(B'F/CCFKhxyyd3H$$X^^D%9::    c                 >    t        j                  |d      }||d<   |S )NTr   r   )r   load)r   r	   r   datas       r    r   z#WorkflowPrinter._updateWorkflowSpec4   s!    99X$/D#H^Or"   c                 $    | j                  |      S )zTransform ApplicationStatus into the output structure of marker classes.

    Args:
      record: a dict object

    Returns:
      lines formatted for output
    )r!   )r   records     r    	TransformzWorkflowPrinter.Transform9   s     %%f--r"   N)__name__
__module____qualname____doc__r!   r   r(    r"   r    r   r      s    /;,
	.r"   r   N)r,   
__future__r   r   r   $googlecloudsdk.api_lib.cloudbuild.v2r   googlecloudsdk.corer   googlecloudsdk.core.resourcer   PRINTER_FORMATCustomPrinterBaser   r-   r"   r    <module>r4      s5    A &  ' E $ <'.);; '.r"   