
    2Bf$}                        d dl Z d dlZd dlZd dlZd dlZd dlZ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 d dlZd dlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ 	 d dlZ	 d dlZ G d dej6                        Zd ZdhdZd Zd Z d Z!didZ"d Z# ejH                  dgdde#dd      Z% G d d      Z& G d d      Z' ejP                  e'd      Z)d Z* G d  d!ejV                        Z, G d" d#e,      Z-d$ Z.djd%Z/d& Z0 G d' d(ejb                        Z2d) Z3 G d* d+ejh                        Z5 ejl                  d,d-.       ejn                  d/d0d1d23       ejn                  d4d5d6d73       ejn                  d8 e2       d9:       ejn                  d; ejh                  ddd<      e3dd=>       ejn                  d?dd@3       ejn                  dAddB3       ejn                  dCddD3       ejn                  dEddF3       ejn                  dGd e5       dHejp                  jr                  dIJ      e)dK                                                                              Z: ejl                  dLdM.      e*dkdO              Z; ejl                  dPdQ.       ejn                  dRdS ejx                  dT      dUdVW       ejn                  dXddYZ      e*d[e=d\e>dNdfd]                            Z? e-d^j                  ej                  d_k(  rd`ndaej                  d_k(  rdbndcd      e      ZBdkdfZCeDdgk(  r eC        yy# e$ r dZY w xY w# e$ r dZY w xY w)l    N)update_wrapper)
attrgetter)Lock)Thread)import_string   )current_app)get_debug_flag)get_env)get_load_dotenvc                       e Zd ZdZy)NoAppExceptionz3Raised if an application cannot be found or loaded.N)__name__
__module____qualname____doc__     I/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/flask/cli.pyr   r   !   s    =r   r   c                    ddl m} dD ]  }t        ||d      }t        ||      s|c S  |j                  j                         D cg c]  }t        ||      s| }}t        |      dk(  r|d   S t        |      dkD  r&t        d|j                  d|j                   d      d	D ]B  }t        ||d      }t        j                  |      s&	 t        | |      }t        ||      r|c S D t        d|j                  d|j                   d      c c}w # t        $ r9 t        |      s t        d
|d|j                  d|j                   d| d	      w xY w)zwGiven a module instance this tries to find the best possible
    application in the module or raises an exception.
    r   Flask)appapplicationNr   z/Detected multiple Flask applications in module z. Use 'FLASK_APP=z":name' to specify the correct one.)
