Files
fastapi/docs_src/settings/app03/main.py
Sebastián Ramírez 2e14c69c31 👷 Adopt Ruff format (#10517)
* 🔧 Update pre-commit, use ruff format

* ⬆️ Upgrade dependencies, use Ruff for formatting

* 🔧 Update Ruff config

* 🔨 Update lint and format scripts, use Ruff

* 🎨 Format internals with Ruff

* 🎨 Format docs scripts

* 🎨 Format tests

* 🎨 Format extra commas in src for docs

* 📝 Update docs mentioning `@lru_cache()`, use `@lru_cache` instead to keep consistency with the format

* 🎨 Update src for docs, use plain `@lru_cache`

* 🎨 Update src for docs format and docs references
2023-10-25 00:26:06 +04:00

22 lines
412 B
Python

from functools import lru_cache
from fastapi import Depends, FastAPI
from . import config
app = FastAPI()
@lru_cache
def get_settings():
return config.Settings()
@app.get("/info")
async def info(settings: config.Settings = Depends(get_settings)):
return {
"app_name": settings.app_name,
"admin_email": settings.admin_email,
"items_per_user": settings.items_per_user,
}