§
    ùÛgˆ  ã                   ó¸   — d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	  G d„ de
e¦  «        Ze G d„ d	ee
¦  «        ¦   «         Z G d
„ de
¦  «        Zd„ Zd„ Zd„ ZdS )zÍ
    flask.debughelpers
    ~~~~~~~~~~~~~~~~~~

    Various helpers to make the development experience better.

    :copyright: (c) 2015 by Armin Ronacher.
    :license: BSD, see LICENSE for more details.
é   )Úimplements_to_stringÚ	text_type)ÚFlask)Ú	Blueprint)Ú_request_ctx_stackc                   ó   — e Zd ZdZdS )ÚUnexpectedUnicodeErrorzjRaised in places where we want some better error reporting for
    unexpected unicode or binary data.
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úH/granary/edev/quantum/lib/python3.11/site-packages/flask/debughelpers.pyr	   r	      s   € € € € € ðð ð ð r   r	   c                   ó   — e Zd ZdZd„ Zd„ ZdS )ÚDebugFilesKeyErrorz•Raised from request.files during debugging.  The idea is that it can
    provide a better error message than just a generic KeyError/BadRequest.
    c                 óú   — |j                              |¦  «        }d|›d|j        ›d�g}|r5|                     dd                     d„ |D ¦   «         ¦  «        z  ¦  «         d                     |¦  «        | _        d S )NzYou tried to access the file "z[" in the request.files dictionary but it does not exist.  The mimetype for the request is "z¨" instead of "multipart/form-data" which means that no file contents were transmitted.  To fix this error you should provide enctype="multipart/form-data" in your form.zI

The browser instead transmitted some file names. This was submitted: %sz, c              3   ó    K  — | ]	}d |z  V — Œ
dS )z"%s"Nr   ©Ú.0Úxs     r   ú	<genexpr>z.DebugFilesKeyError.__init__.<locals>.<genexpr>'   s;   è è € ð <3ð <3Ø !ð =CÀQ¹Jð <3ð <3ð <3ð <3ð <3ð <3r   Ú )ÚformÚgetlistÚmimetypeÚappendÚjoinÚmsg)ÚselfÚrequestÚkeyÚform_matchesÚbufs        r   Ú__init__zDebugFilesKeyError.__init__   s§   € Ø”|×+Ò+¨CÑ0Ô0ˆˆð ���WÔ%Ð%Ð%ð'ð (ˆð ð 	4Ø�JŠJð 0Ø26·)²)ð <3ð <3Ø%1ð<3ñ <3ô <3ñ 33ô 33ñ3ñ 4ô 4ð 4ð —7’7˜3‘<”<ˆŒˆˆr   c                 ó   — | j         S ©N)r   )r    s    r   Ú__str__zDebugFilesKeyError.__str__+   s	   € ØŒxˆr   N)r
   r   r   r   r%   r(   r   r   r   r   r      s<   € € € € € ðð ð ð  ð  ðð ð ð ð r   r   c                   ó   — e Zd ZdZd„ ZdS )ÚFormDataRoutingRedirectzÎThis exception is raised by Flask in debug mode if it detects a
    redirect caused by the routing system when the request method is not
    GET, HEAD or OPTIONS.  Reasoning: form data will be dropped.
    c                 ó¤  — |j         }d|j        ›d|j        ›d�g}|j        dz   |j                             d¦  «        d         k    r|                     d¦  «         |                     d|j        z  ¦  «         |                     d	¦  «         t                               | d
 	                    |¦  «         
                    d¦  «        ¦  «         d S )Nz A request was sent to this URL (zD) but a redirect was issued automatically by the routing system to "z".ú/ú?é    z“  The URL was defined with a trailing slash so Flask will automatically redirect to the URL with the trailing slash if it was accessed without one.z£  Make sure to directly send your %s-request to this URL since we can't make browsers or HTTP clients redirect with form data reliably or without user interaction.z3