create_appmake_appzDetected factory  in module z;, but could not call it without arguments. Use "FLASK_APP=':z(args)'" to specify arguments.z6Failed to find Flask application or factory in module z:name' to specify one.) r   getattr
isinstance__dict__valueslenr   r   inspect
isfunctioncall_factory	TypeError_called_with_wrong_args)script_infomoduler   	attr_namer   vmatchesapp_factorys           r   find_best_appr0   %   s     , 	fi.c5!J	 !//002KQjE6JqKGK
7|qqz	W	""3FOO3D E+,
 	
 0 	fi6k*";<c5)J *& 	OO//@ A	 ? L*  .{;$'	}K?R S%%+__$5Qyk B-- s   DDDAEc                    t        j                  |      }|g n|}|i n|}d|j                  v rt        j                  dt
               | |d<   |st        |j                        dk(  r{t        t        |j                  j                                     j                  t         j                  j                  u r+t        j                  dt
               |j                  |         ||i |S )zTakes an app factory, a ``script_info` object and  optionally a tuple
    of arguments. Checks for the existence of a script_info argument and calls
    the app_factory depending on that and the arguments provided.
    r*   ziThe 'script_info' argument is deprecated and will not be passed to the app factory function in Flask 2.1.r   zqScript info is deprecated and will not be passed as the single argument to the app factory function in Flask 2.1.)r%   	signature
parameterswarningswarnDeprecationWarningr$   nextiterr#   default	Parameteremptyappend)r*   r/   argskwargssigs        r   r'   r'   Y   s    
 

K
(C24D>RvF&@	

 !,} 1$cnn++-./777;L;L;R;RR 		
 	K '''r   c                     t        j                         d   }	 |4|j                  j                  | j                  u r	 ~y|j
                  }|4	 ~y# ~w xY w)zCheck whether calling a function raised a ``TypeError`` because
    the call failed or because something in the factory raised the
    error.

    :param f: The function that was called.
    :return: ``True`` if the call failed.
       FT)sysexc_infotb_framef_code__code__tb_next)ftbs     r   r)   r)   z   s\     
	Bn{{!!QZZ/  B n  Bs   $A  A Ac                    ddl m} 	 t        j                  |j	                         d      j
                  }t        |t        j                        r|j                  }dx}}nt        |t        j                        rt        |j                  t        j                        st        d|d	      |j                  j                  }	 |j                  D cg c]  }t        j                  |       }}|j                  D 	ci c],  }	|	j                   t        j                  |	j"                        . }}	nt        d|d      	 t'        ||      }
t-        j.                  |
      r	 t1        | |
||      }n|
}t        ||      r|S t        d|j*                   d| d      # t        $ r t        d|d      w xY wc c}w c c}	w # t$        $ r t        d
|d	      w xY w# t(        $ r t        d|d|j*                  d	      w xY w# t2        $ r) t5        |
      s t        d|d|j*                  d      w xY w)zCheck if the given string is a variable name or a function. Call
    a function to get the app instance, or return the variable directly.
    r   r   eval)modezFailed to parse z' as an attribute name or function call.Nz*Function reference must be a simple name: .z-Failed to parse arguments as literal values: zFailed to find attribute z in zThe factory r   z2 could not be called with the specified arguments.z1A valid Flask application was not obtained from 'r   z'.)r   r   astparsestripbodySyntaxErrorr   r!   NameidCallfuncr=   literal_evalkeywordsargvalue
ValueErrorr    AttributeErrorr   r%   r&   r'   r(   r)   )r*   r+   app_namer   exprnamer=   r>   rY   kwattrr   s               r   find_app_by_stringrb      sU    
yy)7<< $!wwv	D#((	#$))SXX. <XLJ  yy||	59YY?cC$$S)?D?CG==QRbffc..rxx88QFQ xl*QR
 	

vt$ $
	{D$?C #u

	__Qxj	, w  
xl*QR
 	

& @Q 	 !?|1M 	  
'xtFOO3FaH
 	

  	*40 xl +OO& '(( 		sM   /F! G F=0G  1G1G G# &H !F:=
G G #&H	2H>c                    t         j                  j                  |       } t         j                  j                  |       \  }}|dk(  r|} t         j                  j	                  |       dk(  rt         j                  j                  |       } g }	 t         j                  j                  |       \  } }|j                  |       t         j                  j                  t         j                  j                  | d            snrt        j                  d   | k7  r t        j                  j                  d|        dj                  |ddd         S )zGiven a filename this will try to calculate the python path, add it
    to the search path and return the actual module name that is expected.
    z.py__init__z__init__.pyr   rM   N)ospathrealpathsplitextbasenamedirnamesplitr<   existsjoinrB   insert)rg   fnameextmodule_namer_   s        r   prepare_importrs      s     77D!D!!$'JE3
e|	ww+wwt$K WW]]4(
d4 ww~~bggll4?@  xx{d4 88K"%&&r   Tc                 B   d}	 t        |       t        j                  |   }|t        | |      S t        | ||      S # t        $ rX t        j                         d   j                  r#t        d|dt        j                                |rt        d|d      Y y w xY w)NTrA   zWhile importing z, an ImportError was raised:

zCould not import rM   )
__import__ImportErrorrB   rC   rG   r   	traceback
format_excmodulesr0   rb   )r*   rr   r]   raise_if_not_found__traceback_hide__r+   s         r   
locate_appr|      s    ; [[%F[&11!+vx@@%   <<>!$$ ";/ 2(33568    #4[O1!EFFs   = ABBc                     |r| j                   ry dd l}ddlm} t	        j
                  dt        j                          d| d|j                   | j                         | j                          y )Nr   r   )__version__Python z
Flask z

Werkzeug )color)
resilient_parsingwerkzeugr   r~   clickechoplatformpython_versionr   exit)ctxparamrZ   r   r~   s        r   get_versionr     sg    C))	JJ
())+, - (()	+ ii	 HHJr   z	--versionzShow the flask versionF)helpexpose_valuecallbackis_flagis_eagerc                   0    e Zd ZdZddZd Zd Zd Zd Zy)	DispatchingAppa  Special application that dispatches to a Flask application which
    is imported by name in a background thread.  If an error happens
    it is recorded and shown as part of the WSGI handling which in case
    of the Werkzeug debugger means that it shows up in the browser.
    Nc                     || _         d | _        t               | _        d | _        |"t
        j                  j                  d      dk7  }|r| j                          y | j                          y )NWERKZEUG_RUN_MAINtrue)
loader_appr   _lock_bg_loading_exc_inforf   environget_load_unlocked_load_in_background)selfr   use_eager_loadings      r   rd   zDispatchingApp.__init__7  s[    	V
$(!$ "

/B Cv M!$$&r   c                 J      fd}t        |d      }|j                          y )Nc                      d} j                   5  	 j                          d d d        y # t        $ r t        j                         _        Y -w xY w# 1 sw Y   y xY wNT)r   r   	ExceptionrB   rC   r   )r{   r   s    r   	_load_appz5DispatchingApp._load_in_background.<locals>._load_appF  sZ    !% ??'')? ? ! ?03D-?? ?s&   A+"AAAAAr   )targetr=   )r   start)r   r   ts   `  r   r   z"DispatchingApp._load_in_backgroundE  s    	? )"-		r   c                 6    d}| j                   }|	d | _         |y r   )r   )r   r{   rC   s      r   _flush_bg_loading_exceptionz*DispatchingApp._flush_bg_loading_exceptionQ  s+    !,,(,D%N  r   c                 F    d}| j                         x| _        }d | _        |S r   )r   r   r   )r   r{   rvs      r   r   zDispatchingApp._load_unlockedX  s'    !&	B$(!	r   c                 
   d}| j                   | j                  ||      S | j                          | j                  5  | j                   | j                   }n| j                         } |||      cd d d        S # 1 sw Y   y xY wr   )r   r   r   r   )r   r   start_responser{   r   s        r   __call__zDispatchingApp.__call__^  sv    !99 99Wn55((*ZZ 	/yy$YY((*g~.	/ 	/ 	/s   2A99BN)	r   r   r   r   rd   r   r   r   r   r   r   r   r   r   0  s     '

