Home / Function/ add_ctx() — flask Function Reference

add_ctx() — flask Function Reference

Architecture documentation for the add_ctx() function in app.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  00f5af9e_64cc_3191_e993_7b037a67bd5b["add_ctx()"]
  9612cfdd_2178_92c0_2ed7_16ebb0c72901["app.py"]
  00f5af9e_64cc_3191_e993_7b037a67bd5b -->|defined in| 9612cfdd_2178_92c0_2ed7_16ebb0c72901
  9ecf8228_23ee_83b6_506a_89e897629e5e["__init_subclass__()"]
  9ecf8228_23ee_83b6_506a_89e897629e5e -->|calls| 00f5af9e_64cc_3191_e993_7b037a67bd5b
  b7db9b24_d5be_a8c2_55fe_26b8b73ffe93["_get_current_object()"]
  00f5af9e_64cc_3191_e993_7b037a67bd5b -->|calls| b7db9b24_d5be_a8c2_55fe_26b8b73ffe93
  style 00f5af9e_64cc_3191_e993_7b037a67bd5b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/app.py lines 96–105

def add_ctx(f: F) -> F:
    def wrapper(self: Flask, *args: t.Any, **kwargs: t.Any) -> t.Any:
        if not args:
            args = (app_ctx._get_current_object(),)
        elif not isinstance(args[0], AppContext):
            args = (app_ctx._get_current_object(), *args)

        return f(self, *args, **kwargs)

    return update_wrapper(wrapper, f)  # type: ignore[return-value]

Subdomains

Defined In

Frequently Asked Questions

What does add_ctx() do?
add_ctx() is a function in the flask codebase, defined in src/flask/app.py.
Where is add_ctx() defined?
add_ctx() is defined in src/flask/app.py at line 96.
What does add_ctx() call?
add_ctx() calls 1 function(s): _get_current_object.
What calls add_ctx()?
add_ctx() is called by 1 function(s): __init_subclass__.

Analyze Your Own Codebase

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

Try Supermodel Free