Note: this exception is only raised in debug moder   zutf-8)Úrouting_exceptionÚurlÚnew_urlÚbase_urlÚsplitr   ÚmethodÚAssertionErrorr%   r   Úencode)r    r!   Úexcr$   s       r   r%   z FormDataRoutingRedirect.__init__5   sã   € ØÔ'ˆˆð ”+�+�+˜sœ{˜{˜{ð,ð -ˆð
 Ô˜cÑ! S¤[×%6Ò%6°sÑ%;Ô%;¸AÔ%>Ò>Ð>Ø�JŠJð &ñ 'ô 'ð 'ð
 	�
Š
ð Jð ”>ñ"ñ 	#ô 	#ð 	#ð 	�
Š
ÐJÑKÔKÐKÝ×Ò  b§g¢g¨c¡l¤l×&9Ò&9¸'Ñ&BÔ&BÑCÔCÐCÐCÐCr   N)r
   r   r   r   r%   r   r   r   r*   r*   /   s2   € € € € € ðð ð
Dð Dð Dð Dð Dr   r*   c                 óŒ   ‡ ‡— ‰ j         j        Š G ˆˆ fd„d‰¦  «        }‰j        |_        ‰j        |_        |‰ j         _        dS )z¨Since Flask 0.8 we're monkeypatching the files object in case a
    request is detected that does not use multipart form data but the files
    object is accessed.
    c                   ó   •— e Zd Zˆ ˆfd„ZdS )ú.attach_enctype_error_multidict.<locals>.newclsc                 ó‚   •— 	 ‰                      | |¦  «        S # t          $ r |‰j        vr‚ t          ‰|¦  «        ‚w xY wr'   )Ú__getitem__ÚKeyErrorr   r   )r    r"   Úoldclsr!   s     €€r   r<   z:attach_enctype_error_multidict.<locals>.newcls.__getitem__Q   sY   ø€ ð7Ø×)Ò)¨$°Ñ4Ô4Ð4øÝð 7ð 7ð 7Ø˜gœlÐ*Ð*ØÝ(¨°#Ñ6Ô6Ð6ð7øøøs   ƒ ™%>N)r
   r   r   r<   )r>   r!   s   €€r   Únewclsr:   P   s3   ø€ € € € € ð	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7ð 	7r   r?   N)ÚfilesÚ	__class__r
   r   )r!   r?   r>   s   ` @r   Úattach_enctype_error_multidictrB   J   so   øø€ ð
 Œ]Ô$€Fð7ð 7ð 7ð 7ð 7ð 7ð 7ð 7�ñ 7ô 7ð 7ð ”o€F„OØÔ)€FÔØ$€G„MÔÐÐr   c           	   #   óî  K  — dt          | ¦  «        j        ›dt          | ¦  «        j        ›�V — t          | j                             ¦   «         ¦  «        D ]�\  }}|                     d¦  «        rŒt          |t          t          f¦  «        r.t          d„ |D ¦   «         ¦  «        sŒQd|z  V — |D ]	}d|z  V — Œ
Œet          |t          t          t          t          t          f¦  «        sŒ”|›d|›�V — Œžd S )Nzclass: ú.Ú_c              3   óN   K  — | ] }t          |t          t          f¦  «        V — Œ!d S r'   )Ú
isinstanceÚstrr   r   s     r   r   z$_dump_loader_info.<locals>.<genexpr>c   s1   è è € ÐFÐF¸1•z !¥c­9Ð%5Ñ6Ô6ÐFÐFÐFÐFÐFÐFr   z%s:z  - %sz: )Útyper   r
   ÚsortedÚ__dict__ÚitemsÚ
startswithrG   ÚtupleÚlistÚallrH   r   ÚintÚfloatÚbool)Úloaderr"   ÚvalueÚitems       r   Ú_dump_loader_inforW   ]   s%  è è € € Ý  ™LœLÔ3Ð3Ð3µT¸&±\´\Ô5JÐ5JÐ
KÐKÐKÐKÝ˜Vœ_×2Ò2Ñ4Ô4Ñ5Ô5ð &ð &‰
ˆˆUØ�>Š>˜#ÑÔð 	ØÝ�e�e¥T˜]Ñ+Ô+ð 	ÝÐFÐFÀÐFÑFÔFÑFÔFð ØØ˜#‘+ÐÐÐØð &ð &�Ø ‘oÐ%Ð%Ð%Ð%ØÝ˜E¥C­µC½ÅÐ#EÑFÔFð 	ØØ˜#˜#˜u˜uÐ%Ð%Ð%Ð%Ð%ð&ð &r   c                 ó”  — d|z  g}d}d}t           j        }|�|j        j        �|j        j        }t	          |¦  «        D ]×\  }\  }}	}
t          |	t          ¦  «        rd|	j        z  }n8t          |	t          ¦  «        rd|	j	        ›d|	j        ›d�}nt          |	¦  «        }|                     d|d	z   |fz  ¦  «         t          |¦  «        D ]}|                     d
|z  ¦  «         Œ|
€d}nd|
d	         pdz  }|d	z  }|                     d|z  ¦  «         ŒØd}|dk    r|                     d¦  «         d}n|d	k    r|                     d¦  «         d}|�D|rB|                     d|z  ¦  «         |                     d¦  «         |                     d¦  «         | j                             d                     |¦  «        ¦  «         dS )z2This should help developers understand what failedzLocating template "%s":r.   Nzapplication "%s"zblueprint "z" (ú)z% 5d: trying loader of %sr   z	       %szno matchz
found (%r)z<string>z       -> %sFz'Error: the template could not be found.Tz<Warning: multiple loaders returned a match for the template.zQ  The template was looked up from an endpoint that belongs to the blueprint "%s".z9  Maybe you did not place a template in the right folder?z7  See http://flask.pocoo.org/docs/blueprints/#templatesú
)r   Útopr!   Ú	blueprintÚ	enumeraterG   r   Úimport_namer   ÚnameÚreprr   rW   ÚloggerÚinfor   )ÚappÚtemplateÚattemptsrb   Útotal_foundr\   ÚreqctxÚidxrT   ÚsrcobjÚtripleÚsrc_infoÚlineÚdetailÚseems_fishys                  r   Ú!explain_template_loading_attemptsro   n   s+  € à%¨Ñ0Ð1€DØ€KØ€IÝÔ#€FØÐ˜fœnÔ6ÐBØ”NÔ,ˆ	å)2°8Ñ)<Ô)<ð -ð -Ñ%ˆÑ%ˆf�f˜fÝ�f�eÑ$Ô$ð 	$Ø)¨FÔ,>Ñ>ˆHˆHÝ˜¥	Ñ*Ô*ð 	$ð 	$Ø06´°°Ø06Ô0BÐ0BÐ0BðDˆHˆHõ ˜F‘|”|ˆHà�ŠÐ/Ø�!‰G�Xð3ñ ñ 	 ô 	 ð 	 õ & fÑ-Ô-ð 	,ð 	,ˆDØ�KŠK˜ dÑ*Ñ+Ô+Ð+Ð+àˆ>ØˆFˆFà! V¨A¤YÐ%<°*Ñ=ˆFØ˜1ÑˆKØ�Š�N VÑ+Ñ,Ô,Ð,Ð,à€KØ�aÒÐØ�ŠÐ=Ñ>Ô>Ð>ØˆˆØ	�qŠˆØ�ŠÐRÑSÔSÐSØˆàÐ ÐØ�Šð 5Ø7@ñAñ 	Bô 	Bð 	Bà�ŠÐOÑPÔPÐPØ�ŠÐMÑNÔNÐNà„J‡O‚O�D—I’I˜d‘O”OÑ$Ô$Ð$Ð$Ð$r   N)r   Ú_compatr   r   rc   r   Ú
blueprintsr   Úglobalsr   r5   ÚUnicodeErrorr	   r=   r   r*   rB   rW   ro   r   r   r   ú<module>rt      s-  ððð ð 5Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø Ð Ð Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'ðð ð ð ð ˜^¨\ñ ô ð ð ðð ð ð ð ˜ >ñ ô ñ Ôðð.Dð Dð Dð Dð D˜nñ Dô Dð Dð6%ð %ð %ð&&ð &ð &ð"-%ð -%ð -%ð -%ð -%r   