provider.py — flask Source File
Architecture documentation for provider.py, a python file in the flask codebase. 10 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 64bf3a3f_ca45_015e_bd00_0190cbad6928["provider.py"] 0ffb7b1b_462e_063a_86d7_0c28573f1322["sansio.app"] 64bf3a3f_ca45_015e_bd00_0190cbad6928 --> 0ffb7b1b_462e_063a_86d7_0c28573f1322 0a202be0_9dcc_09f2_84fd_54327dbc5f50["dataclasses"] 64bf3a3f_ca45_015e_bd00_0190cbad6928 --> 0a202be0_9dcc_09f2_84fd_54327dbc5f50 148a8303_4748_e3d5_e14d_4289067aa7d6["decimal"] 64bf3a3f_ca45_015e_bd00_0190cbad6928 --> 148a8303_4748_e3d5_e14d_4289067aa7d6 24c75b54_2419_4c05_11fb_668c1d1c4ac5["json"] 64bf3a3f_ca45_015e_bd00_0190cbad6928 --> 24c75b54_2419_4c05_11fb_668c1d1c4ac5 852dc50b_4da6_57dc_ead7_cdd90925e0b8["typing"] 64bf3a3f_ca45_015e_bd00_0190cbad6928 --> 852dc50b_4da6_57dc_ead7_cdd90925e0b8 c26d67c5_e5bf_05b7_bcb4_ac69089e1109["uuid"] 64bf3a3f_ca45_015e_bd00_0190cbad6928 --> c26d67c5_e5bf_05b7_bcb4_ac69089e1109 63a99ca9_769e_3a2f_1040_efa398b8241d["weakref"] 64bf3a3f_ca45_015e_bd00_0190cbad6928 --> 63a99ca9_769e_3a2f_1040_efa398b8241d bdb4799f_8b0c_fcfd_51cc_f0b833652f8f["datetime"] 64bf3a3f_ca45_015e_bd00_0190cbad6928 --> bdb4799f_8b0c_fcfd_51cc_f0b833652f8f c8ef0481_732f_584a_537b_20ea831e8fd0["werkzeug.http"] 64bf3a3f_ca45_015e_bd00_0190cbad6928 --> c8ef0481_732f_584a_537b_20ea831e8fd0 151410f6_1bb7_5cc2_b5a2_1bc32b945b6e["werkzeug.sansio.response"] 64bf3a3f_ca45_015e_bd00_0190cbad6928 --> 151410f6_1bb7_5cc2_b5a2_1bc32b945b6e a2a0fafc_2ea9_1b29_60c7_bc4419008a44["__init__.py"] a2a0fafc_2ea9_1b29_60c7_bc4419008a44 --> 64bf3a3f_ca45_015e_bd00_0190cbad6928 style 64bf3a3f_ca45_015e_bd00_0190cbad6928 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from __future__ import annotations
import dataclasses
import decimal
import json
import typing as t
import uuid
import weakref
from datetime import date
from werkzeug.http import http_date
if t.TYPE_CHECKING: # pragma: no cover
from werkzeug.sansio.response import Response
from ..sansio.app import App
class JSONProvider:
"""A standard set of JSON operations for an application. Subclasses
of this can be used to customize JSON behavior or use different
JSON libraries.
To implement a provider for a specific library, subclass this base
class and implement at least :meth:`dumps` and :meth:`loads`. All
other methods have default implementations.
To use a different provider, either subclass ``Flask`` and set
:attr:`~flask.Flask.json_provider_class` to a provider class, or set
:attr:`app.json <flask.Flask.json>` to an instance of the class.
:param app: An application instance. This will be stored as a
:class:`weakref.proxy` on the :attr:`_app` attribute.
.. versionadded:: 2.2
"""
def __init__(self, app: App) -> None:
self._app: App = weakref.proxy(app)
def dumps(self, obj: t.Any, **kwargs: t.Any) -> str:
"""Serialize data as JSON.
:param obj: The data to serialize.
:param kwargs: May be passed to the underlying JSON library.
"""
raise NotImplementedError
def dump(self, obj: t.Any, fp: t.IO[str], **kwargs: t.Any) -> None:
"""Serialize data as JSON and write to a file.
:param obj: The data to serialize.
:param fp: A file opened for writing text. Should use the UTF-8
encoding to be valid JSON.
:param kwargs: May be passed to the underlying JSON library.
"""
fp.write(self.dumps(obj, **kwargs))
def loads(self, s: str | bytes, **kwargs: t.Any) -> t.Any:
"""Deserialize data as JSON.
// ... (156 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
- dataclasses
- datetime
- decimal
- json
- sansio.app
- typing
- uuid
- weakref
- werkzeug.http
- werkzeug.sansio.response
Imported By
Source
Frequently Asked Questions
What does provider.py do?
provider.py is a source file in the flask codebase, written in python. It belongs to the DataHandling domain, JsonProvider subdomain.
What functions are defined in provider.py?
provider.py defines 2 function(s): _default, werkzeug.
What does provider.py depend on?
provider.py imports 10 module(s): dataclasses, datetime, decimal, json, sansio.app, typing, uuid, weakref, and 2 more.
What files import provider.py?
provider.py is imported by 1 file(s): __init__.py.
Where is provider.py in the architecture?
provider.py is located at src/flask/json/provider.py (domain: DataHandling, subdomain: JsonProvider, directory: src/flask/json).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free