/r   r   c                       e Zd ZdZddZd Zy)
ScriptInfoa  Helper object to deal with Flask applications.  This is usually not
    necessary to interface with as it's used internally in the dispatching
    to click.  In future versions of Flask this object will most likely play
    a bigger role.  Typically it's created automatically by the
    :class:`FlaskGroup` but you can also manually create it and pass it
    onwards as click object.
    Nc                     |xs t         j                  j                  d      | _        || _        i | _        || _        d | _        y )N	FLASK_APP)rf   r   r   app_import_pathr   dataset_debug_flag_loaded_app)r   r   r   r   s       r   rd   zScriptInfo.__init__t  s>    .M"**..2M % 	,r   c                    d}| j                   | j                   S | j                  t        | | j                        }nu| j                  rDt	        j
                  d| j                  d      dgz   dd \  }}t        |      }t        | ||      }n%dD ]   }t        |      }t        | |dd      }|s  n st        d	      | j                  rt               |_        || _         |S )
zLoads the Flask app (if not yet loaded) and returns it.  Calling
        this multiple times will just result in the already loaded app to
        be returned.
        TNz
:(?![\\/])r   rA   )zwsgi.pyzapp.pyF)rz   zCould not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory.)r   r   r'   r   rerl   rs   r|   r   r   r
   debug)r   r{   r   rg   r_   import_names         r   load_appzScriptInfo.load_app  s    
 "'###??&tT__5C##HH]D,@,@!DvM1
d -T2 {D91 D"0"6K$T;QVWC  J   '(CI
r   )NNT)r   r   r   r   rd   r   r   r   r   r   r   k  s    
 (r   r   )ensurec                 L     t         j                   fd       }t        |       S )zWraps a callback so that it's guaranteed to be executed with the
    script's application context.  If callbacks are registered directly
    to the ``app.cli`` object then they are wrapped with this function
    by default unless it's disabled.
    c                     | j                  t              j                         j                         5   | j                  g|i |cd d d        S # 1 sw Y   y xY wr   )ensure_objectr   r   app_contextinvoke)__ctxr=   r>   rH   s      r   	decoratorz"with_appcontext.<locals>.decorator  sP      ,557CCE 	45<<3D3F3	4 	4 	4s   AA)r   pass_contextr   )rH   r   s   ` r   with_appcontextr     s,     4 4 )Q''r   c                       e Zd ZdZd Zd Zy)AppGroupa   This works similar to a regular click :class:`~click.Group` but it
    changes the behavior of the :meth:`command` decorator so that it
    automatically wraps the functions in :func:`with_appcontext`.

    Not to be confused with :class:`FlaskGroup`.
    c                 B     j                  dd       fd}|S )zThis works exactly like the method of the same name on a regular
        :class:`click.Group` but it wraps callbacks in :func:`with_appcontext`
        unless it's disabled by passing ``with_appcontext=False``.
        r   Tc                 p    rt        |       }  t        j                  j                  gi |       S r   )r   r   Groupcommand)rH   r=   r>   r   wrap_for_ctxs    r   r   z#AppGroup.command.<locals>.decorator  s6    #A&=5;;&&t=d=f=a@@r   )pop)r   r=   r>   r   r   s   ``` @r   r   zAppGroup.command  s$    
 zz"3T:	A
 r   c                 t    |j                  dt               t        j                  j                  | g|i |S )zThis works exactly like the method of the same name on a regular
        :class:`click.Group` but it defaults the group class to
        :class:`AppGroup`.
        cls)
