
                         j    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Z G d dej                        Z	y)	z.Object representation format resource printer.    )absolute_import)division)unicode_literals)resource_printer_baseNc                   *     e Zd ZdZ fdZddZ xZS )ObjectPrintera  Prints the object representation of each item in a list.

  Bypasses JSON-serialization and prints the object representation of each
  resource.

  Printer attributes:
    separator: The line printed between resources.
    terminator: The line printed after each resource.
  c                     t        t        | 
  |ddi| d| _        | j                  j                  d      | _        | j                  j                  d      | _        d | _        y )N
by_columnsT	separator
terminatorc                     | S )N )xs    2lib/googlecloudsdk/core/resource/object_printer.py<lambda>z(ObjectPrinter.__init__.<locals>.<lambda>+   s    Q    )	superr   __init___first_record
attributesget
_separator_terminator_process_record)selfargskwargs	__class__s      r   r   zObjectPrinter.__init__&   sY    	-'I$I&IDoo))+6DO**<8D&Dr   c                 R   | j                   rd| _         n3|r1| j                  %| j                  j                  | j                         | j                  j	                  t        j                  |             | j                  &| j                  j                  | j                         yy)zImmediately prints the given record using the object representation.

    Args:
      record: An object.
      delimit: Display the separator.
    FN)r   r   _outPrintwritesix	text_typer   )r   recorddelimits      r   
_AddRecordzObjectPrinter._AddRecord-   su      d	T__0
iioodoo&IIOOCMM&)*#
iiood&&' $r   )F)__name__
__module____qualname____doc__r   r'   __classcell__)r   s   @r   r   r      s    '(r   r   )
r+   
__future__r   r   r   googlecloudsdk.core.resourcer   r#   ResourcePrinterr   r   r   r   <module>r0      s,     5 &  ' > 
()99 (r   