o
    ê}”e9  ã                   @  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 ejr5dd	lmZ G d
d„ deƒZdS )é    )ÚannotationsN)Ú	timedeltaé   )Úcurrent_app)Úsend_from_directory)Ú	Blueprint)ÚBlueprintSetupState)ÚResponsec                   @  s,   e Zd Zddd„Zdd	d
„Zdddd„ZdS )r   Úfilenameú
str | NoneÚreturnú
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
        ZSEND_FILE_MAX_AGE_DEFAULTN)r   ÚconfigÚ
isinstancer   ÚintÚtotal_seconds)Úselfr
   Úvalue© r   úY/Users/abhinavbhinder/Documents/map/venv/lib/python3.10/site-packages/flask/blueprints.pyÚget_send_file_max_age   s   

zBlueprint.get_send_file_max_ageÚstrr	   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)Zhas_static_folderÚRuntimeErrorr   r   ÚtÚcastr   Zstatic_folder)r   r
   r   r   r   r   Úsend_static_file,   s   
ÿzBlueprint.send_static_fileÚrbÚresourceÚmodeút.IO[t.AnyStr]c                 C  s&   |dvrt dƒ‚ttj | j|¡|ƒS )a�  Open a resource file relative to :attr:`root_path` for
        reading.

        For example, if the file ``schema.sql`` is next to the file
        ``app.py`` where the ``Flask`` app is defined, it can be opened
        with:

        .. code-block:: python

            with app.open_resource("schema.sql") as f:
                conn.executescript(f.read())

        :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".

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

        >   Úrtr   Úrz)Resources can only be opened for reading.)Ú
ValueErrorÚopenÚosÚpathÚjoinÚ	root_path)r   r   r   r   r   r   Úopen_resourceB   s   zBlueprint.open_resourceN)r
   r   r   r   )r
   r   r   r	   )r   )r   r   r   r   r   r    )Ú__name__Ú
__module__Ú__qualname__r   r   r)   r   r   r   r   r      s    

r   )Ú
__future__r   r%   Útypingr   Údatetimer   Úglobalsr   Zhelpersr   Zsansio.blueprintsr   ZSansioBlueprintr   ÚTYPE_CHECKINGÚwrappersr	   r   r   r   r   Ú<module>   s    