setdefaultr   r   r   group)r   r=   r>   s      r   r   zAppGroup.group  s3    
 	%*{{  7777r   N)r   r   r   r   r   r   r   r   r   r   r     s    8r   r   c                   N     e Zd ZdZ	 	 	 	 	 ddZd Z fdZ fdZ fdZ xZ	S )
FlaskGroupa<  Special subclass of the :class:`AppGroup` group that supports
    loading more commands from the configured Flask app.  Normally a
    developer does not have to interface with this class but there are
    some very advanced use cases for which it makes sense to create an
    instance of this. see :ref:`custom-scripts`.

    :param add_default_commands: if this is True then the default run and
        shell commands will be added.
    :param add_version_option: adds the ``--version`` option.
    :param create_app: an optional callback that is passed the script info and
        returns the loaded app.
    :param load_dotenv: Load the nearest :file:`.env` and :file:`.flaskenv`
        files to set environment variables. Will also change the working
        directory to the directory containing the first file found.
    :param set_debug_flag: Set the app's debug flag based on the active
        environment

    .. versionchanged:: 1.0
        If installed, python-dotenv will be used to load environment variables
        from :file:`.env` and :file:`.flaskenv` files.
    c                 Z   t        |j                  dd       xs d      }|r|j                  t               t	        j
                  | fd|i| || _        || _        || _        |r?| j                  t               | j                  t               | j                  t               d| _        y )Nparamsr   F)listr   r<   version_optionr   rd   r   load_dotenvr   add_commandrun_commandshell_commandroutes_command_loaded_plugin_commands)r   add_default_commandsr   add_version_optionr   r   extrar   s           r   rd   zFlaskGroup.__init__  s     eii$/526MM.)$7v77$&,[)]+^,',$r   c                     | j                   ry 	 dd l}|j                  d      D ],  }| j	                  |j                         |j                         . d| _         y # t        $ r
 d| _         Y y w xY w)Nr   Tzflask.commands)r   pkg_resourcesrv   iter_entry_pointsr   loadr_   )r   r   eps      r   _load_plugin_commandsz FlaskGroup._load_plugin_commands  sq    ''	 
  112BC 	1BRWWY0	1'+$  	+/D(	s   A A.-A.c                 L   | j                          t        | 	  ||      }||S |j                  t              }	 |j                         j                  j                  ||      S # t        $ r4}t        j                  d|j                          ddd       Y d }~y d }~ww xY wNzError: 
