Format: application/x-python-code
⬇ Download File (4.1 KB)
   1  o
   2  
   3  D'h��@s�ddlmZddlZddlZddlmZddlmZddl	m
   4  Z
   5  ddlmZddl
   6  mZdd	l
   7  mZdd
   8  lmZejrAddlmZGdd
   9  �d
  10  e�ZdS)�)�annotationsN)�	timedelta�)�AppGroup)�current_app)�send_from_directory)�	Blueprint)�BlueprintSetupState)�	_sentinel)�ResponsecsReZdZdddddddefd#�fdd�
  11  Zd$dd�Zd%dd�Z	d&d'd!d"�Z�ZS)(rN�name�str�import_name�
  12  static_folder�str | os.PathLike[str] | None�static_url_path�
  13  str | None�template_folder�
  14  url_prefix�	subdomain�url_defaults�dict[str, t.Any] | None�	root_path�	cli_group�return�Nonecs4t��|||||||||	|
  15  �
  16  t�|_|j|j_dS)N)�super�__init__r�clir)�selfrrrrrrrrrr��	__class__��FC:\Users\shubh\Videos\agent\nova\Lib\site-packages\flask/blueprints.pyrs
  17  �zBlueprint.__init__�filename�
  18  int | NonecCs0tjd}|durdSt|t�rt|���S|S)anUsed by :func:`send_file` to determine the ``max_age`` cache
  19          value for a given file path if it wasn't passed.
  20  
  21          By default, this returns :data:`SEND_FILE_MAX_AGE_DEFAULT` from
  22          the configuration of :data:`~flask.current_app`. This defaults
  23          to ``None``, which tells the browser to use conditional requests
  24          instead of a timed cache, which is usually preferable.
  25  
  26          Note this is a duplicate of the same method in the Flask
  27          class.
  28  
  29          .. versionchanged:: 2.0
  30              The default configuration is ``None`` instead of 12 hours.
  31  
  32          .. versionadded:: 0.9
  33          ZSEND_FILE_MAX_AGE_DEFAULTN)r�config�
  34  isinstancer�int�
  35  total_seconds)rr$�valuer"r"r#�get_send_file_max_age7s
  36  
  37  zBlueprint.get_send_file_max_agercCs0|jstd��|�|�}tt�t|j�||d�S)aAThe view function used to serve files from
  38          :attr:`static_folder`. A route is automatically registered for
  39          this view at :attr:`static_url_path` if :attr:`static_folder` is
  40          set.
  41  
  42          Note this is a duplicate of the same method in the Flask
  43          class.
  44  
  45          .. versionadded:: 0.5
  46  
  47          z2'static_folder' must be set to serve static_files.)�max_age)Zhas_static_folder�RuntimeErrorr+r�t�castr
  48  r)rr$r,r"r"r#�send_static_fileRs
  49  �zBlueprint.send_static_file�rb�utf-8�resource�mode�encoding�t.IO[t.AnyStr]cCs@|dvrtd��tj�|j|�}|dkrt||�St|||d�S)aeOpen a resource file relative to :attr:`root_path` for reading. The
  50          blueprint-relative equivalent of the app's :meth:`~.Flask.open_resource`
  51          method.
  52  
  53          :param resource: Path to the resource relative to :attr:`root_path`.
  54          :param mode: Open the file in this mode. Only reading is supported,
  55              valid values are ``"r"`` (or ``"rt"``) and ``"rb"``.
  56          :param encoding: Open the file with this encoding when opening in text
  57              mode. This is ignored when opening in binary mode.
  58  
  59          .. versionchanged:: 3.1
  60              Added the ``encoding`` parameter.
  61          >�rr1�rtz)Resources can only be opened for reading.r1)r5)�
  62  ValueError�os�path�joinr�open)rr3r4r5r;r"r"r#�
  63  open_resourcehs
  64  zBlueprint.open_resource)rr
  65  rr
  66  rrrrrrrrrrrrrrrrrr)r$rrr%)r$r
  67  rr)r1r2)r3r
  68  r4r
  69  r5rrr6)	�__name__�
  70  __module__�__qualname__r
  71  rr+r0r>�
  72  __classcell__r"r"r r#rs�
  73  $
  74  �r)�
  75  __future__rr:�typingr.�datetimerrr�globalsr�helpersrZsansio.blueprintsrZSansioBlueprintr	Zsansio.scaffoldr
  76  �
  77  TYPE_CHECKINGZwrappersrr"r"r"r#�<module>s