ConfigAttribute Class — flask Architecture
Architecture documentation for the ConfigAttribute class in config.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD 6e0922d5_7477_d0c7_7eac_60d90675889e["ConfigAttribute"] 2e858a02_7725_54fd_8d55_a9c969ab89bf["config.py"] 6e0922d5_7477_d0c7_7eac_60d90675889e -->|defined in| 2e858a02_7725_54fd_8d55_a9c969ab89bf 5af864d1_a18c_50fd_6ffa_11767b8c9d2e["__init__()"] 6e0922d5_7477_d0c7_7eac_60d90675889e -->|method| 5af864d1_a18c_50fd_6ffa_11767b8c9d2e e3707c99_bd69_ca47_43ee_567d74e108f5["__get__()"] 6e0922d5_7477_d0c7_7eac_60d90675889e -->|method| e3707c99_bd69_ca47_43ee_567d74e108f5 f624f641_84cd_29a2_5431_747caafd6869["__set__()"] 6e0922d5_7477_d0c7_7eac_60d90675889e -->|method| f624f641_84cd_29a2_5431_747caafd6869
Relationship Graph
Source Code
src/flask/config.py lines 20–47
class ConfigAttribute(t.Generic[T]):
"""Makes an attribute forward to the config"""
def __init__(
self, name: str, get_converter: t.Callable[[t.Any], T] | None = None
) -> None:
self.__name__ = name
self.get_converter = get_converter
@t.overload
def __get__(self, obj: None, owner: None) -> te.Self: ...
@t.overload
def __get__(self, obj: App, owner: type[App]) -> T: ...
def __get__(self, obj: App | None, owner: type[App] | None = None) -> T | te.Self:
if obj is None:
return self
rv = obj.config[self.__name__]
if self.get_converter is not None:
rv = self.get_converter(rv)
return rv # type: ignore[no-any-return]
def __set__(self, obj: App, value: t.Any) -> None:
obj.config[self.__name__] = value
Domain
Defined In
Source
Frequently Asked Questions
What is the ConfigAttribute class?
ConfigAttribute is a class in the flask codebase, defined in src/flask/config.py.
Where is ConfigAttribute defined?
ConfigAttribute is defined in src/flask/config.py at line 20.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free