Tred)errfg)r   superget_commandr   r   r   clir   r   sechoformat_message)r   r   r_   r   infoe	__class__s         r   r   zFlaskGroup.get_command  s    ""$ W d+>I  ,	N==?&&223== 	NKK'!"2"2"4!5R8duMM	Ns   )A& &	B#/*BB#c                    | j                          t        t        |   |            }|j	                  t
              }	 |j                  |j                         j                  j                  |             t!        |      S # t        $ r>}t        j                  d|j                          ddd       Y d }~t!        |      S d }~wt        $ r: t        j                  t        j                          ddd       Y t!        |      S w xY wr   )r   setr   list_commandsr   r   updater   r   r   r   r   r   r   rw   rx   sorted)r   r   r   r   r   r   s        r   r   zFlaskGroup.list_commands,  s    ""$&s+,  ,		KIIdmmo))77<= bz  	N KK'!"2"2"4!5R8duMM bz  	K KK9//12"54EJbz	Ks    8B 	D*C9D
Dc                    dt         j                  d<   t        | j                        r
t                |j	                  d      }|!t        | j                  | j                        }||d<   |j                  dd       t        | (  |i |S )Nr   FLASK_RUN_FROM_CLIobj)r   r   auto_envvar_prefixFLASK)rf   r   r   r   r   r   r   r   r   r   main)r   r=   r>   r   r   s       r   r   zFlaskGroup.mainA  s    
 ,2

'(4++,Mjj;??4;N;NC u.8w|T,V,,r   )TNTTT)
r   r   r   r   rd   r   r   r   r   __classcell__r   s   @r   r   r     s8    0 "-4,N$*- -r   r   c                     t         j                  j                  | |t        |       d j	                  t         j
                              |k(  S )zTake ``other`` and remove the length of ``path`` from it. Then join it
    to ``path``. If it is the original value, ``path`` is an ancestor of
    ``other``.N)rf   rg   rn   r$   lstripsep)rg   others     r   _path_is_ancestorr  W  s8     77<<eCIK077?@EIIr   c                    t         Y| s>t        j                  j                  d      st        j                  j                  d      rt	        j
                  ddd       y| 7t        j                  j                  |       rt        j                  | d	
      S yd}dD ]T  }t        j                  |d      } | s|t        j                  j                  |       }t        j                  | d	
       V |duS )a  Load "dotenv" files in order of precedence to set environment variables.

    If an env var is already set it is not overwritten, so earlier files in the
    list are preferred over later files.

    This is a no-op if `python-dotenv`_ is not installed.

    .. _python-dotenv: https://github.com/theskumar/python-dotenv#readme

    :param path: Load the file at this location instead of searching.
    :return: ``True`` if a file was loaded.

    .. versionchanged:: 1.1.0
        Returns ``False`` when python-dotenv is not installed, or when
        the given path isn't a file.

    .. versionchanged:: 2.0
        When loading the env files, set the default encoding to UTF-8.

    .. versionadded:: 1.0
    N.env	.flaskenvz^ * Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them.yellowT)r   r   Fzutf-8)encoding)r  r	  )usecwd)	dotenvrf   rg   isfiler   r   r   find_dotenvrk   )rg   new_dirr_   s      r   r   r   ^  s    , ~277>>&)RWW^^K-HKK?	  77>>$%%dW==G% 	3!!$t4?ggood+G4'2	3 $r   c                 d   t         j                  j                  d      dk(  ry|!d|}|s|dz  }t        j                  |       t        j                  d|         | dk(  r.t        j
                  dd	
       t        j
                  dd       |t        j                  d|rdnd        yy)z]Show extra startup messages the first time the server is run,
    ignoring the reloader.
    r   r   Nz * Serving Flask app z (lazy loading)z * Environment: 
