
                             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r\" S/ SQ5      r	 " S S	\	5      r
S
 rS rS rS r   SS jrg)z/This package manipulates Docker image metadata.    )absolute_import)print_function)
namedtupleN
OverridesT)nameparentsize
entrypointcmdenvlabelsportsvolumesworkdiruserc                   F   ^  \ rS rSrSr           SU 4S jjrSrU =r$ )	Overrides   z$Docker image layer metadata options.c                 <   > [         [        U ]  U UUUUUUUUU	U
US9$ )zConstructor.)r   r   r	   r
   r   r   r   r   r   r   r   )superr   __new__)clsr   r   r	   r
   r   r   r   r   r   r   r   	__class__s               ;lib/third_party/containerregistry/transform/v1/metadata_.pyr   Overrides.__new__"   sB     C( )       )NNNNNNNNNNN)__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classcell__)r   s   @r   r   r      s3    ,  r   r   c                     [         R                  n U[         l        [         R                  R                  U 5      U[         l        $ ! U[         l        f = f)z;Resolves environment variables embedded in the given value.)osenvironpath
expandvars)valueenvironment	outer_envs      r   _Resolver-   ?   s8    jj)BJ77e$BJBJs   )A Ac                     [        U 5      [        [        5       5      :X  a&  [        S [        R                  " U 5       5       5      $ [        R
                  " U 5      $ )z$Do a deep copy, skipping null entry.c              3   \   #    U  H"  u  pUc  M
  [        U5      [        U5      4v   M$     g 7f)N)_DeepCopySkipNull).0kvs      r   	<genexpr>$_DeepCopySkipNull.<locals>.<genexpr>M   s/      "/DA ="1%'8';</s   	,,)typedictsix	iteritemscopydeepcopy)datas    r   r0   r0   J   sH    	$Z4< "MM$/" " " 
t	r   c                 \    [        5       nU  H  nUR                  SS5      u  p4XAU'   M     U$ )z=Converts an iterable object of key=value pairs to dictionary.=   )r7   split)pairdkvr2   r3   s        r   _KeyValueToDictrD   S   s3    
f!bXXc1FQaD  
(r   c                 p    [        U R                  5       5       Vs/ s H  o< SX   < 3PM     sn$ s  snf )Nr>   )sortedkeys)rB   r2   s     r   _DictToKeyValuerH   \   s.    '-affh'7	8'7!Q
'7	88	8s   3c                 |   [        U 5      nUR                  (       d  [        S5      eUR                  US'   UR                  (       a  UR                  US'   OU (       a  [        SU -  5      eUR                  (       a  UR                  US'   O	SU;   a  US	 SU;  a  0 US'   UR
                  (       a  UR
                  US   S'   UR                  (       a  UR                  US   S'   UR                  (       a  UR                  US   S	'   X%S
'   X5S'   XES'   UR                  (       ae  [        US   R                  S/ 5      5      n[        R                  " UR                  5       H  u  px[        X5      Xg'   M     [        U5      US   S'   UR                  (       a\  [        US   R                  S/ 5      5      n	[        R                  " UR                  5       H	  u  pxXU'   M     [        U	5      US   S'   UR                   (       aE  SUS   ;  a  0 US   S'   UR                    H$  n
SU
;   a  0 US   S   U
'   M  0 US   S   U
S-   '   M&     UR"                  (       a/  SUS   ;  a  0 US   S'   UR"                   H  n
0 US   S   U
'   M     UR$                  (       a  UR$                  US   S'   SU;   a  US	 U$ )a  Rewrite and return a copy of the input data according to options.

Args:
  data: The dict of Docker image layer metadata we're copying and rewriting.
  options: The changes this layer makes to the overall image's metadata, which
           first appears in this layer's version of the metadata
  docker_version: The version of docker write in the metadata (default: 1.5.0)
  architecture: The architecture to write in the metadata (default: amd64)
  operating_system: The os to write in the metadata (default: linux)

Returns:
  A deep copy of data, which has been updated to reflect the metadata
  additions of this layer.

Raises:
  Exception: a required option was missing.
zMissing required option: nameidr   z;Expected empty input object when parent is omitted, got: %sSizeconfig
EntrypointCmdUserdocker_versionarchitecturer&   EnvLabelExposedPorts/z/tcpVolumes
WorkingDircontainer_config)r0   r   	Exceptionr   r	   r
   r   r   r   rD   getr8   r9   r-   rH   r   r   r   r   )r<   optionsrP   rQ   operating_systemoutputenviron_dictr2   r3   
label_dictps              r   Overridera   `   s   , T"&	
3
44&,^^~~F8
ELN N \\\\F6NvVF8%,%7%7F8\"[[%kkF8U\\&||F8V+	'!,[["6(#3#7#7r#BCLgkk* 1lo + .l;F8U^^ !1!5!5gr!BCJgnn-m . /
 ;F8W]]VH--)+fX~&]]	 /1x(+ 8:x(V4  __x(($&fXy!__')fXy!!$  __%,__F8\" 6!!"	-r   )z1.5.0amd64linux)r"   
__future__r   r   collectionsr   r:   r&   r8   _OverridesTr   r-   r0   rD   rH   ra   r   r   r   <module>rg      sa    6 & % "  	 
  (  @9 &# '	hr   