Home / File/ scaffold.py — flask Source File

scaffold.py — flask Source File

Architecture documentation for scaffold.py, a python file in the flask codebase. 14 imports, 2 dependents.

File python ApplicationCore Scaffolding 14 imports 2 dependents 5 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  b48dce3f_427c_079b_4c4a_8f5873f5b51f["scaffold.py"]
  ef067598_b87b_459b_7a19_f6c8df8fd2e4["ef067598:b87b:459b:7a19:f6c8df8fd2e4"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> ef067598_b87b_459b_7a19_f6c8df8fd2e4
  26e52470_30b2_ff5b_1d4a_69e4e1a5d06c["helpers"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> 26e52470_30b2_ff5b_1d4a_69e4e1a5d06c
  55e8b855_d95d_ace3_7d8e_5938af2604c3["templating"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> 55e8b855_d95d_ace3_7d8e_5938af2604c3
  e2103321_f71b_de04_724e_2b923350399d["importlib.util"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> e2103321_f71b_de04_724e_2b923350399d
  bdc6911d_da67_3a1f_90cb_90f5e9f0603e["os"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> bdc6911d_da67_3a1f_90cb_90f5e9f0603e
  e7a1eae0_bd3b_70ce_3ad8_77d21551aba8["pathlib"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> e7a1eae0_bd3b_70ce_3ad8_77d21551aba8
  8e9cc1cb_fabe_237c_ff24_85400e094882["sys"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> 8e9cc1cb_fabe_237c_ff24_85400e094882
  852dc50b_4da6_57dc_ead7_cdd90925e0b8["typing"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> 852dc50b_4da6_57dc_ead7_cdd90925e0b8
  8fd3515c_7e50_5f0a_b0b8_f61f07875a2c["collections"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> 8fd3515c_7e50_5f0a_b0b8_f61f07875a2c
  3eebf5bc_1ef0_6524_701b_beec8ec8524a["functools"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> 3eebf5bc_1ef0_6524_701b_beec8ec8524a
  080c4713_770c_bdc4_fb40_89df334e08bb["jinja2"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> 080c4713_770c_bdc4_fb40_89df334e08bb
  9b468bc7_cc0b_fef2_ed71_07b4f027fb55["werkzeug.exceptions"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> 9b468bc7_cc0b_fef2_ed71_07b4f027fb55
  d04b8dfd_bc0a_e096_b08f_f16e74bf9488["werkzeug.utils"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> d04b8dfd_bc0a_e096_b08f_f16e74bf9488
  2681878a_119e_c28f_8e5e_e924c75161c4["click"]
  b48dce3f_427c_079b_4c4a_8f5873f5b51f --> 2681878a_119e_c28f_8e5e_e924c75161c4
  style b48dce3f_427c_079b_4c4a_8f5873f5b51f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from __future__ import annotations

import importlib.util
import os
import pathlib
import sys
import typing as t
from collections import defaultdict
from functools import update_wrapper

from jinja2 import BaseLoader
from jinja2 import FileSystemLoader
from werkzeug.exceptions import default_exceptions
from werkzeug.exceptions import HTTPException
from werkzeug.utils import cached_property

from .. import typing as ft
from ..helpers import get_root_path
from ..templating import _default_template_ctx_processor

if t.TYPE_CHECKING:  # pragma: no cover
    from click import Group

# a singleton sentinel value for parameter defaults
_sentinel = object()

F = t.TypeVar("F", bound=t.Callable[..., t.Any])
T_after_request = t.TypeVar("T_after_request", bound=ft.AfterRequestCallable[t.Any])
T_before_request = t.TypeVar("T_before_request", bound=ft.BeforeRequestCallable)
T_error_handler = t.TypeVar("T_error_handler", bound=ft.ErrorHandlerCallable)
T_teardown = t.TypeVar("T_teardown", bound=ft.TeardownCallable)
T_template_context_processor = t.TypeVar(
    "T_template_context_processor", bound=ft.TemplateContextProcessorCallable
)
T_url_defaults = t.TypeVar("T_url_defaults", bound=ft.URLDefaultCallable)
T_url_value_preprocessor = t.TypeVar(
    "T_url_value_preprocessor", bound=ft.URLValuePreprocessorCallable
)
T_route = t.TypeVar("T_route", bound=ft.RouteCallable)


def setupmethod(f: F) -> F:
    f_name = f.__name__

    def wrapper_func(self: Scaffold, *args: t.Any, **kwargs: t.Any) -> t.Any:
        self._check_setup_finished(f_name)
        return f(self, *args, **kwargs)

    return t.cast(F, update_wrapper(wrapper_func, f))


class Scaffold:
    """Common behavior shared between :class:`~flask.Flask` and
    :class:`~flask.blueprints.Blueprint`.

    :param import_name: The import name of the module where this object
        is defined. Usually :attr:`__name__` should be used.
    :param static_folder: Path to a folder of static files to serve.
        If this is set, a static route will be added.
    :param static_url_path: URL prefix for the static route.
// ... (733 more lines)

Subdomains

Classes

Dependencies

  • click
  • collections
  • ef067598:b87b:459b:7a19:f6c8df8fd2e4
  • functools
  • helpers
  • importlib.util
  • jinja2
  • os
  • pathlib
  • sys
  • templating
  • typing
  • werkzeug.exceptions
  • werkzeug.utils

Frequently Asked Questions

What does scaffold.py do?
scaffold.py is a source file in the flask codebase, written in python. It belongs to the ApplicationCore domain, Scaffolding subdomain.
What functions are defined in scaffold.py?
scaffold.py defines 5 function(s): _endpoint_from_view_func, _find_package_path, click, find_package, setupmethod.
What does scaffold.py depend on?
scaffold.py imports 14 module(s): click, collections, ef067598:b87b:459b:7a19:f6c8df8fd2e4, functools, helpers, importlib.util, jinja2, os, and 6 more.
What files import scaffold.py?
scaffold.py is imported by 2 file(s): app.py, blueprints.py.
Where is scaffold.py in the architecture?
scaffold.py is located at src/flask/sansio/scaffold.py (domain: ApplicationCore, subdomain: Scaffolding, directory: src/flask/sansio).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free