Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/flask/__pycache__/app.cpython-39.pyc
Ðазад
a p�h � @ s� d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z ddl mZ ddlm Z ddlmZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm 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+ dd l)m,Z, dd!l-m.Z. dd"l-m/Z/ dd#l-m0Z0 dd$l-m1Z1 dd%l2m3Z3 dd&l2m4Z4 dd'l2m5Z5 dd(l2m6Z6 dd)l2m7Z7 dd*l2m8Z8 dd+l2m9Z9 dd,l2m:Z: dd-l2m;Z; dd.l m<Z< dd/l=m>Z> dd0l?m@Z@ dd1lAmBZB dd2lAmCZC dd3lAmDZD dd4lAmEZE dd5lAmFZF dd6lGmHZH dd7lGmIZI dd8lGmJZJ dd9lKmLZL dd:lKmMZM eN� ZOd;d<� ZPd=d>� ZQG d?d@� d@e4�ZRdS )Az� flask.app ~~~~~~~~~ This module implements the central WSGI application object. :copyright: 2010 Pallets :license: BSD-3-Clause � N)� timedelta��update_wrapper)�chain)�Lock)�Headers)� ImmutableDict)� BadRequest)�BadRequestKeyError)�default_exceptions)� HTTPException)�InternalServerError)�MethodNotAllowed)� BuildError)�Map)�RequestRedirect)�RoutingException)�Rule)�BaseResponse� )�cli)�json)� integer_types)�reraise)�string_types)� text_type)�Config)�ConfigAttribute)�_AppCtxGlobals�� AppContext��RequestContext)�_request_ctx_stack)�g)�request)�session)�_endpoint_from_view_func)�_PackageBoundObject)�find_package)�get_debug_flag)�get_env)�get_flashed_messages)�get_load_dotenv)�locked_cached_property)�url_for)�jsonify�� create_logger)�SecureCookieSessionInterface)�appcontext_tearing_down)�got_request_exception)�request_finished)�request_started)�request_tearing_down)�_default_template_ctx_processor��DispatchingJinjaLoader)�Environment)�Request)�Responsec C s t | t�st| d�S | S )N)�seconds)� isinstancer )�value� rB �y/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/flask/app.py�_make_timedeltaL s rD c s � fdd�}t |� �S )zkWraps a method so that it performs a check in debug mode if the first request was already handled. c s* | j r| jrtd��� | g|�R i |��S )Nam A setup function was called after the first request was handled. This usually indicates a bug in the application where a module was not imported and decorators or other functionality was called too late. To fix this make sure to import all your view modules, database models and everything related at a central place before the application starts serving requests.)�debug�_got_first_request�AssertionError)�self�args�kwargs��frB rC �wrapper_funcW s � z!setupmethod.<locals>.wrapper_funcr )rL rM rB rK rC �setupmethodR s rN c @ s� e Zd ZdZeZeZeZ e ZeZ ed�Zed�Zed�Zeded�Zeded�Zed�ZejZejZd d dgiZeddd dddedd�d ddddddd dddedd�dd d dddd dddd��ZeZ e!Z"dZ#dZ$e%� Z&dZ'dZ(dZ)d�dd�Z*e+dd� �Z,e-dd � �Z.e-d!d"� �Z/e+d#d$� �Z0e+d%d&� �Z1e-d'd(� �Z2d�d)d*�Z3d+d,� Z4d�d.d/�Z5e-d0d1� �Z6e6j7d2d1� �Z6d3d4� Z8d5d6� Z9d7d8� Z:d9d:� Z;d;d<� Z<ed=�Z=e-d>d?� �Z>e>j7d@d?� �Z>d�dAdB�Z?d�dCdD�Z@dEdF� ZAdGdH� ZBdIdJ� ZCdKdL� ZDeEdMdN� �ZFdOdP� ZGeEd�dQdR��ZHdSdT� ZIeEdUdV� �ZJeKdWdX� �ZLeEdYdZ� �ZMeEd[d\� �ZNeEd]d^� �ZOeEd�d_d`��ZPeEd�dadb��ZQeEd�dcdd��ZReEd�dedf��ZSeEd�dgdh��ZTeEd�didj��ZUeEdkdl� �ZVeEdmdn� �ZWeEdodp� �ZXeEdqdr� �ZYeEdsdt� �ZZeEdudv� �Z[eEdwdx� �Z\eEdydz� �Z]eEd{d|� �Z^d}d~� Z_dd�� Z`d�d�� Zad�d�� Zbd�d�� Zcd�d�� Zdd�d�� Zed�d�� Zfd�d�� Zgd�d�d��Zhd�d�� Zid�d�� Zjd�d�� Zkd�d�� Zld�d�� Zmd�d�� Znd�d�� Zod�d�� Zpd�d�� Zqerfd�d��Zserfd�d��Ztd�d�� Zud�d�� Zvd�d�� Zwd�d�� Zxd�d�� Zyd�d�� ZzdS )��Flaskag 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: Flask by default will automatically calculate the path to the root of the application. In certain situations this cannot be achieved (for instance if the package is a Python 3 namespace package) and needs to be manually defined. �TESTING� SECRET_KEY�SESSION_COOKIE_NAME�PERMANENT_SESSION_LIFETIME)Z get_converter�SEND_FILE_MAX_AGE_DEFAULT�USE_X_SENDFILE� extensionszjinja2.ext.autoescapezjinja2.ext.with_NF� )�days�/r&