ó
    Ú°›jû[  ã                   ó.  • 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  SSK	J
r
  SSKJrJrJr  SSKJr  SS	KJrJrJrJrJrJrJr  \R2                  " \5      r\R8                  " S
5      r\R8                  " S5      r\R8                  " S5      rSr 1 Skr!\" 5       r"\" 5       r# " S S5      r$\$r% " S S5      r& " S S\5      r' " S S\&5      r( " S S\&5      r) " S S\&5      r* " S S5      r+ " S S\5      r, " S S 5      r- " S! S"5      r. " S# S$5      r/g)%a|  
NOTE: All classes and functions in this module are considered private and are
subject to abrupt breaking changes. Please do not use them directly.

To view the raw JSON that the objects in this module represent, please
go to any `endpoint-rule-set.json` file in /botocore/data/<service>/<api version>/
or you can look at the test files in /tests/unit/data/endpoints/valid-rules/
é    N)ÚEnum)Ú	Formatter)Ú
NamedTuple)Ú
xform_name)ÚIPV4_REÚquoteÚurlparse)ÚEndpointResolutionError)Ú	ArnParserÚInvalidArnExceptionÚis_valid_ipv4_endpoint_urlÚis_valid_ipv6_endpoint_urlÚlru_cache_weakrefÚnormalize_url_pathÚpercent_encodez\{[a-zA-Z#]+\}z(\w*)\[(\d+)\]z^(?!-)[a-zA-Z\d-]{1,63}(?<!-)$éd   >   ÚKeyÚPrefixÚ
CopySourcec                   ó¢   • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rSrg)ÚRuleSetStandardLibraryé:   z5Rule actions to be performed by the EndpointProvider.c                 ó   • Xl         g ©N©Úpartitions_data)Úselfr   s     ÚW/home/mande/repo/quber/.venv/lib/python3.13/site-packages/botocore/endpoint_provider.pyÚ__init__ÚRuleSetStandardLibrary.__init__=   s   € Ø.Õó    c                 ó:   • [        U[        5      =(       a    SU;   $ )zODetermine if an object is a function object.

:type argument: Any
:rtype: bool
Úfn©Ú
isinstanceÚdict©r   Úarguments     r   Úis_funcÚRuleSetStandardLibrary.is_func@   s   € ô ˜(¤DÓ)×>¨d°hÑ.>Ð>r!   c                 ó:   • [        U[        5      =(       a    SU;   $ )zPDetermine if an object is a reference object.

:type argument: Any
:rtype: bool
Úrefr$   r'   s     r   Úis_refÚRuleSetStandardLibrary.is_refH   s   € ô ˜(¤DÓ)×?¨e°xÑ.?Ð?r!   c                 ó^   • [        U[        5      =(       a    [        R                  U5      SL$ )zTDetermine if an object contains a template string.

:type argument: Any
:rtpe: bool
N)r%   ÚstrÚTEMPLATE_STRING_REÚsearchr'   s     r   Úis_templateÚ"RuleSetStandardLibrary.is_templateP   s,   € ô �x¤Ó%÷ @Ü"×)Ñ)¨(Ó3¸4Ð?ð	
r!   c                 ó¬   • Sn[         R                  U5       H8  u  pE  nUb*  UnUR                  S5      nU H  n	Xy   nM	     X4 U 3-  nM4  X4-  nM:     U$ )zgResolve and inject values into a template string.

:type value: str
:type scope_vars: dict
:rtype: str
Ú Ú#)ÚSTRING_FORMATTERÚparseÚsplit)
r   ÚvalueÚ
scope_varsÚresultÚliteralÚ	referenceÚ_Útemplate_valueÚtemplate_paramsÚparams
             r   Úresolve_template_stringÚ.RuleSetStandardLibrary.resolve_template_string[   sr   € ð ˆÜ(8×(>Ñ(>¸uÖ(EÑ$ˆG  1ØÑ$Ø!+�Ø"+§/¡/°#Ó"6�Û,�EØ%3Ñ%:’Nñ -à˜I nÐ%5Ð6Ñ6’àÑ!’ñ )Fð ˆr!   c                 óö   • U R                  U5      (       a  U R                  X5      $ U R                  U5      (       a  UR                  US   5      $ U R	                  U5      (       a  U R                  X5      $ U$ )z[Return evaluated value based on type.

:type value: Any
:type scope_vars: dict
:rtype: Any
r,   )r)   Úcall_functionr-   Úgetr3   rD   )r   r;   r<   s      r   Úresolve_valueÚ$RuleSetStandardLibrary.resolve_valuen   sm   € ð �<‰<˜×ÑØ×%Ñ% eÓ8Ð8Ø�[‰[˜×ÑØ—>‘> %¨¡,Ó/Ð/Ø×Ñ˜e×$Ñ$Ø×/Ñ/°ÓBÐBàˆr!   c                 óT   • [        U5       nUS:X  a  SU 3nUR                  SS5      $ )z8Normalize function names.

:type value: str
:rtype: str
Únotr@   Ú.)r   Úreplace)r   r;   Únormalized_names      r   Úconvert_func_nameÚ(RuleSetStandardLibrary.convert_func_name~   s9   € ô (¨Ó.Ð/ˆØ˜eÓ#Ø ! /Ð!2Ð3ˆOØ×&Ñ& s¨CÓ0Ð0r!   c                 óâ   • US    Vs/ s H  nU R                  X25      PM     nnU R                  US   5      n[        X5      nU" U6 nSU;   a  US   nX‚;   a  [        SU S3S9eXrU'   U$ s  snf )z™Call the function with the resolved arguments and assign to `scope_vars`
when applicable.

:type func_signature: dict
:type scope_vars: dict
:rtype: Any
Úargvr#   ÚassignzAssignment z= already exists in scoped variables and cannot be overwritten©Úmsg)rI   rP   Úgetattrr
   )	r   Úfunc_signaturer<   ÚargÚ	func_argsÚ	func_nameÚfuncr=   rT   s	            r   rG   Ú$RuleSetStandardLibrary.call_function‰   s«   € ð & fÒ-ó
â-�ð ×Ñ˜sÖ/Ù-ð 	ð 
ð ×*Ñ*¨>¸$Ñ+?Ó@ˆ	Ü�tÓ'ˆÙ�yÐ!ˆØ�~Ó%Ø# HÑ-ˆFØÓ#Ü-Ø% f Xð .Að Añð ð "(�vÑØˆùò
s   ˆA,c                 ó
   • USL$ )zAEvaluates whether a value is set.

:type value: Any
:rytpe: bool
N© ©r   r;   s     r   Úis_setÚRuleSetStandardLibrary.is_set¢   s   € ð ˜DÐ Ð r!   c                 ó  • UR                  S5       Hn  n[        R                  U5      nUbO  UR                  5       u  pV[	        U5      nU(       a  UR                  U5      nUb  U[        U5      :¼  a    gX   s  $ X   nMp     U$ )a9  Find an attribute within a value given a path string. The path can contain
the name of the attribute and an index in brackets. A period separating attribute
names indicates the one to the right is nested. The index will always occur at
the end of the path.

:type value: dict or tuple
:type path: str
:rtype: Any
rM   N)r:   ÚGET_ATTR_REr2   ÚgroupsÚintrH   Úlen)r   r;   ÚpathÚpartÚmatchÚnameÚindexs          r   Úget_attrÚRuleSetStandardLibrary.get_attrª   s{   € ð —J‘J˜s–OˆDÜ×&Ñ& tÓ,ˆEØÑ Ø#Ÿl™l›n‘�Ü˜E›
�ÞØ!ŸI™I d›O�EØ‘= E¬S°«ZÓ$7ÙØ‘|Ò#à™’ñ $ð ˆr!   c                 ó    • US   nUS   US'   U$ )NÚoutputsÚidrk   r_   )r   Ú	partitionÚoutputs      r   Úformat_partition_outputÚ.RuleSetStandardLibrary.format_partition_outputÂ   s   € Ø˜9Ñ%ˆØ" 4™ˆˆv‰Øˆr!   c                 óZ   • [         R                  " US   U5      S LnXS   ;   =(       d    U$ )NÚregionRegexÚregions)Úrerj   )r   Úregionrr   Úmatches_regexs       r   Úis_partition_matchÚ)RuleSetStandardLibrary.is_partition_matchÇ   s/   € ÜŸš ¨=Ñ!9¸6ÓBÈ$ÐNˆØ 9Ñ-Ñ-×>°Ð>r!   c                 ó¶   • U R                   S   nUb2  U H,  nU R                  X5      (       d  M  U R                  U5      s  $    US   nU R                  U5      $ )zJMatch a region string to an AWS partition.

:type value: str
:rtype: dict
Ú
partitionsr   )r   r|   rt   )r   r;   r   rr   Úaws_partitions        r   r€   Ú$RuleSetStandardLibrary.aws_partitionË   sb   € ð ×)Ñ)¨,Ñ7ˆ
àÑÛ'�	Ø×*Ñ*¨5×<Ó<Ø×7Ñ7¸	ÓBÒBñ (ð
 # 1™ˆØ×+Ñ+¨MÓ:Ð:r!   c                 óR  • Ub  UR                  S5      (       d  g [        R                  U5      n[	        US   US   US   45      (       d  gUR                  S5      US'   UR                  S5      nUR                  SS	5      R                  S	5      US
'   U$ ! [         a     gf = f)zMParse and validate string for ARN components.

:type value: str
:rtype: dict
Nzarn:rr   ÚserviceÚresourceÚaccountÚ	accountIdÚ:Ú/Ú
resourceId)Ú
startswithÚ
ARN_PARSERÚ	parse_arnr   ÚallÚpoprN   r:   )r   r;   Úarn_dictr„   s       r   Úaws_parse_arnÚ$RuleSetStandardLibrary.aws_parse_arnÜ   sº   € ð ‰= × 0Ñ 0°× 8Ñ 8Øð	Ü!×+Ñ+¨EÓ2ˆHô
 Ø�kÑ" H¨YÑ$7¸À*Ñ9MÐN÷
ñ 
ð à (§¡¨YÓ 7ˆ�Ñà—<‘< 
Ó+ˆØ!)×!1Ñ!1°#°sÓ!;×!AÑ!AÀ#Ó!Fˆ�Ñàˆøô #ó 	Ùð	ús   œB Â
B&Â%B&c                 óÀ   ^ • Ub  USL a  UR                  S5      S:”  a  gUSL a$  [        U 4S jUR                  S5       5       5      $ [        R	                  U5      SL$ )zÌEvaluates whether a value is a valid host label per
RFC 1123. If allow_subdomains is True, split on `.` and validate
each component separately.

:type value: str
:type allow_subdomains: bool
:rtype: bool
NFrM   r   Tc              3   óH   >#   • U  H  nTR                  US 5      v •  M     g7f)FN)Úis_valid_host_label)Ú.0Úlabelr   s     €r   Ú	<genexpr>Ú=RuleSetStandardLibrary.is_valid_host_label.<locals>.<genexpr>  s(   øé € ð â-�Eð ×(Ñ(¨°×6Ð6Ú-ùs   ƒ")Úcountr�   r:   ÚVALID_HOST_LABEL_RErj   ©r   r;   Úallow_subdomainss   `  r   r”   Ú*RuleSetStandardLibrary.is_valid_host_label÷   sh   ø€ ð ‰=Ð,°Ò5¸%¿+¹+ÀcÓ:JÈQÓ:NØà˜tÒ#Üô à"Ÿ[™[¨Ô-óó ð ô
 #×(Ñ(¨Ó/°tÐ;Ð;r!   c                 ó‚   • [        S X4 5       5      (       d$  S[        U5       S[        U5       S3n[        US9eX:H  $ )z\Evaluates two string values for equality.

:type value1: str
:type value2: str
:rtype: bool
c              3   óB   #   • U  H  n[        U[        5      v •  M     g 7fr   )r%   r0   ©r•   Úvals     r   r—   Ú7RuleSetStandardLibrary.string_equals.<locals>.<genexpr>  s   é € ÐDÒ3C¨C”:˜c¤3×'Ð'Ò3Cùó   ‚z!Both values must be strings, not ú and rM   rU   ©r�   Útyper
   ©r   Úvalue1Úvalue2rV   s       r   Ústring_equalsÚ$RuleSetStandardLibrary.string_equals  sI   € ô ÑD°FÑ3CÓD×DÑDØ5´d¸6³l°^À5ÌÈfËÈÐVWÐXˆCÜ)¨cÑ2Ð2ØÑÐr!   c                 ó    • Uc  g[        U5      $ )zKPerform percent-encoding on an input string.

:type value: str
:rytpe: str
N)r   r`   s     r   Ú
uri_encodeÚ!RuleSetStandardLibrary.uri_encode  s   € ð ‰=Øä˜eÓ$Ð$r!   c                 ó†  • Uc  g[        U5      n UR                    UR                  nUR                  nUS;  d  [        U5      S:”  a  gUR                  n[        [        U5      5      nUR                  S5      (       d  U S3nUUR                  UU[        U5      =(       d    [        U5      S.$ ! [         a     gf = f)zCParse a URL string into components.

:type value: str
:rtype: dict
N)ÚhttpsÚhttpr   rˆ   )ÚschemeÚ	authorityrh   ÚnormalizedPathÚisIp)r	   ÚportÚ
ValueErrorr²   Úqueryrg   rh   r   r   ÚendswithÚnetlocr   r   )r   r;   Úurl_componentsr²   r¸   rh   Únormalized_paths          r   Ú	parse_urlÚ RuleSetStandardLibrary.parse_url"  sÓ   € ð ‰=Øä! %›ˆð	ð ×Òð  ×&Ñ&ˆØ×$Ñ$ˆàÐ*Ó*¬c°%«j¸1«nØà×"Ñ"ˆÜÔ 2°4Ó 8Ó9ˆØ×'Ñ'¨×,Ñ,Ø!0Ð 1°Ð3ˆOð Ø'×.Ñ.ØØ-Ü.¨uÓ5÷ 1Ü)¨%Ó0ñ
ð 	
øô ó 	Ùð	ús   ‘B3 Â3
C Â?C c                 ó€   • [        S X4 5       5      (       d$  S[        U5       S[        U5       S3n[        US9eXL $ )z_Evaluates two boolean values for equality.

:type value1: bool
:type value2: bool
:rtype: bool
c              3   óB   #   • U  H  n[        U[        5      v •  M     g 7fr   )r%   Úboolr    s     r   r—   Ú8RuleSetStandardLibrary.boolean_equals.<locals>.<genexpr>N  s   é € ÐEÒ4D¨S”:˜c¤4×(Ð(Ò4Dùr£   z"Both arguments must be bools, not r¤   rM   rU   r¥   r§   s       r   Úboolean_equalsÚ%RuleSetStandardLibrary.boolean_equalsG  sI   € ô ÑE°VÑ4DÓE×EÑEØ6´t¸F³|°nÀEÌ$ÈvË,ÈÐWXÐYˆCÜ)¨cÑ2Ð2ØÐÐr!   c                 óH   •  UR                  S5        g! [         a     gf = f)zUEvaluates if a string only contains ASCII characters.

:type value: str
:rtype: bool
ÚasciiTF)ÚencodeÚUnicodeEncodeErrorr`   s     r   Úis_asciiÚRuleSetStandardLibrary.is_asciiS  s(   € ð	Ø�L‰L˜Ô!ØøÜ!ó 	Ùð	ús   ‚ ”
! !c                 ó  • [        U[        5      (       d  S[        U5       S3n[        US9eX#:¼  d%  [	        U5      U:  d  U R                  U5      (       d  gUSL a   [	        U5      U-
  n[	        U5      U-
  nXU $ XU $ )zÉComputes a substring given the start index and end index. If `reverse` is
True, slice the string from the end instead.

:type value: str
:type start: int
:type end: int
:type reverse: bool
:rtype: str
zInput must be a string, not rM   rU   NT)r%   r0   r¦   r
   rg   rÉ   )r   r;   ÚstartÚstopÚreverserV   Úr_startÚr_stops           r   Ú	substringÚ RuleSetStandardLibrary.substring_  sˆ   € ô ˜%¤×%Ñ%Ø0´°e³°¸QÐ?ˆCÜ)¨cÑ2Ð2Ø‹=œC ›J¨Ó-°T·]±]À5×5IÑ5IØà�dŠ?Ü˜%“j 4Ñ'ˆGÜ˜“Z %Ñ'ˆFØ Ð(Ð(à˜4Ð Ð r!   c                 ó   • U(       + $ )zXA function implementation of the logical operator `not`.

:type value: Any
:rtype: bool
r_   r`   s     r   Ú_notÚRuleSetStandardLibrary._notv  s   € ð ŒyÐr!   c                 óœ   • Ub:  [        U5      S:  d+  UR                  5       U:w  d  [        R                  " U5      b  gU R	                  XS9$ )a¿  Evaluates whether a value is a valid bucket name for virtual host
style bucket URLs. To pass, the value must meet the following criteria:
1. is_valid_host_label(value) is True
2. length between 3 and 63 characters (inclusive)
3. does not contain uppercase characters
4. is not formatted as an IP address

If allow_subdomains is True, split on `.` and validate
each component separately.

:type value: str
:type allow_subdomains: bool
:rtype: bool
é   F)rœ   )rg   Úlowerr   rj   r”   r›   s      r   Ú!aws_is_virtual_hostable_s3_bucketÚ8RuleSetStandardLibrary.aws_is_virtual_hostable_s3_bucket~  sO   € ð  ‰MÜ�5‹z˜A‹~Ø�{‰{‹} Ó%Ü�}Š}˜UÓ#Ñ/àà×'Ñ'Øð (ð 
ð 	
r!   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r)   r-   r3   rD   rI   rP   rG   ra   rm   rt   r|   r€   r�   r”   rª   r­   r½   rÃ   rÉ   rÑ   rÔ   rÙ   Ú__static_attributes__r_   r!   r   r   r   :   sz   † Ù?ò/ò?ò@ò	
òò&ò 	1òò2!òò0ò
?ò;ò"ò6<ò(
 ò	%ò#
òJ
 ò
ò!ò.õ
r!   r   c                   ó.   • \ rS rSrSrSS jrS rS rSrg)	ÚBaseRuleiŸ  z-Base interface for individual endpoint rules.Nc                 ó   • Xl         X l        g r   ©Ú
conditionsÚdocumentation)r   rå   ræ   s      r   r   ÚBaseRule.__init__¢  s   € Ø$ŒØ*Õr!   c                 ó   • [        5       er   )ÚNotImplementedError)r   r<   Úrule_libs      r   ÚevaluateÚBaseRule.evaluate¦  s   € Ü!Ó#Ð#r!   c                 ó`   • U R                    H  nUR                  X15      nUSL d  Ub  M    g   g)z{Determine if all conditions in a rule are met.

:type scope_vars: dict
:type rule_lib: RuleSetStandardLibrary
:rtype: bool
FT)rå   rG   )r   r<   rê   rX   r=   s        r   Úevaluate_conditionsÚBaseRule.evaluate_conditions©  s5   € ð #ŸoœoˆNØ×+Ñ+¨NÓGˆFØ˜Š &£.Ùñ .ð r!   rä   r   )	rÛ   rÜ   rÝ   rÞ   rß   r   rë   rî   rà   r_   r!   r   râ   râ   Ÿ  s   † Ù7ô+ò$õr!   râ   c                   ó8   • \ rS rSr% Sr\\S'   \\S'   \\S'   Srg)ÚRuleSetEndpointi·  z.A resolved endpoint object returned by a rule.ÚurlÚ
propertiesÚheadersr_   N)	rÛ   rÜ   rÝ   rÞ   rß   r0   Ú__annotations__r&   rà   r_   r!   r   rñ   rñ   ·  s   ‡ Ù8à	ƒHØÓØ†Mr!   rñ   c                   ó:   ^ • \ rS rSrU 4S jrS rS rS rSrU =r	$ )ÚEndpointRulei¿  c                 ó2   >• [         TU ]  " S0 UD6  Xl        g ©Nr_   )Úsuperr   Úendpoint)r   rû   ÚkwargsÚ	__class__s      €r   r   ÚEndpointRule.__init__À  s   ø€ Ü‰ÒÑ"˜6Ò"Ø �r!   c                 óþ   • U R                  X5      (       ag  UR                  U R                  S   U5      nU R                  U R                  R	                  S0 5      UU5      nU R                  X5      n[        X4US9$ g)zmDetermine if conditions are met to provide a valid endpoint.

:type scope_vars: dict
:rtype: RuleSetEndpoint
rò   ró   )rò   ró   rô   N)rî   rI   rû   Úresolve_propertiesrH   Úresolve_headersrñ   )r   r<   rê   rò   ró   rô   s         r   rë   ÚEndpointRule.evaluateÄ  sƒ   € ð ×#Ñ# J×9Ñ9Ø×(Ñ(¨¯©°uÑ)=¸zÓJˆCØ×0Ñ0Ø—‘×!Ñ! ,°Ó3ØØóˆJð
 ×*Ñ*¨:Ó@ˆGÜ"Ø¸ñð ð r!   c           
      ón  • [        U[        5      (       a#  U Vs/ s H  nU R                  XBU5      PM     sn$ [        U[        5      (       a5  UR	                  5        VVs0 s H  u  pVXPR                  XbU5      _M     snn$ UR                  U5      (       a  UR                  X5      $ U$ s  snf s  snnf )z­Traverse `properties` attribute, resolving any template strings.

:type properties: dict/list/str
:type scope_vars: dict
:type rule_lib: RuleSetStandardLibrary
:rtype: dict
)r%   Úlistr   r&   Úitemsr3   rD   )r   ró   r<   rê   ÚpropÚkeyr;   s          r   r   ÚEndpointRule.resolve_propertiesØ  sÀ   € ô �j¤$×'Ñ'ñ 'óâ&�Dð ×'Ñ'¨¸(ÖCÙ&ñð ô ˜
¤D×)Ñ)ð #-×"2Ñ"2Ô"4ôâ"4‘J�Cð ×,Ñ,¨UÀÓIÒIÙ"4òð ð ×!Ñ! *×-Ñ-Ø×3Ñ3°JÓKÐKàÐùòùó
s   šB,Á!B1c                 óÄ   • 0 nU R                   R                  S0 5      nUR                  5        H(  u  pVU Vs/ s H  orR                  Xq5      PM     snX5'   M*     U$ s  snf )z„Iterate through headers attribute resolving all values.

:type scope_vars: dict
:type rule_lib: RuleSetStandardLibrary
:rtype: dict
rô   )rû   rH   r  rI   )r   r<   rê   Úresolved_headersrô   ÚheaderÚvaluesÚitems           r   r  ÚEndpointRule.resolve_headersï  se   € ð ÐØ—-‘-×#Ñ# I¨rÓ2ˆà%Ÿm™mžo‰NˆFáEKó(ÚEK¸T×&Ñ& tÖ8ÁVñ(ÐÓ$ñ .ð  Ðùò(s   ¸A)rû   )
rÛ   rÜ   rÝ   rÞ   r   rë   r   r  rà   Ú__classcell__©rý   s   @r   r÷   r÷   ¿  s   ø† õ!òò(÷. ð  r!   r÷   c                   ó.   ^ • \ rS rSrU 4S jrS rSrU =r$ )Ú	ErrorRulei   c                 ó2   >• [         TU ]  " S0 UD6  Xl        g rù   )rú   r   Úerror)r   r  rü   rý   s      €r   r   ÚErrorRule.__init__  s   ø€ Ü‰ÒÑ"˜6Ò"Ø�
r!   c                 óz   • U R                  X5      (       a%  UR                  U R                  U5      n[        US9eg)z›If an error rule's conditions are met, raise an error rule.

:type scope_vars: dict
:type rule_lib: RuleSetStandardLibrary
:rtype: EndpointResolutionError
rU   N)rî   rI   r  r
   )r   r<   rê   r  s       r   rë   ÚErrorRule.evaluate  s9   € ð ×#Ñ# J×9Ñ9Ø×*Ñ*¨4¯:©:°zÓBˆEÜ)¨eÑ4Ð4Ør!   )r  )rÛ   rÜ   rÝ   rÞ   r   rë   rà   r  r  s   @r   r  r     s   ø† õ÷
