Sindbad~EG File Manager
3
Ĝg7@ � @ s� d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlm Z d dl
mZ d dlm
Z
d dlmZ d dlmZ d dlmZ d dlmZ d d lmZ d d
lmZ d dlmZ d dlmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm Z d dl!m"Z# ddl$m%Z% ddl$m&Z& ddl'm(Z( ddl'm)Z) ddl*m+Z+ ddl*m,Z, ddl*m-Z- ddl.m/Z/ ddl.m0Z0 ddl.m1Z1 ddl.m2Z2 dd l3m4Z4 dd!l3m5Z5 dd"l3m6Z6 dd#l3m7Z7 dd$l3m8Z8 dd%l3m9Z9 dd&l3m:Z: dd'l&m;Z; dd(lm<Z< dd)l=m>Z> dd*l=m?Z? dd+l=m@Z@ dd,l=mAZA dd-l=mBZB dd.lCmDZD dd/lEmFZF dd0lEmGZG dd1lEmHZH dd2lEmIZI dd3lEmJZJ dd4lKmLZL dd5lKmMZM dd6lmNZN dd7lmOZO dd8lmPZP dd9lmQZQ dd:lmRZR dd;lmSZS dd<lTmUZU ddlTm"Z" ejV�r<d dlWZXdd=lYmZZZ dd>l[m\Z\ dd?l[m]Z] dd@lm^Z^ ej_dKk�rPej`Z`nejaebdC�dDdE�Z`ejce ejce dF�dGdH�ZdG dIdJ� dJeA�ZedS )L� N)� timedelta)�chain)�Lock)�
TracebackType)�Headers)�
ImmutableDict)�
BadRequest)�BadRequestKeyError)�
HTTPException)�InternalServerError)�
ContextVar)�
BuildError)�Map)�
MapAdapter)�RequestRedirect)�RoutingException)�Rule)�Response� )�cli)�json)�Config)�ConfigAttribute)�_AppCtxGlobals)�
AppContext)�RequestContext)�_request_ctx_stack)�g)�request)�session)�_split_blueprint_path)�get_debug_flag)�get_env)�get_flashed_messages)�get_load_dotenv)�locked_cached_property)�url_for)�jsonify)�
create_logger)�_endpoint_from_view_func)� _sentinel)�find_package)�Scaffold)�setupmethod)�SecureCookieSessionInterface)�appcontext_tearing_down)�got_request_exception)�request_finished)�request_started)�request_tearing_down)�DispatchingJinjaLoader)�Environment)�BeforeFirstRequestCallable)�ResponseReturnValue)�TeardownCallable)�TemplateFilterCallable)�TemplateGlobalCallable)�TemplateTestCallable)�Request)� Blueprint)�FlaskClient)�FlaskCliRunner)�ErrorHandlerCallable� � )�func�returnc C s8 xt j| �r| j} qW xt| tj�r,| j} qW t j| �S )N)�inspect�ismethod�__func__�
isinstance� functools�partialrC �iscoroutinefunction)rC � rL �*/tmp/pip-build-fsllo_ck/Flask/flask/app.pyrK Q s
rK )�valuerD c C s | d kst | t�r| S t| d�S )N)�seconds)rH r )rN rL rL rM �_make_timedelta[ s rP c s� e Zd ZU dZeZeZeZ e
ZeZ
ed�Zed�Zed�Zeded�Zeded�Zed�ZejZejZi Zeed d d
d d d edd�d
d d
dd d dd
d dd d d d
d
dddd
dd dd��Ze Z!e"Z#d Z$e%j&e%j'd $d Z(e%j&e%j'd (e)� Z*d�e+e%j&e+ e%j&e%j,e+e-j.f e%j&e+ e/e/e%j&e+ e%j&e+ e/e%j&e+ d�
� fdd�
Z0e/d�dd�Z1e2e+d�dd��Z3e4e/d�d d!��Z5e4e/d�d"d#��Z6e2e7j8d�d$d%��Z9e2ed�d&d'��Z:e4e/d�d(d)��Z;d�e/ed*�d+d,�Z<e+d�d-d.�Z=d�e+e+e%j>e%j? d0�d1d2�Z@e4e/d�d3d4��ZAeAjBe/d d5�d6d4��ZAed�d7d8�ZCeDd�d9d:�ZEe+e/d;�d<d=�ZFed d>�d?d@�ZGed�dAdB�ZHedC�ZIe4e/d�dDdE��ZJeJjBe/d d5�dFdE��ZJd�e%j&e+ e%j&eK e%j&e/ e/e%jLd dG�dHdI�ZMd�e/e%jLddJ�dKdL�ZNe%jLddM�dNdO�ZOePdPe%jLd dQ�dRdS��ZQe%jRdP d�dTdU�ZSePd�e+e%j&e+ e%j&e%jT e%j&e/ e%jLd dV�dWdX��ZUePd�e%j&e+ e%jTeVgeVf dY�dZd[��ZWePd�eVe%j&e+ d d\�d]d^��ZXePd�e%j&e+ e%jTeYgeYf dY�d_d`��ZZePd�eYe%j&e+ d d\�dadb��Z[ePd�e%j&e+ e%jTe\ge\f dY�dcdd��Z]ePd�e\e%j&e+ d d\�dedf��Z^ePe_e_dg�dhdi��Z`ePeaeadg�djdk��ZbePe%jTe%jTdg�dldm��Zcede%j&dn do�dpdq�Zeefe%j,efegf do�drds�Zhede/do�dtdu�Ziede%j,efegf do�dvdw�Zjededo�dxdy�Zke%j,e%jlemeneof e%jld� f d dz�d{d|�Zped}d~�dd��Zqegd�d�d��Zred�d�d��Zsd�e%j,egeff e/ed��d�d��Ztd d�d�d��Zued�d�d��Zve%j&en e/d��d�d��Zwe%jTe%jTd��d�d��Zxe%jTd�e%jyf e%jTd�e%jLf d��d�d��Zzeged��d�d��Z{e%j&e e%j&e| d~�d�d��Z}e+ed d��d�d��Z~ede+ee+d��d�d��Ze%j&eg d�d�d��Z�eed��d�d��Z�e�fe%j&en d d��d�d��Z�e�fe%j&en d d��d�d��Z�e�d�d�d��Z�ee�d��d�d��Z�e%jLe%jLe�d��d�d��Z�ee%jTe%jLd��d�d��Z�ee%jTe%jLd��d�d��Z�� Z�S )��Flaska� The flask object implements a WSGI application and acts as the central
object. It is passed the name of the module or package of the
application. Once it is created it will act as a central registry for
the view functions, the URL rules, template configuration and much more.
The name of the package is used to resolve resources from inside the
package or the folder the module is contained in depending on if the
package parameter resolves to an actual python package (a folder with
an :file:`__init__.py` file inside) or a standard module (just a ``.py`` file).
For more information about resource loading, see :func:`open_resource`.
Usually you create a :class:`Flask` instance in your main module or
in the :file:`__init__.py` file of your package like this::
from flask import Flask
app = Flask(__name__)
.. admonition:: About the First Parameter
The idea of the first parameter is to give Flask an idea of what
belongs to your application. This name is used to find resources
on the filesystem, can be used by extensions to improve debugging
information and a lot more.
So it's important what you provide there. If you are using a single
module, `__name__` is always the correct value. If you however are
using a package, it's usually recommended to hardcode the name of
your package there.
For example if your application is defined in :file:`yourapplication/app.py`
you should create it with one of the two versions below::
app = Flask('yourapplication')
app = Flask(__name__.split('.')[0])
Why is that? The application will work even with `__name__`, thanks
to how resources are looked up. However it will make debugging more
painful. Certain extensions can make assumptions based on the
import name of your application. For example the Flask-SQLAlchemy
extension will look for the code in your application that triggered
an SQL query in debug mode. If the import name is not properly set
up, that debugging information is lost. (For example it would only
pick up SQL queries in `yourapplication.app` and not
`yourapplication.views.frontend`)
.. versionadded:: 0.7
The `static_url_path`, `static_folder`, and `template_folder`
parameters were added.
.. versionadded:: 0.8
The `instance_path` and `instance_relative_config` parameters were
added.
.. versionadded:: 0.11
The `root_path` parameter was added.
.. versionadded:: 1.0
The ``host_matching`` and ``static_host`` parameters were added.
.. versionadded:: 1.0
The ``subdomain_matching`` parameter was added. Subdomain
matching needs to be enabled manually now. Setting
:data:`SERVER_NAME` does not implicitly enable it.
:param import_name: the name of the application package
:param static_url_path: can be used to specify a different path for the
static files on the web. Defaults to the name
of the `static_folder` folder.
:param static_folder: The folder with static files that is served at
``static_url_path``. Relative to the application ``root_path``
or an absolute path. Defaults to ``'static'``.
:param static_host: the host to use when adding the static route.
Defaults to None. Required when using ``host_matching=True``
with a ``static_folder`` configured.
:param host_matching: set ``url_map.host_matching`` attribute.
Defaults to False.
:param subdomain_matching: consider the subdomain relative to
:data:`SERVER_NAME` when matching routes. Defaults to False.
:param template_folder: the folder that contains the templates that should
be used by the application. Defaults to
``'templates'`` folder in the root path of the
application.
:param instance_path: An alternative instance path for the application.
By default the folder ``'instance'`` next to the
package or module is assumed to be the instance
path.
:param instance_relative_config: if set to ``True`` relative filenames
for loading the config are assumed to
be relative to the instance path instead
of the application root.
:param root_path: The path to the root of the application files.
This should only be set manually when it can't be detected
automatically, such as for namespace packages.
�TESTING�
SECRET_KEY�SESSION_COOKIE_NAME�PERMANENT_SESSION_LIFETIME)Z
get_converter�SEND_FILE_MAX_AGE_DEFAULT�USE_X_SENDFILENF� )�days�/r T�httpzapplication/jsoni� )�ENV�DEBUGrR �PROPAGATE_EXCEPTIONS�PRESERVE_CONTEXT_ON_EXCEPTIONrS rU rW �SERVER_NAME�APPLICATION_ROOTrT ZSESSION_COOKIE_DOMAINZSESSION_COOKIE_PATHZSESSION_COOKIE_HTTPONLYZSESSION_COOKIE_SECUREZSESSION_COOKIE_SAMESITEZSESSION_REFRESH_EACH_REQUESTZMAX_CONTENT_LENGTHrV �TRAP_BAD_REQUEST_ERRORS�TRAP_HTTP_EXCEPTIONSZEXPLAIN_TEMPLATE_LOADING�PREFERRED_URL_SCHEMEZ
JSON_AS_ASCIIZJSON_SORT_KEYSZJSONIFY_PRETTYPRINT_REGULARZJSONIFY_MIMETYPE�TEMPLATES_AUTO_RELOADZMAX_COOKIE_SIZEr>