
    2Bf                         d dl Z d dlZd dlmZ ddlmZ ddlmZ ddl	m
Z
  G d dee      Z G d	 d
ee      Z G d de      Zd Zdej$                  fdZdeddfdZddZy)    N)warn   )Flask)	Blueprint)_request_ctx_stackc                       e Zd ZdZy)UnexpectedUnicodeErrorzjRaised in places where we want some better error reporting for
    unexpected unicode or binary data.
    N)__name__
__module____qualname____doc__     R/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/flask/debughelpers.pyr	   r	   
   s    r   r	   c                       e Zd ZdZd Zd Zy)DebugFilesKeyErrorzRaised from request.files during debugging.  The idea is that it can
    provide a better error message than just a generic KeyError/BadRequest.
    c                     |j                   j                  |      }d|d|j                  dg}|r,dj                  d |D              }|j	                  d|        dj                  |      | _        y )NzYou tried to access the file zX 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.z, c              3   2   K   | ]  }t        |        y wN)repr.0xs     r   	<genexpr>z.DebugFilesKeyError.__init__.<locals>.<genexpr>    s     <!d1g<s   zG

The browser instead transmitted some file names. This was submitted:  )formgetlistmimetypejoinappendmsg)selfrequestkeyform_matchesbufnamess         r   __init__zDebugFilesKeyError.__init__   s    ||++C0+C7 3"++. /;;
 II<|<<EJJ'',g/ 773<r   c                     | j                   S r   )r!   )r"   s    r   __str__zDebugFilesKeyError.__str__'   s    xx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y)FormDataRoutingRedirectzThis 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|j                  j	                  d      d   k(  r|j                  d       |j                  d|j                   d	       |j                  d
       t        j                  | dj                  |      j                  d             y )Nz A request was sent to this URL (zC) but a redirect was issued automatically by the routing system to ./?r   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 z-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__1   s    ''.w{{m <;;/$
 q!S[[%6%6s%;A%>>JJB 	

  ,,	
 	

JKbggcl&9&9'&BCr   N)r
   r   r   r   r(   r   r   r   r,   r,   +   s    
Dr   r,   c                       j                   j                   G  fdd      }j                  |_        j                  |_        | j                   _        y)zSince 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y).attach_enctype_error_multidict.<locals>.newclsc                 z    	 j                  | |      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__S   sF    7))$44 7gll*(#667s    %:N)r
   r   r   r>   )r@   r#   s   r   newclsr<   R   s    	7r   rA   N)files	__class__r
   r   )r#   rA   r@   s   ` @r   attach_enctype_error_multidictrD   K   sG    
 ]]$$F7 7 ooFO))F$GMMr   returnc              #     K   dt        |       j                   dt        |       j                    t        | j                  j                               D ]  \  }}|j                  d      rt        |t        t        f      r)t        d |D              sA| d |D ]	  }d|   Wt        |t        t        t        t        f      sx| d|  y w)Nzclass: r.   _c              3   <   K   | ]  }t        |t                y wr   )
isinstancestrr   s     r   r   z$_dump_loader_info.<locals>.<genexpr>f   s     9az!S)9s   :z  - z: )typer   r
   sorted__dict__items
startswithrI   tuplelistallrJ   intfloatbool)loaderr$   valueitems       r   _dump_loader_inforZ   `   s     DL++,Ad6l.C.C-D
EEV__2245 "
U>>#eeT]+9599E)O $TFm#$ECeT#:;Ry!!"s   CCappc                 x   d|dg}d}d}t         j                  }|,|j                  j                  |j                  j                  }t	        |      D ]  \  }\  }}	}
t        |	t              rd|	j                  }n9t        |	t              rd|	j                  d|	j                   d}nt        |	      }|j                  |d	z   d
d|        t        |      D ]  }|j                  d|         |
d}nd|
d	   xs dd}|d	z  }|j                  d|         d}|dk(  r|j                  d       d}n|d	kD  r|j                  d       d}|9|r7|j                  d|d       |j                  d       |j                  d       | j                  j                  dj                  |             y)z2This should help developers understand what failedzLocating template rK   r   Nzapplication z
blueprint z ()r   5z: trying loader of z       zno matchzfound (z<string>z
       -> Fz'Error: the template could not be found.Tz<Warning: multiple loaders returned a match for the template.zL  The template was looked up from an endpoint that belongs to the blueprint r.   z9  Maybe you did not place a template in the right folder?z=  See https://flask.palletsprojects.com/blueprints/#templates
)r   topr#   	blueprint	enumeraterI   r   import_namer   namer   r    rZ   loggerinfor   )r[   templateattemptsrf   total_foundra   reqctxidxrW   srcobjtriplesrc_infolinedetailseems_fishys                  r   !explain_template_loading_attemptsrr   q   s    A./DKI##Ffnn66BNN,,	)28)< +%%ffffe$%f&8&8%;<H	*#FKK?"V5G5G4HJHF|HsQwqk!4XJ?@%f- 	*DKK'$()	* >Fvay6J9;F1Kj)*%+( Ka=>	qRS!!*Q0	
 	OPSTJJOODIIdO$r   c                  v    t         j                  j                  d      dk7  rt        t	        d      d       y y )NWERKZEUG_RUN_MAINtruezSilently ignoring app.run() because the application is run from the flask command line executable. Consider putting app.run() behind an if __name__ == "__main__" guard to silence this warning.   )
stacklevel)osenvirongetr   Warningr   r   r   explain_ignored_app_runr|      s7    	zz~~)*f42 	
 5r   )rE   N)rx   typingtwarningsr   r[   r   
blueprintsr   globalsr   r7   UnicodeErrorr	   r?   r   r,   rD   	GeneratorrZ   rr   r|   r   r   r   <module>r      sp    	    ! '^\ > 6Dn D@%*" ""-%5 -% -%`

r   