productionzS   WARNING: This is a development server. Do not use it in a production deployment.r   )r   z(   Use a production WSGI server instead.T)dimz * Debug mode: onoff)rf   r   r   r   r   r   )envr   r   eager_loadingmessages        r   show_server_bannerr    s     
zz~~)*f4")/)<=((G

7	JJ!#'(
l(	

 	>DI

_UT$>?@ r   c                        e Zd ZdZdZd Zd Zy)CertParamTypezClick option type for the ``--cert`` option. Allows either an
    existing file, the string ``'adhoc'``, or an import for a
    :class:`~ssl.SSLContext` object.
    rg   c                 >    t        j                  ddd      | _        y )NTFrm   dir_okayresolve_path)r   Path	path_type)r   s    r   rd   zCertParamType.__init__  s    4%dSr   c                    t         t        j                  d||      	 | j                  |||      S # t        j                  $ r t        j                  |||      j                         }|dk(  r.	 dd l}n$# t        $ r t        j                  d||      w xY w|cY S t        |d      }t        |t         j                        r|cY S  w xY w)Nz?Using "--cert" requires Python to be compiled with SSL support.adhocr   z<Using ad-hoc certificates requires the cryptography library.T)silent)sslr   BadParameterr!  STRINGlowercryptographyrv   r   r!   
SSLContext)r   rZ   r   r   r)  r   s         r   convertzCertParamType.convert  s    ;$$Q 	>>%44!! 	LLs399;E'" ,,V  d3C#s~~.
)	s-   2 =C
0A54C
5!BC
)C
C
N)r   r   r   r   r_   rd   r+  r   r   r   r  r    s    
 DTr   r  c                    | j                   j                  d      }|dk(  }t        xr t        |t        j                        }|^|rt        j                  d| |      |rt        j                  d| |      |st        j                  d| |      ||f| j                   d<   |S |r|s|st        j                  d| |      |S )zThe ``--key`` option must be specified when ``--cert`` is a file.
    Modifies the ``cert`` param to be a ``(cert, key)`` pair if needed.
    certr#  z.When "--cert" is "adhoc", "--key" is not used.z:When "--cert" is an SSLContext object, "--key is not used.z "--cert" must also be specified.zRequired when using "--cert".)r   r   r%  r!   r*  r   r&  )r   r   rZ   r-  is_adhoc
is_contexts         r   _validate_keyr0    s     ::>>&!DwH9D#..9J$$@#u  $$LcSX  $$%GeTT!5[

6 L Z$$%Dc5QQLr   c                   "     e Zd ZdZ fdZ xZS )SeparatedPathTypezClick option type that accepts a list of values separated by the
    OS's path separator (``:``, ``;`` on Windows). Each value is
    validated as a :class:`click.Path` type.
    c                 t    | j                  |      }t        |   }|D cg c]  } ||||       c}S c c}w r   )split_envvar_valuer   r+  )r   rZ   r   r   itemssuper_convertitemr   s          r   r+  zSeparatedPathType.convert  s9    ''.<ABDdE3/BBBs   5)r   r   r   r   r+  r   r  s   @r   r2  r2    s    
