From 1f03c69ea7fce360ba28a1239811532fb92c977a Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Sat, 28 Dec 2024 09:42:15 +0100 Subject: [PATCH] docs: don't show code source --- docs/database.md | 8 ++------ docs/exceptions.md | 4 ++-- docs/requests.md | 10 +++++----- docs/testclient.md | 1 + mkdocs.yml | 1 + 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/docs/database.md b/docs/database.md index 8e599dbcd..f8b2f7030 100644 --- a/docs/database.md +++ b/docs/database.md @@ -9,15 +9,11 @@ which provides SQLAlchemy core support against a range of different database dri Here's a complete example, that includes table definitions, configuring a `database.Database` instance, and a couple of endpoints that interact with the database. -**.env** - -```ini +```ini title=".env" DATABASE_URL=sqlite:///test.db ``` -**app.py** - -```python +```python title="app.py" import contextlib import databases diff --git a/docs/exceptions.md b/docs/exceptions.md index 2a351e771..75a1c8e22 100644 --- a/docs/exceptions.md +++ b/docs/exceptions.md @@ -123,8 +123,8 @@ The `ExceptionMiddleware` implementation defaults to returning plain-text HTTP r You should only raise `HTTPException` inside routing or endpoints. Middleware classes should instead just return appropriate responses directly. -You can use an `HTTPException` on a WebSocket endpoint in case it's raised before `websocket.accept()`. -The connection is not upgraded to a WebSocket connection, and the proper HTTP response is returned. +You can use an `HTTPException` on a WebSocket endpoint. In case it's raised before `websocket.accept()` +the connection is not upgraded to a WebSocket connection, and the proper HTTP response is returned. ```python from starlette.applications import Starlette diff --git a/docs/requests.md b/docs/requests.md index 368755f13..d63055532 100644 --- a/docs/requests.md +++ b/docs/requests.md @@ -90,7 +90,7 @@ You can also access the request body as a stream, using the `async for` syntax: from starlette.requests import Request from starlette.responses import Response - + async def app(scope, receive, send): assert scope['type'] == 'http' request = Request(scope, receive) @@ -155,11 +155,11 @@ async with request.form() as form: ``` !!! info - As settled in [RFC-7578: 4.2](https://www.ietf.org/rfc/rfc7578.txt), form-data content part that contains file + As settled in [RFC-7578: 4.2](https://www.ietf.org/rfc/rfc7578.txt), form-data content part that contains file assumed to have `name` and `filename` fields in `Content-Disposition` header: `Content-Disposition: form-data; - name="user"; filename="somefile"`. Though `filename` field is optional according to RFC-7578, it helps - Starlette to differentiate which data should be treated as file. If `filename` field was supplied, `UploadFile` - object will be created to access underlying file, otherwise form-data part will be parsed and available as a raw + name="user"; filename="somefile"`. Though `filename` field is optional according to RFC-7578, it helps + Starlette to differentiate which data should be treated as file. If `filename` field was supplied, `UploadFile` + object will be created to access underlying file, otherwise form-data part will be parsed and available as a raw string. #### Application diff --git a/docs/testclient.md b/docs/testclient.md index 258186b04..ab05c4290 100644 --- a/docs/testclient.md +++ b/docs/testclient.md @@ -3,6 +3,7 @@ ::: starlette.testclient.TestClient options: parameter_headings: false + show_bases: false show_root_heading: true heading_level: 3 filters: diff --git a/mkdocs.yml b/mkdocs.yml index 55bf1c224..b1f32422a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -81,6 +81,7 @@ plugins: merge_init_into_class: true parameter_headings: true show_signature_annotations: true + show_source: false signature_crossrefs: true import: - url: https://docs.python.org/3/objects.inv