ð 
r!   r  c                   ó2   ^ • \ rS rSrSrU 4S jrS rSrU =r$ )ÚTreeRulei  z”A tree rule is non-terminal meaning it will never be returned to a provider.
Additionally this means it has no attributes that need to be resolved.
c                 óˆ   >• [         TU ]  " S0 UD6  U Vs/ s H  n[        R                  " S0 UD6PM     snU l        g s  snf rù   )rú   r   ÚRuleCreatorÚcreateÚrules)r   r  rü   Úrulerý   s       €r   r   ÚTreeRule.__init__  s:   ø€ Ü‰ÒÑ"˜6Ò"Ù=BÓCºU°T”k×(Ò(Ñ0¨4Ô0¹UÑCˆ�
ùÒCs   – ?c                 ó¬   • U R                  X5      (       a>  U R                   H.  nUR                  UR                  5       U5      nU(       d  M,  Us  $    g)zÉIf a tree rule's conditions are met, iterate its sub-rules
and return first result found.

:type scope_vars: dict
:type rule_lib: RuleSetStandardLibrary
:rtype: RuleSetEndpoint/EndpointResolutionError
N)rî   r  rë   Úcopy)r   r<   rê   r  Úrule_results        r   rë   ÚTreeRule.evaluate  sJ   € ð ×#Ñ# J×9Ñ9ØŸ
œ
�à"Ÿm™m¨J¯O©OÓ,=¸xÓH�ß�;Ø&Ò&ñ	 #ð
 r!   )r  )	rÛ   rÜ   rÝ   rÞ   rß   r   rë   rà   r  r  s   @r   r  r    s   ø† ñõD÷ð r!   r  c                   ó0   • \ rS rSr\r\r\r	\