C Cr   r2  runzRun a development server.)
short_helpz--hostz-hz	127.0.0.1zThe interface to bind to.)r9   r   z--portz-pi  zThe port to bind to.z--certz(Specify a certificate file to use HTTPS.)typer   z--keyr  z2The key file to use when specifying a certificate.)r:  r   r   r   z--reload/--no-reloadzVEnable or disable the reloader. By default the reloader is active if debug is enabled.z--debugger/--no-debuggerzVEnable or disable the debugger. By default the debugger is active if debug is enabled.z--eager-loading/--lazy-loadingzaEnable or disable eager loading. By default eager loading is enabled if the reloader is disabled.z --with-threads/--without-threadsz!Enable or disable multithreading.z--extra-fileszMExtra files that trigger a reload on change. Multiple paths are separated by rM   )r9   r:  r   c	           
          t               }	||	}||	}t        t               |	| j                  |       t	        | j
                  |      }
ddlm}  ||||
|||||       y)a  Run a local development server.

    This server is for development purposes only. It does not provide
    the stability, security, or performance of production WSGI servers.

    The reloader and debugger are enabled by default if
    FLASK_ENV=development or FLASK_DEBUG=1.
    N)r   r   )
run_simple)use_reloaderuse_debuggerthreadedssl_contextextra_files)r
   r  r   r   r   r   werkzeug.servingr<  )r   hostportreloaddebuggerr  with_threadsr-  rA  r   r   r<  s               r   r   r     sk    r E~wy%)=)=}M
-
HC+	r   shellzRun a shell in the app context.returnc            
         ddl } ddlm} |j                  j                  }dt
        j                   dt
        j                   d|j                   d|j                   d	|j                   
}i }t        j                  j                  d
      }|rXt        j                  j                  |      r9t!        |      5 }t#        t%        |j'                         |d      |       ddd       |j)                  |j+                                t-        t
        dd      }|3	 ddl}ddlm}	 |j5                   |	|      j6                          |        | j;                  ||       y# 1 sw Y   xY w# t8        $ r Y 2w xY w)a:  Run an interactive Python shell in the context of a given
    Flask application.  The application will populate the default
    namespace of this shell according to its configuration.

    This is useful for executing small snippets of management code
    without having to manually configure the application.
    r   Nr   )_app_ctx_stackr   z on z
App: z [z]
Instance: PYTHONSTARTUPexec__interactivehook__)	Completer)bannerlocal)codeglobalsrK  topr   rB   versionr   r   r  instance_pathrf   r   r   rg   r  openrK   compilereadr   make_shell_contextr    readlinerlcompleterrO  set_completercompleterv   interact)
rR  rK  r   rP  r   startuprH   interactive_hookr[  rO  s
             r   r   r   ]  sE    '



 
 C
#++d3<<. 1 377) ,&&'	) 
 C jjnn_-G277>>'*'] 	:a7F3S9	: JJs%%'(
 s$94@#	<- ""9S>#:#:;MMsM+/	: 	:  		s   9&E 
E,  E),	E87E8routeszShow the routes for the app.z--sortz-s)endpointmethodsrulematchrc  zgMethod to sort routes by. "match" is the order that Flask will match routes when dispatching a request.)r:  r9   r   z--all-methodszShow HEAD and OPTIONS methods.)r   r   sortall_methodsc           	         t        t        j                  j                               }|st	        j
                  d       yt        |rdnd      }| dv rt        |t        |             }n| dk(  rt        |d       }|D cg c])  }d	j                  t        |j                  |z
              + }}d
}t        d |D              t        d |D              t        d |D              f}t        ||      D 	cg c]  \  }}	t        t        |      |	       }}}	 dj                  | }
t	        j
                   |
