o
    àý°j½  ã                   @  s–   d dl m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mZ dd	lmZ dd
lmZ ejrAddlmZ G dd„ deƒZdS )é    )ÚannotationsN)Ú	timedeltaé   )ÚAppGroup)Úcurrent_app)Úsend_from_directory)Ú	Blueprint)ÚBlueprintSetupState)Ú	_sentinel)ÚResponsec                      sR   e Zd Zdddddddefd#‡ fdd„Zd$dd„Zd%dd„Z	d&d'd!d"„Z‡  ZS )(r   NÚnameÚstrÚimport_nameÚstatic_folderústr | os.PathLike[str] | NoneÚstatic_url_pathú
str | NoneÚtemplate_folderÚ
url_prefixÚ	subdomainÚurl_defaultsúdict[str, t.Any] | NoneÚ	root_pathÚ	cli_groupÚreturnÚNonec                   s4   t ƒ  |||||||||	|
¡
 tƒ | _| j| j_d S )N)ÚsuperÚ__init__r   Úclir   )Úselfr   r   r   r   r   r   r   r   r   r   ©Ú	__class__© úƒ/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/flask/blueprints.pyr      s   özBlueprint.__init__Úfilenameú
int | Nonec                 C  s0   t jd }|du rdS t|tƒrt| ¡ ƒS |S )an  Used by :func:`send_file` to determine the ``max_age`` cache
        value for a given file path if it wasn't passed.

        By default, this returns :data:`SEND_FILE_MAX_AGE_DEFAULT` from
        the configuration of :data:`~flask.current_app`. This defaults
        to ``None``, which tells the browser to use conditional requests
        instead of a timed cache, which is usually preferable.

        Note this is a duplicate of the same method in the Flask
        class.

        .. versionchanged:: 2.0
            The default configuration is ``None`` instead of 12 hours.

        .. versionadded:: 0.9
        ÚSEND_FILE_MAX_AGE_DEFAULTN)r   ÚconfigÚ
isinstancer   ÚintÚtotal_seconds)r   r$   Úvaluer"   r"   r#   Úget_send_file_max_age7   s   

zBlueprint.get_send_file_max_ager   c                 C  s0   | j stdƒ‚|  |¡}tt t| j¡||d�S )aA  The view function used to serve files from
        :attr:`static_folder`. A route is automatically registered for
        this view at :attr:`static_url_path` if :attr:`static_folder` is
        set.

        Note this is a duplicate of the same method in the Flask
        class.

        .. versionadded:: 0.5

        z2'static_folder' must be set to serve static_files.)Úmax_age)Úhas_static_folderÚRuntimeErrorr,   r   ÚtÚcastr   r   )r   r$   r-   r"   r"   r#   Úsend_static_fileR   s   
ÿzBlueprint.send_static_fileÚrbúutf-8ÚresourceÚmodeÚencodingút.IO[t.AnyStr]c                 C  s@   |dvrt dƒ‚tj | j|¡}|dkrt||ƒS t|||d�S )ae  Open a resource file relative to :attr:`root_path` for reading. The
        blueprint-relative equivalent of the app's :meth:`~.Flask.open_resource`
        method.

        :param resource: Path to the resource relative to :attr:`root_path`.
        :param mode: Open the file in this mode. Only reading is supported,
            valid values are ``"r"`` (or ``"rt"``) and ``"rb"``.
        :param encoding: Open the file with this encoding when opening in text
            mode. This is ignored when opening in binary mode.

        .. versionchanged:: 3.1
            Added the ``encoding`` parameter.
        >   Úrr3   Úrtz)Resources can only be opened for reading.r3   )r7   )Ú
ValueErrorÚosÚpathÚjoinr   Úopen)r   r5   r6   r7   r=   r"   r"   r#   Úopen_resourceh   s   
zBlueprint.open_resource)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r$   r   r   r%   )r$   r   r   r   )r3   r4   )r5   r   r6   r   r7   r   r   r8   )	Ú__name__Ú
__module__Ú__qualname__r
   r   r,   r2   r@   Ú__classcell__r"   r"   r    r#   r      s    õ
$
ÿr   )Ú
__future__r   r<   Útypingr0   Údatetimer   r   r   Úglobalsr   Úhelpersr   Úsansio.blueprintsr   ÚSansioBlueprintr	   Úsansio.scaffoldr
   ÚTYPE_CHECKINGÚwrappersr   r"   r"   r"   r#   Ú<module>   s    