
    L;g                     &    d dl mZ  G d de      Zy)   )CodeGeneratorDraft06c                   n     e Zd Z eej
                  fi dddddddZdi d	d	f fd
	Zd Zd Zd Z	 xZ
S )CodeGeneratorDraft07z2^(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})\Zz^\w+:(\/?\/?)[^\s]+\Zz'^(\w+:(\/?\/?))?[^#\\\s]*(#[^\\\s]*)?\Zz^[^@]+@[^@]+\.[^@]+\Zz1^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)\Zzu^(?P<hour>\d{1,2}):(?P<minute>\d{1,2})(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6}))?([zZ]|[+-]\d\d:\d\d)?)?\Z)dateiriziri-referencez	idn-emailzrelative-json-pointertimeNTc                     t         |   |||||       | j                  j                  d| j                  fd| j
                  fd| j                  ff       y )NifcontentEncodingcontentMediaType)super__init___json_keywords_to_functionupdategenerate_if_then_elsegenerate_content_encodinggenerate_content_media_type)self
definitionresolverformatsuse_defaultuse_formats	__class__s         6lib/python3.12/site-packages/fastjsonschema/draft07.pyr   zCodeGeneratorDraft07.__init__   s[    Xw[Q''..4--. > >?!A!AB0
 	    c                    | j                  dd      5  | j                  | j                  d   | j                  | j                  d       ddd       | j                  d      5  d	| j                  v r7| j                  | j                  d	   | j                  | j                  d       n| j                  d
       ddd       d| j                  v rQ| j                  d      5  | j                  | j                  d   | j                  | j                  d       ddd       yy# 1 sw Y   xY w# 1 sw Y   uxY w# 1 sw Y   yxY w)a  
        Implementation of if-then-else.

        .. code-block:: python

            {
                'if': {
                    'exclusiveMaximum': 0,
                },
                'then': {
                    'minimum': -10,
                },
                'else': {
                    'multipleOf': 2,
                },
            }

        Valid values are any between -10 and 0 or any multiplication of two.
        try:F)optimizer
   T)clear_variablesNz except JsonSchemaValueException:elsepassthenzelse:)lgenerate_func_code_block_definition	_variable_variable_namer   s    r   r   z*CodeGeneratorDraft07.generate_if_then_else   s%   ( VVFUV+))  &## $	 *  , VV67)))--$$V,NN''$(	 .  v 8 T%%%--$$V,NN''$(	 .  ! &# ,+ 87 !s$   7D#$AD/"7D;#D,/D8;Ec                    | j                   d   dk(  r| j                  d      5  | j                  d      5  | j                  d       | j                  d       ddd       | j                  d      5  | j                  d	       ddd       | j                  d
      5  | j                  d       ddd       ddd       yy# 1 sw Y   ixY w# 1 sw Y   JxY w# 1 sw Y   +xY w# 1 sw Y   yxY w)z
        Means decoding value when it's encoded by base64.

        .. code-block:: python

            {
                'contentEncoding': 'base64',
            }
        r   base64if isinstance({variable}, str):r   zimport base64z){variable} = base64.b64decode({variable})Nexcept Exception:z {name} must be encoded by base64zif {variable} == "":zcontentEncoding must be base64r&   r$   excr)   s    r   r   z.CodeGeneratorDraft07.generate_content_encodingK   s     -.(:9:VVF^FF?+FFFG $ VV/0HH?@ 1VV23HH=> 4 ;: ;#^ 1033 ;:sR   C%#CC%2CC%C/C%C
	C%C	C%C"	C%%C.c                    | j                   d   dk(  r| j                  d      5  | j                  d      5  | j                  d       ddd       | j                  d      5  | j                  d       ddd       ddd       | j                  d	      5  | j                  d      5  | j                  d
       | j                  d       ddd       | j                  d      5  | j                  d       ddd       ddd       yy# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   bxY w# 1 sw Y   CxY w# 1 sw Y   yxY w)z
        Means loading value when it's specified as JSON.

        .. code-block:: python

            {
                'contentMediaType': 'application/json',
            }
        r   zapplication/jsonz!if isinstance({variable}, bytes):r   z'{variable} = {variable}.decode("utf-8")Nr-   z{name} must encoded by utf8r,   zimport jsonz#{variable} = json.loads({variable})z{name} must be valid JSONr.   r)   s    r   r   z0CodeGeneratorDraft07.generate_content_media_type_   s     ./3EE;<VVF^FFDE $VV/0HH:; 1 =
 9:VVF^FF=)FF@A $ VV/0HH89 1	 ;: F#^00 =< $^ 10	 ;:sv   DDD!D3DE&#D*	E"D64ED	DD	DD'*D3	/E6D?	;EE)__name__
__module____qualname__dictr   FORMAT_REGEXSr   r   r   r   __classcell__)r   s   @r   r   r      sV    -;; E'C-!U)@ M -1"$\` ,\?(:r   r   N)draft06r   r    r   r   <module>r9      s    )p:/ p:r   