S 5       rSrg)r  i,  c                 ó‚   • UR                  S5      n [        X5      nU" S0 UD6$ ! [         a    [        SU S3S9ef = f)zOCreate a rule instance from metadata.

:rtype: TreeRule/EndpointRule/ErrorRule
r¦   zUnknown rule type: z1. A rule must be of type tree, endpoint or error.rU   r_   )rŽ   rW   ÚAttributeErrorr
   )Úclsrü   Ú	rule_typeÚ
rule_classs       r   r  ÚRuleCreator.create1  s`   € ð —J‘J˜vÓ&ˆ	ð	(Ü  Ó0ˆJñ Ñ' Ñ'Ð'øô ó 	Ü)Ø)¨)¨ð 56ð 6ñð ð	ús   “& ¦>r_   N)rÛ   rÜ   rÝ   rÞ   r÷   rû   r  r  r  ÚtreeÚclassmethodr  rà   r_   r!   r   r  r  ,  s#   † Ø€HØ€EØ€Dàñ(ó ó(r!   r  c                   ó$   • \ rS rSrSr\r\r\	r
Srg)ÚParameterTypeiC  z8Translation from `type` attribute to native Python type.r_   N)rÛ   rÜ   rÝ   rÞ   rß   r0   ÚstringrÁ   ÚbooleanÚtupleÚstringarrayrà   r_   r!   r   r.  r.  C  s   † ÙBà€FØ€GØƒKr!   r.  c                   ó8   • \ rS rSrSr     SS jrS rS rSrg)	ÚParameterDefinitioniK  z9The spec of an individual parameter defined in a RuleSet.Nc                 óÞ   • Xl          [        [        UR                  5       5      R                  U l        X0l        X@l	        XPl
        X`l        Xpl        g ! [         a    [        SU S3S9ef = f)NzUnknown parameter type: z>. A parameter must be of type string, boolean, or stringarray.rU   )rk   rW   r.  rØ   r;   Úparameter_typer&  r
   ræ   ÚbuiltinÚdefaultÚrequiredÚ