j                  | j                                t	        j
                   |
j                  d |D                t        ||      D ]M  \  }}t	        j
                  |
j                  |j                   ||j"                        j%                                O yc c}w c c}	}w )z6Show all registered routes with endpoints and methods.zNo routes were registered.Nr   )HEADOPTIONS)rc  re  )keyrd  c                 ,    t        | j                        S r   )r   rd  )re  s    r   <lambda>z routes_command.<locals>.<lambda>  s    vdll/C r   z, )EndpointMethodsRulec              3   F   K   | ]  }t        |j                          y wr   )r$   rc  .0re  s     r   	<genexpr>z!routes_command.<locals>.<genexpr>  s     14C1   !c              3   2   K   | ]  }t        |        y wr   )r$   )rt  rd  s     r   ru  z!routes_command.<locals>.<genexpr>  s     5WCL5s   c              3   F   K   | ]  }t        |j                          y wr   )r$   re  rs  s     r   ru  z!routes_command.<locals>.<genexpr>  s     -tC		N-rv  z"{{0:<{0}}}  {{1:<{1}}}  {{2:<{2}}}c              3   &   K   | ]	  }d |z    yw)-Nr   )rt  widths     r   ru  z!routes_command.<locals>.<genexpr>  s     <EC%K<s   )r   r	   url_map
iter_rulesr   r   r   r   r   rn   rd  maxzipr$   formatrP   rc  re  rstrip)rg  rh  rulesignored_methodsre  rule_methodsheaderswidthshwrowrd  s               r   r   r     s     $$//12E

/0"1DEO##u*T"23		u"CD  			&789L 
 .G1511555-u--F
 *-Wf)=>Ac#a&!n>F>
5
.
5
5v
>C	JJzszz7#))+,	JJzszz<V<=>UL1 Kg

3::dmmWdii@GGIJK# ?s   .G7G#a  A general utility script for Flask applications.

Provides commands from Flask, extensions, and the application. Loads the
application defined in the FLASK_APP environment variable, or from a wsgi.py
file. Setting the FLASK_ENV environment variable to 'development' will enable
debug mode.


  {prefix}{cmd} FLASK_APP=hello.py
  {prefix}{cmd} FLASK_ENV=development
  {prefix}flask run
posixexportr   z$ z> )cmdprefix)r   c                      t        t        j                  d         dk  rt        j                  dt
               t        j                  t        j                  dd         y )Nr      zUsing the `flask` cli with Click 7 is deprecated and will not be supported starting with Flask 2.1. Please upgrade to Click 8 as soon as possible.r   )r=   )
intr   r~   r4   r5   r6   r   r   rB   argvr   r   r   r   r     sJ    
5Q 1$> 		
 HH#((12,Hr   __main__)NN)Tr   )rI  N)ErN   r%   rf   r   r   rB   rw   r4   	functoolsr   operatorr   	threadingr   r   r   werkzeug.utilsr   rS  r	   helpersr
   r   r   r  rv   r%  
UsageErrorr   r0   r'   r)   rb   rs   r|   r   Optionr   r   r   make_pass_decoratorpass_script_infor   r   r   r   r  r   r  	ParamTyper  r0  r   r2  r   optionrg   pathsepr   r   Choicestrboolr   r  r_   r   r   r   r   r   r   <module>r     s   
  	  	 
   $     (   #  $
>U%% >1h(B4HV':A4  M	!8/ 8/v= =@ -5,,ZE (8u{{ 8>x- x-vJ6rA:)EOO )X>	C

 	C u!<=hk8SThd1GH=?)S 	4%d	C	= 
% 
% $
6 &	,
 			WW__/q	2 !  I U >\!H w#DE.,  F.,b x$BC	>	?	-	 ot2RS!K !K4 !KD !K  T	 D!KH 
 F7*Hww')tt  (	  zF S  F
  
Cs$   L3 !M 3L>=L>MM