Home / File/ debughelpers.py — flask Source File

debughelpers.py — flask Source File

Architecture documentation for debughelpers.py, a python file in the flask codebase. 10 imports, 3 dependents.

File python ApplicationCore Scaffolding 10 imports 3 dependents 4 functions 4 classes

Entity Profile

Dependency Diagram

graph LR
  7fa0faba_d854_797c_b6bd_20820e905793["debughelpers.py"]
  ebbad164_1651_bd83_3f3b_106e2ce78240["blueprints.py"]
  7fa0faba_d854_797c_b6bd_20820e905793 --> ebbad164_1651_bd83_3f3b_106e2ce78240
  43802377_8224_2289_2f49_1129adf043ee["Blueprint"]
  7fa0faba_d854_797c_b6bd_20820e905793 --> 43802377_8224_2289_2f49_1129adf043ee
  9cff5a62_7dbb_7b80_cf3c_128a7a2fda28["globals.py"]
  7fa0faba_d854_797c_b6bd_20820e905793 --> 9cff5a62_7dbb_7b80_cf3c_128a7a2fda28
  0bdbbb6d_41ac_cb65_54a5_10ce0159c2d6["sansio.app"]
  7fa0faba_d854_797c_b6bd_20820e905793 --> 0bdbbb6d_41ac_cb65_54a5_10ce0159c2d6
  c7e51d1e_44dd_175c_9e8a_ba5d5dbfdec4["sansio.scaffold"]
  7fa0faba_d854_797c_b6bd_20820e905793 --> c7e51d1e_44dd_175c_9e8a_ba5d5dbfdec4
  fb9bd0c5_9d0a_c235_58cf_8d691dde64fb["wrappers.py"]
  7fa0faba_d854_797c_b6bd_20820e905793 --> fb9bd0c5_9d0a_c235_58cf_8d691dde64fb
  eae007fa_ef39_ed97_113d_df4ad5001c0e["Request"]
  7fa0faba_d854_797c_b6bd_20820e905793 --> eae007fa_ef39_ed97_113d_df4ad5001c0e
  d3e9218c_bf0a_48f5_15c9_90795af6f3ac["typing.py"]
  7fa0faba_d854_797c_b6bd_20820e905793 --> d3e9218c_bf0a_48f5_15c9_90795af6f3ac
  78da2890_9ebb_b5f1_02e8_8a6e8bb94ae2["jinja2.loaders"]
  7fa0faba_d854_797c_b6bd_20820e905793 --> 78da2890_9ebb_b5f1_02e8_8a6e8bb94ae2
  e2a72d84_5c89_bb0d_3a69_5d24eacd9d7c["werkzeug.routing"]
  7fa0faba_d854_797c_b6bd_20820e905793 --> e2a72d84_5c89_bb0d_3a69_5d24eacd9d7c
  9612cfdd_2178_92c0_2ed7_16ebb0c72901["app.py"]
  9612cfdd_2178_92c0_2ed7_16ebb0c72901 --> 7fa0faba_d854_797c_b6bd_20820e905793
  554becd3_25b5_c670_a654_7a20377dec19["templating.py"]
  554becd3_25b5_c670_a654_7a20377dec19 --> 7fa0faba_d854_797c_b6bd_20820e905793
  fb9bd0c5_9d0a_c235_58cf_8d691dde64fb["wrappers.py"]
  fb9bd0c5_9d0a_c235_58cf_8d691dde64fb --> 7fa0faba_d854_797c_b6bd_20820e905793
  style 7fa0faba_d854_797c_b6bd_20820e905793 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from __future__ import annotations

import typing as t

from jinja2.loaders import BaseLoader
from werkzeug.routing import RequestRedirect

from .blueprints import Blueprint
from .globals import _cv_app
from .sansio.app import App

if t.TYPE_CHECKING:
    from .sansio.scaffold import Scaffold
    from .wrappers import Request


class UnexpectedUnicodeError(AssertionError, UnicodeError):
    """Raised in places where we want some better error reporting for
    unexpected unicode or binary data.
    """


class DebugFilesKeyError(KeyError, AssertionError):
    """Raised from request.files during debugging.  The idea is that it can
    provide a better error message than just a generic KeyError/BadRequest.
    """

    def __init__(self, request: Request, key: str) -> None:
        form_matches = request.form.getlist(key)
        buf = [
            f"You tried to access the file {key!r} in the request.files"
            " dictionary but it does not exist. The mimetype for the"
            f" request is {request.mimetype!r} instead of"
            " 'multipart/form-data' which means that no file contents"
            " were transmitted. To fix this error you should provide"
            ' enctype="multipart/form-data" in your form.'
        ]
        if form_matches:
            names = ", ".join(repr(x) for x in form_matches)
            buf.append(
                "\n\nThe browser instead transmitted some file names. "
                f"This was submitted: {names}"
            )
        self.msg = "".join(buf)

    def __str__(self) -> str:
        return self.msg


class FormDataRoutingRedirect(AssertionError):
    """This exception is raised in debug mode if a routing redirect
    would cause the browser to drop the method or body. This happens
    when method is not GET, HEAD or OPTIONS and the status code is not
    307 or 308.
    """

    def __init__(self, request: Request) -> None:
        exc = request.routing_exception
        assert isinstance(exc, RequestRedirect)
        buf = [
// ... (120 more lines)

Subdomains

Dependencies

Frequently Asked Questions

What does debughelpers.py do?
debughelpers.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 debughelpers.py?
debughelpers.py defines 4 function(s): _dump_loader_info, attach_enctype_error_multidict, explain_template_loading_attempts, sansio.
What does debughelpers.py depend on?
debughelpers.py imports 10 module(s): Blueprint, Request, blueprints.py, globals.py, jinja2.loaders, sansio.app, sansio.scaffold, typing.py, and 2 more.
What files import debughelpers.py?
debughelpers.py is imported by 3 file(s): app.py, templating.py, wrappers.py.
Where is debughelpers.py in the architecture?
debughelpers.py is located at src/flask/debughelpers.py (domain: ApplicationCore, subdomain: Scaffolding, directory: src/flask).

Analyze Your Own Codebase

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

Try Supermodel Free