deprecated)r   rk   r6  ræ   ÚbuiltInr8  r9  r:  s           r   r   ÚParameterDefinition.__init__N  s   € ð Œ	ð	Ü")Ü˜~×3Ñ3Ó5ó#ç‰eð Ôð +ÔØŒØŒØ ŒØ$�øô ó 	Ü)Ø.¨~Ð.>ð ?Oð Oñð ð	ús   ˆ-A ÁA,c                 óŒ  • [        XR                  5      (       d$  [        SU R                   SU R                   S3S9eU R                  by  U R                   S3nU R                  R                  S5      nU R                  R                  S5      nU(       a  US	U 3-  nU(       a	  US
U S3-  n[        R                  U5        g)z_Perform base validation on parameter input.

:type value: Any
:raises: EndpointParametersError
zValue (z) is the wrong type. Must be rM   rU   Nz has been deprecated.ÚmessageÚsinceÚ
z
Deprecated since )r%   r6  r
   rk   r:  rH   ÚloggerÚinfo)r   r;   Údepr_strrV   r?  s        r   Úvalidate_inputÚ"ParameterDefinition.validate_inputh  sÃ   € ô ˜%×!4Ñ!4×5Ñ5Ü)Ø˜dŸi™i˜[ð )!Ø!%×!4Ñ!4Ð 5°Qð8ñð ð �?‰?Ñ&ØŸ)™)˜Ð$9Ð:ˆHØ—/‘/×%Ñ% iÓ0ˆCØ—O‘O×'Ñ'¨Ó0ˆEÞØ˜b  ˜JÑ&�ÞØÐ1°%°¸Ð:Ñ:�Ü�K‰K˜Ô!àr!   c                 ó´   • UcC  U R                   b  U R                   $ U R                  (       a  [        SU R                   3S9e U$ U R	                  U5        U$ )z>Process input against spec, applying default if value is None.z)Cannot find value for required parameter rU   )r8  r9  r
   rk   rD  r`   s     r   Úprocess_inputÚ!ParameterDefinition.process_input€  s^   € à‰=Ø�|‰|Ñ'Ø—|‘|Ð#Ø�}�}Ü-ØCÀDÇIÁIÀ;ÐOñð ð ð ˆð ×Ñ Ô&Øˆr!   )r7  r8  r:  ræ   rk   r6  r9  )NNNNN)	rÛ   rÜ   rÝ   rÞ   rß   r   rD  rG  rà   r_   r!   r   r4  r4  K  s%   † ÙCð ØØØØô%ò4õ0r!   r4  c                   ó6   • \ rS rSrSr S	S jrS rS rS rSr	g)
ÚRuleSeti�  z:Collection of rules to derive a routable service endpoint.Nc                 óÊ   • Xl         U R                  U5      U l        U Vs/ s H  n[        R                  " S0 UD6PM     snU l        [        U5      U l        XPl        g s  snf rù   )	ÚversionÚ_ingest_parameter_specÚ
parametersr  r  r  r   rê   ræ   )r   rL  rN  r  r   ræ   r  s          r   r   ÚRuleSet.__init__’  sW   € ð ŒØ×5Ñ5°jÓAˆŒÙ=BÓCºU°T”k×(Ò(Ñ0¨4Ô0¹UÑCˆŒ
Ü.¨zÓ:ˆŒØ*Õùò Ds   ¡ A c                 ó  • UR                  5        VVs0 s He  u  p#U[        UUS   UR                  S5      UR                  S5      UR                  S5      UR                  S5      UR                  S5      5      _Mg     snn$ s  snnf )Nr¦   ræ   r;  r8  r9  r:  )r  r4  rH   )r   rN  rk   Úspecs       r   rM  ÚRuleSet._ingest_parameter_spec›  s‹   € ð )×.Ñ.Ô0ô
ò 1‘
�ð Ô%ØØ�V‘Ø—‘˜Ó)Ø—‘˜Ó#Ø—‘˜Ó#Ø—‘˜Ó$Ø—‘˜Ó&óò ñ 1ò
ð 	
ùó 
s   ”A,Bc                 óœ   • U R                   R                  5        H.  u  p#UR                  UR                  U5      5      nUc  M*  XAU'   M0     g)zIProcess each input parameter against its spec.

:type input_params: dict
N)rN  r  rG  rH   )r   Úinput_paramsrk   rQ  r;   s        r   Úprocess_input_parametersÚ RuleSet.process_input_parameters©  sK   € ð
 Ÿ/™/×/Ñ/Ö1‰JˆDØ×&Ñ& |×'7Ñ'7¸Ó'=Ó>ˆEØÓ Ø%*˜TÓ"ñ 2ð r!   c                 ó®   • U R                  U5        U R                   H4  nUR                  UR                  5       U R                  5      nUc  M2  Us  $    g)z]Evaluate input parameters against rules returning first match.

:type input_parameters: dict
N)rU  r  rë   r!  rê   )r   Úinput_parametersr  Ú
evaluations       r   rë   ÚRuleSet.evaluate´  sP   € ð
 	×%Ñ%Ð&6Ô7Ø—J”JˆDØŸ™Ð'7×'<Ñ'<Ó'>ÀÇÁÓNˆJØÓ%Ø!Ò!ñ ð r!   )ræ   rN  rê   r  rL  r   )
rÛ   rÜ   rÝ   rÞ   rß   r   rM  rU  rë   rà   r_   r!   r   rJ  rJ  �  s    † ÙDð EIô+ò
ò	õ
r!   rJ  c                   ó@   • \ rS rSrSrS	S jrS r\" \S9S 5       r	Sr
g)
ÚEndpointProvideriÁ  z<Derives endpoints from a RuleSet for given input parameters.Nc                 ó\   • [        S0 UDSU0D6U l        U=(       d
    [        5       U l        g )Nr   r_   )rJ  ÚrulesetÚ	frozensetÚ_excluded_params)r   Úruleset_dataÚpartition_dataÚexcluded_paramss       r   r   ÚEndpointProvider.__init__Ä  s%   € ÜÑI ÑI¸.ÒIˆŒØ /× >´9³;ˆÕr!   c                 óp   • U R                    H  nUR                  US 5        M     U R                  " S0 UD6$ rù   )r`  rŽ   Ú_resolve_endpoint)r   rX  rC   s      r   Úresolve_endpointÚ!EndpointProvider.resolve_endpointÈ  s7   € Ø×*Ô*ˆEØ× Ñ  ¨Ö-ñ +à×%Ò%Ñ9Ð(8Ñ9Ð9r!   )Úmaxsizec           	      óø   • UR                  5       nU R                  R                  U5      nUcE  SR                  UR	                  5        VVs/ s H  u  pEU SU 3PM     snn5      n[        SU 3S9eU$ s  snnf )zXMatch input parameters to a rule.

