ó
    €ÏD  ã                   ój   • S r SSKJr  SSKJr  SSKJr  SSKrSSKJr   " S S\R                  5      r	g)	zUnified diff resource printer.é    )Úabsolute_import)Údivision)Úunicode_literalsN)Úresource_printer_basec                   ó<   ^ • \ rS rSrSrU 4S jrS rSS jrSrU =r	$ )ÚDiffPrinteré   a>  A printer for a unified diff of the first two projection columns.

A unified diff of the first two projection columns.

Printer attributes:
  format: The format of the diffed resources. Each resource is converted
    to this format and the diff of the converted resources is displayed.
    The default is 'flattened'.
c                 óv   >• [         [        U ]
  " USSS.UD6  U R                  R	                  SS5      U l        g )NT)Ú
by_columnsÚnon_empty_projection_requiredÚformatÚ	flattened)Úsuperr   Ú__init__Ú
attributesÚgetÚ_print_format)ÚselfÚargsÚkwargsÚ	__class__s      €Ú0lib/googlecloudsdk/core/resource/diff_printer.pyr   ÚDiffPrinter.__init__&   s<   ø€ Ü	Œ+tÒ% t¸ØDHñ0à(.ò0ð Ÿ™×,Ñ,¨X°{ÓC€DÕó    c                 óò  • SSK n[        R                  " 5       nU R                  U R                  US9nUR                  U5        [        R                  " 5       nU R                  U R                  US9nUR                  U5        UR                  5       R                  S5      nUR                  5       R                  S5      nUR                  Xx5      n	U	 H  n
U R                  R                  U
5        M      g)a  Prints the unified diff of formatter output for old and new.

Prints a unified diff, eg,
---

+++

@@ -27,6 +27,6 @@

 settings.pricingPlan:                             PER_USE
 settings.replicationType:                         SYNCHRONOUS
 settings.settingsVersion:                         1
-settings.tier:                                    D1
+settings.tier:                                    D0
 state:                                            RUNNABLE

Args:
  old: The old original resource.
  new: The new changed resource.
r   N)ÚoutÚ
)ÚdifflibÚioÚStringIOÚPrinterr   ÚPrintSingleRecordÚgetvalueÚsplitÚunified_diffÚ_outÚPrint)r   ÚoldÚnewr   Úbuf_oldÚprinterÚbuf_newÚ	lines_oldÚ	lines_newÚ
lines_diffÚlines              r   Ú_DiffÚDiffPrinter._Diff,   sÇ   € ó, ô kŠk‹m€GØl‰l˜4×-Ñ-°7ˆlÐ;€GØ×Ñ˜cÔ"äkŠk‹m€GØl‰l˜4×-Ñ-°7ˆlÐ;€GØ×Ñ˜cÔ"à× Ñ Ó"×(Ñ(¨Ó.€IØ× Ñ Ó"×(Ñ(¨Ó.€IØ×%Ñ% iÓ;€JÛˆØ
‡ii‡oodÖò r   c                 óÜ   • U R                   R                  S5      nU(       a"  U R                  R                  U5        SU l        [        U5      S:”  a  U R                  US   US   5        gg)zÙImmediately prints the first two columns of record as a unified diff.

Records with less than 2 colums are silently ignored.

Args:
  record: A JSON-serializable object.
  delimit: Prints resource delimiters if True.
ÚtitleNé   r   )r   r   r&   r'   Ú_titleÚlenr1   )r   ÚrecordÚdelimitr4   s       r   Ú
_AddRecordÚDiffPrinter._AddRecordT   sX   € ð O‰O×Ñ Ó(€EÞØ
‡ii‡ooeÔØ€d„kÜ
ˆ6ƒ{QƒØ
‡jj˜‘˜F 1™IÕ&ð r   )r   r6   )F)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r1   r:   Ú__static_attributes__Ú__classcell__)r   s   @r   r   r      s   ø† ñõDò&÷P'ò 'r   r   )
r@   Ú
__future__r   r   r   r   Úgooglecloudsdk.core.resourcer   ÚResourcePrinterr   © r   r   Ú<module>rG      s.   ðñ  %å &Ý Ý 'ã 	å >ôG'Ð'×7Ñ7õ G'r   