Sindbad~EG File Manager
�
(ٜg� � � � d dl mZ d dlZd dlmZ d dlZd dlZd dl Z d dl
Z
d dlZd dlZd dl
Z
d dlZd dlmZ d dlmZ d dlmZ d dlZd dlmZ d dlmZ d dlmZ d d lmZ d
dlm Z d
dl!m"Z" d
d
l!m#Z# ejH rd dl%Z%d dl&m'Z' d dl&m(Z( d dl&m)Z) d
dl*m+Z+ G d� dejX � Z-dxd�Z.dyd�Z/dzd�Z0d{d�Z1ejd d| d}d�� Z3ejd d~ dd�� Z3 d| d�d�Z3d�d�Z4 ejj dgdd e4dd�!� Z6 G d"� d#� Z7 ejp e7d�$� Z9 ejt d%ejv dejx f �&� Z=d�d'�Z> G d(� d)ej~ � Z@d�d*�ZA ejj d+d,gd-d.dd eA�/� ZBd�d0�ZC ejj d1gd2d eC�3� ZD d�d4�ZE ejj d5d6g ej� dd �7� d8dd eE�9� ZG G d:� d;e@� ZHd�d<�ZI d� d�d=�ZJd�d>�ZK G d?� d@ej� � ZMd�dA�ZN G dB� dCej� � ZO ej� dDdE�F� ej� dGdHdIdJ�K� ej� dLdMdNdO�K� ej� dP eM� dQd�R� ej� dS ej� dd d�T� eNd dU�V� ej� dWddX�K� ej� dYddZ�K� ej� d[dd\�K� ej� d]d eO� d^e j� j� �d_��`� ej� dad eO� dbe j� j� �d_��`� e9 d�dc�� � � � � � � � � � � ZTeTj� j� d eD� ej� ddde�F� e>d�df�� � ZW ej� dgdh�F� ej� didj ej� dk� dldm�n� ej� doddp�q� e>d�dr�� � � � ZY eHdsdt�u� ZZd�dv�Z[e\dwk( r e[� yy)�� )�annotationsN)�update_wrapper)�
itemgetter)�
ModuleType)�ParameterSource)�
run_simple)�is_running_from_reloader)�
import_string� )�current_app)�get_debug_flag)�get_load_dotenv)�
StartResponse)�WSGIApplication)�WSGIEnvironment��Flaskc � � e Zd ZdZy)�NoAppExceptionz3Raised if an application cannot be found or loaded.N)�__name__�
__module__�__qualname__�__doc__� � �4/usr/local/lib/python3.12/site-packages/flask/cli.pyr r % s � �=r r c
� � ddl m} dD ] }t | |d� }t ||� s�|c S | j j � D �cg c] }t ||� s�|�� }}t
|� dk( r|d S t
|� dkD r&t d| j � d| j � d�� �d D ]= }t | |d� }t j |� s�& |� }t ||� r|c S �? t d| j � d| j � d�� �c c}w # t $ r>}t |� s� t d
|� d| j � d| j � d
|� d� � |�d}~ww xY w)zwGiven a module instance this tries to find the best possible
application in the module or raises an exception.
r r )�app�applicationNr z0Detected multiple Flask applications in module 'z'. Use 'z":name' to specify the correct one.)�
create_app�make_appzDetected factory 'z
' in module 'z1', but could not call it without arguments. Use '�:z(args)' to specify arguments.z7Failed to find Flask application or factory in module 'z:name' to specify one.)
� r �getattr�
isinstance�__dict__�values�lenr r �inspect�
isfunction� TypeError�_called_with_wrong_args)�moduler � attr_namer �v�matches�app_factory�es r �
find_best_appr3 ) s� � � � ,� ��f�i��.���c�5�!��J� ,� !�/�/�0�0�2�K�2�Q�j��E�6J�q�2�G�K�
�7�|�q���q�z�� �W��� ��
����!��&�/�/�):� ;+�
+�
�
� 0� ��f�i��6�����k�*�
�!�m���c�5�)��J� *� 0�( �
�
�_�_��X�f�o�o�%6� 7� �� ��A L��* �
�.�{�;��$�(���=����@Q� R����)��9�+� 6-�-��
���
�s$ �D�D�D� E�9E�Ec � � t j � d } |�4|j j | j u r ~y|j
}|��4 ~y# ~w xY w)z�Check 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, ^ s\ � �
����� �B�
��n��{�{�!�!�Q�Z�Z�/��
� ���B� �n� �
��B�s �$A � A �Ac � � ddl m} t j |j � d�� j
}t |t j � r|j }g }i }n�t |t j � r�t |j t j � st d|�d �� �|j j } |j D �cg c] }t j |� �� }}|j D �ci c]8 }|j �*|j t j |j"