:type input_parameters: dict
:rtype: RuleSetEndpoint
r@  z: z"No endpoint found for parameters:
rU   )r!  r^  rë   Újoinr  r
   )r   rX  Úparams_for_errorrû   r  r;   Úparam_strings          r   rf  Ú"EndpointProvider._resolve_endpointÍ  sŒ   € ð ,×0Ñ0Ó2ÐØ—<‘<×(Ñ(Ð)9Ó:ˆØÑØŸ9™9Ø5E×5KÑ5KÔ5MÔNÒ5M¡z s�C�5˜˜5˜'Ó"Ñ5MÒNóˆLô *Ø9¸,¸ÐHñð ð ˆùó Os   ÁA6
)r`  r^  r   )rÛ   rÜ   rÝ   rÞ   rß   r   rg  r   Ú
CACHE_SIZErf  rà   r_   r!   r   r\  r\  Á  s(   † ÙFô?ò:ñ
 ˜zÑ*ñó +ór!   r\  )0rß   Úloggingry   Úenumr   r/  r   Útypingr   Úbotocorer   Úbotocore.compatr   r   r	   Úbotocore.exceptionsr
   Úbotocore.utilsr   r   r   r   r   r   r   Ú	getLoggerrÛ   rA  Úcompiler1   rd   rš   ro  ÚS3_UNREFERENCED_PARAMSr‹   r8   r   ÚRuleSetStandardLibaryrâ   rñ   r÷   r  r  r  r.  r4  rJ  r\  r_   r!   r   Ú<module>r{     s  ðñó Û 	Ý Ý Ý å ß 4Ñ 4Ý 7÷÷ ñ ð 
×	Ò	˜8Ó	$€à—Z’ZÐ 1Ó2Ð Ø�jŠjÐ*Ó+€Ø—j’jØ%óÐ ð €
ò 9Ð Ù‹[€
Ù“;Ð ÷]
ñ ]
ðD /Ð ÷ñ ô0�jô ô> �8ô > ôB�ô ô$ˆxô ÷4(ñ (ô.�Dô ÷Añ A÷H/ñ /÷dò r!   