
    vKg5                         S r SSKrSSKrSSKJr  SSKJr  SSKJrJr  S r	S r
S r " S	 S
5      r " S S5      r " S S5      rg)aQ  User input parameter validation.

This module handles user input parameter validation
against a provided input model.

Note that the objects in this module do *not* mutate any
arguments.  No type version happens here.  It is up to another
layer to properly convert arguments to any required types.

Validation Errors
-----------------


    N)datetime)ParamValidationError)is_json_value_headerparse_to_aware_datetimec                     [        5       nUR                  X5      nUR                  5       (       a  [        UR	                  5       S9eg)aF  Validates input parameters against a schema.

This is a convenience function that validates parameters against a schema.
You can also instantiate and use the ParamValidator class directly if you
want more control.

If there are any validation errors then a ParamValidationError
will be raised.  If there are no validation errors than no exception
is raised and a value of None is returned.

:param params: The user provided input parameters.

:type shape: botocore.model.Shape
:param shape: The schema which the input parameters should
    adhere to.

:raise: ParamValidationError

reportN)ParamValidatorvalidate
has_errorsr   generate_report)paramsshape	validatorr	   s       Q/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/botocore/validate.pyvalidate_parametersr      sD    (  I.F"&*@*@*BCC     c                    ^  U 4S jnU$ )Nc                 &   >^ ^ UU 4S jnU4S jmU$ )Nc                 6   > T" XU5      (       a
  T" XX#U5      $ g N )selfparamr   errorsname_type_checkfuncs        r   _on_passes_type_checkKtype_check.<locals>._create_type_check_guard.<locals>._on_passes_type_check4   s$    5$//D== 0r   c                    > [        U T5      (       d-  T Vs/ sH  n[        U5      PM     nnUR                  USU US9  ggs  snf )Ninvalid typer   valid_typesFT)
isinstancestrr	   )r   r   r   tvalid_type_namesr$   s        r   r   Atype_check.<locals>._create_type_check_guard.<locals>._type_check8   sT    e[114?#@KqCFK #@" 0	    $As   Ar   )r   r   r   r$   s   ` @r   _create_type_check_guard,type_check.<locals>._create_type_check_guard3   s    	>
	 %$r   r   )r$   r*   s   ` r   
type_checkr,   2   s    %& $#r   c                    Sn[        S5      nSUR                  ;   a  UR                  S   nX:  a  SnO:[        US5      (       a)  UR                  R	                  S5      (       a	  SnX:  a  SnU(       a  UR                  XXS9  g g )	NFz-infminTserialization	hostLabel   )r   min_allowed)floatmetadatahasattrr/   getr	   )r   valuer   
error_typer   failedr2   s          r   range_checkr:   I   s    F-KnnU+F		(	("";//K"deM r   c                   8    \ rS rSrS rS rS rS rS rS r	Sr
g	)
ValidationErrorsZ   c                     / U l         g r   _errorsr   s    r   __init__ValidationErrors.__init__[   s	    r   c                 (    U R                   (       a  ggNTFr?   rA   s    r   r   ValidationErrors.has_errors^   s    <<r   c                     / nU R                    H#  nUR                  U R                  U5      5        M%     SR                  U5      $ )N
)r@   append_format_errorjoin)r   error_messageserrors      r   r    ValidationErrors.generate_reportc   s=    \\E!!$"4"4U";< "yy((r   c                    Uu  p#nU R                  U5      nUS:X  a  SU SUS    S3$ US:X  a$  US   nSR                  US	   5      nS
U SU SU 3$ US:X  a2  US   n[        U5      nSR                  US   5      n	SU SU SU SU	 3$ US:X  a  US   nUS   n
SU SU SU
 3$ US:X  a  US   nUS   n
SU SU SU
 3$ US:X  a  SR                  UUS   5      $ US:X  a2  US   n[        U5      nSR                  US   5      n	SU SU SU SU	 3$ US:X  a  SR                  US    5      nS!U S"U S#3$ US$:X  a  SR                  US    5      nS%U S&U S#3$ g )'Nmissing required fieldzMissing required parameter in z: "required_name"unknown fieldunknown_paramz, valid_nameszUnknown parameter in z", must be one of: r"   r   r$   zInvalid type for parameter z	, value: z, type: z, valid types: invalid ranger2   zInvalid value for parameter z, valid min value: invalid lengthzInvalid length for parameter z, valid min length: unable to encode to jsonz2Invalid parameter {} must be json serializable: {}
type_errorinvalid type for documentz$Invalid type for document parameter more than one inputmembersz<Invalid number of parameters set for tagged union structure z*. Can only set one of the following keys: .empty inputz=Must set one of the following keys for tagged unionstructure z: )	_get_namerK   typeformat)r   rM   r8   r   
additionalrT   rU   r   
param_typer$   r2   r\   s               r   rJ   ValidationErrors._format_errori   sd   ',$
*~~d#110 7015 ?*&7M))J}$=>K'vS @##.-1 >)w'EeJ))J}$=>K-dV9UG D#OK=B ?*w'E$]3K.tfIeW E$$/=2 ++w'E$]3K/vYug F%%0M3 55GNN<(  66w'EeJ))J}$=>K6tfIeW M#OK=B 00ii
9 56GN&B)1
 =(ii
9 56G!F"WIQ0 )r   c                 L    U(       d  gUR                  S5      (       a  USS  $ U$ )Ninputr]   r1   )
startswith)r   r   s     r   r_   ValidationErrors._get_name   s'    __S!!8OKr   c                 >    U R                   R                  X!U45        g r   )r@   rI   )r   r   reasonkwargss       r   r	   ValidationErrors.report   s    V623r   r?   N)__name__
__module____qualname____firstlineno__rB   r   r   rJ   r_   r	   __static_attributes__r   r   r   r<   r<   Z   s!    
)>@4r   r<   c                   <   \ rS rSrSrS rS rS rS rS r	\
" \4S9S	 5       r\
" \4S9S
 5       r\
" \\4S9S 5       r\
" \4S9S 5       r\
" \4S9S 5       rS r\
" \4S9S 5       r\
" \\R4                  4\4-   S9S 5       r\r\
" \4S9S 5       rS rS rSr g)r
      z+Validates parameters against a shape model.c                 <    [        5       nU R                  XUSS9  U$ )a  Validate parameters against a shape model.

This method will validate the parameters against a provided shape model.
All errors will be collected before returning to the caller.  This means
that this method will not stop at the first error, it will return all
possible errors.

:param params: User provided dict of parameters
:param shape: A shape model describing the expected input.

:return: A list of errors.

 )r   )r<   	_validate)r   r   r   r   s       r   r   ParamValidator.validate   s#     "#vf26r   c                     [        U5      (       a  U R                  $ UR                  S:X  a  UR                  (       a  U R                  $ g g )N	structure)r   _validate_jsonvalue_string	type_nameis_document_type_validate_document)r   r   s     r   _check_special_validation_cases.ParamValidator._check_special_validation_cases   sB    &&222??k)e.D.D*** /E)r   c                     U R                  U5      nU(       a
  U" XX45        g [        U SUR                   35      " XX45        g )N
_validate_)r~   getattrr{   )r   r   r   r   r   special_validators         r   rv   ParamValidator._validate   s@     @@GfV:DJu&789vr   c                      [         R                  " U5        g ! [        [        4 a  nUR	                  USUS9   S nAg S nAff = f)NrX   )rY   )jsondumps
ValueError	TypeErrorr	   )r   r   r   r   r   es         r   rz   )ParamValidator._validate_jsonvalue_string   s>    	JJJvI& 	JMM$ :qMI	Js    A?Ac           	         Uc  g [        U[        5      (       a  U H  nU R                  X   X#U5        M     g [        U[        5      (       a,  [	        U5       H  u  pgU R                  XrUSXF4-  5        M     g [        U[
        4[        [        [        45      (       dW  [
        [        [        [        [        [        4nU V	s/ sH  n	[        U	5      PM     n
n	UR                  USU[        U5      U
S9  g g s  sn	f )Nz%s[%d]rZ   )r   rc   r$   )r%   dictr}   list	enumerater&   intboolr3   r	   r`   )r   r   r   r   r   keyindexentityr$   r'   r(   s              r   r}   !ParamValidator._validate_document   s    >fd##''UCH %%!*6!2''68tm+C "3 FcVS$$>??T5$=K0;<1A<MM+<,   @<s   C8)r$   c           	      >   UR                   (       aU  [        U5      S:X  a  UR                  USUR                  S9  O*[        U5      S:  a  UR                  USUR                  S9  UR                  R                  S/ 5       H  nXQ;  d  M
  UR                  USUUS9  M     UR                  n/ nU H6  nX;  a  UR                  US	U[        U5      S
9  M%  UR                  U5        M8     U H+  nU R                  X   UR                  U   UU SU 35        M-     g )Nr   r^   )r\   r1   r[   requiredrP   )rQ   user_paramsrS   )rT   rU   r]   )	is_tagged_unionlenr	   r\   r4   r6   r   rI   rv   )	r   r   r   r   r   required_memberr\   known_paramsr   s	            r   _validate_structure"ParamValidator._validate_structure   s!     6{adM5==IVq/  
  %~~11*bAO,,"1 &	    B --E##"' $W	   ##E*  "ENNe$&%!	 "r   c                 4    [        U[        U5      USU5        g )NrW   )r:   r   r   r   r   r   r   s        r   _validate_stringParamValidator._validate_string!  s     	D#e*e-=vFr   c           
          UR                   n[        U[        U5      USU5        [        U5       H  u  pgU R	                  XuX4 SU S35        M     g )NrW   [])memberr:   r   r   rv   )r   r   r   r   r   member_shapeiitems           r   _validate_listParamValidator._validate_list-  sK    ||D#e*e-=vF 'GANN4vq1~F (r   c           
          UR                   nUR                  nUR                  5        H4  u  pxU R                  XuX4 SU S35        U R                  XX4 SU 35        M6     g )Nz (key: )r]   )r   r7   itemsrv   )	r   r   r   r   r   	key_shapevalue_shaper   r7   s	            r   _validate_mapParamValidator._validate_map4  sY    II	kk++-JCNN36V73%q3IJNN5vqG (r   c                      [        XAUSU5        g NrV   r:   r   s        r   _validate_integer ParamValidator._validate_integer<      D@r   c           	          [        U[        [        [        45      (       a  g [	        US5      (       a  g UR                  USU[        [        5      [        [        5      S/S9  g )Nreadr"   zfile-like objectr#   )r%   bytes	bytearrayr&   r5   r	   r   s        r   _validate_blobParamValidator._validate_blob@  sV    eeY455UF##MM ZY9KL	  r   c                     g r   r   r   s        r   _validate_boolean ParamValidator._validate_booleanN  s    r   c                      [        XAUSU5        g r   r   r   s        r   _validate_doubleParamValidator._validate_doubleR  r   r   c                      [        XAUSU5        g r   r   r   s        r   _validate_longParamValidator._validate_longX  r   r   c                 z    U R                  U5      nU(       d#  [        [        5      S/nUR                  USXS9  g g )Nztimestamp-stringr"   r#   )_type_check_datetimer&   r   r	   )r   r   r   r   r   is_valid_typer(   s          r   _validate_timestamp"ParamValidator._validate_timestamp\  sD     11%8 #H/ABMMnE   r   c                 R     [        U5        g! [        [        [        4 a     gf = frE   )r   r   r   AttributeError)r   r7   s     r   r   #ParamValidator._type_check_datetimeg  s-    	#E*:~6 	 	s    &&r   N)!rm   rn   ro   rp   __doc__r   r~   rv   rz   r}   r,   r   r   r&   r   r   tupler   r   r   r   r   r   r   r3   decimalDecimalr   _validate_floatr   r   r   rq   r   r   r   r
   r
      s(   5$+J. TG$& %&P SF#	G $	G T5M*G +G TG$H %H SF#A $A TG$ % UGOO4v=>A ?A 'OSF#A $A	r   r
   c                        \ rS rSrS rS rSrg)ParamValidationDecoratoriq  c                     Xl         X l        g r   _param_validator_serializer)r   param_validator
serializers      r   rB   !ParamValidationDecorator.__init__r  s     /%r   c                     UR                   nUbQ  U R                  R                  XR                   5      nUR                  5       (       a  [	        UR                  5       S9eU R                  R                  X5      $ )Nr   )input_shaper   r   r   r   r   r   serialize_to_request)r   
parametersoperation_modelr   r	   s        r   r   -ParamValidationDecorator.serialize_to_requestv  ss    %11"**3377F   ""*&2H2H2JKK44
 	
r   r   N)rm   rn   ro   rp   rB   r   rq   r   r   r   r   r   q  s    &

r   r   )r   r   r   r   botocore.exceptionsr   botocore.utilsr   r   r   r,   r:   r<   r
   r   r   r   r   <module>r      sP       4 HD4$.N"X4 X4vy yx
 
r   