]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
🔧 Remove `base_path` for `mdx_include` Markdown extension in MkDocs (#12391)
authorSebastián Ramírez <tiangolo@gmail.com>
Sun, 6 Oct 2024 20:36:54 +0000 (22:36 +0200)
committerGitHub <noreply@github.com>
Sun, 6 Oct 2024 20:36:54 +0000 (22:36 +0200)
529 files changed:
docs/bn/docs/python-types.md
docs/de/docs/advanced/additional-responses.md
docs/de/docs/advanced/additional-status-codes.md
docs/de/docs/advanced/advanced-dependencies.md
docs/de/docs/advanced/async-tests.md
docs/de/docs/advanced/behind-a-proxy.md
docs/de/docs/advanced/custom-response.md
docs/de/docs/advanced/dataclasses.md
docs/de/docs/advanced/events.md
docs/de/docs/advanced/generate-clients.md
docs/de/docs/advanced/middleware.md
docs/de/docs/advanced/openapi-callbacks.md
docs/de/docs/advanced/openapi-webhooks.md
docs/de/docs/advanced/path-operation-advanced-configuration.md
docs/de/docs/advanced/response-change-status-code.md
docs/de/docs/advanced/response-cookies.md
docs/de/docs/advanced/response-directly.md
docs/de/docs/advanced/response-headers.md
docs/de/docs/advanced/security/http-basic-auth.md
docs/de/docs/advanced/security/oauth2-scopes.md
docs/de/docs/advanced/settings.md
docs/de/docs/advanced/sub-applications.md
docs/de/docs/advanced/templates.md
docs/de/docs/advanced/testing-dependencies.md
docs/de/docs/advanced/testing-events.md
docs/de/docs/advanced/testing-websockets.md
docs/de/docs/advanced/using-request-directly.md
docs/de/docs/advanced/websockets.md
docs/de/docs/advanced/wsgi.md
docs/de/docs/how-to/conditional-openapi.md
docs/de/docs/how-to/configure-swagger-ui.md
docs/de/docs/how-to/custom-docs-ui-assets.md
docs/de/docs/how-to/custom-request-and-route.md
docs/de/docs/how-to/extending-openapi.md
docs/de/docs/how-to/graphql.md
docs/de/docs/how-to/separate-openapi-schemas.md
docs/de/docs/python-types.md
docs/de/docs/tutorial/background-tasks.md
docs/de/docs/tutorial/bigger-applications.md
docs/de/docs/tutorial/body-fields.md
docs/de/docs/tutorial/body-multiple-params.md
docs/de/docs/tutorial/body-nested-models.md
docs/de/docs/tutorial/body-updates.md
docs/de/docs/tutorial/body.md
docs/de/docs/tutorial/cookie-params.md
docs/de/docs/tutorial/dependencies/classes-as-dependencies.md
docs/de/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
docs/de/docs/tutorial/dependencies/dependencies-with-yield.md
docs/de/docs/tutorial/dependencies/global-dependencies.md
docs/de/docs/tutorial/dependencies/index.md
docs/de/docs/tutorial/dependencies/sub-dependencies.md
docs/de/docs/tutorial/encoder.md
docs/de/docs/tutorial/extra-data-types.md
docs/de/docs/tutorial/extra-models.md
docs/de/docs/tutorial/first-steps.md
docs/de/docs/tutorial/handling-errors.md
docs/de/docs/tutorial/header-params.md
docs/de/docs/tutorial/metadata.md
docs/de/docs/tutorial/middleware.md
docs/de/docs/tutorial/path-operation-configuration.md
docs/de/docs/tutorial/path-params-numeric-validations.md
docs/de/docs/tutorial/path-params.md
docs/de/docs/tutorial/query-params-str-validations.md
docs/de/docs/tutorial/query-params.md
docs/de/docs/tutorial/request-files.md
docs/de/docs/tutorial/request-forms-and-files.md
docs/de/docs/tutorial/request-forms.md
docs/de/docs/tutorial/response-model.md
docs/de/docs/tutorial/response-status-code.md
docs/de/docs/tutorial/schema-extra-example.md
docs/de/docs/tutorial/security/first-steps.md
docs/de/docs/tutorial/security/get-current-user.md
docs/de/docs/tutorial/security/oauth2-jwt.md
docs/de/docs/tutorial/security/simple-oauth2.md
docs/de/docs/tutorial/static-files.md
docs/de/docs/tutorial/testing.md
docs/em/docs/advanced/additional-responses.md
docs/em/docs/advanced/additional-status-codes.md
docs/em/docs/advanced/advanced-dependencies.md
docs/em/docs/advanced/async-tests.md
docs/em/docs/advanced/behind-a-proxy.md
docs/em/docs/advanced/custom-response.md
docs/em/docs/advanced/dataclasses.md
docs/em/docs/advanced/events.md
docs/em/docs/advanced/generate-clients.md
docs/em/docs/advanced/middleware.md
docs/em/docs/advanced/openapi-callbacks.md
docs/em/docs/advanced/path-operation-advanced-configuration.md
docs/em/docs/advanced/response-change-status-code.md
docs/em/docs/advanced/response-cookies.md
docs/em/docs/advanced/response-directly.md
docs/em/docs/advanced/response-headers.md
docs/em/docs/advanced/security/http-basic-auth.md
docs/em/docs/advanced/security/oauth2-scopes.md
docs/em/docs/advanced/settings.md
docs/em/docs/advanced/sub-applications.md
docs/em/docs/advanced/templates.md
docs/em/docs/advanced/testing-database.md
docs/em/docs/advanced/testing-dependencies.md
docs/em/docs/advanced/testing-events.md
docs/em/docs/advanced/testing-websockets.md
docs/em/docs/advanced/using-request-directly.md
docs/em/docs/advanced/websockets.md
docs/em/docs/advanced/wsgi.md
docs/em/docs/how-to/conditional-openapi.md
docs/em/docs/how-to/custom-request-and-route.md
docs/em/docs/how-to/extending-openapi.md
docs/em/docs/how-to/graphql.md
docs/em/docs/how-to/sql-databases-peewee.md
docs/em/docs/python-types.md
docs/em/docs/tutorial/background-tasks.md
docs/em/docs/tutorial/bigger-applications.md
docs/em/docs/tutorial/body-fields.md
docs/em/docs/tutorial/body-multiple-params.md
docs/em/docs/tutorial/body-nested-models.md
docs/em/docs/tutorial/body-updates.md
docs/em/docs/tutorial/body.md
docs/em/docs/tutorial/cookie-params.md
docs/em/docs/tutorial/cors.md
docs/em/docs/tutorial/debugging.md
docs/em/docs/tutorial/dependencies/classes-as-dependencies.md
docs/em/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
docs/em/docs/tutorial/dependencies/dependencies-with-yield.md
docs/em/docs/tutorial/dependencies/global-dependencies.md
docs/em/docs/tutorial/dependencies/index.md
docs/em/docs/tutorial/dependencies/sub-dependencies.md
docs/em/docs/tutorial/encoder.md
docs/em/docs/tutorial/extra-data-types.md
docs/em/docs/tutorial/extra-models.md
docs/em/docs/tutorial/first-steps.md
docs/em/docs/tutorial/handling-errors.md
docs/em/docs/tutorial/header-params.md
docs/em/docs/tutorial/metadata.md
docs/em/docs/tutorial/middleware.md
docs/em/docs/tutorial/path-operation-configuration.md
docs/em/docs/tutorial/path-params-numeric-validations.md
docs/em/docs/tutorial/path-params.md
docs/em/docs/tutorial/query-params-str-validations.md
docs/em/docs/tutorial/query-params.md
docs/em/docs/tutorial/request-files.md
docs/em/docs/tutorial/request-forms-and-files.md
docs/em/docs/tutorial/request-forms.md
docs/em/docs/tutorial/response-model.md
docs/em/docs/tutorial/response-status-code.md
docs/em/docs/tutorial/schema-extra-example.md
docs/em/docs/tutorial/security/first-steps.md
docs/em/docs/tutorial/security/get-current-user.md
docs/em/docs/tutorial/security/oauth2-jwt.md
docs/em/docs/tutorial/security/simple-oauth2.md
docs/em/docs/tutorial/sql-databases.md
docs/em/docs/tutorial/static-files.md
docs/em/docs/tutorial/testing.md
docs/en/docs/advanced/additional-responses.md
docs/en/docs/advanced/additional-status-codes.md
docs/en/docs/advanced/advanced-dependencies.md
docs/en/docs/advanced/async-tests.md
docs/en/docs/advanced/behind-a-proxy.md
docs/en/docs/advanced/custom-response.md
docs/en/docs/advanced/dataclasses.md
docs/en/docs/advanced/events.md
docs/en/docs/advanced/generate-clients.md
docs/en/docs/advanced/middleware.md
docs/en/docs/advanced/openapi-callbacks.md
docs/en/docs/advanced/openapi-webhooks.md
docs/en/docs/advanced/path-operation-advanced-configuration.md
docs/en/docs/advanced/response-change-status-code.md
docs/en/docs/advanced/response-cookies.md
docs/en/docs/advanced/response-directly.md
docs/en/docs/advanced/response-headers.md
docs/en/docs/advanced/security/http-basic-auth.md
docs/en/docs/advanced/security/oauth2-scopes.md
docs/en/docs/advanced/settings.md
docs/en/docs/advanced/sub-applications.md
docs/en/docs/advanced/templates.md
docs/en/docs/advanced/testing-database.md
docs/en/docs/advanced/testing-dependencies.md
docs/en/docs/advanced/testing-events.md
docs/en/docs/advanced/testing-websockets.md
docs/en/docs/advanced/using-request-directly.md
docs/en/docs/advanced/websockets.md
docs/en/docs/advanced/wsgi.md
docs/en/docs/how-to/async-sql-encode-databases.md
docs/en/docs/how-to/conditional-openapi.md
docs/en/docs/how-to/configure-swagger-ui.md
docs/en/docs/how-to/custom-docs-ui-assets.md
docs/en/docs/how-to/custom-request-and-route.md
docs/en/docs/how-to/extending-openapi.md
docs/en/docs/how-to/graphql.md
docs/en/docs/how-to/nosql-databases-couchbase.md
docs/en/docs/how-to/separate-openapi-schemas.md
docs/en/docs/how-to/sql-databases-peewee.md
docs/en/docs/python-types.md
docs/en/docs/tutorial/background-tasks.md
docs/en/docs/tutorial/bigger-applications.md
docs/en/docs/tutorial/body-fields.md
docs/en/docs/tutorial/body-multiple-params.md
docs/en/docs/tutorial/body-nested-models.md
docs/en/docs/tutorial/body-updates.md
docs/en/docs/tutorial/body.md
docs/en/docs/tutorial/cookie-param-models.md
docs/en/docs/tutorial/cookie-params.md
docs/en/docs/tutorial/cors.md
docs/en/docs/tutorial/debugging.md
docs/en/docs/tutorial/dependencies/classes-as-dependencies.md
docs/en/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
docs/en/docs/tutorial/dependencies/dependencies-with-yield.md
docs/en/docs/tutorial/dependencies/global-dependencies.md
docs/en/docs/tutorial/dependencies/index.md
docs/en/docs/tutorial/dependencies/sub-dependencies.md
docs/en/docs/tutorial/encoder.md
docs/en/docs/tutorial/extra-data-types.md
docs/en/docs/tutorial/extra-models.md
docs/en/docs/tutorial/first-steps.md
docs/en/docs/tutorial/handling-errors.md
docs/en/docs/tutorial/header-param-models.md
docs/en/docs/tutorial/header-params.md
docs/en/docs/tutorial/metadata.md
docs/en/docs/tutorial/middleware.md
docs/en/docs/tutorial/path-operation-configuration.md
docs/en/docs/tutorial/path-params-numeric-validations.md
docs/en/docs/tutorial/path-params.md
docs/en/docs/tutorial/query-param-models.md
docs/en/docs/tutorial/query-params-str-validations.md
docs/en/docs/tutorial/query-params.md
docs/en/docs/tutorial/request-files.md
docs/en/docs/tutorial/request-form-models.md
docs/en/docs/tutorial/request-forms-and-files.md
docs/en/docs/tutorial/request-forms.md
docs/en/docs/tutorial/response-model.md
docs/en/docs/tutorial/response-status-code.md
docs/en/docs/tutorial/schema-extra-example.md
docs/en/docs/tutorial/security/first-steps.md
docs/en/docs/tutorial/security/get-current-user.md
docs/en/docs/tutorial/security/oauth2-jwt.md
docs/en/docs/tutorial/security/simple-oauth2.md
docs/en/docs/tutorial/sql-databases.md
docs/en/docs/tutorial/static-files.md
docs/en/docs/tutorial/testing.md
docs/en/mkdocs.yml
docs/es/docs/advanced/additional-status-codes.md
docs/es/docs/advanced/path-operation-advanced-configuration.md
docs/es/docs/advanced/response-change-status-code.md
docs/es/docs/advanced/response-directly.md
docs/es/docs/advanced/response-headers.md
docs/es/docs/how-to/graphql.md
docs/es/docs/python-types.md
docs/es/docs/tutorial/cookie-params.md
docs/es/docs/tutorial/first-steps.md
docs/es/docs/tutorial/path-params.md
docs/es/docs/tutorial/query-params.md
docs/fa/docs/advanced/sub-applications.md
docs/fa/docs/tutorial/middleware.md
docs/fr/docs/advanced/additional-responses.md
docs/fr/docs/advanced/additional-status-codes.md
docs/fr/docs/advanced/path-operation-advanced-configuration.md
docs/fr/docs/advanced/response-directly.md
docs/fr/docs/python-types.md
docs/fr/docs/tutorial/background-tasks.md
docs/fr/docs/tutorial/body-multiple-params.md
docs/fr/docs/tutorial/body.md
docs/fr/docs/tutorial/debugging.md
docs/fr/docs/tutorial/first-steps.md
docs/fr/docs/tutorial/path-params-numeric-validations.md
docs/fr/docs/tutorial/path-params.md
docs/fr/docs/tutorial/query-params-str-validations.md
docs/fr/docs/tutorial/query-params.md
docs/ja/docs/advanced/additional-status-codes.md
docs/ja/docs/advanced/custom-response.md
docs/ja/docs/advanced/path-operation-advanced-configuration.md
docs/ja/docs/advanced/response-directly.md
docs/ja/docs/advanced/websockets.md
docs/ja/docs/how-to/conditional-openapi.md
docs/ja/docs/python-types.md
docs/ja/docs/tutorial/background-tasks.md
docs/ja/docs/tutorial/body-fields.md
docs/ja/docs/tutorial/body-multiple-params.md
docs/ja/docs/tutorial/body-nested-models.md
docs/ja/docs/tutorial/body-updates.md
docs/ja/docs/tutorial/body.md
docs/ja/docs/tutorial/cookie-params.md
docs/ja/docs/tutorial/cors.md
docs/ja/docs/tutorial/debugging.md
docs/ja/docs/tutorial/dependencies/classes-as-dependencies.md
docs/ja/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
docs/ja/docs/tutorial/dependencies/dependencies-with-yield.md
docs/ja/docs/tutorial/dependencies/index.md
docs/ja/docs/tutorial/dependencies/sub-dependencies.md
docs/ja/docs/tutorial/encoder.md
docs/ja/docs/tutorial/extra-data-types.md
docs/ja/docs/tutorial/extra-models.md
docs/ja/docs/tutorial/first-steps.md
docs/ja/docs/tutorial/handling-errors.md
docs/ja/docs/tutorial/header-params.md
docs/ja/docs/tutorial/metadata.md
docs/ja/docs/tutorial/middleware.md
docs/ja/docs/tutorial/path-operation-configuration.md
docs/ja/docs/tutorial/path-params-numeric-validations.md
docs/ja/docs/tutorial/path-params.md
docs/ja/docs/tutorial/query-params-str-validations.md
docs/ja/docs/tutorial/query-params.md
docs/ja/docs/tutorial/request-forms-and-files.md
docs/ja/docs/tutorial/request-forms.md
docs/ja/docs/tutorial/response-model.md
docs/ja/docs/tutorial/response-status-code.md
docs/ja/docs/tutorial/schema-extra-example.md
docs/ja/docs/tutorial/security/first-steps.md
docs/ja/docs/tutorial/security/get-current-user.md
docs/ja/docs/tutorial/security/oauth2-jwt.md
docs/ja/docs/tutorial/static-files.md
docs/ja/docs/tutorial/testing.md
docs/ko/docs/advanced/events.md
docs/ko/docs/python-types.md
docs/ko/docs/tutorial/background-tasks.md
docs/ko/docs/tutorial/body-fields.md
docs/ko/docs/tutorial/body-multiple-params.md
docs/ko/docs/tutorial/body-nested-models.md
docs/ko/docs/tutorial/body.md
docs/ko/docs/tutorial/cookie-params.md
docs/ko/docs/tutorial/cors.md
docs/ko/docs/tutorial/debugging.md
docs/ko/docs/tutorial/dependencies/classes-as-dependencies.md
docs/ko/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
docs/ko/docs/tutorial/dependencies/global-dependencies.md
docs/ko/docs/tutorial/dependencies/index.md
docs/ko/docs/tutorial/encoder.md
docs/ko/docs/tutorial/extra-data-types.md
docs/ko/docs/tutorial/first-steps.md
docs/ko/docs/tutorial/header-params.md
docs/ko/docs/tutorial/middleware.md
docs/ko/docs/tutorial/path-operation-configuration.md
docs/ko/docs/tutorial/path-params-numeric-validations.md
docs/ko/docs/tutorial/path-params.md
docs/ko/docs/tutorial/query-params-str-validations.md
docs/ko/docs/tutorial/query-params.md
docs/ko/docs/tutorial/request-files.md
docs/ko/docs/tutorial/request-forms-and-files.md
docs/ko/docs/tutorial/response-model.md
docs/ko/docs/tutorial/response-status-code.md
docs/ko/docs/tutorial/schema-extra-example.md
docs/ko/docs/tutorial/security/get-current-user.md
docs/ko/docs/tutorial/security/simple-oauth2.md
docs/ko/docs/tutorial/static-files.md
docs/nl/docs/python-types.md
docs/pl/docs/tutorial/first-steps.md
docs/pt/docs/advanced/additional-responses.md
docs/pt/docs/advanced/additional-status-codes.md
docs/pt/docs/advanced/advanced-dependencies.md
docs/pt/docs/advanced/async-tests.md
docs/pt/docs/advanced/behind-a-proxy.md
docs/pt/docs/advanced/events.md
docs/pt/docs/advanced/openapi-webhooks.md
docs/pt/docs/advanced/response-change-status-code.md
docs/pt/docs/advanced/response-directly.md
docs/pt/docs/advanced/security/http-basic-auth.md
docs/pt/docs/advanced/security/oauth2-scopes.md
docs/pt/docs/advanced/settings.md
docs/pt/docs/advanced/sub-applications.md
docs/pt/docs/advanced/templates.md
docs/pt/docs/advanced/testing-dependencies.md
docs/pt/docs/advanced/testing-events.md
docs/pt/docs/advanced/testing-websockets.md
docs/pt/docs/advanced/using-request-directly.md
docs/pt/docs/advanced/wsgi.md
docs/pt/docs/how-to/conditional-openapi.md
docs/pt/docs/how-to/configure-swagger-ui.md
docs/pt/docs/how-to/graphql.md
docs/pt/docs/python-types.md
docs/pt/docs/tutorial/background-tasks.md
docs/pt/docs/tutorial/bigger-applications.md
docs/pt/docs/tutorial/body-fields.md
docs/pt/docs/tutorial/body-multiple-params.md
docs/pt/docs/tutorial/body-nested-models.md
docs/pt/docs/tutorial/body.md
docs/pt/docs/tutorial/cookie-params.md
docs/pt/docs/tutorial/cors.md
docs/pt/docs/tutorial/debugging.md
docs/pt/docs/tutorial/dependencies/classes-as-dependencies.md
docs/pt/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
docs/pt/docs/tutorial/dependencies/dependencies-with-yield.md
docs/pt/docs/tutorial/dependencies/global-dependencies.md
docs/pt/docs/tutorial/dependencies/index.md
docs/pt/docs/tutorial/dependencies/sub-dependencies.md
docs/pt/docs/tutorial/encoder.md
docs/pt/docs/tutorial/extra-data-types.md
docs/pt/docs/tutorial/extra-models.md
docs/pt/docs/tutorial/first-steps.md
docs/pt/docs/tutorial/handling-errors.md
docs/pt/docs/tutorial/header-params.md
docs/pt/docs/tutorial/middleware.md
docs/pt/docs/tutorial/path-operation-configuration.md
docs/pt/docs/tutorial/path-params-numeric-validations.md
docs/pt/docs/tutorial/path-params.md
docs/pt/docs/tutorial/query-params-str-validations.md
docs/pt/docs/tutorial/query-params.md
docs/pt/docs/tutorial/request-form-models.md
docs/pt/docs/tutorial/request-forms-and-files.md
docs/pt/docs/tutorial/request-forms.md
docs/pt/docs/tutorial/request_files.md
docs/pt/docs/tutorial/response-status-code.md
docs/pt/docs/tutorial/schema-extra-example.md
docs/pt/docs/tutorial/security/first-steps.md
docs/pt/docs/tutorial/static-files.md
docs/pt/docs/tutorial/testing.md
docs/ru/docs/python-types.md
docs/ru/docs/tutorial/background-tasks.md
docs/ru/docs/tutorial/body-fields.md
docs/ru/docs/tutorial/body-multiple-params.md
docs/ru/docs/tutorial/body-nested-models.md
docs/ru/docs/tutorial/body-updates.md
docs/ru/docs/tutorial/body.md
docs/ru/docs/tutorial/cookie-params.md
docs/ru/docs/tutorial/cors.md
docs/ru/docs/tutorial/debugging.md
docs/ru/docs/tutorial/dependencies/classes-as-dependencies.md
docs/ru/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
docs/ru/docs/tutorial/dependencies/dependencies-with-yield.md
docs/ru/docs/tutorial/dependencies/global-dependencies.md
docs/ru/docs/tutorial/dependencies/index.md
docs/ru/docs/tutorial/dependencies/sub-dependencies.md
docs/ru/docs/tutorial/encoder.md
docs/ru/docs/tutorial/extra-data-types.md
docs/ru/docs/tutorial/extra-models.md
docs/ru/docs/tutorial/first-steps.md
docs/ru/docs/tutorial/handling-errors.md
docs/ru/docs/tutorial/header-params.md
docs/ru/docs/tutorial/metadata.md
docs/ru/docs/tutorial/path-operation-configuration.md
docs/ru/docs/tutorial/path-params-numeric-validations.md
docs/ru/docs/tutorial/path-params.md
docs/ru/docs/tutorial/query-params-str-validations.md
docs/ru/docs/tutorial/query-params.md
docs/ru/docs/tutorial/request-files.md
docs/ru/docs/tutorial/request-forms-and-files.md
docs/ru/docs/tutorial/request-forms.md
docs/ru/docs/tutorial/response-model.md
docs/ru/docs/tutorial/response-status-code.md
docs/ru/docs/tutorial/schema-extra-example.md
docs/ru/docs/tutorial/security/first-steps.md
docs/ru/docs/tutorial/static-files.md
docs/ru/docs/tutorial/testing.md
docs/tr/docs/advanced/testing-websockets.md
docs/tr/docs/advanced/wsgi.md
docs/tr/docs/python-types.md
docs/tr/docs/tutorial/cookie-params.md
docs/tr/docs/tutorial/first-steps.md
docs/tr/docs/tutorial/path-params.md
docs/tr/docs/tutorial/query-params.md
docs/tr/docs/tutorial/request-forms.md
docs/tr/docs/tutorial/static-files.md
docs/uk/docs/python-types.md
docs/uk/docs/tutorial/body-fields.md
docs/uk/docs/tutorial/body.md
docs/uk/docs/tutorial/cookie-params.md
docs/uk/docs/tutorial/encoder.md
docs/uk/docs/tutorial/extra-data-types.md
docs/uk/docs/tutorial/first-steps.md
docs/vi/docs/python-types.md
docs/vi/docs/tutorial/first-steps.md
docs/zh/docs/advanced/additional-responses.md
docs/zh/docs/advanced/additional-status-codes.md
docs/zh/docs/advanced/advanced-dependencies.md
docs/zh/docs/advanced/behind-a-proxy.md
docs/zh/docs/advanced/custom-response.md
docs/zh/docs/advanced/dataclasses.md
docs/zh/docs/advanced/events.md
docs/zh/docs/advanced/generate-clients.md
docs/zh/docs/advanced/middleware.md
docs/zh/docs/advanced/openapi-callbacks.md
docs/zh/docs/advanced/path-operation-advanced-configuration.md
docs/zh/docs/advanced/response-change-status-code.md
docs/zh/docs/advanced/response-cookies.md
docs/zh/docs/advanced/response-directly.md
docs/zh/docs/advanced/response-headers.md
docs/zh/docs/advanced/security/http-basic-auth.md
docs/zh/docs/advanced/security/oauth2-scopes.md
docs/zh/docs/advanced/settings.md
docs/zh/docs/advanced/sub-applications.md
docs/zh/docs/advanced/templates.md
docs/zh/docs/advanced/testing-database.md
docs/zh/docs/advanced/testing-dependencies.md
docs/zh/docs/advanced/testing-events.md
docs/zh/docs/advanced/testing-websockets.md
docs/zh/docs/advanced/using-request-directly.md
docs/zh/docs/advanced/websockets.md
docs/zh/docs/advanced/wsgi.md
docs/zh/docs/how-to/configure-swagger-ui.md
docs/zh/docs/python-types.md
docs/zh/docs/tutorial/background-tasks.md
docs/zh/docs/tutorial/bigger-applications.md
docs/zh/docs/tutorial/body-fields.md
docs/zh/docs/tutorial/body-multiple-params.md
docs/zh/docs/tutorial/body-nested-models.md
docs/zh/docs/tutorial/body-updates.md
docs/zh/docs/tutorial/body.md
docs/zh/docs/tutorial/cookie-params.md
docs/zh/docs/tutorial/cors.md
docs/zh/docs/tutorial/debugging.md
docs/zh/docs/tutorial/dependencies/classes-as-dependencies.md
docs/zh/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md
docs/zh/docs/tutorial/dependencies/dependencies-with-yield.md
docs/zh/docs/tutorial/dependencies/global-dependencies.md
docs/zh/docs/tutorial/dependencies/index.md
docs/zh/docs/tutorial/dependencies/sub-dependencies.md
docs/zh/docs/tutorial/encoder.md
docs/zh/docs/tutorial/extra-data-types.md
docs/zh/docs/tutorial/extra-models.md
docs/zh/docs/tutorial/first-steps.md
docs/zh/docs/tutorial/handling-errors.md
docs/zh/docs/tutorial/header-params.md
docs/zh/docs/tutorial/metadata.md
docs/zh/docs/tutorial/middleware.md
docs/zh/docs/tutorial/path-operation-configuration.md
docs/zh/docs/tutorial/path-params-numeric-validations.md
docs/zh/docs/tutorial/path-params.md
docs/zh/docs/tutorial/query-params-str-validations.md
docs/zh/docs/tutorial/query-params.md
docs/zh/docs/tutorial/request-files.md
docs/zh/docs/tutorial/request-forms-and-files.md
docs/zh/docs/tutorial/request-forms.md
docs/zh/docs/tutorial/response-model.md
docs/zh/docs/tutorial/response-status-code.md
docs/zh/docs/tutorial/schema-extra-example.md
docs/zh/docs/tutorial/security/first-steps.md
docs/zh/docs/tutorial/security/get-current-user.md
docs/zh/docs/tutorial/security/oauth2-jwt.md
docs/zh/docs/tutorial/security/simple-oauth2.md
docs/zh/docs/tutorial/sql-databases.md
docs/zh/docs/tutorial/static-files.md
docs/zh/docs/tutorial/testing.md

index d5304a65e317798509c5cbe2b452e392a6d8fee7..4a602b679d050391adbf95ef07192d0dcbb6d625 100644 (file)
@@ -23,7 +23,7 @@ Python-এ ঐচ্ছিক "টাইপ হিন্ট" (যা "টাই
 চলুন একটি সাধারণ উদাহরণ দিয়ে শুরু করি:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 এই প্রোগ্রামটি কল করলে আউটপুট হয়:
@@ -39,7 +39,7 @@ John Doe
 * তাদেরকে মাঝখানে একটি স্পেস দিয়ে <abbr title="একটার পরে একটা একত্রিত করা">concatenate</abbr> করে।
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### এটি সম্পাদনা করুন
@@ -83,7 +83,7 @@ John Doe
 এগুলিই "টাইপ হিন্ট":
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 এটি ডিফল্ট ভ্যালু ঘোষণা করার মত নয় যেমন:
@@ -113,7 +113,7 @@ John Doe
 এই ফাংশনটি দেখুন, এটিতে ইতিমধ্যে টাইপ হিন্ট রয়েছে:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 এডিটর ভেরিয়েবলগুলির টাইপ জানার কারণে, আপনি শুধুমাত্র অটোকমপ্লিশনই পান না, আপনি এরর চেকও পান:
@@ -123,7 +123,7 @@ John Doe
 এখন আপনি জানেন যে আপনাকে এটি ঠিক করতে হবে, `age`-কে একটি স্ট্রিং হিসেবে রূপান্তর করতে `str(age)` ব্যবহার করতে হবে:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## টাইপ ঘোষণা
@@ -144,7 +144,7 @@ John Doe
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### টাইপ প্যারামিটার সহ জেনেরিক টাইপ
@@ -182,7 +182,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্
 যেহেতু লিস্ট এমন একটি টাইপ যা অভ্যন্তরীণ টাইপগুলি ধারণ করে, আপনি তাদের স্কোয়ার ব্রাকেটের ভিতরে ব্যবহার করুন:
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006_py39.py!}
+{!> ../../docs_src/python_types/tutorial006_py39.py!}
 ```
 
 ////
@@ -192,7 +192,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্
 `typing` থেকে `List` (বড় হাতের `L` দিয়ে) ইমপোর্ট করুন:
 
 ``` Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 ভেরিয়েবলটি ঘোষণা করুন, একই কোলন (`:`) সিনট্যাক্স ব্যবহার করে।
@@ -202,7 +202,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্
 যেহেতু লিস্ট এমন একটি টাইপ যা অভ্যন্তরীণ টাইপগুলি ধারণ করে, আপনি তাদের স্কোয়ার ব্রাকেটের ভিতরে করুন:
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 ////
@@ -240,7 +240,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্
 //// tab | Python 3.9+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial007_py39.py!}
+{!> ../../docs_src/python_types/tutorial007_py39.py!}
 ```
 
 ////
@@ -248,7 +248,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial007.py!}
+{!> ../../docs_src/python_types/tutorial007.py!}
 ```
 
 ////
@@ -269,7 +269,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্
 //// tab | Python 3.9+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008_py39.py!}
+{!> ../../docs_src/python_types/tutorial008_py39.py!}
 ```
 
 ////
@@ -277,7 +277,7 @@ Python যত এগিয়ে যাচ্ছে, **নতুন সংস্
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008.py!}
+{!> ../../docs_src/python_types/tutorial008.py!}
 ```
 
 ////
@@ -299,7 +299,7 @@ Python 3.10-এ একটি **নতুন সিনট্যাক্স** আ
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008b_py310.py!}
+{!> ../../docs_src/python_types/tutorial008b_py310.py!}
 ```
 
 ////
@@ -307,7 +307,7 @@ Python 3.10-এ একটি **নতুন সিনট্যাক্স** আ
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008b.py!}
+{!> ../../docs_src/python_types/tutorial008b.py!}
 ```
 
 ////
@@ -321,7 +321,7 @@ Python 3.10-এ একটি **নতুন সিনট্যাক্স** আ
 Python 3.6 এবং তার উপরের সংস্করণগুলিতে (Python 3.10 অনতর্ভুক্ত) আপনি `typing` মডিউল থেকে `Optional` ইমপোর্ট করে এটি ঘোষণা এবং ব্যবহার করতে পারেন।
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 `Optional[str]` ব্যবহার করা মানে হল শুধু `str` নয়, এটি হতে পারে `None`-ও, যা আপনার এডিটরকে সেই ত্রুটিগুলি শনাক্ত করতে সাহায্য করবে যেখানে আপনি ধরে নিচ্ছেন যে একটি মান সবসময় `str` হবে, অথচ এটি `None`-ও হতে পারেও।
@@ -333,7 +333,7 @@ Python 3.6 এবং তার উপরের সংস্করণগুলি
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial009_py310.py!}
+{!> ../../docs_src/python_types/tutorial009_py310.py!}
 ```
 
 ////
@@ -341,7 +341,7 @@ Python 3.6 এবং তার উপরের সংস্করণগুলি
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009.py!}
+{!> ../../docs_src/python_types/tutorial009.py!}
 ```
 
 ////
@@ -349,7 +349,7 @@ Python 3.6 এবং তার উপরের সংস্করণগুলি
 //// tab | Python 3.8+ বিকল্প
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009b.py!}
+{!> ../../docs_src/python_types/tutorial009b.py!}
 ```
 
 ////
@@ -370,7 +370,7 @@ Python 3.6 এবং তার উপরের সংস্করণগুলি
 একটি উদাহরণ হিসেবে, এই ফাংশনটি নিন:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009c.py!}
+{!../../docs_src/python_types/tutorial009c.py!}
 ```
 
 `name` প্যারামিটারটি `Optional[str]` হিসেবে সংজ্ঞায়িত হয়েছে, কিন্তু এটি **অপশনাল নয়**, আপনি প্যারামিটার ছাড়া ফাংশনটি কল করতে পারবেন না:
@@ -388,7 +388,7 @@ say_hi(name=None)  # এটি কাজ করে, None বৈধ 🎉
 সুখবর হল, একবার আপনি Python 3.10 ব্যবহার করা শুরু করলে, আপনাকে এগুলোর ব্যাপারে আর চিন্তা করতে হবে না, যেহুতু আপনি | ব্যবহার করেই ইউনিয়ন ঘোষণা করতে পারবেন:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009c_py310.py!}
+{!../../docs_src/python_types/tutorial009c_py310.py!}
 ```
 
 এবং তারপর আপনাকে নামগুলি যেমন `Optional` এবং `Union` নিয়ে আর চিন্তা করতে হবে না। 😎
@@ -452,13 +452,13 @@ Python 3.10-এ, `Union` এবং `Optional` জেনেরিকস ব্য
 ধরুন আপনার কাছে `Person` নামে একটি ক্লাস আছে, যার একটি নাম আছে:
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 তারপর আপনি একটি ভেরিয়েবলকে `Person` টাইপের হিসেবে ঘোষণা করতে পারেন:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 এবং তারপর, আবার, আপনি এডিটর সাপোর্ট পেয়ে যাবেন:
@@ -486,7 +486,7 @@ Python 3.10-এ, `Union` এবং `Optional` জেনেরিকস ব্য
 //// tab | Python 3.10+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py310.py!}
+{!> ../../docs_src/python_types/tutorial011_py310.py!}
 ```
 
 ////
@@ -494,7 +494,7 @@ Python 3.10-এ, `Union` এবং `Optional` জেনেরিকস ব্য
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py39.py!}
+{!> ../../docs_src/python_types/tutorial011_py39.py!}
 ```
 
 ////
@@ -502,7 +502,7 @@ Python 3.10-এ, `Union` এবং `Optional` জেনেরিকস ব্য
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011.py!}
+{!> ../../docs_src/python_types/tutorial011.py!}
 ```
 
 ////
@@ -532,7 +532,7 @@ Python-এ এমন একটি ফিচার আছে যা `Annotated` 
 Python 3.9-এ, `Annotated` স্ট্যান্ডার্ড লাইব্রেরিতে অন্তর্ভুক্ত, তাই আপনি এটি `typing` থেকে ইমপোর্ট করতে পারেন।
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial013_py39.py!}
+{!> ../../docs_src/python_types/tutorial013_py39.py!}
 ```
 
 ////
@@ -544,7 +544,7 @@ Python 3.9-এর নীচের সংস্করণগুলিতে, আ
 এটি **FastAPI** এর সাথে ইতিমদ্ধে ইনস্টল হয়ে থাকবে।
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial013.py!}
+{!> ../../docs_src/python_types/tutorial013.py!}
 ```
 
 ////
index 6f2c4b2dd844e4649b3e9633e8ba576caa7ab79d..a87c564910043565628c2dac3bcfb2cf7b23cabc 100644 (file)
@@ -27,7 +27,7 @@ Jedes dieser Response-`dict`s kann einen Schlüssel `model` haben, welcher ein P
 Um beispielsweise eine weitere Response mit dem Statuscode `404` und einem Pydantic-Modell `Message` zu deklarieren, können Sie schreiben:
 
 ```Python hl_lines="18  22"
-{!../../../docs_src/additional_responses/tutorial001.py!}
+{!../../docs_src/additional_responses/tutorial001.py!}
 ```
 
 /// note | "Hinweis"
@@ -178,7 +178,7 @@ Sie können denselben `responses`-Parameter verwenden, um verschiedene Medientyp
 Sie können beispielsweise einen zusätzlichen Medientyp `image/png` hinzufügen und damit deklarieren, dass Ihre *Pfadoperation* ein JSON-Objekt (mit dem Medientyp `application/json`) oder ein PNG-Bild zurückgeben kann:
 
 ```Python hl_lines="19-24  28"
-{!../../../docs_src/additional_responses/tutorial002.py!}
+{!../../docs_src/additional_responses/tutorial002.py!}
 ```
 
 /// note | "Hinweis"
@@ -208,7 +208,7 @@ Sie können beispielsweise eine Response mit dem Statuscode `404` deklarieren, d
 Und eine Response mit dem Statuscode `200`, die Ihr `response_model` verwendet, aber ein benutzerdefiniertes Beispiel (`example`) enthält:
 
 ```Python hl_lines="20-31"
-{!../../../docs_src/additional_responses/tutorial003.py!}
+{!../../docs_src/additional_responses/tutorial003.py!}
 ```
 
 Es wird alles kombiniert und in Ihre OpenAPI eingebunden und in der API-Dokumentation angezeigt:
@@ -244,7 +244,7 @@ Mit dieser Technik können Sie einige vordefinierte Responses in Ihren *Pfadoper
 Zum Beispiel:
 
 ```Python hl_lines="13-17  26"
-{!../../../docs_src/additional_responses/tutorial004.py!}
+{!../../docs_src/additional_responses/tutorial004.py!}
 ```
 
 ## Weitere Informationen zu OpenAPI-Responses
index 672efee51caecb05aa2fb7e63201aee441550a82..fc8d09e4cefb0e5f625bb7ca7bce289b4f971177 100644 (file)
@@ -17,7 +17,7 @@ Um dies zu erreichen, importieren Sie `JSONResponse`, und geben Sie Ihren Inhalt
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  25"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an_py310.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Um dies zu erreichen, importieren Sie `JSONResponse`, und geben Sie Ihren Inhalt
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  25"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an_py39.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -33,7 +33,7 @@ Um dies zu erreichen, importieren Sie `JSONResponse`, und geben Sie Ihren Inhalt
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  26"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="2  23"
-{!> ../../../docs_src/additional_status_codes/tutorial001_py310.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_py310.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="4  25"
-{!> ../../../docs_src/additional_status_codes/tutorial001.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001.py!}
 ```
 
 ////
index f29970872675de082ab46cd2336148b26122e564..54351714e396b731104afe400d005f9026483e2a 100644 (file)
@@ -21,7 +21,7 @@ Dazu deklarieren wir eine Methode `__call__`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -29,7 +29,7 @@ Dazu deklarieren wir eine Methode `__call__`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@ Und jetzt können wir `__init__` verwenden, um die Parameter der Instanz zu dekl
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -65,7 +65,7 @@ Und jetzt können wir `__init__` verwenden, um die Parameter der Instanz zu dekl
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@ Wir könnten eine Instanz dieser Klasse erstellen mit:
 //// tab | Python 3.9+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -101,7 +101,7 @@ Wir könnten eine Instanz dieser Klasse erstellen mit:
 //// tab | Python 3.8+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
 ```
 
 ////
@@ -115,7 +115,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
 ```
 
 ////
@@ -137,7 +137,7 @@ checker(q="somequery")
 //// tab | Python 3.9+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -145,7 +145,7 @@ checker(q="somequery")
 //// tab | Python 3.8+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
 ```
 
 ////
@@ -159,7 +159,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
 ```
 
 ////
index e56841faadf4dcc6f23415448230925f6a7d8290..93ff84b8a88976551d76c07cddbb02596ea32e87 100644 (file)
@@ -33,13 +33,13 @@ Betrachten wir als einfaches Beispiel eine Dateistruktur ähnlich der in [Größ
 Die Datei `main.py` hätte als Inhalt:
 
 ```Python
-{!../../../docs_src/async_tests/main.py!}
+{!../../docs_src/async_tests/main.py!}
 ```
 
 Die Datei `test_main.py` hätte die Tests für `main.py`, das könnte jetzt so aussehen:
 
 ```Python
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
 ```
 
 ## Es ausführen
@@ -61,7 +61,7 @@ $ pytest
 Der Marker `@pytest.mark.anyio` teilt pytest mit, dass diese Testfunktion asynchron aufgerufen werden soll:
 
 ```Python hl_lines="7"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
 ```
 
 /// tip | "Tipp"
@@ -73,7 +73,7 @@ Beachten Sie, dass die Testfunktion jetzt `async def` ist und nicht nur `def` wi
 Dann können wir einen `AsyncClient` mit der App erstellen und mit `await` asynchrone Requests an ihn senden.
 
 ```Python hl_lines="9-12"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
 ```
 
 Das ist das Äquivalent zu:
index 18f90ebde863570217605955efe78057a6badf59..74b25308a8b6126f3d27d0bb928532aa1e85fc16 100644 (file)
@@ -19,7 +19,7 @@ In diesem Fall würde der ursprüngliche Pfad `/app` tatsächlich unter `/api/v1
 Auch wenn Ihr gesamter Code unter der Annahme geschrieben ist, dass es nur `/app` gibt.
 
 ```Python hl_lines="6"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
 ```
 
 Und der Proxy würde das **Pfadpräfix** on-the-fly **"entfernen**", bevor er die Anfrage an Uvicorn übermittelt, dafür sorgend, dass Ihre Anwendung davon überzeugt ist, dass sie unter `/app` bereitgestellt wird, sodass Sie nicht Ihren gesamten Code dahingehend aktualisieren müssen, das Präfix `/api/v1` zu verwenden.
@@ -99,7 +99,7 @@ Sie können den aktuellen `root_path` abrufen, der von Ihrer Anwendung für jede
 Hier fügen wir ihn, nur zu Demonstrationszwecken, in die Nachricht ein.
 
 ```Python hl_lines="8"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
 ```
 
 Wenn Sie Uvicorn dann starten mit:
@@ -128,7 +128,7 @@ wäre die Response etwa:
 Falls Sie keine Möglichkeit haben, eine Kommandozeilenoption wie `--root-path` oder ähnlich zu übergeben, können Sie als Alternative beim Erstellen Ihrer FastAPI-Anwendung den Parameter `root_path` setzen:
 
 ```Python hl_lines="3"
-{!../../../docs_src/behind_a_proxy/tutorial002.py!}
+{!../../docs_src/behind_a_proxy/tutorial002.py!}
 ```
 
 Die Übergabe des `root_path` an `FastAPI` wäre das Äquivalent zur Übergabe der `--root-path`-Kommandozeilenoption an Uvicorn oder Hypercorn.
@@ -310,7 +310,7 @@ Wenn Sie eine benutzerdefinierte Liste von Servern (`servers`) übergeben und es
 Zum Beispiel:
 
 ```Python hl_lines="4-7"
-{!../../../docs_src/behind_a_proxy/tutorial003.py!}
+{!../../docs_src/behind_a_proxy/tutorial003.py!}
 ```
 
 Erzeugt ein OpenAPI-Schema, wie:
@@ -359,7 +359,7 @@ Die Dokumentationsoberfläche interagiert mit dem von Ihnen ausgewählten Server
 Wenn Sie nicht möchten, dass **FastAPI** einen automatischen Server inkludiert, welcher `root_path` verwendet, können Sie den Parameter `root_path_in_servers=False` verwenden:
 
 ```Python hl_lines="9"
-{!../../../docs_src/behind_a_proxy/tutorial004.py!}
+{!../../docs_src/behind_a_proxy/tutorial004.py!}
 ```
 
 Dann wird er nicht in das OpenAPI-Schema aufgenommen.
index 20d6a039a82f4df28942d86de540745cd413ccbc..357d2c5629ab9b6424d3d57a5c8051a1185095a0 100644 (file)
@@ -31,7 +31,7 @@ Das liegt daran, dass FastAPI standardmäßig jedes enthaltene Element überprü
 Wenn Sie jedoch sicher sind, dass der von Ihnen zurückgegebene Inhalt **mit JSON serialisierbar** ist, können Sie ihn direkt an die Response-Klasse übergeben und die zusätzliche Arbeit vermeiden, die FastAPI hätte, indem es Ihren zurückgegebenen Inhalt durch den `jsonable_encoder` leitet, bevor es ihn an die Response-Klasse übergibt.
 
 ```Python hl_lines="2  7"
-{!../../../docs_src/custom_response/tutorial001b.py!}
+{!../../docs_src/custom_response/tutorial001b.py!}
 ```
 
 /// info
@@ -58,7 +58,7 @@ Um eine Response mit HTML direkt von **FastAPI** zurückzugeben, verwenden Sie `
 * Übergeben Sie `HTMLResponse` als den Parameter `response_class` Ihres *Pfadoperation-Dekorators*.
 
 ```Python hl_lines="2  7"
-{!../../../docs_src/custom_response/tutorial002.py!}
+{!../../docs_src/custom_response/tutorial002.py!}
 ```
 
 /// info
@@ -78,7 +78,7 @@ Wie in [Eine Response direkt zurückgeben](response-directly.md){.internal-link
 Das gleiche Beispiel von oben, das eine `HTMLResponse` zurückgibt, könnte so aussehen:
 
 ```Python hl_lines="2  7  19"
-{!../../../docs_src/custom_response/tutorial003.py!}
+{!../../docs_src/custom_response/tutorial003.py!}
 ```
 
 /// warning | "Achtung"
@@ -104,7 +104,7 @@ Die `response_class` wird dann nur zur Dokumentation der OpenAPI-Pfadoperation*
 Es könnte zum Beispiel so etwas sein:
 
 ```Python hl_lines="7  21  23"
-{!../../../docs_src/custom_response/tutorial004.py!}
+{!../../docs_src/custom_response/tutorial004.py!}
 ```
 
 In diesem Beispiel generiert die Funktion `generate_html_response()` bereits eine `Response` und gibt sie zurück, anstatt das HTML in einem `str` zurückzugeben.
@@ -145,7 +145,7 @@ Sie akzeptiert die folgenden Parameter:
 FastAPI (eigentlich Starlette) fügt automatisch einen Content-Length-Header ein. Außerdem wird es einen Content-Type-Header einfügen, der auf dem media_type basiert, und für Texttypen einen Zeichensatz (charset) anfügen.
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ### `HTMLResponse`
@@ -157,7 +157,7 @@ Nimmt Text oder Bytes entgegen und gibt eine HTML-Response zurück, wie Sie oben
 Nimmt Text oder Bytes entgegen und gibt eine Plain-Text-Response zurück.
 
 ```Python hl_lines="2  7  9"
-{!../../../docs_src/custom_response/tutorial005.py!}
+{!../../docs_src/custom_response/tutorial005.py!}
 ```
 
 ### `JSONResponse`
@@ -181,7 +181,7 @@ Eine alternative JSON-Response mit <a href="https://github.com/ultrajson/ultrajs
 ///
 
 ```Python hl_lines="2  7"
-{!../../../docs_src/custom_response/tutorial001.py!}
+{!../../docs_src/custom_response/tutorial001.py!}
 ```
 
 /// tip | "Tipp"
@@ -197,7 +197,7 @@ Gibt eine HTTP-Weiterleitung (HTTP-Redirect) zurück. Verwendet standardmäßig
 Sie können eine `RedirectResponse` direkt zurückgeben:
 
 ```Python hl_lines="2  9"
-{!../../../docs_src/custom_response/tutorial006.py!}
+{!../../docs_src/custom_response/tutorial006.py!}
 ```
 
 ---
@@ -206,7 +206,7 @@ Oder Sie können sie im Parameter `response_class` verwenden:
 
 
 ```Python hl_lines="2  7  9"
-{!../../../docs_src/custom_response/tutorial006b.py!}
+{!../../docs_src/custom_response/tutorial006b.py!}
 ```
 
 Wenn Sie das tun, können Sie die URL direkt von Ihrer *Pfadoperation*-Funktion zurückgeben.
@@ -218,7 +218,7 @@ In diesem Fall ist der verwendete `status_code` der Standardcode für die `Redir
 Sie können den Parameter `status_code` auch in Kombination mit dem Parameter `response_class` verwenden:
 
 ```Python hl_lines="2  7  9"
-{!../../../docs_src/custom_response/tutorial006c.py!}
+{!../../docs_src/custom_response/tutorial006c.py!}
 ```
 
 ### `StreamingResponse`
@@ -226,7 +226,7 @@ Sie können den Parameter `status_code` auch in Kombination mit dem Parameter `r
 Nimmt einen asynchronen Generator oder einen normalen Generator/Iterator und streamt den Responsebody.
 
 ```Python hl_lines="2  14"
-{!../../../docs_src/custom_response/tutorial007.py!}
+{!../../docs_src/custom_response/tutorial007.py!}
 ```
 
 #### Verwendung von `StreamingResponse` mit dateiähnlichen Objekten
@@ -238,7 +238,7 @@ Auf diese Weise müssen Sie nicht alles zuerst in den Arbeitsspeicher lesen und
 Das umfasst viele Bibliotheken zur Interaktion mit Cloud-Speicher, Videoverarbeitung und anderen.
 
 ```{ .python .annotate hl_lines="2  10-12  14" }
-{!../../../docs_src/custom_response/tutorial008.py!}
+{!../../docs_src/custom_response/tutorial008.py!}
 ```
 
 1. Das ist die Generatorfunktion. Es handelt sich um eine „Generatorfunktion“, da sie `yield`-Anweisungen enthält.
@@ -269,13 +269,13 @@ Nimmt zur Instanziierung einen anderen Satz von Argumenten entgegen als die ande
 Datei-Responses enthalten die entsprechenden `Content-Length`-, `Last-Modified`- und `ETag`-Header.
 
 ```Python hl_lines="2  10"
-{!../../../docs_src/custom_response/tutorial009.py!}
+{!../../docs_src/custom_response/tutorial009.py!}
 ```
 
 Sie können auch den Parameter `response_class` verwenden:
 
 ```Python hl_lines="2  8  10"
-{!../../../docs_src/custom_response/tutorial009b.py!}
+{!../../docs_src/custom_response/tutorial009b.py!}
 ```
 
 In diesem Fall können Sie den Dateipfad direkt von Ihrer *Pfadoperation*-Funktion zurückgeben.
@@ -291,7 +291,7 @@ Sie möchten etwa, dass Ihre Response eingerücktes und formatiertes JSON zurüc
 Sie könnten eine `CustomORJSONResponse` erstellen. Das Wichtigste, was Sie tun müssen, ist, eine `Response.render(content)`-Methode zu erstellen, die den Inhalt als `bytes` zurückgibt:
 
 ```Python hl_lines="9-14  17"
-{!../../../docs_src/custom_response/tutorial009c.py!}
+{!../../docs_src/custom_response/tutorial009c.py!}
 ```
 
 Statt:
@@ -319,7 +319,7 @@ Der Parameter, der das definiert, ist `default_response_class`.
 Im folgenden Beispiel verwendet **FastAPI** standardmäßig `ORJSONResponse` in allen *Pfadoperationen*, anstelle von `JSONResponse`.
 
 ```Python hl_lines="2  4"
-{!../../../docs_src/custom_response/tutorial010.py!}
+{!../../docs_src/custom_response/tutorial010.py!}
 ```
 
 /// tip | "Tipp"
index d5a6634852c5bb57274edabf515e6290c92324e0..573f500e8c0ded375e360e23f3ef0da95cd0c492 100644 (file)
@@ -5,7 +5,7 @@ FastAPI basiert auf **Pydantic** und ich habe Ihnen gezeigt, wie Sie Pydantic-Mo
 Aber FastAPI unterstützt auf die gleiche Weise auch die Verwendung von <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a>:
 
 ```Python hl_lines="1  7-12  19-20"
-{!../../../docs_src/dataclasses/tutorial001.py!}
+{!../../docs_src/dataclasses/tutorial001.py!}
 ```
 
 Das ist dank **Pydantic** ebenfalls möglich, da es <a href="https://pydantic-docs.helpmanual.io/usage/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">`dataclasses` intern unterstützt</a>.
@@ -35,7 +35,7 @@ Wenn Sie jedoch eine Menge Datenklassen herumliegen haben, ist dies ein guter Tr
 Sie können `dataclasses` auch im Parameter `response_model` verwenden:
 
 ```Python hl_lines="1  7-13  19"
-{!../../../docs_src/dataclasses/tutorial002.py!}
+{!../../docs_src/dataclasses/tutorial002.py!}
 ```
 
 Die Datenklasse wird automatisch in eine Pydantic-Datenklasse konvertiert.
@@ -53,7 +53,7 @@ In einigen Fällen müssen Sie möglicherweise immer noch Pydantics Version von
 In diesem Fall können Sie einfach die Standard-`dataclasses` durch `pydantic.dataclasses` ersetzen, was einen direkten Ersatz darstellt:
 
 ```{ .python .annotate hl_lines="1  5  8-11  14-17  23-25  28" }
-{!../../../docs_src/dataclasses/tutorial003.py!}
+{!../../docs_src/dataclasses/tutorial003.py!}
 ```
 
 1. Wir importieren `field` weiterhin von Standard-`dataclasses`.
index e898db49b2687cc5f5fc77a6571d8bd86a8a7e4d..b0c4d3922c4e42b7dca81aaa4f028cdf1a11e31c 100644 (file)
@@ -31,7 +31,7 @@ Beginnen wir mit einem Beispiel und sehen es uns dann im Detail an.
 Wir erstellen eine asynchrone Funktion `lifespan()` mit `yield` wie folgt:
 
 ```Python hl_lines="16  19"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 Hier simulieren wir das langsame *Hochfahren*, das Laden des Modells, indem wir die (Fake-)Modellfunktion vor dem `yield` in das Dictionary mit Modellen für maschinelles Lernen einfügen. Dieser Code wird ausgeführt, **bevor** die Anwendung **beginnt, Requests entgegenzunehmen**, während des *Hochfahrens*.
@@ -51,7 +51,7 @@ Möglicherweise müssen Sie eine neue Version starten, oder Sie haben es einfach
 Das Erste, was auffällt, ist, dass wir eine asynchrone Funktion mit `yield` definieren. Das ist sehr ähnlich zu Abhängigkeiten mit `yield`.
 
 ```Python hl_lines="14-19"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 Der erste Teil der Funktion, vor dem `yield`, wird ausgeführt **bevor** die Anwendung startet.
@@ -65,7 +65,7 @@ Wie Sie sehen, ist die Funktion mit einem `@asynccontextmanager` versehen.
 Dadurch wird die Funktion in einen sogenannten „**asynchronen Kontextmanager**“ umgewandelt.
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 Ein **Kontextmanager** in Python ist etwas, das Sie in einer `with`-Anweisung verwenden können, zum Beispiel kann `open()` als Kontextmanager verwendet werden:
@@ -89,7 +89,7 @@ In unserem obigen Codebeispiel verwenden wir ihn nicht direkt, sondern übergebe
 Der Parameter `lifespan` der `FastAPI`-App benötigt einen **asynchronen Kontextmanager**, wir können ihm also unseren neuen asynchronen Kontextmanager `lifespan` übergeben.
 
 ```Python hl_lines="22"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 ## Alternative Events (deprecated)
@@ -113,7 +113,7 @@ Diese Funktionen können mit `async def` oder normalem `def` deklariert werden.
 Um eine Funktion hinzuzufügen, die vor dem Start der Anwendung ausgeführt werden soll, deklarieren Sie diese mit dem Event `startup`:
 
 ```Python hl_lines="8"
-{!../../../docs_src/events/tutorial001.py!}
+{!../../docs_src/events/tutorial001.py!}
 ```
 
 In diesem Fall initialisiert die Eventhandler-Funktion `startup` die „Datenbank“ der Items (nur ein `dict`) mit einigen Werten.
@@ -127,7 +127,7 @@ Und Ihre Anwendung empfängt erst dann Anfragen, wenn alle `startup`-Eventhandle
 Um eine Funktion hinzuzufügen, die beim Herunterfahren der Anwendung ausgeführt werden soll, deklarieren Sie sie mit dem Event `shutdown`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/events/tutorial002.py!}
+{!../../docs_src/events/tutorial002.py!}
 ```
 
 Hier schreibt die `shutdown`-Eventhandler-Funktion eine Textzeile `"Application shutdown"` in eine Datei `log.txt`.
index b8d66fdd704a3c39fa00674cc389abd094c3dff4..80c44b3f965637b01eb3d895fffb08f004a6c819 100644 (file)
@@ -31,7 +31,7 @@ Beginnen wir mit einer einfachen FastAPI-Anwendung:
 //// tab | Python 3.9+
 
 ```Python hl_lines="7-9  12-13  16-17  21"
-{!> ../../../docs_src/generate_clients/tutorial001_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial001_py39.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Beginnen wir mit einer einfachen FastAPI-Anwendung:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-11  14-15  18  19  23"
-{!> ../../../docs_src/generate_clients/tutorial001.py!}
+{!> ../../docs_src/generate_clients/tutorial001.py!}
 ```
 
 ////
@@ -150,7 +150,7 @@ Beispielsweise könnten Sie einen Abschnitt für **Items (Artikel)** und einen w
 //// tab | Python 3.9+
 
 ```Python hl_lines="21  26  34"
-{!> ../../../docs_src/generate_clients/tutorial002_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial002_py39.py!}
 ```
 
 ////
@@ -158,7 +158,7 @@ Beispielsweise könnten Sie einen Abschnitt für **Items (Artikel)** und einen w
 //// tab | Python 3.8+
 
 ```Python hl_lines="23  28  36"
-{!> ../../../docs_src/generate_clients/tutorial002.py!}
+{!> ../../docs_src/generate_clients/tutorial002.py!}
 ```
 
 ////
@@ -211,7 +211,7 @@ Anschließend können Sie diese benutzerdefinierte Funktion als Parameter `gener
 //// tab | Python 3.9+
 
 ```Python hl_lines="6-7  10"
-{!> ../../../docs_src/generate_clients/tutorial003_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial003_py39.py!}
 ```
 
 ////
@@ -219,7 +219,7 @@ Anschließend können Sie diese benutzerdefinierte Funktion als Parameter `gener
 //// tab | Python 3.8+
 
 ```Python hl_lines="8-9  12"
-{!> ../../../docs_src/generate_clients/tutorial003.py!}
+{!> ../../docs_src/generate_clients/tutorial003.py!}
 ```
 
 ////
@@ -247,7 +247,7 @@ Wir könnten das OpenAPI-JSON in eine Datei `openapi.json` herunterladen und dan
 //// tab | Python
 
 ```Python
-{!> ../../../docs_src/generate_clients/tutorial004.py!}
+{!> ../../docs_src/generate_clients/tutorial004.py!}
 ```
 
 ////
@@ -255,7 +255,7 @@ Wir könnten das OpenAPI-JSON in eine Datei `openapi.json` herunterladen und dan
 //// tab | Node.js
 
 ```Javascript
-{!> ../../../docs_src/generate_clients/tutorial004.js!}
+{!> ../../docs_src/generate_clients/tutorial004.js!}
 ```
 
 ////
index 8912225fbf256cb0bc2557e072e969012d46856d..b4001efda7a1904ea8053e15cc34f3dc82859201 100644 (file)
@@ -58,7 +58,7 @@ Erzwingt, dass alle eingehenden Requests entweder `https` oder `wss` sein müsse
 Alle eingehenden Requests an `http` oder `ws` werden stattdessen an das sichere Schema umgeleitet.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/advanced_middleware/tutorial001.py!}
+{!../../docs_src/advanced_middleware/tutorial001.py!}
 ```
 
 ## `TrustedHostMiddleware`
@@ -66,7 +66,7 @@ Alle eingehenden Requests an `http` oder `ws` werden stattdessen an das sichere
 Erzwingt, dass alle eingehenden Requests einen korrekt gesetzten `Host`-Header haben, um sich vor HTTP-Host-Header-Angriffen zu schützen.
 
 ```Python hl_lines="2  6-8"
-{!../../../docs_src/advanced_middleware/tutorial002.py!}
+{!../../docs_src/advanced_middleware/tutorial002.py!}
 ```
 
 Die folgenden Argumente werden unterstützt:
@@ -82,7 +82,7 @@ Verarbeitet GZip-Responses für alle Requests, die `"gzip"` im `Accept-Encoding`
 Diese Middleware verarbeitet sowohl Standard- als auch Streaming-Responses.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/advanced_middleware/tutorial003.py!}
+{!../../docs_src/advanced_middleware/tutorial003.py!}
 ```
 
 Die folgenden Argumente werden unterstützt:
index d7b5bc885a2d46ab9618b2403c27e925186654ec..f407d54507f97d6f2712d8ffceb2660130b5e686 100644 (file)
@@ -32,7 +32,7 @@ Sie verfügt über eine *Pfadoperation*, die einen `Invoice`-Body empfängt, und
 Dieser Teil ist ziemlich normal, der größte Teil des Codes ist Ihnen wahrscheinlich bereits bekannt:
 
 ```Python hl_lines="9-13  36-53"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 /// tip | "Tipp"
@@ -93,7 +93,7 @@ Wenn Sie diese Sichtweise (des *externen Entwicklers*) vorübergehend übernehme
 Erstellen Sie zunächst einen neuen `APIRouter`, der einen oder mehrere Callbacks enthält.
 
 ```Python hl_lines="3  25"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 ### Die Callback-*Pfadoperation* erstellen
@@ -106,7 +106,7 @@ Sie sollte wie eine normale FastAPI-*Pfadoperation* aussehen:
 * Und sie könnte auch eine Deklaration der Response enthalten, die zurückgegeben werden soll, z. B. `response_model=InvoiceEventReceived`.
 
 ```Python hl_lines="16-18  21-22  28-32"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 Es gibt zwei Hauptunterschiede zu einer normalen *Pfadoperation*:
@@ -176,7 +176,7 @@ An diesem Punkt haben Sie die benötigte(n) *Callback-Pfadoperation(en)* (diejen
 Verwenden Sie nun den Parameter `callbacks` im *Pfadoperation-Dekorator Ihrer API*, um das Attribut `.routes` (das ist eigentlich nur eine `list`e von Routen/*Pfadoperationen*) dieses Callback-Routers zu übergeben:
 
 ```Python hl_lines="35"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 /// tip | "Tipp"
index fb0daa90866446c987d22f73ff4d645a47ac3f75..9f1bb69598359778e37d3ca814a73f195a9ae3d0 100644 (file)
@@ -33,7 +33,7 @@ Webhooks sind in OpenAPI 3.1.0 und höher verfügbar und werden von FastAPI `0.9
 Wenn Sie eine **FastAPI**-Anwendung erstellen, gibt es ein `webhooks`-Attribut, mit dem Sie *Webhooks* definieren können, genauso wie Sie *Pfadoperationen* definieren würden, zum Beispiel mit `@app.webhooks.post()`.
 
 ```Python hl_lines="9-13  36-53"
-{!../../../docs_src/openapi_webhooks/tutorial001.py!}
+{!../../docs_src/openapi_webhooks/tutorial001.py!}
 ```
 
 Die von Ihnen definierten Webhooks landen im **OpenAPI**-Schema und der automatischen **Dokumentations-Oberfläche**.
index c9cb82fe3d8de182deacc56d457bafd214fa4b1c..2d8b88be585d18c769bb0f493cb53c18d6490d3e 100644 (file)
@@ -13,7 +13,7 @@ Mit dem Parameter `operation_id` können Sie die OpenAPI `operationId` festlegen
 Sie müssten sicherstellen, dass sie für jede Operation eindeutig ist.
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
 ```
 
 ### Verwendung des Namens der *Pfadoperation-Funktion* als operationId
@@ -23,7 +23,7 @@ Wenn Sie die Funktionsnamen Ihrer API als `operationId`s verwenden möchten, kö
 Sie sollten dies tun, nachdem Sie alle Ihre *Pfadoperationen* hinzugefügt haben.
 
 ```Python hl_lines="2  12-21  24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
 ```
 
 /// tip | "Tipp"
@@ -45,7 +45,7 @@ Auch wenn diese sich in unterschiedlichen Modulen (Python-Dateien) befinden.
 Um eine *Pfadoperation* aus dem generierten OpenAPI-Schema (und damit aus den automatischen Dokumentationssystemen) auszuschließen, verwenden Sie den Parameter `include_in_schema` und setzen Sie ihn auf `False`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
 ```
 
 ## Fortgeschrittene Beschreibung mittels Docstring
@@ -57,7 +57,7 @@ Das Hinzufügen eines `\f` (ein maskiertes „Form Feed“-Zeichen) führt dazu,
 Sie wird nicht in der Dokumentation angezeigt, aber andere Tools (z. B. Sphinx) können den Rest verwenden.
 
 ```Python hl_lines="19-29"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
 ```
 
 ## Zusätzliche Responses
@@ -101,7 +101,7 @@ Sie können das OpenAPI-Schema für eine *Pfadoperation* erweitern, indem Sie de
 Dieses `openapi_extra` kann beispielsweise hilfreich sein, um <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions" class="external-link" target="_blank">OpenAPI-Erweiterungen</a> zu deklarieren:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial005.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial005.py!}
 ```
 
 Wenn Sie die automatische API-Dokumentation öffnen, wird Ihre Erweiterung am Ende der spezifischen *Pfadoperation* angezeigt.
@@ -150,7 +150,7 @@ Sie könnten sich beispielsweise dafür entscheiden, den Request mit Ihrem eigen
 Das könnte man mit `openapi_extra` machen:
 
 ```Python hl_lines="20-37  39-40"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial006.py!}
 ```
 
 In diesem Beispiel haben wir kein Pydantic-Modell deklariert. Tatsächlich wird der Requestbody nicht einmal als JSON <abbr title="von einem einfachen Format, wie Bytes, in Python-Objekte konvertieren">geparst</abbr>, sondern direkt als `bytes` gelesen und die Funktion `magic_data_reader ()` wäre dafür verantwortlich, ihn in irgendeiner Weise zu parsen.
@@ -168,7 +168,7 @@ In der folgenden Anwendung verwenden wir beispielsweise weder die integrierte Fu
 //// tab | Pydantic v2
 
 ```Python hl_lines="17-22  24"
-{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
+{!> ../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
 ```
 
 ////
@@ -176,7 +176,7 @@ In der folgenden Anwendung verwenden wir beispielsweise weder die integrierte Fu
 //// tab | Pydantic v1
 
 ```Python hl_lines="17-22  24"
-{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!}
+{!> ../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!}
 ```
 
 ////
@@ -196,7 +196,7 @@ Und dann parsen wir in unserem Code diesen YAML-Inhalt direkt und verwenden dann
 //// tab | Pydantic v2
 
 ```Python hl_lines="26-33"
-{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
+{!> ../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
 ```
 
 ////
@@ -204,7 +204,7 @@ Und dann parsen wir in unserem Code diesen YAML-Inhalt direkt und verwenden dann
 //// tab | Pydantic v1
 
 ```Python hl_lines="26-33"
-{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!}
+{!> ../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!}
 ```
 
 ////
index bba908a3eef6e35f5c863c0536b803fb9a5d4171..202df0d87f0ba29fb4a1fd9f0ed9aa548720ac10 100644 (file)
@@ -21,7 +21,7 @@ Sie können einen Parameter vom Typ `Response` in Ihrer *Pfadoperation-Funktion*
 Anschließend können Sie den `status_code` in diesem *vorübergehenden* Response-Objekt festlegen.
 
 ```Python hl_lines="1  9  12"
-{!../../../docs_src/response_change_status_code/tutorial001.py!}
+{!../../docs_src/response_change_status_code/tutorial001.py!}
 ```
 
 Und dann können Sie wie gewohnt jedes benötigte Objekt zurückgeben (ein `dict`, ein Datenbankmodell usw.).
index 3d2043565b3119fcae9b1b84e8af53da2c008cf5..ba100870daf09a900e07df08a0f9e73667c7bc5d 100644 (file)
@@ -7,7 +7,7 @@ Sie können einen Parameter vom Typ `Response` in Ihrer *Pfadoperation-Funktion*
 Und dann können Sie Cookies in diesem *vorübergehenden* Response-Objekt setzen.
 
 ```Python hl_lines="1  8-9"
-{!../../../docs_src/response_cookies/tutorial002.py!}
+{!../../docs_src/response_cookies/tutorial002.py!}
 ```
 
 Anschließend können Sie wie gewohnt jedes gewünschte Objekt zurückgeben (ein `dict`, ein Datenbankmodell, usw.).
@@ -27,7 +27,7 @@ Dazu können Sie eine Response erstellen, wie unter [Eine Response direkt zurüc
 Setzen Sie dann Cookies darin und geben Sie sie dann zurück:
 
 ```Python hl_lines="10-12"
-{!../../../docs_src/response_cookies/tutorial001.py!}
+{!../../docs_src/response_cookies/tutorial001.py!}
 ```
 
 /// tip | "Tipp"
index 377490b5691e996064f7f853aff9cfffbb377013..70c045f57432baf685af3264fd212ebabb9642a8 100644 (file)
@@ -35,7 +35,7 @@ Sie können beispielsweise kein Pydantic-Modell in eine `JSONResponse` einfügen
 In diesen Fällen können Sie den `jsonable_encoder` verwenden, um Ihre Daten zu konvertieren, bevor Sie sie an eine Response übergeben:
 
 ```Python hl_lines="6-7  21-22"
-{!../../../docs_src/response_directly/tutorial001.py!}
+{!../../docs_src/response_directly/tutorial001.py!}
 ```
 
 /// note | "Technische Details"
@@ -57,7 +57,7 @@ Nehmen wir an, Sie möchten eine <a href="https://en.wikipedia.org/wiki/XML" cla
 Sie könnten Ihren XML-Inhalt als String in eine `Response` einfügen und sie zurückgeben:
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ## Anmerkungen
index 51a364f56782aa55ecc2b9866e61fac95c11681e..31c2c9c986ac30b931ead64fa9f3694c7cec7f97 100644 (file)
@@ -7,7 +7,7 @@ Sie können einen Parameter vom Typ `Response` in Ihrer *Pfadoperation-Funktion*
 Und dann können Sie Header in diesem *vorübergehenden* Response-Objekt festlegen.
 
 ```Python hl_lines="1  7-8"
-{!../../../docs_src/response_headers/tutorial002.py!}
+{!../../docs_src/response_headers/tutorial002.py!}
 ```
 
 Anschließend können Sie wie gewohnt jedes gewünschte Objekt zurückgeben (ein `dict`, ein Datenbankmodell, usw.).
@@ -25,7 +25,7 @@ Sie können auch Header hinzufügen, wenn Sie eine `Response` direkt zurückgebe
 Erstellen Sie eine Response wie in [Eine Response direkt zurückgeben](response-directly.md){.internal-link target=_blank} beschrieben und übergeben Sie die Header als zusätzlichen Parameter:
 
 ```Python hl_lines="10-12"
-{!../../../docs_src/response_headers/tutorial001.py!}
+{!../../docs_src/response_headers/tutorial001.py!}
 ```
 
 /// note | "Technische Details"
index 3e7aeb8a03a284407719aca9ba4fe6b0de092498..4e607e6a1eeaa1dfab7fc44196a7416ba9732fed 100644 (file)
@@ -23,7 +23,7 @@ Wenn Sie dann den Benutzernamen und das Passwort eingeben, sendet der Browser di
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  8  12"
-{!> ../../../docs_src/security/tutorial006_an_py39.py!}
+{!> ../../docs_src/security/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Wenn Sie dann den Benutzernamen und das Passwort eingeben, sendet der Browser di
 //// tab | Python 3.8+
 
 ```Python hl_lines="2  7  11"
-{!> ../../../docs_src/security/tutorial006_an.py!}
+{!> ../../docs_src/security/tutorial006_an.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="2  6  10"
-{!> ../../../docs_src/security/tutorial006.py!}
+{!> ../../docs_src/security/tutorial006.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@ Dann können wir `secrets.compare_digest()` verwenden, um sicherzustellen, dass
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  12-24"
-{!> ../../../docs_src/security/tutorial007_an_py39.py!}
+{!> ../../docs_src/security/tutorial007_an_py39.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@ Dann können wir `secrets.compare_digest()` verwenden, um sicherzustellen, dass
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  12-24"
-{!> ../../../docs_src/security/tutorial007_an.py!}
+{!> ../../docs_src/security/tutorial007_an.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1  11-21"
-{!> ../../../docs_src/security/tutorial007.py!}
+{!> ../../docs_src/security/tutorial007.py!}
 ```
 
 ////
@@ -163,7 +163,7 @@ Nachdem Sie festgestellt haben, dass die Anmeldeinformationen falsch sind, geben
 //// tab | Python 3.9+
 
 ```Python hl_lines="26-30"
-{!> ../../../docs_src/security/tutorial007_an_py39.py!}
+{!> ../../docs_src/security/tutorial007_an_py39.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ Nachdem Sie festgestellt haben, dass die Anmeldeinformationen falsch sind, geben
 //// tab | Python 3.8+
 
 ```Python hl_lines="26-30"
-{!> ../../../docs_src/security/tutorial007_an.py!}
+{!> ../../docs_src/security/tutorial007_an.py!}
 ```
 
 ////
@@ -185,7 +185,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="23-27"
-{!> ../../../docs_src/security/tutorial007.py!}
+{!> ../../docs_src/security/tutorial007.py!}
 ```
 
 ////
index f02707698ec78acd5dd1d7cc9ca250e0a42ebf6c..c0af2560a2147b3f2cf22299d64661116e3079b0 100644 (file)
@@ -65,7 +65,7 @@ Sehen wir uns zunächst kurz die Teile an, die sich gegenüber den Beispielen im
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  8  12  46  64  105  107-115  121-124  128-134  139  155"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@ Sehen wir uns zunächst kurz die Teile an, die sich gegenüber den Beispielen im
 //// tab | Python 3.9+
 
 ```Python hl_lines="2  4  8  12  46  64  105  107-115  121-124  128-134  139  155"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -81,7 +81,7 @@ Sehen wir uns zunächst kurz die Teile an, die sich gegenüber den Beispielen im
 //// tab | Python 3.8+
 
 ```Python hl_lines="2  4  8  12  47  65  106  108-116  122-125  129-135  140  156"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -95,7 +95,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="3  7  11  45  63  104  106-114  120-123  127-133  138  154"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -109,7 +109,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="2  4  8  12  46  64  105  107-115  121-124  128-134  139  155"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -123,7 +123,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="2  4  8  12  46  64  105  107-115  121-124  128-134  139  155"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -139,7 +139,7 @@ Der `scopes`-Parameter erhält ein `dict` mit jedem Scope als Schlüssel und des
 //// tab | Python 3.10+
 
 ```Python hl_lines="62-65"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ Der `scopes`-Parameter erhält ein `dict` mit jedem Scope als Schlüssel und des
 //// tab | Python 3.9+
 
 ```Python hl_lines="62-65"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -155,7 +155,7 @@ Der `scopes`-Parameter erhält ein `dict` mit jedem Scope als Schlüssel und des
 //// tab | Python 3.8+
 
 ```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -169,7 +169,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="61-64"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -183,7 +183,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="62-65"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -197,7 +197,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="62-65"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -229,7 +229,7 @@ Aus Sicherheitsgründen sollten Sie jedoch sicherstellen, dass Sie in Ihrer Anwe
 //// tab | Python 3.10+
 
 ```Python hl_lines="155"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ Aus Sicherheitsgründen sollten Sie jedoch sicherstellen, dass Sie in Ihrer Anwe
 //// tab | Python 3.9+
 
 ```Python hl_lines="155"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ Aus Sicherheitsgründen sollten Sie jedoch sicherstellen, dass Sie in Ihrer Anwe
 //// tab | Python 3.8+
 
 ```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -259,7 +259,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="154"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="155"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -287,7 +287,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="155"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -319,7 +319,7 @@ Wir tun dies hier, um zu demonstrieren, wie **FastAPI** auf verschiedenen Ebenen
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  139  170"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -327,7 +327,7 @@ Wir tun dies hier, um zu demonstrieren, wie **FastAPI** auf verschiedenen Ebenen
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  139  170"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -335,7 +335,7 @@ Wir tun dies hier, um zu demonstrieren, wie **FastAPI** auf verschiedenen Ebenen
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  140  171"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -349,7 +349,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="3  138  167"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -363,7 +363,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="4  139  168"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -377,7 +377,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="4  139  168"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -409,7 +409,7 @@ Diese `SecurityScopes`-Klasse ähnelt `Request` (`Request` wurde verwendet, um d
 //// tab | Python 3.10+
 
 ```Python hl_lines="8  105"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -417,7 +417,7 @@ Diese `SecurityScopes`-Klasse ähnelt `Request` (`Request` wurde verwendet, um d
 //// tab | Python 3.9+
 
 ```Python hl_lines="8  105"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -425,7 +425,7 @@ Diese `SecurityScopes`-Klasse ähnelt `Request` (`Request` wurde verwendet, um d
 //// tab | Python 3.8+
 
 ```Python hl_lines="8  106"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -439,7 +439,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7  104"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -453,7 +453,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="8  105"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -467,7 +467,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="8  105"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -487,7 +487,7 @@ In diese Exception fügen wir (falls vorhanden) die erforderlichen Scopes als du
 //// tab | Python 3.10+
 
 ```Python hl_lines="105  107-115"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -495,7 +495,7 @@ In diese Exception fügen wir (falls vorhanden) die erforderlichen Scopes als du
 //// tab | Python 3.9+
 
 ```Python hl_lines="105  107-115"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -503,7 +503,7 @@ In diese Exception fügen wir (falls vorhanden) die erforderlichen Scopes als du
 //// tab | Python 3.8+
 
 ```Python hl_lines="106  108-116"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -517,7 +517,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="104  106-114"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -531,7 +531,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="105  107-115"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -545,7 +545,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="105  107-115"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -567,7 +567,7 @@ Wir verifizieren auch, dass wir einen Benutzer mit diesem Benutzernamen haben, u
 //// tab | Python 3.10+
 
 ```Python hl_lines="46  116-127"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -575,7 +575,7 @@ Wir verifizieren auch, dass wir einen Benutzer mit diesem Benutzernamen haben, u
 //// tab | Python 3.9+
 
 ```Python hl_lines="46  116-127"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -583,7 +583,7 @@ Wir verifizieren auch, dass wir einen Benutzer mit diesem Benutzernamen haben, u
 //// tab | Python 3.8+
 
 ```Python hl_lines="47  117-128"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -597,7 +597,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="45  115-126"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -611,7 +611,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="46  116-127"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -625,7 +625,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="46  116-127"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -639,7 +639,7 @@ Hierzu verwenden wir `security_scopes.scopes`, das eine `list`e mit allen diesen
 //// tab | Python 3.10+
 
 ```Python hl_lines="128-134"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -647,7 +647,7 @@ Hierzu verwenden wir `security_scopes.scopes`, das eine `list`e mit allen diesen
 //// tab | Python 3.9+
 
 ```Python hl_lines="128-134"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -655,7 +655,7 @@ Hierzu verwenden wir `security_scopes.scopes`, das eine `list`e mit allen diesen
 //// tab | Python 3.8+
 
 ```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -669,7 +669,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="127-133"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -683,7 +683,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="128-134"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -697,7 +697,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="128-134"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
index 3cd4c6c7d410557bb9c884229e63853fc0ee798b..8b9ba2f488c8b765729167f47862e8bc186009f1 100644 (file)
@@ -181,7 +181,7 @@ Sie können dieselben Validierungs-Funktionen und -Tools verwenden, die Sie für
 //// tab | Pydantic v2
 
 ```Python hl_lines="2  5-8  11"
-{!> ../../../docs_src/settings/tutorial001.py!}
+{!> ../../docs_src/settings/tutorial001.py!}
 ```
 
 ////
@@ -195,7 +195,7 @@ In Pydantic v1 würden Sie `BaseSettings` direkt von `pydantic` statt von `pydan
 ///
 
 ```Python hl_lines="2  5-8  11"
-{!> ../../../docs_src/settings/tutorial001_pv1.py!}
+{!> ../../docs_src/settings/tutorial001_pv1.py!}
 ```
 
 ////
@@ -215,7 +215,7 @@ Als Nächstes werden die Daten konvertiert und validiert. Wenn Sie also dieses `
 Dann können Sie das neue `settings`-Objekt in Ihrer Anwendung verwenden:
 
 ```Python hl_lines="18-20"
-{!../../../docs_src/settings/tutorial001.py!}
+{!../../docs_src/settings/tutorial001.py!}
 ```
 
 ### Den Server ausführen
@@ -251,13 +251,13 @@ Sie könnten diese Einstellungen in eine andere Moduldatei einfügen, wie Sie in
 Sie könnten beispielsweise eine Datei `config.py` haben mit:
 
 ```Python
-{!../../../docs_src/settings/app01/config.py!}
+{!../../docs_src/settings/app01/config.py!}
 ```
 
 Und dann verwenden Sie diese in einer Datei `main.py`:
 
 ```Python hl_lines="3  11-13"
-{!../../../docs_src/settings/app01/main.py!}
+{!../../docs_src/settings/app01/main.py!}
 ```
 
 /// tip | "Tipp"
@@ -277,7 +277,7 @@ Dies könnte besonders beim Testen nützlich sein, da es sehr einfach ist, eine
 Ausgehend vom vorherigen Beispiel könnte Ihre Datei `config.py` so aussehen:
 
 ```Python hl_lines="10"
-{!../../../docs_src/settings/app02/config.py!}
+{!../../docs_src/settings/app02/config.py!}
 ```
 
 Beachten Sie, dass wir jetzt keine Standardinstanz `settings = Settings()` erstellen.
@@ -289,7 +289,7 @@ Jetzt erstellen wir eine Abhängigkeit, die ein neues `config.Settings()` zurüc
 //// tab | Python 3.9+
 
 ```Python hl_lines="6  12-13"
-{!> ../../../docs_src/settings/app02_an_py39/main.py!}
+{!> ../../docs_src/settings/app02_an_py39/main.py!}
 ```
 
 ////
@@ -297,7 +297,7 @@ Jetzt erstellen wir eine Abhängigkeit, die ein neues `config.Settings()` zurüc
 //// tab | Python 3.8+
 
 ```Python hl_lines="6  12-13"
-{!> ../../../docs_src/settings/app02_an/main.py!}
+{!> ../../docs_src/settings/app02_an/main.py!}
 ```
 
 ////
@@ -311,7 +311,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="5  11-12"
-{!> ../../../docs_src/settings/app02/main.py!}
+{!> ../../docs_src/settings/app02/main.py!}
 ```
 
 ////
@@ -329,7 +329,7 @@ Und dann können wir das von der *Pfadoperation-Funktion* als Abhängigkeit einf
 //// tab | Python 3.9+
 
 ```Python hl_lines="17  19-21"
-{!> ../../../docs_src/settings/app02_an_py39/main.py!}
+{!> ../../docs_src/settings/app02_an_py39/main.py!}
 ```
 
 ////
@@ -337,7 +337,7 @@ Und dann können wir das von der *Pfadoperation-Funktion* als Abhängigkeit einf
 //// tab | Python 3.8+
 
 ```Python hl_lines="17  19-21"
-{!> ../../../docs_src/settings/app02_an/main.py!}
+{!> ../../docs_src/settings/app02_an/main.py!}
 ```
 
 ////
@@ -351,7 +351,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="16  18-20"
-{!> ../../../docs_src/settings/app02/main.py!}
+{!> ../../docs_src/settings/app02/main.py!}
 ```
 
 ////
@@ -361,7 +361,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 Dann wäre es sehr einfach, beim Testen ein anderes Einstellungsobjekt bereitzustellen, indem man eine Abhängigkeitsüberschreibung für `get_settings` erstellt:
 
 ```Python hl_lines="9-10  13  21"
-{!../../../docs_src/settings/app02/test_main.py!}
+{!../../docs_src/settings/app02/test_main.py!}
 ```
 
 Bei der Abhängigkeitsüberschreibung legen wir einen neuen Wert für `admin_email` fest, wenn wir das neue `Settings`-Objekt erstellen, und geben dann dieses neue Objekt zurück.
@@ -406,7 +406,7 @@ Und dann aktualisieren Sie Ihre `config.py` mit:
 //// tab | Pydantic v2
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/settings/app03_an/config.py!}
+{!> ../../docs_src/settings/app03_an/config.py!}
 ```
 
 /// tip | "Tipp"
@@ -420,7 +420,7 @@ Das Attribut `model_config` wird nur für die Pydantic-Konfiguration verwendet.
 //// tab | Pydantic v1
 
 ```Python hl_lines="9-10"
-{!> ../../../docs_src/settings/app03_an/config_pv1.py!}
+{!> ../../docs_src/settings/app03_an/config_pv1.py!}
 ```
 
 /// tip | "Tipp"
@@ -465,7 +465,7 @@ Da wir jedoch den `@lru_cache`-Dekorator oben verwenden, wird das `Settings`-Obj
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  11"
-{!> ../../../docs_src/settings/app03_an_py39/main.py!}
+{!> ../../docs_src/settings/app03_an_py39/main.py!}
 ```
 
 ////
@@ -473,7 +473,7 @@ Da wir jedoch den `@lru_cache`-Dekorator oben verwenden, wird das `Settings`-Obj
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  11"
-{!> ../../../docs_src/settings/app03_an/main.py!}
+{!> ../../docs_src/settings/app03_an/main.py!}
 ```
 
 ////
@@ -487,7 +487,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1  10"
-{!> ../../../docs_src/settings/app03/main.py!}
+{!> ../../docs_src/settings/app03/main.py!}
 ```
 
 ////
index 7dfaaa0cde0f581e67c2ec3c53dbf87ecb408989..172b8d3c1f7a74c6c06cdebad36d81ca90cd4e20 100644 (file)
@@ -11,7 +11,7 @@ Wenn Sie zwei unabhängige FastAPI-Anwendungen mit deren eigenen unabhängigen O
 Erstellen Sie zunächst die Hauptanwendung **FastAPI** und deren *Pfadoperationen*:
 
 ```Python hl_lines="3  6-8"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### Unteranwendung
@@ -21,7 +21,7 @@ Erstellen Sie dann Ihre Unteranwendung und deren *Pfadoperationen*.
 Diese Unteranwendung ist nur eine weitere Standard-FastAPI-Anwendung, aber diese wird „gemountet“:
 
 ```Python hl_lines="11  14-16"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### Die Unteranwendung mounten
@@ -31,7 +31,7 @@ Mounten Sie in Ihrer Top-Level-Anwendung `app` die Unteranwendung `subapi`.
 In diesem Fall wird sie im Pfad `/subapi` gemountet:
 
 ```Python hl_lines="11  19"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### Es in der automatischen API-Dokumentation betrachten
index abc7624f1d8b0bdcf3a401875f24665f680339fe..6cb3fcf6c36aab91320fc03e66e718810b366096 100644 (file)
@@ -28,7 +28,7 @@ $ pip install jinja2
 * Verwenden Sie die von Ihnen erstellten `templates`, um eine `TemplateResponse` zu rendern und zurückzugeben, übergeben Sie den Namen des Templates, das Requestobjekt und ein „Kontext“-Dictionary mit Schlüssel-Wert-Paaren, die innerhalb des Jinja2-Templates verwendet werden sollen.
 
 ```Python hl_lines="4  11  15-18"
-{!../../../docs_src/templates/tutorial001.py!}
+{!../../docs_src/templates/tutorial001.py!}
 ```
 
 /// note | "Hinweis"
@@ -58,7 +58,7 @@ Sie können auch `from starlette.templating import Jinja2Templates` verwenden.
 Dann können Sie unter `templates/item.html` ein Template erstellen, mit z. B. folgendem Inhalt:
 
 ```jinja hl_lines="7"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
 ```
 
 ### Template-Kontextwerte
@@ -112,13 +112,13 @@ Mit beispielsweise der ID `42` würde dies Folgendes ergeben:
 Sie können `url_for()` innerhalb des Templates auch beispielsweise mit den `StaticFiles` verwenden, die Sie mit `name="static"` gemountet haben.
 
 ```jinja hl_lines="4"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
 ```
 
 In diesem Beispiel würde das zu einer CSS-Datei unter `static/styles.css` verlinken, mit folgendem Inhalt:
 
 ```CSS hl_lines="4"
-{!../../../docs_src/templates/static/styles.css!}
+{!../../docs_src/templates/static/styles.css!}
 ```
 
 Und da Sie `StaticFiles` verwenden, wird diese CSS-Datei automatisch von Ihrer **FastAPI**-Anwendung unter der URL `/static/styles.css` bereitgestellt.
index f131d27cd2edd025cb33f5318cae4923cb56d5af..c565b30f2ff336da8e332a005bfffba2a0911f65 100644 (file)
@@ -31,7 +31,7 @@ Und dann ruft **FastAPI** diese Überschreibung anstelle der ursprünglichen Abh
 //// tab | Python 3.10+
 
 ```Python hl_lines="26-27  30"
-{!> ../../../docs_src/dependency_testing/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Und dann ruft **FastAPI** diese Überschreibung anstelle der ursprünglichen Abh
 //// tab | Python 3.9+
 
 ```Python hl_lines="28-29  32"
-{!> ../../../docs_src/dependency_testing/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@ Und dann ruft **FastAPI** diese Überschreibung anstelle der ursprünglichen Abh
 //// tab | Python 3.8+
 
 ```Python hl_lines="29-30  33"
-{!> ../../../docs_src/dependency_testing/tutorial001_an.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_an.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="24-25  28"
-{!> ../../../docs_src/dependency_testing/tutorial001_py310.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="28-29  32"
-{!> ../../../docs_src/dependency_testing/tutorial001.py!}
+{!> ../../docs_src/dependency_testing/tutorial001.py!}
 ```
 
 ////
index f500935485474dae4ea1ee9de7f435b897da1462..3e63791c6b3fc9811bdcffa13aa17e0b9a680d80 100644 (file)
@@ -3,5 +3,5 @@
 Wenn Sie in Ihren Tests Ihre Event-Handler (`startup` und `shutdown`) ausführen wollen, können Sie den `TestClient` mit einer `with`-Anweisung verwenden:
 
 ```Python hl_lines="9-12  20-24"
-{!../../../docs_src/app_testing/tutorial003.py!}
+{!../../docs_src/app_testing/tutorial003.py!}
 ```
index 4cbc45c17a6c5bea2a8bfde38f8cfe6842348127..7ae7d92d6422ca4e06613e6c1817ecddcb682d70 100644 (file)
@@ -5,7 +5,7 @@ Sie können den schon bekannten `TestClient` zum Testen von WebSockets verwenden
 Dazu verwenden Sie den `TestClient` in einer `with`-Anweisung, eine Verbindung zum WebSocket herstellend:
 
 ```Python hl_lines="27-31"
-{!../../../docs_src/app_testing/tutorial002.py!}
+{!../../docs_src/app_testing/tutorial002.py!}
 ```
 
 /// note | "Hinweis"
index 1d575a7cb08599a8e5f63e8b402b4fad15093464..6a0b96680e74eae286271307266663d4ce408801 100644 (file)
@@ -30,7 +30,7 @@ Angenommen, Sie möchten auf die IP-Adresse/den Host des Clients in Ihrer *Pfado
 Dazu müssen Sie direkt auf den Request zugreifen.
 
 ```Python hl_lines="1  7-8"
-{!../../../docs_src/using_request_directly/tutorial001.py!}
+{!../../docs_src/using_request_directly/tutorial001.py!}
 ```
 
 Durch die Deklaration eines *Pfadoperation-Funktionsparameters*, dessen Typ der `Request` ist, weiß **FastAPI**, dass es den `Request` diesem Parameter übergeben soll.
index 6d772b6c9ad68d30d1ed0e178ff5abbeb329d313..cf13fa23ce425d5e91da1f541608dad4c9bbe6d5 100644 (file)
@@ -39,7 +39,7 @@ In der Produktion hätten Sie eine der oben genannten Optionen.
 Aber es ist die einfachste Möglichkeit, sich auf die Serverseite von WebSockets zu konzentrieren und ein funktionierendes Beispiel zu haben:
 
 ```Python hl_lines="2  6-38  41-43"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 ## Einen `websocket` erstellen
@@ -47,7 +47,7 @@ Aber es ist die einfachste Möglichkeit, sich auf die Serverseite von WebSockets
 Erstellen Sie in Ihrer **FastAPI**-Anwendung einen `websocket`:
 
 ```Python hl_lines="1  46-47"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 /// note | "Technische Details"
@@ -63,7 +63,7 @@ Sie können auch `from starlette.websockets import WebSocket` verwenden.
 In Ihrer WebSocket-Route können Sie Nachrichten `await`en und Nachrichten senden.
 
 ```Python hl_lines="48-52"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 Sie können Binär-, Text- und JSON-Daten empfangen und senden.
@@ -118,7 +118,7 @@ Diese funktionieren auf die gleiche Weise wie für andere FastAPI-Endpunkte/*Pfa
 //// tab | Python 3.10+
 
 ```Python hl_lines="68-69  82"
-{!> ../../../docs_src/websockets/tutorial002_an_py310.py!}
+{!> ../../docs_src/websockets/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -126,7 +126,7 @@ Diese funktionieren auf die gleiche Weise wie für andere FastAPI-Endpunkte/*Pfa
 //// tab | Python 3.9+
 
 ```Python hl_lines="68-69  82"
-{!> ../../../docs_src/websockets/tutorial002_an_py39.py!}
+{!> ../../docs_src/websockets/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -134,7 +134,7 @@ Diese funktionieren auf die gleiche Weise wie für andere FastAPI-Endpunkte/*Pfa
 //// tab | Python 3.8+
 
 ```Python hl_lines="69-70  83"
-{!> ../../../docs_src/websockets/tutorial002_an.py!}
+{!> ../../docs_src/websockets/tutorial002_an.py!}
 ```
 
 ////
@@ -148,7 +148,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="66-67  79"
-{!> ../../../docs_src/websockets/tutorial002_py310.py!}
+{!> ../../docs_src/websockets/tutorial002_py310.py!}
 ```
 
 ////
@@ -162,7 +162,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="68-69  81"
-{!> ../../../docs_src/websockets/tutorial002.py!}
+{!> ../../docs_src/websockets/tutorial002.py!}
 ```
 
 ////
@@ -213,7 +213,7 @@ Wenn eine WebSocket-Verbindung geschlossen wird, löst `await websocket.receive_
 //// tab | Python 3.9+
 
 ```Python hl_lines="79-81"
-{!> ../../../docs_src/websockets/tutorial003_py39.py!}
+{!> ../../docs_src/websockets/tutorial003_py39.py!}
 ```
 
 ////
@@ -221,7 +221,7 @@ Wenn eine WebSocket-Verbindung geschlossen wird, löst `await websocket.receive_
 //// tab | Python 3.8+
 
 ```Python hl_lines="81-83"
-{!> ../../../docs_src/websockets/tutorial003.py!}
+{!> ../../docs_src/websockets/tutorial003.py!}
 ```
 
 ////
index 19ff90a9011cbb5ff9d810f3336580d4aabe89c2..50abc84d1ee02c22a4e902d3704016d81a87922a 100644 (file)
@@ -13,7 +13,7 @@ Wrappen Sie dann die WSGI-Anwendung (z. B. Flask) mit der Middleware.
 Und dann mounten Sie das auf einem Pfad.
 
 ```Python hl_lines="2-3  23"
-{!../../../docs_src/wsgi/tutorial001.py!}
+{!../../docs_src/wsgi/tutorial001.py!}
 ```
 
 ## Es ansehen
index 7f277bb888858823583c351be00b6c7ff936e2fd..a0a4983bb4f111c804fe4996ff72656232ae4bba 100644 (file)
@@ -30,7 +30,7 @@ Sie können problemlos dieselben Pydantic-Einstellungen verwenden, um Ihre gener
 Zum Beispiel:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/conditional_openapi/tutorial001.py!}
+{!../../docs_src/conditional_openapi/tutorial001.py!}
 ```
 
 Hier deklarieren wir die Einstellung `openapi_url` mit dem gleichen Defaultwert `"/openapi.json"`.
index 7d62a14d3eaa7268cf4432f18e1a7fdb1ecc80e7..31b9cd290758ae04e3c8c4fce2009820ca219f52 100644 (file)
@@ -19,7 +19,7 @@ Ohne Änderung der Einstellungen ist die Syntaxhervorhebung standardmäßig akti
 Sie können sie jedoch deaktivieren, indem Sie `syntaxHighlight` auf `False` setzen:
 
 ```Python hl_lines="3"
-{!../../../docs_src/configure_swagger_ui/tutorial001.py!}
+{!../../docs_src/configure_swagger_ui/tutorial001.py!}
 ```
 
 ... und dann zeigt die Swagger-Oberfläche die Syntaxhervorhebung nicht mehr an:
@@ -31,7 +31,7 @@ Sie können sie jedoch deaktivieren, indem Sie `syntaxHighlight` auf `False` set
 Auf die gleiche Weise könnten Sie das Theme der Syntaxhervorhebung mit dem Schlüssel `syntaxHighlight.theme` festlegen (beachten Sie, dass er einen Punkt in der Mitte hat):
 
 ```Python hl_lines="3"
-{!../../../docs_src/configure_swagger_ui/tutorial002.py!}
+{!../../docs_src/configure_swagger_ui/tutorial002.py!}
 ```
 
 Obige Konfiguration würde das Theme für die Farbe der Syntaxhervorhebung ändern:
@@ -45,7 +45,7 @@ FastAPI enthält einige Defaultkonfigurationsparameter, die für die meisten Anw
 Es umfasst die folgenden Defaultkonfigurationen:
 
 ```Python
-{!../../../fastapi/openapi/docs.py[ln:7-23]!}
+{!../../fastapi/openapi/docs.py[ln:7-23]!}
 ```
 
 Sie können jede davon überschreiben, indem Sie im Argument `swagger_ui_parameters` einen anderen Wert festlegen.
@@ -53,7 +53,7 @@ Sie können jede davon überschreiben, indem Sie im Argument `swagger_ui_paramet
 Um beispielsweise `deepLinking` zu deaktivieren, könnten Sie folgende Einstellungen an `swagger_ui_parameters` übergeben:
 
 ```Python hl_lines="3"
-{!../../../docs_src/configure_swagger_ui/tutorial003.py!}
+{!../../docs_src/configure_swagger_ui/tutorial003.py!}
 ```
 
 ## Andere Parameter der Swagger-Oberfläche
index e8750f7c2208c693a76b8c7916333bdfce8b50b4..e5fd20a10f471f1c24af929e34cebd3b30bad199 100644 (file)
@@ -19,7 +19,7 @@ Der erste Schritt besteht darin, die automatischen Dokumentationen zu deaktivier
 Um diese zu deaktivieren, setzen Sie deren URLs beim Erstellen Ihrer `FastAPI`-App auf `None`:
 
 ```Python hl_lines="8"
-{!../../../docs_src/custom_docs_ui/tutorial001.py!}
+{!../../docs_src/custom_docs_ui/tutorial001.py!}
 ```
 
 ### Die benutzerdefinierten Dokumentationen hinzufügen
@@ -37,7 +37,7 @@ Sie können die internen Funktionen von FastAPI wiederverwenden, um die HTML-Sei
 Und genau so für ReDoc ...
 
 ```Python hl_lines="2-6  11-19  22-24  27-33"
-{!../../../docs_src/custom_docs_ui/tutorial001.py!}
+{!../../docs_src/custom_docs_ui/tutorial001.py!}
 ```
 
 /// tip | "Tipp"
@@ -55,7 +55,7 @@ Swagger UI erledigt das hinter den Kulissen für Sie, benötigt aber diesen „U
 Um nun testen zu können, ob alles funktioniert, erstellen Sie eine *Pfadoperation*:
 
 ```Python hl_lines="36-38"
-{!../../../docs_src/custom_docs_ui/tutorial001.py!}
+{!../../docs_src/custom_docs_ui/tutorial001.py!}
 ```
 
 ### Es ausprobieren
@@ -125,7 +125,7 @@ Danach könnte Ihre Dateistruktur wie folgt aussehen:
 * „Mounten“ Sie eine `StaticFiles()`-Instanz in einem bestimmten Pfad.
 
 ```Python hl_lines="7  11"
-{!../../../docs_src/custom_docs_ui/tutorial002.py!}
+{!../../docs_src/custom_docs_ui/tutorial002.py!}
 ```
 
 ### Die statischen Dateien testen
@@ -159,7 +159,7 @@ Wie bei der Verwendung eines benutzerdefinierten CDN besteht der erste Schritt d
 Um diese zu deaktivieren, setzen Sie deren URLs beim Erstellen Ihrer `FastAPI`-App auf `None`:
 
 ```Python hl_lines="9"
-{!../../../docs_src/custom_docs_ui/tutorial002.py!}
+{!../../docs_src/custom_docs_ui/tutorial002.py!}
 ```
 
 ### Die benutzerdefinierten Dokumentationen, mit statischen Dateien, hinzufügen
@@ -177,7 +177,7 @@ Auch hier können Sie die internen Funktionen von FastAPI wiederverwenden, um di
 Und genau so für ReDoc ...
 
 ```Python hl_lines="2-6  14-22  25-27  30-36"
-{!../../../docs_src/custom_docs_ui/tutorial002.py!}
+{!../../docs_src/custom_docs_ui/tutorial002.py!}
 ```
 
 /// tip | "Tipp"
@@ -195,7 +195,7 @@ Swagger UI erledigt das hinter den Kulissen für Sie, benötigt aber diesen „U
 Um nun testen zu können, ob alles funktioniert, erstellen Sie eine *Pfadoperation*:
 
 ```Python hl_lines="39-41"
-{!../../../docs_src/custom_docs_ui/tutorial002.py!}
+{!../../docs_src/custom_docs_ui/tutorial002.py!}
 ```
 
 ### Benutzeroberfläche, mit statischen Dateien, testen
index a0c4a0e0cf7cd45c419467cac655b879e6ffd154..f81fa1da3d5f7186097eb78eca2829945d8f43eb 100644 (file)
@@ -43,7 +43,7 @@ Wenn der Header kein `gzip` enthält, wird nicht versucht, den Body zu dekomprim
 Auf diese Weise kann dieselbe Routenklasse gzip-komprimierte oder unkomprimierte Requests verarbeiten.
 
 ```Python hl_lines="8-15"
-{!../../../docs_src/custom_request_and_route/tutorial001.py!}
+{!../../docs_src/custom_request_and_route/tutorial001.py!}
 ```
 
 ### Eine benutzerdefinierte `GzipRoute`-Klasse erstellen
@@ -57,7 +57,7 @@ Diese Methode gibt eine Funktion zurück. Und diese Funktion empfängt einen Req
 Hier verwenden wir sie, um aus dem ursprünglichen Request einen `GzipRequest` zu erstellen.
 
 ```Python hl_lines="18-26"
-{!../../../docs_src/custom_request_and_route/tutorial001.py!}
+{!../../docs_src/custom_request_and_route/tutorial001.py!}
 ```
 
 /// note | "Technische Details"
@@ -97,13 +97,13 @@ Wir können denselben Ansatz auch verwenden, um in einem Exceptionhandler auf de
 Alles, was wir tun müssen, ist, den Request innerhalb eines `try`/`except`-Blocks zu handhaben:
 
 ```Python hl_lines="13  15"
-{!../../../docs_src/custom_request_and_route/tutorial002.py!}
+{!../../docs_src/custom_request_and_route/tutorial002.py!}
 ```
 
 Wenn eine Exception auftritt, befindet sich die `Request`-Instanz weiterhin im Gültigkeitsbereich, sodass wir den Requestbody lesen und bei der Fehlerbehandlung verwenden können:
 
 ```Python hl_lines="16-18"
-{!../../../docs_src/custom_request_and_route/tutorial002.py!}
+{!../../docs_src/custom_request_and_route/tutorial002.py!}
 ```
 
 ## Benutzerdefinierte `APIRoute`-Klasse in einem Router
@@ -111,11 +111,11 @@ Wenn eine Exception auftritt, befindet sich die `Request`-Instanz weiterhin im G
 Sie können auch den Parameter `route_class` eines `APIRouter` festlegen:
 
 ```Python hl_lines="26"
-{!../../../docs_src/custom_request_and_route/tutorial003.py!}
+{!../../docs_src/custom_request_and_route/tutorial003.py!}
 ```
 
 In diesem Beispiel verwenden die *Pfadoperationen* unter dem `router` die benutzerdefinierte `TimedRoute`-Klasse und haben in der Response einen zusätzlichen `X-Response-Time`-Header mit der Zeit, die zum Generieren der Response benötigt wurde:
 
 ```Python hl_lines="13-20"
-{!../../../docs_src/custom_request_and_route/tutorial003.py!}
+{!../../docs_src/custom_request_and_route/tutorial003.py!}
 ```
index 347c5bed3f9ba433562af5a5524f48edd642f495..c895fb860d54b2dd29cdccc17432099d8813372b 100644 (file)
@@ -44,7 +44,7 @@ Fügen wir beispielsweise <a href="https://github.com/Rebilly/ReDoc/blob/master/
 Schreiben Sie zunächst wie gewohnt Ihre ganze **FastAPI**-Anwendung:
 
 ```Python hl_lines="1  4  7-9"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### Das OpenAPI-Schema generieren
@@ -52,7 +52,7 @@ Schreiben Sie zunächst wie gewohnt Ihre ganze **FastAPI**-Anwendung:
 Verwenden Sie dann dieselbe Hilfsfunktion, um das OpenAPI-Schema innerhalb einer `custom_openapi()`-Funktion zu generieren:
 
 ```Python hl_lines="2  15-21"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### Das OpenAPI-Schema ändern
@@ -60,7 +60,7 @@ Verwenden Sie dann dieselbe Hilfsfunktion, um das OpenAPI-Schema innerhalb einer
 Jetzt können Sie die ReDoc-Erweiterung hinzufügen und dem `info`-„Objekt“ im OpenAPI-Schema ein benutzerdefiniertes `x-logo` hinzufügen:
 
 ```Python hl_lines="22-24"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### Zwischenspeichern des OpenAPI-Schemas
@@ -72,7 +72,7 @@ Auf diese Weise muss Ihre Anwendung das Schema nicht jedes Mal generieren, wenn
 Es wird nur einmal generiert und dann wird dasselbe zwischengespeicherte Schema für die nächsten Requests verwendet.
 
 ```Python hl_lines="13-14  25-26"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### Die Methode überschreiben
@@ -80,7 +80,7 @@ Es wird nur einmal generiert und dann wird dasselbe zwischengespeicherte Schema
 Jetzt können Sie die Methode `.openapi()` durch Ihre neue Funktion ersetzen.
 
 ```Python hl_lines="29"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### Testen
index 19af25bb382031a0695a268219fb82bfc92352fd..cde56ffdef7f4b243eb585ed6958cb27c4ac6257 100644 (file)
@@ -36,7 +36,7 @@ Abhängig von Ihrem Anwendungsfall bevorzugen Sie vielleicht eine andere Bibliot
 Hier ist eine kleine Vorschau, wie Sie Strawberry mit FastAPI integrieren können:
 
 ```Python hl_lines="3  22  25-26"
-{!../../../docs_src/graphql/tutorial001.py!}
+{!../../docs_src/graphql/tutorial001.py!}
 ```
 
 Weitere Informationen zu Strawberry finden Sie in der <a href="https://strawberry.rocks/" class="external-link" target="_blank">Strawberry-Dokumentation</a>.
index eaecb27de473e935432202b381e9a2184d8569ed..974341dd2079b2f130f73a4e40fdfea5e49624b4 100644 (file)
@@ -13,7 +13,7 @@ Nehmen wir an, Sie haben ein Pydantic-Modell mit Defaultwerten wie dieses:
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-7]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-7]!}
 
 # Code unterhalb weggelassen 👇
 ```
@@ -22,7 +22,7 @@ Nehmen wir an, Sie haben ein Pydantic-Modell mit Defaultwerten wie dieses:
 <summary>👀 Vollständige Dateivorschau</summary>
 
 ```Python
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
 ```
 
 </details>
@@ -32,7 +32,7 @@ Nehmen wir an, Sie haben ein Pydantic-Modell mit Defaultwerten wie dieses:
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py39.py[ln:1-9]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py[ln:1-9]!}
 
 # Code unterhalb weggelassen 👇
 ```
@@ -41,7 +41,7 @@ Nehmen wir an, Sie haben ein Pydantic-Modell mit Defaultwerten wie dieses:
 <summary>👀 Vollständige Dateivorschau</summary>
 
 ```Python
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
 ```
 
 </details>
@@ -51,7 +51,7 @@ Nehmen wir an, Sie haben ein Pydantic-Modell mit Defaultwerten wie dieses:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001.py[ln:1-9]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001.py[ln:1-9]!}
 
 # Code unterhalb weggelassen 👇
 ```
@@ -60,7 +60,7 @@ Nehmen wir an, Sie haben ein Pydantic-Modell mit Defaultwerten wie dieses:
 <summary>👀 Vollständige Dateivorschau</summary>
 
 ```Python
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001.py!}
 ```
 
 </details>
@@ -74,7 +74,7 @@ Wenn Sie dieses Modell wie hier als Eingabe verwenden:
 //// tab | Python 3.10+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-15]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-15]!}
 
 # Code unterhalb weggelassen 👇
 ```
@@ -83,7 +83,7 @@ Wenn Sie dieses Modell wie hier als Eingabe verwenden:
 <summary>👀 Vollständige Dateivorschau</summary>
 
 ```Python
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
 ```
 
 </details>
@@ -93,7 +93,7 @@ Wenn Sie dieses Modell wie hier als Eingabe verwenden:
 //// tab | Python 3.9+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py39.py[ln:1-17]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py[ln:1-17]!}
 
 # Code unterhalb weggelassen 👇
 ```
@@ -102,7 +102,7 @@ Wenn Sie dieses Modell wie hier als Eingabe verwenden:
 <summary>👀 Vollständige Dateivorschau</summary>
 
 ```Python
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
 ```
 
 </details>
@@ -112,7 +112,7 @@ Wenn Sie dieses Modell wie hier als Eingabe verwenden:
 //// tab | Python 3.8+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001.py[ln:1-17]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001.py[ln:1-17]!}
 
 # Code unterhalb weggelassen 👇
 ```
@@ -121,7 +121,7 @@ Wenn Sie dieses Modell wie hier als Eingabe verwenden:
 <summary>👀 Vollständige Dateivorschau</summary>
 
 ```Python
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001.py!}
 ```
 
 </details>
@@ -145,7 +145,7 @@ Wenn Sie jedoch dasselbe Modell als Ausgabe verwenden, wie hier:
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
 ```
 
 ////
@@ -153,7 +153,7 @@ Wenn Sie jedoch dasselbe Modell als Ausgabe verwenden, wie hier:
 //// tab | Python 3.9+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
 ```
 
 ////
@@ -161,7 +161,7 @@ Wenn Sie jedoch dasselbe Modell als Ausgabe verwenden, wie hier:
 //// tab | Python 3.8+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001.py!}
 ```
 
 ////
@@ -226,7 +226,7 @@ Unterstützung für `separate_input_output_schemas` wurde in FastAPI `0.102.0` h
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial002_py310.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial002_py310.py!}
 ```
 
 ////
@@ -234,7 +234,7 @@ Unterstützung für `separate_input_output_schemas` wurde in FastAPI `0.102.0` h
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial002_py39.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial002_py39.py!}
 ```
 
 ////
@@ -242,7 +242,7 @@ Unterstützung für `separate_input_output_schemas` wurde in FastAPI `0.102.0` h
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial002.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial002.py!}
 ```
 
 ////
index 9bbff83d33576acddc0df799997e6b9b3d47c76b..a43bf5ffe946b9dc3047bd1e776a7a7875553d9f 100644 (file)
@@ -23,7 +23,7 @@ Wenn Sie ein Python-Experte sind und bereits alles über Typhinweise wissen, üb
 Fangen wir mit einem einfachen Beispiel an:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 Dieses Programm gibt aus:
@@ -39,7 +39,7 @@ Die Funktion macht Folgendes:
 * <abbr title="Füge zu einer Einheit zusammen, eins nach dem anderen.">Verkettet</abbr> sie mit einem Leerzeichen in der Mitte.
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### Bearbeiten Sie es
@@ -83,7 +83,7 @@ Das war's.
 Das sind die „Typhinweise“:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 Das ist nicht das gleiche wie das Deklarieren von Defaultwerten, wie es hier der Fall ist:
@@ -113,7 +113,7 @@ Hier können Sie durch die Optionen blättern, bis Sie diejenige finden, bei der
 Sehen Sie sich diese Funktion an, sie hat bereits Typhinweise:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 Da der Editor die Typen der Variablen kennt, erhalten Sie nicht nur Code-Vervollständigung, sondern auch eine Fehlerprüfung:
@@ -123,7 +123,7 @@ Da der Editor die Typen der Variablen kennt, erhalten Sie nicht nur Code-Vervoll
 Jetzt, da Sie wissen, dass Sie das reparieren müssen, konvertieren Sie `age` mittels `str(age)` in einen String:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## Deklarieren von Typen
@@ -144,7 +144,7 @@ Zum Beispiel diese:
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### Generische Typen mit Typ-Parametern
@@ -182,7 +182,7 @@ Als Typ nehmen Sie `list`.
 Da die Liste ein Typ ist, welcher innere Typen enthält, werden diese von eckigen Klammern umfasst:
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006_py39.py!}
+{!> ../../docs_src/python_types/tutorial006_py39.py!}
 ```
 
 ////
@@ -192,7 +192,7 @@ Da die Liste ein Typ ist, welcher innere Typen enthält, werden diese von eckige
 Von `typing` importieren Sie `List` (mit Großbuchstaben `L`):
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 Deklarieren Sie die Variable mit der gleichen Doppelpunkt-Syntax (`:`).
@@ -202,7 +202,7 @@ Als Typ nehmen Sie das `List`, das Sie von `typing` importiert haben.
 Da die Liste ein Typ ist, welcher innere Typen enthält, werden diese von eckigen Klammern umfasst:
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 ////
@@ -240,7 +240,7 @@ Das Gleiche gilt für die Deklaration eines Tupels – `tuple` – und einer Men
 //// tab | Python 3.9+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial007_py39.py!}
+{!> ../../docs_src/python_types/tutorial007_py39.py!}
 ```
 
 ////
@@ -248,7 +248,7 @@ Das Gleiche gilt für die Deklaration eines Tupels – `tuple` – und einer Men
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial007.py!}
+{!> ../../docs_src/python_types/tutorial007.py!}
 ```
 
 ////
@@ -269,7 +269,7 @@ Der zweite Typ-Parameter ist für die Werte des `dict`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008_py39.py!}
+{!> ../../docs_src/python_types/tutorial008_py39.py!}
 ```
 
 ////
@@ -277,7 +277,7 @@ Der zweite Typ-Parameter ist für die Werte des `dict`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008.py!}
+{!> ../../docs_src/python_types/tutorial008.py!}
 ```
 
 ////
@@ -299,7 +299,7 @@ In Python 3.10 gibt es zusätzlich eine **neue Syntax**, die es erlaubt, die mö
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008b_py310.py!}
+{!> ../../docs_src/python_types/tutorial008b_py310.py!}
 ```
 
 ////
@@ -307,7 +307,7 @@ In Python 3.10 gibt es zusätzlich eine **neue Syntax**, die es erlaubt, die mö
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008b.py!}
+{!> ../../docs_src/python_types/tutorial008b.py!}
 ```
 
 ////
@@ -321,7 +321,7 @@ Sie können deklarieren, dass ein Wert ein `str`, aber vielleicht auch `None` se
 In Python 3.6 und darüber (inklusive Python 3.10) können Sie das deklarieren, indem Sie `Optional` vom `typing` Modul importieren und verwenden.
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 Wenn Sie `Optional[str]` anstelle von nur `str` verwenden, wird Ihr Editor Ihnen dabei helfen, Fehler zu erkennen, bei denen Sie annehmen könnten, dass ein Wert immer eine String (`str`) ist, obwohl er auch `None` sein könnte.
@@ -333,7 +333,7 @@ Das bedeutet auch, dass Sie in Python 3.10 `Something | None` verwenden können:
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial009_py310.py!}
+{!> ../../docs_src/python_types/tutorial009_py310.py!}
 ```
 
 ////
@@ -341,7 +341,7 @@ Das bedeutet auch, dass Sie in Python 3.10 `Something | None` verwenden können:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009.py!}
+{!> ../../docs_src/python_types/tutorial009.py!}
 ```
 
 ////
@@ -349,7 +349,7 @@ Das bedeutet auch, dass Sie in Python 3.10 `Something | None` verwenden können:
 //// tab | Python 3.8+ Alternative
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009b.py!}
+{!> ../../docs_src/python_types/tutorial009b.py!}
 ```
 
 ////
@@ -370,7 +370,7 @@ Es geht nur um Wörter und Namen. Aber diese Worte können beeinflussen, wie Sie
 Nehmen wir zum Beispiel diese Funktion:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009c.py!}
+{!../../docs_src/python_types/tutorial009c.py!}
 ```
 
 Der Parameter `name` ist definiert als `Optional[str]`, aber er ist **nicht optional**, Sie können die Funktion nicht ohne diesen Parameter aufrufen:
@@ -388,7 +388,7 @@ say_hi(name=None)  # Das funktioniert, None is gültig 🎉
 Die gute Nachricht ist, dass Sie sich darüber keine Sorgen mehr machen müssen, wenn Sie Python 3.10 verwenden, da Sie einfach `|` verwenden können, um Vereinigungen von Typen zu definieren:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009c_py310.py!}
+{!../../docs_src/python_types/tutorial009c_py310.py!}
 ```
 
 Und dann müssen Sie sich nicht mehr um Namen wie `Optional` und `Union` kümmern. 😎
@@ -452,13 +452,13 @@ Sie können auch eine Klasse als Typ einer Variablen deklarieren.
 Nehmen wir an, Sie haben eine Klasse `Person`, mit einem Namen:
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Dann können Sie eine Variable vom Typ `Person` deklarieren:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Und wiederum bekommen Sie die volle Editor-Unterstützung:
@@ -486,7 +486,7 @@ Ein Beispiel aus der offiziellen Pydantic Dokumentation:
 //// tab | Python 3.10+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py310.py!}
+{!> ../../docs_src/python_types/tutorial011_py310.py!}
 ```
 
 ////
@@ -494,7 +494,7 @@ Ein Beispiel aus der offiziellen Pydantic Dokumentation:
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py39.py!}
+{!> ../../docs_src/python_types/tutorial011_py39.py!}
 ```
 
 ////
@@ -502,7 +502,7 @@ Ein Beispiel aus der offiziellen Pydantic Dokumentation:
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011.py!}
+{!> ../../docs_src/python_types/tutorial011.py!}
 ```
 
 ////
@@ -532,7 +532,7 @@ Python bietet auch die Möglichkeit, **zusätzliche Metadaten** in Typhinweisen
 In Python 3.9 ist `Annotated` ein Teil der Standardbibliothek, Sie können es von `typing` importieren.
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial013_py39.py!}
+{!> ../../docs_src/python_types/tutorial013_py39.py!}
 ```
 
 ////
@@ -544,7 +544,7 @@ In Versionen niedriger als Python 3.9 importieren Sie `Annotated` von `typing_ex
 Es wird bereits mit **FastAPI** installiert sein.
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial013.py!}
+{!> ../../docs_src/python_types/tutorial013.py!}
 ```
 
 ////
index 0852288d59655b180c9c49c0ae3d3dca2800457a..cd857f5e7c41f3323cc49140ab7ab4848070619b 100644 (file)
@@ -16,7 +16,7 @@ Hierzu zählen beispielsweise:
 Importieren Sie zunächst `BackgroundTasks` und definieren Sie einen Parameter in Ihrer *Pfadoperation-Funktion* mit der Typdeklaration `BackgroundTasks`:
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 **FastAPI** erstellt für Sie das Objekt vom Typ `BackgroundTasks` und übergibt es als diesen Parameter.
@@ -34,7 +34,7 @@ In diesem Fall schreibt die Taskfunktion in eine Datei (den Versand einer E-Mail
 Und da der Schreibvorgang nicht `async` und `await` verwendet, definieren wir die Funktion mit normalem `def`:
 
 ```Python hl_lines="6-9"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 ## Den Hintergrundtask hinzufügen
@@ -42,7 +42,7 @@ Und da der Schreibvorgang nicht `async` und `await` verwendet, definieren wir di
 Übergeben Sie innerhalb Ihrer *Pfadoperation-Funktion* Ihre Taskfunktion mit der Methode `.add_task()` an das *Hintergrundtasks*-Objekt:
 
 ```Python hl_lines="14"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 `.add_task()` erhält als Argumente:
@@ -60,7 +60,7 @@ Die Verwendung von `BackgroundTasks` funktioniert auch mit dem <abbr title="Einb
 //// tab | Python 3.10+
 
 ```Python hl_lines="13  15  22  25"
-{!> ../../../docs_src/background_tasks/tutorial002_an_py310.py!}
+{!> ../../docs_src/background_tasks/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -68,7 +68,7 @@ Die Verwendung von `BackgroundTasks` funktioniert auch mit dem <abbr title="Einb
 //// tab | Python 3.9+
 
 ```Python hl_lines="13  15  22  25"
-{!> ../../../docs_src/background_tasks/tutorial002_an_py39.py!}
+{!> ../../docs_src/background_tasks/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -76,7 +76,7 @@ Die Verwendung von `BackgroundTasks` funktioniert auch mit dem <abbr title="Einb
 //// tab | Python 3.8+
 
 ```Python hl_lines="14  16  23  26"
-{!> ../../../docs_src/background_tasks/tutorial002_an.py!}
+{!> ../../docs_src/background_tasks/tutorial002_an.py!}
 ```
 
 ////
@@ -90,7 +90,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="11  13  20  23"
-{!> ../../../docs_src/background_tasks/tutorial002_py310.py!}
+{!> ../../docs_src/background_tasks/tutorial002_py310.py!}
 ```
 
 ////
@@ -104,7 +104,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="13  15  22  25"
-{!> ../../../docs_src/background_tasks/tutorial002.py!}
+{!> ../../docs_src/background_tasks/tutorial002.py!}
 ```
 
 ////
index 986a99a38c1b9eabe5bbd95d27b1ed7b396a2f76..000fa1f437d9775fd194c5c8acb66d825af8b96e 100644 (file)
@@ -86,7 +86,7 @@ Sie können die *Pfadoperationen* für dieses Modul mit `APIRouter` erstellen.
 Sie importieren ihn und erstellen eine „Instanz“ auf die gleiche Weise wie mit der Klasse `FastAPI`:
 
 ```Python hl_lines="1  3" title="app/routers/users.py"
-{!../../../docs_src/bigger_applications/app/routers/users.py!}
+{!../../docs_src/bigger_applications/app/routers/users.py!}
 ```
 
 ### *Pfadoperationen* mit `APIRouter`
@@ -96,7 +96,7 @@ Und dann verwenden Sie ihn, um Ihre *Pfadoperationen* zu deklarieren.
 Verwenden Sie ihn auf die gleiche Weise wie die Klasse `FastAPI`:
 
 ```Python hl_lines="6  11  16" title="app/routers/users.py"
-{!../../../docs_src/bigger_applications/app/routers/users.py!}
+{!../../docs_src/bigger_applications/app/routers/users.py!}
 ```
 
 Sie können sich `APIRouter` als eine „Mini-`FastAPI`“-Klasse vorstellen.
@@ -124,7 +124,7 @@ Wir werden nun eine einfache Abhängigkeit verwenden, um einen benutzerdefiniert
 //// tab | Python 3.9+
 
 ```Python hl_lines="3  6-8" title="app/dependencies.py"
-{!> ../../../docs_src/bigger_applications/app_an_py39/dependencies.py!}
+{!> ../../docs_src/bigger_applications/app_an_py39/dependencies.py!}
 ```
 
 ////
@@ -132,7 +132,7 @@ Wir werden nun eine einfache Abhängigkeit verwenden, um einen benutzerdefiniert
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  5-7" title="app/dependencies.py"
-{!> ../../../docs_src/bigger_applications/app_an/dependencies.py!}
+{!> ../../docs_src/bigger_applications/app_an/dependencies.py!}
 ```
 
 ////
@@ -146,7 +146,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1  4-6" title="app/dependencies.py"
-{!> ../../../docs_src/bigger_applications/app/dependencies.py!}
+{!> ../../docs_src/bigger_applications/app/dependencies.py!}
 ```
 
 ////
@@ -182,7 +182,7 @@ Wir wissen, dass alle *Pfadoperationen* in diesem Modul folgendes haben:
 Anstatt also alles zu jeder *Pfadoperation* hinzuzufügen, können wir es dem `APIRouter` hinzufügen.
 
 ```Python hl_lines="5-10  16  21" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 Da der Pfad jeder *Pfadoperation* mit `/` beginnen muss, wie in:
@@ -243,7 +243,7 @@ Und wir müssen die Abhängigkeitsfunktion aus dem Modul `app.dependencies` impo
 Daher verwenden wir einen relativen Import mit `..` für die Abhängigkeiten:
 
 ```Python hl_lines="3" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 #### Wie relative Importe funktionieren
@@ -316,7 +316,7 @@ Wir fügen weder das Präfix `/items` noch `tags=["items"]` zu jeder *Pfadoperat
 Aber wir können immer noch _mehr_ `tags` hinzufügen, die auf eine bestimmte *Pfadoperation* angewendet werden, sowie einige zusätzliche `responses`, die speziell für diese *Pfadoperation* gelten:
 
 ```Python hl_lines="30-31" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 /// tip | "Tipp"
@@ -344,7 +344,7 @@ Sie importieren und erstellen wie gewohnt eine `FastAPI`-Klasse.
 Und wir können sogar [globale Abhängigkeiten](dependencies/global-dependencies.md){.internal-link target=_blank} deklarieren, die mit den Abhängigkeiten für jeden `APIRouter` kombiniert werden:
 
 ```Python hl_lines="1  3  7" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 ### Den `APIRouter` importieren
@@ -352,7 +352,7 @@ Und wir können sogar [globale Abhängigkeiten](dependencies/global-dependencies
 Jetzt importieren wir die anderen Submodule, die `APIRouter` haben:
 
 ```Python hl_lines="4-5" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 Da es sich bei den Dateien `app/routers/users.py` und `app/routers/items.py` um Submodule handelt, die Teil desselben Python-Packages `app` sind, können wir einen einzelnen Punkt `.` verwenden, um sie mit „relativen Imports“ zu importieren.
@@ -417,7 +417,7 @@ würde der `router` von `users` den von `items` überschreiben und wir könnten
 Um also beide in derselben Datei verwenden zu können, importieren wir die Submodule direkt:
 
 ```Python hl_lines="5" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 
@@ -426,7 +426,7 @@ Um also beide in derselben Datei verwenden zu können, importieren wir die Submo
 Inkludieren wir nun die `router` aus diesen Submodulen `users` und `items`:
 
 ```Python hl_lines="10-11" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 /// info
@@ -468,7 +468,7 @@ Sie enthält einen `APIRouter` mit einigen administrativen *Pfadoperationen*, di
 In diesem Beispiel wird es ganz einfach sein. Nehmen wir jedoch an, dass wir, da sie mit anderen Projekten in der Organisation geteilt wird, sie nicht ändern und kein `prefix`, `dependencies`, `tags`, usw. direkt zum `APIRouter` hinzufügen können:
 
 ```Python hl_lines="3" title="app/internal/admin.py"
-{!../../../docs_src/bigger_applications/app/internal/admin.py!}
+{!../../docs_src/bigger_applications/app/internal/admin.py!}
 ```
 
 Aber wir möchten immer noch ein benutzerdefiniertes `prefix` festlegen, wenn wir den `APIRouter` einbinden, sodass alle seine *Pfadoperationen* mit `/admin` beginnen, wir möchten es mit den `dependencies` sichern, die wir bereits für dieses Projekt haben, und wir möchten `tags` und `responses` hinzufügen.
@@ -476,7 +476,7 @@ Aber wir möchten immer noch ein benutzerdefiniertes `prefix` festlegen, wenn wi
 Wir können das alles deklarieren, ohne den ursprünglichen `APIRouter` ändern zu müssen, indem wir diese Parameter an `app.include_router()` übergeben:
 
 ```Python hl_lines="14-17" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 Auf diese Weise bleibt der ursprüngliche `APIRouter` unverändert, sodass wir dieselbe `app/internal/admin.py`-Datei weiterhin mit anderen Projekten in der Organisation teilen können.
@@ -499,7 +499,7 @@ Wir können *Pfadoperationen* auch direkt zur `FastAPI`-App hinzufügen.
 Hier machen wir es ... nur um zu zeigen, dass wir es können 🤷:
 
 ```Python hl_lines="21-23" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 und es wird korrekt funktionieren, zusammen mit allen anderen *Pfadoperationen*, die mit `app.include_router()` hinzugefügt wurden.
index 33f7713ee435a1ba2b62dc0c1849c5b355e09528..d22524c678635defd1a8fab0263e332d4fe1ddc8 100644 (file)
@@ -9,7 +9,7 @@ Importieren Sie es zuerst:
 //// tab | Python 3.10+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Importieren Sie es zuerst:
 //// tab | Python 3.9+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Importieren Sie es zuerst:
 //// tab | Python 3.8+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@ Dann können Sie `Field` mit Modellattributen deklarieren:
 //// tab | Python 3.10+
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@ Dann können Sie `Field` mit Modellattributen deklarieren:
 //// tab | Python 3.9+
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -87,7 +87,7 @@ Dann können Sie `Field` mit Modellattributen deklarieren:
 //// tab | Python 3.8+
 
 ```Python hl_lines="12-15"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
 ```
 
 ////
@@ -101,7 +101,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9-12"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
@@ -115,7 +115,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
index 977e17671b43eb600492a38e9e5b55f36a6bebf7..26ae73ebcda8dc3e47947cc3afd048864aba8921 100644 (file)
@@ -11,7 +11,7 @@ Und Sie können auch Body-Parameter als optional kennzeichnen, indem Sie den Def
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-20"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@ Und Sie können auch Body-Parameter als optional kennzeichnen, indem Sie den Def
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-20"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ Und Sie können auch Body-Parameter als optional kennzeichnen, indem Sie den Def
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-21"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an.py!}
 ```
 
 ////
@@ -41,7 +41,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="17-19"
-{!> ../../../docs_src/body_multiple_params/tutorial001_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -55,7 +55,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="19-21"
-{!> ../../../docs_src/body_multiple_params/tutorial001.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@ Aber Sie können auch mehrere Body-Parameter deklarieren, z. B. `item` und `user
 //// tab | Python 3.10+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial002_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -92,7 +92,7 @@ Aber Sie können auch mehrere Body-Parameter deklarieren, z. B. `item` und `user
 //// tab | Python 3.8+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial002.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002.py!}
 ```
 
 ////
@@ -139,7 +139,7 @@ Aber Sie können **FastAPI** instruieren, ihn als weiteren Body-Schlüssel zu er
 //// tab | Python 3.10+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ Aber Sie können **FastAPI** instruieren, ihn als weiteren Body-Schlüssel zu er
 //// tab | Python 3.9+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -155,7 +155,7 @@ Aber Sie können **FastAPI** instruieren, ihn als weiteren Body-Schlüssel zu er
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an.py!}
 ```
 
 ////
@@ -169,7 +169,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial003_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -183,7 +183,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial003.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003.py!}
 ```
 
 ////
@@ -229,7 +229,7 @@ Zum Beispiel:
 //// tab | Python 3.10+
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ Zum Beispiel:
 //// tab | Python 3.9+
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ Zum Beispiel:
 //// tab | Python 3.8+
 
 ```Python hl_lines="28"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an.py!}
 ```
 
 ////
@@ -259,7 +259,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="25"
-{!> ../../../docs_src/body_multiple_params/tutorial004_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004.py!}
 ```
 
 ////
@@ -301,7 +301,7 @@ so wie in:
 //// tab | Python 3.10+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -309,7 +309,7 @@ so wie in:
 //// tab | Python 3.9+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -317,7 +317,7 @@ so wie in:
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an.py!}
 ```
 
 ////
@@ -331,7 +331,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/body_multiple_params/tutorial005_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_py310.py!}
 ```
 
 ////
@@ -345,7 +345,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005.py!}
 ```
 
 ////
index 8aef965f4c8b5e94392c5c2ab37ade7c4e557f56..13153aa68145f8f86aa1c1a13846a49affd72bf4 100644 (file)
@@ -9,7 +9,7 @@ Sie können ein Attribut als Kindtyp definieren, zum Beispiel eine Python-`list`
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial001_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Sie können ein Attribut als Kindtyp definieren, zum Beispiel eine Python-`list`
 //// tab | Python 3.8+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial001.py!}
+{!> ../../docs_src/body_nested_models/tutorial001.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@ In Python 3.9 oder darüber können Sie einfach `list` verwenden, um diese Typan
 In Python-Versionen vor 3.9 (3.6 und darüber), müssen Sie zuerst `List` von Pythons Standardmodul `typing` importieren.
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/body_nested_models/tutorial002.py!}
+{!> ../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ### Eine `list`e mit einem Typ-Parameter deklarieren
@@ -68,7 +68,7 @@ In unserem Beispiel können wir also bewirken, dass `tags` spezifisch eine „Li
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial002_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -76,7 +76,7 @@ In unserem Beispiel können wir also bewirken, dass `tags` spezifisch eine „Li
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial002_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial002_py39.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@ In unserem Beispiel können wir also bewirken, dass `tags` spezifisch eine „Li
 //// tab | Python 3.8+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial002.py!}
+{!> ../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ////
@@ -100,7 +100,7 @@ Deklarieren wir also `tags` als Set von Strings.
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial003_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial003_py310.py!}
 ```
 
 ////
@@ -108,7 +108,7 @@ Deklarieren wir also `tags` als Set von Strings.
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial003_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial003_py39.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ Deklarieren wir also `tags` als Set von Strings.
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  14"
-{!> ../../../docs_src/body_nested_models/tutorial003.py!}
+{!> ../../docs_src/body_nested_models/tutorial003.py!}
 ```
 
 ////
@@ -144,7 +144,7 @@ Wir können zum Beispiel ein `Image`-Modell definieren.
 //// tab | Python 3.10+
 
 ```Python hl_lines="7-9"
-{!> ../../../docs_src/body_nested_models/tutorial004_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py310.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ Wir können zum Beispiel ein `Image`-Modell definieren.
 //// tab | Python 3.9+
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/body_nested_models/tutorial004_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -160,7 +160,7 @@ Wir können zum Beispiel ein `Image`-Modell definieren.
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/body_nested_models/tutorial004.py!}
+{!> ../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ Und dann können wir es als Typ eines Attributes verwenden.
 //// tab | Python 3.10+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_nested_models/tutorial004_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py310.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ Und dann können wir es als Typ eines Attributes verwenden.
 //// tab | Python 3.9+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial004_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -188,7 +188,7 @@ Und dann können wir es als Typ eines Attributes verwenden.
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial004.py!}
+{!> ../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ////
@@ -227,7 +227,7 @@ Da wir zum Beispiel im `Image`-Modell ein Feld `url` haben, können wir deklarie
 //// tab | Python 3.10+
 
 ```Python hl_lines="2  8"
-{!> ../../../docs_src/body_nested_models/tutorial005_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial005_py310.py!}
 ```
 
 ////
@@ -235,7 +235,7 @@ Da wir zum Beispiel im `Image`-Modell ein Feld `url` haben, können wir deklarie
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  10"
-{!> ../../../docs_src/body_nested_models/tutorial005_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial005_py39.py!}
 ```
 
 ////
@@ -243,7 +243,7 @@ Da wir zum Beispiel im `Image`-Modell ein Feld `url` haben, können wir deklarie
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  10"
-{!> ../../../docs_src/body_nested_models/tutorial005.py!}
+{!> ../../docs_src/body_nested_models/tutorial005.py!}
 ```
 
 ////
@@ -257,7 +257,7 @@ Sie können Pydantic-Modelle auch als Typen innerhalb von `list`, `set`, usw. ve
 //// tab | Python 3.10+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_nested_models/tutorial006_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial006_py310.py!}
 ```
 
 ////
@@ -265,7 +265,7 @@ Sie können Pydantic-Modelle auch als Typen innerhalb von `list`, `set`, usw. ve
 //// tab | Python 3.9+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial006_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial006_py39.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ Sie können Pydantic-Modelle auch als Typen innerhalb von `list`, `set`, usw. ve
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial006.py!}
+{!> ../../docs_src/body_nested_models/tutorial006.py!}
 ```
 
 ////
@@ -317,7 +317,7 @@ Sie können beliebig tief verschachtelte Modelle definieren:
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  12  18  21  25"
-{!> ../../../docs_src/body_nested_models/tutorial007_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial007_py310.py!}
 ```
 
 ////
@@ -325,7 +325,7 @@ Sie können beliebig tief verschachtelte Modelle definieren:
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  14  20  23  27"
-{!> ../../../docs_src/body_nested_models/tutorial007_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial007_py39.py!}
 ```
 
 ////
@@ -333,7 +333,7 @@ Sie können beliebig tief verschachtelte Modelle definieren:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  14  20  23  27"
-{!> ../../../docs_src/body_nested_models/tutorial007.py!}
+{!> ../../docs_src/body_nested_models/tutorial007.py!}
 ```
 
 ////
@@ -363,7 +363,7 @@ so wie in:
 //// tab | Python 3.9+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/body_nested_models/tutorial008_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial008_py39.py!}
 ```
 
 ////
@@ -371,7 +371,7 @@ so wie in:
 //// tab | Python 3.8+
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/body_nested_models/tutorial008.py!}
+{!> ../../docs_src/body_nested_models/tutorial008.py!}
 ```
 
 ////
@@ -407,7 +407,7 @@ Im folgenden Beispiel akzeptieren Sie irgendein `dict`, solange es `int`-Schlüs
 //// tab | Python 3.9+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/body_nested_models/tutorial009_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial009_py39.py!}
 ```
 
 ////
@@ -415,7 +415,7 @@ Im folgenden Beispiel akzeptieren Sie irgendein `dict`, solange es `int`-Schlüs
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/body_nested_models/tutorial009.py!}
+{!> ../../docs_src/body_nested_models/tutorial009.py!}
 ```
 
 ////
index b835549146333ec8bbb2142878c727b1b80ec410..ed5c1890fe58e522ec65c63515b11287ea00ebea 100644 (file)
@@ -9,7 +9,7 @@ Sie können den `jsonable_encoder` verwenden, um die empfangenen Daten in etwas
 //// tab | Python 3.10+
 
 ```Python hl_lines="28-33"
-{!> ../../../docs_src/body_updates/tutorial001_py310.py!}
+{!> ../../docs_src/body_updates/tutorial001_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Sie können den `jsonable_encoder` verwenden, um die empfangenen Daten in etwas
 //// tab | Python 3.9+
 
 ```Python hl_lines="30-35"
-{!> ../../../docs_src/body_updates/tutorial001_py39.py!}
+{!> ../../docs_src/body_updates/tutorial001_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Sie können den `jsonable_encoder` verwenden, um die empfangenen Daten in etwas
 //// tab | Python 3.8+
 
 ```Python hl_lines="30-35"
-{!> ../../../docs_src/body_updates/tutorial001.py!}
+{!> ../../docs_src/body_updates/tutorial001.py!}
 ```
 
 ////
@@ -87,7 +87,7 @@ Sie können das verwenden, um ein `dict` zu erstellen, das nur die (im Request)
 //// tab | Python 3.10+
 
 ```Python hl_lines="32"
-{!> ../../../docs_src/body_updates/tutorial002_py310.py!}
+{!> ../../docs_src/body_updates/tutorial002_py310.py!}
 ```
 
 ////
@@ -95,7 +95,7 @@ Sie können das verwenden, um ein `dict` zu erstellen, das nur die (im Request)
 //// tab | Python 3.9+
 
 ```Python hl_lines="34"
-{!> ../../../docs_src/body_updates/tutorial002_py39.py!}
+{!> ../../docs_src/body_updates/tutorial002_py39.py!}
 ```
 
 ////
@@ -103,7 +103,7 @@ Sie können das verwenden, um ein `dict` zu erstellen, das nur die (im Request)
 //// tab | Python 3.8+
 
 ```Python hl_lines="34"
-{!> ../../../docs_src/body_updates/tutorial002.py!}
+{!> ../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ////
@@ -125,7 +125,7 @@ Wie in `stored_item_model.model_copy(update=update_data)`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="33"
-{!> ../../../docs_src/body_updates/tutorial002_py310.py!}
+{!> ../../docs_src/body_updates/tutorial002_py310.py!}
 ```
 
 ////
@@ -133,7 +133,7 @@ Wie in `stored_item_model.model_copy(update=update_data)`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="35"
-{!> ../../../docs_src/body_updates/tutorial002_py39.py!}
+{!> ../../docs_src/body_updates/tutorial002_py39.py!}
 ```
 
 ////
@@ -141,7 +141,7 @@ Wie in `stored_item_model.model_copy(update=update_data)`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="35"
-{!> ../../../docs_src/body_updates/tutorial002.py!}
+{!> ../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ////
@@ -164,7 +164,7 @@ Zusammengefasst, um Teil-Ersetzungen vorzunehmen:
 //// tab | Python 3.10+
 
 ```Python hl_lines="28-35"
-{!> ../../../docs_src/body_updates/tutorial002_py310.py!}
+{!> ../../docs_src/body_updates/tutorial002_py310.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ Zusammengefasst, um Teil-Ersetzungen vorzunehmen:
 //// tab | Python 3.9+
 
 ```Python hl_lines="30-37"
-{!> ../../../docs_src/body_updates/tutorial002_py39.py!}
+{!> ../../docs_src/body_updates/tutorial002_py39.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ Zusammengefasst, um Teil-Ersetzungen vorzunehmen:
 //// tab | Python 3.8+
 
 ```Python hl_lines="30-37"
-{!> ../../../docs_src/body_updates/tutorial002.py!}
+{!> ../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ////
index 3fdd4ade329b3ef87968e973f0b0d83217902d5e..3a64e747e31b78cbcccc24091fed127b1086a0fa 100644 (file)
@@ -25,7 +25,7 @@ Zuerst müssen Sie `BaseModel` von `pydantic` importieren:
 //// tab | Python 3.10+
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -33,7 +33,7 @@ Zuerst müssen Sie `BaseModel` von `pydantic` importieren:
 //// tab | Python 3.8+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@ Verwenden Sie Standard-Python-Typen für die Klassenattribute:
 //// tab | Python 3.10+
 
 ```Python hl_lines="5-9"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -55,7 +55,7 @@ Verwenden Sie Standard-Python-Typen für die Klassenattribute:
 //// tab | Python 3.8+
 
 ```Python hl_lines="7-11"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -89,7 +89,7 @@ Um es zu Ihrer *Pfadoperation* hinzuzufügen, deklarieren Sie es auf die gleiche
 //// tab | Python 3.10+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ Um es zu Ihrer *Pfadoperation* hinzuzufügen, deklarieren Sie es auf die gleiche
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -170,7 +170,7 @@ Innerhalb der Funktion können Sie alle Attribute des Modells direkt verwenden:
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/body/tutorial002_py310.py!}
+{!> ../../docs_src/body/tutorial002_py310.py!}
 ```
 
 ////
@@ -178,7 +178,7 @@ Innerhalb der Funktion können Sie alle Attribute des Modells direkt verwenden:
 //// tab | Python 3.8+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/body/tutorial002.py!}
+{!> ../../docs_src/body/tutorial002.py!}
 ```
 
 ////
@@ -192,7 +192,7 @@ Sie können Pfad- und Requestbody-Parameter gleichzeitig deklarieren.
 //// tab | Python 3.10+
 
 ```Python hl_lines="15-16"
-{!> ../../../docs_src/body/tutorial003_py310.py!}
+{!> ../../docs_src/body/tutorial003_py310.py!}
 ```
 
 ////
@@ -200,7 +200,7 @@ Sie können Pfad- und Requestbody-Parameter gleichzeitig deklarieren.
 //// tab | Python 3.8+
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/body/tutorial003.py!}
+{!> ../../docs_src/body/tutorial003.py!}
 ```
 
 ////
@@ -214,7 +214,7 @@ Sie können auch zur gleichen Zeit **Body-**, **Pfad-** und **Query-Parameter**
 //// tab | Python 3.10+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial004_py310.py!}
+{!> ../../docs_src/body/tutorial004_py310.py!}
 ```
 
 ////
@@ -222,7 +222,7 @@ Sie können auch zur gleichen Zeit **Body-**, **Pfad-** und **Query-Parameter**
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial004.py!}
+{!> ../../docs_src/body/tutorial004.py!}
 ```
 
 ////
index 0060db8e88b47cf49b17e270d4c79d927d0b7552..4714a59aedc3ae4b6b1df27783d47afe24bd93d0 100644 (file)
@@ -9,7 +9,7 @@ Importieren Sie zuerst `Cookie`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Importieren Sie zuerst `Cookie`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Importieren Sie zuerst `Cookie`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
@@ -67,7 +67,7 @@ Der erste Wert ist der Typ. Sie können `Cookie` die gehabten Extra Validierungs
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Der erste Wert ist der Typ. Sie können `Cookie` die gehabten Extra Validierungs
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@ Der erste Wert ist der Typ. Sie können `Cookie` die gehabten Extra Validierungs
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -111,7 +111,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
index 0a9f05bf9066a66ca3a240f1c4f70f3c6a41f8d8..a660ab337d41f1a5e53fab89d9c5ac9ee4698695 100644 (file)
@@ -9,7 +9,7 @@ Im vorherigen Beispiel haben wir ein `dict` von unserer Abhängigkeit („Depend
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Im vorherigen Beispiel haben wir ein `dict` von unserer Abhängigkeit („Depend
 //// tab | Python 3.9+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Im vorherigen Beispiel haben wir ein `dict` von unserer Abhängigkeit („Depend
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -122,7 +122,7 @@ Dann können wir das „Dependable“ `common_parameters` der Abhängigkeit von
 //// tab | Python 3.10+
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -130,7 +130,7 @@ Dann können wir das „Dependable“ `common_parameters` der Abhängigkeit von
 //// tab | Python 3.9+
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -138,7 +138,7 @@ Dann können wir das „Dependable“ `common_parameters` der Abhängigkeit von
 //// tab | Python 3.8+
 
 ```Python hl_lines="12-16"
-{!> ../../../docs_src/dependencies/tutorial002_an.py!}
+{!> ../../docs_src/dependencies/tutorial002_an.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9-13"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -166,7 +166,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -176,7 +176,7 @@ Achten Sie auf die Methode `__init__`, die zum Erstellen der Instanz der Klasse
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -184,7 +184,7 @@ Achten Sie auf die Methode `__init__`, die zum Erstellen der Instanz der Klasse
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -192,7 +192,7 @@ Achten Sie auf die Methode `__init__`, die zum Erstellen der Instanz der Klasse
 //// tab | Python 3.8+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial002_an.py!}
+{!> ../../docs_src/dependencies/tutorial002_an.py!}
 ```
 
 ////
@@ -206,7 +206,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -220,7 +220,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -230,7 +230,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -238,7 +238,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -246,7 +246,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -260,7 +260,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -274,7 +274,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -296,7 +296,7 @@ Jetzt können Sie Ihre Abhängigkeit mithilfe dieser Klasse deklarieren.
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -304,7 +304,7 @@ Jetzt können Sie Ihre Abhängigkeit mithilfe dieser Klasse deklarieren.
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -312,7 +312,7 @@ Jetzt können Sie Ihre Abhängigkeit mithilfe dieser Klasse deklarieren.
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial002_an.py!}
+{!> ../../docs_src/dependencies/tutorial002_an.py!}
 ```
 
 ////
@@ -326,7 +326,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -340,7 +340,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -440,7 +440,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -448,7 +448,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -456,7 +456,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial003_an.py!}
+{!> ../../docs_src/dependencies/tutorial003_an.py!}
 ```
 
 ////
@@ -470,7 +470,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial003_py310.py!}
+{!> ../../docs_src/dependencies/tutorial003_py310.py!}
 ```
 
 ////
@@ -484,7 +484,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003.py!}
+{!> ../../docs_src/dependencies/tutorial003.py!}
 ```
 
 ////
@@ -578,7 +578,7 @@ Dasselbe Beispiel würde dann so aussehen:
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -586,7 +586,7 @@ Dasselbe Beispiel würde dann so aussehen:
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -594,7 +594,7 @@ Dasselbe Beispiel würde dann so aussehen:
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial004_an.py!}
+{!> ../../docs_src/dependencies/tutorial004_an.py!}
 ```
 
 ////
@@ -608,7 +608,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial004_py310.py!}
+{!> ../../docs_src/dependencies/tutorial004_py310.py!}
 ```
 
 ////
@@ -622,7 +622,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004.py!}
+{!> ../../docs_src/dependencies/tutorial004.py!}
 ```
 
 ////
index 47d6453c264f391ea3898692b3ed0bd82ea0ad3a..3bb261e44d49b6d1011742602335a8c1c59401e2 100644 (file)
@@ -17,7 +17,7 @@ Es sollte eine `list`e von `Depends()` sein:
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Es sollte eine `list`e von `Depends()` sein:
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Sie können Anforderungen für einen Request (wie Header) oder andere Unterabhä
 //// tab | Python 3.9+
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@ Sie können Anforderungen für einen Request (wie Header) oder andere Unterabhä
 //// tab | Python 3.8+
 
 ```Python hl_lines="7  12"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="6  11"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
@@ -109,7 +109,7 @@ Die Abhängigkeiten können Exceptions `raise`n, genau wie normale Abhängigkeit
 //// tab | Python 3.9+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Die Abhängigkeiten können Exceptions `raise`n, genau wie normale Abhängigkeit
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  14"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -131,7 +131,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
@@ -145,7 +145,7 @@ Sie können also eine normale Abhängigkeit (die einen Wert zurückgibt), die Si
 //// tab | Python 3.9+
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -153,7 +153,7 @@ Sie können also eine normale Abhängigkeit (die einen Wert zurückgibt), die Si
 //// tab | Python 3.8+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -167,7 +167,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9  14"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
index 9c2e6dd86abacbf398fa50ea587426d7221e022e..48b057e28cad6e84b843e64dabf6fab624f9c483 100644 (file)
@@ -30,19 +30,19 @@ Sie könnten damit beispielsweise eine Datenbanksession erstellen und diese nach
 Nur der Code vor und einschließlich der `yield`-Anweisung wird ausgeführt, bevor eine Response erzeugt wird:
 
 ```Python hl_lines="2-4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 Der ge`yield`ete Wert ist das, was in *Pfadoperationen* und andere Abhängigkeiten eingefügt wird:
 
 ```Python hl_lines="4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 Der auf die `yield`-Anweisung folgende Code wird ausgeführt, nachdem die Response gesendet wurde:
 
 ```Python hl_lines="5-6"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 /// tip | "Tipp"
@@ -64,7 +64,7 @@ Sie können also mit `except SomeException` diese bestimmte Exception innerhalb
 Auf die gleiche Weise können Sie `finally` verwenden, um sicherzustellen, dass die Exit-Schritte ausgeführt werden, unabhängig davon, ob eine Exception geworfen wurde oder nicht.
 
 ```Python hl_lines="3  5"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 ## Unterabhängigkeiten mit `yield`.
@@ -78,7 +78,7 @@ Beispielsweise kann `dependency_c` von `dependency_b` und `dependency_b` von `de
 //// tab | Python 3.9+
 
 ```Python hl_lines="6  14  22"
-{!> ../../../docs_src/dependencies/tutorial008_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -86,7 +86,7 @@ Beispielsweise kann `dependency_c` von `dependency_b` und `dependency_b` von `de
 //// tab | Python 3.8+
 
 ```Python hl_lines="5  13  21"
-{!> ../../../docs_src/dependencies/tutorial008_an.py!}
+{!> ../../docs_src/dependencies/tutorial008_an.py!}
 ```
 
 ////
@@ -100,7 +100,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="4  12  20"
-{!> ../../../docs_src/dependencies/tutorial008.py!}
+{!> ../../docs_src/dependencies/tutorial008.py!}
 ```
 
 ////
@@ -114,7 +114,7 @@ Und wiederum benötigt `dependency_b` den Wert von `dependency_a` (hier `dep_a`
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-19  26-27"
-{!> ../../../docs_src/dependencies/tutorial008_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -122,7 +122,7 @@ Und wiederum benötigt `dependency_b` den Wert von `dependency_a` (hier `dep_a`
 //// tab | Python 3.8+
 
 ```Python hl_lines="17-18  25-26"
-{!> ../../../docs_src/dependencies/tutorial008_an.py!}
+{!> ../../docs_src/dependencies/tutorial008_an.py!}
 ```
 
 ////
@@ -136,7 +136,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="16-17  24-25"
-{!> ../../../docs_src/dependencies/tutorial008.py!}
+{!> ../../docs_src/dependencies/tutorial008.py!}
 ```
 
 ////
@@ -174,7 +174,7 @@ Aber es ist für Sie da, wenn Sie es brauchen. 🤓
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-22  31"
-{!> ../../../docs_src/dependencies/tutorial008b_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008b_an_py39.py!}
 ```
 
 ////
@@ -182,7 +182,7 @@ Aber es ist für Sie da, wenn Sie es brauchen. 🤓
 //// tab | Python 3.8+
 
 ```Python hl_lines="17-21  30"
-{!> ../../../docs_src/dependencies/tutorial008b_an.py!}
+{!> ../../docs_src/dependencies/tutorial008b_an.py!}
 ```
 
 ////
@@ -196,7 +196,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="16-20  29"
-{!> ../../../docs_src/dependencies/tutorial008b.py!}
+{!> ../../docs_src/dependencies/tutorial008b.py!}
 ```
 
 ////
@@ -321,7 +321,7 @@ In Python können Sie Kontextmanager erstellen, indem Sie <a href="https://docs.
 Sie können solche auch innerhalb von **FastAPI**-Abhängigkeiten mit `yield` verwenden, indem Sie `with`- oder `async with`-Anweisungen innerhalb der Abhängigkeits-Funktion verwenden:
 
 ```Python hl_lines="1-9  13"
-{!../../../docs_src/dependencies/tutorial010.py!}
+{!../../docs_src/dependencies/tutorial010.py!}
 ```
 
 /// tip | "Tipp"
index 26e631b1cfeac966ab5d574fb855267d2fd212a3..6b9e9e3958d2d62596baec3ff8d9757de4f6c8ea 100644 (file)
@@ -9,7 +9,7 @@ In diesem Fall werden sie auf alle *Pfadoperationen* in der Anwendung angewendet
 //// tab | Python 3.9+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial012_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial012_an_py39.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ In diesem Fall werden sie auf alle *Pfadoperationen* in der Anwendung angewendet
 //// tab | Python 3.8+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial012_an.py!}
+{!> ../../docs_src/dependencies/tutorial012_an.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/dependencies/tutorial012.py!}
+{!> ../../docs_src/dependencies/tutorial012.py!}
 ```
 
 ////
index f7d9ed5109325c4ca140891024df4dbe162ec45b..494708d1911a39fca415ab9b9862aa256a894d0d 100644 (file)
@@ -33,7 +33,7 @@ Es handelt sich einfach um eine Funktion, die die gleichen Parameter entgegennim
 //// tab | Python 3.10+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -41,7 +41,7 @@ Es handelt sich einfach um eine Funktion, die die gleichen Parameter entgegennim
 //// tab | Python 3.9+
 
 ```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -49,7 +49,7 @@ Es handelt sich einfach um eine Funktion, die die gleichen Parameter entgegennim
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-12"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -63,7 +63,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="6-7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -77,7 +77,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -115,7 +115,7 @@ Bitte [aktualisieren Sie FastAPI](../../deployment/versions.md#upgrade-der-fasta
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -123,7 +123,7 @@ Bitte [aktualisieren Sie FastAPI](../../deployment/versions.md#upgrade-der-fasta
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -131,7 +131,7 @@ Bitte [aktualisieren Sie FastAPI](../../deployment/versions.md#upgrade-der-fasta
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -145,7 +145,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -159,7 +159,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ So wie auch `Body`, `Query`, usw., verwenden Sie `Depends` mit den Parametern Ih
 //// tab | Python 3.10+
 
 ```Python hl_lines="13  18"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ So wie auch `Body`, `Query`, usw., verwenden Sie `Depends` mit den Parametern Ih
 //// tab | Python 3.9+
 
 ```Python hl_lines="15  20"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -187,7 +187,7 @@ So wie auch `Body`, `Query`, usw., verwenden Sie `Depends` mit den Parametern Ih
 //// tab | Python 3.8+
 
 ```Python hl_lines="16  21"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -201,7 +201,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -215,7 +215,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="15  20"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -278,7 +278,7 @@ Da wir jedoch `Annotated` verwenden, können wir diesen `Annotated`-Wert in eine
 //// tab | Python 3.10+
 
 ```Python hl_lines="12  16  21"
-{!> ../../../docs_src/dependencies/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an_py310.py!}
 ```
 
 ////
@@ -286,7 +286,7 @@ Da wir jedoch `Annotated` verwenden, können wir diesen `Annotated`-Wert in eine
 //// tab | Python 3.9+
 
 ```Python hl_lines="14  18  23"
-{!> ../../../docs_src/dependencies/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an_py39.py!}
 ```
 
 ////
@@ -294,7 +294,7 @@ Da wir jedoch `Annotated` verwenden, können wir diesen `Annotated`-Wert in eine
 //// tab | Python 3.8+
 
 ```Python hl_lines="15  19  24"
-{!> ../../../docs_src/dependencies/tutorial001_02_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an.py!}
 ```
 
 ////
index 12664a8cd29d5a5c3bad44f727c7984443755b27..a20aed63b3b46a30ca1007e1cdb29096fc62ef9c 100644 (file)
@@ -13,7 +13,7 @@ Sie könnten eine erste Abhängigkeit („Dependable“) wie folgt erstellen:
 //// tab | Python 3.10+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -21,7 +21,7 @@ Sie könnten eine erste Abhängigkeit („Dependable“) wie folgt erstellen:
 //// tab | Python 3.9+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -29,7 +29,7 @@ Sie könnten eine erste Abhängigkeit („Dependable“) wie folgt erstellen:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-10"
-{!> ../../../docs_src/dependencies/tutorial005_an.py!}
+{!> ../../docs_src/dependencies/tutorial005_an.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="6-7"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@ Dann können Sie eine weitere Abhängigkeitsfunktion (ein „Dependable“) erst
 //// tab | Python 3.10+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -81,7 +81,7 @@ Dann können Sie eine weitere Abhängigkeitsfunktion (ein „Dependable“) erst
 //// tab | Python 3.9+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -89,7 +89,7 @@ Dann können Sie eine weitere Abhängigkeitsfunktion (ein „Dependable“) erst
 //// tab | Python 3.8+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/dependencies/tutorial005_an.py!}
+{!> ../../docs_src/dependencies/tutorial005_an.py!}
 ```
 
 ////
@@ -103,7 +103,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
@@ -136,7 +136,7 @@ Diese Abhängigkeit verwenden wir nun wie folgt:
 //// tab | Python 3.10+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/dependencies/tutorial005_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -144,7 +144,7 @@ Diese Abhängigkeit verwenden wir nun wie folgt:
 //// tab | Python 3.9+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/dependencies/tutorial005_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ Diese Abhängigkeit verwenden wir nun wie folgt:
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/dependencies/tutorial005_an.py!}
+{!> ../../docs_src/dependencies/tutorial005_an.py!}
 ```
 
 ////
@@ -166,7 +166,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
index 38a881b4f623c55aaec2fca58310cd597254b8bb..0ab72b8dd37fb19f7271f7f85cd77067df17c512 100644 (file)
@@ -23,7 +23,7 @@ Es nimmt ein Objekt entgegen, wie etwa ein Pydantic-Modell, und gibt eine JSON-k
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  21"
-{!> ../../../docs_src/encoder/tutorial001_py310.py!}
+{!> ../../docs_src/encoder/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Es nimmt ein Objekt entgegen, wie etwa ein Pydantic-Modell, und gibt eine JSON-k
 //// tab | Python 3.8+
 
 ```Python hl_lines="5  22"
-{!> ../../../docs_src/encoder/tutorial001.py!}
+{!> ../../docs_src/encoder/tutorial001.py!}
 ```
 
 ////
index 334a232a8f6cd0b3fef69d454e0cb21c743e93d7..7581b4f870734fa92ea422b9f46bedd36bd5d6b6 100644 (file)
@@ -58,7 +58,7 @@ Hier ist ein Beispiel für eine *Pfadoperation* mit Parametern, die einige der o
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  3  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -66,7 +66,7 @@ Hier ist ein Beispiel für eine *Pfadoperation* mit Parametern, die einige der o
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  3  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@ Hier ist ein Beispiel für eine *Pfadoperation* mit Parametern, die einige der o
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  3  13-17"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
 ```
 
 ////
@@ -88,7 +88,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1  2  11-15"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
@@ -102,7 +102,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1  2  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
@@ -112,7 +112,7 @@ Beachten Sie, dass die Parameter innerhalb der Funktion ihren natürlichen Daten
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -120,7 +120,7 @@ Beachten Sie, dass die Parameter innerhalb der Funktion ihren natürlichen Daten
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -128,7 +128,7 @@ Beachten Sie, dass die Parameter innerhalb der Funktion ihren natürlichen Daten
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-20"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
 ```
 
 ////
@@ -142,7 +142,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
@@ -156,7 +156,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
index cfd0230eb2664eadc4f58e29e0b4d38eaf8a1fd9..14e84206542206374d0f30cf25c6e579ba0d1f27 100644 (file)
@@ -23,7 +23,7 @@ Hier der generelle Weg, wie die Modelle mit ihren Passwort-Feldern aussehen kön
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  9  14  20  22  27-28  31-33  38-39"
-{!> ../../../docs_src/extra_models/tutorial001_py310.py!}
+{!> ../../docs_src/extra_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Hier der generelle Weg, wie die Modelle mit ihren Passwort-Feldern aussehen kön
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  11  16  22  24  29-30  33-35  40-41"
-{!> ../../../docs_src/extra_models/tutorial001.py!}
+{!> ../../docs_src/extra_models/tutorial001.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Auf diese Weise beschreiben wir nur noch die Unterschiede zwischen den Modellen
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  13-14  17-18  21-22"
-{!> ../../../docs_src/extra_models/tutorial002_py310.py!}
+{!> ../../docs_src/extra_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -187,7 +187,7 @@ Auf diese Weise beschreiben wir nur noch die Unterschiede zwischen den Modellen
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  15-16  19-20  23-24"
-{!> ../../../docs_src/extra_models/tutorial002.py!}
+{!> ../../docs_src/extra_models/tutorial002.py!}
 ```
 
 ////
@@ -209,7 +209,7 @@ Listen Sie, wenn Sie eine <a href="https://pydantic-docs.helpmanual.io/usage/typ
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  14-15  18-20  33"
-{!> ../../../docs_src/extra_models/tutorial003_py310.py!}
+{!> ../../docs_src/extra_models/tutorial003_py310.py!}
 ```
 
 ////
@@ -217,7 +217,7 @@ Listen Sie, wenn Sie eine <a href="https://pydantic-docs.helpmanual.io/usage/typ
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  14-15  18-20  33"
-{!> ../../../docs_src/extra_models/tutorial003.py!}
+{!> ../../docs_src/extra_models/tutorial003.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ Verwenden Sie dafür Pythons Standard `typing.List` (oder nur `list` in Python 3
 //// tab | Python 3.9+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/extra_models/tutorial004_py39.py!}
+{!> ../../docs_src/extra_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -253,7 +253,7 @@ Verwenden Sie dafür Pythons Standard `typing.List` (oder nur `list` in Python 3
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  20"
-{!> ../../../docs_src/extra_models/tutorial004.py!}
+{!> ../../docs_src/extra_models/tutorial004.py!}
 ```
 
 ////
@@ -269,7 +269,7 @@ In diesem Fall können Sie `typing.Dict` verwenden (oder nur `dict` in Python 3.
 //// tab | Python 3.9+
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/extra_models/tutorial005_py39.py!}
+{!> ../../docs_src/extra_models/tutorial005_py39.py!}
 ```
 
 ////
@@ -277,7 +277,7 @@ In diesem Fall können Sie `typing.Dict` verwenden (oder nur `dict` in Python 3.
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  8"
-{!> ../../../docs_src/extra_models/tutorial005.py!}
+{!> ../../docs_src/extra_models/tutorial005.py!}
 ```
 
 ////
index b9e38707cb092f8e4fa412fdca732808d79bd4f6..fe3886b70c1b7b704c0d6049630064e6ca375191 100644 (file)
@@ -3,7 +3,7 @@
 Die einfachste FastAPI-Datei könnte wie folgt aussehen:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Kopieren Sie dies in eine Datei `main.py`.
@@ -134,7 +134,7 @@ Ebenfalls können Sie es verwenden, um automatisch Code für Clients zu generier
 ### Schritt 1: Importieren von `FastAPI`
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI` ist eine Python-Klasse, die die gesamte Funktionalität für Ihre API bereitstellt.
@@ -150,7 +150,7 @@ Sie können alle <a href="https://www.starlette.io/" class="external-link" targe
 ### Schritt 2: Erzeugen einer `FastAPI`-„Instanz“
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 In diesem Beispiel ist die Variable `app` eine „Instanz“ der Klasse `FastAPI`.
@@ -172,7 +172,7 @@ $ uvicorn main:app --reload
 Wenn Sie Ihre Anwendung wie folgt erstellen:
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
 ```
 
 Und in eine Datei `main.py` einfügen, dann würden Sie `uvicorn` wie folgt aufrufen:
@@ -251,7 +251,7 @@ Wir werden sie auch „**Operationen**“ nennen.
 #### Definieren eines *Pfadoperation-Dekorators*
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Das `@app.get("/")` sagt **FastAPI**, dass die Funktion direkt darunter für die Bearbeitung von Anfragen zuständig ist, die an:
@@ -307,7 +307,7 @@ Das ist unsere „**Pfadoperation-Funktion**“:
 * **Funktion**: ist die Funktion direkt unter dem „Dekorator“ (unter `@app.get("/")`).
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Dies ist eine Python-Funktion.
@@ -321,7 +321,7 @@ In diesem Fall handelt es sich um eine `async`-Funktion.
 Sie könnten sie auch als normale Funktion anstelle von `async def` definieren:
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note | "Hinweis"
@@ -333,7 +333,7 @@ Wenn Sie den Unterschied nicht kennen, lesen Sie [Async: *„In Eile?“*](../as
 ### Schritt 5: den Inhalt zurückgeben
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Sie können ein `dict`, eine `list`, einzelne Werte wie `str`, `int`, usw. zurückgeben.
index 6ee47948c8e504be5168953df76191e0ec5a42b0..70dc0c523f614016f88e003d556d6842ea35b654 100644 (file)
@@ -26,7 +26,7 @@ Um HTTP-Responses mit Fehlern zum Client zurückzugeben, verwenden Sie `HTTPExce
 ### `HTTPException` importieren
 
 ```Python hl_lines="1"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 ```
 
 ### Eine `HTTPException` in Ihrem Code auslösen
@@ -42,7 +42,7 @@ Der Vorteil, eine Exception auszulösen (`raise`), statt sie zurückzugeben (`re
 Im folgenden Beispiel lösen wir, wenn der Client eine ID anfragt, die nicht existiert, eine Exception mit dem Statuscode `404` aus.
 
 ```Python hl_lines="11"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 ```
 
 ### Die resultierende Response
@@ -82,7 +82,7 @@ Sie müssen das wahrscheinlich nicht direkt in ihrem Code verwenden.
 Aber falls es in einem fortgeschrittenen Szenario notwendig ist, können Sie benutzerdefinierte Header wie folgt hinzufügen:
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial002.py!}
+{!../../docs_src/handling_errors/tutorial002.py!}
 ```
 
 ## Benutzerdefinierte Exceptionhandler definieren
@@ -96,7 +96,7 @@ Und Sie möchten diese Exception global mit FastAPI handhaben.
 Sie könnten einen benutzerdefinierten Exceptionhandler mittels `@app.exception_handler()` hinzufügen:
 
 ```Python hl_lines="5-7  13-18  24"
-{!../../../docs_src/handling_errors/tutorial003.py!}
+{!../../docs_src/handling_errors/tutorial003.py!}
 ```
 
 Wenn Sie nun `/unicorns/yolo` anfragen, `raise`d die *Pfadoperation* eine `UnicornException`.
@@ -136,7 +136,7 @@ Um diesen zu überschreiben, importieren Sie den `RequestValidationError` und ve
 Der Exceptionhandler wird einen `Request` und die Exception entgegennehmen.
 
 ```Python hl_lines="2  14-16"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 ```
 
 Wenn Sie nun `/items/foo` besuchen, erhalten Sie statt des Default-JSON-Errors:
@@ -189,7 +189,7 @@ Genauso können Sie den `HTTPException`-Handler überschreiben.
 Zum Beispiel könnten Sie eine Klartext-Response statt JSON für diese Fehler zurückgeben wollen:
 
 ```Python hl_lines="3-4  9-11  22"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 ```
 
 /// note | "Technische Details"
@@ -207,7 +207,7 @@ Der `RequestValidationError` enthält den empfangenen `body` mit den ungültigen
 Sie könnten diesen verwenden, während Sie Ihre Anwendung entwickeln, um den Body zu loggen und zu debuggen, ihn zum Benutzer zurückzugeben, usw.
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial005.py!}
+{!../../docs_src/handling_errors/tutorial005.py!}
 ```
 
 Jetzt versuchen Sie, einen ungültigen Artikel zu senden:
@@ -265,7 +265,7 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
 Wenn Sie die Exception zusammen mit denselben Default-Exceptionhandlern von **FastAPI** verwenden möchten, können Sie die Default-Exceptionhandler von `fastapi.Exception_handlers` importieren und wiederverwenden:
 
 ```Python hl_lines="2-5  15  21"
-{!../../../docs_src/handling_errors/tutorial006.py!}
+{!../../docs_src/handling_errors/tutorial006.py!}
 ```
 
 In diesem Beispiel `print`en Sie nur den Fehler mit einer sehr ausdrucksstarken Nachricht, aber Sie sehen, worauf wir hinauswollen. Sie können mit der Exception etwas machen und dann einfach die Default-Exceptionhandler wiederverwenden.
index c8c3a4c5774edf759de27e5120f04367ce3a4d62..c4901c2ee4bdcdb8802bae6a7593e7f75f82e443 100644 (file)
@@ -9,7 +9,7 @@ Importieren Sie zuerst `Header`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Importieren Sie zuerst `Header`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Importieren Sie zuerst `Header`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001_an.py!}
+{!> ../../docs_src/header_params/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/header_params/tutorial001_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001.py!}
+{!> ../../docs_src/header_params/tutorial001.py!}
 ```
 
 ////
@@ -67,7 +67,7 @@ Der erste Wert ist der Typ. Sie können `Header` die gehabten Extra Validierungs
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Der erste Wert ist der Typ. Sie können `Header` die gehabten Extra Validierungs
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@ Der erste Wert ist der Typ. Sie können `Header` die gehabten Extra Validierungs
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial001_an.py!}
+{!> ../../docs_src/header_params/tutorial001_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/header_params/tutorial001_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -111,7 +111,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001.py!}
+{!> ../../docs_src/header_params/tutorial001.py!}
 ```
 
 ////
@@ -149,7 +149,7 @@ Wenn Sie aus irgendeinem Grund das automatische Konvertieren von Unterstrichen z
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial002_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -157,7 +157,7 @@ Wenn Sie aus irgendeinem Grund das automatische Konvertieren von Unterstrichen z
 //// tab | Python 3.9+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/header_params/tutorial002_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -165,7 +165,7 @@ Wenn Sie aus irgendeinem Grund das automatische Konvertieren von Unterstrichen z
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/header_params/tutorial002_an.py!}
+{!> ../../docs_src/header_params/tutorial002_an.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/header_params/tutorial002_py310.py!}
+{!> ../../docs_src/header_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -193,7 +193,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial002.py!}
+{!> ../../docs_src/header_params/tutorial002.py!}
 ```
 
 ////
@@ -217,7 +217,7 @@ Um zum Beispiel einen Header `X-Token` zu deklarieren, der mehrmals vorkommen ka
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -225,7 +225,7 @@ Um zum Beispiel einen Header `X-Token` zu deklarieren, der mehrmals vorkommen ka
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -233,7 +233,7 @@ Um zum Beispiel einen Header `X-Token` zu deklarieren, der mehrmals vorkommen ka
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial003_an.py!}
+{!> ../../docs_src/header_params/tutorial003_an.py!}
 ```
 
 ////
@@ -247,7 +247,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/header_params/tutorial003_py310.py!}
+{!> ../../docs_src/header_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -261,7 +261,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_py39.py!}
+{!> ../../docs_src/header_params/tutorial003_py39.py!}
 ```
 
 ////
@@ -275,7 +275,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003.py!}
+{!> ../../docs_src/header_params/tutorial003.py!}
 ```
 
 ////
index 3ab56ff3efcf98f88ad056f6f2d1a25eb9676f60..98724e1e8a9b9bf14173716d8002a9c87c3b0b1a 100644 (file)
@@ -19,7 +19,7 @@ Sie können die folgenden Felder festlegen, welche in der OpenAPI-Spezifikation
 Sie können diese wie folgt setzen:
 
 ```Python hl_lines="3-16  19-32"
-{!../../../docs_src/metadata/tutorial001.py!}
+{!../../docs_src/metadata/tutorial001.py!}
 ```
 
 /// tip | "Tipp"
@@ -39,7 +39,7 @@ Seit OpenAPI 3.1.0 und FastAPI 0.99.0 können Sie die `license_info` auch mit ei
 Zum Beispiel:
 
 ```Python hl_lines="31"
-{!../../../docs_src/metadata/tutorial001_1.py!}
+{!../../docs_src/metadata/tutorial001_1.py!}
 ```
 
 ## Metadaten für Tags
@@ -63,7 +63,7 @@ Versuchen wir das an einem Beispiel mit Tags für `users` und `items`.
 Erstellen Sie Metadaten für Ihre Tags und übergeben Sie sie an den Parameter `openapi_tags`:
 
 ```Python hl_lines="3-16  18"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
 ```
 
 Beachten Sie, dass Sie Markdown in den Beschreibungen verwenden können. Beispielsweise wird „login“ in Fettschrift (**login**) und „fancy“ in Kursivschrift (_fancy_) angezeigt.
@@ -79,7 +79,7 @@ Sie müssen nicht für alle von Ihnen verwendeten Tags Metadaten hinzufügen.
 Verwenden Sie den Parameter `tags` mit Ihren *Pfadoperationen* (und `APIRouter`n), um diese verschiedenen Tags zuzuweisen:
 
 ```Python hl_lines="21  26"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
 ```
 
 /// info
@@ -109,7 +109,7 @@ Sie können das aber mit dem Parameter `openapi_url` konfigurieren.
 Um beispielsweise festzulegen, dass es unter `/api/v1/openapi.json` bereitgestellt wird:
 
 ```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial002.py!}
+{!../../docs_src/metadata/tutorial002.py!}
 ```
 
 Wenn Sie das OpenAPI-Schema vollständig deaktivieren möchten, können Sie `openapi_url=None` festlegen, wodurch auch die Dokumentationsbenutzeroberflächen deaktiviert werden, die es verwenden.
@@ -128,5 +128,5 @@ Sie können die beiden enthaltenen Dokumentationsbenutzeroberflächen konfigurie
 Um beispielsweise Swagger UI so einzustellen, dass sie unter `/documentation` bereitgestellt wird, und ReDoc zu deaktivieren:
 
 ```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial003.py!}
+{!../../docs_src/metadata/tutorial003.py!}
 ```
index 62a0d1613ff914dad521420baa7b91e35d46bd41..410dc0247f257fca32fcb92e73b3eaf2504799ff 100644 (file)
@@ -32,7 +32,7 @@ Die Middleware-Funktion erhält:
 * Sie können die `response` dann weiter modifizieren, bevor Sie sie zurückgeben.
 
 ```Python hl_lines="8-9  11  14"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 /// tip | "Tipp"
@@ -60,7 +60,7 @@ Und auch nachdem die `response` generiert wurde, bevor sie zurückgegeben wird.
 Sie könnten beispielsweise einen benutzerdefinierten Header `X-Process-Time` hinzufügen, der die Zeit in Sekunden enthält, die benötigt wurde, um den Request zu verarbeiten und eine Response zu generieren:
 
 ```Python hl_lines="10  12-13"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 ## Andere Middlewares
index 03980b7dd06751f1c31677c3880b65ddc047aded..411916e9c5007e369aa3d3fe8754d2545af97780 100644 (file)
@@ -19,7 +19,7 @@ Aber falls Sie sich nicht mehr erinnern, wofür jede Nummer steht, können Sie d
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  15"
-{!> ../../../docs_src/path_operation_configuration/tutorial001_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001_py310.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ Aber falls Sie sich nicht mehr erinnern, wofür jede Nummer steht, können Sie d
 //// tab | Python 3.9+
 
 ```Python hl_lines="3  17"
-{!> ../../../docs_src/path_operation_configuration/tutorial001_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001_py39.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@ Aber falls Sie sich nicht mehr erinnern, wofür jede Nummer steht, können Sie d
 //// tab | Python 3.8+
 
 ```Python hl_lines="3  17"
-{!> ../../../docs_src/path_operation_configuration/tutorial001.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@ Sie können Ihrer *Pfadoperation* Tags hinzufügen, mittels des Parameters `tags
 //// tab | Python 3.10+
 
 ```Python hl_lines="15  20  25"
-{!> ../../../docs_src/path_operation_configuration/tutorial002_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002_py310.py!}
 ```
 
 ////
@@ -65,7 +65,7 @@ Sie können Ihrer *Pfadoperation* Tags hinzufügen, mittels des Parameters `tags
 //// tab | Python 3.9+
 
 ```Python hl_lines="17  22  27"
-{!> ../../../docs_src/path_operation_configuration/tutorial002_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002_py39.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@ Sie können Ihrer *Pfadoperation* Tags hinzufügen, mittels des Parameters `tags
 //// tab | Python 3.8+
 
 ```Python hl_lines="17  22  27"
-{!> ../../../docs_src/path_operation_configuration/tutorial002.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002.py!}
 ```
 
 ////
@@ -91,7 +91,7 @@ In diesem Fall macht es Sinn, die Tags in einem `Enum` zu speichern.
 **FastAPI** unterstützt diese genauso wie einfache Strings:
 
 ```Python hl_lines="1  8-10  13  18"
-{!../../../docs_src/path_operation_configuration/tutorial002b.py!}
+{!../../docs_src/path_operation_configuration/tutorial002b.py!}
 ```
 
 ## Zusammenfassung und Beschreibung
@@ -101,7 +101,7 @@ Sie können eine Zusammenfassung (`summary`) und eine Beschreibung (`description
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/path_operation_configuration/tutorial003_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003_py310.py!}
 ```
 
 ////
@@ -109,7 +109,7 @@ Sie können eine Zusammenfassung (`summary`) und eine Beschreibung (`description
 //// tab | Python 3.9+
 
 ```Python hl_lines="20-21"
-{!> ../../../docs_src/path_operation_configuration/tutorial003_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003_py39.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Sie können eine Zusammenfassung (`summary`) und eine Beschreibung (`description
 //// tab | Python 3.8+
 
 ```Python hl_lines="20-21"
-{!> ../../../docs_src/path_operation_configuration/tutorial003.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003.py!}
 ```
 
 ////
@@ -131,7 +131,7 @@ Sie können im Docstring <a href="https://en.wikipedia.org/wiki/Markdown" class=
 //// tab | Python 3.10+
 
 ```Python hl_lines="17-25"
-{!> ../../../docs_src/path_operation_configuration/tutorial004_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004_py310.py!}
 ```
 
 ////
@@ -139,7 +139,7 @@ Sie können im Docstring <a href="https://en.wikipedia.org/wiki/Markdown" class=
 //// tab | Python 3.9+
 
 ```Python hl_lines="19-27"
-{!> ../../../docs_src/path_operation_configuration/tutorial004_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004_py39.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ Sie können im Docstring <a href="https://en.wikipedia.org/wiki/Markdown" class=
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-27"
-{!> ../../../docs_src/path_operation_configuration/tutorial004.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004.py!}
 ```
 
 ////
@@ -163,7 +163,7 @@ Die Response können Sie mit dem Parameter `response_description` beschreiben:
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/path_operation_configuration/tutorial005_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005_py310.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ Die Response können Sie mit dem Parameter `response_description` beschreiben:
 //// tab | Python 3.9+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/path_operation_configuration/tutorial005_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005_py39.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Die Response können Sie mit dem Parameter `response_description` beschreiben:
 //// tab | Python 3.8+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/path_operation_configuration/tutorial005.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005.py!}
 ```
 
 ////
@@ -205,7 +205,7 @@ Daher, wenn Sie keine vergeben, wird **FastAPI** automatisch eine für „Erfolg
 Wenn Sie eine *Pfadoperation* als <abbr title="deprecated – obsolet, veraltet: Es soll nicht mehr verwendet werden">deprecated</abbr> kennzeichnen möchten, ohne sie zu entfernen, fügen Sie den Parameter `deprecated` hinzu:
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_operation_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_configuration/tutorial006.py!}
 ```
 
 Sie wird in der interaktiven Dokumentation gut sichtbar als deprecated markiert werden:
index 3908a0b2d5c003b5faae1504aeb56f2b41249418..fc2d5dff113c1f70649b3d1ef03fa9368daaabd8 100644 (file)
@@ -9,7 +9,7 @@ Importieren Sie zuerst `Path` von `fastapi`, und importieren Sie `Annotated`.
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Importieren Sie zuerst `Path` von `fastapi`, und importieren Sie `Annotated`.
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Importieren Sie zuerst `Path` von `fastapi`, und importieren Sie `Annotated`.
 //// tab | Python 3.8+
 
 ```Python hl_lines="3-4"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -77,7 +77,7 @@ Um zum Beispiel einen `title`-Metadaten-Wert für den Pfad-Parameter `item_id` z
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -85,7 +85,7 @@ Um zum Beispiel einen `title`-Metadaten-Wert für den Pfad-Parameter `item_id` z
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@ Um zum Beispiel einen `title`-Metadaten-Wert für den Pfad-Parameter `item_id` z
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
 ```
 
 ////
@@ -107,7 +107,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -121,7 +121,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -167,7 +167,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002.py!}
 ```
 
 ////
@@ -177,7 +177,7 @@ Aber bedenken Sie, dass Sie dieses Problem nicht haben, wenn Sie `Annotated` ver
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -185,7 +185,7 @@ Aber bedenken Sie, dass Sie dieses Problem nicht haben, wenn Sie `Annotated` ver
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002_an.py!}
 ```
 
 ////
@@ -214,7 +214,7 @@ Wenn Sie eines der folgenden Dinge tun möchten:
 Python macht nichts mit diesem `*`, aber es wird wissen, dass alle folgenden Parameter als <abbr title="Keyword-Argument – Schlüsselwort-Argument: Das Argument wird anhand seines Namens erkannt, nicht anhand seiner Reihenfolge in der Argumentliste">Keyword-Argumente</abbr> (Schlüssel-Wert-Paare), auch bekannt als <abbr title="Von: K-ey W-ord Arg-uments"><code>kwargs</code></abbr>, verwendet werden. Selbst wenn diese keinen Defaultwert haben.
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
 ```
 
 ### Besser mit `Annotated`
@@ -224,7 +224,7 @@ Bedenken Sie, dass Sie, wenn Sie `Annotated` verwenden, dieses Problem nicht hab
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -232,7 +232,7 @@ Bedenken Sie, dass Sie, wenn Sie `Annotated` verwenden, dieses Problem nicht hab
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ Hier, mit `ge=1`, wird festgelegt, dass `item_id` eine Ganzzahl benötigt, die g
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -253,7 +253,7 @@ Hier, mit `ge=1`, wird festgelegt, dass `item_id` eine Ganzzahl benötigt, die g
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
 ```
 
 ////
@@ -267,7 +267,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004.py!}
 ```
 
 ////
@@ -282,7 +282,7 @@ Das Gleiche trifft zu auf:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -290,7 +290,7 @@ Das Gleiche trifft zu auf:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
 ```
 
 ////
@@ -304,7 +304,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005.py!}
 ```
 
 ////
@@ -322,7 +322,7 @@ Das gleiche gilt für <abbr title="less than – kleiner als"><code>lt</code></a
 //// tab | Python 3.9+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -330,7 +330,7 @@ Das gleiche gilt für <abbr title="less than – kleiner als"><code>lt</code></a
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
 ```
 
 ////
@@ -344,7 +344,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006.py!}
 ```
 
 ////
index 2c1b691a8042d28cd0db15cdbce746227eeb641e..9cb172c941d884ac594c241c9907f5f9abc8d06e 100644 (file)
@@ -3,7 +3,7 @@
 Sie können Pfad-„Parameter“ oder -„Variablen“ mit der gleichen Syntax deklarieren, welche in Python-<abbr title="Format-String – Formatierter String: Der String enthält Variablen, die mit geschweiften Klammern umschlossen sind. Solche Stellen werden durch den Wert der Variable ersetzt">Format-Strings</abbr> verwendet wird:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
 ```
 
 Der Wert des Pfad-Parameters `item_id` wird Ihrer Funktion als das Argument `item_id` übergeben.
@@ -19,7 +19,7 @@ Wenn Sie dieses Beispiel ausführen und auf <a href="http://127.0.0.1:8000/items
 Sie können den Typ eines Pfad-Parameters in der Argumentliste der Funktion deklarieren, mit Standard-Python-Typannotationen:
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
 ```
 
 In diesem Fall wird `item_id` als `int` deklariert, also als Ganzzahl.
@@ -124,7 +124,7 @@ Und Sie haben auch einen Pfad `/users/{user_id}`, um Daten über einen spezifisc
 Weil *Pfadoperationen* in ihrer Reihenfolge ausgewertet werden, müssen Sie sicherstellen, dass der Pfad `/users/me` vor `/users/{user_id}` deklariert wurde:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
 ```
 
 Ansonsten würde der Pfad für `/users/{user_id}` auch `/users/me` auswerten, und annehmen, dass ein Parameter `user_id` mit dem Wert `"me"` übergeben wurde.
@@ -132,7 +132,7 @@ Ansonsten würde der Pfad für `/users/{user_id}` auch `/users/me` auswerten, un
 Sie können eine Pfadoperation auch nicht erneut definieren:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003b.py!}
+{!../../docs_src/path_params/tutorial003b.py!}
 ```
 
 Die erste Definition wird immer verwendet werden, da ihr Pfad zuerst übereinstimmt.
@@ -150,7 +150,7 @@ Indem Sie von `str` erben, weiß die API Dokumentation, dass die Werte des Enums
 Erstellen Sie dann Klassen-Attribute mit festgelegten Werten, welches die erlaubten Werte sein werden:
 
 ```Python hl_lines="1  6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// info
@@ -170,7 +170,7 @@ Falls Sie sich fragen, was „AlexNet“, „ResNet“ und „LeNet“ ist, das
 Dann erstellen Sie einen *Pfad-Parameter*, der als Typ die gerade erstellte Enum-Klasse hat (`ModelName`):
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 ### Testen Sie es in der API-Dokumentation
@@ -188,7 +188,7 @@ Der *Pfad-Parameter* wird ein *<abbr title="Member – Mitglied: Einer der mögl
 Sie können ihn mit einem Member Ihres Enums `ModelName` vergleichen:
 
 ```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 #### *Enum-Wert* erhalten
@@ -196,7 +196,7 @@ Sie können ihn mit einem Member Ihres Enums `ModelName` vergleichen:
 Den tatsächlichen Wert (in diesem Fall ein `str`) erhalten Sie via `model_name.value`, oder generell, `ihr_enum_member.value`:
 
 ```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// tip | "Tipp"
@@ -212,7 +212,7 @@ Sie können *Enum-Member* in ihrer *Pfadoperation* zurückgeben, sogar verschach
 Diese werden zu ihren entsprechenden Werten konvertiert (in diesem Fall Strings), bevor sie zum Client übertragen werden:
 
 ```Python hl_lines="18  21  23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 In Ihrem Client erhalten Sie eine JSON-Response, wie etwa:
@@ -253,7 +253,7 @@ In diesem Fall ist der Name des Parameters `file_path`. Der letzte Teil, `:path`
 Sie verwenden das also wie folgt:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
 ```
 
 /// tip | "Tipp"
index ab30fc6cf19e201047e0f1d00fb16e20b1cdac33..a9f1e0f395c561e85e8cfd29e6882ce63bea53c3 100644 (file)
@@ -7,7 +7,7 @@ Nehmen wir als Beispiel die folgende Anwendung:
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial001_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -15,7 +15,7 @@ Nehmen wir als Beispiel die folgende Anwendung:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001.py!}
 ```
 
 ////
@@ -46,7 +46,7 @@ Importieren Sie zuerst:
 In Python 3.9 oder darüber, ist `Annotated` Teil der Standardbibliothek, also können Sie es von `typing` importieren.
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -58,7 +58,7 @@ In Versionen unter Python 3.9 importieren Sie `Annotated` von `typing_extensions
 Es wird bereits mit FastAPI installiert sein.
 
 ```Python hl_lines="3-4"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
 ```
 
 ////
@@ -126,7 +126,7 @@ Jetzt, da wir `Annotated` für unsere Metadaten deklariert haben, fügen Sie `Qu
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -134,7 +134,7 @@ Jetzt, da wir `Annotated` für unsere Metadaten deklariert haben, fügen Sie `Qu
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
 ```
 
 ////
@@ -164,7 +164,7 @@ So würden Sie `Query()` als Defaultwert Ihres Funktionsparameters verwenden, de
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_py310.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ So würden Sie `Query()` als Defaultwert Ihres Funktionsparameters verwenden, de
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 ////
@@ -278,7 +278,7 @@ Sie können auch einen Parameter `min_length` hinzufügen:
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -286,7 +286,7 @@ Sie können auch einen Parameter `min_length` hinzufügen:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -294,7 +294,7 @@ Sie können auch einen Parameter `min_length` hinzufügen:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an.py!}
 ```
 
 ////
@@ -308,7 +308,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_py310.py!}
 ```
 
 ////
@@ -322,7 +322,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003.py!}
 ```
 
 ////
@@ -334,7 +334,7 @@ Sie können einen <abbr title="Ein regulärer Ausdruck, auch regex oder regexp g
 //// tab | Python 3.10+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -342,7 +342,7 @@ Sie können einen <abbr title="Ein regulärer Ausdruck, auch regex oder regexp g
 //// tab | Python 3.9+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -350,7 +350,7 @@ Sie können einen <abbr title="Ein regulärer Ausdruck, auch regex oder regexp g
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an.py!}
 ```
 
 ////
@@ -364,7 +364,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_py310.py!}
 ```
 
 ////
@@ -378,7 +378,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004.py!}
 ```
 
 ////
@@ -402,7 +402,7 @@ Sie könnten immer noch Code sehen, der den alten Namen verwendet:
 //// tab | Python 3.10+ Pydantic v1
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an_py310_regex.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py310_regex.py!}
 ```
 
 ////
@@ -418,7 +418,7 @@ Beispielsweise könnten Sie den `q` Query-Parameter so deklarieren, dass er eine
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -426,7 +426,7 @@ Beispielsweise könnten Sie den `q` Query-Parameter so deklarieren, dass er eine
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial005_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005_an.py!}
 ```
 
 ////
@@ -440,7 +440,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005.py!}
 ```
 
 ////
@@ -488,7 +488,7 @@ Wenn Sie einen Parameter erforderlich machen wollen, während Sie `Query` verwen
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -496,7 +496,7 @@ Wenn Sie einen Parameter erforderlich machen wollen, während Sie `Query` verwen
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006_an.py!}
 ```
 
 ////
@@ -510,7 +510,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006.py!}
 ```
 
 /// tip | "Tipp"
@@ -530,7 +530,7 @@ Es gibt eine Alternative, die explizit deklariert, dass ein Wert erforderlich is
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b_an_py39.py!}
 ```
 
 ////
@@ -538,7 +538,7 @@ Es gibt eine Alternative, die explizit deklariert, dass ein Wert erforderlich is
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b_an.py!}
 ```
 
 ////
@@ -552,7 +552,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b.py!}
 ```
 
 ////
@@ -576,7 +576,7 @@ Um das zu machen, deklarieren Sie, dass `None` ein gültiger Typ ist, aber verwe
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an_py310.py!}
 ```
 
 ////
@@ -584,7 +584,7 @@ Um das zu machen, deklarieren Sie, dass `None` ein gültiger Typ ist, aber verwe
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an_py39.py!}
 ```
 
 ////
@@ -592,7 +592,7 @@ Um das zu machen, deklarieren Sie, dass `None` ein gültiger Typ ist, aber verwe
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an.py!}
 ```
 
 ////
@@ -606,7 +606,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
 ```
 
 ////
@@ -620,7 +620,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c.py!}
 ```
 
 ////
@@ -646,7 +646,7 @@ Um zum Beispiel einen Query-Parameter `q` zu deklarieren, der mehrere Male in de
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an_py310.py!}
 ```
 
 ////
@@ -654,7 +654,7 @@ Um zum Beispiel einen Query-Parameter `q` zu deklarieren, der mehrere Male in de
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -662,7 +662,7 @@ Um zum Beispiel einen Query-Parameter `q` zu deklarieren, der mehrere Male in de
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an.py!}
 ```
 
 ////
@@ -676,7 +676,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py310.py!}
 ```
 
 ////
@@ -690,7 +690,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py39.py!}
 ```
 
 ////
@@ -704,7 +704,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011.py!}
 ```
 
 ////
@@ -745,7 +745,7 @@ Und Sie können auch eine Default-`list`e von Werten definieren, wenn keine übe
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_an_py39.py!}
 ```
 
 ////
@@ -753,7 +753,7 @@ Und Sie können auch eine Default-`list`e von Werten definieren, wenn keine übe
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_an.py!}
 ```
 
 ////
@@ -767,7 +767,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_py39.py!}
 ```
 
 ////
@@ -781,7 +781,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012.py!}
 ```
 
 ////
@@ -810,7 +810,7 @@ Sie können auch `list` direkt verwenden, anstelle von `List[str]` (oder `list[s
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial013_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013_an_py39.py!}
 ```
 
 ////
@@ -818,7 +818,7 @@ Sie können auch `list` direkt verwenden, anstelle von `List[str]` (oder `list[s
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial013_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013_an.py!}
 ```
 
 ////
@@ -832,7 +832,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013.py!}
 ```
 
 ////
@@ -864,7 +864,7 @@ Sie können einen Titel hinzufügen – `title`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an_py310.py!}
 ```
 
 ////
@@ -872,7 +872,7 @@ Sie können einen Titel hinzufügen – `title`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an_py39.py!}
 ```
 
 ////
@@ -880,7 +880,7 @@ Sie können einen Titel hinzufügen – `title`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an.py!}
 ```
 
 ////
@@ -894,7 +894,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_py310.py!}
 ```
 
 ////
@@ -908,7 +908,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007.py!}
 ```
 
 ////
@@ -918,7 +918,7 @@ Und eine Beschreibung – `description`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an_py310.py!}
 ```
 
 ////
@@ -926,7 +926,7 @@ Und eine Beschreibung – `description`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -934,7 +934,7 @@ Und eine Beschreibung – `description`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an.py!}
 ```
 
 ////
@@ -948,7 +948,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_py310.py!}
 ```
 
 ////
@@ -962,7 +962,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008.py!}
 ```
 
 ////
@@ -988,7 +988,7 @@ Dann können Sie einen `alias` deklarieren, und dieser Alias wird verwendet, um
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an_py310.py!}
 ```
 
 ////
@@ -996,7 +996,7 @@ Dann können Sie einen `alias` deklarieren, und dieser Alias wird verwendet, um
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an_py39.py!}
 ```
 
 ////
@@ -1004,7 +1004,7 @@ Dann können Sie einen `alias` deklarieren, und dieser Alias wird verwendet, um
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an.py!}
 ```
 
 ////
@@ -1018,7 +1018,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_py310.py!}
 ```
 
 ////
@@ -1032,7 +1032,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009.py!}
 ```
 
 ////
@@ -1048,7 +1048,7 @@ In diesem Fall fügen Sie den Parameter `deprecated=True` zu `Query` hinzu.
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an_py310.py!}
 ```
 
 ////
@@ -1056,7 +1056,7 @@ In diesem Fall fügen Sie den Parameter `deprecated=True` zu `Query` hinzu.
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an_py39.py!}
 ```
 
 ////
@@ -1064,7 +1064,7 @@ In diesem Fall fügen Sie den Parameter `deprecated=True` zu `Query` hinzu.
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an.py!}
 ```
 
 ////
@@ -1078,7 +1078,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_py310.py!}
 ```
 
 ////
@@ -1092,7 +1092,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010.py!}
 ```
 
 ////
@@ -1108,7 +1108,7 @@ Um einen Query-Parameter vom generierten OpenAPI-Schema auszuschließen (und dah
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an_py310.py!}
 ```
 
 ////
@@ -1116,7 +1116,7 @@ Um einen Query-Parameter vom generierten OpenAPI-Schema auszuschließen (und dah
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an_py39.py!}
 ```
 
 ////
@@ -1124,7 +1124,7 @@ Um einen Query-Parameter vom generierten OpenAPI-Schema auszuschließen (und dah
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an.py!}
 ```
 
 ////
@@ -1138,7 +1138,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_py310.py!}
 ```
 
 ////
@@ -1152,7 +1152,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014.py!}
 ```
 
 ////
index 136852216e8f9a827f1331b578cc34814baf4a92..bb1dbdf9c3db0acbbadfc6e5077591c60b95dd4f 100644 (file)
@@ -3,7 +3,7 @@
 Wenn Sie in ihrer Funktion Parameter deklarieren, die nicht Teil der Pfad-Parameter sind, dann werden diese automatisch als „Query“-Parameter interpretiert.
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
 ```
 
 Query-Parameter (Deutsch: Abfrage-Parameter) sind die Schlüssel-Wert-Paare, die nach dem `?` in einer URL aufgelistet sind, getrennt durch `&`-Zeichen.
@@ -66,7 +66,7 @@ Auf die gleiche Weise können Sie optionale Query-Parameter deklarieren, indem S
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial002_py310.py!}
+{!> ../../docs_src/query_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@ Auf die gleiche Weise können Sie optionale Query-Parameter deklarieren, indem S
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial002.py!}
+{!> ../../docs_src/query_params/tutorial002.py!}
 ```
 
 ////
@@ -94,7 +94,7 @@ Sie können auch `bool`-Typen deklarieren und sie werden konvertiert:
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial003_py310.py!}
+{!> ../../docs_src/query_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -102,7 +102,7 @@ Sie können auch `bool`-Typen deklarieren und sie werden konvertiert:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial003.py!}
+{!> ../../docs_src/query_params/tutorial003.py!}
 ```
 
 ////
@@ -150,7 +150,7 @@ Parameter werden anhand ihres Namens erkannt:
 //// tab | Python 3.10+
 
 ```Python hl_lines="6  8"
-{!> ../../../docs_src/query_params/tutorial004_py310.py!}
+{!> ../../docs_src/query_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -158,7 +158,7 @@ Parameter werden anhand ihres Namens erkannt:
 //// tab | Python 3.8+
 
 ```Python hl_lines="8  10"
-{!> ../../../docs_src/query_params/tutorial004.py!}
+{!> ../../docs_src/query_params/tutorial004.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ Wenn Sie keinen spezifischen Wert haben wollen, sondern der Parameter einfach op
 Aber wenn Sie wollen, dass ein Query-Parameter erforderlich ist, vergeben Sie einfach keinen Defaultwert:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
 ```
 
 Hier ist `needy` ein erforderlicher Query-Parameter vom Typ `str`.
@@ -222,7 +222,7 @@ Und natürlich können Sie einige Parameter als erforderlich, einige mit Default
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params/tutorial006_py310.py!}
+{!> ../../docs_src/query_params/tutorial006_py310.py!}
 ```
 
 ////
@@ -230,7 +230,7 @@ Und natürlich können Sie einige Parameter als erforderlich, einige mit Default
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params/tutorial006.py!}
+{!> ../../docs_src/query_params/tutorial006.py!}
 ```
 
 ////
index cf44df5f0a9050a05300de487d0e0f83467ef4b7..c0d0ef3f2e7a8aeb26cb2f0e795b40f9f7b0c2f9 100644 (file)
@@ -19,7 +19,7 @@ Importieren Sie `File` und `UploadFile` von `fastapi`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ Importieren Sie `File` und `UploadFile` von `fastapi`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
 ```
 
 ////
@@ -41,7 +41,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Erstellen Sie Datei-Parameter, so wie Sie es auch mit `Body` und `Form` machen w
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ Erstellen Sie Datei-Parameter, so wie Sie es auch mit `Body` und `Form` machen w
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
 ```
 
 ////
@@ -109,7 +109,7 @@ Definieren Sie einen Datei-Parameter mit dem Typ `UploadFile`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Definieren Sie einen Datei-Parameter mit dem Typ `UploadFile`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
 ```
 
 ////
@@ -131,7 +131,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
 ```
 
 ////
@@ -220,7 +220,7 @@ Sie können eine Datei optional machen, indem Sie Standard-Typannotationen verwe
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py310.py!}
 ```
 
 ////
@@ -228,7 +228,7 @@ Sie können eine Datei optional machen, indem Sie Standard-Typannotationen verwe
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py39.py!}
 ```
 
 ////
@@ -236,7 +236,7 @@ Sie können eine Datei optional machen, indem Sie Standard-Typannotationen verwe
 //// tab | Python 3.8+
 
 ```Python hl_lines="10  18"
-{!> ../../../docs_src/request_files/tutorial001_02_an.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an.py!}
 ```
 
 ////
@@ -250,7 +250,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7  15"
-{!> ../../../docs_src/request_files/tutorial001_02_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_py310.py!}
 ```
 
 ////
@@ -264,7 +264,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02.py!}
+{!> ../../docs_src/request_files/tutorial001_02.py!}
 ```
 
 ////
@@ -276,7 +276,7 @@ Sie können auch `File()` zusammen mit `UploadFile` verwenden, um zum Beispiel z
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  15"
-{!> ../../../docs_src/request_files/tutorial001_03_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an_py39.py!}
 ```
 
 ////
@@ -284,7 +284,7 @@ Sie können auch `File()` zusammen mit `UploadFile` verwenden, um zum Beispiel z
 //// tab | Python 3.8+
 
 ```Python hl_lines="8  14"
-{!> ../../../docs_src/request_files/tutorial001_03_an.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an.py!}
 ```
 
 ////
@@ -298,7 +298,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7  13"
-{!> ../../../docs_src/request_files/tutorial001_03.py!}
+{!> ../../docs_src/request_files/tutorial001_03.py!}
 ```
 
 ////
@@ -314,7 +314,7 @@ Um das zu machen, deklarieren Sie eine Liste von `bytes` oder `UploadFile`s:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/request_files/tutorial002_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -322,7 +322,7 @@ Um das zu machen, deklarieren Sie eine Liste von `bytes` oder `UploadFile`s:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/request_files/tutorial002_an.py!}
+{!> ../../docs_src/request_files/tutorial002_an.py!}
 ```
 
 ////
@@ -336,7 +336,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/request_files/tutorial002_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_py39.py!}
 ```
 
 ////
@@ -350,7 +350,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/request_files/tutorial002.py!}
+{!> ../../docs_src/request_files/tutorial002.py!}
 ```
 
 ////
@@ -372,7 +372,7 @@ Und so wie zuvor können Sie `File()` verwenden, um zusätzliche Parameter zu se
 //// tab | Python 3.9+
 
 ```Python hl_lines="11  18-20"
-{!> ../../../docs_src/request_files/tutorial003_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -380,7 +380,7 @@ Und so wie zuvor können Sie `File()` verwenden, um zusätzliche Parameter zu se
 //// tab | Python 3.8+
 
 ```Python hl_lines="12  19-21"
-{!> ../../../docs_src/request_files/tutorial003_an.py!}
+{!> ../../docs_src/request_files/tutorial003_an.py!}
 ```
 
 ////
@@ -394,7 +394,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="9  16"
-{!> ../../../docs_src/request_files/tutorial003_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_py39.py!}
 ```
 
 ////
@@ -408,7 +408,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="11  18"
-{!> ../../../docs_src/request_files/tutorial003.py!}
+{!> ../../docs_src/request_files/tutorial003.py!}
 ```
 
 ////
index e109595d10849da0cd543f3a1c5855de7001c4ff..2b89edbb401e43f31712e3c63f6c46ee041fdea3 100644 (file)
@@ -15,7 +15,7 @@ Z. B. `pip install python-multipart`.
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -23,7 +23,7 @@ Z. B. `pip install python-multipart`.
 //// tab | Python 3.8+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an.py!}
 ```
 
 ////
@@ -37,7 +37,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 ////
@@ -49,7 +49,7 @@ Erstellen Sie Datei- und Formularparameter, so wie Sie es auch mit `Body` und `Q
 //// tab | Python 3.9+
 
 ```Python hl_lines="10-12"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@ Erstellen Sie Datei- und Formularparameter, so wie Sie es auch mit `Body` und `Q
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 ////
index 391788affc6085b7aad7b9600d500b11e4a5afa1..0784aa8c0437b3e81bfa0984a9f4aa45fd2abf72 100644 (file)
@@ -17,7 +17,7 @@ Importieren Sie `Form` von `fastapi`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Importieren Sie `Form` von `fastapi`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
 ```
 
 ////
@@ -51,7 +51,7 @@ Erstellen Sie Formular-Parameter, so wie Sie es auch mit `Body` und `Query` mach
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -59,7 +59,7 @@ Erstellen Sie Formular-Parameter, so wie Sie es auch mit `Body` und `Query` mach
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
 ```
 
 ////
index b480780bcaeb82ebc215cc0774dcc43055177fc0..31ad73c77042c07f35f86f16824f9cc82409f968 100644 (file)
@@ -7,7 +7,7 @@ Hierbei können Sie **Typannotationen** genauso verwenden, wie Sie es bei Werten
 //// tab | Python 3.10+
 
 ```Python hl_lines="16  21"
-{!> ../../../docs_src/response_model/tutorial001_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py310.py!}
 ```
 
 ////
@@ -15,7 +15,7 @@ Hierbei können Sie **Typannotationen** genauso verwenden, wie Sie es bei Werten
 //// tab | Python 3.9+
 
 ```Python hl_lines="18  23"
-{!> ../../../docs_src/response_model/tutorial001_01_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py39.py!}
 ```
 
 ////
@@ -23,7 +23,7 @@ Hierbei können Sie **Typannotationen** genauso verwenden, wie Sie es bei Werten
 //// tab | Python 3.8+
 
 ```Python hl_lines="18  23"
-{!> ../../../docs_src/response_model/tutorial001_01.py!}
+{!> ../../docs_src/response_model/tutorial001_01.py!}
 ```
 
 ////
@@ -62,7 +62,7 @@ Sie können `response_model` in jeder möglichen *Pfadoperation* verwenden:
 //// tab | Python 3.10+
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_py310.py!}
 ```
 
 ////
@@ -70,7 +70,7 @@ Sie können `response_model` in jeder möglichen *Pfadoperation* verwenden:
 //// tab | Python 3.9+
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_py39.py!}
 ```
 
 ////
@@ -78,7 +78,7 @@ Sie können `response_model` in jeder möglichen *Pfadoperation* verwenden:
 //// tab | Python 3.8+
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001.py!}
+{!> ../../docs_src/response_model/tutorial001.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ Im Folgenden deklarieren wir ein `UserIn`-Modell; es enthält ein Klartext-Passw
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  9"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
 ```
 
 ////
@@ -124,7 +124,7 @@ Im Folgenden deklarieren wir ein `UserIn`-Modell; es enthält ein Klartext-Passw
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  11"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
 ```
 
 ////
@@ -143,7 +143,7 @@ Wir verwenden dieses Modell, um sowohl unsere Eingabe- als auch Ausgabedaten zu
 //// tab | Python 3.10+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
 ```
 
 ////
@@ -151,7 +151,7 @@ Wir verwenden dieses Modell, um sowohl unsere Eingabe- als auch Ausgabedaten zu
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
 ```
 
 ////
@@ -175,7 +175,7 @@ Wir können stattdessen ein Eingabemodell mit dem Klartext-Passwort, und ein Aus
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  11  16"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -183,7 +183,7 @@ Wir können stattdessen ein Eingabemodell mit dem Klartext-Passwort, und ein Aus
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  11  16"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -193,7 +193,7 @@ Obwohl unsere *Pfadoperation-Funktion* hier denselben `user` von der Eingabe zur
 //// tab | Python 3.10+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -201,7 +201,7 @@ Obwohl unsere *Pfadoperation-Funktion* hier denselben `user` von der Eingabe zur
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -211,7 +211,7 @@ Obwohl unsere *Pfadoperation-Funktion* hier denselben `user` von der Eingabe zur
 //// tab | Python 3.10+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -219,7 +219,7 @@ Obwohl unsere *Pfadoperation-Funktion* hier denselben `user` von der Eingabe zur
 //// tab | Python 3.8+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -249,7 +249,7 @@ Und in solchen Fällen können wir Klassen und Vererbung verwenden, um Vorteil a
 //// tab | Python 3.10+
 
 ```Python hl_lines="7-10  13-14  18"
-{!> ../../../docs_src/response_model/tutorial003_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_01_py310.py!}
 ```
 
 ////
@@ -257,7 +257,7 @@ Und in solchen Fällen können wir Klassen und Vererbung verwenden, um Vorteil a
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-13  15-16  20"
-{!> ../../../docs_src/response_model/tutorial003_01.py!}
+{!> ../../docs_src/response_model/tutorial003_01.py!}
 ```
 
 ////
@@ -303,7 +303,7 @@ Es kann Fälle geben, bei denen Sie etwas zurückgeben, das kein gültiges Pydan
 Der häufigste Anwendungsfall ist, wenn Sie [eine Response direkt zurückgeben, wie es später im Handbuch für fortgeschrittene Benutzer erläutert wird](../advanced/response-directly.md){.internal-link target=_blank}.
 
 ```Python hl_lines="8  10-11"
-{!> ../../../docs_src/response_model/tutorial003_02.py!}
+{!> ../../docs_src/response_model/tutorial003_02.py!}
 ```
 
 Dieser einfache Anwendungsfall wird automatisch von FastAPI gehandhabt, weil die Annotation des Rückgabetyps die Klasse (oder eine Unterklasse von) `Response` ist.
@@ -315,7 +315,7 @@ Und Tools werden auch glücklich sein, weil sowohl `RedirectResponse` als auch `
 Sie können auch eine Unterklasse von `Response` in der Typannotation verwenden.
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/response_model/tutorial003_03.py!}
+{!> ../../docs_src/response_model/tutorial003_03.py!}
 ```
 
 Das wird ebenfalls funktionieren, weil `RedirectResponse` eine Unterklasse von `Response` ist, und FastAPI sich um diesen einfachen Anwendungsfall automatisch kümmert.
@@ -329,7 +329,7 @@ Das gleiche wird passieren, wenn Sie eine <abbr title='Eine Union mehrerer Typen
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/response_model/tutorial003_04_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_04_py310.py!}
 ```
 
 ////
@@ -337,7 +337,7 @@ Das gleiche wird passieren, wenn Sie eine <abbr title='Eine Union mehrerer Typen
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/response_model/tutorial003_04.py!}
+{!> ../../docs_src/response_model/tutorial003_04.py!}
 ```
 
 ////
@@ -355,7 +355,7 @@ In diesem Fall können Sie die Generierung des Responsemodells abschalten, indem
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/response_model/tutorial003_05_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_05_py310.py!}
 ```
 
 ////
@@ -363,7 +363,7 @@ In diesem Fall können Sie die Generierung des Responsemodells abschalten, indem
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/response_model/tutorial003_05.py!}
+{!> ../../docs_src/response_model/tutorial003_05.py!}
 ```
 
 ////
@@ -377,7 +377,7 @@ Ihr Responsemodell könnte Defaultwerte haben, wie:
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  11-12"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
 ```
 
 ////
@@ -385,7 +385,7 @@ Ihr Responsemodell könnte Defaultwerte haben, wie:
 //// tab | Python 3.9+
 
 ```Python hl_lines="11  13-14"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
 ```
 
 ////
@@ -393,7 +393,7 @@ Ihr Responsemodell könnte Defaultwerte haben, wie:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11  13-14"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
 ```
 
 ////
@@ -413,7 +413,7 @@ Sie können den *Pfadoperation-Dekorator*-Parameter `response_model_exclude_unse
 //// tab | Python 3.10+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
 ```
 
 ////
@@ -421,7 +421,7 @@ Sie können den *Pfadoperation-Dekorator*-Parameter `response_model_exclude_unse
 //// tab | Python 3.9+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
 ```
 
 ////
@@ -429,7 +429,7 @@ Sie können den *Pfadoperation-Dekorator*-Parameter `response_model_exclude_unse
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
 ```
 
 ////
@@ -532,7 +532,7 @@ Das trifft auch auf `response_model_by_alias` zu, welches ähnlich funktioniert.
 //// tab | Python 3.10+
 
 ```Python hl_lines="29  35"
-{!> ../../../docs_src/response_model/tutorial005_py310.py!}
+{!> ../../docs_src/response_model/tutorial005_py310.py!}
 ```
 
 ////
@@ -540,7 +540,7 @@ Das trifft auch auf `response_model_by_alias` zu, welches ähnlich funktioniert.
 //// tab | Python 3.8+
 
 ```Python hl_lines="31  37"
-{!> ../../../docs_src/response_model/tutorial005.py!}
+{!> ../../docs_src/response_model/tutorial005.py!}
 ```
 
 ////
@@ -560,7 +560,7 @@ Wenn Sie vergessen, ein `set` zu verwenden, und stattdessen eine `list`e oder ei
 //// tab | Python 3.10+
 
 ```Python hl_lines="29  35"
-{!> ../../../docs_src/response_model/tutorial006_py310.py!}
+{!> ../../docs_src/response_model/tutorial006_py310.py!}
 ```
 
 ////
@@ -568,7 +568,7 @@ Wenn Sie vergessen, ein `set` zu verwenden, und stattdessen eine `list`e oder ei
 //// tab | Python 3.8+
 
 ```Python hl_lines="31  37"
-{!> ../../../docs_src/response_model/tutorial006.py!}
+{!> ../../docs_src/response_model/tutorial006.py!}
 ```
 
 ////
index 5f96b83e4ca6aa3bfe32053e6bf97ea5412795e3..872007a12c2f0b8d24dae5b026dd2c8424657895 100644 (file)
@@ -9,7 +9,7 @@ So wie ein Responsemodell, können Sie auch einen HTTP-Statuscode für die Respo
 * usw.
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 /// note | "Hinweis"
@@ -77,7 +77,7 @@ Um mehr über Statuscodes zu lernen, und welcher wofür verwendet wird, lesen Si
 Schauen wir uns das vorherige Beispiel noch einmal an:
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 `201` ist der Statuscode für „Created“ („Erzeugt“).
@@ -87,7 +87,7 @@ Aber Sie müssen sich nicht daran erinnern, welcher dieser Codes was bedeutet.
 Sie können die Hilfsvariablen von `fastapi.status` verwenden.
 
 ```Python hl_lines="1  6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
 ```
 
 Diese sind nur eine Annehmlichkeit und enthalten dieselbe Nummer, aber auf diese Weise können Sie die Autovervollständigung Ihres Editors verwenden, um sie zu finden:
index 07b4bb7596d0aa4769290692769ff9d983f377e4..0da1a4ea4ba20f48a46ec17944145567893fe848 100644 (file)
@@ -11,7 +11,7 @@ Sie können `examples` („Beispiele“) für ein Pydantic-Modell deklarieren, w
 //// tab | Python 3.10+ Pydantic v2
 
 ```Python hl_lines="13-24"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@ Sie können `examples` („Beispiele“) für ein Pydantic-Modell deklarieren, w
 //// tab | Python 3.10+ Pydantic v1
 
 ```Python hl_lines="13-23"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310_pv1.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310_pv1.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ Sie können `examples` („Beispiele“) für ein Pydantic-Modell deklarieren, w
 //// tab | Python 3.8+ Pydantic v2
 
 ```Python hl_lines="15-26"
-{!> ../../../docs_src/schema_extra_example/tutorial001.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@ Sie können `examples` („Beispiele“) für ein Pydantic-Modell deklarieren, w
 //// tab | Python 3.8+ Pydantic v1
 
 ```Python hl_lines="15-25"
-{!> ../../../docs_src/schema_extra_example/tutorial001_pv1.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_pv1.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@ Wenn Sie `Field()` mit Pydantic-Modellen verwenden, können Sie ebenfalls zusät
 //// tab | Python 3.10+
 
 ```Python hl_lines="2  8-11"
-{!> ../../../docs_src/schema_extra_example/tutorial002_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002_py310.py!}
 ```
 
 ////
@@ -91,7 +91,7 @@ Wenn Sie `Field()` mit Pydantic-Modellen verwenden, können Sie ebenfalls zusät
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  10-13"
-{!> ../../../docs_src/schema_extra_example/tutorial002.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Hier übergeben wir `examples`, welches ein einzelnes Beispiel für die in `Body
 //// tab | Python 3.10+
 
 ```Python hl_lines="22-29"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -125,7 +125,7 @@ Hier übergeben wir `examples`, welches ein einzelnes Beispiel für die in `Body
 //// tab | Python 3.9+
 
 ```Python hl_lines="22-29"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -133,7 +133,7 @@ Hier übergeben wir `examples`, welches ein einzelnes Beispiel für die in `Body
 //// tab | Python 3.8+
 
 ```Python hl_lines="23-30"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="18-25"
-{!> ../../../docs_src/schema_extra_example/tutorial003_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_py310.py!}
 ```
 
 ////
@@ -161,7 +161,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="20-27"
-{!> ../../../docs_src/schema_extra_example/tutorial003.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Sie können natürlich auch mehrere `examples` übergeben:
 //// tab | Python 3.10+
 
 ```Python hl_lines="23-38"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -187,7 +187,7 @@ Sie können natürlich auch mehrere `examples` übergeben:
 //// tab | Python 3.9+
 
 ```Python hl_lines="23-38"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -195,7 +195,7 @@ Sie können natürlich auch mehrere `examples` übergeben:
 //// tab | Python 3.8+
 
 ```Python hl_lines="24-39"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an.py!}
 ```
 
 ////
@@ -209,7 +209,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="19-34"
-{!> ../../../docs_src/schema_extra_example/tutorial004_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_py310.py!}
 ```
 
 ////
@@ -223,7 +223,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="21-36"
-{!> ../../../docs_src/schema_extra_example/tutorial004.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004.py!}
 ```
 
 ////
@@ -270,7 +270,7 @@ Sie können es so verwenden:
 //// tab | Python 3.10+
 
 ```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -278,7 +278,7 @@ Sie können es so verwenden:
 //// tab | Python 3.9+
 
 ```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -286,7 +286,7 @@ Sie können es so verwenden:
 //// tab | Python 3.8+
 
 ```Python hl_lines="24-50"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an.py!}
 ```
 
 ////
@@ -300,7 +300,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="19-45"
-{!> ../../../docs_src/schema_extra_example/tutorial005_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_py310.py!}
 ```
 
 ////
@@ -314,7 +314,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="21-47"
-{!> ../../../docs_src/schema_extra_example/tutorial005.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005.py!}
 ```
 
 ////
index 6bc42cf6c3b278cc5c59a8dcba0cffbb89d97f30..c552a681bea4347af357dd1befdcdd7e0d5ecb5c 100644 (file)
@@ -23,7 +23,7 @@ Kopieren Sie das Beispiel in eine Datei `main.py`:
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Kopieren Sie das Beispiel in eine Datei `main.py`:
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
 ```
 
 ////
@@ -157,7 +157,7 @@ Wenn wir eine Instanz der Klasse `OAuth2PasswordBearer` erstellen, übergeben wi
 //// tab | Python 3.9+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -165,7 +165,7 @@ Wenn wir eine Instanz der Klasse `OAuth2PasswordBearer` erstellen, übergeben wi
 //// tab | Python 3.8+
 
 ```Python  hl_lines="7"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
 ```
 
 ////
@@ -223,7 +223,7 @@ Jetzt können Sie dieses `oauth2_scheme` als Abhängigkeit `Depends` übergeben.
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -231,7 +231,7 @@ Jetzt können Sie dieses `oauth2_scheme` als Abhängigkeit `Depends` übergeben.
 //// tab | Python 3.8+
 
 ```Python  hl_lines="11"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
 ```
 
 ////
index 8a68deeeff65a37d5487394691f4500fd2096b8f..a9478a36e95d8b4f09d9ee9502bf8b72cc82e95d 100644 (file)
@@ -5,7 +5,7 @@ Im vorherigen Kapitel hat das Sicherheitssystem (das auf dem Dependency Injectio
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -13,7 +13,7 @@ Im vorherigen Kapitel hat das Sicherheitssystem (das auf dem Dependency Injectio
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@ So wie wir Pydantic zum Deklarieren von Bodys verwenden, können wir es auch üb
 //// tab | Python 3.10+
 
 ```Python hl_lines="5  12-16"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ So wie wir Pydantic zum Deklarieren von Bodys verwenden, können wir es auch üb
 //// tab | Python 3.9+
 
 ```Python hl_lines="5  12-16"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ So wie wir Pydantic zum Deklarieren von Bodys verwenden, können wir es auch üb
 //// tab | Python 3.8+
 
 ```Python hl_lines="5  13-17"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="3  10-14"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -89,7 +89,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="5  12-16"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -107,7 +107,7 @@ So wie wir es zuvor in der *Pfadoperation* direkt gemacht haben, erhält unsere
 //// tab | Python 3.10+
 
 ```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -115,7 +115,7 @@ So wie wir es zuvor in der *Pfadoperation* direkt gemacht haben, erhält unsere
 //// tab | Python 3.9+
 
 ```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -123,7 +123,7 @@ So wie wir es zuvor in der *Pfadoperation* direkt gemacht haben, erhält unsere
 //// tab | Python 3.8+
 
 ```Python hl_lines="26"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
 ```
 
 ////
@@ -137,7 +137,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -151,7 +151,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -163,7 +163,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 //// tab | Python 3.10+
 
 ```Python hl_lines="19-22  26-27"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 //// tab | Python 3.9+
 
 ```Python hl_lines="19-22  26-27"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 //// tab | Python 3.8+
 
 ```Python hl_lines="20-23  27-28"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
 ```
 
 ////
@@ -193,7 +193,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="17-20  24-25"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -207,7 +207,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="19-22  26-27"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -219,7 +219,7 @@ Und jetzt können wir wiederum `Depends` mit unserem `get_current_user` in der *
 //// tab | Python 3.10+
 
 ```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -227,7 +227,7 @@ Und jetzt können wir wiederum `Depends` mit unserem `get_current_user` in der *
 //// tab | Python 3.9+
 
 ```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -235,7 +235,7 @@ Und jetzt können wir wiederum `Depends` mit unserem `get_current_user` in der *
 //// tab | Python 3.8+
 
 ```Python hl_lines="32"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
 ```
 
 ////
@@ -249,7 +249,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="29"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -263,7 +263,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -323,7 +323,7 @@ Und alle diese Tausenden von *Pfadoperationen* können nur drei Zeilen lang sein
 //// tab | Python 3.10+
 
 ```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -331,7 +331,7 @@ Und alle diese Tausenden von *Pfadoperationen* können nur drei Zeilen lang sein
 //// tab | Python 3.9+
 
 ```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -339,7 +339,7 @@ Und alle diese Tausenden von *Pfadoperationen* können nur drei Zeilen lang sein
 //// tab | Python 3.8+
 
 ```Python hl_lines="31-33"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
 ```
 
 ////
@@ -353,7 +353,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="28-30"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -367,7 +367,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
index 88f0dbe42e866ada0f2aa0a18879a8ff1909ded5..79e8178408bdd149d38bf527086bf71f611c0099 100644 (file)
@@ -121,7 +121,7 @@ Und noch eine, um einen Benutzer zu authentifizieren und zurückzugeben.
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  48  55-56  59-60  69-75"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -129,7 +129,7 @@ Und noch eine, um einen Benutzer zu authentifizieren und zurückzugeben.
 //// tab | Python 3.9+
 
 ```Python hl_lines="7  48  55-56  59-60  69-75"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -137,7 +137,7 @@ Und noch eine, um einen Benutzer zu authentifizieren und zurückzugeben.
 //// tab | Python 3.8+
 
 ```Python hl_lines="7  49  56-57  60-61  70-76"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
 ```
 
 ////
@@ -151,7 +151,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="6  47  54-55  58-59  68-74"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -165,7 +165,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="7  48  55-56  59-60  69-75"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
@@ -207,7 +207,7 @@ Erstellen Sie eine Hilfsfunktion, um einen neuen Zugriffstoken zu generieren.
 //// tab | Python 3.10+
 
 ```Python hl_lines="6  12-14  28-30  78-86"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -215,7 +215,7 @@ Erstellen Sie eine Hilfsfunktion, um einen neuen Zugriffstoken zu generieren.
 //// tab | Python 3.9+
 
 ```Python hl_lines="6  12-14  28-30  78-86"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -223,7 +223,7 @@ Erstellen Sie eine Hilfsfunktion, um einen neuen Zugriffstoken zu generieren.
 //// tab | Python 3.8+
 
 ```Python hl_lines="6  13-15  29-31 79-87"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="5  11-13  27-29  77-85"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -251,7 +251,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="6  12-14  28-30  78-86"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
@@ -267,7 +267,7 @@ Wenn der Token ungültig ist, geben Sie sofort einen HTTP-Fehler zurück.
 //// tab | Python 3.10+
 
 ```Python hl_lines="89-106"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -275,7 +275,7 @@ Wenn der Token ungültig ist, geben Sie sofort einen HTTP-Fehler zurück.
 //// tab | Python 3.9+
 
 ```Python hl_lines="89-106"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -283,7 +283,7 @@ Wenn der Token ungültig ist, geben Sie sofort einen HTTP-Fehler zurück.
 //// tab | Python 3.8+
 
 ```Python hl_lines="90-107"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
 ```
 
 ////
@@ -297,7 +297,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="88-105"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -311,7 +311,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="89-106"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
@@ -325,7 +325,7 @@ Erstellen Sie einen echten JWT-Zugriffstoken und geben Sie ihn zurück.
 //// tab | Python 3.10+
 
 ```Python hl_lines="117-132"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -333,7 +333,7 @@ Erstellen Sie einen echten JWT-Zugriffstoken und geben Sie ihn zurück.
 //// tab | Python 3.9+
 
 ```Python hl_lines="117-132"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -341,7 +341,7 @@ Erstellen Sie einen echten JWT-Zugriffstoken und geben Sie ihn zurück.
 //// tab | Python 3.8+
 
 ```Python hl_lines="118-133"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
 ```
 
 ////
@@ -355,7 +355,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="114-129"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -369,7 +369,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="115-130"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
index 3b1c4ae28a0943037de6af21b5b6a900360eb92b..4c20fae5570fbb331e3bb7f659643ac00e735a8f 100644 (file)
@@ -55,7 +55,7 @@ Importieren Sie zunächst `OAuth2PasswordRequestForm` und verwenden Sie es als A
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  78"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -63,7 +63,7 @@ Importieren Sie zunächst `OAuth2PasswordRequestForm` und verwenden Sie es als A
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  78"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@ Importieren Sie zunächst `OAuth2PasswordRequestForm` und verwenden Sie es als A
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  79"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
 ```
 
 ////
@@ -85,7 +85,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="2  74"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -99,7 +99,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="4  76"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -153,7 +153,7 @@ Für den Fehler verwenden wir die Exception `HTTPException`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="3  79-81"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -161,7 +161,7 @@ Für den Fehler verwenden wir die Exception `HTTPException`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3  79-81"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -169,7 +169,7 @@ Für den Fehler verwenden wir die Exception `HTTPException`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="3  80-82"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
 ```
 
 ////
@@ -183,7 +183,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="1  75-77"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -197,7 +197,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="3  77-79"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -229,7 +229,7 @@ Der Dieb kann also nicht versuchen, die gleichen Passwörter in einem anderen Sy
 //// tab | Python 3.10+
 
 ```Python hl_lines="82-85"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ Der Dieb kann also nicht versuchen, die gleichen Passwörter in einem anderen Sy
 //// tab | Python 3.9+
 
 ```Python hl_lines="82-85"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ Der Dieb kann also nicht versuchen, die gleichen Passwörter in einem anderen Sy
 //// tab | Python 3.8+
 
 ```Python hl_lines="83-86"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
 ```
 
 ////
@@ -259,7 +259,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="78-81"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="80-83"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -321,7 +321,7 @@ Aber konzentrieren wir uns zunächst auf die spezifischen Details, die wir benö
 //// tab | Python 3.10+
 
 ```Python hl_lines="87"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -329,7 +329,7 @@ Aber konzentrieren wir uns zunächst auf die spezifischen Details, die wir benö
 //// tab | Python 3.9+
 
 ```Python hl_lines="87"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -337,7 +337,7 @@ Aber konzentrieren wir uns zunächst auf die spezifischen Details, die wir benö
 //// tab | Python 3.8+
 
 ```Python hl_lines="88"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
 ```
 
 ////
@@ -351,7 +351,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="83"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -365,7 +365,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="85"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -397,7 +397,7 @@ In unserem Endpunkt erhalten wir also nur dann einen Benutzer, wenn der Benutzer
 //// tab | Python 3.10+
 
 ```Python hl_lines="58-66  69-74  94"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -405,7 +405,7 @@ In unserem Endpunkt erhalten wir also nur dann einen Benutzer, wenn der Benutzer
 //// tab | Python 3.9+
 
 ```Python hl_lines="58-66  69-74  94"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -413,7 +413,7 @@ In unserem Endpunkt erhalten wir also nur dann einen Benutzer, wenn der Benutzer
 //// tab | Python 3.8+
 
 ```Python hl_lines="59-67  70-75  95"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
 ```
 
 ////
@@ -427,7 +427,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="56-64  67-70  88"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -441,7 +441,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python hl_lines="58-66  69-72  90"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
index cca8cd0ea493198d07935aceff29775bb18dbab3..4afd251aa04e10a908e1e4fb575d0a471ff659a2 100644 (file)
@@ -8,7 +8,7 @@ Mit `StaticFiles` können Sie statische Dateien aus einem Verzeichnis automatisc
 * „Mounten“ Sie eine `StaticFiles()`-Instanz in einem bestimmten Pfad.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
 ```
 
 /// note | "Technische Details"
index 43ced2aae6b1a2a049164b73c6f4161b497a2634..bda6d7d60779f6fdf4b67e11a31fd938ca23872d 100644 (file)
@@ -27,7 +27,7 @@ Verwenden Sie das `TestClient`-Objekt auf die gleiche Weise wie `httpx`.
 Schreiben Sie einfache `assert`-Anweisungen mit den Standard-Python-Ausdrücken, die Sie überprüfen müssen (wiederum, Standard-`pytest`).
 
 ```Python hl_lines="2  12  15-18"
-{!../../../docs_src/app_testing/tutorial001.py!}
+{!../../docs_src/app_testing/tutorial001.py!}
 ```
 
 /// tip | "Tipp"
@@ -75,7 +75,7 @@ In der Datei `main.py` haben Sie Ihre **FastAPI**-Anwendung:
 
 
 ```Python
-{!../../../docs_src/app_testing/main.py!}
+{!../../docs_src/app_testing/main.py!}
 ```
 
 ### Testdatei
@@ -93,7 +93,7 @@ Dann könnten Sie eine Datei `test_main.py` mit Ihren Tests haben. Sie könnte s
 Da sich diese Datei im selben Package befindet, können Sie relative Importe verwenden, um das Objekt `app` aus dem `main`-Modul (`main.py`) zu importieren:
 
 ```Python hl_lines="3"
-{!../../../docs_src/app_testing/test_main.py!}
+{!../../docs_src/app_testing/test_main.py!}
 ```
 
 ... und haben den Code für die Tests wie zuvor.
@@ -125,7 +125,7 @@ Beide *Pfadoperationen* erfordern einen `X-Token`-Header.
 //// tab | Python 3.10+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py310/main.py!}
 ```
 
 ////
@@ -133,7 +133,7 @@ Beide *Pfadoperationen* erfordern einen `X-Token`-Header.
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an_py39/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py39/main.py!}
 ```
 
 ////
@@ -141,7 +141,7 @@ Beide *Pfadoperationen* erfordern einen `X-Token`-Header.
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an/main.py!}
+{!> ../../docs_src/app_testing/app_b_an/main.py!}
 ```
 
 ////
@@ -155,7 +155,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_py310/main.py!}
 ```
 
 ////
@@ -169,7 +169,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 ///
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/main.py!}
+{!> ../../docs_src/app_testing/app_b/main.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Bevorzugen Sie die `Annotated`-Version, falls möglich.
 Anschließend könnten Sie `test_main.py` mit den erweiterten Tests aktualisieren:
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/test_main.py!}
+{!> ../../docs_src/app_testing/app_b/test_main.py!}
 ```
 
 Wenn Sie möchten, dass der Client Informationen im Request übergibt und Sie nicht wissen, wie das geht, können Sie suchen (googeln), wie es mit `httpx` gemacht wird, oder sogar, wie es mit `requests` gemacht wird, da das Design von HTTPX auf dem Design von Requests basiert.
index 7a70718c5e3fec2a52a132521b3e35e0f8fe1507..e4442135e14c07b40f8c1464ea93546d0d084d1c 100644 (file)
@@ -27,7 +27,7 @@
 🖼, 📣 ➕1️⃣ 📨 ⏮️ 👔 📟 `404` &amp; Pydantic 🏷 `Message`, 👆 💪 ✍:
 
 ```Python hl_lines="18  22"
-{!../../../docs_src/additional_responses/tutorial001.py!}
+{!../../docs_src/additional_responses/tutorial001.py!}
 ```
 
 /// note
 🖼, 👆 💪 🚮 🌖 📻 🆎 `image/png`, 📣 👈 👆 *➡ 🛠️* 💪 📨 🎻 🎚 (⏮️ 📻 🆎 `application/json`) ⚖️ 🇩🇴 🖼:
 
 ```Python hl_lines="19-24  28"
-{!../../../docs_src/additional_responses/tutorial002.py!}
+{!../../docs_src/additional_responses/tutorial002.py!}
 ```
 
 /// note
 &amp; 📨 ⏮️ 👔 📟 `200` 👈 ⚙️ 👆 `response_model`, ✋️ 🔌 🛃 `example`:
 
 ```Python hl_lines="20-31"
-{!../../../docs_src/additional_responses/tutorial003.py!}
+{!../../docs_src/additional_responses/tutorial003.py!}
 ```
 
 ⚫️ 🔜 🌐 🌀 &amp; 🔌 👆 🗄, &amp; 🎦 🛠️ 🩺:
@@ -244,7 +244,7 @@ new_dict = {**old_dict, "new key": "new value"}
 🖼:
 
 ```Python hl_lines="13-17  26"
-{!../../../docs_src/additional_responses/tutorial004.py!}
+{!../../docs_src/additional_responses/tutorial004.py!}
 ```
 
 ## 🌖 ℹ 🔃 🗄 📨
index 3f3b0aea4bb4de749ac44453df4fdb1c52ec1adc..7a50e1bcadbfdf76fcebc512d6500893b832995f 100644 (file)
@@ -15,7 +15,7 @@
 🏆 👈, 🗄 `JSONResponse`, &amp; 📨 👆 🎚 📤 🔗, ⚒ `status_code` 👈 👆 💚:
 
 ```Python hl_lines="4  25"
-{!../../../docs_src/additional_status_codes/tutorial001.py!}
+{!../../docs_src/additional_status_codes/tutorial001.py!}
 ```
 
 /// warning
index 22044c783c973b2e7bfed7afc57066ebc131ad51..721428ce4ddc462c47746618e145291afeb21afa 100644 (file)
@@ -19,7 +19,7 @@
 👈, 👥 📣 👩‍🔬 `__call__`:
 
 ```Python hl_lines="10"
-{!../../../docs_src/dependencies/tutorial011.py!}
+{!../../docs_src/dependencies/tutorial011.py!}
 ```
 
 👉 💼, 👉 `__call__` ⚫️❔ **FastAPI** 🔜 ⚙️ ✅ 🌖 🔢 &amp; 🎧-🔗, &amp; 👉 ⚫️❔ 🔜 🤙 🚶‍♀️ 💲 🔢 👆 *➡ 🛠️ 🔢* ⏪.
@@ -29,7 +29,7 @@
 &amp; 🔜, 👥 💪 ⚙️ `__init__` 📣 🔢 👐 👈 👥 💪 ⚙️ "🔗" 🔗:
 
 ```Python hl_lines="7"
-{!../../../docs_src/dependencies/tutorial011.py!}
+{!../../docs_src/dependencies/tutorial011.py!}
 ```
 
 👉 💼, **FastAPI** 🏆 🚫 ⏱ 👆 ⚖️ 💅 🔃 `__init__`, 👥 🔜 ⚙️ ⚫️ 🔗 👆 📟.
@@ -39,7 +39,7 @@
 👥 💪 ✍ 👐 👉 🎓 ⏮️:
 
 ```Python hl_lines="16"
-{!../../../docs_src/dependencies/tutorial011.py!}
+{!../../docs_src/dependencies/tutorial011.py!}
 ```
 
 &amp; 👈 🌌 👥 💪 "🔗" 👆 🔗, 👈 🔜 ✔️ `"bar"` 🔘 ⚫️, 🔢 `checker.fixed_content`.
@@ -57,7 +57,7 @@ checker(q="somequery")
 ...&amp; 🚶‍♀️ ⚫️❔ 👈 📨 💲 🔗 👆 *➡ 🛠️ 🔢* 🔢 `fixed_content_included`:
 
 ```Python hl_lines="20"
-{!../../../docs_src/dependencies/tutorial011.py!}
+{!../../docs_src/dependencies/tutorial011.py!}
 ```
 
 /// tip
index 11f885fe608b9014612238023c3d6e8c1a8f6074..4d468acd4a172bf70f6f4ca3b0d64cb125ca7b7b 100644 (file)
 📁 `main.py` 🔜 ✔️:
 
 ```Python
-{!../../../docs_src/async_tests/main.py!}
+{!../../docs_src/async_tests/main.py!}
 ```
 
 📁 `test_main.py` 🔜 ✔️ 💯 `main.py`, ⚫️ 💪 👀 💖 👉 🔜:
 
 ```Python
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
 ```
 
 ## 🏃 ⚫️
@@ -61,7 +61,7 @@ $ pytest
 📑 `@pytest.mark.anyio` 💬 ✳ 👈 👉 💯 🔢 🔜 🤙 🔁:
 
 ```Python hl_lines="7"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
 ```
 
 /// tip
@@ -73,7 +73,7 @@ $ pytest
 ⤴️ 👥 💪 ✍ `AsyncClient` ⏮️ 📱, &amp; 📨 🔁 📨 ⚫️, ⚙️ `await`.
 
 ```Python hl_lines="9-12"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
 ```
 
 👉 🌓:
index bb65e1487e28cd2c87e45d193af9a619b2a305d9..e66ddccf75a3f9f87bd9ae9c16eae5505413f593 100644 (file)
@@ -95,7 +95,7 @@ $ uvicorn main:app --root-path /api/v1
 📥 👥 ✅ ⚫️ 📧 🎦 🎯.
 
 ```Python hl_lines="8"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
 ```
 
 ⤴️, 🚥 👆 ▶️ Uvicorn ⏮️:
@@ -124,7 +124,7 @@ $ uvicorn main:app --root-path /api/v1
 👐, 🚥 👆 🚫 ✔️ 🌌 🚚 📋 ⏸ 🎛 💖 `--root-path` ⚖️ 🌓, 👆 💪 ⚒ `root_path` 🔢 🕐❔ 🏗 👆 FastAPI 📱:
 
 ```Python hl_lines="3"
-{!../../../docs_src/behind_a_proxy/tutorial002.py!}
+{!../../docs_src/behind_a_proxy/tutorial002.py!}
 ```
 
 🚶‍♀️ `root_path` `FastAPI` 🔜 🌓 🚶‍♀️ `--root-path` 📋 ⏸ 🎛 Uvicorn ⚖️ Hypercorn.
@@ -306,7 +306,7 @@ $ uvicorn main:app --root-path /api/v1
 🖼:
 
 ```Python hl_lines="4-7"
-{!../../../docs_src/behind_a_proxy/tutorial003.py!}
+{!../../docs_src/behind_a_proxy/tutorial003.py!}
 ```
 
 🔜 🏗 🗄 🔗 💖:
@@ -355,7 +355,7 @@ $ uvicorn main:app --root-path /api/v1
 🚥 👆 🚫 💚 **FastAPI** 🔌 🏧 💽 ⚙️ `root_path`, 👆 💪 ⚙️ 🔢 `root_path_in_servers=False`:
 
 ```Python hl_lines="9"
-{!../../../docs_src/behind_a_proxy/tutorial004.py!}
+{!../../docs_src/behind_a_proxy/tutorial004.py!}
 ```
 
 &amp; ⤴️ ⚫️ 🏆 🚫 🔌 ⚫️ 🗄 🔗.
index eec87b91bf3ee3e9ace3f607e49fb1862a3ed9b8..7147a45360d004ad17cdb880ee69d61d55fd7d15 100644 (file)
@@ -31,7 +31,7 @@
 ✋️ 🚥 👆 🎯 👈 🎚 👈 👆 🛬 **🎻 ⏮️ 🎻**, 👆 💪 🚶‍♀️ ⚫️ 🔗 📨 🎓 &amp; ❎ ➕ 🌥 👈 FastAPI 🔜 ✔️ 🚶‍♀️ 👆 📨 🎚 🔘 `jsonable_encoder` ⏭ 🚶‍♀️ ⚫️ 📨 🎓.
 
 ```Python hl_lines="2  7"
-{!../../../docs_src/custom_response/tutorial001b.py!}
+{!../../docs_src/custom_response/tutorial001b.py!}
 ```
 
 /// info
@@ -58,7 +58,7 @@
 * 🚶‍♀️ `HTMLResponse` 🔢 `response_class` 👆 *➡ 🛠️ 👨‍🎨*.
 
 ```Python hl_lines="2  7"
-{!../../../docs_src/custom_response/tutorial002.py!}
+{!../../docs_src/custom_response/tutorial002.py!}
 ```
 
 /// info
@@ -78,7 +78,7 @@
 🎏 🖼 ⚪️➡️ 🔛, 🛬 `HTMLResponse`, 💪 👀 💖:
 
 ```Python hl_lines="2  7  19"
-{!../../../docs_src/custom_response/tutorial003.py!}
+{!../../docs_src/custom_response/tutorial003.py!}
 ```
 
 /// warning
 🖼, ⚫️ 💪 🕳 💖:
 
 ```Python hl_lines="7  21  23"
-{!../../../docs_src/custom_response/tutorial004.py!}
+{!../../docs_src/custom_response/tutorial004.py!}
 ```
 
 👉 🖼, 🔢 `generate_html_response()` ⏪ 🏗 &amp; 📨 `Response` ↩️ 🛬 🕸 `str`.
 FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎 🎚, ⚓️ 🔛 = &amp; 🔁 = ✍ 🆎.
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ### `HTMLResponse`
@@ -157,7 +157,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎 
 ✊ ✍ ⚖️ 🔢 &amp; 📨 ✅ ✍ 📨.
 
 ```Python hl_lines="2  7  9"
-{!../../../docs_src/custom_response/tutorial005.py!}
+{!../../docs_src/custom_response/tutorial005.py!}
 ```
 
 ### `JSONResponse`
@@ -181,7 +181,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎 
 ///
 
 ```Python hl_lines="2  7"
-{!../../../docs_src/custom_response/tutorial001.py!}
+{!../../docs_src/custom_response/tutorial001.py!}
 ```
 
 /// tip
@@ -197,7 +197,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎 
 👆 💪 📨 `RedirectResponse` 🔗:
 
 ```Python hl_lines="2  9"
-{!../../../docs_src/custom_response/tutorial006.py!}
+{!../../docs_src/custom_response/tutorial006.py!}
 ```
 
 ---
@@ -206,7 +206,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎 
 
 
 ```Python hl_lines="2  7  9"
-{!../../../docs_src/custom_response/tutorial006b.py!}
+{!../../docs_src/custom_response/tutorial006b.py!}
 ```
 
 🚥 👆 👈, ⤴️ 👆 💪 📨 📛 🔗 ⚪️➡️ 👆 *➡ 🛠️* 🔢.
@@ -218,7 +218,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎 
 👆 💪 ⚙️ `status_code` 🔢 🌀 ⏮️ `response_class` 🔢:
 
 ```Python hl_lines="2  7  9"
-{!../../../docs_src/custom_response/tutorial006c.py!}
+{!../../docs_src/custom_response/tutorial006c.py!}
 ```
 
 ### `StreamingResponse`
@@ -226,7 +226,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎 
 ✊ 🔁 🚂 ⚖️ 😐 🚂/🎻 &amp; 🎏 📨 💪.
 
 ```Python hl_lines="2  14"
-{!../../../docs_src/custom_response/tutorial007.py!}
+{!../../docs_src/custom_response/tutorial007.py!}
 ```
 
 #### ⚙️ `StreamingResponse` ⏮️ 📁-💖 🎚
@@ -238,7 +238,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎 
 👉 🔌 📚 🗃 🔗 ⏮️ ☁ 💾, 📹 🏭, &amp; 🎏.
 
 ```{ .python .annotate hl_lines="2  10-12  14" }
-{!../../../docs_src/custom_response/tutorial008.py!}
+{!../../docs_src/custom_response/tutorial008.py!}
 ```
 
 1️⃣. 👉 🚂 🔢. ⚫️ "🚂 🔢" ↩️ ⚫️ 🔌 `yield` 📄 🔘.
@@ -269,13 +269,13 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎 
 📁 📨 🔜 🔌 ☑ `Content-Length`, `Last-Modified` &amp; `ETag` 🎚.
 
 ```Python hl_lines="2  10"
-{!../../../docs_src/custom_response/tutorial009.py!}
+{!../../docs_src/custom_response/tutorial009.py!}
 ```
 
 👆 💪 ⚙️ `response_class` 🔢:
 
 ```Python hl_lines="2  8  10"
-{!../../../docs_src/custom_response/tutorial009b.py!}
+{!../../docs_src/custom_response/tutorial009b.py!}
 ```
 
 👉 💼, 👆 💪 📨 📁 ➡ 🔗 ⚪️➡️ 👆 *➡ 🛠️* 🔢.
@@ -291,7 +291,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎 
 👆 💪 ✍ `CustomORJSONResponse`. 👑 👜 👆 ✔️ ✍ `Response.render(content)` 👩‍🔬 👈 📨 🎚 `bytes`:
 
 ```Python hl_lines="9-14  17"
-{!../../../docs_src/custom_response/tutorial009c.py!}
+{!../../docs_src/custom_response/tutorial009c.py!}
 ```
 
 🔜 ↩️ 🛬:
@@ -319,7 +319,7 @@ FastAPI (🤙 💃) 🔜 🔁 🔌 🎚-📐 🎚. ⚫️ 🔜 🔌 🎚-🆎 
 🖼 🔛, **FastAPI** 🔜 ⚙️ `ORJSONResponse` 🔢, 🌐 *➡ 🛠️*, ↩️ `JSONResponse`.
 
 ```Python hl_lines="2  4"
-{!../../../docs_src/custom_response/tutorial010.py!}
+{!../../docs_src/custom_response/tutorial010.py!}
 ```
 
 /// tip
index 3f49ef07cabb7b3e6945b6e456289ca3632e4042..ab76e5083498d13df7e0000a4a82d41dd810ee6d 100644 (file)
@@ -5,7 +5,7 @@ FastAPI 🏗 🔛 🔝 **Pydantic**, &amp; 👤 ✔️ 🌏 👆 ❔ ⚙️ Pyda
 ✋️ FastAPI 🐕‍🦺 ⚙️ <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a> 🎏 🌌:
 
 ```Python hl_lines="1  7-12  19-20"
-{!../../../docs_src/dataclasses/tutorial001.py!}
+{!../../docs_src/dataclasses/tutorial001.py!}
 ```
 
 👉 🐕‍🦺 👏 **Pydantic**, ⚫️ ✔️ <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">🔗 🐕‍🦺 `dataclasses`</a>.
@@ -35,7 +35,7 @@ FastAPI 🏗 🔛 🔝 **Pydantic**, &amp; 👤 ✔️ 🌏 👆 ❔ ⚙️ Pyda
 👆 💪 ⚙️ `dataclasses` `response_model` 🔢:
 
 ```Python hl_lines="1  7-13  19"
-{!../../../docs_src/dataclasses/tutorial002.py!}
+{!../../docs_src/dataclasses/tutorial002.py!}
 ```
 
 🎻 🔜 🔁 🗜 Pydantic 🎻.
@@ -53,7 +53,7 @@ FastAPI 🏗 🔛 🔝 **Pydantic**, &amp; 👤 ✔️ 🌏 👆 ❔ ⚙️ Pyda
 👈 💼, 👆 💪 🎯 💱 🐩 `dataclasses` ⏮️ `pydantic.dataclasses`, ❔ 💧-♻:
 
 ```{ .python .annotate hl_lines="1  5  8-11  14-17  23-25  28" }
-{!../../../docs_src/dataclasses/tutorial003.py!}
+{!../../docs_src/dataclasses/tutorial003.py!}
 ```
 
 1️⃣. 👥 🗄 `field` ⚪️➡️ 🐩 `dataclasses`.
index 12c902c18612e5feeaf2def48633aa80377dc8cc..2eae2b36607824893fa01136c172fb8ea00cdd81 100644 (file)
@@ -31,7 +31,7 @@
 👥 ✍ 🔁 🔢 `lifespan()` ⏮️ `yield` 💖 👉:
 
 ```Python hl_lines="16  19"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 📥 👥 ⚖ 😥 *🕴* 🛠️ 🚚 🏷 🚮 (❌) 🏷 🔢 📖 ⏮️ 🎰 🏫 🏷 ⏭ `yield`. 👉 📟 🔜 🛠️ **⏭** 🈸 **▶️ ✊ 📨**, ⏮️ *🕴*.
@@ -51,7 +51,7 @@
 🥇 👜 👀, 👈 👥 ⚖ 🔁 🔢 ⏮️ `yield`. 👉 📶 🎏 🔗 ⏮️ `yield`.
 
 ```Python hl_lines="14-19"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 🥇 🍕 🔢, ⏭ `yield`, 🔜 🛠️ **⏭** 🈸 ▶️.
@@ -65,7 +65,7 @@
 👈 🗜 🔢 🔘 🕳 🤙 "**🔁 🔑 👨‍💼**".
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 **🔑 👨‍💼** 🐍 🕳 👈 👆 💪 ⚙️ `with` 📄, 🖼, `open()` 💪 ⚙️ 🔑 👨‍💼:
@@ -89,7 +89,7 @@ async with lifespan(app):
 `lifespan` 🔢 `FastAPI` 📱 ✊ **🔁 🔑 👨‍💼**, 👥 💪 🚶‍♀️ 👆 🆕 `lifespan` 🔁 🔑 👨‍💼 ⚫️.
 
 ```Python hl_lines="22"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 ## 🎛 🎉 (😢)
@@ -113,7 +113,7 @@ async with lifespan(app):
 🚮 🔢 👈 🔜 🏃 ⏭ 🈸 ▶️, 📣 ⚫️ ⏮️ 🎉 `"startup"`:
 
 ```Python hl_lines="8"
-{!../../../docs_src/events/tutorial001.py!}
+{!../../docs_src/events/tutorial001.py!}
 ```
 
 👉 💼, `startup` 🎉 🐕‍🦺 🔢 🔜 🔢 🏬 "💽" ( `dict`) ⏮️ 💲.
@@ -127,7 +127,7 @@ async with lifespan(app):
 🚮 🔢 👈 🔜 🏃 🕐❔ 🈸 🤫 🔽, 📣 ⚫️ ⏮️ 🎉 `"shutdown"`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/events/tutorial002.py!}
+{!../../docs_src/events/tutorial002.py!}
 ```
 
 📥, `shutdown` 🎉 🐕‍🦺 🔢 🔜 ✍ ✍ ⏸ `"Application shutdown"` 📁 `log.txt`.
index c8e044340d6af322fa4a6d89decc12f901fcd4d4..f09d75623c0c87b05d41083e57f9f7a71b84e9be 100644 (file)
@@ -19,7 +19,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9-11  14-15  18  19  23"
-{!> ../../../docs_src/generate_clients/tutorial001.py!}
+{!> ../../docs_src/generate_clients/tutorial001.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="7-9  12-13  16-17  21"
-{!> ../../../docs_src/generate_clients/tutorial001_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial001_py39.py!}
 ```
 
 ////
@@ -139,7 +139,7 @@ frontend-app@1.0.0 generate-client /home/user/code/frontend-app
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="23  28  36"
-{!> ../../../docs_src/generate_clients/tutorial002.py!}
+{!> ../../docs_src/generate_clients/tutorial002.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ frontend-app@1.0.0 generate-client /home/user/code/frontend-app
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="21  26  34"
-{!> ../../../docs_src/generate_clients/tutorial002_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial002_py39.py!}
 ```
 
 ////
@@ -200,7 +200,7 @@ FastAPI ⚙️ **😍 🆔** 🔠 *➡ 🛠️*, ⚫️ ⚙️ **🛠️ 🆔**
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="8-9  12"
-{!> ../../../docs_src/generate_clients/tutorial003.py!}
+{!> ../../docs_src/generate_clients/tutorial003.py!}
 ```
 
 ////
@@ -208,7 +208,7 @@ FastAPI ⚙️ **😍 🆔** 🔠 *➡ 🛠️*, ⚫️ ⚙️ **🛠️ 🆔**
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="6-7  10"
-{!> ../../../docs_src/generate_clients/tutorial003_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial003_py39.py!}
 ```
 
 ////
@@ -234,7 +234,7 @@ FastAPI ⚙️ **😍 🆔** 🔠 *➡ 🛠️*, ⚫️ ⚙️ **🛠️ 🆔**
 👥 💪 ⏬ 🗄 🎻 📁 `openapi.json` &amp; ⤴️ 👥 💪 **❎ 👈 🔡 🔖** ⏮️ ✍ 💖 👉:
 
 ```Python
-{!../../../docs_src/generate_clients/tutorial004.py!}
+{!../../docs_src/generate_clients/tutorial004.py!}
 ```
 
 ⏮️ 👈, 🛠️ 🆔 🔜 📁 ⚪️➡️ 👜 💖 `items-get_items` `get_items`, 👈 🌌 👩‍💻 🚂 💪 🏗 🙅 👩‍🔬 📛.
index e3cc389c64e51262d9cac1c22f84121bae43939f..23d2918d74f6728958b0cdfe0434e760ab9a00ef 100644 (file)
@@ -58,7 +58,7 @@ app.add_middleware(UnicornMiddleware, some_config="rainbow")
 🙆 📨 📨 `http` ⚖️ `ws` 🔜 ❎ 🔐 ⚖ ↩️.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/advanced_middleware/tutorial001.py!}
+{!../../docs_src/advanced_middleware/tutorial001.py!}
 ```
 
 ## `TrustedHostMiddleware`
@@ -66,7 +66,7 @@ app.add_middleware(UnicornMiddleware, some_config="rainbow")
 🛠️ 👈 🌐 📨 📨 ✔️ ☑ ⚒ `Host` 🎚, ✔ 💂‍♂ 🛡 🇺🇸🔍 🦠 🎚 👊.
 
 ```Python hl_lines="2  6-8"
-{!../../../docs_src/advanced_middleware/tutorial002.py!}
+{!../../docs_src/advanced_middleware/tutorial002.py!}
 ```
 
 📄 ❌ 🐕‍🦺:
@@ -82,7 +82,7 @@ app.add_middleware(UnicornMiddleware, some_config="rainbow")
 🛠️ 🔜 🍵 👯‍♂️ 🐩 &amp; 🎥 📨.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/advanced_middleware/tutorial003.py!}
+{!../../docs_src/advanced_middleware/tutorial003.py!}
 ```
 
 📄 ❌ 🐕‍🦺:
index 00d54ebecddc3bf18a97c5db589a05bb6858ae60..f7b5e7ed9dd94202d20ae1eec59d19b865d935a4 100644 (file)
@@ -32,7 +32,7 @@
 👉 🍕 📶 😐, 🌅 📟 🎲 ⏪ 😰 👆:
 
 ```Python hl_lines="9-13  36-53"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 /// tip
@@ -93,7 +93,7 @@ httpx.post(callback_url, json={"description": "Invoice paid", "paid": True})
 🥇 ✍ 🆕 `APIRouter` 👈 🔜 🔌 1️⃣ ⚖️ 🌅 ⏲.
 
 ```Python hl_lines="3  25"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 ### ✍ ⏲ *➡ 🛠️*
@@ -106,7 +106,7 @@ httpx.post(callback_url, json={"description": "Invoice paid", "paid": True})
 *  &amp; ⚫️ 💪 ✔️ 📄 📨 ⚫️ 🔜 📨, ✅ `response_model=InvoiceEventReceived`.
 
 ```Python hl_lines="16-18  21-22  28-32"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 📤 2️⃣ 👑 🔺 ⚪️➡️ 😐 *➡ 🛠️*:
@@ -176,7 +176,7 @@ https://www.external.org/events/invoices/2expen51ve
 🔜 ⚙️ 🔢 `callbacks` *👆 🛠️ ➡ 🛠️ 👨‍🎨* 🚶‍♀️ 🔢 `.routes` (👈 🤙 `list` 🛣/*➡ 🛠️*) ⚪️➡️ 👈 ⏲ 📻:
 
 ```Python hl_lines="35"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 /// tip
index b684df26f588253ddb6bc48bdafc34b449bce4ed..805bfdf30e8bb9595398110b2a62a3bd56e029a0 100644 (file)
@@ -13,7 +13,7 @@
 👆 🔜 ✔️ ⚒ 💭 👈 ⚫️ 😍 🔠 🛠️.
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
 ```
 
 ### ⚙️ *➡ 🛠️ 🔢* 📛 {
@@ -23,7 +23,7 @@
 👆 🔜 ⚫️ ⏮️ ❎ 🌐 👆 *➡ 🛠️*.
 
 ```Python hl_lines="2  12-21  24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
 ```
 
 /// tip
@@ -45,7 +45,7 @@
 🚫 *➡ 🛠️* ⚪️➡️ 🏗 🗄 🔗 (&amp; ➡️, ⚪️➡️ 🏧 🧾 ⚙️), ⚙️ 🔢 `include_in_schema` &amp; ⚒ ⚫️ `False`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
 ```
 
 ## 🏧 📛 ⚪️➡️ #️⃣
@@ -57,7 +57,7 @@
 ⚫️ 🏆 🚫 🎦 🆙 🧾, ✋️ 🎏 🧰 (✅ 🐉) 🔜 💪 ⚙️ 🎂.
 
 ```Python hl_lines="19-29"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
 ```
 
 ## 🌖 📨
 👉 `openapi_extra` 💪 👍, 🖼, 📣 [🗄 ↔](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions):
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial005.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial005.py!}
 ```
 
 🚥 👆 📂 🏧 🛠️ 🩺, 👆 ↔ 🔜 🎦 🆙 🔝 🎯 *➡ 🛠️*.
 👆 💪 👈 ⏮️ `openapi_extra`:
 
 ```Python hl_lines="20-37  39-40"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial006.py!}
 ```
 
 👉 🖼, 👥 🚫 📣 🙆 Pydantic 🏷. 👐, 📨 💪 🚫 <abbr title="converted from some plain format, like bytes, into Python objects">🎻</abbr> 🎻, ⚫️ ✍ 🔗 `bytes`, &amp; 🔢 `magic_data_reader()` 🔜 🈚 🎻 ⚫️ 🌌.
 🖼, 👉 🈸 👥 🚫 ⚙️ FastAPI 🛠️ 🛠️ ⚗ 🎻 🔗 ⚪️➡️ Pydantic 🏷 🚫 🏧 🔬 🎻. 👐, 👥 📣 📨 🎚 🆎 📁, 🚫 🎻:
 
 ```Python hl_lines="17-22  24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
 ```
 
 👐, 👐 👥 🚫 ⚙️ 🔢 🛠️ 🛠️, 👥 ⚙️ Pydantic 🏷 ❎ 🏗 🎻 🔗 💽 👈 👥 💚 📨 📁.
 &amp; ⤴️ 👆 📟, 👥 🎻 👈 📁 🎚 🔗, &amp; ⤴️ 👥 🔄 ⚙️ 🎏 Pydantic 🏷 ✔ 📁 🎚:
 
 ```Python hl_lines="26-33"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
 ```
 
 /// tip
index 156efcc16ab49abc923b4bb445cfda829060543b..7f2e8c157294c0492a5ca6ca7ee5f983e1ad9959 100644 (file)
@@ -21,7 +21,7 @@
 &amp; ⤴️ 👆 💪 ⚒ `status_code` 👈 *🔀* 📨 🎚.
 
 ```Python hl_lines="1  9  12"
-{!../../../docs_src/response_change_status_code/tutorial001.py!}
+{!../../docs_src/response_change_status_code/tutorial001.py!}
 ```
 
 &amp; ⤴️ 👆 💪 📨 🙆 🎚 👆 💪, 👆 🛎 🔜 ( `dict`, 💽 🏷, ♒️).
index 717fb87ce63fc07353fa1b1ce803259c6388e1e3..6b9e9a4d98d33721cec5b9607722ce347a9c5948 100644 (file)
@@ -7,7 +7,7 @@
 &amp; ⤴️ 👆 💪 ⚒ 🍪 👈 *🔀* 📨 🎚.
 
 ```Python hl_lines="1  8-9"
-{!../../../docs_src/response_cookies/tutorial002.py!}
+{!../../docs_src/response_cookies/tutorial002.py!}
 ```
 
 &amp; ⤴️ 👆 💪 📨 🙆 🎚 👆 💪, 👆 🛎 🔜 ( `dict`, 💽 🏷, ♒️).
@@ -27,7 +27,7 @@
 ⤴️ ⚒ 🍪 ⚫️, &amp; ⤴️ 📨 ⚫️:
 
 ```Python hl_lines="10-12"
-{!../../../docs_src/response_cookies/tutorial001.py!}
+{!../../docs_src/response_cookies/tutorial001.py!}
 ```
 
 /// tip
index 13ee081c2f8d2e9537fb5d30ed6f53b713e8d784..dcffc56c61892ebbdebf78d8bfa2a90fb85a2fb6 100644 (file)
@@ -35,7 +35,7 @@
 📚 💼, 👆 💪 ⚙️ `jsonable_encoder` 🗜 👆 📊 ⏭ 🚶‍♀️ ⚫️ 📨:
 
 ```Python hl_lines="6-7  21-22"
-{!../../../docs_src/response_directly/tutorial001.py!}
+{!../../docs_src/response_directly/tutorial001.py!}
 ```
 
 /// note | "📡 ℹ"
@@ -57,7 +57,7 @@
 👆 💪 🚮 👆 📂 🎚 🎻, 🚮 ⚫️ `Response`, &amp; 📨 ⚫️:
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ## 🗒
index 27e1cdbd553a04ad152a7ee04ef733e53cb94975..cbbbae23788d9b4f0f8a19aa40e5a591b34c26e4 100644 (file)
@@ -7,7 +7,7 @@
 &amp; ⤴️ 👆 💪 ⚒ 🎚 👈 *🔀* 📨 🎚.
 
 ```Python hl_lines="1  7-8"
-{!../../../docs_src/response_headers/tutorial002.py!}
+{!../../docs_src/response_headers/tutorial002.py!}
 ```
 
 &amp; ⤴️ 👆 💪 📨 🙆 🎚 👆 💪, 👆 🛎 🔜 ( `dict`, 💽 🏷, ♒️).
@@ -25,7 +25,7 @@
 ✍ 📨 🔬 [📨 📨 🔗](response-directly.md){.internal-link target=_blank} &amp; 🚶‍♀️ 🎚 🌖 🔢:
 
 ```Python hl_lines="10-12"
-{!../../../docs_src/response_headers/tutorial001.py!}
+{!../../docs_src/response_headers/tutorial001.py!}
 ```
 
 /// note | "📡 ℹ"
index 33470a72689058a409eeecee7ecc40d73e253f52..e6fe3e32c8bc524d3d7e834d2f2aafa26c08e260 100644 (file)
@@ -21,7 +21,7 @@
     * ⚫️ 🔌 `username` &amp; `password` 📨.
 
 ```Python hl_lines="2  6  10"
-{!../../../docs_src/security/tutorial006.py!}
+{!../../docs_src/security/tutorial006.py!}
 ```
 
 🕐❔ 👆 🔄 📂 📛 🥇 🕰 (⚖️ 🖊 "🛠️" 🔼 🩺) 🖥 🔜 💭 👆 👆 🆔 &amp; 🔐:
@@ -43,7 +43,7 @@
 ⤴️ 👥 💪 ⚙️ `secrets.compare_digest()` 🚚 👈 `credentials.username` `"stanleyjobson"`, &amp; 👈 `credentials.password` `"swordfish"`.
 
 ```Python hl_lines="1  11-21"
-{!../../../docs_src/security/tutorial007.py!}
+{!../../docs_src/security/tutorial007.py!}
 ```
 
 👉 🔜 🎏:
@@ -109,5 +109,5 @@ if "stanleyjobsox" == "stanleyjobson" and "love123" == "swordfish":
 ⏮️ 🔍 👈 🎓 ❌, 📨 `HTTPException` ⏮️ 👔 📟 4️⃣0️⃣1️⃣ (🎏 📨 🕐❔ 🙅‍♂ 🎓 🚚) &amp; 🚮 🎚 `WWW-Authenticate` ⚒ 🖥 🎦 💳 📋 🔄:
 
 ```Python hl_lines="23-27"
-{!../../../docs_src/security/tutorial007.py!}
+{!../../docs_src/security/tutorial007.py!}
 ```
index 73b2ec54067ad5dcf2a0ce838380db50f2cc548b..661be034e5f9012f5a802fabd69937432acf524f 100644 (file)
@@ -63,7 +63,7 @@ Oauth2️⃣ 👫 🎻.
 🥇, ➡️ 🔜 👀 🍕 👈 🔀 ⚪️➡️ 🖼 👑 **🔰 - 👩‍💻 🦮** [Oauth2️⃣ ⏮️ 🔐 (&amp; 🔁), 📨 ⏮️ 🥙 🤝](../../tutorial/security/oauth2-jwt.md){.internal-link target=_blank}. 🔜 ⚙️ Oauth2️⃣ ↔:
 
 ```Python hl_lines="2  4  8  12  46  64  105  107-115  121-124  128-134  139  155"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 🔜 ➡️ 📄 👈 🔀 🔁 🔁.
@@ -75,7 +75,7 @@ Oauth2️⃣ 👫 🎻.
 `scopes` 🔢 📨 `dict` ⏮️ 🔠 ↔ 🔑 &amp; 📛 💲:
 
 ```Python hl_lines="62-65"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 ↩️ 👥 🔜 📣 📚 ↔, 👫 🔜 🎦 🆙 🛠️ 🩺 🕐❔ 👆 🕹-/✔.
@@ -103,7 +103,7 @@ Oauth2️⃣ 👫 🎻.
 ///
 
 ```Python hl_lines="155"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 ## 📣 ↔ *➡ 🛠️* &amp; 🔗
@@ -131,7 +131,7 @@ Oauth2️⃣ 👫 🎻.
 ///
 
 ```Python hl_lines="4  139  168"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 /// info | "📡 ℹ"
@@ -159,7 +159,7 @@ Oauth2️⃣ 👫 🎻.
 👉 `SecurityScopes` 🎓 🎏 `Request` (`Request` ⚙️ 🤚 📨 🎚 🔗).
 
 ```Python hl_lines="8  105"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 ## ⚙️ `scopes`
@@ -175,7 +175,7 @@ Oauth2️⃣ 👫 🎻.
 👉 ⚠, 👥 🔌 ↔ 🚚 (🚥 🙆) 🎻 👽 🚀 (⚙️ `scope_str`). 👥 🚮 👈 🎻 ⚗ ↔ `WWW-Authenticate` 🎚 (👉 🍕 🔌).
 
 ```Python hl_lines="105  107-115"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 ## ✔ `username` &amp; 💽 💠
@@ -193,7 +193,7 @@ Oauth2️⃣ 👫 🎻.
 👥 ✔ 👈 👥 ✔️ 👩‍💻 ⏮️ 👈 🆔, &amp; 🚥 🚫, 👥 🤚 👈 🎏 ⚠ 👥 ✍ ⏭.
 
 ```Python hl_lines="46  116-127"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 ## ✔ `scopes`
@@ -203,7 +203,7 @@ Oauth2️⃣ 👫 🎻.
 👉, 👥 ⚙️ `security_scopes.scopes`, 👈 🔌 `list` ⏮️ 🌐 👫 ↔ `str`.
 
 ```Python hl_lines="128-134"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 ## 🔗 🌲 &amp; ↔
index e84941b572edc8ecc655b9b8e50765bf1b72689a..59fb71d73b03b5402ed547528f6a1c271940f759 100644 (file)
@@ -149,7 +149,7 @@ Hello World from Python
 👆 💪 ⚙️ 🌐 🎏 🔬 ⚒ &amp; 🧰 👆 ⚙️ Pydantic 🏷, 💖 🎏 📊 🆎 &amp; 🌖 🔬 ⏮️ `Field()`.
 
 ```Python hl_lines="2  5-8  11"
-{!../../../docs_src/settings/tutorial001.py!}
+{!../../docs_src/settings/tutorial001.py!}
 ```
 
 /// tip
@@ -167,7 +167,7 @@ Hello World from Python
 ⤴️ 👆 💪 ⚙️ 🆕 `settings` 🎚 👆 🈸:
 
 ```Python hl_lines="18-20"
-{!../../../docs_src/settings/tutorial001.py!}
+{!../../docs_src/settings/tutorial001.py!}
 ```
 
 ### 🏃 💽
@@ -203,13 +203,13 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp" uvicorn main:app
 🖼, 👆 💪 ✔️ 📁 `config.py` ⏮️:
 
 ```Python
-{!../../../docs_src/settings/app01/config.py!}
+{!../../docs_src/settings/app01/config.py!}
 ```
 
 &amp; ⤴️ ⚙️ ⚫️ 📁 `main.py`:
 
 ```Python hl_lines="3  11-13"
-{!../../../docs_src/settings/app01/main.py!}
+{!../../docs_src/settings/app01/main.py!}
 ```
 
 /// tip
@@ -229,7 +229,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp" uvicorn main:app
 👟 ⚪️➡️ ⏮️ 🖼, 👆 `config.py` 📁 💪 👀 💖:
 
 ```Python hl_lines="10"
-{!../../../docs_src/settings/app02/config.py!}
+{!../../docs_src/settings/app02/config.py!}
 ```
 
 👀 👈 🔜 👥 🚫 ✍ 🔢 👐 `settings = Settings()`.
@@ -239,7 +239,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp" uvicorn main:app
 🔜 👥 ✍ 🔗 👈 📨 🆕 `config.Settings()`.
 
 ```Python hl_lines="5  11-12"
-{!../../../docs_src/settings/app02/main.py!}
+{!../../docs_src/settings/app02/main.py!}
 ```
 
 /// tip
@@ -253,7 +253,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp" uvicorn main:app
 &amp; ⤴️ 👥 💪 🚚 ⚫️ ⚪️➡️ *➡ 🛠️ 🔢* 🔗 &amp; ⚙️ ⚫️ 🙆 👥 💪 ⚫️.
 
 ```Python hl_lines="16  18-20"
-{!../../../docs_src/settings/app02/main.py!}
+{!../../docs_src/settings/app02/main.py!}
 ```
 
 ### ⚒ &amp; 🔬
@@ -261,7 +261,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp" uvicorn main:app
 ⤴️ ⚫️ 🔜 📶 ⏩ 🚚 🎏 ⚒ 🎚 ⏮️ 🔬 🏗 🔗 🔐 `get_settings`:
 
 ```Python hl_lines="9-10  13  21"
-{!../../../docs_src/settings/app02/test_main.py!}
+{!../../docs_src/settings/app02/test_main.py!}
 ```
 
 🔗 🔐 👥 ⚒ 🆕 💲 `admin_email` 🕐❔ 🏗 🆕 `Settings` 🎚, &amp; ⤴️ 👥 📨 👈 🆕 🎚.
@@ -304,7 +304,7 @@ APP_NAME="ChimichangApp"
 &amp; ⤴️ ℹ 👆 `config.py` ⏮️:
 
 ```Python hl_lines="9-10"
-{!../../../docs_src/settings/app03/config.py!}
+{!../../docs_src/settings/app03/config.py!}
 ```
 
 📥 👥 ✍ 🎓 `Config` 🔘 👆 Pydantic `Settings` 🎓, &amp; ⚒ `env_file` 📁 ⏮️ 🇨🇻 📁 👥 💚 ⚙️.
@@ -339,7 +339,7 @@ def get_settings():
 ✋️ 👥 ⚙️ `@lru_cache` 👨‍🎨 🔛 🔝, `Settings` 🎚 🔜 ✍ 🕴 🕐, 🥇 🕰 ⚫️ 🤙. 👶 👶
 
 ```Python hl_lines="1  10"
-{!../../../docs_src/settings/app03/main.py!}
+{!../../docs_src/settings/app03/main.py!}
 ```
 
 ⤴️ 🙆 🏁 🤙 `get_settings()` 🔗 ⏭ 📨, ↩️ 🛠️ 🔗 📟 `get_settings()` &amp; 🏗 🆕 `Settings` 🎚, ⚫️ 🔜 📨 🎏 🎚 👈 📨 🔛 🥇 🤙, 🔄 &amp; 🔄.
index 1e0931f95fad280c51b1ae9fd451118119b6670b..e19f3f234001776b9dcf7b6d0cf2ca042fb5968d 100644 (file)
@@ -11,7 +11,7 @@
 🥇, ✍ 👑, 🔝-🎚, **FastAPI** 🈸, &amp; 🚮 *➡ 🛠️*:
 
 ```Python hl_lines="3  6-8"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### 🎧-🈸
@@ -21,7 +21,7 @@
 👉 🎧-🈸 ➕1️⃣ 🐩 FastAPI 🈸, ✋️ 👉 1️⃣ 👈 🔜 "🗻":
 
 ```Python hl_lines="11  14-16"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### 🗻 🎧-🈸
@@ -31,7 +31,7 @@
 👉 💼, ⚫️ 🔜 📌 ➡ `/subapi`:
 
 ```Python hl_lines="11  19"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### ✅ 🏧 🛠️ 🩺
index c45ff47a19d37b2525779e13f2b5924a309f754b..66c7484a6d65db06d8530a5a58d85ddc42460794 100644 (file)
@@ -28,7 +28,7 @@ $ pip install jinja2
 * ⚙️ `templates` 👆 ✍ ✍ &amp; 📨 `TemplateResponse`, 🚶‍♀️ `request` 1️⃣ 🔑-💲 👫 Jinja2️⃣ "🔑".
 
 ```Python hl_lines="4  11  15-18"
-{!../../../docs_src/templates/tutorial001.py!}
+{!../../docs_src/templates/tutorial001.py!}
 ```
 
 /// note
@@ -56,7 +56,7 @@ $ pip install jinja2
 ⤴️ 👆 💪 ✍ 📄 `templates/item.html` ⏮️:
 
 ```jinja hl_lines="7"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
 ```
 
 ⚫️ 🔜 🎦 `id` ✊ ⚪️➡️ "🔑" `dict` 👆 🚶‍♀️:
@@ -70,13 +70,13 @@ $ pip install jinja2
 &amp; 👆 💪 ⚙️ `url_for()` 🔘 📄, &amp; ⚙️ ⚫️, 🖼, ⏮️ `StaticFiles` 👆 📌.
 
 ```jinja hl_lines="4"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
 ```
 
 👉 🖼, ⚫️ 🔜 🔗 🎚 📁 `static/styles.css` ⏮️:
 
 ```CSS hl_lines="4"
-{!../../../docs_src/templates/static/styles.css!}
+{!../../docs_src/templates/static/styles.css!}
 ```
 
 &amp; ↩️ 👆 ⚙️ `StaticFiles`, 👈 🎚 📁 🔜 🍦 🔁 👆 **FastAPI** 🈸 📛 `/static/styles.css`.
index 825d545a94cd4324b7dedce7849d32e1798403f7..71b29f9b7c1b00799bc9448c9faf7804dfd69418 100644 (file)
@@ -49,7 +49,7 @@
 ✋️ 🎂 🎉 📟 🌅 ⚖️ 🌘 🎏, 👥 📁 ⚫️.
 
 ```Python hl_lines="8-13"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
+{!../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
 ```
 
 /// tip
@@ -73,7 +73,7 @@ Base.metadata.create_all(bind=engine)
 👥 🚮 👈 ⏸ 📥, ⏮️ 🆕 📁.
 
 ```Python hl_lines="16"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
+{!../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
 ```
 
 ## 🔗 🔐
@@ -81,7 +81,7 @@ Base.metadata.create_all(bind=engine)
 🔜 👥 ✍ 🔗 🔐 &amp; 🚮 ⚫️ 🔐 👆 📱.
 
 ```Python hl_lines="19-24  27"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
+{!../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
 ```
 
 /// tip
@@ -95,7 +95,7 @@ Base.metadata.create_all(bind=engine)
 ⤴️ 👥 💪 💯 📱 🛎.
 
 ```Python hl_lines="32-47"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
+{!../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
 ```
 
 &amp; 🌐 🛠️ 👥 ⚒ 💽 ⏮️ 💯 🔜 `test.db` 💽 ↩️ 👑 `sql_app.db`.
index 8bcffcc29c62e284ffd84314cc57124b1249d046..027767df193cfb81cf84c97f1dd10cbc81522193 100644 (file)
@@ -29,7 +29,7 @@
 &amp; ⤴️ **FastAPI** 🔜 🤙 👈 🔐 ↩️ ⏮️ 🔗.
 
 ```Python hl_lines="28-29  32"
-{!../../../docs_src/dependency_testing/tutorial001.py!}
+{!../../docs_src/dependency_testing/tutorial001.py!}
 ```
 
 /// tip
index d64436eb9c1103b2846388a24efef1ed5b7fe99b..071d49c212b2d86044bfd6d2f49075b12b6fb28d 100644 (file)
@@ -3,5 +3,5 @@
 🕐❔ 👆 💪 👆 🎉 🐕‍🦺 (`startup` &amp; `shutdown`) 🏃 👆 💯, 👆 💪 ⚙️ `TestClient` ⏮️ `with` 📄:
 
 ```Python hl_lines="9-12  20-24"
-{!../../../docs_src/app_testing/tutorial003.py!}
+{!../../docs_src/app_testing/tutorial003.py!}
 ```
index 5fb1e9c340aa9fb4546dac4372915c9e66242a91..62939c343866a10aee11e5da69765d9b6de2dc4a 100644 (file)
@@ -5,7 +5,7 @@
 👉, 👆 ⚙️ `TestClient` `with` 📄, 🔗*️⃣:
 
 ```Python hl_lines="27-31"
-{!../../../docs_src/app_testing/tutorial002.py!}
+{!../../docs_src/app_testing/tutorial002.py!}
 ```
 
 /// note
index edc951d963295cafedf0f409a391630f2a2a99d6..ae212364f259ab2ef134b06a5af7df64484a374f 100644 (file)
@@ -30,7 +30,7 @@
 👈 👆 💪 🔐 📨 🔗.
 
 ```Python hl_lines="1  7-8"
-{!../../../docs_src/using_request_directly/tutorial001.py!}
+{!../../docs_src/using_request_directly/tutorial001.py!}
 ```
 
 📣 *➡ 🛠️ 🔢* 🔢 ⏮️ 🆎 ➖ `Request` **FastAPI** 🔜 💭 🚶‍♀️ `Request` 👈 🔢.
index 30dc3043e4360d0b24e097ab47573d5302f65847..7957eba1ff721a4889211c7c7dc27d443ea1e157 100644 (file)
@@ -39,7 +39,7 @@ $ pip install websockets
 ✋️ ⚫️ 🙅 🌌 🎯 🔛 💽-🚄 *️⃣ &amp; ✔️ 👷 🖼:
 
 ```Python hl_lines="2  6-38  41-43"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 ## ✍ `websocket`
@@ -47,7 +47,7 @@ $ pip install websockets
 👆 **FastAPI** 🈸, ✍ `websocket`:
 
 ```Python hl_lines="1  46-47"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 /// note | "📡 ℹ"
@@ -63,7 +63,7 @@ $ pip install websockets
 👆 *️⃣ 🛣 👆 💪 `await` 📧 &amp; 📨 📧.
 
 ```Python hl_lines="48-52"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 👆 💪 📨 &amp; 📨 💱, ✍, &amp; 🎻 💽.
@@ -116,7 +116,7 @@ $ uvicorn main:app --reload
 👫 👷 🎏 🌌 🎏 FastAPI 🔗/*➡ 🛠️*:
 
 ```Python hl_lines="66-77  76-91"
-{!../../../docs_src/websockets/tutorial002.py!}
+{!../../docs_src/websockets/tutorial002.py!}
 ```
 
 /// info
@@ -163,7 +163,7 @@ $ uvicorn main:app --reload
 🕐❔ *️⃣ 🔗 📪, `await websocket.receive_text()` 🔜 🤚 `WebSocketDisconnect` ⚠, ❔ 👆 💪 ⤴️ ✊ &amp; 🍵 💖 👉 🖼.
 
 ```Python hl_lines="81-83"
-{!../../../docs_src/websockets/tutorial003.py!}
+{!../../docs_src/websockets/tutorial003.py!}
 ```
 
 🔄 ⚫️ 👅:
index 6a4ed073c2d616533727322ccd05941a2da35a76..8c0008c74fdd96b34da8c8dabdcba2c751c07a05 100644 (file)
@@ -13,7 +13,7 @@
 &amp; ⤴️ 🗻 👈 🔽 ➡.
 
 ```Python hl_lines="2-3  22"
-{!../../../docs_src/wsgi/tutorial001.py!}
+{!../../docs_src/wsgi/tutorial001.py!}
 ```
 
 ## ✅ ⚫️
index a17ba4eec52c1975f150abbbfddaf047950e72e5..a5932933a6d4e9e7b0a2772cf7b0480cca37d232 100644 (file)
@@ -30,7 +30,7 @@
 🖼:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/conditional_openapi/tutorial001.py!}
+{!../../docs_src/conditional_openapi/tutorial001.py!}
 ```
 
 📥 👥 📣 ⚒ `openapi_url` ⏮️ 🎏 🔢 `"/openapi.json"`.
index 1f66c6edae1322c05c26799a2e40fd212a7f202b..0425e6267c49437aeff16048245b6d5b6877cf0a 100644 (file)
@@ -43,7 +43,7 @@
 👈 🌌, 🎏 🛣 🎓 💪 🍵 🗜 🗜 ⚖️ 🗜 📨.
 
 ```Python hl_lines="8-15"
-{!../../../docs_src/custom_request_and_route/tutorial001.py!}
+{!../../docs_src/custom_request_and_route/tutorial001.py!}
 ```
 
 ### ✍ 🛃 `GzipRoute` 🎓
@@ -57,7 +57,7 @@
 📥 👥 ⚙️ ⚫️ ✍ `GzipRequest` ⚪️➡️ ⏮️ 📨.
 
 ```Python hl_lines="18-26"
-{!../../../docs_src/custom_request_and_route/tutorial001.py!}
+{!../../docs_src/custom_request_and_route/tutorial001.py!}
 ```
 
 /// note | "📡 ℹ"
 🌐 👥 💪 🍵 📨 🔘 `try`/`except` 🍫:
 
 ```Python hl_lines="13  15"
-{!../../../docs_src/custom_request_and_route/tutorial002.py!}
+{!../../docs_src/custom_request_and_route/tutorial002.py!}
 ```
 
 🚥 ⚠ 📉, `Request` 👐 🔜 ↔, 👥 💪 ✍ &amp; ⚒ ⚙️ 📨 💪 🕐❔ 🚚 ❌:
 
 ```Python hl_lines="16-18"
-{!../../../docs_src/custom_request_and_route/tutorial002.py!}
+{!../../docs_src/custom_request_and_route/tutorial002.py!}
 ```
 
 ## 🛃 `APIRoute` 🎓 📻
 👆 💪 ⚒ `route_class` 🔢 `APIRouter`:
 
 ```Python hl_lines="26"
-{!../../../docs_src/custom_request_and_route/tutorial003.py!}
+{!../../docs_src/custom_request_and_route/tutorial003.py!}
 ```
 
 👉 🖼, *➡ 🛠️* 🔽 `router` 🔜 ⚙️ 🛃 `TimedRoute` 🎓, &amp; 🔜 ✔️ ➕ `X-Response-Time` 🎚 📨 ⏮️ 🕰 ⚫️ ✊ 🏗 📨:
 
 ```Python hl_lines="13-20"
-{!../../../docs_src/custom_request_and_route/tutorial003.py!}
+{!../../docs_src/custom_request_and_route/tutorial003.py!}
 ```
index dc9adf80e15a8390102c10af93c16eda1bd28f53..698c78ec14a51b609cac284da7f881299fb213c6 100644 (file)
@@ -47,7 +47,7 @@
 🥇, ✍ 🌐 👆 **FastAPI** 🈸 🛎:
 
 ```Python hl_lines="1  4  7-9"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### 🏗 🗄 🔗
@@ -55,7 +55,7 @@
 ⤴️, ⚙️ 🎏 🚙 🔢 🏗 🗄 🔗, 🔘 `custom_openapi()` 🔢:
 
 ```Python hl_lines="2  15-20"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### 🔀 🗄 🔗
@@ -63,7 +63,7 @@
 🔜 👆 💪 🚮 📄 ↔, ❎ 🛃 `x-logo` `info` "🎚" 🗄 🔗:
 
 ```Python hl_lines="21-23"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### 💾 🗄 🔗
@@ -75,7 +75,7 @@
 ⚫️ 🔜 🏗 🕴 🕐, &amp; ⤴️ 🎏 💾 🔗 🔜 ⚙️ ⏭ 📨.
 
 ```Python hl_lines="13-14  24-25"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### 🔐 👩‍🔬
@@ -83,7 +83,7 @@
 🔜 👆 💪 ❎ `.openapi()` 👩‍🔬 ⏮️ 👆 🆕 🔢.
 
 ```Python hl_lines="28"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### ✅ ⚫️
index b8610b767526b6237a5fb55c072c4ed219458bd0..5d0d95567253ec398aaa90adddfe5a480fd2a002 100644 (file)
@@ -36,7 +36,7 @@
 📥 🤪 🎮 ❔ 👆 💪 🛠️ 🍓 ⏮️ FastAPI:
 
 ```Python hl_lines="3  22  25-26"
-{!../../../docs_src/graphql/tutorial001.py!}
+{!../../docs_src/graphql/tutorial001.py!}
 ```
 
 👆 💪 💡 🌅 🔃 🍓 <a href="https://strawberry.rocks/" class="external-link" target="_blank">🍓 🧾</a>.
index 88b827c247fef7b777d53b124d2c9b621d5e41e1..d25b77894bab467825e6a3321f8c18847c6b971c 100644 (file)
@@ -71,7 +71,7 @@
 ➡️ 🥇 ✅ 🌐 😐 🏒 📟, ✍ 🏒 💽:
 
 ```Python hl_lines="3  5  22"
-{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/database.py!}
 ```
 
 /// tip
@@ -131,7 +131,7 @@ connect_args={"check_same_thread": False}
 👥 🔜 ✍ `PeeweeConnectionState`:
 
 ```Python hl_lines="10-19"
-{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/database.py!}
 ```
 
 👉 🎓 😖 ⚪️➡️ 🎁 🔗 🎓 ⚙️ 🏒.
@@ -155,7 +155,7 @@ connect_args={"check_same_thread": False}
 🔜, 📁 `._state` 🔗 🔢 🏒 💽 `db` 🎚 ⚙️ 🆕 `PeeweeConnectionState`:
 
 ```Python hl_lines="24"
-{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/database.py!}
 ```
 
 /// tip
@@ -191,7 +191,7 @@ connect_args={"check_same_thread": False}
 🗄 `db` ⚪️➡️ `database` (📁 `database.py` ⚪️➡️ 🔛) &amp; ⚙️ ⚫️ 📥.
 
 ```Python hl_lines="3  6-12  15-21"
-{!../../../docs_src/sql_databases_peewee/sql_app/models.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/models.py!}
 ```
 
 /// tip
@@ -225,7 +225,7 @@ connect_args={"check_same_thread": False}
 ✍ 🌐 🎏 Pydantic 🏷 🇸🇲 🔰:
 
 ```Python hl_lines="16-18  21-22  25-30  34-35  38-39  42-48"
-{!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
 ```
 
 /// tip
@@ -253,7 +253,7 @@ connect_args={"check_same_thread": False}
 👥 🔜 ✍ 🛃 `PeeweeGetterDict` 🎓 &amp; ⚙️ ⚫️ 🌐 🎏 Pydantic *🏷* / 🔗 👈 ⚙️ `orm_mode`:
 
 ```Python hl_lines="3  8-13  31  49"
-{!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
 ```
 
 📥 👥 ✅ 🚥 🔢 👈 ➖ 🔐 (✅ `.items` `some_user.items`) 👐 `peewee.ModelSelect`.
@@ -277,7 +277,7 @@ connect_args={"check_same_thread": False}
 ✍ 🌐 🎏 💩 🇨🇻 🇸🇲 🔰, 🌐 📟 📶 🎏:
 
 ```Python hl_lines="1  4-5  8-9  12-13  16-20  23-24  27-30"
-{!../../../docs_src/sql_databases_peewee/sql_app/crud.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/crud.py!}
 ```
 
 📤 🔺 ⏮️ 📟 🇸🇲 🔰.
@@ -301,7 +301,7 @@ list(models.User.select())
 📶 🙃 🌌 ✍ 💽 🏓:
 
 ```Python hl_lines="9-11"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/main.py!}
 ```
 
 ### ✍ 🔗
@@ -309,7 +309,7 @@ list(models.User.select())
 ✍ 🔗 👈 🔜 🔗 💽 ▶️️ ▶️ 📨 &amp; 🔌 ⚫️ 🔚:
 
 ```Python hl_lines="23-29"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/main.py!}
 ```
 
 📥 👥 ✔️ 🛁 `yield` ↩️ 👥 🤙 🚫 ⚙️ 💽 🎚 🔗.
@@ -323,7 +323,7 @@ list(models.User.select())
 ✋️ 👥 🚫 ⚙️ 💲 👐 👉 🔗 (⚫️ 🤙 🚫 🤝 🙆 💲, ⚫️ ✔️ 🛁 `yield`). , 👥 🚫 🚮 ⚫️ *➡ 🛠️ 🔢* ✋️ *➡ 🛠️ 👨‍🎨* `dependencies` 🔢:
 
 ```Python hl_lines="32  40  47  59  65  72"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/main.py!}
 ```
 
 ### 🔑 🔢 🎧-🔗
@@ -333,7 +333,7 @@ list(models.User.select())
 👈, 👥 💪 ✍ ➕1️⃣ `async` 🔗 `reset_db_state()` 👈 ⚙️ 🎧-🔗 `get_db()`. ⚫️ 🔜 ⚒ 💲 🔑 🔢 (⏮️ 🔢 `dict`) 👈 🔜 ⚙️ 💽 🇵🇸 🎂 📨. &amp; ⤴️ 🔗 `get_db()` 🔜 🏪 ⚫️ 💽 🇵🇸 (🔗, 💵, ♒️).
 
 ```Python hl_lines="18-20"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/main.py!}
 ```
 
 **⏭ 📨**, 👥 🔜 ⏲ 👈 🔑 🔢 🔄 `async` 🔗 `reset_db_state()` &amp; ⤴️ ✍ 🆕 🔗 `get_db()` 🔗, 👈 🆕 📨 🔜 ✔️ 🚮 👍 💽 🇵🇸 (🔗, 💵, ♒️).
@@ -365,7 +365,7 @@ async def reset_db_state():
 🔜, 😒, 📥 🐩 **FastAPI** *➡ 🛠️* 📟.
 
 ```Python hl_lines="32-37  40-43  46-53  56-62  65-68  71-79"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/main.py!}
 ```
 
 ### 🔃 `def` 🆚 `async def`
@@ -482,31 +482,31 @@ async def reset_db_state():
 * `sql_app/database.py`:
 
 ```Python
-{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/database.py!}
 ```
 
 * `sql_app/models.py`:
 
 ```Python
-{!../../../docs_src/sql_databases_peewee/sql_app/models.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/models.py!}
 ```
 
 * `sql_app/schemas.py`:
 
 ```Python
-{!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
 ```
 
 * `sql_app/crud.py`:
 
 ```Python
-{!../../../docs_src/sql_databases_peewee/sql_app/crud.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/crud.py!}
 ```
 
 * `sql_app/main.py`:
 
 ```Python
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/main.py!}
 ```
 
 ## 📡 ℹ
index 202c90f94c2bc787814a76aa172b6fd5e0425ab5..d2af23bb9a4cd5e2d1c8df2e8444c1d6b918d61b 100644 (file)
@@ -23,7 +23,7 @@
 ➡️ ▶️ ⏮️ 🙅 🖼:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 🤙 👉 📋 🔢:
@@ -39,7 +39,7 @@ John Doe
 * <abbr title="Puts them together, as one. With the contents of one after the other.">🔢</abbr> 👫 ⏮️ 🚀 🖕.
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### ✍ ⚫️
@@ -83,7 +83,7 @@ John Doe
 👈 "🆎 🔑":
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 👈 🚫 🎏 📣 🔢 💲 💖 🔜 ⏮️:
@@ -113,7 +113,7 @@ John Doe
 ✅ 👉 🔢, ⚫️ ⏪ ✔️ 🆎 🔑:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 ↩️ 👨‍🎨 💭 🆎 🔢, 👆 🚫 🕴 🤚 🛠️, 👆 🤚 ❌ ✅:
@@ -123,7 +123,7 @@ John Doe
 🔜 👆 💭 👈 👆 ✔️ 🔧 ⚫️, 🗜 `age` 🎻 ⏮️ `str(age)`:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## 📣 🆎
@@ -144,7 +144,7 @@ John Doe
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### 💊 🆎 ⏮️ 🆎 🔢
@@ -172,7 +172,7 @@ John Doe
 ⚪️➡️ `typing`, 🗄 `List` (⏮️ 🔠 `L`):
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 📣 🔢, ⏮️ 🎏 ❤ (`:`) ❕.
@@ -182,7 +182,7 @@ John Doe
 📇 🆎 👈 🔌 🔗 🆎, 👆 🚮 👫 ⬜ 🗜:
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 ////
@@ -196,7 +196,7 @@ John Doe
 📇 🆎 👈 🔌 🔗 🆎, 👆 🚮 👫 ⬜ 🗜:
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006_py39.py!}
+{!> ../../docs_src/python_types/tutorial006_py39.py!}
 ```
 
 ////
@@ -234,7 +234,7 @@ John Doe
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial007.py!}
+{!> ../../docs_src/python_types/tutorial007.py!}
 ```
 
 ////
@@ -242,7 +242,7 @@ John Doe
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial007_py39.py!}
+{!> ../../docs_src/python_types/tutorial007_py39.py!}
 ```
 
 ////
@@ -263,7 +263,7 @@ John Doe
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008.py!}
+{!> ../../docs_src/python_types/tutorial008.py!}
 ```
 
 ////
@@ -271,7 +271,7 @@ John Doe
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008_py39.py!}
+{!> ../../docs_src/python_types/tutorial008_py39.py!}
 ```
 
 ////
@@ -293,7 +293,7 @@ John Doe
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008b.py!}
+{!> ../../docs_src/python_types/tutorial008b.py!}
 ```
 
 ////
@@ -301,7 +301,7 @@ John Doe
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008b_py310.py!}
+{!> ../../docs_src/python_types/tutorial008b_py310.py!}
 ```
 
 ////
@@ -315,7 +315,7 @@ John Doe
 🐍 3️⃣.6️⃣ &amp; 🔛 (✅ 🐍 3️⃣.1️⃣0️⃣) 👆 💪 📣 ⚫️ 🏭 &amp; ⚙️ `Optional` ⚪️➡️ `typing` 🕹.
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 ⚙️ `Optional[str]` ↩️ `str` 🔜 ➡️ 👨‍🎨 ℹ 👆 🔍 ❌ 🌐❔ 👆 💪 🤔 👈 💲 🕧 `str`, 🕐❔ ⚫️ 💪 🤙 `None` 💁‍♂️.
@@ -327,7 +327,7 @@ John Doe
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009.py!}
+{!> ../../docs_src/python_types/tutorial009.py!}
 ```
 
 ////
@@ -335,7 +335,7 @@ John Doe
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛 - 🎛
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009b.py!}
+{!> ../../docs_src/python_types/tutorial009b.py!}
 ```
 
 ////
@@ -343,7 +343,7 @@ John Doe
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial009_py310.py!}
+{!> ../../docs_src/python_types/tutorial009_py310.py!}
 ```
 
 ////
@@ -364,7 +364,7 @@ John Doe
 🖼, ➡️ ✊ 👉 🔢:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009c.py!}
+{!../../docs_src/python_types/tutorial009c.py!}
 ```
 
 🔢 `name` 🔬 `Optional[str]`, ✋️ ⚫️ **🚫 📦**, 👆 🚫🔜 🤙 🔢 🍵 🔢:
@@ -382,7 +382,7 @@ say_hi(name=None)  # This works, None is valid 🎉
 👍 📰, 🕐 👆 🔛 🐍 3️⃣.1️⃣0️⃣ 👆 🏆 🚫 ✔️ 😟 🔃 👈, 👆 🔜 💪 🎯 ⚙️ `|` 🔬 🇪🇺 🆎:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009c_py310.py!}
+{!../../docs_src/python_types/tutorial009c_py310.py!}
 ```
 
 &amp; ⤴️ 👆 🏆 🚫 ✔️ 😟 🔃 📛 💖 `Optional` &amp; `Union`. 👶
@@ -446,13 +446,13 @@ say_hi(name=None)  # This works, None is valid 🎉
 ➡️ 💬 👆 ✔️ 🎓 `Person`, ⏮️ 📛:
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 ⤴️ 👆 💪 📣 🔢 🆎 `Person`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 &amp; ⤴️, 🔄, 👆 🤚 🌐 👨‍🎨 🐕‍🦺:
@@ -476,7 +476,7 @@ say_hi(name=None)  # This works, None is valid 🎉
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011.py!}
+{!> ../../docs_src/python_types/tutorial011.py!}
 ```
 
 ////
@@ -484,7 +484,7 @@ say_hi(name=None)  # This works, None is valid 🎉
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py39.py!}
+{!> ../../docs_src/python_types/tutorial011_py39.py!}
 ```
 
 ////
@@ -492,7 +492,7 @@ say_hi(name=None)  # This works, None is valid 🎉
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py310.py!}
+{!> ../../docs_src/python_types/tutorial011_py310.py!}
 ```
 
 ////
index 1d17a0e4eabf6b537ddee8f191bfbb416567814d..0f4585ebe1a8b3c1ea52764c9ae369e275e27af9 100644 (file)
@@ -16,7 +16,7 @@
 🥇, 🗄 `BackgroundTasks` &amp; 🔬 🔢 👆 *➡ 🛠️ 🔢* ⏮️ 🆎 📄 `BackgroundTasks`:
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 **FastAPI** 🔜 ✍ 🎚 🆎 `BackgroundTasks` 👆 &amp; 🚶‍♀️ ⚫️ 👈 🔢.
@@ -34,7 +34,7 @@
 &amp; ✍ 🛠️ 🚫 ⚙️ `async` &amp; `await`, 👥 🔬 🔢 ⏮️ 😐 `def`:
 
 ```Python hl_lines="6-9"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 ## 🚮 🖥 📋
@@ -42,7 +42,7 @@
 🔘 👆 *➡ 🛠️ 🔢*, 🚶‍♀️ 👆 📋 🔢 *🖥 📋* 🎚 ⏮️ 👩‍🔬 `.add_task()`:
 
 ```Python hl_lines="14"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 `.add_task()` 📨 ❌:
@@ -60,7 +60,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="13  15  22  25"
-{!> ../../../docs_src/background_tasks/tutorial002.py!}
+{!> ../../docs_src/background_tasks/tutorial002.py!}
 ```
 
 ////
@@ -68,7 +68,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="11  13  20  23"
-{!> ../../../docs_src/background_tasks/tutorial002_py310.py!}
+{!> ../../docs_src/background_tasks/tutorial002_py310.py!}
 ```
 
 ////
index 693a75d28d6175f483f8b7aad8bbc58f1eb6c8e4..074ab302c8336d8274f1dabe6c2eaa34f82464d0 100644 (file)
@@ -86,7 +86,7 @@ from app.routers import items
 👆 🗄 ⚫️ &amp; ✍ "👐" 🎏 🌌 👆 🔜 ⏮️ 🎓 `FastAPI`:
 
 ```Python hl_lines="1  3" title="app/routers/users.py"
-{!../../../docs_src/bigger_applications/app/routers/users.py!}
+{!../../docs_src/bigger_applications/app/routers/users.py!}
 ```
 
 ### *➡ 🛠️* ⏮️ `APIRouter`
@@ -96,7 +96,7 @@ from app.routers import items
 ⚙️ ⚫️ 🎏 🌌 👆 🔜 ⚙️ `FastAPI` 🎓:
 
 ```Python hl_lines="6  11  16" title="app/routers/users.py"
-{!../../../docs_src/bigger_applications/app/routers/users.py!}
+{!../../docs_src/bigger_applications/app/routers/users.py!}
 ```
 
 👆 💪 💭 `APIRouter` "🐩 `FastAPI`" 🎓.
@@ -122,7 +122,7 @@ from app.routers import items
 👥 🔜 🔜 ⚙️ 🙅 🔗 ✍ 🛃 `X-Token` 🎚:
 
 ```Python hl_lines="1  4-6" title="app/dependencies.py"
-{!../../../docs_src/bigger_applications/app/dependencies.py!}
+{!../../docs_src/bigger_applications/app/dependencies.py!}
 ```
 
 /// tip
@@ -156,7 +156,7 @@ from app.routers import items
 , ↩️ ❎ 🌐 👈 🔠 *➡ 🛠️*, 👥 💪 🚮 ⚫️ `APIRouter`.
 
 ```Python hl_lines="5-10  16  21" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 ➡ 🔠 *➡ 🛠️* ✔️ ▶️ ⏮️ `/`, 💖:
@@ -217,7 +217,7 @@ async def read_item(item_id: str):
 👥 ⚙️ ⚖ 🗄 ⏮️ `..` 🔗:
 
 ```Python hl_lines="3" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 #### ❔ ⚖ 🗄 👷
@@ -290,7 +290,7 @@ that 🔜 ⛓:
 ✋️ 👥 💪 🚮 _🌅_ `tags` 👈 🔜 ✔ 🎯 *➡ 🛠️*, &amp; ➕ `responses` 🎯 👈 *➡ 🛠️*:
 
 ```Python hl_lines="30-31" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 /// tip
@@ -318,7 +318,7 @@ that 🔜 ⛓:
 &amp; 👥 💪 📣 [🌐 🔗](dependencies/global-dependencies.md){.internal-link target=_blank} 👈 🔜 🌀 ⏮️ 🔗 🔠 `APIRouter`:
 
 ```Python hl_lines="1  3  7" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 ### 🗄 `APIRouter`
@@ -326,7 +326,7 @@ that 🔜 ⛓:
 🔜 👥 🗄 🎏 🔁 👈 ✔️ `APIRouter`Ⓜ:
 
 ```Python hl_lines="5" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 📁 `app/routers/users.py` &amp; `app/routers/items.py` 🔁 👈 🍕 🎏 🐍 📦 `app`, 👥 💪 ⚙️ 👁 ❣ `.` 🗄 👫 ⚙️ "⚖ 🗄".
@@ -391,7 +391,7 @@ from .routers.users import router
 , 💪 ⚙️ 👯‍♂️ 👫 🎏 📁, 👥 🗄 🔁 🔗:
 
 ```Python hl_lines="5" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 ### 🔌 `APIRouter`Ⓜ `users` &amp; `items`
@@ -399,7 +399,7 @@ from .routers.users import router
 🔜, ➡️ 🔌 `router`Ⓜ ⚪️➡️ 🔁 `users` &amp; `items`:
 
 ```Python hl_lines="10-11" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 /// info
@@ -441,7 +441,7 @@ from .routers.users import router
 👉 🖼 ⚫️ 🔜 💎 🙅. ✋️ ➡️ 💬 👈 ↩️ ⚫️ 💰 ⏮️ 🎏 🏗 🏢, 👥 🚫🔜 🔀 ⚫️ &amp; 🚮 `prefix`, `dependencies`, `tags`, ♒️. 🔗 `APIRouter`:
 
 ```Python hl_lines="3" title="app/internal/admin.py"
-{!../../../docs_src/bigger_applications/app/internal/admin.py!}
+{!../../docs_src/bigger_applications/app/internal/admin.py!}
 ```
 
 ✋️ 👥 💚 ⚒ 🛃 `prefix` 🕐❔ ✅ `APIRouter` 👈 🌐 🚮 *➡ 🛠️* ▶️ ⏮️ `/admin`, 👥 💚 🔐 ⚫️ ⏮️ `dependencies` 👥 ⏪ ✔️ 👉 🏗, &amp; 👥 💚 🔌 `tags` &amp; `responses`.
@@ -449,7 +449,7 @@ from .routers.users import router
 👥 💪 📣 🌐 👈 🍵 ✔️ 🔀 ⏮️ `APIRouter` 🚶‍♀️ 👈 🔢 `app.include_router()`:
 
 ```Python hl_lines="14-17" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 👈 🌌, ⏮️ `APIRouter` 🔜 🚧 ⚗, 👥 💪 💰 👈 🎏 `app/internal/admin.py` 📁 ⏮️ 🎏 🏗 🏢.
@@ -472,7 +472,7 @@ from .routers.users import router
 📥 👥 ⚫️... 🎦 👈 👥 💪 🤷:
 
 ```Python hl_lines="21-23" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 &amp; ⚫️ 🔜 👷 ☑, 👯‍♂️ ⏮️ 🌐 🎏 *➡ 🛠️* 🚮 ⏮️ `app.include_router()`.
index c5a04daeb0d4754c767af29d7ba7d4b70abc6ff0..eb3093de2725a7c426880a7ba1c8a1ca6099bba4 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="9-12"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
index c2a9a224d5b21616b0a0bbfedb675f630576dbf6..2e20c83f951fcaa6ce02ecf19627e240f009813b 100644 (file)
@@ -11,7 +11,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="19-21"
-{!> ../../../docs_src/body_multiple_params/tutorial001.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="17-19"
-{!> ../../../docs_src/body_multiple_params/tutorial001_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -48,7 +48,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial002.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002.py!}
 ```
 
 ////
@@ -56,7 +56,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial002_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002_py310.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial003.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial003_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -157,7 +157,7 @@ q: str | None = None
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004.py!}
 ```
 
 ////
@@ -165,7 +165,7 @@ q: str | None = None
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="26"
-{!> ../../../docs_src/body_multiple_params/tutorial004_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -193,7 +193,7 @@ item: Item = Body(embed=True)
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005.py!}
 ```
 
 ////
@@ -201,7 +201,7 @@ item: Item = Body(embed=True)
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/body_multiple_params/tutorial005_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_py310.py!}
 ```
 
 ////
index 23114540aa6240a962c724c4100d02933ef16d7f..3b56b7a07cdfa206224372b7fe913accb97e3071 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial001.py!}
+{!> ../../docs_src/body_nested_models/tutorial001.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial001_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@
 ✋️ 🐍 ⏬ ⏭ 3️⃣.9️⃣ (3️⃣.6️⃣ &amp; 🔛), 👆 🥇 💪 🗄 `List` ⚪️➡️ 🐩 🐍 `typing` 🕹:
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/body_nested_models/tutorial002.py!}
+{!> ../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ### 📣 `list` ⏮️ 🆎 🔢
@@ -68,7 +68,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial002.py!}
+{!> ../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ////
@@ -76,7 +76,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial002_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial002_py39.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial002_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -100,7 +100,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="1  14"
-{!> ../../../docs_src/body_nested_models/tutorial003.py!}
+{!> ../../docs_src/body_nested_models/tutorial003.py!}
 ```
 
 ////
@@ -108,7 +108,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial003_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial003_py39.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial003_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial003_py310.py!}
 ```
 
 ////
@@ -144,7 +144,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/body_nested_models/tutorial004.py!}
+{!> ../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/body_nested_models/tutorial004_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -160,7 +160,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7-9"
-{!> ../../../docs_src/body_nested_models/tutorial004_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py310.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial004.py!}
+{!> ../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial004_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -188,7 +188,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_nested_models/tutorial004_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py310.py!}
 ```
 
 ////
@@ -227,7 +227,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="4  10"
-{!> ../../../docs_src/body_nested_models/tutorial005.py!}
+{!> ../../docs_src/body_nested_models/tutorial005.py!}
 ```
 
 ////
@@ -235,7 +235,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="4  10"
-{!> ../../../docs_src/body_nested_models/tutorial005_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial005_py39.py!}
 ```
 
 ////
@@ -243,7 +243,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="2  8"
-{!> ../../../docs_src/body_nested_models/tutorial005_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial005_py310.py!}
 ```
 
 ////
@@ -257,7 +257,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial006.py!}
+{!> ../../docs_src/body_nested_models/tutorial006.py!}
 ```
 
 ////
@@ -265,7 +265,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial006_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial006_py39.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_nested_models/tutorial006_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial006_py310.py!}
 ```
 
 ////
@@ -317,7 +317,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9  14  20  23  27"
-{!> ../../../docs_src/body_nested_models/tutorial007.py!}
+{!> ../../docs_src/body_nested_models/tutorial007.py!}
 ```
 
 ////
@@ -325,7 +325,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="9  14  20  23  27"
-{!> ../../../docs_src/body_nested_models/tutorial007_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial007_py39.py!}
 ```
 
 ////
@@ -333,7 +333,7 @@ my_list: List[str]
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7  12  18  21  25"
-{!> ../../../docs_src/body_nested_models/tutorial007_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial007_py310.py!}
 ```
 
 ////
@@ -363,7 +363,7 @@ images: list[Image]
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/body_nested_models/tutorial008.py!}
+{!> ../../docs_src/body_nested_models/tutorial008.py!}
 ```
 
 ////
@@ -371,7 +371,7 @@ images: list[Image]
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/body_nested_models/tutorial008_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial008_py39.py!}
 ```
 
 ////
@@ -407,7 +407,7 @@ images: list[Image]
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/body_nested_models/tutorial009.py!}
+{!> ../../docs_src/body_nested_models/tutorial009.py!}
 ```
 
 ////
@@ -415,7 +415,7 @@ images: list[Image]
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/body_nested_models/tutorial009_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial009_py39.py!}
 ```
 
 ////
index 97501eb6da6f814588a2697d2dfafbc3dcda8319..4a4b3b6b876f272de77294da78cf3233d1917e27 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="30-35"
-{!> ../../../docs_src/body_updates/tutorial001.py!}
+{!> ../../docs_src/body_updates/tutorial001.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="30-35"
-{!> ../../../docs_src/body_updates/tutorial001_py39.py!}
+{!> ../../docs_src/body_updates/tutorial001_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="28-33"
-{!> ../../../docs_src/body_updates/tutorial001_py310.py!}
+{!> ../../docs_src/body_updates/tutorial001_py310.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="34"
-{!> ../../../docs_src/body_updates/tutorial002.py!}
+{!> ../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ////
@@ -87,7 +87,7 @@
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="34"
-{!> ../../../docs_src/body_updates/tutorial002_py39.py!}
+{!> ../../docs_src/body_updates/tutorial002_py39.py!}
 ```
 
 ////
@@ -95,7 +95,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="32"
-{!> ../../../docs_src/body_updates/tutorial002_py310.py!}
+{!> ../../docs_src/body_updates/tutorial002_py310.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="35"
-{!> ../../../docs_src/body_updates/tutorial002.py!}
+{!> ../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="35"
-{!> ../../../docs_src/body_updates/tutorial002_py39.py!}
+{!> ../../docs_src/body_updates/tutorial002_py39.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="33"
-{!> ../../../docs_src/body_updates/tutorial002_py310.py!}
+{!> ../../docs_src/body_updates/tutorial002_py310.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="30-37"
-{!> ../../../docs_src/body_updates/tutorial002.py!}
+{!> ../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="30-37"
-{!> ../../../docs_src/body_updates/tutorial002_py39.py!}
+{!> ../../docs_src/body_updates/tutorial002_py39.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="28-35"
-{!> ../../../docs_src/body_updates/tutorial002_py310.py!}
+{!> ../../docs_src/body_updates/tutorial002_py310.py!}
 ```
 
 ////
index 79d8e716f637278e42dce9c177a4710e0758f2a5..3468fc5122bcb7d27e12d9b99ce24486a17b9a38 100644 (file)
@@ -25,7 +25,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -33,7 +33,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="7-11"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -55,7 +55,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="5-9"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -89,7 +89,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/body/tutorial002.py!}
+{!> ../../docs_src/body/tutorial002.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/body/tutorial002_py310.py!}
+{!> ../../docs_src/body/tutorial002_py310.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/body/tutorial003.py!}
+{!> ../../docs_src/body/tutorial003.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="15-16"
-{!> ../../../docs_src/body/tutorial003_py310.py!}
+{!> ../../docs_src/body/tutorial003_py310.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial004.py!}
+{!> ../../docs_src/body/tutorial004.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial004_py310.py!}
+{!> ../../docs_src/body/tutorial004_py310.py!}
 ```
 
 ////
index 89199902837a95193b89bb79d6efecddb0acd38a..f4956e76f3e129d6c6731414b74989c2ac2cf161 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
index 690b8973a2fc78d23de6ede2f4029acfb968b4e1..5829319cb2a15adb338266a78ad641271086db39 100644 (file)
@@ -47,7 +47,7 @@
 * 🎯 🇺🇸🔍 🎚 ⚖️ 🌐 👫 ⏮️ 🃏 `"*"`.
 
 ```Python hl_lines="2  6-11  13-19"
-{!../../../docs_src/cors/tutorial001.py!}
+{!../../docs_src/cors/tutorial001.py!}
 ```
 
 🔢 🔢 ⚙️ `CORSMiddleware` 🛠️ 🚫 🔢, 👆 🔜 💪 🎯 🛠️ 🎯 🇨🇳, 👩‍🔬, ⚖️ 🎚, ✔ 🖥 ✔ ⚙️ 👫 ✖️-🆔 🔑.
index abef2a50cd00488025e50a7045c01848547b17e3..9320370d66f10e0fda5834d82c09b1be19292ef2 100644 (file)
@@ -7,7 +7,7 @@
 👆 FastAPI 🈸, 🗄 &amp; 🏃 `uvicorn` 🔗:
 
 ```Python hl_lines="1  15"
-{!../../../docs_src/debugging/tutorial001.py!}
+{!../../docs_src/debugging/tutorial001.py!}
 ```
 
 ### 🔃 `__name__ == "__main__"`
index f14239b0f8e496b9a53bb42ac98fbcbb2ee6935a..3e58d506ceccb9359239023290abcc09e2fc20b0 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -86,7 +86,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -94,7 +94,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="9-13"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -104,7 +104,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -112,7 +112,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -122,7 +122,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -130,7 +130,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -160,7 +160,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -206,7 +206,7 @@ commons = Depends(CommonQueryParams)
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003.py!}
+{!> ../../docs_src/dependencies/tutorial003.py!}
 ```
 
 ////
@@ -214,7 +214,7 @@ commons = Depends(CommonQueryParams)
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial003_py310.py!}
+{!> ../../docs_src/dependencies/tutorial003_py310.py!}
 ```
 
 ////
@@ -254,7 +254,7 @@ commons: CommonQueryParams = Depends()
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004.py!}
+{!> ../../docs_src/dependencies/tutorial004.py!}
 ```
 
 ////
@@ -262,7 +262,7 @@ commons: CommonQueryParams = Depends()
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial004_py310.py!}
+{!> ../../docs_src/dependencies/tutorial004_py310.py!}
 ```
 
 ////
index bf267e056148c8e9174152f27ee6225cf778df6d..cd36ad1004d7ad32f055e82817b2dc325914e876 100644 (file)
@@ -15,7 +15,7 @@
 ⚫️ 🔜 `list` `Depends()`:
 
 ```Python hl_lines="17"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
 ```
 
 👉 🔗 🔜 🛠️/❎ 🎏 🌌 😐 🔗. ✋️ 👫 💲 (🚥 👫 📨 🙆) 🏆 🚫 🚶‍♀️ 👆 *➡ 🛠️ 🔢*.
@@ -47,7 +47,7 @@
 👫 💪 📣 📨 📄 (💖 🎚) ⚖️ 🎏 🎧-🔗:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ### 🤚 ⚠
@@ -55,7 +55,7 @@
 👫 🔗 💪 `raise` ⚠, 🎏 😐 🔗:
 
 ```Python hl_lines="8  13"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ### 📨 💲
@@ -65,7 +65,7 @@
 , 👆 💪 🏤-⚙️ 😐 🔗 (👈 📨 💲) 👆 ⏪ ⚙️ 👱 🙆, &amp; ✋️ 💲 🏆 🚫 ⚙️, 🔗 🔜 🛠️:
 
 ```Python hl_lines="9  14"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ## 🔗 👪 *➡ 🛠️*
index 5998d06dfff2c852678b0710c2e7a6dccef02d7e..e0d6dba24ebba3c9cb1963ab025756f96c0fc0f7 100644 (file)
@@ -30,19 +30,19 @@ FastAPI 🐕‍🦺 🔗 👈 <abbr title='sometimes also called "exit", "cleanu
 🕴 📟 ⏭ &amp; 🔌 `yield` 📄 🛠️ ⏭ 📨 📨:
 
 ```Python hl_lines="2-4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 🌾 💲 ⚫️❔ 💉 🔘 *➡ 🛠️* &amp; 🎏 🔗:
 
 ```Python hl_lines="4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 📟 📄 `yield` 📄 🛠️ ⏮️ 📨 ✔️ 🚚:
 
 ```Python hl_lines="5-6"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 /// tip
@@ -64,7 +64,7 @@ FastAPI 🐕‍🦺 🔗 👈 <abbr title='sometimes also called "exit", "cleanu
 🎏 🌌, 👆 💪 ⚙️ `finally` ⚒ 💭 🚪 📶 🛠️, 🙅‍♂ 🤔 🚥 📤 ⚠ ⚖️ 🚫.
 
 ```Python hl_lines="3  5"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 ## 🎧-🔗 ⏮️ `yield`
@@ -76,7 +76,7 @@ FastAPI 🐕‍🦺 🔗 👈 <abbr title='sometimes also called "exit", "cleanu
 🖼, `dependency_c` 💪 ✔️ 🔗 🔛 `dependency_b`, &amp; `dependency_b` 🔛 `dependency_a`:
 
 ```Python hl_lines="4  12  20"
-{!../../../docs_src/dependencies/tutorial008.py!}
+{!../../docs_src/dependencies/tutorial008.py!}
 ```
 
 &amp; 🌐 👫 💪 ⚙️ `yield`.
@@ -86,7 +86,7 @@ FastAPI 🐕‍🦺 🔗 👈 <abbr title='sometimes also called "exit", "cleanu
 &amp; , 🔄, `dependency_b` 💪 💲 ⚪️➡️ `dependency_a` (📥 📛 `dep_a`) 💪 🚮 🚪 📟.
 
 ```Python hl_lines="16-17  24-25"
-{!../../../docs_src/dependencies/tutorial008.py!}
+{!../../docs_src/dependencies/tutorial008.py!}
 ```
 
 🎏 🌌, 👆 💪 ✔️ 🔗 ⏮️ `yield` &amp; `return` 🌀.
@@ -225,7 +225,7 @@ with open("./somefile.txt") as f:
 `with` ⚖️ `async with` 📄 🔘 🔗 🔢:
 
 ```Python hl_lines="1-9  13"
-{!../../../docs_src/dependencies/tutorial010.py!}
+{!../../docs_src/dependencies/tutorial010.py!}
 ```
 
 /// tip
index 81759d0e831991a64be06bf2ae6b41f88778f6db..bb69e78a828a2e1ea4b1768f2c12158aeabb8a20 100644 (file)
@@ -7,7 +7,7 @@
 👈 💼, 👫 🔜 ✔ 🌐 *➡ 🛠️* 🈸:
 
 ```Python hl_lines="15"
-{!../../../docs_src/dependencies/tutorial012.py!}
+{!../../docs_src/dependencies/tutorial012.py!}
 ```
 
 &amp; 🌐 💭 📄 🔃 [❎ `dependencies` *➡ 🛠️ 👨‍🎨*](dependencies-in-path-operation-decorators.md){.internal-link target=_blank} ✔, ✋️ 👉 💼, 🌐 *➡ 🛠️* 📱.
index efb4ee672b55187c1fa55bcf44f97aa841f5379e..b029b85b72869cce2cbacf9043fe4bdbd08ed612 100644 (file)
@@ -34,7 +34,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -42,7 +42,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="6-7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -70,7 +70,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -78,7 +78,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -90,7 +90,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="15  20"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -98,7 +98,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
index 02b33ccd7c49e683d8bdddf9805c71a1fb8a13cc..a1e7be1340321cfe742f02bd6d2a5101fd4cb7e9 100644 (file)
@@ -13,7 +13,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
@@ -21,7 +21,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="6-7"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
@@ -37,7 +37,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
@@ -64,7 +64,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
@@ -72,7 +72,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
index 314f5b32479193d1276413c95d128c49da417a44..21419ef21f6ad890375d397de147fc0bf7500a80 100644 (file)
@@ -23,7 +23,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="5  22"
-{!> ../../../docs_src/encoder/tutorial001.py!}
+{!> ../../docs_src/encoder/tutorial001.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="4  21"
-{!> ../../../docs_src/encoder/tutorial001_py310.py!}
+{!> ../../docs_src/encoder/tutorial001_py310.py!}
 ```
 
 ////
index cbe111079918b28421ec649ff50123fd2cdc85e1..1d473bd9364d10738cda214789d80781c69708b9 100644 (file)
@@ -58,7 +58,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="1  3  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
@@ -66,7 +66,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="1  2  11-15"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
@@ -76,7 +76,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
index 4703c71234cb2d21f716d33c5e4f6235ff545089..4fdf196e8e750311dc5dde6cb6b45e96f70fda3e 100644 (file)
@@ -23,7 +23,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9  11  16  22  24  29-30  33-35  40-41"
-{!> ../../../docs_src/extra_models/tutorial001.py!}
+{!> ../../docs_src/extra_models/tutorial001.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7  9  14  20  22  27-28  31-33  38-39"
-{!> ../../../docs_src/extra_models/tutorial001_py310.py!}
+{!> ../../docs_src/extra_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ UserInDB(
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9  15-16  19-20  23-24"
-{!> ../../../docs_src/extra_models/tutorial002.py!}
+{!> ../../docs_src/extra_models/tutorial002.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ UserInDB(
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7  13-14  17-18  21-22"
-{!> ../../../docs_src/extra_models/tutorial002_py310.py!}
+{!> ../../docs_src/extra_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -201,7 +201,7 @@ UserInDB(
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="1  14-15  18-20  33"
-{!> ../../../docs_src/extra_models/tutorial003.py!}
+{!> ../../docs_src/extra_models/tutorial003.py!}
 ```
 
 ////
@@ -209,7 +209,7 @@ UserInDB(
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="1  14-15  18-20  33"
-{!> ../../../docs_src/extra_models/tutorial003_py310.py!}
+{!> ../../docs_src/extra_models/tutorial003_py310.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ some_variable: PlaneItem | CarItem
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="1  20"
-{!> ../../../docs_src/extra_models/tutorial004.py!}
+{!> ../../docs_src/extra_models/tutorial004.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ some_variable: PlaneItem | CarItem
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/extra_models/tutorial004_py39.py!}
+{!> ../../docs_src/extra_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -261,7 +261,7 @@ some_variable: PlaneItem | CarItem
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="1  8"
-{!> ../../../docs_src/extra_models/tutorial005.py!}
+{!> ../../docs_src/extra_models/tutorial005.py!}
 ```
 
 ////
@@ -269,7 +269,7 @@ some_variable: PlaneItem | CarItem
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/extra_models/tutorial005_py39.py!}
+{!> ../../docs_src/extra_models/tutorial005_py39.py!}
 ```
 
 ////
index 158189e6ee6b48a887ee9e96f157e4503d171d98..d8cc05c40593cb76633523c7752a0b12b3758dd5 100644 (file)
@@ -3,7 +3,7 @@
 🙅 FastAPI 📁 💪 👀 💖 👉:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 📁 👈 📁 `main.py`.
@@ -134,7 +134,7 @@ INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
 ### 🔁 1️⃣: 🗄 `FastAPI`
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI` 🐍 🎓 👈 🚚 🌐 🛠️ 👆 🛠️.
@@ -150,7 +150,7 @@ INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
 ### 🔁 2️⃣: ✍ `FastAPI` "👐"
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 📥 `app` 🔢 🔜 "👐" 🎓 `FastAPI`.
@@ -172,7 +172,7 @@ $ uvicorn main:app --reload
 🚥 👆 ✍ 👆 📱 💖:
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
 ```
 
 &amp; 🚮 ⚫️ 📁 `main.py`, ⤴️ 👆 🔜 🤙 `uvicorn` 💖:
@@ -251,7 +251,7 @@ https://example.com/items/foo
 #### 🔬 *➡ 🛠️ 👨‍🎨*
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `@app.get("/")` 💬 **FastAPI** 👈 🔢 ▶️️ 🔛 🈚 🚚 📨 👈 🚶:
@@ -307,7 +307,7 @@ https://example.com/items/foo
 * **🔢**: 🔢 🔛 "👨‍🎨" (🔛 `@app.get("/")`).
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 👉 🐍 🔢.
@@ -321,7 +321,7 @@ https://example.com/items/foo
 👆 💪 🔬 ⚫️ 😐 🔢 ↩️ `async def`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note
@@ -333,7 +333,7 @@ https://example.com/items/foo
 ### 🔁 5️⃣: 📨 🎚
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 👆 💪 📨 `dict`, `list`, ⭐ 💲 `str`, `int`, ♒️.
index ed32ab53a29e2459917696a53d0dbaec740c7fb9..7f6a704eb08568dd790e630437d62b00bc2c3f0d 100644 (file)
@@ -26,7 +26,7 @@
 ### 🗄 `HTTPException`
 
 ```Python hl_lines="1"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 ```
 
 ### 🤚 `HTTPException` 👆 📟
@@ -42,7 +42,7 @@
 👉 🖼, 🕐❔ 👩‍💻 📨 🏬 🆔 👈 🚫 🔀, 🤚 ⚠ ⏮️ 👔 📟 `404`:
 
 ```Python hl_lines="11"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 ```
 
 ### 📉 📨
@@ -82,7 +82,7 @@
 ✋️ 💼 👆 💪 ⚫️ 🏧 😐, 👆 💪 🚮 🛃 🎚:
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial002.py!}
+{!../../docs_src/handling_errors/tutorial002.py!}
 ```
 
 ## ❎ 🛃 ⚠ 🐕‍🦺
@@ -96,7 +96,7 @@
 👆 💪 🚮 🛃 ⚠ 🐕‍🦺 ⏮️ `@app.exception_handler()`:
 
 ```Python hl_lines="5-7  13-18  24"
-{!../../../docs_src/handling_errors/tutorial003.py!}
+{!../../docs_src/handling_errors/tutorial003.py!}
 ```
 
 📥, 🚥 👆 📨 `/unicorns/yolo`, *➡ 🛠️* 🔜 `raise` `UnicornException`.
 ⚠ 🐕‍🦺 🔜 📨 `Request` &amp; ⚠.
 
 ```Python hl_lines="2  14-16"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 ```
 
 🔜, 🚥 👆 🚶 `/items/foo`, ↩️ 💆‍♂ 🔢 🎻 ❌ ⏮️:
@@ -189,7 +189,7 @@ path -> item_id
 🖼, 👆 💪 💚 📨 ✅ ✍ 📨 ↩️ 🎻 👫 ❌:
 
 ```Python hl_lines="3-4  9-11  22"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 ```
 
 /// note | "📡 ℹ"
@@ -207,7 +207,7 @@ path -> item_id
 👆 💪 ⚙️ ⚫️ ⏪ 🛠️ 👆 📱 🕹 💪 &amp; ℹ ⚫️, 📨 ⚫️ 👩‍💻, ♒️.
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial005.py!}
+{!../../docs_src/handling_errors/tutorial005.py!}
 ```
 
 🔜 🔄 📨 ❌ 🏬 💖:
@@ -267,7 +267,7 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
 🚥 👆 💚 ⚙️ ⚠ ⤴️ ⏮️ 🎏 🔢 ⚠ 🐕‍🦺 ⚪️➡️ **FastAPI**, 👆 💪 🗄 &amp; 🏤-⚙️ 🔢 ⚠ 🐕‍🦺 ⚪️➡️ `fastapi.exception_handlers`:
 
 ```Python hl_lines="2-5  15  21"
-{!../../../docs_src/handling_errors/tutorial006.py!}
+{!../../docs_src/handling_errors/tutorial006.py!}
 ```
 
 👉 🖼 👆 `print`😅 ❌ ⏮️ 📶 🎨 📧, ✋️ 👆 🤚 💭. 👆 💪 ⚙️ ⚠ &amp; ⤴️ 🏤-⚙️ 🔢 ⚠ 🐕‍🦺.
index 82583c7c33a4bc7df128f9aa78229f06dc099e45..34abd3a4c0f1aff6f6de35d55b16a06ee1363bb0 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001.py!}
+{!> ../../docs_src/header_params/tutorial001.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/header_params/tutorial001_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001.py!}
+{!> ../../docs_src/header_params/tutorial001.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/header_params/tutorial001_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -77,7 +77,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial002.py!}
+{!> ../../docs_src/header_params/tutorial002.py!}
 ```
 
 ////
@@ -85,7 +85,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/header_params/tutorial002_py310.py!}
+{!> ../../docs_src/header_params/tutorial002_py310.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003.py!}
+{!> ../../docs_src/header_params/tutorial003.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_py39.py!}
+{!> ../../docs_src/header_params/tutorial003_py39.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/header_params/tutorial003_py310.py!}
+{!> ../../docs_src/header_params/tutorial003_py310.py!}
 ```
 
 ////
index 6caeed4cd0df7471201265578f50a58a2230d630..a30db113db153170a4f80985d584f332ff7ab45a 100644 (file)
@@ -18,7 +18,7 @@
 👆 💪 ⚒ 👫 ⏩:
 
 ```Python hl_lines="3-16  19-31"
-{!../../../docs_src/metadata/tutorial001.py!}
+{!../../docs_src/metadata/tutorial001.py!}
 ```
 
 /// tip
@@ -52,7 +52,7 @@
 ✍ 🗃 👆 🔖 &amp; 🚶‍♀️ ⚫️ `openapi_tags` 🔢:
 
 ```Python hl_lines="3-16  18"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
 ```
 
 👀 👈 👆 💪 ⚙️ ✍ 🔘 📛, 🖼 "💳" 🔜 🎦 🦁 (**💳**) &amp; "🎀" 🔜 🎦 ❕ (_🎀_).
@@ -68,7 +68,7 @@
 ⚙️ `tags` 🔢 ⏮️ 👆 *➡ 🛠️* (&amp; `APIRouter`Ⓜ) 🛠️ 👫 🎏 🔖:
 
 ```Python hl_lines="21  26"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
 ```
 
 /// info
@@ -98,7 +98,7 @@
 🖼, ⚒ ⚫️ 🍦 `/api/v1/openapi.json`:
 
 ```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial002.py!}
+{!../../docs_src/metadata/tutorial002.py!}
 ```
 
 🚥 👆 💚 ❎ 🗄 🔗 🍕 👆 💪 ⚒ `openapi_url=None`, 👈 🔜 ❎ 🧾 👩‍💻 🔢 👈 ⚙️ ⚫️.
 🖼, ⚒ 🦁 🎚 🍦 `/documentation` &amp; ❎ 📄:
 
 ```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial003.py!}
+{!../../docs_src/metadata/tutorial003.py!}
 ```
index b9bb12e00516b817b15c4145ae8fa9609d4ed521..cd0777ebbb09d3431be62c825f865f22a35fd631 100644 (file)
@@ -32,7 +32,7 @@
 * 👆 💪 ⤴️ 🔀 🌅 `response` ⏭ 🛬 ⚫️.
 
 ```Python hl_lines="8-9  11  14"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 /// tip
@@ -60,7 +60,7 @@
 🖼, 👆 💪 🚮 🛃 🎚 `X-Process-Time` ⚗ 🕰 🥈 👈 ⚫️ ✊ 🛠️ 📨 &amp; 🏗 📨:
 
 ```Python hl_lines="10  12-13"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 ## 🎏 🛠️
index 1979bed2b2a877bd08c82f908715e13830030646..9529928fbf12d7430a5a87e67179472dfb4e4a0d 100644 (file)
@@ -19,7 +19,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="3  17"
-{!> ../../../docs_src/path_operation_configuration/tutorial001.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="3  17"
-{!> ../../../docs_src/path_operation_configuration/tutorial001_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001_py39.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="1  15"
-{!> ../../../docs_src/path_operation_configuration/tutorial001_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001_py310.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="17  22  27"
-{!> ../../../docs_src/path_operation_configuration/tutorial002.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002.py!}
 ```
 
 ////
@@ -65,7 +65,7 @@
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="17  22  27"
-{!> ../../../docs_src/path_operation_configuration/tutorial002_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002_py39.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="15  20  25"
-{!> ../../../docs_src/path_operation_configuration/tutorial002_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002_py310.py!}
 ```
 
 ////
@@ -91,7 +91,7 @@
 **FastAPI** 🐕‍🦺 👈 🎏 🌌 ⏮️ ✅ 🎻:
 
 ```Python hl_lines="1  8-10  13  18"
-{!../../../docs_src/path_operation_configuration/tutorial002b.py!}
+{!../../docs_src/path_operation_configuration/tutorial002b.py!}
 ```
 
 ## 📄 &amp; 📛
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="20-21"
-{!> ../../../docs_src/path_operation_configuration/tutorial003.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="20-21"
-{!> ../../../docs_src/path_operation_configuration/tutorial003_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003_py39.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/path_operation_configuration/tutorial003_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003_py310.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="19-27"
-{!> ../../../docs_src/path_operation_configuration/tutorial004.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="19-27"
-{!> ../../../docs_src/path_operation_configuration/tutorial004_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004_py39.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="17-25"
-{!> ../../../docs_src/path_operation_configuration/tutorial004_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004_py310.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/path_operation_configuration/tutorial005.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/path_operation_configuration/tutorial005_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005_py39.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/path_operation_configuration/tutorial005_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005_py310.py!}
 ```
 
 ////
 🚥 👆 💪 ™ *➡ 🛠️* <abbr title="obsolete, recommended not to use it">😢</abbr>, ✋️ 🍵 ❎ ⚫️, 🚶‍♀️ 🔢 `deprecated`:
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_operation_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_configuration/tutorial006.py!}
 ```
 
 ⚫️ 🔜 🎯 ™ 😢 🎓 🩺:
index a7952984cda736dcbc84ea8a8358c60ed5a1595f..c25f0323e96c9de4f186f4dda01478ef2b100c79 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@
 , 👆 💪 📣 👆 🔢:
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial002.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial002.py!}
 ```
 
 ## ✔ 🔢 👆 💪, 🎱
@@ -83,7 +83,7 @@
 🐍 🏆 🚫 🕳 ⏮️ 👈 `*`, ✋️ ⚫️ 🔜 💭 👈 🌐 📄 🔢 🔜 🤙 🇨🇻 ❌ (🔑-💲 👫), 💭 <abbr title="From: K-ey W-ord Arg-uments"><code>kwargs</code></abbr>. 🚥 👫 🚫 ✔️ 🔢 💲.
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
 ```
 
 ## 🔢 🔬: 👑 🌘 ⚖️ 🌓
@@ -93,7 +93,7 @@
 📥, ⏮️ `ge=1`, `item_id` 🔜 💪 🔢 🔢 "`g`🅾 🌘 ⚖️ `e`🅾" `1`.
 
 ```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial004.py!}
 ```
 
 ## 🔢 🔬: 🌘 🌘 &amp; 🌘 🌘 ⚖️ 🌓
 * `le`: `l`👭 🌘 ⚖️ `e`🅾
 
 ```Python hl_lines="9"
-{!../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial005.py!}
 ```
 
 ## 🔢 🔬: 🎈, 🌘 🌘 &amp; 🌘 🌘
 &amp; 🎏 <abbr title="less than"><code>lt</code></abbr>.
 
 ```Python hl_lines="11"
-{!../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial006.py!}
 ```
 
 ## 🌃
index e0d51a1df9f032d12802b8772702011cb14fc4f8..daf5417ebd8d6e8117962a9f5b3cccf890132c59 100644 (file)
@@ -3,7 +3,7 @@
 👆 💪 📣 ➡ "🔢" ⚖️ "🔢" ⏮️ 🎏 ❕ ⚙️ 🐍 📁 🎻:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
 ```
 
 💲 ➡ 🔢 `item_id` 🔜 🚶‍♀️ 👆 🔢 ❌ `item_id`.
@@ -19,7 +19,7 @@
 👆 💪 📣 🆎 ➡ 🔢 🔢, ⚙️ 🐩 🐍 🆎 ✍:
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
 ```
 
 👉 💼, `item_id` 📣 `int`.
 ↩️ *➡ 🛠️* 🔬 ✔, 👆 💪 ⚒ 💭 👈 ➡ `/users/me` 📣 ⏭ 1️⃣ `/users/{user_id}`:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
 ```
 
 ⏪, ➡ `/users/{user_id}` 🔜 🏏 `/users/me`, "💭" 👈 ⚫️ 📨 🔢 `user_id` ⏮️ 💲 `"me"`.
 ➡, 👆 🚫🔜 ↔ ➡ 🛠️:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003b.py!}
+{!../../docs_src/path_params/tutorial003b.py!}
 ```
 
 🥇 🕐 🔜 🕧 ⚙️ ↩️ ➡ 🏏 🥇.
 ⤴️ ✍ 🎓 🔢 ⏮️ 🔧 💲, ❔ 🔜 💪 ☑ 💲:
 
 ```Python hl_lines="1  6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// info
 ⤴️ ✍ *➡ 🔢* ⏮️ 🆎 ✍ ⚙️ 🔢 🎓 👆 ✍ (`ModelName`):
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 ### ✅ 🩺
 👆 💪 🔬 ⚫️ ⏮️ *🔢 👨‍🎓* 👆 ✍ 🔢 `ModelName`:
 
 ```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 #### 🤚 *🔢 💲*
 👆 💪 🤚 ☑ 💲 ( `str` 👉 💼) ⚙️ `model_name.value`, ⚖️ 🏢, `your_enum_member.value`:
 
 ```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// tip
 👫 🔜 🗜 👫 🔗 💲 (🎻 👉 💼) ⏭ 🛬 👫 👩‍💻:
 
 ```Python hl_lines="18  21  23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 👆 👩‍💻 👆 🔜 🤚 🎻 📨 💖:
 , 👆 💪 ⚙️ ⚫️ ⏮️:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
 ```
 
 /// tip
index 23873155ed3bb883e57ee5369deba96ef19cefc8..f75c0a26fa65b94eea066e11d8f68a76f208d14f 100644 (file)
@@ -7,7 +7,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001.py!}
 ```
 
 ////
@@ -15,7 +15,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial001_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -41,7 +41,7 @@ FastAPI 🔜 💭 👈 💲 `q` 🚫 ✔ ↩️ 🔢 💲 `= None`.
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 ////
@@ -49,7 +49,7 @@ FastAPI 🔜 💭 👈 💲 `q` 🚫 ✔ ↩️ 🔢 💲 `= None`.
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_py310.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ FastAPI 🔜 💭 👈 💲 `q` 🚫 ✔ ↩️ 🔢 💲 `= None`.
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 ////
@@ -69,7 +69,7 @@ FastAPI 🔜 💭 👈 💲 `q` 🚫 ✔ ↩️ 🔢 💲 `= None`.
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_py310.py!}
 ```
 
 ////
@@ -137,7 +137,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003.py!}
 ```
 
 ////
@@ -145,7 +145,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_py310.py!}
 ```
 
 ////
@@ -157,7 +157,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004.py!}
 ```
 
 ////
@@ -165,7 +165,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_py310.py!}
 ```
 
 ////
@@ -187,7 +187,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
 ➡️ 💬 👈 👆 💚 📣 `q` 🔢 🔢 ✔️ `min_length` `3`, &amp; ✔️ 🔢 💲 `"fixedquery"`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!../../docs_src/query_params_str_validations/tutorial005.py!}
 ```
 
 /// note
@@ -219,7 +219,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 , 🕐❔ 👆 💪 📣 💲 ✔ ⏪ ⚙️ `Query`, 👆 💪 🎯 🚫 📣 🔢 💲:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!../../docs_src/query_params_str_validations/tutorial006.py!}
 ```
 
 ### ✔ ⏮️ ❕ (`...`)
@@ -227,7 +227,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 📤 🎛 🌌 🎯 📣 👈 💲 ✔. 👆 💪 ⚒ `default` 🔢 🔑 💲 `...`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006b.py!}
+{!../../docs_src/query_params_str_validations/tutorial006b.py!}
 ```
 
 /// info
@@ -249,7 +249,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c.py!}
 ```
 
 ////
@@ -257,7 +257,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ Pydantic, ❔ ⚫️❔ 🏋️ 🌐 💽 🔬 &amp; 🛠️ FastAPI, ✔️ 
 🚥 👆 💭 😬 ⚙️ `...`, 👆 💪 🗄 &amp; ⚙️ `Required` ⚪️➡️ Pydantic:
 
 ```Python hl_lines="2  8"
-{!../../../docs_src/query_params_str_validations/tutorial006d.py!}
+{!../../docs_src/query_params_str_validations/tutorial006d.py!}
 ```
 
 /// tip
@@ -291,7 +291,7 @@ Pydantic, ❔ ⚫️❔ 🏋️ 🌐 💽 🔬 &amp; 🛠️ FastAPI, ✔️ 
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011.py!}
 ```
 
 ////
@@ -299,7 +299,7 @@ Pydantic, ❔ ⚫️❔ 🏋️ 🌐 💽 🔬 &amp; 🛠️ FastAPI, ✔️ 
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py39.py!}
 ```
 
 ////
@@ -307,7 +307,7 @@ Pydantic, ❔ ⚫️❔ 🏋️ 🌐 💽 🔬 &amp; 🛠️ FastAPI, ✔️ 
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py310.py!}
 ```
 
 ////
@@ -348,7 +348,7 @@ http://localhost:8000/items/?q=foo&q=bar
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012.py!}
 ```
 
 ////
@@ -356,7 +356,7 @@ http://localhost:8000/items/?q=foo&q=bar
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_py39.py!}
 ```
 
 ////
@@ -383,7 +383,7 @@ http://localhost:8000/items/
 👆 💪 ⚙️ `list` 🔗 ↩️ `List[str]` (⚖️ `list[str]` 🐍 3️⃣.9️⃣ ➕):
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!../../docs_src/query_params_str_validations/tutorial013.py!}
 ```
 
 /// note
@@ -413,7 +413,7 @@ http://localhost:8000/items/
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007.py!}
 ```
 
 ////
@@ -421,7 +421,7 @@ http://localhost:8000/items/
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_py310.py!}
 ```
 
 ////
@@ -431,7 +431,7 @@ http://localhost:8000/items/
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008.py!}
 ```
 
 ////
@@ -439,7 +439,7 @@ http://localhost:8000/items/
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_py310.py!}
 ```
 
 ////
@@ -465,7 +465,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009.py!}
 ```
 
 ////
@@ -473,7 +473,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_py310.py!}
 ```
 
 ////
@@ -489,7 +489,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010.py!}
 ```
 
 ////
@@ -497,7 +497,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_py310.py!}
 ```
 
 ////
@@ -513,7 +513,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014.py!}
 ```
 
 ////
@@ -521,7 +521,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_py310.py!}
 ```
 
 ////
index 9bdab9e3c1f63af46394b9da928cf245a52226bd..c8432f182fac2509ad528a20607b26093aa448db 100644 (file)
@@ -3,7 +3,7 @@
 🕐❔ 👆 📣 🎏 🔢 🔢 👈 🚫 🍕 ➡ 🔢, 👫 🔁 🔬 "🔢" 🔢.
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
 ```
 
 🔢 ⚒ 🔑-💲 👫 👈 🚶 ⏮️ `?` 📛, 🎏 `&` 🦹.
@@ -66,7 +66,7 @@ http://127.0.0.1:8000/items/?skip=20
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial002.py!}
+{!> ../../docs_src/query_params/tutorial002.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@ http://127.0.0.1:8000/items/?skip=20
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial002_py310.py!}
+{!> ../../docs_src/query_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -94,7 +94,7 @@ http://127.0.0.1:8000/items/?skip=20
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial003.py!}
+{!> ../../docs_src/query_params/tutorial003.py!}
 ```
 
 ////
@@ -102,7 +102,7 @@ http://127.0.0.1:8000/items/?skip=20
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial003_py310.py!}
+{!> ../../docs_src/query_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -151,7 +151,7 @@ http://127.0.0.1:8000/items/foo?short=yes
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="8  10"
-{!> ../../../docs_src/query_params/tutorial004.py!}
+{!> ../../docs_src/query_params/tutorial004.py!}
 ```
 
 ////
@@ -159,7 +159,7 @@ http://127.0.0.1:8000/items/foo?short=yes
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="6  8"
-{!> ../../../docs_src/query_params/tutorial004_py310.py!}
+{!> ../../docs_src/query_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -173,7 +173,7 @@ http://127.0.0.1:8000/items/foo?short=yes
 ✋️ 🕐❔ 👆 💚 ⚒ 🔢 🔢 ✔, 👆 💪 🚫 📣 🙆 🔢 💲:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
 ```
 
 📥 🔢 🔢 `needy` ✔ 🔢 🔢 🆎 `str`.
@@ -221,7 +221,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params/tutorial006.py!}
+{!> ../../docs_src/query_params/tutorial006.py!}
 ```
 
 ////
@@ -229,7 +229,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params/tutorial006_py310.py!}
+{!> ../../docs_src/query_params/tutorial006_py310.py!}
 ```
 
 ////
index 010aa76bf389a79eb1483dbde048ad29d24036d5..102690f4bd46eaad949a9ab96d6e040b219def7b 100644 (file)
@@ -17,7 +17,7 @@
 🗄 `File` &amp; `UploadFile` ⚪️➡️ `fastapi`:
 
 ```Python hl_lines="1"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
 ```
 
 ## 🔬 `File` 🔢
@@ -25,7 +25,7 @@
 ✍ 📁 🔢 🎏 🌌 👆 🔜 `Body` ⚖️ `Form`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
 ```
 
 /// info
@@ -55,7 +55,7 @@
 🔬 📁 🔢 ⏮️ 🆎 `UploadFile`:
 
 ```Python hl_lines="12"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
 ```
 
 ⚙️ `UploadFile` ✔️ 📚 📈 🤭 `bytes`:
@@ -142,7 +142,7 @@ contents = myfile.file.read()
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02.py!}
+{!> ../../docs_src/request_files/tutorial001_02.py!}
 ```
 
 ////
@@ -150,7 +150,7 @@ contents = myfile.file.read()
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7  14"
-{!> ../../../docs_src/request_files/tutorial001_02_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_py310.py!}
 ```
 
 ////
@@ -160,7 +160,7 @@ contents = myfile.file.read()
 👆 💪 ⚙️ `File()` ⏮️ `UploadFile`, 🖼, ⚒ 🌖 🗃:
 
 ```Python hl_lines="13"
-{!../../../docs_src/request_files/tutorial001_03.py!}
+{!../../docs_src/request_files/tutorial001_03.py!}
 ```
 
 ## 💗 📁 📂
@@ -174,7 +174,7 @@ contents = myfile.file.read()
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/request_files/tutorial002.py!}
+{!> ../../docs_src/request_files/tutorial002.py!}
 ```
 
 ////
@@ -182,7 +182,7 @@ contents = myfile.file.read()
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/request_files/tutorial002_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_py39.py!}
 ```
 
 ////
@@ -204,7 +204,7 @@ contents = myfile.file.read()
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/request_files/tutorial003.py!}
+{!> ../../docs_src/request_files/tutorial003.py!}
 ```
 
 ////
@@ -212,7 +212,7 @@ contents = myfile.file.read()
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/request_files/tutorial003_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_py39.py!}
 ```
 
 ////
index ab39d1b9499f046e5c5630fb0c7ee5f825187838..80793dae408bedfbeb16f3c63c990b6744037f6b 100644 (file)
@@ -13,7 +13,7 @@
 ## 🗄 `File` &amp; `Form`
 
 ```Python hl_lines="1"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 ## 🔬 `File` &amp; `Form` 🔢
@@ -21,7 +21,7 @@
 ✍ 📁 &amp; 📨 🔢 🎏 🌌 👆 🔜 `Body` ⚖️ `Query`:
 
 ```Python hl_lines="8"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 📁 &amp; 📨 🏑 🔜 📂 📨 📊 &amp; 👆 🔜 📨 📁 &amp; 📨 🏑.
index 74117c47d390136f5e1b6346f3075c896a7d393c..cbe4e2862dad91ebb848c3230de5f34ab313dd7e 100644 (file)
@@ -15,7 +15,7 @@
 🗄 `Form` ⚪️➡️ `fastapi`:
 
 ```Python hl_lines="1"
-{!../../../docs_src/request_forms/tutorial001.py!}
+{!../../docs_src/request_forms/tutorial001.py!}
 ```
 
 ## 🔬 `Form` 🔢
@@ -23,7 +23,7 @@
 ✍ 📨 🔢 🎏 🌌 👆 🔜 `Body` ⚖️ `Query`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/request_forms/tutorial001.py!}
+{!../../docs_src/request_forms/tutorial001.py!}
 ```
 
 🖼, 1️⃣ 🌌 Oauth2️⃣ 🔧 💪 ⚙️ (🤙 "🔐 💧") ⚫️ ✔ 📨 `username` &amp; `password` 📨 🏑.
index 9483508aa1ea45f66f2b5474efed8cee898b3e03..fb5c17dd656840035eb2f725ad534a41292ddd9a 100644 (file)
@@ -7,7 +7,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="18  23"
-{!> ../../../docs_src/response_model/tutorial001_01.py!}
+{!> ../../docs_src/response_model/tutorial001_01.py!}
 ```
 
 ////
@@ -15,7 +15,7 @@
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="18  23"
-{!> ../../../docs_src/response_model/tutorial001_01_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py39.py!}
 ```
 
 ////
@@ -23,7 +23,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="16  21"
-{!> ../../../docs_src/response_model/tutorial001_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py310.py!}
 ```
 
 ////
@@ -62,7 +62,7 @@ FastAPI 🔜 ⚙️ 👉 📨 🆎:
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001.py!}
+{!> ../../docs_src/response_model/tutorial001.py!}
 ```
 
 ////
@@ -70,7 +70,7 @@ FastAPI 🔜 ⚙️ 👉 📨 🆎:
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_py39.py!}
 ```
 
 ////
@@ -78,7 +78,7 @@ FastAPI 🔜 ⚙️ 👉 📨 🆎:
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_py310.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. &amp; **
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9  11"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
 ```
 
 ////
@@ -124,7 +124,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. &amp; **
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7  9"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
 ```
 
 ////
@@ -143,7 +143,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. &amp; **
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
 ```
 
 ////
@@ -151,7 +151,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. &amp; **
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
 ```
 
 ////
@@ -175,7 +175,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. &amp; **
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9  11  16"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -183,7 +183,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. &amp; **
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="9  11  16"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -193,7 +193,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. &amp; **
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -201,7 +201,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. &amp; **
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -211,7 +211,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. &amp; **
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -219,7 +219,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. &amp; **
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -249,7 +249,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. &amp; **
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9-13  15-16  20"
-{!> ../../../docs_src/response_model/tutorial003_01.py!}
+{!> ../../docs_src/response_model/tutorial003_01.py!}
 ```
 
 ////
@@ -257,7 +257,7 @@ FastAPI 🔜 ⚙️ 👉 `response_model` 🌐 💽 🧾, 🔬, ♒️. &amp; **
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7-10  13-14  18"
-{!> ../../../docs_src/response_model/tutorial003_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_01_py310.py!}
 ```
 
 ////
@@ -303,7 +303,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓 
 🏆 ⚠ 💼 🔜 [🛬 📨 🔗 🔬 ⏪ 🏧 🩺](../advanced/response-directly.md){.internal-link target=_blank}.
 
 ```Python hl_lines="8  10-11"
-{!> ../../../docs_src/response_model/tutorial003_02.py!}
+{!> ../../docs_src/response_model/tutorial003_02.py!}
 ```
 
 👉 🙅 💼 🍵 🔁 FastAPI ↩️ 📨 🆎 ✍ 🎓 (⚖️ 🏿) `Response`.
@@ -315,7 +315,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓 
 👆 💪 ⚙️ 🏿 `Response` 🆎 ✍:
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/response_model/tutorial003_03.py!}
+{!> ../../docs_src/response_model/tutorial003_03.py!}
 ```
 
 👉 🔜 👷 ↩️ `RedirectResponse` 🏿 `Response`, &amp; FastAPI 🔜 🔁 🍵 👉 🙅 💼.
@@ -329,7 +329,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓 
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/response_model/tutorial003_04.py!}
+{!> ../../docs_src/response_model/tutorial003_04.py!}
 ```
 
 ////
@@ -337,7 +337,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓 
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/response_model/tutorial003_04_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_04_py310.py!}
 ```
 
 ////
@@ -355,7 +355,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓 
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/response_model/tutorial003_05.py!}
+{!> ../../docs_src/response_model/tutorial003_05.py!}
 ```
 
 ////
@@ -363,7 +363,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓 
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/response_model/tutorial003_05_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_05_py310.py!}
 ```
 
 ////
@@ -377,7 +377,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓 
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="11  13-14"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
 ```
 
 ////
@@ -385,7 +385,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓 
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="11  13-14"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
 ```
 
 ////
@@ -393,7 +393,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓 
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="9  11-12"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
 ```
 
 ////
@@ -413,7 +413,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓 
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
 ```
 
 ////
@@ -421,7 +421,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓 
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
 ```
 
 ////
@@ -429,7 +429,7 @@ FastAPI 🔨 📚 👜 🔘 ⏮️ Pydantic ⚒ 💭 👈 📚 🎏 🚫 🎓 
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
 ```
 
 ////
@@ -524,7 +524,7 @@ FastAPI 🙃 🥃 (🤙, Pydantic 🙃 🥃) 🤔 👈, ✋️ `description`, `t
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="31  37"
-{!> ../../../docs_src/response_model/tutorial005.py!}
+{!> ../../docs_src/response_model/tutorial005.py!}
 ```
 
 ////
@@ -532,7 +532,7 @@ FastAPI 🙃 🥃 (🤙, Pydantic 🙃 🥃) 🤔 👈, ✋️ `description`, `t
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="29  35"
-{!> ../../../docs_src/response_model/tutorial005_py310.py!}
+{!> ../../docs_src/response_model/tutorial005_py310.py!}
 ```
 
 ////
@@ -552,7 +552,7 @@ FastAPI 🙃 🥃 (🤙, Pydantic 🙃 🥃) 🤔 👈, ✋️ `description`, `t
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="31  37"
-{!> ../../../docs_src/response_model/tutorial006.py!}
+{!> ../../docs_src/response_model/tutorial006.py!}
 ```
 
 ////
@@ -560,7 +560,7 @@ FastAPI 🙃 🥃 (🤙, Pydantic 🙃 🥃) 🤔 👈, ✋️ `description`, `t
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="29  35"
-{!> ../../../docs_src/response_model/tutorial006_py310.py!}
+{!> ../../docs_src/response_model/tutorial006_py310.py!}
 ```
 
 ////
index 57c44777a3a645c56608a80df14d60f8731281b7..cefff708f331e9bac16405a4232d9dc1b7830274 100644 (file)
@@ -9,7 +9,7 @@
 * ♒️.
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 /// note
@@ -77,7 +77,7 @@ FastAPI 💭 👉, &amp; 🔜 🏭 🗄 🩺 👈 🇵🇸 📤 🙅‍♂ 📨
 ➡️ 👀 ⏮️ 🖼 🔄:
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 `201` 👔 📟 "✍".
@@ -87,7 +87,7 @@ FastAPI 💭 👉, &amp; 🔜 🏭 🗄 🩺 👈 🇵🇸 📤 🙅‍♂ 📨
 👆 💪 ⚙️ 🏪 🔢 ⚪️➡️ `fastapi.status`.
 
 ```Python hl_lines="1  6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
 ```
 
 👫 🏪, 👫 🧑‍🤝‍🧑 🎏 🔢, ✋️ 👈 🌌 👆 💪 ⚙️ 👨‍🎨 📋 🔎 👫:
index 8562de09cfdcc81d0fe70bc08016bc4fc12cf209..e4f877a8e65f5b317be38ba2945806f4fd78ef4a 100644 (file)
@@ -11,7 +11,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="15-23"
-{!> ../../../docs_src/schema_extra_example/tutorial001.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="13-21"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="4  10-13"
-{!> ../../../docs_src/schema_extra_example/tutorial002.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002.py!}
 ```
 
 ////
@@ -51,7 +51,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="2  8-11"
-{!> ../../../docs_src/schema_extra_example/tutorial002_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002_py310.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="20-25"
-{!> ../../../docs_src/schema_extra_example/tutorial003.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003.py!}
 ```
 
 ////
@@ -91,7 +91,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="18-23"
-{!> ../../../docs_src/schema_extra_example/tutorial003_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_py310.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="21-47"
-{!> ../../../docs_src/schema_extra_example/tutorial004.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="19-45"
-{!> ../../../docs_src/schema_extra_example/tutorial004_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_py310.py!}
 ```
 
 ////
index 538ea7b0a6ec3497c8df8ae25fb9e27ba8651166..6245f52ab66fdbd912a2342c1120364181448865 100644 (file)
@@ -21,7 +21,7 @@
 📁 🖼 📁 `main.py`:
 
 ```Python
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 ## 🏃 ⚫️
@@ -129,7 +129,7 @@ Oauth2️⃣ 🔧 👈 👩‍💻 ⚖️ 🛠️ 💪 🔬 💽 👈 🔓 👩
 🕐❔ 👥 ✍ 👐 `OAuth2PasswordBearer` 🎓 👥 🚶‍♀️ `tokenUrl` 🔢. 👉 🔢 🔌 📛 👈 👩‍💻 (🕸 🏃 👩‍💻 🖥) 🔜 ⚙️ 📨 `username` &amp; `password` ✔ 🤚 🤝.
 
 ```Python hl_lines="6"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 /// tip
@@ -169,7 +169,7 @@ oauth2_scheme(some, parameters)
 🔜 👆 💪 🚶‍♀️ 👈 `oauth2_scheme` 🔗 ⏮️ `Depends`.
 
 ```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 👉 🔗 🔜 🚚 `str` 👈 🛠️ 🔢 `token` *➡ 🛠️ 🔢*.
index 15545f42780dce4f5376867524dd67db64923c25..4e5b4ebfc708a4ac284050b5910dc0741e4a9e3d 100644 (file)
@@ -3,7 +3,7 @@
 ⏮️ 📃 💂‍♂ ⚙️ (❔ 🧢 🔛 🔗 💉 ⚙️) 🤝 *➡ 🛠️ 🔢* `token` `str`:
 
 ```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 ✋️ 👈 🚫 👈 ⚠.
@@ -19,7 +19,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="5  12-16"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="3  10-14"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -65,7 +65,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="19-22  26-27"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="17-20  24-25"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -85,7 +85,7 @@
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="29"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="28-30"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
index 3ab8cc98671456615f05f8b03b63d50f17148d76..95fa58f718358182b464f6153263174b87636385 100644 (file)
@@ -121,7 +121,7 @@ $ pip install "passlib[bcrypt]"
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="7  48  55-56  59-60  69-75"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
@@ -129,7 +129,7 @@ $ pip install "passlib[bcrypt]"
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="6  47  54-55  58-59  68-74"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ $ openssl rand -hex 32
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="6  12-14  28-30  78-86"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ $ openssl rand -hex 32
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="5  11-13  27-29  77-85"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -195,7 +195,7 @@ $ openssl rand -hex 32
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="89-106"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
@@ -203,7 +203,7 @@ $ openssl rand -hex 32
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="88-105"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -217,7 +217,7 @@ $ openssl rand -hex 32
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="115-130"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
@@ -225,7 +225,7 @@ $ openssl rand -hex 32
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="114-129"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
index 937546be887e4875816fd0e811e786e50bcb5433..43d928ce79c3901b7cd534a013d9fa86820926b1 100644 (file)
@@ -55,7 +55,7 @@ Oauth2️⃣ 👫 🎻.
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="4  76"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -63,7 +63,7 @@ Oauth2️⃣ 👫 🎻.
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="2  74"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Oauth2️⃣ 🔌 🤙 *🚚* 🏑 `grant_type` ⏮️ 🔧 💲 `password`, ✋
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="3  77-79"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -125,7 +125,7 @@ Oauth2️⃣ 🔌 🤙 *🚚* 🏑 `grant_type` ⏮️ 🔧 💲 `password`, ✋
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="1  75-77"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -157,7 +157,7 @@ Oauth2️⃣ 🔌 🤙 *🚚* 🏑 `grant_type` ⏮️ 🔧 💲 `password`, ✋
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="80-83"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -165,7 +165,7 @@ Oauth2️⃣ 🔌 🤙 *🚚* 🏑 `grant_type` ⏮️ 🔧 💲 `password`, ✋
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="78-81"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -213,7 +213,7 @@ UserInDB(
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="85"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -221,7 +221,7 @@ UserInDB(
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="83"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -253,7 +253,7 @@ UserInDB(
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="58-66  69-72  90"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -261,7 +261,7 @@ UserInDB(
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="55-64  67-70  88"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
index 2492c87087d4a505cefb747994906e7f6b077a5a..c59d8c13145fb1fc76a40033e2d5738429d82de7 100644 (file)
@@ -110,13 +110,13 @@ $ pip install sqlalchemy
 ### 🗄 🇸🇲 🍕
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 ### ✍ 💽 📛 🇸🇲
 
 ```Python hl_lines="5-6"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 👉 🖼, 👥 "🔗" 🗄 💽 (📂 📁 ⏮️ 🗄 💽).
@@ -146,7 +146,7 @@ SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db"
 👥 🔜 ⏪ ⚙️ 👉 `engine` 🎏 🥉.
 
 ```Python hl_lines="8-10"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 #### 🗒
@@ -184,7 +184,7 @@ connect_args={"check_same_thread": False}
 ✍ `SessionLocal` 🎓, ⚙️ 🔢 `sessionmaker`:
 
 ```Python hl_lines="11"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 ### ✍ `Base` 🎓
@@ -194,7 +194,7 @@ connect_args={"check_same_thread": False}
 ⏪ 👥 🔜 😖 ⚪️➡️ 👉 🎓 ✍ 🔠 💽 🏷 ⚖️ 🎓 (🐜 🏷):
 
 ```Python hl_lines="13"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 ## ✍ 💽 🏷
@@ -220,7 +220,7 @@ connect_args={"check_same_thread": False}
 👫 🎓 🇸🇲 🏷.
 
 ```Python hl_lines="4  7-8  18-19"
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
 ```
 
 `__tablename__` 🔢 💬 🇸🇲 📛 🏓 ⚙️ 💽 🔠 👫 🏷.
@@ -236,7 +236,7 @@ connect_args={"check_same_thread": False}
 &amp; 👥 🚶‍♀️ 🇸🇲 🎓 "🆎", `Integer`, `String`, &amp; `Boolean`, 👈 🔬 🆎 💽, ❌.
 
 ```Python hl_lines="1  10-13  21-24"
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
 ```
 
 ### ✍ 💛
@@ -248,7 +248,7 @@ connect_args={"check_same_thread": False}
 👉 🔜 ▶️️, 🌅 ⚖️ 🌘, "🎱" 🔢 👈 🔜 🔌 💲 ⚪️➡️ 🎏 🏓 🔗 👉 1️⃣.
 
 ```Python hl_lines="2  15  26"
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
 ```
 
 🕐❔ 🔐 🔢 `items` `User`, `my_user.items`, ⚫️ 🔜 ✔️ 📇 `Item` 🇸🇲 🏷 (⚪️➡️ `items` 🏓) 👈 ✔️ 💱 🔑 ☝ 👉 ⏺ `users` 🏓.
@@ -284,7 +284,7 @@ connect_args={"check_same_thread": False}
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="3  6-8  11-12  23-24  27-28"
-{!> ../../../docs_src/sql_databases/sql_app/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app/schemas.py!}
 ```
 
 ////
@@ -292,7 +292,7 @@ connect_args={"check_same_thread": False}
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="3  6-8  11-12  23-24  27-28"
-{!> ../../../docs_src/sql_databases/sql_app_py39/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/schemas.py!}
 ```
 
 ////
@@ -300,7 +300,7 @@ connect_args={"check_same_thread": False}
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="1  4-6  9-10  21-22  25-26"
-{!> ../../../docs_src/sql_databases/sql_app_py310/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py310/schemas.py!}
 ```
 
 ////
@@ -334,7 +334,7 @@ name: str
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="15-17  31-34"
-{!> ../../../docs_src/sql_databases/sql_app/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app/schemas.py!}
 ```
 
 ////
@@ -342,7 +342,7 @@ name: str
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="15-17  31-34"
-{!> ../../../docs_src/sql_databases/sql_app_py39/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/schemas.py!}
 ```
 
 ////
@@ -350,7 +350,7 @@ name: str
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="13-15  29-32"
-{!> ../../../docs_src/sql_databases/sql_app_py310/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py310/schemas.py!}
 ```
 
 ////
@@ -372,7 +372,7 @@ name: str
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="15  19-20  31  36-37"
-{!> ../../../docs_src/sql_databases/sql_app/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app/schemas.py!}
 ```
 
 ////
@@ -380,7 +380,7 @@ name: str
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="15  19-20  31  36-37"
-{!> ../../../docs_src/sql_databases/sql_app_py39/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/schemas.py!}
 ```
 
 ////
@@ -388,7 +388,7 @@ name: str
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python hl_lines="13  17-18  29  34-35"
-{!> ../../../docs_src/sql_databases/sql_app_py310/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py310/schemas.py!}
 ```
 
 ////
@@ -466,7 +466,7 @@ current_user.items
 * ✍ 💗 🏬.
 
 ```Python hl_lines="1  3  6-7  10-11  14-15  27-28"
-{!../../../docs_src/sql_databases/sql_app/crud.py!}
+{!../../docs_src/sql_databases/sql_app/crud.py!}
 ```
 
 /// tip
@@ -487,7 +487,7 @@ current_user.items
 * `refresh` 👆 👐 (👈 ⚫️ 🔌 🙆 🆕 📊 ⚪️➡️ 💽, 💖 🏗 🆔).
 
 ```Python hl_lines="18-24  31-36"
-{!../../../docs_src/sql_databases/sql_app/crud.py!}
+{!../../docs_src/sql_databases/sql_app/crud.py!}
 ```
 
 /// tip
@@ -539,7 +539,7 @@ current_user.items
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
 ```
 
 ////
@@ -547,7 +547,7 @@ current_user.items
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
 ```
 
 ////
@@ -577,7 +577,7 @@ current_user.items
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="15-20"
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
 ```
 
 ////
@@ -585,7 +585,7 @@ current_user.items
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="13-18"
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
 ```
 
 ////
@@ -609,7 +609,7 @@ current_user.items
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="24  32  38  47  53"
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
 ```
 
 ////
@@ -617,7 +617,7 @@ current_user.items
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="22  30  36  45  51"
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
 ```
 
 ////
@@ -637,7 +637,7 @@ current_user.items
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="23-28  31-34  37-42  45-49  52-55"
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
 ```
 
 ////
@@ -645,7 +645,7 @@ current_user.items
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="21-26  29-32  35-40  43-47  50-53"
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
 ```
 
 ////
@@ -732,13 +732,13 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 * `sql_app/database.py`:
 
 ```Python
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 * `sql_app/models.py`:
 
 ```Python
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
 ```
 
 * `sql_app/schemas.py`:
@@ -746,7 +746,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python
-{!> ../../../docs_src/sql_databases/sql_app/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app/schemas.py!}
 ```
 
 ////
@@ -754,7 +754,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python
-{!> ../../../docs_src/sql_databases/sql_app_py39/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/schemas.py!}
 ```
 
 ////
@@ -762,7 +762,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python
-{!> ../../../docs_src/sql_databases/sql_app_py310/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py310/schemas.py!}
 ```
 
 ////
@@ -770,7 +770,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 * `sql_app/crud.py`:
 
 ```Python
-{!../../../docs_src/sql_databases/sql_app/crud.py!}
+{!../../docs_src/sql_databases/sql_app/crud.py!}
 ```
 
 * `sql_app/main.py`:
@@ -778,7 +778,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
 ```
 
 ////
@@ -786,7 +786,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
 ```
 
 ////
@@ -843,7 +843,7 @@ $ uvicorn sql_app.main:app --reload
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python hl_lines="14-22"
-{!> ../../../docs_src/sql_databases/sql_app/alt_main.py!}
+{!> ../../docs_src/sql_databases/sql_app/alt_main.py!}
 ```
 
 ////
@@ -851,7 +851,7 @@ $ uvicorn sql_app.main:app --reload
 //// tab | 🐍 3️⃣.9️⃣ &amp; 🔛
 
 ```Python hl_lines="12-20"
-{!> ../../../docs_src/sql_databases/sql_app_py39/alt_main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/alt_main.py!}
 ```
 
 ////
index 3305746c29c7fca1130a4554b32a49c107118691..0627031b3b8ef6175918f9882050dc9efe997cf4 100644 (file)
@@ -8,7 +8,7 @@
 * "🗻" `StaticFiles()` 👐 🎯 ➡.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
 ```
 
 /// note | "📡 ℹ"
index 75dd2d2958ebc675e7c5eedd57968aedd5dc12cd..5f3d5e736347937ce7b4f199f82c41f32e1db53b 100644 (file)
@@ -27,7 +27,7 @@
 ✍ 🙅 `assert` 📄 ⏮️ 🐩 🐍 🧬 👈 👆 💪 ✅ (🔄, 🐩 `pytest`).
 
 ```Python hl_lines="2  12  15-18"
-{!../../../docs_src/app_testing/tutorial001.py!}
+{!../../docs_src/app_testing/tutorial001.py!}
 ```
 
 /// tip
@@ -75,7 +75,7 @@
 
 
 ```Python
-{!../../../docs_src/app_testing/main.py!}
+{!../../docs_src/app_testing/main.py!}
 ```
 
 ### 🔬 📁
@@ -93,7 +93,7 @@
 ↩️ 👉 📁 🎏 📦, 👆 💪 ⚙️ ⚖ 🗄 🗄 🎚 `app` ⚪️➡️ `main` 🕹 (`main.py`):
 
 ```Python hl_lines="3"
-{!../../../docs_src/app_testing/test_main.py!}
+{!../../docs_src/app_testing/test_main.py!}
 ```
 
 ...&amp; ✔️ 📟 💯 💖 ⏭.
 //// tab | 🐍 3️⃣.6️⃣ &amp; 🔛
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/main.py!}
+{!> ../../docs_src/app_testing/app_b/main.py!}
 ```
 
 ////
 //// tab | 🐍 3️⃣.1️⃣0️⃣ &amp; 🔛
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_py310/main.py!}
 ```
 
 ////
 👆 💪 ⤴️ ℹ `test_main.py` ⏮️ ↔ 💯:
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/test_main.py!}
+{!> ../../docs_src/app_testing/app_b/test_main.py!}
 ```
 
 🕐❔ 👆 💪 👩‍💻 🚶‍♀️ ℹ 📨 &amp; 👆 🚫 💭 ❔, 👆 💪 🔎 (🇺🇸🔍) ❔ ⚫️ `httpx`, ⚖️ ❔ ⚫️ ⏮️ `requests`, 🇸🇲 🔧 ⚓️ 🔛 📨' 🔧.
index 4fec412131c1545781bea0ada0df673daef2d08c..c038096f9fdc50396d585145438f97d9a75933ec 100644 (file)
@@ -27,7 +27,7 @@ Each of those response `dict`s can have a key `model`, containing a Pydantic mod
 For example, to declare another response with a status code `404` and a Pydantic model `Message`, you can write:
 
 ```Python hl_lines="18  22"
-{!../../../docs_src/additional_responses/tutorial001.py!}
+{!../../docs_src/additional_responses/tutorial001.py!}
 ```
 
 /// note
@@ -178,7 +178,7 @@ You can use this same `responses` parameter to add different media types for the
 For example, you can add an additional media type of `image/png`, declaring that your *path operation* can return a JSON object (with media type `application/json`) or a PNG image:
 
 ```Python hl_lines="19-24  28"
-{!../../../docs_src/additional_responses/tutorial002.py!}
+{!../../docs_src/additional_responses/tutorial002.py!}
 ```
 
 /// note
@@ -208,7 +208,7 @@ For example, you can declare a response with a status code `404` that uses a Pyd
 And a response with a status code `200` that uses your `response_model`, but includes a custom `example`:
 
 ```Python hl_lines="20-31"
-{!../../../docs_src/additional_responses/tutorial003.py!}
+{!../../docs_src/additional_responses/tutorial003.py!}
 ```
 
 It will all be combined and included in your OpenAPI, and shown in the API docs:
@@ -244,7 +244,7 @@ You can use that technique to reuse some predefined responses in your *path oper
 For example:
 
 ```Python hl_lines="13-17  26"
-{!../../../docs_src/additional_responses/tutorial004.py!}
+{!../../docs_src/additional_responses/tutorial004.py!}
 ```
 
 ## More information about OpenAPI responses
index 99ad72b536ab2368b587d336669839ced467ff05..6105a301cf99c0aa7874cad29bd4a329a5baf755 100644 (file)
@@ -17,7 +17,7 @@ To achieve that, import `JSONResponse`, and return your content there directly,
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  25"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an_py310.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ To achieve that, import `JSONResponse`, and return your content there directly,
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  25"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an_py39.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -33,7 +33,7 @@ To achieve that, import `JSONResponse`, and return your content there directly,
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  26"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="2  23"
-{!> ../../../docs_src/additional_status_codes/tutorial001_py310.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_py310.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="4  25"
-{!> ../../../docs_src/additional_status_codes/tutorial001.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001.py!}
 ```
 
 ////
index f65e1b1809ce40cb36a2e059682ba06a087e0a6a..b15a4fe3dc8c461f2f7f8506938cb56ba3e9e48e 100644 (file)
@@ -21,7 +21,7 @@ To do that, we declare a method `__call__`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -29,7 +29,7 @@ To do that, we declare a method `__call__`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@ And now, we can use `__init__` to declare the parameters of the instance that we
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -65,7 +65,7 @@ And now, we can use `__init__` to declare the parameters of the instance that we
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@ We could create an instance of this class with:
 //// tab | Python 3.9+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -101,7 +101,7 @@ We could create an instance of this class with:
 //// tab | Python 3.8+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
 ```
 
 ////
@@ -115,7 +115,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
 ```
 
 ////
@@ -137,7 +137,7 @@ checker(q="somequery")
 //// tab | Python 3.9+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -145,7 +145,7 @@ checker(q="somequery")
 //// tab | Python 3.8+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
 ```
 
 ////
@@ -159,7 +159,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
 ```
 
 ////
index a528c80feb7289fac46e4a55c33acfa3438307d4..232cd6e57e081ad8cd0213ab0c9b982c519e6e47 100644 (file)
@@ -33,13 +33,13 @@ For a simple example, let's consider a file structure similar to the one describ
 The file `main.py` would have:
 
 ```Python
-{!../../../docs_src/async_tests/main.py!}
+{!../../docs_src/async_tests/main.py!}
 ```
 
 The file `test_main.py` would have the tests for `main.py`, it could look like this now:
 
 ```Python
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
 ```
 
 ## Run it
@@ -61,7 +61,7 @@ $ pytest
 The marker `@pytest.mark.anyio` tells pytest that this test function should be called asynchronously:
 
 ```Python hl_lines="7"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
 ```
 
 /// tip
@@ -73,7 +73,7 @@ Note that the test function is now `async def` instead of just `def` as before w
 Then we can create an `AsyncClient` with the app, and send async requests to it, using `await`.
 
 ```Python hl_lines="9-12"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
 ```
 
 This is the equivalent to:
index e642b191029f6f76795d613545532005356d518a..67718a27b03fca906d5db37fbf4986b76d9bb0c5 100644 (file)
@@ -19,7 +19,7 @@ In this case, the original path `/app` would actually be served at `/api/v1/app`
 Even though all your code is written assuming there's just `/app`.
 
 ```Python hl_lines="6"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
 ```
 
 And the proxy would be **"stripping"** the **path prefix** on the fly before transmitting the request to the app server (probably Uvicorn via FastAPI CLI), keeping your application convinced that it is being served at `/app`, so that you don't have to update all your code to include the prefix `/api/v1`.
@@ -99,7 +99,7 @@ You can get the current `root_path` used by your application for each request, i
 Here we are including it in the message just for demonstration purposes.
 
 ```Python hl_lines="8"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
 ```
 
 Then, if you start Uvicorn with:
@@ -128,7 +128,7 @@ The response would be something like:
 Alternatively, if you don't have a way to provide a command line option like `--root-path` or equivalent, you can set the `root_path` parameter when creating your FastAPI app:
 
 ```Python hl_lines="3"
-{!../../../docs_src/behind_a_proxy/tutorial002.py!}
+{!../../docs_src/behind_a_proxy/tutorial002.py!}
 ```
 
 Passing the `root_path` to `FastAPI` would be the equivalent of passing the `--root-path` command line option to Uvicorn or Hypercorn.
@@ -310,7 +310,7 @@ If you pass a custom list of `servers` and there's a `root_path` (because your A
 For example:
 
 ```Python hl_lines="4-7"
-{!../../../docs_src/behind_a_proxy/tutorial003.py!}
+{!../../docs_src/behind_a_proxy/tutorial003.py!}
 ```
 
 Will generate an OpenAPI schema like:
@@ -359,7 +359,7 @@ The docs UI will interact with the server that you select.
 If you don't want **FastAPI** to include an automatic server using the `root_path`, you can use the parameter `root_path_in_servers=False`:
 
 ```Python hl_lines="9"
-{!../../../docs_src/behind_a_proxy/tutorial004.py!}
+{!../../docs_src/behind_a_proxy/tutorial004.py!}
 ```
 
 and then it won't include it in the OpenAPI schema.
index 1cefe979f6ac18ba6d3ccfc4f01cd561839b6b79..1d6dc3f6d0ad0d8cf5999966dbcede54d3d9dad4 100644 (file)
@@ -31,7 +31,7 @@ This is because by default, FastAPI will inspect every item inside and make sure
 But if you are certain that the content that you are returning is **serializable with JSON**, you can pass it directly to the response class and avoid the extra overhead that FastAPI would have by passing your return content through the `jsonable_encoder` before passing it to the response class.
 
 ```Python hl_lines="2  7"
-{!../../../docs_src/custom_response/tutorial001b.py!}
+{!../../docs_src/custom_response/tutorial001b.py!}
 ```
 
 /// info
@@ -58,7 +58,7 @@ To return a response with HTML directly from **FastAPI**, use `HTMLResponse`.
 * Pass `HTMLResponse` as the parameter `response_class` of your *path operation decorator*.
 
 ```Python hl_lines="2  7"
-{!../../../docs_src/custom_response/tutorial002.py!}
+{!../../docs_src/custom_response/tutorial002.py!}
 ```
 
 /// info
@@ -78,7 +78,7 @@ As seen in [Return a Response directly](response-directly.md){.internal-link tar
 The same example from above, returning an `HTMLResponse`, could look like:
 
 ```Python hl_lines="2  7  19"
-{!../../../docs_src/custom_response/tutorial003.py!}
+{!../../docs_src/custom_response/tutorial003.py!}
 ```
 
 /// warning
@@ -104,7 +104,7 @@ The `response_class` will then be used only to document the OpenAPI *path operat
 For example, it could be something like:
 
 ```Python hl_lines="7  21  23"
-{!../../../docs_src/custom_response/tutorial004.py!}
+{!../../docs_src/custom_response/tutorial004.py!}
 ```
 
 In this example, the function `generate_html_response()` already generates and returns a `Response` instead of returning the HTML in a `str`.
@@ -145,7 +145,7 @@ It accepts the following parameters:
 FastAPI (actually Starlette) will automatically include a Content-Length header. It will also include a Content-Type header, based on the `media_type` and appending a charset for text types.
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ### `HTMLResponse`
@@ -157,7 +157,7 @@ Takes some text or bytes and returns an HTML response, as you read above.
 Takes some text or bytes and returns a plain text response.
 
 ```Python hl_lines="2  7  9"
-{!../../../docs_src/custom_response/tutorial005.py!}
+{!../../docs_src/custom_response/tutorial005.py!}
 ```
 
 ### `JSONResponse`
@@ -193,7 +193,7 @@ This requires installing `ujson` for example with `pip install ujson`.
 ///
 
 ```Python hl_lines="2  7"
-{!../../../docs_src/custom_response/tutorial001.py!}
+{!../../docs_src/custom_response/tutorial001.py!}
 ```
 
 /// tip
@@ -209,7 +209,7 @@ Returns an HTTP redirect. Uses a 307 status code (Temporary Redirect) by default
 You can return a `RedirectResponse` directly:
 
 ```Python hl_lines="2  9"
-{!../../../docs_src/custom_response/tutorial006.py!}
+{!../../docs_src/custom_response/tutorial006.py!}
 ```
 
 ---
@@ -218,7 +218,7 @@ Or you can use it in the `response_class` parameter:
 
 
 ```Python hl_lines="2  7  9"
-{!../../../docs_src/custom_response/tutorial006b.py!}
+{!../../docs_src/custom_response/tutorial006b.py!}
 ```
 
 If you do that, then you can return the URL directly from your *path operation* function.
@@ -230,7 +230,7 @@ In this case, the `status_code` used will be the default one for the `RedirectRe
 You can also use the `status_code` parameter combined with the `response_class` parameter:
 
 ```Python hl_lines="2  7  9"
-{!../../../docs_src/custom_response/tutorial006c.py!}
+{!../../docs_src/custom_response/tutorial006c.py!}
 ```
 
 ### `StreamingResponse`
@@ -238,7 +238,7 @@ You can also use the `status_code` parameter combined with the `response_class`
 Takes an async generator or a normal generator/iterator and streams the response body.
 
 ```Python hl_lines="2  14"
-{!../../../docs_src/custom_response/tutorial007.py!}
+{!../../docs_src/custom_response/tutorial007.py!}
 ```
 
 #### Using `StreamingResponse` with file-like objects
@@ -250,7 +250,7 @@ That way, you don't have to read it all first in memory, and you can pass that g
 This includes many libraries to interact with cloud storage, video processing, and others.
 
 ```{ .python .annotate hl_lines="2  10-12  14" }
-{!../../../docs_src/custom_response/tutorial008.py!}
+{!../../docs_src/custom_response/tutorial008.py!}
 ```
 
 1. This is the generator function. It's a "generator function" because it contains `yield` statements inside.
@@ -281,13 +281,13 @@ Takes a different set of arguments to instantiate than the other response types:
 File responses will include appropriate `Content-Length`, `Last-Modified` and `ETag` headers.
 
 ```Python hl_lines="2  10"
-{!../../../docs_src/custom_response/tutorial009.py!}
+{!../../docs_src/custom_response/tutorial009.py!}
 ```
 
 You can also use the `response_class` parameter:
 
 ```Python hl_lines="2  8  10"
-{!../../../docs_src/custom_response/tutorial009b.py!}
+{!../../docs_src/custom_response/tutorial009b.py!}
 ```
 
 In this case, you can return the file path directly from your *path operation* function.
@@ -303,7 +303,7 @@ Let's say you want it to return indented and formatted JSON, so you want to use
 You could create a `CustomORJSONResponse`. The main thing you have to do is create a `Response.render(content)` method that returns the content as `bytes`:
 
 ```Python hl_lines="9-14  17"
-{!../../../docs_src/custom_response/tutorial009c.py!}
+{!../../docs_src/custom_response/tutorial009c.py!}
 ```
 
 Now instead of returning:
@@ -331,7 +331,7 @@ The parameter that defines this is `default_response_class`.
 In the example below, **FastAPI** will use `ORJSONResponse` by default, in all *path operations*, instead of `JSONResponse`.
 
 ```Python hl_lines="2  4"
-{!../../../docs_src/custom_response/tutorial010.py!}
+{!../../docs_src/custom_response/tutorial010.py!}
 ```
 
 /// tip
index 252ab6fa5e4d7b04f02dfbe9a33ba537db97bcd7..efc07eab2829c645d0493c926d9840621bc51f27 100644 (file)
@@ -5,7 +5,7 @@ FastAPI is built on top of **Pydantic**, and I have been showing you how to use
 But FastAPI also supports using <a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a> the same way:
 
 ```Python hl_lines="1  7-12  19-20"
-{!../../../docs_src/dataclasses/tutorial001.py!}
+{!../../docs_src/dataclasses/tutorial001.py!}
 ```
 
 This is still supported thanks to **Pydantic**, as it has <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">internal support for `dataclasses`</a>.
@@ -35,7 +35,7 @@ But if you have a bunch of dataclasses laying around, this is a nice trick to us
 You can also use `dataclasses` in the `response_model` parameter:
 
 ```Python hl_lines="1  7-13  19"
-{!../../../docs_src/dataclasses/tutorial002.py!}
+{!../../docs_src/dataclasses/tutorial002.py!}
 ```
 
 The dataclass will be automatically converted to a Pydantic dataclass.
@@ -53,7 +53,7 @@ In some cases, you might still have to use Pydantic's version of `dataclasses`.
 In that case, you can simply swap the standard `dataclasses` with `pydantic.dataclasses`, which is a drop-in replacement:
 
 ```{ .python .annotate hl_lines="1  5  8-11  14-17  23-25  28" }
-{!../../../docs_src/dataclasses/tutorial003.py!}
+{!../../docs_src/dataclasses/tutorial003.py!}
 ```
 
 1. We still import `field` from standard `dataclasses`.
index 7fd9343446668c60274823970796fbcca523fef6..efce492f41a99696570e545016b8039cac54de99 100644 (file)
@@ -31,7 +31,7 @@ Let's start with an example and then see it in detail.
 We create an async function `lifespan()` with `yield` like this:
 
 ```Python hl_lines="16  19"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 Here we are simulating the expensive *startup* operation of loading the model by putting the (fake) model function in the dictionary with machine learning models before the `yield`. This code will be executed **before** the application **starts taking requests**, during the *startup*.
@@ -51,7 +51,7 @@ Maybe you need to start a new version, or you just got tired of running it. 🤷
 The first thing to notice, is that we are defining an async function with `yield`. This is very similar to Dependencies with `yield`.
 
 ```Python hl_lines="14-19"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 The first part of the function, before the `yield`, will be executed **before** the application starts.
@@ -65,7 +65,7 @@ If you check, the function is decorated with an `@asynccontextmanager`.
 That converts the function into something called an "**async context manager**".
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 A **context manager** in Python is something that you can use in a `with` statement, for example, `open()` can be used as a context manager:
@@ -89,7 +89,7 @@ In our code example above, we don't use it directly, but we pass it to FastAPI f
 The `lifespan` parameter of the `FastAPI` app takes an **async context manager**, so we can pass our new `lifespan` async context manager to it.
 
 ```Python hl_lines="22"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 ## Alternative Events (deprecated)
@@ -113,7 +113,7 @@ These functions can be declared with `async def` or normal `def`.
 To add a function that should be run before the application starts, declare it with the event `"startup"`:
 
 ```Python hl_lines="8"
-{!../../../docs_src/events/tutorial001.py!}
+{!../../docs_src/events/tutorial001.py!}
 ```
 
 In this case, the `startup` event handler function will initialize the items "database" (just a `dict`) with some values.
@@ -127,7 +127,7 @@ And your application won't start receiving requests until all the `startup` even
 To add a function that should be run when the application is shutting down, declare it with the event `"shutdown"`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/events/tutorial002.py!}
+{!../../docs_src/events/tutorial002.py!}
 ```
 
 Here, the `shutdown` event handler function will write a text line `"Application shutdown"` to a file `log.txt`.
index faa7c323f51c7149e82b4f7b97ff812791d70c0c..7872103c3028052a721aea1e61049d3965e596ee 100644 (file)
@@ -35,7 +35,7 @@ Let's start with a simple FastAPI application:
 //// tab | Python 3.9+
 
 ```Python hl_lines="7-9  12-13  16-17  21"
-{!> ../../../docs_src/generate_clients/tutorial001_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial001_py39.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@ Let's start with a simple FastAPI application:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-11  14-15  18  19  23"
-{!> ../../../docs_src/generate_clients/tutorial001.py!}
+{!> ../../docs_src/generate_clients/tutorial001.py!}
 ```
 
 ////
@@ -154,7 +154,7 @@ For example, you could have a section for **items** and another section for **us
 //// tab | Python 3.9+
 
 ```Python hl_lines="21  26  34"
-{!> ../../../docs_src/generate_clients/tutorial002_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial002_py39.py!}
 ```
 
 ////
@@ -162,7 +162,7 @@ For example, you could have a section for **items** and another section for **us
 //// tab | Python 3.8+
 
 ```Python hl_lines="23  28  36"
-{!> ../../../docs_src/generate_clients/tutorial002.py!}
+{!> ../../docs_src/generate_clients/tutorial002.py!}
 ```
 
 ////
@@ -215,7 +215,7 @@ You can then pass that custom function to **FastAPI** as the `generate_unique_id
 //// tab | Python 3.9+
 
 ```Python hl_lines="6-7  10"
-{!> ../../../docs_src/generate_clients/tutorial003_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial003_py39.py!}
 ```
 
 ////
@@ -223,7 +223,7 @@ You can then pass that custom function to **FastAPI** as the `generate_unique_id
 //// tab | Python 3.8+
 
 ```Python hl_lines="8-9  12"
-{!> ../../../docs_src/generate_clients/tutorial003.py!}
+{!> ../../docs_src/generate_clients/tutorial003.py!}
 ```
 
 ////
@@ -251,7 +251,7 @@ We could download the OpenAPI JSON to a file `openapi.json` and then we could **
 //// tab | Python
 
 ```Python
-{!> ../../../docs_src/generate_clients/tutorial004.py!}
+{!> ../../docs_src/generate_clients/tutorial004.py!}
 ```
 
 ////
@@ -259,7 +259,7 @@ We could download the OpenAPI JSON to a file `openapi.json` and then we could **
 //// tab | Node.js
 
 ```Javascript
-{!> ../../../docs_src/generate_clients/tutorial004.js!}
+{!> ../../docs_src/generate_clients/tutorial004.js!}
 ```
 
 ////
index ab7778db0716c2d4805c8719c70df2a10284fa40..07deac716e04bd3430d10d030e1896b3de29900a 100644 (file)
@@ -58,7 +58,7 @@ Enforces that all incoming requests must either be `https` or `wss`.
 Any incoming request to `http` or `ws` will be redirected to the secure scheme instead.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/advanced_middleware/tutorial001.py!}
+{!../../docs_src/advanced_middleware/tutorial001.py!}
 ```
 
 ## `TrustedHostMiddleware`
@@ -66,7 +66,7 @@ Any incoming request to `http` or `ws` will be redirected to the secure scheme i
 Enforces that all incoming requests have a correctly set `Host` header, in order to guard against HTTP Host Header attacks.
 
 ```Python hl_lines="2  6-8"
-{!../../../docs_src/advanced_middleware/tutorial002.py!}
+{!../../docs_src/advanced_middleware/tutorial002.py!}
 ```
 
 The following arguments are supported:
@@ -82,7 +82,7 @@ Handles GZip responses for any request that includes `"gzip"` in the `Accept-Enc
 The middleware will handle both standard and streaming responses.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/advanced_middleware/tutorial003.py!}
+{!../../docs_src/advanced_middleware/tutorial003.py!}
 ```
 
 The following arguments are supported:
index 7fead2ed9f3d36141799042593e3725f05b6354e..82069a950073fac17054da43254d44abaf2caa30 100644 (file)
@@ -32,7 +32,7 @@ It will have a *path operation* that will receive an `Invoice` body, and a query
 This part is pretty normal, most of the code is probably already familiar to you:
 
 ```Python hl_lines="9-13  36-53"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 /// tip
@@ -93,7 +93,7 @@ Temporarily adopting this point of view (of the *external developer*) can help y
 First create a new `APIRouter` that will contain one or more callbacks.
 
 ```Python hl_lines="3  25"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 ### Create the callback *path operation*
@@ -106,7 +106,7 @@ It should look just like a normal FastAPI *path operation*:
 * And it could also have a declaration of the response it should return, e.g. `response_model=InvoiceEventReceived`.
 
 ```Python hl_lines="16-18  21-22  28-32"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 There are 2 main differences from a normal *path operation*:
@@ -176,7 +176,7 @@ At this point you have the *callback path operation(s)* needed (the one(s) that
 Now use the parameter `callbacks` in *your API's path operation decorator* to pass the attribute `.routes` (that's actually just a `list` of routes/*path operations*) from that callback router:
 
 ```Python hl_lines="35"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 /// tip
index 5ee321e2ae2abdc0dd49711056508f9c9609b89c..eaaa48a37ee23392a78024b597ca000fd1b572db 100644 (file)
@@ -33,7 +33,7 @@ Webhooks are available in OpenAPI 3.1.0 and above, supported by FastAPI `0.99.0`
 When you create a **FastAPI** application, there is a `webhooks` attribute that you can use to define *webhooks*, the same way you would define *path operations*, for example with `@app.webhooks.post()`.
 
 ```Python hl_lines="9-13  36-53"
-{!../../../docs_src/openapi_webhooks/tutorial001.py!}
+{!../../docs_src/openapi_webhooks/tutorial001.py!}
 ```
 
 The webhooks that you define will end up in the **OpenAPI** schema and the automatic **docs UI**.
index d599006d201874610150a2f4c40587481acddd61..a61e3f19b5ba363b9ab103f04c22067ce44a8ae6 100644 (file)
@@ -13,7 +13,7 @@ You can set the OpenAPI `operationId` to be used in your *path operation* with t
 You would have to make sure that it is unique for each operation.
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
 ```
 
 ### Using the *path operation function* name as the operationId
@@ -23,7 +23,7 @@ If you want to use your APIs' function names as `operationId`s, you can iterate
 You should do it after adding all your *path operations*.
 
 ```Python hl_lines="2  12-21  24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
 ```
 
 /// tip
@@ -45,7 +45,7 @@ Even if they are in different modules (Python files).
 To exclude a *path operation* from the generated OpenAPI schema (and thus, from the automatic documentation systems), use the parameter `include_in_schema` and set it to `False`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
 ```
 
 ## Advanced description from docstring
@@ -57,7 +57,7 @@ Adding an `\f` (an escaped "form feed" character) causes **FastAPI** to truncate
 It won't show up in the documentation, but other tools (such as Sphinx) will be able to use the rest.
 
 ```Python hl_lines="19-29"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
 ```
 
 ## Additional Responses
@@ -101,7 +101,7 @@ You can extend the OpenAPI schema for a *path operation* using the parameter `op
 This `openapi_extra` can be helpful, for example, to declare [OpenAPI Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions):
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial005.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial005.py!}
 ```
 
 If you open the automatic API docs, your extension will show up at the bottom of the specific *path operation*.
@@ -150,7 +150,7 @@ For example, you could decide to read and validate the request with your own cod
 You could do that with `openapi_extra`:
 
 ```Python hl_lines="19-36  39-40"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial006.py!}
 ```
 
 In this example, we didn't declare any Pydantic model. In fact, the request body is not even <abbr title="converted from some plain format, like bytes, into Python objects">parsed</abbr> as JSON, it is read directly as `bytes`, and the function `magic_data_reader()` would be in charge of parsing it in some way.
@@ -168,7 +168,7 @@ For example, in this application we don't use FastAPI's integrated functionality
 //// tab | Pydantic v2
 
 ```Python hl_lines="17-22  24"
-{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
+{!> ../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
 ```
 
 ////
@@ -176,7 +176,7 @@ For example, in this application we don't use FastAPI's integrated functionality
 //// tab | Pydantic v1
 
 ```Python hl_lines="17-22  24"
-{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!}
+{!> ../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!}
 ```
 
 ////
@@ -196,7 +196,7 @@ And then in our code, we parse that YAML content directly, and then we are again
 //// tab | Pydantic v2
 
 ```Python hl_lines="26-33"
-{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
+{!> ../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
 ```
 
 ////
@@ -204,7 +204,7 @@ And then in our code, we parse that YAML content directly, and then we are again
 //// tab | Pydantic v1
 
 ```Python hl_lines="26-33"
-{!> ../../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!}
+{!> ../../docs_src/path_operation_advanced_configuration/tutorial007_pv1.py!}
 ```
 
 ////
index b88d74a8af62e1573f17475426f5bc32676ac3c1..fc041f7de5fc125d9a99e5575c24ee264890379d 100644 (file)
@@ -21,7 +21,7 @@ You can declare a parameter of type `Response` in your *path operation function*
 And then you can set the `status_code` in that *temporal* response object.
 
 ```Python hl_lines="1  9  12"
-{!../../../docs_src/response_change_status_code/tutorial001.py!}
+{!../../docs_src/response_change_status_code/tutorial001.py!}
 ```
 
 And then you can return any object you need, as you normally would (a `dict`, a database model, etc).
index 85e423f42a87314553f88656f79e488d07ed624f..4467779ba65b841b251981e8571b27ccdb695e6a 100644 (file)
@@ -7,7 +7,7 @@ You can declare a parameter of type `Response` in your *path operation function*
 And then you can set cookies in that *temporal* response object.
 
 ```Python hl_lines="1  8-9"
-{!../../../docs_src/response_cookies/tutorial002.py!}
+{!../../docs_src/response_cookies/tutorial002.py!}
 ```
 
 And then you can return any object you need, as you normally would (a `dict`, a database model, etc).
@@ -27,7 +27,7 @@ To do that, you can create a response as described in [Return a Response Directl
 Then set Cookies in it, and then return it:
 
 ```Python hl_lines="10-12"
-{!../../../docs_src/response_cookies/tutorial001.py!}
+{!../../docs_src/response_cookies/tutorial001.py!}
 ```
 
 /// tip
index 092aeceb142f59b846fe78e6934619693739fc99..8246b967406022adacd4f13a019eef097efcae16 100644 (file)
@@ -35,7 +35,7 @@ For example, you cannot put a Pydantic model in a `JSONResponse` without first c
 For those cases, you can use the `jsonable_encoder` to convert your data before passing it to a response:
 
 ```Python hl_lines="6-7  21-22"
-{!../../../docs_src/response_directly/tutorial001.py!}
+{!../../docs_src/response_directly/tutorial001.py!}
 ```
 
 /// note | "Technical Details"
@@ -57,7 +57,7 @@ Let's say that you want to return an <a href="https://en.wikipedia.org/wiki/XML"
 You could put your XML content in a string, put that in a `Response`, and return it:
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ## Notes
index acbb6d7e5e5917f55207cf3ffe4125cfc1463ddb..80c10082635b511d6746585309323ac6e2633eb0 100644 (file)
@@ -7,7 +7,7 @@ You can declare a parameter of type `Response` in your *path operation function*
 And then you can set headers in that *temporal* response object.
 
 ```Python hl_lines="1  7-8"
-{!../../../docs_src/response_headers/tutorial002.py!}
+{!../../docs_src/response_headers/tutorial002.py!}
 ```
 
 And then you can return any object you need, as you normally would (a `dict`, a database model, etc).
@@ -25,7 +25,7 @@ You can also add headers when you return a `Response` directly.
 Create a response as described in [Return a Response Directly](response-directly.md){.internal-link target=_blank} and pass the headers as an additional parameter:
 
 ```Python hl_lines="10-12"
-{!../../../docs_src/response_headers/tutorial001.py!}
+{!../../docs_src/response_headers/tutorial001.py!}
 ```
 
 /// note | "Technical Details"
index e669d10d8ed0b9883bb0dddc24f2208545c57900..fa652c52b3d628729ee42ec30ecb0b1678fa80c7 100644 (file)
@@ -23,7 +23,7 @@ Then, when you type that username and password, the browser sends them in the he
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  8  12"
-{!> ../../../docs_src/security/tutorial006_an_py39.py!}
+{!> ../../docs_src/security/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Then, when you type that username and password, the browser sends them in the he
 //// tab | Python 3.8+
 
 ```Python hl_lines="2  7  11"
-{!> ../../../docs_src/security/tutorial006_an.py!}
+{!> ../../docs_src/security/tutorial006_an.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="2  6  10"
-{!> ../../../docs_src/security/tutorial006.py!}
+{!> ../../docs_src/security/tutorial006.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@ Then we can use `secrets.compare_digest()` to ensure that `credentials.username`
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  12-24"
-{!> ../../../docs_src/security/tutorial007_an_py39.py!}
+{!> ../../docs_src/security/tutorial007_an_py39.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@ Then we can use `secrets.compare_digest()` to ensure that `credentials.username`
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  12-24"
-{!> ../../../docs_src/security/tutorial007_an.py!}
+{!> ../../docs_src/security/tutorial007_an.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1  11-21"
-{!> ../../../docs_src/security/tutorial007.py!}
+{!> ../../docs_src/security/tutorial007.py!}
 ```
 
 ////
@@ -163,7 +163,7 @@ After detecting that the credentials are incorrect, return an `HTTPException` wi
 //// tab | Python 3.9+
 
 ```Python hl_lines="26-30"
-{!> ../../../docs_src/security/tutorial007_an_py39.py!}
+{!> ../../docs_src/security/tutorial007_an_py39.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ After detecting that the credentials are incorrect, return an `HTTPException` wi
 //// tab | Python 3.8+
 
 ```Python hl_lines="26-30"
-{!> ../../../docs_src/security/tutorial007_an.py!}
+{!> ../../docs_src/security/tutorial007_an.py!}
 ```
 
 ////
@@ -185,7 +185,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="23-27"
-{!> ../../../docs_src/security/tutorial007.py!}
+{!> ../../docs_src/security/tutorial007.py!}
 ```
 
 ////
index fdd8db7b92d6149f0752d51a1abebe248ce61779..3db284d02ec1039ef7652846ad389dde1a450d8e 100644 (file)
@@ -65,7 +65,7 @@ First, let's quickly see the parts that change from the examples in the main **T
 //// tab | Python 3.10+
 
 ```Python hl_lines="5  9  13  47  65  106  108-116  122-125  129-135  140  156"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@ First, let's quickly see the parts that change from the examples in the main **T
 //// tab | Python 3.9+
 
 ```Python hl_lines="2  5  9  13  47  65  106  108-116  122-125  129-135  140  156"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -81,7 +81,7 @@ First, let's quickly see the parts that change from the examples in the main **T
 //// tab | Python 3.8+
 
 ```Python hl_lines="2  5  9  13  48  66  107  109-117  123-126  130-136  141  157"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -95,7 +95,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="4  8  12  46  64  105  107-115  121-124  128-134  139  155"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -109,7 +109,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="2  5  9  13  47  65  106  108-116  122-125  129-135  140  156"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -123,7 +123,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="2  5  9  13  47  65  106  108-116  122-125  129-135  140  156"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -139,7 +139,7 @@ The `scopes` parameter receives a `dict` with each scope as a key and the descri
 //// tab | Python 3.10+
 
 ```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ The `scopes` parameter receives a `dict` with each scope as a key and the descri
 //// tab | Python 3.9+
 
 ```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -155,7 +155,7 @@ The `scopes` parameter receives a `dict` with each scope as a key and the descri
 //// tab | Python 3.8+
 
 ```Python hl_lines="64-67"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -169,7 +169,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="62-65"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -183,7 +183,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -197,7 +197,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -229,7 +229,7 @@ But in your application, for security, you should make sure you only add the sco
 //// tab | Python 3.10+
 
 ```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ But in your application, for security, you should make sure you only add the sco
 //// tab | Python 3.9+
 
 ```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ But in your application, for security, you should make sure you only add the sco
 //// tab | Python 3.8+
 
 ```Python hl_lines="157"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -259,7 +259,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="155"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -287,7 +287,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -319,7 +319,7 @@ We are doing it here to demonstrate how **FastAPI** handles scopes declared at d
 //// tab | Python 3.10+
 
 ```Python hl_lines="5  140  171"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -327,7 +327,7 @@ We are doing it here to demonstrate how **FastAPI** handles scopes declared at d
 //// tab | Python 3.9+
 
 ```Python hl_lines="5  140  171"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -335,7 +335,7 @@ We are doing it here to demonstrate how **FastAPI** handles scopes declared at d
 //// tab | Python 3.8+
 
 ```Python hl_lines="5  141  172"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -349,7 +349,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="4  139  168"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -363,7 +363,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="5  140  169"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -377,7 +377,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="5  140  169"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -409,7 +409,7 @@ This `SecurityScopes` class is similar to `Request` (`Request` was used to get t
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  106"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -417,7 +417,7 @@ This `SecurityScopes` class is similar to `Request` (`Request` was used to get t
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  106"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -425,7 +425,7 @@ This `SecurityScopes` class is similar to `Request` (`Request` was used to get t
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  107"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -439,7 +439,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8  105"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -453,7 +453,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9  106"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -467,7 +467,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9  106"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -487,7 +487,7 @@ In this exception, we include the scopes required (if any) as a string separated
 //// tab | Python 3.10+
 
 ```Python hl_lines="106  108-116"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -495,7 +495,7 @@ In this exception, we include the scopes required (if any) as a string separated
 //// tab | Python 3.9+
 
 ```Python hl_lines="106  108-116"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -503,7 +503,7 @@ In this exception, we include the scopes required (if any) as a string separated
 //// tab | Python 3.8+
 
 ```Python hl_lines="107  109-117"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -517,7 +517,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="105  107-115"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -531,7 +531,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="106  108-116"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -545,7 +545,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="106  108-116"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -567,7 +567,7 @@ We also verify that we have a user with that username, and if not, we raise that
 //// tab | Python 3.10+
 
 ```Python hl_lines="47  117-128"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -575,7 +575,7 @@ We also verify that we have a user with that username, and if not, we raise that
 //// tab | Python 3.9+
 
 ```Python hl_lines="47  117-128"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -583,7 +583,7 @@ We also verify that we have a user with that username, and if not, we raise that
 //// tab | Python 3.8+
 
 ```Python hl_lines="48  118-129"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -597,7 +597,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="46  116-127"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -611,7 +611,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="47  117-128"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -625,7 +625,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="47  117-128"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -639,7 +639,7 @@ For this, we use `security_scopes.scopes`, that contains a `list` with all these
 //// tab | Python 3.10+
 
 ```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -647,7 +647,7 @@ For this, we use `security_scopes.scopes`, that contains a `list` with all these
 //// tab | Python 3.9+
 
 ```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -655,7 +655,7 @@ For this, we use `security_scopes.scopes`, that contains a `list` with all these
 //// tab | Python 3.8+
 
 ```Python hl_lines="130-136"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -669,7 +669,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="128-134"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -683,7 +683,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -697,7 +697,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
index 8c04d2507671e9a56a1d21d73aa2450b34068f90..01810c438a79267e726691a83ebabbbfa61b4f28 100644 (file)
@@ -63,7 +63,7 @@ You can use all the same validation features and tools you use for Pydantic mode
 //// tab | Pydantic v2
 
 ```Python hl_lines="2  5-8  11"
-{!> ../../../docs_src/settings/tutorial001.py!}
+{!> ../../docs_src/settings/tutorial001.py!}
 ```
 
 ////
@@ -77,7 +77,7 @@ In Pydantic v1 you would import `BaseSettings` directly from `pydantic` instead
 ///
 
 ```Python hl_lines="2  5-8  11"
-{!> ../../../docs_src/settings/tutorial001_pv1.py!}
+{!> ../../docs_src/settings/tutorial001_pv1.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ Next it will convert and validate the data. So, when you use that `settings` obj
 Then you can use the new `settings` object in your application:
 
 ```Python hl_lines="18-20"
-{!../../../docs_src/settings/tutorial001.py!}
+{!../../docs_src/settings/tutorial001.py!}
 ```
 
 ### Run the server
@@ -133,13 +133,13 @@ You could put those settings in another module file as you saw in [Bigger Applic
 For example, you could have a file `config.py` with:
 
 ```Python
-{!../../../docs_src/settings/app01/config.py!}
+{!../../docs_src/settings/app01/config.py!}
 ```
 
 And then use it in a file `main.py`:
 
 ```Python hl_lines="3  11-13"
-{!../../../docs_src/settings/app01/main.py!}
+{!../../docs_src/settings/app01/main.py!}
 ```
 
 /// tip
@@ -159,7 +159,7 @@ This could be especially useful during testing, as it's very easy to override a
 Coming from the previous example, your `config.py` file could look like:
 
 ```Python hl_lines="10"
-{!../../../docs_src/settings/app02/config.py!}
+{!../../docs_src/settings/app02/config.py!}
 ```
 
 Notice that now we don't create a default instance `settings = Settings()`.
@@ -171,7 +171,7 @@ Now we create a dependency that returns a new `config.Settings()`.
 //// tab | Python 3.9+
 
 ```Python hl_lines="6  12-13"
-{!> ../../../docs_src/settings/app02_an_py39/main.py!}
+{!> ../../docs_src/settings/app02_an_py39/main.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Now we create a dependency that returns a new `config.Settings()`.
 //// tab | Python 3.8+
 
 ```Python hl_lines="6  12-13"
-{!> ../../../docs_src/settings/app02_an/main.py!}
+{!> ../../docs_src/settings/app02_an/main.py!}
 ```
 
 ////
@@ -193,7 +193,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="5  11-12"
-{!> ../../../docs_src/settings/app02/main.py!}
+{!> ../../docs_src/settings/app02/main.py!}
 ```
 
 ////
@@ -211,7 +211,7 @@ And then we can require it from the *path operation function* as a dependency an
 //// tab | Python 3.9+
 
 ```Python hl_lines="17  19-21"
-{!> ../../../docs_src/settings/app02_an_py39/main.py!}
+{!> ../../docs_src/settings/app02_an_py39/main.py!}
 ```
 
 ////
@@ -219,7 +219,7 @@ And then we can require it from the *path operation function* as a dependency an
 //// tab | Python 3.8+
 
 ```Python hl_lines="17  19-21"
-{!> ../../../docs_src/settings/app02_an/main.py!}
+{!> ../../docs_src/settings/app02_an/main.py!}
 ```
 
 ////
@@ -233,7 +233,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="16  18-20"
-{!> ../../../docs_src/settings/app02/main.py!}
+{!> ../../docs_src/settings/app02/main.py!}
 ```
 
 ////
@@ -243,7 +243,7 @@ Prefer to use the `Annotated` version if possible.
 Then it would be very easy to provide a different settings object during testing by creating a dependency override for `get_settings`:
 
 ```Python hl_lines="9-10  13  21"
-{!../../../docs_src/settings/app02/test_main.py!}
+{!../../docs_src/settings/app02/test_main.py!}
 ```
 
 In the dependency override we set a new value for the `admin_email` when creating the new `Settings` object, and then we return that new object.
@@ -288,7 +288,7 @@ And then update your `config.py` with:
 //// tab | Pydantic v2
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/settings/app03_an/config.py!}
+{!> ../../docs_src/settings/app03_an/config.py!}
 ```
 
 /// tip
@@ -302,7 +302,7 @@ The `model_config` attribute is used just for Pydantic configuration. You can re
 //// tab | Pydantic v1
 
 ```Python hl_lines="9-10"
-{!> ../../../docs_src/settings/app03_an/config_pv1.py!}
+{!> ../../docs_src/settings/app03_an/config_pv1.py!}
 ```
 
 /// tip
@@ -347,7 +347,7 @@ But as we are using the `@lru_cache` decorator on top, the `Settings` object wil
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  11"
-{!> ../../../docs_src/settings/app03_an_py39/main.py!}
+{!> ../../docs_src/settings/app03_an_py39/main.py!}
 ```
 
 ////
@@ -355,7 +355,7 @@ But as we are using the `@lru_cache` decorator on top, the `Settings` object wil
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  11"
-{!> ../../../docs_src/settings/app03_an/main.py!}
+{!> ../../docs_src/settings/app03_an/main.py!}
 ```
 
 ////
@@ -369,7 +369,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1  10"
-{!> ../../../docs_src/settings/app03/main.py!}
+{!> ../../docs_src/settings/app03/main.py!}
 ```
 
 ////
index 568a9deca6fa2a27bfd6880a630b374f02223c96..befa9908a43de41ae3dbba2238176f57de66b8d5 100644 (file)
@@ -11,7 +11,7 @@ If you need to have two independent FastAPI applications, with their own indepen
 First, create the main, top-level, **FastAPI** application, and its *path operations*:
 
 ```Python hl_lines="3  6-8"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### Sub-application
@@ -21,7 +21,7 @@ Then, create your sub-application, and its *path operations*.
 This sub-application is just another standard FastAPI application, but this is the one that will be "mounted":
 
 ```Python hl_lines="11  14-16"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### Mount the sub-application
@@ -31,7 +31,7 @@ In your top-level application, `app`, mount the sub-application, `subapi`.
 In this case, it will be mounted at the path `/subapi`:
 
 ```Python hl_lines="11  19"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### Check the automatic API docs
index 416540ba4fc16c5b0d6e5606062413776609a6de..d688c5cb7a03907ed366c9f99877a3220c4f17ee 100644 (file)
@@ -28,7 +28,7 @@ $ pip install jinja2
 * Use the `templates` you created to render and return a `TemplateResponse`, pass the name of the template, the request object, and a "context" dictionary with key-value pairs to be used inside of the Jinja2 template.
 
 ```Python hl_lines="4  11  15-18"
-{!../../../docs_src/templates/tutorial001.py!}
+{!../../docs_src/templates/tutorial001.py!}
 ```
 
 /// note
@@ -58,7 +58,7 @@ You could also use `from starlette.templating import Jinja2Templates`.
 Then you can write a template at `templates/item.html` with, for example:
 
 ```jinja hl_lines="7"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
 ```
 
 ### Template Context Values
@@ -112,13 +112,13 @@ For example, with an ID of `42`, this would render:
 You can also use `url_for()` inside of the template, and use it, for example, with the `StaticFiles` you mounted with the `name="static"`.
 
 ```jinja hl_lines="4"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
 ```
 
 In this example, it would link to a CSS file at `static/styles.css` with:
 
 ```CSS hl_lines="4"
-{!../../../docs_src/templates/static/styles.css!}
+{!../../docs_src/templates/static/styles.css!}
 ```
 
 And because you are using `StaticFiles`, that CSS file would be served automatically by your **FastAPI** application at the URL `/static/styles.css`.
index 974cf4caa7f52ca2a037a7b0f5f2f457a9aa25d9..2b704f2299a5f8c270362a3d2a417fcedbc7b41a 100644 (file)
@@ -59,7 +59,7 @@ We'll use an in-memory database that persists during the tests instead of the lo
 But the rest of the session code is more or less the same, we just copy it.
 
 ```Python hl_lines="8-13"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
+{!../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
 ```
 
 /// tip
@@ -83,7 +83,7 @@ That is normally called in `main.py`, but the line in `main.py` uses the databas
 So we add that line here, with the new file.
 
 ```Python hl_lines="16"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
+{!../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
 ```
 
 ## Dependency override
@@ -91,7 +91,7 @@ So we add that line here, with the new file.
 Now we create the dependency override and add it to the overrides for our app.
 
 ```Python hl_lines="19-24  27"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
+{!../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
 ```
 
 /// tip
@@ -105,7 +105,7 @@ The code for `override_get_db()` is almost exactly the same as for `get_db()`, b
 Then we can just test the app as normally.
 
 ```Python hl_lines="32-47"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
+{!../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
 ```
 
 And all the modifications we made in the database during the tests will be in the `test.db` database instead of the main `sql_app.db`.
index 92e25f88d9c9042fa98aea7c0518aa58c64415f8..1cc4313a1e17f0fa1f0346c1f59e6c7b86f415ea 100644 (file)
@@ -31,7 +31,7 @@ And then **FastAPI** will call that override instead of the original dependency.
 //// tab | Python 3.10+
 
 ```Python hl_lines="26-27  30"
-{!> ../../../docs_src/dependency_testing/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ And then **FastAPI** will call that override instead of the original dependency.
 //// tab | Python 3.9+
 
 ```Python hl_lines="28-29  32"
-{!> ../../../docs_src/dependency_testing/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@ And then **FastAPI** will call that override instead of the original dependency.
 //// tab | Python 3.8+
 
 ```Python hl_lines="29-30  33"
-{!> ../../../docs_src/dependency_testing/tutorial001_an.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_an.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="24-25  28"
-{!> ../../../docs_src/dependency_testing/tutorial001_py310.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="28-29  32"
-{!> ../../../docs_src/dependency_testing/tutorial001.py!}
+{!> ../../docs_src/dependency_testing/tutorial001.py!}
 ```
 
 ////
index b24a2ccfe854643af45309d6d30787a07fa248da..f48907c7c3de1942ae541758c3479d868c4f3625 100644 (file)
@@ -3,5 +3,5 @@
 When you need your event handlers (`startup` and `shutdown`) to run in your tests, you can use the `TestClient` with a `with` statement:
 
 ```Python hl_lines="9-12  20-24"
-{!../../../docs_src/app_testing/tutorial003.py!}
+{!../../docs_src/app_testing/tutorial003.py!}
 ```
index 6c071bc198ef31bde215c7470f2ea6095b0478b6..ab08c90fe876cc4f85d861ac072c5a012ac2015d 100644 (file)
@@ -5,7 +5,7 @@ You can use the same `TestClient` to test WebSockets.
 For this, you use the `TestClient` in a `with` statement, connecting to the WebSocket:
 
 ```Python hl_lines="27-31"
-{!../../../docs_src/app_testing/tutorial002.py!}
+{!../../docs_src/app_testing/tutorial002.py!}
 ```
 
 /// note
index 5473db5cba36347c775212c06663a4a5ce2dfd33..917d77a95f3c3c73c579215b6360eabb4d96ef60 100644 (file)
@@ -30,7 +30,7 @@ Let's imagine you want to get the client's IP address/host inside of your *path
 For that you need to access the request directly.
 
 ```Python hl_lines="1  7-8"
-{!../../../docs_src/using_request_directly/tutorial001.py!}
+{!../../docs_src/using_request_directly/tutorial001.py!}
 ```
 
 By declaring a *path operation function* parameter with the type being the `Request` **FastAPI** will know to pass the `Request` in that parameter.
index 44c6c742842c6f44b5dc60289333e81560692abe..8947f32e7d2c9071cecfa2d36aae7d3d13e32771 100644 (file)
@@ -39,7 +39,7 @@ In production you would have one of the options above.
 But it's the simplest way to focus on the server-side of WebSockets and have a working example:
 
 ```Python hl_lines="2  6-38  41-43"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 ## Create a `websocket`
@@ -47,7 +47,7 @@ But it's the simplest way to focus on the server-side of WebSockets and have a w
 In your **FastAPI** application, create a `websocket`:
 
 ```Python hl_lines="1  46-47"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 /// note | "Technical Details"
@@ -63,7 +63,7 @@ You could also use `from starlette.websockets import WebSocket`.
 In your WebSocket route you can `await` for messages and send messages.
 
 ```Python hl_lines="48-52"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 You can receive and send binary, text, and JSON data.
@@ -118,7 +118,7 @@ They work the same way as for other FastAPI endpoints/*path operations*:
 //// tab | Python 3.10+
 
 ```Python hl_lines="68-69  82"
-{!> ../../../docs_src/websockets/tutorial002_an_py310.py!}
+{!> ../../docs_src/websockets/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -126,7 +126,7 @@ They work the same way as for other FastAPI endpoints/*path operations*:
 //// tab | Python 3.9+
 
 ```Python hl_lines="68-69  82"
-{!> ../../../docs_src/websockets/tutorial002_an_py39.py!}
+{!> ../../docs_src/websockets/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -134,7 +134,7 @@ They work the same way as for other FastAPI endpoints/*path operations*:
 //// tab | Python 3.8+
 
 ```Python hl_lines="69-70  83"
-{!> ../../../docs_src/websockets/tutorial002_an.py!}
+{!> ../../docs_src/websockets/tutorial002_an.py!}
 ```
 
 ////
@@ -148,7 +148,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="66-67  79"
-{!> ../../../docs_src/websockets/tutorial002_py310.py!}
+{!> ../../docs_src/websockets/tutorial002_py310.py!}
 ```
 
 ////
@@ -162,7 +162,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="68-69  81"
-{!> ../../../docs_src/websockets/tutorial002.py!}
+{!> ../../docs_src/websockets/tutorial002.py!}
 ```
 
 ////
@@ -213,7 +213,7 @@ When a WebSocket connection is closed, the `await websocket.receive_text()` will
 //// tab | Python 3.9+
 
 ```Python hl_lines="79-81"
-{!> ../../../docs_src/websockets/tutorial003_py39.py!}
+{!> ../../docs_src/websockets/tutorial003_py39.py!}
 ```
 
 ////
@@ -221,7 +221,7 @@ When a WebSocket connection is closed, the `await websocket.receive_text()` will
 //// tab | Python 3.8+
 
 ```Python hl_lines="81-83"
-{!> ../../../docs_src/websockets/tutorial003.py!}
+{!> ../../docs_src/websockets/tutorial003.py!}
 ```
 
 ////
index f07609ed6f82b2dd70d555c266f296b2c848b7a0..3974d491c3a44f9019c76c9fe38de0880147834b 100644 (file)
@@ -13,7 +13,7 @@ Then wrap the WSGI (e.g. Flask) app with the middleware.
 And then mount that under a path.
 
 ```Python hl_lines="2-3  23"
-{!../../../docs_src/wsgi/tutorial001.py!}
+{!../../docs_src/wsgi/tutorial001.py!}
 ```
 
 ## Check it
index a75f8ef58224308035895622a51ed6601d65d6f8..a72316c4dc8ee829058e6a89ca3bc66afc12e4ad 100644 (file)
@@ -43,7 +43,7 @@ This section doesn't apply those ideas, to be equivalent to the counterpart in <
 * Create a table `notes` using the `metadata` object.
 
 ```Python hl_lines="4  14  16-22"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
+{!../../docs_src/async_sql_databases/tutorial001.py!}
 ```
 
 /// tip
@@ -61,7 +61,7 @@ Notice that all this code is pure SQLAlchemy Core.
 * Create a `database` object.
 
 ```Python hl_lines="3  9  12"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
+{!../../docs_src/async_sql_databases/tutorial001.py!}
 ```
 
 /// tip
@@ -80,7 +80,7 @@ Here, this section would run directly, right before starting your **FastAPI** ap
 * Create all the tables from the `metadata` object.
 
 ```Python hl_lines="25-28"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
+{!../../docs_src/async_sql_databases/tutorial001.py!}
 ```
 
 ## Create models
@@ -91,7 +91,7 @@ Create Pydantic models for:
 * Notes to be returned (`Note`).
 
 ```Python hl_lines="31-33  36-39"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
+{!../../docs_src/async_sql_databases/tutorial001.py!}
 ```
 
 By creating these Pydantic models, the input data will be validated, serialized (converted), and annotated (documented).
@@ -104,7 +104,7 @@ So, you will be able to see it all in the interactive API docs.
 * Create event handlers to connect and disconnect from the database.
 
 ```Python hl_lines="42  45-47  50-52"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
+{!../../docs_src/async_sql_databases/tutorial001.py!}
 ```
 
 ## Read notes
@@ -112,7 +112,7 @@ So, you will be able to see it all in the interactive API docs.
 Create the *path operation function* to read notes:
 
 ```Python hl_lines="55-58"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
+{!../../docs_src/async_sql_databases/tutorial001.py!}
 ```
 
 /// note
@@ -132,7 +132,7 @@ That documents (and validates, serializes, filters) the output data, as a `list`
 Create the *path operation function* to create notes:
 
 ```Python hl_lines="61-65"
-{!../../../docs_src/async_sql_databases/tutorial001.py!}
+{!../../docs_src/async_sql_databases/tutorial001.py!}
 ```
 
 /// info
index add16fbec519ec7877bc3958bc0876a00dd34af0..6cd0385a2a2fe3b5e992294d248a259278dae2bb 100644 (file)
@@ -30,7 +30,7 @@ You can easily use the same Pydantic settings to configure your generated OpenAP
 For example:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/conditional_openapi/tutorial001.py!}
+{!../../docs_src/conditional_openapi/tutorial001.py!}
 ```
 
 Here we declare the setting `openapi_url` with the same default of `"/openapi.json"`.
index 040c3926bde8ffa0fe3e4846c4bd4b860f2bc67e..2c649c152e35b5130cce1b0c020dd00d66e52573 100644 (file)
@@ -19,7 +19,7 @@ Without changing the settings, syntax highlighting is enabled by default:
 But you can disable it by setting `syntaxHighlight` to `False`:
 
 ```Python hl_lines="3"
-{!../../../docs_src/configure_swagger_ui/tutorial001.py!}
+{!../../docs_src/configure_swagger_ui/tutorial001.py!}
 ```
 
 ...and then Swagger UI won't show the syntax highlighting anymore:
@@ -31,7 +31,7 @@ But you can disable it by setting `syntaxHighlight` to `False`:
 The same way you could set the syntax highlighting theme with the key `"syntaxHighlight.theme"` (notice that it has a dot in the middle):
 
 ```Python hl_lines="3"
-{!../../../docs_src/configure_swagger_ui/tutorial002.py!}
+{!../../docs_src/configure_swagger_ui/tutorial002.py!}
 ```
 
 That configuration would change the syntax highlighting color theme:
@@ -45,7 +45,7 @@ FastAPI includes some default configuration parameters appropriate for most of t
 It includes these default configurations:
 
 ```Python
-{!../../../fastapi/openapi/docs.py[ln:7-23]!}
+{!../../fastapi/openapi/docs.py[ln:7-23]!}
 ```
 
 You can override any of them by setting a different value in the argument `swagger_ui_parameters`.
@@ -53,7 +53,7 @@ You can override any of them by setting a different value in the argument `swagg
 For example, to disable `deepLinking` you could pass these settings to `swagger_ui_parameters`:
 
 ```Python hl_lines="3"
-{!../../../docs_src/configure_swagger_ui/tutorial003.py!}
+{!../../docs_src/configure_swagger_ui/tutorial003.py!}
 ```
 
 ## Other Swagger UI Parameters
index 0c766d3e43a67071875956859c5de120dc3babe0..16c873d1152a59836c0a5e0c8c9168f7699401ea 100644 (file)
@@ -19,7 +19,7 @@ The first step is to disable the automatic docs, as by default, those use the de
 To disable them, set their URLs to `None` when creating your `FastAPI` app:
 
 ```Python hl_lines="8"
-{!../../../docs_src/custom_docs_ui/tutorial001.py!}
+{!../../docs_src/custom_docs_ui/tutorial001.py!}
 ```
 
 ### Include the custom docs
@@ -37,7 +37,7 @@ You can reuse FastAPI's internal functions to create the HTML pages for the docs
 And similarly for ReDoc...
 
 ```Python hl_lines="2-6  11-19  22-24  27-33"
-{!../../../docs_src/custom_docs_ui/tutorial001.py!}
+{!../../docs_src/custom_docs_ui/tutorial001.py!}
 ```
 
 /// tip
@@ -55,7 +55,7 @@ Swagger UI will handle it behind the scenes for you, but it needs this "redirect
 Now, to be able to test that everything works, create a *path operation*:
 
 ```Python hl_lines="36-38"
-{!../../../docs_src/custom_docs_ui/tutorial001.py!}
+{!../../docs_src/custom_docs_ui/tutorial001.py!}
 ```
 
 ### Test it
@@ -125,7 +125,7 @@ After that, your file structure could look like:
 * "Mount" a `StaticFiles()` instance in a specific path.
 
 ```Python hl_lines="7  11"
-{!../../../docs_src/custom_docs_ui/tutorial002.py!}
+{!../../docs_src/custom_docs_ui/tutorial002.py!}
 ```
 
 ### Test the static files
@@ -159,7 +159,7 @@ The same as when using a custom CDN, the first step is to disable the automatic
 To disable them, set their URLs to `None` when creating your `FastAPI` app:
 
 ```Python hl_lines="9"
-{!../../../docs_src/custom_docs_ui/tutorial002.py!}
+{!../../docs_src/custom_docs_ui/tutorial002.py!}
 ```
 
 ### Include the custom docs for static files
@@ -177,7 +177,7 @@ Again, you can reuse FastAPI's internal functions to create the HTML pages for t
 And similarly for ReDoc...
 
 ```Python hl_lines="2-6  14-22  25-27  30-36"
-{!../../../docs_src/custom_docs_ui/tutorial002.py!}
+{!../../docs_src/custom_docs_ui/tutorial002.py!}
 ```
 
 /// tip
@@ -195,7 +195,7 @@ Swagger UI will handle it behind the scenes for you, but it needs this "redirect
 Now, to be able to test that everything works, create a *path operation*:
 
 ```Python hl_lines="39-41"
-{!../../../docs_src/custom_docs_ui/tutorial002.py!}
+{!../../docs_src/custom_docs_ui/tutorial002.py!}
 ```
 
 ### Test Static Files UI
index 20e1904f1e58fc8229ab48e9c9dfcf0121f4781b..a62ebf1d57067057542b5b6aa78bdb12c17e5297 100644 (file)
@@ -43,7 +43,7 @@ If there's no `gzip` in the header, it will not try to decompress the body.
 That way, the same route class can handle gzip compressed or uncompressed requests.
 
 ```Python hl_lines="8-15"
-{!../../../docs_src/custom_request_and_route/tutorial001.py!}
+{!../../docs_src/custom_request_and_route/tutorial001.py!}
 ```
 
 ### Create a custom `GzipRoute` class
@@ -57,7 +57,7 @@ This method returns a function. And that function is what will receive a request
 Here we use it to create a `GzipRequest` from the original request.
 
 ```Python hl_lines="18-26"
-{!../../../docs_src/custom_request_and_route/tutorial001.py!}
+{!../../docs_src/custom_request_and_route/tutorial001.py!}
 ```
 
 /// note | "Technical Details"
@@ -97,13 +97,13 @@ We can also use this same approach to access the request body in an exception ha
 All we need to do is handle the request inside a `try`/`except` block:
 
 ```Python hl_lines="13  15"
-{!../../../docs_src/custom_request_and_route/tutorial002.py!}
+{!../../docs_src/custom_request_and_route/tutorial002.py!}
 ```
 
 If an exception occurs, the`Request` instance will still be in scope, so we can read and make use of the request body when handling the error:
 
 ```Python hl_lines="16-18"
-{!../../../docs_src/custom_request_and_route/tutorial002.py!}
+{!../../docs_src/custom_request_and_route/tutorial002.py!}
 ```
 
 ## Custom `APIRoute` class in a router
@@ -111,11 +111,11 @@ If an exception occurs, the`Request` instance will still be in scope, so we can
 You can also set the `route_class` parameter of an `APIRouter`:
 
 ```Python hl_lines="26"
-{!../../../docs_src/custom_request_and_route/tutorial003.py!}
+{!../../docs_src/custom_request_and_route/tutorial003.py!}
 ```
 
 In this example, the *path operations* under the `router` will use the custom `TimedRoute` class, and will have an extra `X-Response-Time` header in the response with the time it took to generate the response:
 
 ```Python hl_lines="13-20"
-{!../../../docs_src/custom_request_and_route/tutorial003.py!}
+{!../../docs_src/custom_request_and_route/tutorial003.py!}
 ```
index 9909f778c3cce3fe0875ca7c83ed840de612197b..2b036795215c4c17f674cfc6723dda32e5bad2aa 100644 (file)
@@ -44,7 +44,7 @@ For example, let's add <a href="https://github.com/Rebilly/ReDoc/blob/master/doc
 First, write all your **FastAPI** application as normally:
 
 ```Python hl_lines="1  4  7-9"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### Generate the OpenAPI schema
@@ -52,7 +52,7 @@ First, write all your **FastAPI** application as normally:
 Then, use the same utility function to generate the OpenAPI schema, inside a `custom_openapi()` function:
 
 ```Python hl_lines="2  15-21"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### Modify the OpenAPI schema
@@ -60,7 +60,7 @@ Then, use the same utility function to generate the OpenAPI schema, inside a `cu
 Now you can add the ReDoc extension, adding a custom `x-logo` to the `info` "object" in the OpenAPI schema:
 
 ```Python hl_lines="22-24"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### Cache the OpenAPI schema
@@ -72,7 +72,7 @@ That way, your application won't have to generate the schema every time a user o
 It will be generated only once, and then the same cached schema will be used for the next requests.
 
 ```Python hl_lines="13-14  25-26"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### Override the method
@@ -80,7 +80,7 @@ It will be generated only once, and then the same cached schema will be used for
 Now you can replace the `.openapi()` method with your new function.
 
 ```Python hl_lines="29"
-{!../../../docs_src/extending_openapi/tutorial001.py!}
+{!../../docs_src/extending_openapi/tutorial001.py!}
 ```
 
 ### Check it
index d4b7cfdaa5b5d46abeb78ec602d1788d22db6f23..2a4377d1697d2d28b5f0d4cffba77cbe9e62b2c5 100644 (file)
@@ -36,7 +36,7 @@ Depending on your use case, you might prefer to use a different library, but if
 Here's a small preview of how you could integrate Strawberry with FastAPI:
 
 ```Python hl_lines="3  22  25-26"
-{!../../../docs_src/graphql/tutorial001.py!}
+{!../../docs_src/graphql/tutorial001.py!}
 ```
 
 You can learn more about Strawberry in the <a href="https://strawberry.rocks/" class="external-link" target="_blank">Strawberry documentation</a>.
index a0abfe21d2a9b36884576afbb8d065c80bd3956e..feb4025dd10dbf66a1b2d70bf7e20b6dcbc8726e 100644 (file)
@@ -39,7 +39,7 @@ There is an official project generator with **FastAPI** and **Couchbase**, all b
 For now, don't pay attention to the rest, only the imports:
 
 ```Python hl_lines="3-5"
-{!../../../docs_src/nosql_databases/tutorial001.py!}
+{!../../docs_src/nosql_databases/tutorial001.py!}
 ```
 
 ## Define a constant to use as a "document type"
@@ -49,7 +49,7 @@ We will use it later as a fixed field `type` in our documents.
 This is not required by Couchbase, but is a good practice that will help you afterwards.
 
 ```Python hl_lines="9"
-{!../../../docs_src/nosql_databases/tutorial001.py!}
+{!../../docs_src/nosql_databases/tutorial001.py!}
 ```
 
 ## Add a function to get a `Bucket`
@@ -74,7 +74,7 @@ This utility function will:
 * Return it.
 
 ```Python hl_lines="12-21"
-{!../../../docs_src/nosql_databases/tutorial001.py!}
+{!../../docs_src/nosql_databases/tutorial001.py!}
 ```
 
 ## Create Pydantic models
@@ -86,7 +86,7 @@ As **Couchbase** "documents" are actually just "JSON objects", we can model them
 First, let's create a `User` model:
 
 ```Python hl_lines="24-28"
-{!../../../docs_src/nosql_databases/tutorial001.py!}
+{!../../docs_src/nosql_databases/tutorial001.py!}
 ```
 
 We will use this model in our *path operation function*, so, we don't include in it the `hashed_password`.
@@ -100,7 +100,7 @@ This will have the data that is actually stored in the database.
 We don't create it as a subclass of Pydantic's `BaseModel` but as a subclass of our own `User`, because it will have all the attributes in `User` plus a couple more:
 
 ```Python hl_lines="31-33"
-{!../../../docs_src/nosql_databases/tutorial001.py!}
+{!../../docs_src/nosql_databases/tutorial001.py!}
 ```
 
 /// note
@@ -123,7 +123,7 @@ Now create a function that will:
 By creating a function that is only dedicated to getting your user from a `username` (or any other parameter) independent of your *path operation function*, you can more easily reuse it in multiple parts and also add <abbr title="Automated test, written in code, that checks if another piece of code is working correctly.">unit tests</abbr> for it:
 
 ```Python hl_lines="36-42"
-{!../../../docs_src/nosql_databases/tutorial001.py!}
+{!../../docs_src/nosql_databases/tutorial001.py!}
 ```
 
 ### f-strings
@@ -158,7 +158,7 @@ UserInDB(username="johndoe", hashed_password="some_hash")
 ### Create the `FastAPI` app
 
 ```Python hl_lines="46"
-{!../../../docs_src/nosql_databases/tutorial001.py!}
+{!../../docs_src/nosql_databases/tutorial001.py!}
 ```
 
 ### Create the *path operation function*
@@ -168,7 +168,7 @@ As our code is calling Couchbase and we are not using the <a href="https://docs.
 Also, Couchbase recommends not using a single `Bucket` object in multiple "<abbr title="A sequence of code being executed by the program, while at the same time, or at intervals, there can be others being executed too.">thread</abbr>s", so, we can just get the bucket directly and pass it to our utility functions:
 
 ```Python hl_lines="49-53"
-{!../../../docs_src/nosql_databases/tutorial001.py!}
+{!../../docs_src/nosql_databases/tutorial001.py!}
 ```
 
 ## Recap
index 0ab5b1337197cb7a18eb1e11092b8aab595096ac..75fd3f9b6166656903d61b5a071ddb871b9d3b86 100644 (file)
@@ -13,7 +13,7 @@ Let's say you have a Pydantic model with default values, like this one:
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-7]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-7]!}
 
 # Code below omitted 👇
 ```
@@ -22,7 +22,7 @@ Let's say you have a Pydantic model with default values, like this one:
 <summary>👀 Full file preview</summary>
 
 ```Python
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
 ```
 
 </details>
@@ -32,7 +32,7 @@ Let's say you have a Pydantic model with default values, like this one:
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py39.py[ln:1-9]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py[ln:1-9]!}
 
 # Code below omitted 👇
 ```
@@ -41,7 +41,7 @@ Let's say you have a Pydantic model with default values, like this one:
 <summary>👀 Full file preview</summary>
 
 ```Python
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
 ```
 
 </details>
@@ -51,7 +51,7 @@ Let's say you have a Pydantic model with default values, like this one:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001.py[ln:1-9]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001.py[ln:1-9]!}
 
 # Code below omitted 👇
 ```
@@ -60,7 +60,7 @@ Let's say you have a Pydantic model with default values, like this one:
 <summary>👀 Full file preview</summary>
 
 ```Python
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001.py!}
 ```
 
 </details>
@@ -74,7 +74,7 @@ If you use this model as an input like here:
 //// tab | Python 3.10+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-15]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py[ln:1-15]!}
 
 # Code below omitted 👇
 ```
@@ -83,7 +83,7 @@ If you use this model as an input like here:
 <summary>👀 Full file preview</summary>
 
 ```Python
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
 ```
 
 </details>
@@ -93,7 +93,7 @@ If you use this model as an input like here:
 //// tab | Python 3.9+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py39.py[ln:1-17]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py[ln:1-17]!}
 
 # Code below omitted 👇
 ```
@@ -102,7 +102,7 @@ If you use this model as an input like here:
 <summary>👀 Full file preview</summary>
 
 ```Python
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
 ```
 
 </details>
@@ -112,7 +112,7 @@ If you use this model as an input like here:
 //// tab | Python 3.8+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001.py[ln:1-17]!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001.py[ln:1-17]!}
 
 # Code below omitted 👇
 ```
@@ -121,7 +121,7 @@ If you use this model as an input like here:
 <summary>👀 Full file preview</summary>
 
 ```Python
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001.py!}
 ```
 
 </details>
@@ -145,7 +145,7 @@ But if you use the same model as an output, like here:
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py310.py!}
 ```
 
 ////
@@ -153,7 +153,7 @@ But if you use the same model as an output, like here:
 //// tab | Python 3.9+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001_py39.py!}
 ```
 
 ////
@@ -161,7 +161,7 @@ But if you use the same model as an output, like here:
 //// tab | Python 3.8+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial001.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial001.py!}
 ```
 
 ////
@@ -226,7 +226,7 @@ Support for `separate_input_output_schemas` was added in FastAPI `0.102.0`. 🤓
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial002_py310.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial002_py310.py!}
 ```
 
 ////
@@ -234,7 +234,7 @@ Support for `separate_input_output_schemas` was added in FastAPI `0.102.0`. 🤓
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial002_py39.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial002_py39.py!}
 ```
 
 ////
@@ -242,7 +242,7 @@ Support for `separate_input_output_schemas` was added in FastAPI `0.102.0`. 🤓
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/separate_openapi_schemas/tutorial002.py!}
+{!> ../../docs_src/separate_openapi_schemas/tutorial002.py!}
 ```
 
 ////
index e411c200c683cc23d6d8b3d2457b79a90be4e320..e73ca369b14fa82b68ccf9e6f6cba9c9f57c99cc 100644 (file)
@@ -89,7 +89,7 @@ Let's refer to the file `sql_app/database.py`.
 Let's first check all the normal Peewee code, create a Peewee database:
 
 ```Python hl_lines="3  5  22"
-{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/database.py!}
 ```
 
 /// tip
@@ -149,7 +149,7 @@ This might seem a bit complex (and it actually is), you don't really need to com
 We will create a `PeeweeConnectionState`:
 
 ```Python hl_lines="10-19"
-{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/database.py!}
 ```
 
 This class inherits from a special internal class used by Peewee.
@@ -173,7 +173,7 @@ But it doesn't give Peewee async super-powers. You should still use normal `def`
 Now, overwrite the `._state` internal attribute in the Peewee database `db` object using the new `PeeweeConnectionState`:
 
 ```Python hl_lines="24"
-{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/database.py!}
 ```
 
 /// tip
@@ -209,7 +209,7 @@ But Pydantic also uses the term "**model**" to refer to something different, the
 Import `db` from `database` (the file `database.py` from above) and use it here.
 
 ```Python hl_lines="3  6-12  15-21"
-{!../../../docs_src/sql_databases_peewee/sql_app/models.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/models.py!}
 ```
 
 /// tip
@@ -243,7 +243,7 @@ So this will help us avoiding confusion while using both.
 Create all the same Pydantic models as in the SQLAlchemy tutorial:
 
 ```Python hl_lines="16-18  21-22  25-30  34-35  38-39  42-48"
-{!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
 ```
 
 /// tip
@@ -271,7 +271,7 @@ But recent versions of Pydantic allow providing a custom class that inherits fro
 We are going to create a custom `PeeweeGetterDict` class and use it in all the same Pydantic *models* / schemas that use `orm_mode`:
 
 ```Python hl_lines="3  8-13  31  49"
-{!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
 ```
 
 Here we are checking if the attribute that is being accessed (e.g. `.items` in `some_user.items`) is an instance of `peewee.ModelSelect`.
@@ -295,7 +295,7 @@ Now let's see the file `sql_app/crud.py`.
 Create all the same CRUD utils as in the SQLAlchemy tutorial, all the code is very similar:
 
 ```Python hl_lines="1  4-5  8-9  12-13  16-20  23-24  27-30"
-{!../../../docs_src/sql_databases_peewee/sql_app/crud.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/crud.py!}
 ```
 
 There are some differences with the code for the SQLAlchemy tutorial.
@@ -319,7 +319,7 @@ And now in the file `sql_app/main.py` let's integrate and use all the other part
 In a very simplistic way create the database tables:
 
 ```Python hl_lines="9-11"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/main.py!}
 ```
 
 ### Create a dependency
@@ -327,7 +327,7 @@ In a very simplistic way create the database tables:
 Create a dependency that will connect the database right at the beginning of a request and disconnect it at the end:
 
 ```Python hl_lines="23-29"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/main.py!}
 ```
 
 Here we have an empty `yield` because we are actually not using the database object directly.
@@ -341,7 +341,7 @@ And then, in each *path operation function* that needs to access the database we
 But we are not using the value given by this dependency (it actually doesn't give any value, as it has an empty `yield`). So, we don't add it to the *path operation function* but to the *path operation decorator* in the `dependencies` parameter:
 
 ```Python hl_lines="32  40  47  59  65  72"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/main.py!}
 ```
 
 ### Context variable sub-dependency
@@ -351,7 +351,7 @@ For all the `contextvars` parts to work, we need to make sure we have an indepen
 For that, we need to create another `async` dependency `reset_db_state()` that is used as a sub-dependency in `get_db()`. It will set the value for the context variable (with just a default `dict`) that will be used as the database state for the whole request. And then the dependency `get_db()` will store in it the database state (connection, transactions, etc).
 
 ```Python hl_lines="18-20"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/main.py!}
 ```
 
 For the **next request**, as we will reset that context variable again in the `async` dependency `reset_db_state()` and then create a new connection in the `get_db()` dependency, that new request will have its own database state (connection, transactions, etc).
@@ -383,7 +383,7 @@ async def reset_db_state():
 Now, finally, here's the standard **FastAPI** *path operations* code.
 
 ```Python hl_lines="32-37  40-43  46-53  56-62  65-68  71-79"
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/main.py!}
 ```
 
 ### About `def` vs `async def`
@@ -500,31 +500,31 @@ Repeat the same process with the 10 tabs. This time all of them will wait and yo
 * `sql_app/database.py`:
 
 ```Python
-{!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/database.py!}
 ```
 
 * `sql_app/models.py`:
 
 ```Python
-{!../../../docs_src/sql_databases_peewee/sql_app/models.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/models.py!}
 ```
 
 * `sql_app/schemas.py`:
 
 ```Python
-{!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
 ```
 
 * `sql_app/crud.py`:
 
 ```Python
-{!../../../docs_src/sql_databases_peewee/sql_app/crud.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/crud.py!}
 ```
 
 * `sql_app/main.py`:
 
 ```Python
-{!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
+{!../../docs_src/sql_databases_peewee/sql_app/main.py!}
 ```
 
 ## Technical Details
index 6994adb5faac3ab5258f54fb3905d0c0f7bb5561..ee192d8cbf40b6e5f4e4701b706515fe12416d5c 100644 (file)
@@ -23,7 +23,7 @@ If you are a Python expert, and you already know everything about type hints, sk
 Let's start with a simple example:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 Calling this program outputs:
@@ -39,7 +39,7 @@ The function does the following:
 * <abbr title="Puts them together, as one. With the contents of one after the other.">Concatenates</abbr> them with a space in the middle.
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### Edit it
@@ -83,7 +83,7 @@ That's it.
 Those are the "type hints":
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 That is not the same as declaring default values like would be with:
@@ -113,7 +113,7 @@ With that, you can scroll, seeing the options, until you find the one that "ring
 Check this function, it already has type hints:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 Because the editor knows the types of the variables, you don't only get completion, you also get error checks:
@@ -123,7 +123,7 @@ Because the editor knows the types of the variables, you don't only get completi
 Now you know that you have to fix it, convert `age` to a string with `str(age)`:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## Declaring types
@@ -144,7 +144,7 @@ You can use, for example:
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### Generic types with type parameters
@@ -182,7 +182,7 @@ As the type, put `list`.
 As the list is a type that contains some internal types, you put them in square brackets:
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006_py39.py!}
+{!> ../../docs_src/python_types/tutorial006_py39.py!}
 ```
 
 ////
@@ -192,7 +192,7 @@ As the list is a type that contains some internal types, you put them in square
 From `typing`, import `List` (with a capital `L`):
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 Declare the variable, with the same colon (`:`) syntax.
@@ -202,7 +202,7 @@ As the type, put the `List` that you imported from `typing`.
 As the list is a type that contains some internal types, you put them in square brackets:
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 ////
@@ -240,7 +240,7 @@ You would do the same to declare `tuple`s and `set`s:
 //// tab | Python 3.9+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial007_py39.py!}
+{!> ../../docs_src/python_types/tutorial007_py39.py!}
 ```
 
 ////
@@ -248,7 +248,7 @@ You would do the same to declare `tuple`s and `set`s:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial007.py!}
+{!> ../../docs_src/python_types/tutorial007.py!}
 ```
 
 ////
@@ -269,7 +269,7 @@ The second type parameter is for the values of the `dict`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008_py39.py!}
+{!> ../../docs_src/python_types/tutorial008_py39.py!}
 ```
 
 ////
@@ -277,7 +277,7 @@ The second type parameter is for the values of the `dict`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008.py!}
+{!> ../../docs_src/python_types/tutorial008.py!}
 ```
 
 ////
@@ -299,7 +299,7 @@ In Python 3.10 there's also a **new syntax** where you can put the possible type
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008b_py310.py!}
+{!> ../../docs_src/python_types/tutorial008b_py310.py!}
 ```
 
 ////
@@ -307,7 +307,7 @@ In Python 3.10 there's also a **new syntax** where you can put the possible type
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008b.py!}
+{!> ../../docs_src/python_types/tutorial008b.py!}
 ```
 
 ////
@@ -321,7 +321,7 @@ You can declare that a value could have a type, like `str`, but that it could al
 In Python 3.6 and above (including Python 3.10) you can declare it by importing and using `Optional` from the `typing` module.
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 Using `Optional[str]` instead of just `str` will let the editor help you detect errors where you could be assuming that a value is always a `str`, when it could actually be `None` too.
@@ -333,7 +333,7 @@ This also means that in Python 3.10, you can use `Something | None`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial009_py310.py!}
+{!> ../../docs_src/python_types/tutorial009_py310.py!}
 ```
 
 ////
@@ -341,7 +341,7 @@ This also means that in Python 3.10, you can use `Something | None`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009.py!}
+{!> ../../docs_src/python_types/tutorial009.py!}
 ```
 
 ////
@@ -349,7 +349,7 @@ This also means that in Python 3.10, you can use `Something | None`:
 //// tab | Python 3.8+ alternative
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009b.py!}
+{!> ../../docs_src/python_types/tutorial009b.py!}
 ```
 
 ////
@@ -370,7 +370,7 @@ It's just about the words and names. But those words can affect how you and your
 As an example, let's take this function:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009c.py!}
+{!../../docs_src/python_types/tutorial009c.py!}
 ```
 
 The parameter `name` is defined as `Optional[str]`, but it is **not optional**, you cannot call the function without the parameter:
@@ -388,7 +388,7 @@ say_hi(name=None)  # This works, None is valid 🎉
 The good news is, once you are on Python 3.10 you won't have to worry about that, as you will be able to simply use `|` to define unions of types:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009c_py310.py!}
+{!../../docs_src/python_types/tutorial009c_py310.py!}
 ```
 
 And then you won't have to worry about names like `Optional` and `Union`. 😎
@@ -452,13 +452,13 @@ You can also declare a class as the type of a variable.
 Let's say you have a class `Person`, with a name:
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Then you can declare a variable to be of type `Person`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 And then, again, you get all the editor support:
@@ -486,7 +486,7 @@ An example from the official Pydantic docs:
 //// tab | Python 3.10+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py310.py!}
+{!> ../../docs_src/python_types/tutorial011_py310.py!}
 ```
 
 ////
@@ -494,7 +494,7 @@ An example from the official Pydantic docs:
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py39.py!}
+{!> ../../docs_src/python_types/tutorial011_py39.py!}
 ```
 
 ////
@@ -502,7 +502,7 @@ An example from the official Pydantic docs:
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011.py!}
+{!> ../../docs_src/python_types/tutorial011.py!}
 ```
 
 ////
@@ -532,7 +532,7 @@ Python also has a feature that allows putting **additional <abbr title="Data abo
 In Python 3.9, `Annotated` is part of the standard library, so you can import it from `typing`.
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial013_py39.py!}
+{!> ../../docs_src/python_types/tutorial013_py39.py!}
 ```
 
 ////
@@ -544,7 +544,7 @@ In versions below Python 3.9, you import `Annotated` from `typing_extensions`.
 It will already be installed with **FastAPI**.
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial013.py!}
+{!> ../../docs_src/python_types/tutorial013.py!}
 ```
 
 ////
index 8b4476e419a797c46c8970b483baefa3e9dc0f3f..1cd460b072a25544ba37c3806b56003c4c8d84d8 100644 (file)
@@ -16,7 +16,7 @@ This includes, for example:
 First, import `BackgroundTasks` and define a parameter in your *path operation function* with a type declaration of `BackgroundTasks`:
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 **FastAPI** will create the object of type `BackgroundTasks` for you and pass it as that parameter.
@@ -34,7 +34,7 @@ In this case, the task function will write to a file (simulating sending an emai
 And as the write operation doesn't use `async` and `await`, we define the function with normal `def`:
 
 ```Python hl_lines="6-9"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 ## Add the background task
@@ -42,7 +42,7 @@ And as the write operation doesn't use `async` and `await`, we define the functi
 Inside of your *path operation function*, pass your task function to the *background tasks* object with the method `.add_task()`:
 
 ```Python hl_lines="14"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 `.add_task()` receives as arguments:
@@ -60,7 +60,7 @@ Using `BackgroundTasks` also works with the dependency injection system, you can
 //// tab | Python 3.10+
 
 ```Python hl_lines="13  15  22  25"
-{!> ../../../docs_src/background_tasks/tutorial002_an_py310.py!}
+{!> ../../docs_src/background_tasks/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -68,7 +68,7 @@ Using `BackgroundTasks` also works with the dependency injection system, you can
 //// tab | Python 3.9+
 
 ```Python hl_lines="13  15  22  25"
-{!> ../../../docs_src/background_tasks/tutorial002_an_py39.py!}
+{!> ../../docs_src/background_tasks/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -76,7 +76,7 @@ Using `BackgroundTasks` also works with the dependency injection system, you can
 //// tab | Python 3.8+
 
 ```Python hl_lines="14  16  23  26"
-{!> ../../../docs_src/background_tasks/tutorial002_an.py!}
+{!> ../../docs_src/background_tasks/tutorial002_an.py!}
 ```
 
 ////
@@ -90,7 +90,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="11  13  20  23"
-{!> ../../../docs_src/background_tasks/tutorial002_py310.py!}
+{!> ../../docs_src/background_tasks/tutorial002_py310.py!}
 ```
 
 ////
@@ -104,7 +104,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="13  15  22  25"
-{!> ../../../docs_src/background_tasks/tutorial002.py!}
+{!> ../../docs_src/background_tasks/tutorial002.py!}
 ```
 
 ////
index 1c33fd051c4a16ea9bff957ace1ab0a0dbdec67c..4ec9b15bdb50c403714c3c1ce729dad24e48b4b3 100644 (file)
@@ -86,7 +86,7 @@ You can create the *path operations* for that module using `APIRouter`.
 You import it and create an "instance" the same way you would with the class `FastAPI`:
 
 ```Python hl_lines="1  3" title="app/routers/users.py"
-{!../../../docs_src/bigger_applications/app/routers/users.py!}
+{!../../docs_src/bigger_applications/app/routers/users.py!}
 ```
 
 ### *Path operations* with `APIRouter`
@@ -96,7 +96,7 @@ And then you use it to declare your *path operations*.
 Use it the same way you would use the `FastAPI` class:
 
 ```Python hl_lines="6  11  16" title="app/routers/users.py"
-{!../../../docs_src/bigger_applications/app/routers/users.py!}
+{!../../docs_src/bigger_applications/app/routers/users.py!}
 ```
 
 You can think of `APIRouter` as a "mini `FastAPI`" class.
@@ -124,7 +124,7 @@ We will now use a simple dependency to read a custom `X-Token` header:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3  6-8" title="app/dependencies.py"
-{!> ../../../docs_src/bigger_applications/app_an_py39/dependencies.py!}
+{!> ../../docs_src/bigger_applications/app_an_py39/dependencies.py!}
 ```
 
 ////
@@ -132,7 +132,7 @@ We will now use a simple dependency to read a custom `X-Token` header:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  5-7" title="app/dependencies.py"
-{!> ../../../docs_src/bigger_applications/app_an/dependencies.py!}
+{!> ../../docs_src/bigger_applications/app_an/dependencies.py!}
 ```
 
 ////
@@ -146,7 +146,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1  4-6" title="app/dependencies.py"
-{!> ../../../docs_src/bigger_applications/app/dependencies.py!}
+{!> ../../docs_src/bigger_applications/app/dependencies.py!}
 ```
 
 ////
@@ -182,7 +182,7 @@ We know all the *path operations* in this module have the same:
 So, instead of adding all that to each *path operation*, we can add it to the `APIRouter`.
 
 ```Python hl_lines="5-10  16  21" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 As the path of each *path operation* has to start with `/`, like in:
@@ -243,7 +243,7 @@ And we need to get the dependency function from the module `app.dependencies`, t
 So we use a relative import with `..` for the dependencies:
 
 ```Python hl_lines="3" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 #### How relative imports work
@@ -316,7 +316,7 @@ We are not adding the prefix `/items` nor the `tags=["items"]` to each *path ope
 But we can still add _more_ `tags` that will be applied to a specific *path operation*, and also some extra `responses` specific to that *path operation*:
 
 ```Python hl_lines="30-31" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 /// tip
@@ -344,7 +344,7 @@ You import and create a `FastAPI` class as normally.
 And we can even declare [global dependencies](dependencies/global-dependencies.md){.internal-link target=_blank} that will be combined with the dependencies for each `APIRouter`:
 
 ```Python hl_lines="1  3  7" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 ### Import the `APIRouter`
@@ -352,7 +352,7 @@ And we can even declare [global dependencies](dependencies/global-dependencies.m
 Now we import the other submodules that have `APIRouter`s:
 
 ```Python hl_lines="4-5" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 As the files `app/routers/users.py` and `app/routers/items.py` are submodules that are part of the same Python package `app`, we can use a single dot `.` to import them using "relative imports".
@@ -417,7 +417,7 @@ the `router` from `users` would overwrite the one from `items` and we wouldn't b
 So, to be able to use both of them in the same file, we import the submodules directly:
 
 ```Python hl_lines="5" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 ### Include the `APIRouter`s for `users` and `items`
@@ -425,7 +425,7 @@ So, to be able to use both of them in the same file, we import the submodules di
 Now, let's include the `router`s from the submodules `users` and `items`:
 
 ```Python hl_lines="10-11" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 /// info
@@ -467,7 +467,7 @@ It contains an `APIRouter` with some admin *path operations* that your organizat
 For this example it will be super simple. But let's say that because it is shared with other projects in the organization, we cannot modify it and add a `prefix`, `dependencies`, `tags`, etc. directly to the `APIRouter`:
 
 ```Python hl_lines="3" title="app/internal/admin.py"
-{!../../../docs_src/bigger_applications/app/internal/admin.py!}
+{!../../docs_src/bigger_applications/app/internal/admin.py!}
 ```
 
 But we still want to set a custom `prefix` when including the `APIRouter` so that all its *path operations* start with `/admin`, we want to secure it with the `dependencies` we already have for this project, and we want to include `tags` and `responses`.
@@ -475,7 +475,7 @@ But we still want to set a custom `prefix` when including the `APIRouter` so tha
 We can declare all that without having to modify the original `APIRouter` by passing those parameters to `app.include_router()`:
 
 ```Python hl_lines="14-17" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 That way, the original `APIRouter` will stay unmodified, so we can still share that same `app/internal/admin.py` file with other projects in the organization.
@@ -498,7 +498,7 @@ We can also add *path operations* directly to the `FastAPI` app.
 Here we do it... just to show that we can 🤷:
 
 ```Python hl_lines="21-23" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 and it will work correctly, together with all the other *path operations* added with `app.include_router()`.
index 466df29f1455183ab3771146949376afa80c9036..30a5c623fb4473f16581d4e10b4026a8bdf3b4ca 100644 (file)
@@ -9,7 +9,7 @@ First, you have to import it:
 //// tab | Python 3.10+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ First, you have to import it:
 //// tab | Python 3.9+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ First, you have to import it:
 //// tab | Python 3.8+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@ You can then use `Field` with model attributes:
 //// tab | Python 3.10+
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@ You can then use `Field` with model attributes:
 //// tab | Python 3.9+
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -87,7 +87,7 @@ You can then use `Field` with model attributes:
 //// tab | Python 3.8+
 
 ```Python hl_lines="12-15"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
 ```
 
 ////
@@ -101,7 +101,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9-12"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
@@ -115,7 +115,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
index d63cd2529bd4729301003ada07abe290240c7236..eebbb3fe45c7be5c09216fde97f5bcbf48ca1889 100644 (file)
@@ -11,7 +11,7 @@ And you can also declare body parameters as optional, by setting the default to
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-20"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@ And you can also declare body parameters as optional, by setting the default to
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-20"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ And you can also declare body parameters as optional, by setting the default to
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-21"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an.py!}
 ```
 
 ////
@@ -41,7 +41,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="17-19"
-{!> ../../../docs_src/body_multiple_params/tutorial001_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -55,7 +55,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="19-21"
-{!> ../../../docs_src/body_multiple_params/tutorial001.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@ But you can also declare multiple body parameters, e.g. `item` and `user`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial002_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -92,7 +92,7 @@ But you can also declare multiple body parameters, e.g. `item` and `user`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial002.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002.py!}
 ```
 
 ////
@@ -139,7 +139,7 @@ But you can instruct **FastAPI** to treat it as another body key using `Body`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ But you can instruct **FastAPI** to treat it as another body key using `Body`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -155,7 +155,7 @@ But you can instruct **FastAPI** to treat it as another body key using `Body`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an.py!}
 ```
 
 ////
@@ -169,7 +169,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial003_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -183,7 +183,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial003.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003.py!}
 ```
 
 ////
@@ -229,7 +229,7 @@ For example:
 //// tab | Python 3.10+
 
 ```Python hl_lines="28"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ For example:
 //// tab | Python 3.9+
 
 ```Python hl_lines="28"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ For example:
 //// tab | Python 3.8+
 
 ```Python hl_lines="29"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an.py!}
 ```
 
 ////
@@ -259,7 +259,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="26"
-{!> ../../../docs_src/body_multiple_params/tutorial004_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="28"
-{!> ../../../docs_src/body_multiple_params/tutorial004.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004.py!}
 ```
 
 ////
@@ -301,7 +301,7 @@ as in:
 //// tab | Python 3.10+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -309,7 +309,7 @@ as in:
 //// tab | Python 3.9+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -317,7 +317,7 @@ as in:
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an.py!}
 ```
 
 ////
@@ -331,7 +331,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/body_multiple_params/tutorial005_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_py310.py!}
 ```
 
 ////
@@ -345,7 +345,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005.py!}
 ```
 
 ////
index d2bda5979a101474f26a2946323325f838e447e6..38f3eb136825e2d1a8bd2f350a7d17b424092296 100644 (file)
@@ -9,7 +9,7 @@ You can define an attribute to be a subtype. For example, a Python `list`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial001_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ You can define an attribute to be a subtype. For example, a Python `list`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial001.py!}
+{!> ../../docs_src/body_nested_models/tutorial001.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@ In Python 3.9 and above you can use the standard `list` to declare these type an
 But in Python versions before 3.9 (3.6 and above), you first need to import `List` from standard Python's `typing` module:
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/body_nested_models/tutorial002.py!}
+{!> ../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ### Declare a `list` with a type parameter
@@ -68,7 +68,7 @@ So, in our example, we can make `tags` be specifically a "list of strings":
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial002_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -76,7 +76,7 @@ So, in our example, we can make `tags` be specifically a "list of strings":
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial002_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial002_py39.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@ So, in our example, we can make `tags` be specifically a "list of strings":
 //// tab | Python 3.8+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial002.py!}
+{!> ../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ////
@@ -100,7 +100,7 @@ Then we can declare `tags` as a set of strings:
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial003_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial003_py310.py!}
 ```
 
 ////
@@ -108,7 +108,7 @@ Then we can declare `tags` as a set of strings:
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial003_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial003_py39.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ Then we can declare `tags` as a set of strings:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  14"
-{!> ../../../docs_src/body_nested_models/tutorial003.py!}
+{!> ../../docs_src/body_nested_models/tutorial003.py!}
 ```
 
 ////
@@ -144,7 +144,7 @@ For example, we can define an `Image` model:
 //// tab | Python 3.10+
 
 ```Python hl_lines="7-9"
-{!> ../../../docs_src/body_nested_models/tutorial004_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py310.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ For example, we can define an `Image` model:
 //// tab | Python 3.9+
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/body_nested_models/tutorial004_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -160,7 +160,7 @@ For example, we can define an `Image` model:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/body_nested_models/tutorial004.py!}
+{!> ../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ And then we can use it as the type of an attribute:
 //// tab | Python 3.10+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_nested_models/tutorial004_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py310.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ And then we can use it as the type of an attribute:
 //// tab | Python 3.9+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial004_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -188,7 +188,7 @@ And then we can use it as the type of an attribute:
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial004.py!}
+{!> ../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ////
@@ -227,7 +227,7 @@ For example, as in the `Image` model we have a `url` field, we can declare it to
 //// tab | Python 3.10+
 
 ```Python hl_lines="2  8"
-{!> ../../../docs_src/body_nested_models/tutorial005_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial005_py310.py!}
 ```
 
 ////
@@ -235,7 +235,7 @@ For example, as in the `Image` model we have a `url` field, we can declare it to
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  10"
-{!> ../../../docs_src/body_nested_models/tutorial005_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial005_py39.py!}
 ```
 
 ////
@@ -243,7 +243,7 @@ For example, as in the `Image` model we have a `url` field, we can declare it to
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  10"
-{!> ../../../docs_src/body_nested_models/tutorial005.py!}
+{!> ../../docs_src/body_nested_models/tutorial005.py!}
 ```
 
 ////
@@ -257,7 +257,7 @@ You can also use Pydantic models as subtypes of `list`, `set`, etc.:
 //// tab | Python 3.10+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_nested_models/tutorial006_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial006_py310.py!}
 ```
 
 ////
@@ -265,7 +265,7 @@ You can also use Pydantic models as subtypes of `list`, `set`, etc.:
 //// tab | Python 3.9+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial006_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial006_py39.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ You can also use Pydantic models as subtypes of `list`, `set`, etc.:
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial006.py!}
+{!> ../../docs_src/body_nested_models/tutorial006.py!}
 ```
 
 ////
@@ -317,7 +317,7 @@ You can define arbitrarily deeply nested models:
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  12  18  21  25"
-{!> ../../../docs_src/body_nested_models/tutorial007_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial007_py310.py!}
 ```
 
 ////
@@ -325,7 +325,7 @@ You can define arbitrarily deeply nested models:
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  14  20  23  27"
-{!> ../../../docs_src/body_nested_models/tutorial007_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial007_py39.py!}
 ```
 
 ////
@@ -333,7 +333,7 @@ You can define arbitrarily deeply nested models:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  14  20  23  27"
-{!> ../../../docs_src/body_nested_models/tutorial007.py!}
+{!> ../../docs_src/body_nested_models/tutorial007.py!}
 ```
 
 ////
@@ -363,7 +363,7 @@ as in:
 //// tab | Python 3.9+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/body_nested_models/tutorial008_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial008_py39.py!}
 ```
 
 ////
@@ -371,7 +371,7 @@ as in:
 //// tab | Python 3.8+
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/body_nested_models/tutorial008.py!}
+{!> ../../docs_src/body_nested_models/tutorial008.py!}
 ```
 
 ////
@@ -407,7 +407,7 @@ In this case, you would accept any `dict` as long as it has `int` keys with `flo
 //// tab | Python 3.9+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/body_nested_models/tutorial009_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial009_py39.py!}
 ```
 
 ////
@@ -415,7 +415,7 @@ In this case, you would accept any `dict` as long as it has `int` keys with `flo
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/body_nested_models/tutorial009.py!}
+{!> ../../docs_src/body_nested_models/tutorial009.py!}
 ```
 
 ////
index 3257f9a08224df12f17cb739bf6250e99d7a6534..3ac2e391497fbded09267630851cbed9836766b8 100644 (file)
@@ -9,7 +9,7 @@ You can use the `jsonable_encoder` to convert the input data to data that can be
 //// tab | Python 3.10+
 
 ```Python hl_lines="28-33"
-{!> ../../../docs_src/body_updates/tutorial001_py310.py!}
+{!> ../../docs_src/body_updates/tutorial001_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ You can use the `jsonable_encoder` to convert the input data to data that can be
 //// tab | Python 3.9+
 
 ```Python hl_lines="30-35"
-{!> ../../../docs_src/body_updates/tutorial001_py39.py!}
+{!> ../../docs_src/body_updates/tutorial001_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ You can use the `jsonable_encoder` to convert the input data to data that can be
 //// tab | Python 3.8+
 
 ```Python hl_lines="30-35"
-{!> ../../../docs_src/body_updates/tutorial001.py!}
+{!> ../../docs_src/body_updates/tutorial001.py!}
 ```
 
 ////
@@ -87,7 +87,7 @@ Then you can use this to generate a `dict` with only the data that was set (sent
 //// tab | Python 3.10+
 
 ```Python hl_lines="32"
-{!> ../../../docs_src/body_updates/tutorial002_py310.py!}
+{!> ../../docs_src/body_updates/tutorial002_py310.py!}
 ```
 
 ////
@@ -95,7 +95,7 @@ Then you can use this to generate a `dict` with only the data that was set (sent
 //// tab | Python 3.9+
 
 ```Python hl_lines="34"
-{!> ../../../docs_src/body_updates/tutorial002_py39.py!}
+{!> ../../docs_src/body_updates/tutorial002_py39.py!}
 ```
 
 ////
@@ -103,7 +103,7 @@ Then you can use this to generate a `dict` with only the data that was set (sent
 //// tab | Python 3.8+
 
 ```Python hl_lines="34"
-{!> ../../../docs_src/body_updates/tutorial002.py!}
+{!> ../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ////
@@ -125,7 +125,7 @@ Like `stored_item_model.model_copy(update=update_data)`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="33"
-{!> ../../../docs_src/body_updates/tutorial002_py310.py!}
+{!> ../../docs_src/body_updates/tutorial002_py310.py!}
 ```
 
 ////
@@ -133,7 +133,7 @@ Like `stored_item_model.model_copy(update=update_data)`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="35"
-{!> ../../../docs_src/body_updates/tutorial002_py39.py!}
+{!> ../../docs_src/body_updates/tutorial002_py39.py!}
 ```
 
 ////
@@ -141,7 +141,7 @@ Like `stored_item_model.model_copy(update=update_data)`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="35"
-{!> ../../../docs_src/body_updates/tutorial002.py!}
+{!> ../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ////
@@ -164,7 +164,7 @@ In summary, to apply partial updates you would:
 //// tab | Python 3.10+
 
 ```Python hl_lines="28-35"
-{!> ../../../docs_src/body_updates/tutorial002_py310.py!}
+{!> ../../docs_src/body_updates/tutorial002_py310.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ In summary, to apply partial updates you would:
 //// tab | Python 3.9+
 
 ```Python hl_lines="30-37"
-{!> ../../../docs_src/body_updates/tutorial002_py39.py!}
+{!> ../../docs_src/body_updates/tutorial002_py39.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ In summary, to apply partial updates you would:
 //// tab | Python 3.8+
 
 ```Python hl_lines="30-37"
-{!> ../../../docs_src/body_updates/tutorial002.py!}
+{!> ../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ////
index 83f08ce84f4099526e1341926577bfcf6e9e1a6c..14d62141863ab8699182e5ea273382a7071892b4 100644 (file)
@@ -25,7 +25,7 @@ First, you need to import `BaseModel` from `pydantic`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -33,7 +33,7 @@ First, you need to import `BaseModel` from `pydantic`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@ Use standard Python types for all the attributes:
 //// tab | Python 3.10+
 
 ```Python hl_lines="5-9"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -55,7 +55,7 @@ Use standard Python types for all the attributes:
 //// tab | Python 3.8+
 
 ```Python hl_lines="7-11"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -89,7 +89,7 @@ To add it to your *path operation*, declare it the same way you declared path an
 //// tab | Python 3.10+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ To add it to your *path operation*, declare it the same way you declared path an
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -170,7 +170,7 @@ Inside of the function, you can access all the attributes of the model object di
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/body/tutorial002_py310.py!}
+{!> ../../docs_src/body/tutorial002_py310.py!}
 ```
 
 ////
@@ -178,7 +178,7 @@ Inside of the function, you can access all the attributes of the model object di
 //// tab | Python 3.8+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/body/tutorial002.py!}
+{!> ../../docs_src/body/tutorial002.py!}
 ```
 
 ////
@@ -192,7 +192,7 @@ You can declare path parameters and request body at the same time.
 //// tab | Python 3.10+
 
 ```Python hl_lines="15-16"
-{!> ../../../docs_src/body/tutorial003_py310.py!}
+{!> ../../docs_src/body/tutorial003_py310.py!}
 ```
 
 ////
@@ -200,7 +200,7 @@ You can declare path parameters and request body at the same time.
 //// tab | Python 3.8+
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/body/tutorial003.py!}
+{!> ../../docs_src/body/tutorial003.py!}
 ```
 
 ////
@@ -214,7 +214,7 @@ You can also declare **body**, **path** and **query** parameters, all at the sam
 //// tab | Python 3.10+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial004_py310.py!}
+{!> ../../docs_src/body/tutorial004_py310.py!}
 ```
 
 ////
@@ -222,7 +222,7 @@ You can also declare **body**, **path** and **query** parameters, all at the sam
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial004.py!}
+{!> ../../docs_src/body/tutorial004.py!}
 ```
 
 ////
index 2aa3a1f593692f1a0a60f786d2e24dae1e62a6a7..62cafbb23d13f6db1a1c10db19aef93bbc97eac6 100644 (file)
@@ -23,7 +23,7 @@ Declare the **cookie** parameters that you need in a **Pydantic model**, and the
 //// tab | Python 3.10+
 
 ```Python hl_lines="9-12  16"
-{!> ../../../docs_src/cookie_param_models/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_param_models/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Declare the **cookie** parameters that you need in a **Pydantic model**, and the
 //// tab | Python 3.9+
 
 ```Python hl_lines="9-12  16"
-{!> ../../../docs_src/cookie_param_models/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_param_models/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Declare the **cookie** parameters that you need in a **Pydantic model**, and the
 //// tab | Python 3.8+
 
 ```Python hl_lines="10-13  17"
-{!> ../../../docs_src/cookie_param_models/tutorial001_an.py!}
+{!> ../../docs_src/cookie_param_models/tutorial001_an.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7-10  14"
-{!> ../../../docs_src/cookie_param_models/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_param_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -67,7 +67,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9-12  16"
-{!> ../../../docs_src/cookie_param_models/tutorial001.py!}
+{!> ../../docs_src/cookie_param_models/tutorial001.py!}
 ```
 
 ////
@@ -103,7 +103,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/cookie_param_models/tutorial002_an_py39.py!}
+{!> ../../docs_src/cookie_param_models/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -111,7 +111,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/cookie_param_models/tutorial002_an.py!}
+{!> ../../docs_src/cookie_param_models/tutorial002_an.py!}
 ```
 
 ////
@@ -125,7 +125,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/cookie_param_models/tutorial002.py!}
+{!> ../../docs_src/cookie_param_models/tutorial002.py!}
 ```
 
 ////
index 0214a9c382add5b485bad577711c5f03f500fd51..8804f854f44322360f5e89175e8dcf2398b429d3 100644 (file)
@@ -9,7 +9,7 @@ First import `Cookie`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ First import `Cookie`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ First import `Cookie`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
@@ -67,7 +67,7 @@ You can define the default value as well as all the extra validation or annotati
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ You can define the default value as well as all the extra validation or annotati
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@ You can define the default value as well as all the extra validation or annotati
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -111,7 +111,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
index 7dd0a5df5831c7557cc60d762d6b5e39fe0f6084..8dfc9bad9504e0c3644ad1fa5a2c60d4d409728a 100644 (file)
@@ -47,7 +47,7 @@ You can also specify whether your backend allows:
 * Specific HTTP headers or all of them with the wildcard `"*"`.
 
 ```Python hl_lines="2  6-11  13-19"
-{!../../../docs_src/cors/tutorial001.py!}
+{!../../docs_src/cors/tutorial001.py!}
 ```
 
 The default parameters used by the `CORSMiddleware` implementation are restrictive by default, so you'll need to explicitly enable particular origins, methods, or headers, in order for browsers to be permitted to use them in a Cross-Domain context.
index c520a631d3fb2c39792aede208a80b1178aac5b5..6c01778538438dba371dadb8ec00ee17d021dec3 100644 (file)
@@ -7,7 +7,7 @@ You can connect the debugger in your editor, for example with Visual Studio Code
 In your FastAPI application, import and run `uvicorn` directly:
 
 ```Python hl_lines="1  15"
-{!../../../docs_src/debugging/tutorial001.py!}
+{!../../docs_src/debugging/tutorial001.py!}
 ```
 
 ### About `__name__ == "__main__"`
index b3394f14e7c255edded7e35eb9d6c09449e0070a..defd61a0dd0532f29b689cee3e05dd4e07a3704b 100644 (file)
@@ -9,7 +9,7 @@ In the previous example, we were returning a `dict` from our dependency ("depend
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ In the previous example, we were returning a `dict` from our dependency ("depend
 //// tab | Python 3.9+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ In the previous example, we were returning a `dict` from our dependency ("depend
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -122,7 +122,7 @@ Then, we can change the dependency "dependable" `common_parameters` from above t
 //// tab | Python 3.10+
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -130,7 +130,7 @@ Then, we can change the dependency "dependable" `common_parameters` from above t
 //// tab | Python 3.9+
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -138,7 +138,7 @@ Then, we can change the dependency "dependable" `common_parameters` from above t
 //// tab | Python 3.8+
 
 ```Python hl_lines="12-16"
-{!> ../../../docs_src/dependencies/tutorial002_an.py!}
+{!> ../../docs_src/dependencies/tutorial002_an.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9-13"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -166,7 +166,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -176,7 +176,7 @@ Pay attention to the `__init__` method used to create the instance of the class:
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -184,7 +184,7 @@ Pay attention to the `__init__` method used to create the instance of the class:
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -192,7 +192,7 @@ Pay attention to the `__init__` method used to create the instance of the class:
 //// tab | Python 3.8+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial002_an.py!}
+{!> ../../docs_src/dependencies/tutorial002_an.py!}
 ```
 
 ////
@@ -206,7 +206,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -220,7 +220,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -230,7 +230,7 @@ Prefer to use the `Annotated` version if possible.
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -238,7 +238,7 @@ Prefer to use the `Annotated` version if possible.
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -246,7 +246,7 @@ Prefer to use the `Annotated` version if possible.
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -260,7 +260,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -274,7 +274,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -296,7 +296,7 @@ Now you can declare your dependency using this class.
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -304,7 +304,7 @@ Now you can declare your dependency using this class.
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -312,7 +312,7 @@ Now you can declare your dependency using this class.
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial002_an.py!}
+{!> ../../docs_src/dependencies/tutorial002_an.py!}
 ```
 
 ////
@@ -326,7 +326,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -340,7 +340,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -440,7 +440,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -448,7 +448,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -456,7 +456,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial003_an.py!}
+{!> ../../docs_src/dependencies/tutorial003_an.py!}
 ```
 
 ////
@@ -470,7 +470,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial003_py310.py!}
+{!> ../../docs_src/dependencies/tutorial003_py310.py!}
 ```
 
 ////
@@ -484,7 +484,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003.py!}
+{!> ../../docs_src/dependencies/tutorial003.py!}
 ```
 
 ////
@@ -578,7 +578,7 @@ The same example would then look like:
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -586,7 +586,7 @@ The same example would then look like:
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -594,7 +594,7 @@ The same example would then look like:
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial004_an.py!}
+{!> ../../docs_src/dependencies/tutorial004_an.py!}
 ```
 
 ////
@@ -608,7 +608,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial004_py310.py!}
+{!> ../../docs_src/dependencies/tutorial004_py310.py!}
 ```
 
 ////
@@ -622,7 +622,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004.py!}
+{!> ../../docs_src/dependencies/tutorial004.py!}
 ```
 
 ////
index 7c3ac792224c11c8fe7f47c682564a3b95a5e306..e89d520be36570834c656f77ff03d664669928c6 100644 (file)
@@ -17,7 +17,7 @@ It should be a `list` of `Depends()`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ It should be a `list` of `Depends()`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ They can declare request requirements (like headers) or other sub-dependencies:
 //// tab | Python 3.9+
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@ They can declare request requirements (like headers) or other sub-dependencies:
 //// tab | Python 3.8+
 
 ```Python hl_lines="7  12"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="6  11"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
@@ -109,7 +109,7 @@ These dependencies can `raise` exceptions, the same as normal dependencies:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ These dependencies can `raise` exceptions, the same as normal dependencies:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  14"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -131,7 +131,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
@@ -145,7 +145,7 @@ So, you can reuse a normal dependency (that returns a value) you already use som
 //// tab | Python 3.9+
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -153,7 +153,7 @@ So, you can reuse a normal dependency (that returns a value) you already use som
 //// tab | Python 3.8+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -167,7 +167,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9  14"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
index 2a3ac2237775dee9a500b7cf67a48ecd94882248..97da668aa0a767bb7452c8db7c7f2bd2a19aa84c 100644 (file)
@@ -30,19 +30,19 @@ For example, you could use this to create a database session and close it after
 Only the code prior to and including the `yield` statement is executed before creating a response:
 
 ```Python hl_lines="2-4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 The yielded value is what is injected into *path operations* and other dependencies:
 
 ```Python hl_lines="4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 The code following the `yield` statement is executed after the response has been delivered:
 
 ```Python hl_lines="5-6"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 /// tip
@@ -64,7 +64,7 @@ So, you can look for that specific exception inside the dependency with `except
 In the same way, you can use `finally` to make sure the exit steps are executed, no matter if there was an exception or not.
 
 ```Python hl_lines="3  5"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 ## Sub-dependencies with `yield`
@@ -78,7 +78,7 @@ For example, `dependency_c` can have a dependency on `dependency_b`, and `depend
 //// tab | Python 3.9+
 
 ```Python hl_lines="6  14  22"
-{!> ../../../docs_src/dependencies/tutorial008_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -86,7 +86,7 @@ For example, `dependency_c` can have a dependency on `dependency_b`, and `depend
 //// tab | Python 3.8+
 
 ```Python hl_lines="5  13  21"
-{!> ../../../docs_src/dependencies/tutorial008_an.py!}
+{!> ../../docs_src/dependencies/tutorial008_an.py!}
 ```
 
 ////
@@ -100,7 +100,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="4  12  20"
-{!> ../../../docs_src/dependencies/tutorial008.py!}
+{!> ../../docs_src/dependencies/tutorial008.py!}
 ```
 
 ////
@@ -114,7 +114,7 @@ And, in turn, `dependency_b` needs the value from `dependency_a` (here named `de
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-19  26-27"
-{!> ../../../docs_src/dependencies/tutorial008_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -122,7 +122,7 @@ And, in turn, `dependency_b` needs the value from `dependency_a` (here named `de
 //// tab | Python 3.8+
 
 ```Python hl_lines="17-18  25-26"
-{!> ../../../docs_src/dependencies/tutorial008_an.py!}
+{!> ../../docs_src/dependencies/tutorial008_an.py!}
 ```
 
 ////
@@ -136,7 +136,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="16-17  24-25"
-{!> ../../../docs_src/dependencies/tutorial008.py!}
+{!> ../../docs_src/dependencies/tutorial008.py!}
 ```
 
 ////
@@ -174,7 +174,7 @@ But it's there for you if you need it. 🤓
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-22  31"
-{!> ../../../docs_src/dependencies/tutorial008b_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008b_an_py39.py!}
 ```
 
 ////
@@ -182,7 +182,7 @@ But it's there for you if you need it. 🤓
 //// tab | Python 3.8+
 
 ```Python hl_lines="17-21  30"
-{!> ../../../docs_src/dependencies/tutorial008b_an.py!}
+{!> ../../docs_src/dependencies/tutorial008b_an.py!}
 ```
 
 ////
@@ -196,7 +196,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="16-20  29"
-{!> ../../../docs_src/dependencies/tutorial008b.py!}
+{!> ../../docs_src/dependencies/tutorial008b.py!}
 ```
 
 ////
@@ -210,7 +210,7 @@ If you catch an exception using `except` in a dependency with `yield` and you do
 //// tab | Python 3.9+
 
 ```Python hl_lines="15-16"
-{!> ../../../docs_src/dependencies/tutorial008c_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008c_an_py39.py!}
 ```
 
 ////
@@ -218,7 +218,7 @@ If you catch an exception using `except` in a dependency with `yield` and you do
 //// tab | Python 3.8+
 
 ```Python hl_lines="14-15"
-{!> ../../../docs_src/dependencies/tutorial008c_an.py!}
+{!> ../../docs_src/dependencies/tutorial008c_an.py!}
 ```
 
 ////
@@ -232,7 +232,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="13-14"
-{!> ../../../docs_src/dependencies/tutorial008c.py!}
+{!> ../../docs_src/dependencies/tutorial008c.py!}
 ```
 
 ////
@@ -248,7 +248,7 @@ You can re-raise the same exception using `raise`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial008d_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008d_an_py39.py!}
 ```
 
 ////
@@ -256,7 +256,7 @@ You can re-raise the same exception using `raise`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial008d_an.py!}
+{!> ../../docs_src/dependencies/tutorial008d_an.py!}
 ```
 
 ////
@@ -270,7 +270,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/dependencies/tutorial008d.py!}
+{!> ../../docs_src/dependencies/tutorial008d.py!}
 ```
 
 ////
@@ -404,7 +404,7 @@ You can also use them inside of **FastAPI** dependencies with `yield` by using
 `with` or `async with` statements inside of the dependency function:
 
 ```Python hl_lines="1-9  13"
-{!../../../docs_src/dependencies/tutorial010.py!}
+{!../../docs_src/dependencies/tutorial010.py!}
 ```
 
 /// tip
index 03a9a42f006a2f60b7e953696e989384aa3f951b..21a8cb6bea90cea70984c4df3c61274de8e8b258 100644 (file)
@@ -9,7 +9,7 @@ In that case, they will be applied to all the *path operations* in the applicati
 //// tab | Python 3.9+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial012_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial012_an_py39.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ In that case, they will be applied to all the *path operations* in the applicati
 //// tab | Python 3.8+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial012_an.py!}
+{!> ../../docs_src/dependencies/tutorial012_an.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/dependencies/tutorial012.py!}
+{!> ../../docs_src/dependencies/tutorial012.py!}
 ```
 
 ////
index a608222f24156bce6f5307766449bddfdaac9ae9..b50edb98ecb58ee6997bf795a6e1b54bc47b41a6 100644 (file)
@@ -34,7 +34,7 @@ It is just a function that can take all the same parameters that a *path operati
 //// tab | Python 3.10+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -42,7 +42,7 @@ It is just a function that can take all the same parameters that a *path operati
 //// tab | Python 3.9+
 
 ```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -50,7 +50,7 @@ It is just a function that can take all the same parameters that a *path operati
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-12"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -64,7 +64,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="6-7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -78,7 +78,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ Make sure you [Upgrade the FastAPI version](../../deployment/versions.md#upgradi
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -124,7 +124,7 @@ Make sure you [Upgrade the FastAPI version](../../deployment/versions.md#upgradi
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -132,7 +132,7 @@ Make sure you [Upgrade the FastAPI version](../../deployment/versions.md#upgradi
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -146,7 +146,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -160,7 +160,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ The same way you use `Body`, `Query`, etc. with your *path operation function* p
 //// tab | Python 3.10+
 
 ```Python hl_lines="13  18"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ The same way you use `Body`, `Query`, etc. with your *path operation function* p
 //// tab | Python 3.9+
 
 ```Python hl_lines="15  20"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -188,7 +188,7 @@ The same way you use `Body`, `Query`, etc. with your *path operation function* p
 //// tab | Python 3.8+
 
 ```Python hl_lines="16  21"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -202,7 +202,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -216,7 +216,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="15  20"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -279,7 +279,7 @@ But because we are using `Annotated`, we can store that `Annotated` value in a v
 //// tab | Python 3.10+
 
 ```Python hl_lines="12  16  21"
-{!> ../../../docs_src/dependencies/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an_py310.py!}
 ```
 
 ////
@@ -287,7 +287,7 @@ But because we are using `Annotated`, we can store that `Annotated` value in a v
 //// tab | Python 3.9+
 
 ```Python hl_lines="14  18  23"
-{!> ../../../docs_src/dependencies/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an_py39.py!}
 ```
 
 ////
@@ -295,7 +295,7 @@ But because we are using `Annotated`, we can store that `Annotated` value in a v
 //// tab | Python 3.8+
 
 ```Python hl_lines="15  19  24"
-{!> ../../../docs_src/dependencies/tutorial001_02_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an.py!}
 ```
 
 ////
index 85b252e13652cab27cf8cb590627832a25fafab5..2b098d1592db12d781c61dde8fb90e14b2ca06a2 100644 (file)
@@ -13,7 +13,7 @@ You could create a first dependency ("dependable") like:
 //// tab | Python 3.10+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -21,7 +21,7 @@ You could create a first dependency ("dependable") like:
 //// tab | Python 3.9+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -29,7 +29,7 @@ You could create a first dependency ("dependable") like:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-10"
-{!> ../../../docs_src/dependencies/tutorial005_an.py!}
+{!> ../../docs_src/dependencies/tutorial005_an.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="6-7"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@ Then you can create another dependency function (a "dependable") that at the sam
 //// tab | Python 3.10+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -81,7 +81,7 @@ Then you can create another dependency function (a "dependable") that at the sam
 //// tab | Python 3.9+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -89,7 +89,7 @@ Then you can create another dependency function (a "dependable") that at the sam
 //// tab | Python 3.8+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/dependencies/tutorial005_an.py!}
+{!> ../../docs_src/dependencies/tutorial005_an.py!}
 ```
 
 ////
@@ -103,7 +103,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
@@ -136,7 +136,7 @@ Then we can use the dependency with:
 //// tab | Python 3.10+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/dependencies/tutorial005_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -144,7 +144,7 @@ Then we can use the dependency with:
 //// tab | Python 3.9+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/dependencies/tutorial005_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ Then we can use the dependency with:
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/dependencies/tutorial005_an.py!}
+{!> ../../docs_src/dependencies/tutorial005_an.py!}
 ```
 
 ////
@@ -166,7 +166,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
index c110a2ac5149691f787ca20a04bec2986846d716..039ac671499e74fda1e077b7df8214ff7b85d688 100644 (file)
@@ -23,7 +23,7 @@ It receives an object, like a Pydantic model, and returns a JSON compatible vers
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  21"
-{!> ../../../docs_src/encoder/tutorial001_py310.py!}
+{!> ../../docs_src/encoder/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ It receives an object, like a Pydantic model, and returns a JSON compatible vers
 //// tab | Python 3.8+
 
 ```Python hl_lines="5  22"
-{!> ../../../docs_src/encoder/tutorial001.py!}
+{!> ../../docs_src/encoder/tutorial001.py!}
 ```
 
 ////
index 3009acaf32ae5bad96d8429018b3f4874113fda9..65f9f1085c5543c92a26c11876c538b0f29a6fe1 100644 (file)
@@ -58,7 +58,7 @@ Here's an example *path operation* with parameters using some of the above types
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  3  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -66,7 +66,7 @@ Here's an example *path operation* with parameters using some of the above types
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  3  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@ Here's an example *path operation* with parameters using some of the above types
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  3  13-17"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
 ```
 
 ////
@@ -88,7 +88,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1  2  11-15"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
@@ -102,7 +102,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1  2  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
@@ -112,7 +112,7 @@ Note that the parameters inside the function have their natural data type, and y
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -120,7 +120,7 @@ Note that the parameters inside the function have their natural data type, and y
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -128,7 +128,7 @@ Note that the parameters inside the function have their natural data type, and y
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-20"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
 ```
 
 ////
@@ -142,7 +142,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
@@ -156,7 +156,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
index 1c87e76ce2b033560ba2ed0a421b548d3746d008..4e6f69f31ece6b7ac5c45ce1d8e8fc2dc5185aea 100644 (file)
@@ -23,7 +23,7 @@ Here's a general idea of how the models could look like with their password fiel
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  9  14  20  22  27-28  31-33  38-39"
-{!> ../../../docs_src/extra_models/tutorial001_py310.py!}
+{!> ../../docs_src/extra_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Here's a general idea of how the models could look like with their password fiel
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  11  16  22  24  29-30  33-35  40-41"
-{!> ../../../docs_src/extra_models/tutorial001.py!}
+{!> ../../docs_src/extra_models/tutorial001.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ That way, we can declare just the differences between the models (with plaintext
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  13-14  17-18  21-22"
-{!> ../../../docs_src/extra_models/tutorial002_py310.py!}
+{!> ../../docs_src/extra_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -187,7 +187,7 @@ That way, we can declare just the differences between the models (with plaintext
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  15-16  19-20  23-24"
-{!> ../../../docs_src/extra_models/tutorial002.py!}
+{!> ../../docs_src/extra_models/tutorial002.py!}
 ```
 
 ////
@@ -209,7 +209,7 @@ When defining a <a href="https://docs.pydantic.dev/latest/concepts/types/#unions
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  14-15  18-20  33"
-{!> ../../../docs_src/extra_models/tutorial003_py310.py!}
+{!> ../../docs_src/extra_models/tutorial003_py310.py!}
 ```
 
 ////
@@ -217,7 +217,7 @@ When defining a <a href="https://docs.pydantic.dev/latest/concepts/types/#unions
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  14-15  18-20  33"
-{!> ../../../docs_src/extra_models/tutorial003.py!}
+{!> ../../docs_src/extra_models/tutorial003.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ For that, use the standard Python `typing.List` (or just `list` in Python 3.9 an
 //// tab | Python 3.9+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/extra_models/tutorial004_py39.py!}
+{!> ../../docs_src/extra_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -253,7 +253,7 @@ For that, use the standard Python `typing.List` (or just `list` in Python 3.9 an
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  20"
-{!> ../../../docs_src/extra_models/tutorial004.py!}
+{!> ../../docs_src/extra_models/tutorial004.py!}
 ```
 
 ////
@@ -269,7 +269,7 @@ In this case, you can use `typing.Dict` (or just `dict` in Python 3.9 and above)
 //// tab | Python 3.9+
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/extra_models/tutorial005_py39.py!}
+{!> ../../docs_src/extra_models/tutorial005_py39.py!}
 ```
 
 ////
@@ -277,7 +277,7 @@ In this case, you can use `typing.Dict` (or just `dict` in Python 3.9 and above)
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  8"
-{!> ../../../docs_src/extra_models/tutorial005.py!}
+{!> ../../docs_src/extra_models/tutorial005.py!}
 ```
 
 ////
index b48a0ee381c49f40d96c9e04200e5e91a8a3dddb..77728cebe12f066592e02fa38551440d80cc0294 100644 (file)
@@ -3,7 +3,7 @@
 The simplest FastAPI file could look like this:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Copy that to a file `main.py`.
@@ -158,7 +158,7 @@ You could also use it to generate code automatically, for clients that communica
 ### Step 1: import `FastAPI`
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI` is a Python class that provides all the functionality for your API.
@@ -174,7 +174,7 @@ You can use all the <a href="https://www.starlette.io/" class="external-link" ta
 ### Step 2: create a `FastAPI` "instance"
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Here the `app` variable will be an "instance" of the class `FastAPI`.
@@ -245,7 +245,7 @@ We are going to call them "**operations**" too.
 #### Define a *path operation decorator*
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 The `@app.get("/")` tells **FastAPI** that the function right below is in charge of handling requests that go to:
@@ -301,7 +301,7 @@ This is our "**path operation function**":
 * **function**: is the function below the "decorator" (below `@app.get("/")`).
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 This is a Python function.
@@ -315,7 +315,7 @@ In this case, it is an `async` function.
 You could also define it as a normal function instead of `async def`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note
@@ -327,7 +327,7 @@ If you don't know the difference, check the [Async: *"In a hurry?"*](../async.md
 ### Step 5: return the content
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 You can return a `dict`, `list`, singular values as `str`, `int`, etc.
index 14a3cf998d10d54bda0966312fe815fa38c4b047..38c15761b8c91e46abf2a8b419d9449213099de1 100644 (file)
@@ -26,7 +26,7 @@ To return HTTP responses with errors to the client you use `HTTPException`.
 ### Import `HTTPException`
 
 ```Python hl_lines="1"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 ```
 
 ### Raise an `HTTPException` in your code
@@ -42,7 +42,7 @@ The benefit of raising an exception over `return`ing a value will be more eviden
 In this example, when the client requests an item by an ID that doesn't exist, raise an exception with a status code of `404`:
 
 ```Python hl_lines="11"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 ```
 
 ### The resulting response
@@ -82,7 +82,7 @@ You probably won't need to use it directly in your code.
 But in case you needed it for an advanced scenario, you can add custom headers:
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial002.py!}
+{!../../docs_src/handling_errors/tutorial002.py!}
 ```
 
 ## Install custom exception handlers
@@ -96,7 +96,7 @@ And you want to handle this exception globally with FastAPI.
 You could add a custom exception handler with `@app.exception_handler()`:
 
 ```Python hl_lines="5-7  13-18  24"
-{!../../../docs_src/handling_errors/tutorial003.py!}
+{!../../docs_src/handling_errors/tutorial003.py!}
 ```
 
 Here, if you request `/unicorns/yolo`, the *path operation* will `raise` a `UnicornException`.
@@ -136,7 +136,7 @@ To override it, import the `RequestValidationError` and use it with `@app.except
 The exception handler will receive a `Request` and the exception.
 
 ```Python hl_lines="2  14-16"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 ```
 
 Now, if you go to `/items/foo`, instead of getting the default JSON error with:
@@ -189,7 +189,7 @@ The same way, you can override the `HTTPException` handler.
 For example, you could want to return a plain text response instead of JSON for these errors:
 
 ```Python hl_lines="3-4  9-11  22"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 ```
 
 /// note | "Technical Details"
@@ -207,7 +207,7 @@ The `RequestValidationError` contains the `body` it received with invalid data.
 You could use it while developing your app to log the body and debug it, return it to the user, etc.
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial005.py!}
+{!../../docs_src/handling_errors/tutorial005.py!}
 ```
 
 Now try sending an invalid item like:
@@ -265,7 +265,7 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
 If you want to use the exception along with the same default exception handlers from  **FastAPI**, you can import and reuse the default exception handlers from `fastapi.exception_handlers`:
 
 ```Python hl_lines="2-5  15  21"
-{!../../../docs_src/handling_errors/tutorial006.py!}
+{!../../docs_src/handling_errors/tutorial006.py!}
 ```
 
 In this example you are just `print`ing the error with a very expressive message, but you get the idea. You can use the exception and then just reuse the default exception handlers.
index 8deb0a455dc2385b5fc4e8c7f3a1fc1a6a4c3a94..78517e4984da74ad29f4d09b39f0c4cba0cb8753 100644 (file)
@@ -17,7 +17,7 @@ Declare the **header parameters** that you need in a **Pydantic model**, and the
 //// tab | Python 3.10+
 
 ```Python hl_lines="9-14  18"
-{!> ../../../docs_src/header_param_models/tutorial001_an_py310.py!}
+{!> ../../docs_src/header_param_models/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Declare the **header parameters** that you need in a **Pydantic model**, and the
 //// tab | Python 3.9+
 
 ```Python hl_lines="9-14  18"
-{!> ../../../docs_src/header_param_models/tutorial001_an_py39.py!}
+{!> ../../docs_src/header_param_models/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -33,7 +33,7 @@ Declare the **header parameters** that you need in a **Pydantic model**, and the
 //// tab | Python 3.8+
 
 ```Python hl_lines="10-15  19"
-{!> ../../../docs_src/header_param_models/tutorial001_an.py!}
+{!> ../../docs_src/header_param_models/tutorial001_an.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7-12  16"
-{!> ../../../docs_src/header_param_models/tutorial001_py310.py!}
+{!> ../../docs_src/header_param_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9-14  18"
-{!> ../../../docs_src/header_param_models/tutorial001_py39.py!}
+{!> ../../docs_src/header_param_models/tutorial001_py39.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7-12  16"
-{!> ../../../docs_src/header_param_models/tutorial001_py310.py!}
+{!> ../../docs_src/header_param_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -99,7 +99,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_param_models/tutorial002_an_py310.py!}
+{!> ../../docs_src/header_param_models/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -107,7 +107,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_param_models/tutorial002_an_py39.py!}
+{!> ../../docs_src/header_param_models/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -115,7 +115,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/header_param_models/tutorial002_an.py!}
+{!> ../../docs_src/header_param_models/tutorial002_an.py!}
 ```
 
 ////
@@ -129,7 +129,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/header_param_models/tutorial002_py310.py!}
+{!> ../../docs_src/header_param_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -143,7 +143,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_param_models/tutorial002_py39.py!}
+{!> ../../docs_src/header_param_models/tutorial002_py39.py!}
 ```
 
 ////
@@ -157,7 +157,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_param_models/tutorial002.py!}
+{!> ../../docs_src/header_param_models/tutorial002.py!}
 ```
 
 ////
index 2e07fe0e60a9be95b58b76608c44563c90dc9446..293de897f79c07ddc1648c50f78e92c15aef850d 100644 (file)
@@ -9,7 +9,7 @@ First import `Header`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ First import `Header`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ First import `Header`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001_an.py!}
+{!> ../../docs_src/header_params/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/header_params/tutorial001_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001.py!}
+{!> ../../docs_src/header_params/tutorial001.py!}
 ```
 
 ////
@@ -67,7 +67,7 @@ You can define the default value as well as all the extra validation or annotati
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ You can define the default value as well as all the extra validation or annotati
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@ You can define the default value as well as all the extra validation or annotati
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial001_an.py!}
+{!> ../../docs_src/header_params/tutorial001_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/header_params/tutorial001_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -111,7 +111,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001.py!}
+{!> ../../docs_src/header_params/tutorial001.py!}
 ```
 
 ////
@@ -149,7 +149,7 @@ If for some reason you need to disable automatic conversion of underscores to hy
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial002_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -157,7 +157,7 @@ If for some reason you need to disable automatic conversion of underscores to hy
 //// tab | Python 3.9+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/header_params/tutorial002_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -165,7 +165,7 @@ If for some reason you need to disable automatic conversion of underscores to hy
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/header_params/tutorial002_an.py!}
+{!> ../../docs_src/header_params/tutorial002_an.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/header_params/tutorial002_py310.py!}
+{!> ../../docs_src/header_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -193,7 +193,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial002.py!}
+{!> ../../docs_src/header_params/tutorial002.py!}
 ```
 
 ////
@@ -217,7 +217,7 @@ For example, to declare a header of `X-Token` that can appear more than once, yo
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -225,7 +225,7 @@ For example, to declare a header of `X-Token` that can appear more than once, yo
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -233,7 +233,7 @@ For example, to declare a header of `X-Token` that can appear more than once, yo
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial003_an.py!}
+{!> ../../docs_src/header_params/tutorial003_an.py!}
 ```
 
 ////
@@ -247,7 +247,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/header_params/tutorial003_py310.py!}
+{!> ../../docs_src/header_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -261,7 +261,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_py39.py!}
+{!> ../../docs_src/header_params/tutorial003_py39.py!}
 ```
 
 ////
@@ -275,7 +275,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003.py!}
+{!> ../../docs_src/header_params/tutorial003.py!}
 ```
 
 ////
index c62509b8b50d3144dfc8c45b3dd98430132d6126..715bb999a52776411da4bb6597e95d21352e0995 100644 (file)
@@ -19,7 +19,7 @@ You can set the following fields that are used in the OpenAPI specification and
 You can set them as follows:
 
 ```Python hl_lines="3-16  19-32"
-{!../../../docs_src/metadata/tutorial001.py!}
+{!../../docs_src/metadata/tutorial001.py!}
 ```
 
 /// tip
@@ -39,7 +39,7 @@ Since OpenAPI 3.1.0 and FastAPI 0.99.0, you can also set the `license_info` with
 For example:
 
 ```Python hl_lines="31"
-{!../../../docs_src/metadata/tutorial001_1.py!}
+{!../../docs_src/metadata/tutorial001_1.py!}
 ```
 
 ## Metadata for tags
@@ -63,7 +63,7 @@ Let's try that in an example with tags for `users` and `items`.
 Create metadata for your tags and pass it to the `openapi_tags` parameter:
 
 ```Python hl_lines="3-16  18"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
 ```
 
 Notice that you can use Markdown inside of the descriptions, for example "login" will be shown in bold (**login**) and "fancy" will be shown in italics (_fancy_).
@@ -79,7 +79,7 @@ You don't have to add metadata for all the tags that you use.
 Use the `tags` parameter with your *path operations* (and `APIRouter`s) to assign them to different tags:
 
 ```Python hl_lines="21  26"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
 ```
 
 /// info
@@ -109,7 +109,7 @@ But you can configure it with the parameter `openapi_url`.
 For example, to set it to be served at `/api/v1/openapi.json`:
 
 ```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial002.py!}
+{!../../docs_src/metadata/tutorial002.py!}
 ```
 
 If you want to disable the OpenAPI schema completely you can set `openapi_url=None`, that will also disable the documentation user interfaces that use it.
@@ -128,5 +128,5 @@ You can configure the two documentation user interfaces included:
 For example, to set Swagger UI to be served at `/documentation` and disable ReDoc:
 
 ```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial003.py!}
+{!../../docs_src/metadata/tutorial003.py!}
 ```
index 199b593d3eea0ba64116562989b96e627bb9b9b3..7c4954c7b704eb5f589b679ee1a7972e5eb336bb 100644 (file)
@@ -32,7 +32,7 @@ The middleware function receives:
 * You can then further modify the `response` before returning it.
 
 ```Python hl_lines="8-9  11  14"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 /// tip
@@ -60,7 +60,7 @@ And also after the `response` is generated, before returning it.
 For example, you could add a custom header `X-Process-Time` containing the time in seconds that it took to process the request and generate a response:
 
 ```Python hl_lines="10  12-13"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 /// tip
index a1a4953a6bb4d7efc8380fe347234ce587e64113..4ca6ebf1334bdc29e967ba9b71bba5f65d8bff5a 100644 (file)
@@ -19,7 +19,7 @@ But if you don't remember what each number code is for, you can use the shortcut
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  15"
-{!> ../../../docs_src/path_operation_configuration/tutorial001_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001_py310.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ But if you don't remember what each number code is for, you can use the shortcut
 //// tab | Python 3.9+
 
 ```Python hl_lines="3  17"
-{!> ../../../docs_src/path_operation_configuration/tutorial001_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001_py39.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@ But if you don't remember what each number code is for, you can use the shortcut
 //// tab | Python 3.8+
 
 ```Python hl_lines="3  17"
-{!> ../../../docs_src/path_operation_configuration/tutorial001.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@ You can add tags to your *path operation*, pass the parameter `tags` with a `lis
 //// tab | Python 3.10+
 
 ```Python hl_lines="15  20  25"
-{!> ../../../docs_src/path_operation_configuration/tutorial002_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002_py310.py!}
 ```
 
 ////
@@ -65,7 +65,7 @@ You can add tags to your *path operation*, pass the parameter `tags` with a `lis
 //// tab | Python 3.9+
 
 ```Python hl_lines="17  22  27"
-{!> ../../../docs_src/path_operation_configuration/tutorial002_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002_py39.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@ You can add tags to your *path operation*, pass the parameter `tags` with a `lis
 //// tab | Python 3.8+
 
 ```Python hl_lines="17  22  27"
-{!> ../../../docs_src/path_operation_configuration/tutorial002.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002.py!}
 ```
 
 ////
@@ -91,7 +91,7 @@ In these cases, it could make sense to store the tags in an `Enum`.
 **FastAPI** supports that the same way as with plain strings:
 
 ```Python hl_lines="1  8-10  13  18"
-{!../../../docs_src/path_operation_configuration/tutorial002b.py!}
+{!../../docs_src/path_operation_configuration/tutorial002b.py!}
 ```
 
 ## Summary and description
@@ -101,7 +101,7 @@ You can add a `summary` and `description`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/path_operation_configuration/tutorial003_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003_py310.py!}
 ```
 
 ////
@@ -109,7 +109,7 @@ You can add a `summary` and `description`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="20-21"
-{!> ../../../docs_src/path_operation_configuration/tutorial003_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003_py39.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ You can add a `summary` and `description`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="20-21"
-{!> ../../../docs_src/path_operation_configuration/tutorial003.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003.py!}
 ```
 
 ////
@@ -131,7 +131,7 @@ You can write <a href="https://en.wikipedia.org/wiki/Markdown" class="external-l
 //// tab | Python 3.10+
 
 ```Python hl_lines="17-25"
-{!> ../../../docs_src/path_operation_configuration/tutorial004_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004_py310.py!}
 ```
 
 ////
@@ -139,7 +139,7 @@ You can write <a href="https://en.wikipedia.org/wiki/Markdown" class="external-l
 //// tab | Python 3.9+
 
 ```Python hl_lines="19-27"
-{!> ../../../docs_src/path_operation_configuration/tutorial004_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004_py39.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ You can write <a href="https://en.wikipedia.org/wiki/Markdown" class="external-l
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-27"
-{!> ../../../docs_src/path_operation_configuration/tutorial004.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004.py!}
 ```
 
 ////
@@ -163,7 +163,7 @@ You can specify the response description with the parameter `response_descriptio
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/path_operation_configuration/tutorial005_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005_py310.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ You can specify the response description with the parameter `response_descriptio
 //// tab | Python 3.9+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/path_operation_configuration/tutorial005_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005_py39.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ You can specify the response description with the parameter `response_descriptio
 //// tab | Python 3.8+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/path_operation_configuration/tutorial005.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005.py!}
 ```
 
 ////
@@ -205,7 +205,7 @@ So, if you don't provide one, **FastAPI** will automatically generate one of "Su
 If you need to mark a *path operation* as <abbr title="obsolete, recommended not to use it">deprecated</abbr>, but without removing it, pass the parameter `deprecated`:
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_operation_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_configuration/tutorial006.py!}
 ```
 
 It will be clearly marked as deprecated in the interactive docs:
index bd835d0d4898fcf1a16a19c3b8dd8077253c9639..9ddf49ea94648918d40a8728bc3aaeee60a4316f 100644 (file)
@@ -9,7 +9,7 @@ First, import `Path` from `fastapi`, and import `Annotated`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ First, import `Path` from `fastapi`, and import `Annotated`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ First, import `Path` from `fastapi`, and import `Annotated`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="3-4"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -77,7 +77,7 @@ For example, to declare a `title` metadata value for the path parameter `item_id
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -85,7 +85,7 @@ For example, to declare a `title` metadata value for the path parameter `item_id
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@ For example, to declare a `title` metadata value for the path parameter `item_id
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
 ```
 
 ////
@@ -107,7 +107,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -121,7 +121,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -163,7 +163,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002.py!}
 ```
 
 ////
@@ -173,7 +173,7 @@ But keep in mind that if you use `Annotated`, you won't have this problem, it wo
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -181,7 +181,7 @@ But keep in mind that if you use `Annotated`, you won't have this problem, it wo
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002_an.py!}
 ```
 
 ////
@@ -210,7 +210,7 @@ Pass `*`, as the first parameter of the function.
 Python won't do anything with that `*`, but it will know that all the following parameters should be called as keyword arguments (key-value pairs), also known as <abbr title="From: K-ey W-ord Arg-uments"><code>kwargs</code></abbr>. Even if they don't have a default value.
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
 ```
 
 ### Better with `Annotated`
@@ -220,7 +220,7 @@ Keep in mind that if you use `Annotated`, as you are not using function paramete
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -228,7 +228,7 @@ Keep in mind that if you use `Annotated`, as you are not using function paramete
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
 ```
 
 ////
@@ -242,7 +242,7 @@ Here, with `ge=1`, `item_id` will need to be an integer number "`g`reater than o
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -250,7 +250,7 @@ Here, with `ge=1`, `item_id` will need to be an integer number "`g`reater than o
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
 ```
 
 ////
@@ -264,7 +264,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004.py!}
 ```
 
 ////
@@ -279,7 +279,7 @@ The same applies for:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -287,7 +287,7 @@ The same applies for:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
 ```
 
 ////
@@ -301,7 +301,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005.py!}
 ```
 
 ////
@@ -319,7 +319,7 @@ And the same for <abbr title="less than"><code>lt</code></abbr>.
 //// tab | Python 3.9+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -327,7 +327,7 @@ And the same for <abbr title="less than"><code>lt</code></abbr>.
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
 ```
 
 ////
@@ -341,7 +341,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006.py!}
 ```
 
 ////
index a87a29e08871abdcec54ac1a52232acbfcd624b7..fd9e745856fc427a00d246b8983317758acc3e9e 100644 (file)
@@ -3,7 +3,7 @@
 You can declare path "parameters" or "variables" with the same syntax used by Python format strings:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
 ```
 
 The value of the path parameter `item_id` will be passed to your function as the argument `item_id`.
@@ -19,7 +19,7 @@ So, if you run this example and go to <a href="http://127.0.0.1:8000/items/foo"
 You can declare the type of a path parameter in the function, using standard Python type annotations:
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
 ```
 
 In this case, `item_id` is declared to be an `int`.
@@ -124,7 +124,7 @@ And then you can also have a path `/users/{user_id}` to get data about a specifi
 Because *path operations* are evaluated in order, you need to make sure that the path for `/users/me` is declared before the one for `/users/{user_id}`:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
 ```
 
 Otherwise, the path for `/users/{user_id}` would match also for `/users/me`, "thinking" that it's receiving a parameter `user_id` with a value of `"me"`.
@@ -132,7 +132,7 @@ Otherwise, the path for `/users/{user_id}` would match also for `/users/me`, "th
 Similarly, you cannot redefine a path operation:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003b.py!}
+{!../../docs_src/path_params/tutorial003b.py!}
 ```
 
 The first one will always be used since the path matches first.
@@ -150,7 +150,7 @@ By inheriting from `str` the API docs will be able to know that the values must
 Then create class attributes with fixed values, which will be the available valid values:
 
 ```Python hl_lines="1  6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// info
@@ -170,7 +170,7 @@ If you are wondering, "AlexNet", "ResNet", and "LeNet" are just names of Machine
 Then create a *path parameter* with a type annotation using the enum class you created (`ModelName`):
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 ### Check the docs
@@ -188,7 +188,7 @@ The value of the *path parameter* will be an *enumeration member*.
 You can compare it with the *enumeration member* in your created enum `ModelName`:
 
 ```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 #### Get the *enumeration value*
@@ -196,7 +196,7 @@ You can compare it with the *enumeration member* in your created enum `ModelName
 You can get the actual value (a `str` in this case) using `model_name.value`, or in general, `your_enum_member.value`:
 
 ```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// tip
@@ -212,7 +212,7 @@ You can return *enum members* from your *path operation*, even nested in a JSON
 They will be converted to their corresponding values (strings in this case) before returning them to the client:
 
 ```Python hl_lines="18  21  23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 In your client you will get a JSON response like:
@@ -253,7 +253,7 @@ In this case, the name of the parameter is `file_path`, and the last part, `:pat
 So, you can use it with:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
 ```
 
 /// tip
index 02e36dc0f8b406da1edbedf6813d640619800d93..f7ce345b2b2c925340b965843d41c270d9c199f6 100644 (file)
@@ -17,7 +17,7 @@ Declare the **query parameters** that you need in a **Pydantic model**, and then
 //// tab | Python 3.10+
 
 ```Python hl_lines="9-13  17"
-{!> ../../../docs_src/query_param_models/tutorial001_an_py310.py!}
+{!> ../../docs_src/query_param_models/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Declare the **query parameters** that you need in a **Pydantic model**, and then
 //// tab | Python 3.9+
 
 ```Python hl_lines="8-12  16"
-{!> ../../../docs_src/query_param_models/tutorial001_an_py39.py!}
+{!> ../../docs_src/query_param_models/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -33,7 +33,7 @@ Declare the **query parameters** that you need in a **Pydantic model**, and then
 //// tab | Python 3.8+
 
 ```Python hl_lines="10-14  18"
-{!> ../../../docs_src/query_param_models/tutorial001_an.py!}
+{!> ../../docs_src/query_param_models/tutorial001_an.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9-13  17"
-{!> ../../../docs_src/query_param_models/tutorial001_py310.py!}
+{!> ../../docs_src/query_param_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8-12 16"
-{!> ../../../docs_src/query_param_models/tutorial001_py39.py!}
+{!> ../../docs_src/query_param_models/tutorial001_py39.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9-13  17"
-{!> ../../../docs_src/query_param_models/tutorial001_py310.py!}
+{!> ../../docs_src/query_param_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -99,7 +99,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_param_models/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_param_models/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -107,7 +107,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_param_models/tutorial002_an_py39.py!}
+{!> ../../docs_src/query_param_models/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -115,7 +115,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_param_models/tutorial002_an.py!}
+{!> ../../docs_src/query_param_models/tutorial002_an.py!}
 ```
 
 ////
@@ -129,7 +129,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_param_models/tutorial002_py310.py!}
+{!> ../../docs_src/query_param_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -143,7 +143,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_param_models/tutorial002_py39.py!}
+{!> ../../docs_src/query_param_models/tutorial002_py39.py!}
 ```
 
 ////
@@ -157,7 +157,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_param_models/tutorial002.py!}
+{!> ../../docs_src/query_param_models/tutorial002.py!}
 ```
 
 ////
index dd101a2a644bfe734f9de8e103978ae3a45704bd..12778d7feaafcee7c30d95ebf67e032df4cf4b38 100644 (file)
@@ -7,7 +7,7 @@ Let's take this application as example:
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial001_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -15,7 +15,7 @@ Let's take this application as example:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001.py!}
 ```
 
 ////
@@ -46,7 +46,7 @@ To achieve that, first import:
 In Python 3.9 or above, `Annotated` is part of the standard library, so you can import it from `typing`.
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -58,7 +58,7 @@ In versions of Python below Python 3.9 you import `Annotated` from `typing_exten
 It will already be installed with FastAPI.
 
 ```Python hl_lines="3-4"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
 ```
 
 ////
@@ -126,7 +126,7 @@ Now that we have this `Annotated` where we can put more information (in this cas
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -134,7 +134,7 @@ Now that we have this `Annotated` where we can put more information (in this cas
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
 ```
 
 ////
@@ -170,7 +170,7 @@ This is how you would use `Query()` as the default value of your function parame
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_py310.py!}
 ```
 
 ////
@@ -178,7 +178,7 @@ This is how you would use `Query()` as the default value of your function parame
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 ////
@@ -284,7 +284,7 @@ You can also add a parameter `min_length`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -292,7 +292,7 @@ You can also add a parameter `min_length`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -300,7 +300,7 @@ You can also add a parameter `min_length`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an.py!}
 ```
 
 ////
@@ -314,7 +314,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_py310.py!}
 ```
 
 ////
@@ -328,7 +328,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003.py!}
 ```
 
 ////
@@ -340,7 +340,7 @@ You can define a <abbr title="A regular expression, regex or regexp is a sequenc
 //// tab | Python 3.10+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -348,7 +348,7 @@ You can define a <abbr title="A regular expression, regex or regexp is a sequenc
 //// tab | Python 3.9+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -356,7 +356,7 @@ You can define a <abbr title="A regular expression, regex or regexp is a sequenc
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an.py!}
 ```
 
 ////
@@ -370,7 +370,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_py310.py!}
 ```
 
 ////
@@ -384,7 +384,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004.py!}
 ```
 
 ////
@@ -408,7 +408,7 @@ You could still see some code using it:
 //// tab | Python 3.10+ Pydantic v1
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an_py310_regex.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py310_regex.py!}
 ```
 
 ////
@@ -424,7 +424,7 @@ Let's say that you want to declare the `q` query parameter to have a `min_length
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -432,7 +432,7 @@ Let's say that you want to declare the `q` query parameter to have a `min_length
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial005_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005_an.py!}
 ```
 
 ////
@@ -446,7 +446,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005.py!}
 ```
 
 ////
@@ -494,7 +494,7 @@ So, when you need to declare a value as required while using `Query`, you can si
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -502,7 +502,7 @@ So, when you need to declare a value as required while using `Query`, you can si
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006_an.py!}
 ```
 
 ////
@@ -516,7 +516,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006.py!}
 ```
 
 /// tip
@@ -536,7 +536,7 @@ There's an alternative way to explicitly declare that a value is required. You c
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b_an_py39.py!}
 ```
 
 ////
@@ -544,7 +544,7 @@ There's an alternative way to explicitly declare that a value is required. You c
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b_an.py!}
 ```
 
 ////
@@ -558,7 +558,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b.py!}
 ```
 
 ////
@@ -582,7 +582,7 @@ To do that, you can declare that `None` is a valid type but still use `...` as t
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an_py310.py!}
 ```
 
 ////
@@ -590,7 +590,7 @@ To do that, you can declare that `None` is a valid type but still use `...` as t
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an_py39.py!}
 ```
 
 ////
@@ -598,7 +598,7 @@ To do that, you can declare that `None` is a valid type but still use `...` as t
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an.py!}
 ```
 
 ////
@@ -612,7 +612,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
 ```
 
 ////
@@ -626,7 +626,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c.py!}
 ```
 
 ////
@@ -652,7 +652,7 @@ For example, to declare a query parameter `q` that can appear multiple times in
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an_py310.py!}
 ```
 
 ////
@@ -660,7 +660,7 @@ For example, to declare a query parameter `q` that can appear multiple times in
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -668,7 +668,7 @@ For example, to declare a query parameter `q` that can appear multiple times in
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an.py!}
 ```
 
 ////
@@ -682,7 +682,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py310.py!}
 ```
 
 ////
@@ -696,7 +696,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py39.py!}
 ```
 
 ////
@@ -710,7 +710,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011.py!}
 ```
 
 ////
@@ -751,7 +751,7 @@ And you can also define a default `list` of values if none are provided:
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_an_py39.py!}
 ```
 
 ////
@@ -759,7 +759,7 @@ And you can also define a default `list` of values if none are provided:
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_an.py!}
 ```
 
 ////
@@ -773,7 +773,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_py39.py!}
 ```
 
 ////
@@ -787,7 +787,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012.py!}
 ```
 
 ////
@@ -816,7 +816,7 @@ You can also use `list` directly instead of `List[str]` (or `list[str]` in Pytho
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial013_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013_an_py39.py!}
 ```
 
 ////
@@ -824,7 +824,7 @@ You can also use `list` directly instead of `List[str]` (or `list[str]` in Pytho
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial013_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013_an.py!}
 ```
 
 ////
@@ -838,7 +838,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013.py!}
 ```
 
 ////
@@ -870,7 +870,7 @@ You can add a `title`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an_py310.py!}
 ```
 
 ////
@@ -878,7 +878,7 @@ You can add a `title`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an_py39.py!}
 ```
 
 ////
@@ -886,7 +886,7 @@ You can add a `title`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an.py!}
 ```
 
 ////
@@ -900,7 +900,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_py310.py!}
 ```
 
 ////
@@ -914,7 +914,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007.py!}
 ```
 
 ////
@@ -924,7 +924,7 @@ And a `description`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an_py310.py!}
 ```
 
 ////
@@ -932,7 +932,7 @@ And a `description`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -940,7 +940,7 @@ And a `description`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an.py!}
 ```
 
 ////
@@ -954,7 +954,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_py310.py!}
 ```
 
 ////
@@ -968,7 +968,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008.py!}
 ```
 
 ////
@@ -994,7 +994,7 @@ Then you can declare an `alias`, and that alias is what will be used to find the
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an_py310.py!}
 ```
 
 ////
@@ -1002,7 +1002,7 @@ Then you can declare an `alias`, and that alias is what will be used to find the
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an_py39.py!}
 ```
 
 ////
@@ -1010,7 +1010,7 @@ Then you can declare an `alias`, and that alias is what will be used to find the
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an.py!}
 ```
 
 ////
@@ -1024,7 +1024,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_py310.py!}
 ```
 
 ////
@@ -1038,7 +1038,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009.py!}
 ```
 
 ////
@@ -1054,7 +1054,7 @@ Then pass the parameter `deprecated=True` to `Query`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an_py310.py!}
 ```
 
 ////
@@ -1062,7 +1062,7 @@ Then pass the parameter `deprecated=True` to `Query`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an_py39.py!}
 ```
 
 ////
@@ -1070,7 +1070,7 @@ Then pass the parameter `deprecated=True` to `Query`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an.py!}
 ```
 
 ////
@@ -1084,7 +1084,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_py310.py!}
 ```
 
 ////
@@ -1098,7 +1098,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010.py!}
 ```
 
 ////
@@ -1114,7 +1114,7 @@ To exclude a query parameter from the generated OpenAPI schema (and thus, from t
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an_py310.py!}
 ```
 
 ////
@@ -1122,7 +1122,7 @@ To exclude a query parameter from the generated OpenAPI schema (and thus, from t
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an_py39.py!}
 ```
 
 ////
@@ -1130,7 +1130,7 @@ To exclude a query parameter from the generated OpenAPI schema (and thus, from t
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an.py!}
 ```
 
 ////
@@ -1144,7 +1144,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_py310.py!}
 ```
 
 ////
@@ -1158,7 +1158,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014.py!}
 ```
 
 ////
index a98ac9b2832aac53e29707c847a9d88b0b840c55..0d31d453d5ce429aaf65e394a86c6b34222e3984 100644 (file)
@@ -3,7 +3,7 @@
 When you declare other function parameters that are not part of the path parameters, they are automatically interpreted as "query" parameters.
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
 ```
 
 The query is the set of key-value pairs that go after the `?` in a URL, separated by `&` characters.
@@ -66,7 +66,7 @@ The same way, you can declare optional query parameters, by setting their defaul
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial002_py310.py!}
+{!> ../../docs_src/query_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@ The same way, you can declare optional query parameters, by setting their defaul
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial002.py!}
+{!> ../../docs_src/query_params/tutorial002.py!}
 ```
 
 ////
@@ -94,7 +94,7 @@ You can also declare `bool` types, and they will be converted:
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial003_py310.py!}
+{!> ../../docs_src/query_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -102,7 +102,7 @@ You can also declare `bool` types, and they will be converted:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial003.py!}
+{!> ../../docs_src/query_params/tutorial003.py!}
 ```
 
 ////
@@ -151,7 +151,7 @@ They will be detected by name:
 //// tab | Python 3.10+
 
 ```Python hl_lines="6  8"
-{!> ../../../docs_src/query_params/tutorial004_py310.py!}
+{!> ../../docs_src/query_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -159,7 +159,7 @@ They will be detected by name:
 //// tab | Python 3.8+
 
 ```Python hl_lines="8  10"
-{!> ../../../docs_src/query_params/tutorial004.py!}
+{!> ../../docs_src/query_params/tutorial004.py!}
 ```
 
 ////
@@ -173,7 +173,7 @@ If you don't want to add a specific value but just make it optional, set the def
 But when you want to make a query parameter required, you can just not declare any default value:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
 ```
 
 Here the query parameter `needy` is a required query parameter of type `str`.
@@ -223,7 +223,7 @@ And of course, you can define some parameters as required, some as having a defa
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params/tutorial006_py310.py!}
+{!> ../../docs_src/query_params/tutorial006_py310.py!}
 ```
 
 ////
@@ -231,7 +231,7 @@ And of course, you can define some parameters as required, some as having a defa
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params/tutorial006.py!}
+{!> ../../docs_src/query_params/tutorial006.py!}
 ```
 
 ////
index 9f19596a865fe002fe5f4cf20b09ae91066aa651..f3f1eb103e7e6110abf194afbe67494d1e21b449 100644 (file)
@@ -23,7 +23,7 @@ Import `File` and `UploadFile` from `fastapi`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Import `File` and `UploadFile` from `fastapi`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@ Create file parameters the same way you would for `Body` or `Form`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -65,7 +65,7 @@ Create file parameters the same way you would for `Body` or `Form`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
 ```
 
 ////
@@ -113,7 +113,7 @@ Define a file parameter with a type of `UploadFile`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -121,7 +121,7 @@ Define a file parameter with a type of `UploadFile`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
 ```
 
 ////
@@ -135,7 +135,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
 ```
 
 ////
@@ -224,7 +224,7 @@ You can make a file optional by using standard type annotations and setting a de
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py310.py!}
 ```
 
 ////
@@ -232,7 +232,7 @@ You can make a file optional by using standard type annotations and setting a de
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py39.py!}
 ```
 
 ////
@@ -240,7 +240,7 @@ You can make a file optional by using standard type annotations and setting a de
 //// tab | Python 3.8+
 
 ```Python hl_lines="10  18"
-{!> ../../../docs_src/request_files/tutorial001_02_an.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an.py!}
 ```
 
 ////
@@ -254,7 +254,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7  15"
-{!> ../../../docs_src/request_files/tutorial001_02_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_py310.py!}
 ```
 
 ////
@@ -268,7 +268,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02.py!}
+{!> ../../docs_src/request_files/tutorial001_02.py!}
 ```
 
 ////
@@ -280,7 +280,7 @@ You can also use `File()` with `UploadFile`, for example, to set additional meta
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  15"
-{!> ../../../docs_src/request_files/tutorial001_03_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an_py39.py!}
 ```
 
 ////
@@ -288,7 +288,7 @@ You can also use `File()` with `UploadFile`, for example, to set additional meta
 //// tab | Python 3.8+
 
 ```Python hl_lines="8  14"
-{!> ../../../docs_src/request_files/tutorial001_03_an.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an.py!}
 ```
 
 ////
@@ -302,7 +302,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7  13"
-{!> ../../../docs_src/request_files/tutorial001_03.py!}
+{!> ../../docs_src/request_files/tutorial001_03.py!}
 ```
 
 ////
@@ -318,7 +318,7 @@ To use that, declare a list of `bytes` or `UploadFile`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/request_files/tutorial002_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -326,7 +326,7 @@ To use that, declare a list of `bytes` or `UploadFile`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/request_files/tutorial002_an.py!}
+{!> ../../docs_src/request_files/tutorial002_an.py!}
 ```
 
 ////
@@ -340,7 +340,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/request_files/tutorial002_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_py39.py!}
 ```
 
 ////
@@ -354,7 +354,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/request_files/tutorial002.py!}
+{!> ../../docs_src/request_files/tutorial002.py!}
 ```
 
 ////
@@ -376,7 +376,7 @@ And the same way as before, you can use `File()` to set additional parameters, e
 //// tab | Python 3.9+
 
 ```Python hl_lines="11  18-20"
-{!> ../../../docs_src/request_files/tutorial003_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -384,7 +384,7 @@ And the same way as before, you can use `File()` to set additional parameters, e
 //// tab | Python 3.8+
 
 ```Python hl_lines="12  19-21"
-{!> ../../../docs_src/request_files/tutorial003_an.py!}
+{!> ../../docs_src/request_files/tutorial003_an.py!}
 ```
 
 ////
@@ -398,7 +398,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9  16"
-{!> ../../../docs_src/request_files/tutorial003_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_py39.py!}
 ```
 
 ////
@@ -412,7 +412,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="11  18"
-{!> ../../../docs_src/request_files/tutorial003.py!}
+{!> ../../docs_src/request_files/tutorial003.py!}
 ```
 
 ////
index 1440d17b8b983f8e35cc9c85f8ca670c407f12a3..f1142877ad447b55464c61fc09912cb9516f30a6 100644 (file)
@@ -27,7 +27,7 @@ You just need to declare a **Pydantic model** with the fields you want to receiv
 //// tab | Python 3.9+
 
 ```Python hl_lines="9-11  15"
-{!> ../../../docs_src/request_form_models/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_form_models/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@ You just need to declare a **Pydantic model** with the fields you want to receiv
 //// tab | Python 3.8+
 
 ```Python hl_lines="8-10  14"
-{!> ../../../docs_src/request_form_models/tutorial001_an.py!}
+{!> ../../docs_src/request_form_models/tutorial001_an.py!}
 ```
 
 ////
@@ -49,7 +49,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7-9  13"
-{!> ../../../docs_src/request_form_models/tutorial001.py!}
+{!> ../../docs_src/request_form_models/tutorial001.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/request_form_models/tutorial002_an_py39.py!}
+{!> ../../docs_src/request_form_models/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -87,7 +87,7 @@ You can use Pydantic's model configuration to `forbid` any `extra` fields:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/request_form_models/tutorial002_an.py!}
+{!> ../../docs_src/request_form_models/tutorial002_an.py!}
 ```
 
 ////
@@ -101,7 +101,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/request_form_models/tutorial002.py!}
+{!> ../../docs_src/request_form_models/tutorial002.py!}
 ```
 
 ////
index 7830a2ba48cf1df3b8cd0f5110a2f9e810f5aa57..d60fc4c00b15518b88b31d8f371819c27f2f40c8 100644 (file)
@@ -19,7 +19,7 @@ $ pip install python-multipart
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ $ pip install python-multipart
 //// tab | Python 3.8+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an.py!}
 ```
 
 ////
@@ -41,7 +41,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Create file and form parameters the same way you would for `Body` or `Query`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10-12"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ Create file and form parameters the same way you would for `Body` or `Query`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 ////
index 87cfdefbc1e0093727c99f7f304d6755a1a0990e..2ccc6886e72df1c30296fb5edbe87facaaa5d17e 100644 (file)
@@ -21,7 +21,7 @@ Import `Form` from `fastapi`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -29,7 +29,7 @@ Import `Form` from `fastapi`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
 ```
 
 ////
@@ -55,7 +55,7 @@ Create form parameters the same way you would for `Body` or `Query`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -63,7 +63,7 @@ Create form parameters the same way you would for `Body` or `Query`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
 ```
 
 ////
@@ -77,7 +77,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
 ```
 
 ////
index 6a2093e6dc1804cf16e7e0175fd3ef010fea1b0b..36ccfc4ce5ba02b4fab2482a7d538cb825464f67 100644 (file)
@@ -7,7 +7,7 @@ You can use **type annotations** the same way you would for input data in functi
 //// tab | Python 3.10+
 
 ```Python hl_lines="16  21"
-{!> ../../../docs_src/response_model/tutorial001_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py310.py!}
 ```
 
 ////
@@ -15,7 +15,7 @@ You can use **type annotations** the same way you would for input data in functi
 //// tab | Python 3.9+
 
 ```Python hl_lines="18  23"
-{!> ../../../docs_src/response_model/tutorial001_01_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py39.py!}
 ```
 
 ////
@@ -23,7 +23,7 @@ You can use **type annotations** the same way you would for input data in functi
 //// tab | Python 3.8+
 
 ```Python hl_lines="18  23"
-{!> ../../../docs_src/response_model/tutorial001_01.py!}
+{!> ../../docs_src/response_model/tutorial001_01.py!}
 ```
 
 ////
@@ -62,7 +62,7 @@ You can use the `response_model` parameter in any of the *path operations*:
 //// tab | Python 3.10+
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_py310.py!}
 ```
 
 ////
@@ -70,7 +70,7 @@ You can use the `response_model` parameter in any of the *path operations*:
 //// tab | Python 3.9+
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_py39.py!}
 ```
 
 ////
@@ -78,7 +78,7 @@ You can use the `response_model` parameter in any of the *path operations*:
 //// tab | Python 3.8+
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001.py!}
+{!> ../../docs_src/response_model/tutorial001.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ Here we are declaring a `UserIn` model, it will contain a plaintext password:
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  9"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
 ```
 
 ////
@@ -124,7 +124,7 @@ Here we are declaring a `UserIn` model, it will contain a plaintext password:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  11"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ And we are using this model to declare our input and the same model to declare o
 //// tab | Python 3.10+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
 ```
 
 ////
@@ -160,7 +160,7 @@ And we are using this model to declare our input and the same model to declare o
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
 ```
 
 ////
@@ -184,7 +184,7 @@ We can instead create an input model with the plaintext password and an output m
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  11  16"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -192,7 +192,7 @@ We can instead create an input model with the plaintext password and an output m
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  11  16"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -202,7 +202,7 @@ Here, even though our *path operation function* is returning the same input user
 //// tab | Python 3.10+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -210,7 +210,7 @@ Here, even though our *path operation function* is returning the same input user
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -220,7 +220,7 @@ Here, even though our *path operation function* is returning the same input user
 //// tab | Python 3.10+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -228,7 +228,7 @@ Here, even though our *path operation function* is returning the same input user
 //// tab | Python 3.8+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -258,7 +258,7 @@ And in those cases, we can use classes and inheritance to take advantage of func
 //// tab | Python 3.10+
 
 ```Python hl_lines="7-10  13-14  18"
-{!> ../../../docs_src/response_model/tutorial003_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_01_py310.py!}
 ```
 
 ////
@@ -266,7 +266,7 @@ And in those cases, we can use classes and inheritance to take advantage of func
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-13  15-16  20"
-{!> ../../../docs_src/response_model/tutorial003_01.py!}
+{!> ../../docs_src/response_model/tutorial003_01.py!}
 ```
 
 ////
@@ -312,7 +312,7 @@ There might be cases where you return something that is not a valid Pydantic fie
 The most common case would be [returning a Response directly as explained later in the advanced docs](../advanced/response-directly.md){.internal-link target=_blank}.
 
 ```Python hl_lines="8  10-11"
-{!> ../../../docs_src/response_model/tutorial003_02.py!}
+{!> ../../docs_src/response_model/tutorial003_02.py!}
 ```
 
 This simple case is handled automatically by FastAPI because the return type annotation is the class (or a subclass of) `Response`.
@@ -324,7 +324,7 @@ And tools will also be happy because both `RedirectResponse` and `JSONResponse`
 You can also use a subclass of `Response` in the type annotation:
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/response_model/tutorial003_03.py!}
+{!> ../../docs_src/response_model/tutorial003_03.py!}
 ```
 
 This will also work because `RedirectResponse` is a subclass of `Response`, and FastAPI will automatically handle this simple case.
@@ -338,7 +338,7 @@ The same would happen if you had something like a <abbr title='A union between m
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/response_model/tutorial003_04_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_04_py310.py!}
 ```
 
 ////
@@ -346,7 +346,7 @@ The same would happen if you had something like a <abbr title='A union between m
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/response_model/tutorial003_04.py!}
+{!> ../../docs_src/response_model/tutorial003_04.py!}
 ```
 
 ////
@@ -364,7 +364,7 @@ In this case, you can disable the response model generation by setting `response
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/response_model/tutorial003_05_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_05_py310.py!}
 ```
 
 ////
@@ -372,7 +372,7 @@ In this case, you can disable the response model generation by setting `response
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/response_model/tutorial003_05.py!}
+{!> ../../docs_src/response_model/tutorial003_05.py!}
 ```
 
 ////
@@ -386,7 +386,7 @@ Your response model could have default values, like:
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  11-12"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
 ```
 
 ////
@@ -394,7 +394,7 @@ Your response model could have default values, like:
 //// tab | Python 3.9+
 
 ```Python hl_lines="11  13-14"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
 ```
 
 ////
@@ -402,7 +402,7 @@ Your response model could have default values, like:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11  13-14"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
 ```
 
 ////
@@ -422,7 +422,7 @@ You can set the *path operation decorator* parameter `response_model_exclude_uns
 //// tab | Python 3.10+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
 ```
 
 ////
@@ -430,7 +430,7 @@ You can set the *path operation decorator* parameter `response_model_exclude_uns
 //// tab | Python 3.9+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
 ```
 
 ////
@@ -438,7 +438,7 @@ You can set the *path operation decorator* parameter `response_model_exclude_uns
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
 ```
 
 ////
@@ -541,7 +541,7 @@ This also applies to `response_model_by_alias` that works similarly.
 //// tab | Python 3.10+
 
 ```Python hl_lines="29  35"
-{!> ../../../docs_src/response_model/tutorial005_py310.py!}
+{!> ../../docs_src/response_model/tutorial005_py310.py!}
 ```
 
 ////
@@ -549,7 +549,7 @@ This also applies to `response_model_by_alias` that works similarly.
 //// tab | Python 3.8+
 
 ```Python hl_lines="31  37"
-{!> ../../../docs_src/response_model/tutorial005.py!}
+{!> ../../docs_src/response_model/tutorial005.py!}
 ```
 
 ////
@@ -569,7 +569,7 @@ If you forget to use a `set` and use a `list` or `tuple` instead, FastAPI will s
 //// tab | Python 3.10+
 
 ```Python hl_lines="29  35"
-{!> ../../../docs_src/response_model/tutorial006_py310.py!}
+{!> ../../docs_src/response_model/tutorial006_py310.py!}
 ```
 
 ////
@@ -577,7 +577,7 @@ If you forget to use a `set` and use a `list` or `tuple` instead, FastAPI will s
 //// tab | Python 3.8+
 
 ```Python hl_lines="31  37"
-{!> ../../../docs_src/response_model/tutorial006.py!}
+{!> ../../docs_src/response_model/tutorial006.py!}
 ```
 
 ////
index 2613bf73d4b3bed5b47a460a9a92b8e6e626025b..73af62aed7186d1c7fff572ccd835c6fd91d6987 100644 (file)
@@ -9,7 +9,7 @@ The same way you can specify a response model, you can also declare the HTTP sta
 * etc.
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 /// note
@@ -77,7 +77,7 @@ To know more about each status code and which code is for what, check the <a hre
 Let's see the previous example again:
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 `201` is the status code for "Created".
@@ -87,7 +87,7 @@ But you don't have to memorize what each of these codes mean.
 You can use the convenience variables from `fastapi.status`.
 
 ```Python hl_lines="1  6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
 ```
 
 They are just a convenience, they hold the same number, but that way you can use the editor's autocomplete to find them:
index 20dee3a4fc147fc7bb501c45f1b2c0bd739126dd..5896b54d98373cb5afb430d9c67ccc1ec4822090 100644 (file)
@@ -11,7 +11,7 @@ You can declare `examples` for a Pydantic model that will be added to the genera
 //// tab | Python 3.10+ Pydantic v2
 
 ```Python hl_lines="13-24"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@ You can declare `examples` for a Pydantic model that will be added to the genera
 //// tab | Python 3.10+ Pydantic v1
 
 ```Python hl_lines="13-23"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310_pv1.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310_pv1.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ You can declare `examples` for a Pydantic model that will be added to the genera
 //// tab | Python 3.8+ Pydantic v2
 
 ```Python hl_lines="15-26"
-{!> ../../../docs_src/schema_extra_example/tutorial001.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@ You can declare `examples` for a Pydantic model that will be added to the genera
 //// tab | Python 3.8+ Pydantic v1
 
 ```Python hl_lines="15-25"
-{!> ../../../docs_src/schema_extra_example/tutorial001_pv1.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_pv1.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@ When using `Field()` with Pydantic models, you can also declare additional `exam
 //// tab | Python 3.10+
 
 ```Python hl_lines="2  8-11"
-{!> ../../../docs_src/schema_extra_example/tutorial002_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002_py310.py!}
 ```
 
 ////
@@ -91,7 +91,7 @@ When using `Field()` with Pydantic models, you can also declare additional `exam
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  10-13"
-{!> ../../../docs_src/schema_extra_example/tutorial002.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Here we pass `examples` containing one example of the data expected in `Body()`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="22-29"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -125,7 +125,7 @@ Here we pass `examples` containing one example of the data expected in `Body()`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="22-29"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -133,7 +133,7 @@ Here we pass `examples` containing one example of the data expected in `Body()`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="23-30"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="18-25"
-{!> ../../../docs_src/schema_extra_example/tutorial003_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_py310.py!}
 ```
 
 ////
@@ -161,7 +161,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="20-27"
-{!> ../../../docs_src/schema_extra_example/tutorial003.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ You can of course also pass multiple `examples`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="23-38"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -187,7 +187,7 @@ You can of course also pass multiple `examples`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="23-38"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -195,7 +195,7 @@ You can of course also pass multiple `examples`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="24-39"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an.py!}
 ```
 
 ////
@@ -209,7 +209,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="19-34"
-{!> ../../../docs_src/schema_extra_example/tutorial004_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_py310.py!}
 ```
 
 ////
@@ -223,7 +223,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="21-36"
-{!> ../../../docs_src/schema_extra_example/tutorial004.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004.py!}
 ```
 
 ////
@@ -270,7 +270,7 @@ You can use it like this:
 //// tab | Python 3.10+
 
 ```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -278,7 +278,7 @@ You can use it like this:
 //// tab | Python 3.9+
 
 ```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -286,7 +286,7 @@ You can use it like this:
 //// tab | Python 3.8+
 
 ```Python hl_lines="24-50"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an.py!}
 ```
 
 ////
@@ -300,7 +300,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="19-45"
-{!> ../../../docs_src/schema_extra_example/tutorial005_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_py310.py!}
 ```
 
 ////
@@ -314,7 +314,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="21-47"
-{!> ../../../docs_src/schema_extra_example/tutorial005.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005.py!}
 ```
 
 ////
index d1fe0163e8e5c18889d01bb4a616683ed76b63ec..ead2aa799224fd0817d8e9394d97d3bd80992895 100644 (file)
@@ -23,7 +23,7 @@ Copy the example in a file `main.py`:
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Copy the example in a file `main.py`:
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
 ```
 
 ////
@@ -163,7 +163,7 @@ When we create an instance of the `OAuth2PasswordBearer` class we pass in the `t
 //// tab | Python 3.9+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ When we create an instance of the `OAuth2PasswordBearer` class we pass in the `t
 //// tab | Python 3.8+
 
 ```Python  hl_lines="7"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
 ```
 
 ////
@@ -185,7 +185,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
 ```
 
 ////
@@ -229,7 +229,7 @@ Now you can pass that `oauth2_scheme` in a dependency with `Depends`.
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ Now you can pass that `oauth2_scheme` in a dependency with `Depends`.
 //// tab | Python 3.8+
 
 ```Python  hl_lines="11"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
 ```
 
 ////
@@ -251,7 +251,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
 ```
 
 ////
index 7faaa3e13bac80da8e94c09ab8f9d489279e5ba4..0698066216af2a988007017a3a7ea018827c6e70 100644 (file)
@@ -5,7 +5,7 @@ In the previous chapter the security system (which is based on the dependency in
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -13,7 +13,7 @@ In the previous chapter the security system (which is based on the dependency in
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@ The same way we use Pydantic to declare bodies, we can use it anywhere else:
 //// tab | Python 3.10+
 
 ```Python hl_lines="5  12-16"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ The same way we use Pydantic to declare bodies, we can use it anywhere else:
 //// tab | Python 3.9+
 
 ```Python hl_lines="5  12-16"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ The same way we use Pydantic to declare bodies, we can use it anywhere else:
 //// tab | Python 3.8+
 
 ```Python hl_lines="5  13-17"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="3  10-14"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -89,7 +89,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="5  12-16"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -107,7 +107,7 @@ The same as we were doing before in the *path operation* directly, our new depen
 //// tab | Python 3.10+
 
 ```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -115,7 +115,7 @@ The same as we were doing before in the *path operation* directly, our new depen
 //// tab | Python 3.9+
 
 ```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -123,7 +123,7 @@ The same as we were doing before in the *path operation* directly, our new depen
 //// tab | Python 3.8+
 
 ```Python hl_lines="26"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
 ```
 
 ////
@@ -137,7 +137,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -151,7 +151,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -163,7 +163,7 @@ Prefer to use the `Annotated` version if possible.
 //// tab | Python 3.10+
 
 ```Python hl_lines="19-22  26-27"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ Prefer to use the `Annotated` version if possible.
 //// tab | Python 3.9+
 
 ```Python hl_lines="19-22  26-27"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Prefer to use the `Annotated` version if possible.
 //// tab | Python 3.8+
 
 ```Python hl_lines="20-23  27-28"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
 ```
 
 ////
@@ -193,7 +193,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="17-20  24-25"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -207,7 +207,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="19-22  26-27"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -219,7 +219,7 @@ So now we can use the same `Depends` with our `get_current_user` in the *path op
 //// tab | Python 3.10+
 
 ```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -227,7 +227,7 @@ So now we can use the same `Depends` with our `get_current_user` in the *path op
 //// tab | Python 3.9+
 
 ```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -235,7 +235,7 @@ So now we can use the same `Depends` with our `get_current_user` in the *path op
 //// tab | Python 3.8+
 
 ```Python hl_lines="32"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
 ```
 
 ////
@@ -249,7 +249,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="29"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -263,7 +263,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -323,7 +323,7 @@ And all these thousands of *path operations* can be as small as 3 lines:
 //// tab | Python 3.10+
 
 ```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002_an_py310.py!}
+{!> ../../docs_src/security/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -331,7 +331,7 @@ And all these thousands of *path operations* can be as small as 3 lines:
 //// tab | Python 3.9+
 
 ```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002_an_py39.py!}
+{!> ../../docs_src/security/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -339,7 +339,7 @@ And all these thousands of *path operations* can be as small as 3 lines:
 //// tab | Python 3.8+
 
 ```Python hl_lines="31-33"
-{!> ../../../docs_src/security/tutorial002_an.py!}
+{!> ../../docs_src/security/tutorial002_an.py!}
 ```
 
 ////
@@ -353,7 +353,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="28-30"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -367,7 +367,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
index ba2bfef2969ad85df70553ada97f02eb45ee6140..f454a8b2845adf1c7d7d2912dc627318b1b69e4f 100644 (file)
@@ -119,7 +119,7 @@ And another one to authenticate and return a user.
 //// tab | Python 3.10+
 
 ```Python hl_lines="8  49  56-57  60-61  70-76"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -127,7 +127,7 @@ And another one to authenticate and return a user.
 //// tab | Python 3.9+
 
 ```Python hl_lines="8  49  56-57  60-61  70-76"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -135,7 +135,7 @@ And another one to authenticate and return a user.
 //// tab | Python 3.8+
 
 ```Python hl_lines="8  50  57-58  61-62  71-77"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
 ```
 
 ////
@@ -149,7 +149,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7  48  55-56  59-60  69-75"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -163,7 +163,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8  49  56-57  60-61  70-76"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
@@ -205,7 +205,7 @@ Create a utility function to generate a new access token.
 //// tab | Python 3.10+
 
 ```Python hl_lines="4 7  13-15  29-31  79-87"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -213,7 +213,7 @@ Create a utility function to generate a new access token.
 //// tab | Python 3.9+
 
 ```Python hl_lines="4 7  13-15  29-31  79-87"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -221,7 +221,7 @@ Create a utility function to generate a new access token.
 //// tab | Python 3.8+
 
 ```Python hl_lines="4 7  14-16  30-32 80-88"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
 ```
 
 ////
@@ -235,7 +235,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="3 6  12-14  28-30  78-86"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -249,7 +249,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="4 7  13-15  29-31  79-87"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
@@ -265,7 +265,7 @@ If the token is invalid, return an HTTP error right away.
 //// tab | Python 3.10+
 
 ```Python hl_lines="90-107"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ If the token is invalid, return an HTTP error right away.
 //// tab | Python 3.9+
 
 ```Python hl_lines="90-107"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -281,7 +281,7 @@ If the token is invalid, return an HTTP error right away.
 //// tab | Python 3.8+
 
 ```Python hl_lines="91-108"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
 ```
 
 ////
@@ -295,7 +295,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="89-106"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -309,7 +309,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="90-107"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
@@ -323,7 +323,7 @@ Create a real JWT access token and return it.
 //// tab | Python 3.10+
 
 ```Python hl_lines="118-133"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -331,7 +331,7 @@ Create a real JWT access token and return it.
 //// tab | Python 3.9+
 
 ```Python hl_lines="118-133"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -339,7 +339,7 @@ Create a real JWT access token and return it.
 //// tab | Python 3.8+
 
 ```Python hl_lines="119-134"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
 ```
 
 ////
@@ -353,7 +353,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="115-130"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -367,7 +367,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="116-131"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
index c9f6a1382f5f3f93d4251246b2d326f29929960a..dc15bef204db54d58db399aaeae6868895ba9cae 100644 (file)
@@ -55,7 +55,7 @@ First, import `OAuth2PasswordRequestForm`, and use it as a dependency with `Depe
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  78"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -63,7 +63,7 @@ First, import `OAuth2PasswordRequestForm`, and use it as a dependency with `Depe
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  78"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@ First, import `OAuth2PasswordRequestForm`, and use it as a dependency with `Depe
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  79"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
 ```
 
 ////
@@ -85,7 +85,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="2  74"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -99,7 +99,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="4  76"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -153,7 +153,7 @@ For the error, we use the exception `HTTPException`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="3  79-81"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -161,7 +161,7 @@ For the error, we use the exception `HTTPException`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3  79-81"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -169,7 +169,7 @@ For the error, we use the exception `HTTPException`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="3  80-82"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
 ```
 
 ////
@@ -183,7 +183,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1  75-77"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -197,7 +197,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="3  77-79"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -229,7 +229,7 @@ So, the thief won't be able to try to use those same passwords in another system
 //// tab | Python 3.10+
 
 ```Python hl_lines="82-85"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ So, the thief won't be able to try to use those same passwords in another system
 //// tab | Python 3.9+
 
 ```Python hl_lines="82-85"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ So, the thief won't be able to try to use those same passwords in another system
 //// tab | Python 3.8+
 
 ```Python hl_lines="83-86"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
 ```
 
 ////
@@ -259,7 +259,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="78-81"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="80-83"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -321,7 +321,7 @@ But for now, let's focus on the specific details we need.
 //// tab | Python 3.10+
 
 ```Python hl_lines="87"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -329,7 +329,7 @@ But for now, let's focus on the specific details we need.
 //// tab | Python 3.9+
 
 ```Python hl_lines="87"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -337,7 +337,7 @@ But for now, let's focus on the specific details we need.
 //// tab | Python 3.8+
 
 ```Python hl_lines="88"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
 ```
 
 ////
@@ -351,7 +351,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="83"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -365,7 +365,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="85"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -397,7 +397,7 @@ So, in our endpoint, we will only get a user if the user exists, was correctly a
 //// tab | Python 3.10+
 
 ```Python hl_lines="58-66  69-74  94"
-{!> ../../../docs_src/security/tutorial003_an_py310.py!}
+{!> ../../docs_src/security/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -405,7 +405,7 @@ So, in our endpoint, we will only get a user if the user exists, was correctly a
 //// tab | Python 3.9+
 
 ```Python hl_lines="58-66  69-74  94"
-{!> ../../../docs_src/security/tutorial003_an_py39.py!}
+{!> ../../docs_src/security/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -413,7 +413,7 @@ So, in our endpoint, we will only get a user if the user exists, was correctly a
 //// tab | Python 3.8+
 
 ```Python hl_lines="59-67  70-75  95"
-{!> ../../../docs_src/security/tutorial003_an.py!}
+{!> ../../docs_src/security/tutorial003_an.py!}
 ```
 
 ////
@@ -427,7 +427,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="56-64  67-70  88"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -441,7 +441,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="58-66  69-72  90"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
index 56971bf9d983174459ed160bc64850a06c2c576f..f65fa773cd7c35129d3b55311715237923d7127d 100644 (file)
@@ -122,13 +122,13 @@ Let's refer to the file `sql_app/database.py`.
 ### Import the SQLAlchemy parts
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 ### Create a database URL for SQLAlchemy
 
 ```Python hl_lines="5-6"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 In this example, we are "connecting" to a SQLite database (opening a file with the SQLite database).
@@ -158,7 +158,7 @@ The first step is to create a SQLAlchemy "engine".
 We will later use this `engine` in other places.
 
 ```Python hl_lines="8-10"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 #### Note
@@ -196,7 +196,7 @@ We will use `Session` (the one imported from SQLAlchemy) later.
 To create the `SessionLocal` class, use the function `sessionmaker`:
 
 ```Python hl_lines="11"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 ### Create a `Base` class
@@ -206,7 +206,7 @@ Now we will use the function `declarative_base()` that returns a class.
 Later we will inherit from this class to create each of the database models or classes (the ORM models):
 
 ```Python hl_lines="13"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 ## Create the database models
@@ -232,7 +232,7 @@ Create classes that inherit from it.
 These classes are the SQLAlchemy models.
 
 ```Python hl_lines="4  7-8  18-19"
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
 ```
 
 The `__tablename__` attribute tells SQLAlchemy the name of the table to use in the database for each of these models.
@@ -248,7 +248,7 @@ We use `Column` from SQLAlchemy as the default value.
 And we pass a SQLAlchemy class "type", as `Integer`, `String`, and `Boolean`, that defines the type in the database, as an argument.
 
 ```Python hl_lines="1  10-13  21-24"
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
 ```
 
 ### Create the relationships
@@ -260,7 +260,7 @@ For this, we use `relationship` provided by SQLAlchemy ORM.
 This will become, more or less, a "magic" attribute that will contain the values from other tables related to this one.
 
 ```Python hl_lines="2  15  26"
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
 ```
 
 When accessing the attribute `items` in a `User`, as in `my_user.items`, it will have a list of `Item` SQLAlchemy models (from the `items` table) that have a foreign key pointing to this record in the `users` table.
@@ -478,7 +478,7 @@ Create utility functions to:
 * Read multiple items.
 
 ```Python hl_lines="1  3  6-7  10-11  14-15  27-28"
-{!../../../docs_src/sql_databases/sql_app/crud.py!}
+{!../../docs_src/sql_databases/sql_app/crud.py!}
 ```
 
 /// tip
@@ -499,7 +499,7 @@ The steps are:
 * `refresh` your instance (so that it contains any new data from the database, like the generated ID).
 
 ```Python hl_lines="18-24  31-36"
-{!../../../docs_src/sql_databases/sql_app/crud.py!}
+{!../../docs_src/sql_databases/sql_app/crud.py!}
 ```
 
 /// info
@@ -752,13 +752,13 @@ For example, in a background task worker with <a href="https://docs.celeryq.dev"
 * `sql_app/database.py`:
 
 ```Python
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 * `sql_app/models.py`:
 
 ```Python
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
 ```
 
 * `sql_app/schemas.py`:
@@ -790,7 +790,7 @@ For example, in a background task worker with <a href="https://docs.celeryq.dev"
 * `sql_app/crud.py`:
 
 ```Python
-{!../../../docs_src/sql_databases/sql_app/crud.py!}
+{!../../docs_src/sql_databases/sql_app/crud.py!}
 ```
 
 * `sql_app/main.py`:
index b8ce3b551c596ae054011cd93f7f0f1509e924fc..2e93bd60b2ea3d290d61d9b6b40cc48b9c15c16f 100644 (file)
@@ -8,7 +8,7 @@ You can serve static files automatically from a directory using `StaticFiles`.
 * "Mount" a `StaticFiles()` instance in a specific path.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
 ```
 
 /// note | "Technical Details"
index 06a87e92ec8d458c93a43004b442ba83739ec36b..7f609a59589647c453c1dd95bb03c91528fff39d 100644 (file)
@@ -31,7 +31,7 @@ Use the `TestClient` object the same way as you do with `httpx`.
 Write simple `assert` statements with the standard Python expressions that you need to check (again, standard `pytest`).
 
 ```Python hl_lines="2  12  15-18"
-{!../../../docs_src/app_testing/tutorial001.py!}
+{!../../docs_src/app_testing/tutorial001.py!}
 ```
 
 /// tip
@@ -79,7 +79,7 @@ In the file `main.py` you have your **FastAPI** app:
 
 
 ```Python
-{!../../../docs_src/app_testing/main.py!}
+{!../../docs_src/app_testing/main.py!}
 ```
 
 ### Testing file
@@ -97,7 +97,7 @@ Then you could have a file `test_main.py` with your tests. It could live on the
 Because this file is in the same package, you can use relative imports to import the object `app` from the `main` module (`main.py`):
 
 ```Python hl_lines="3"
-{!../../../docs_src/app_testing/test_main.py!}
+{!../../docs_src/app_testing/test_main.py!}
 ```
 
 ...and have the code for the tests just like before.
@@ -129,7 +129,7 @@ Both *path operations* require an `X-Token` header.
 //// tab | Python 3.10+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py310/main.py!}
 ```
 
 ////
@@ -137,7 +137,7 @@ Both *path operations* require an `X-Token` header.
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an_py39/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py39/main.py!}
 ```
 
 ////
@@ -145,7 +145,7 @@ Both *path operations* require an `X-Token` header.
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an/main.py!}
+{!> ../../docs_src/app_testing/app_b_an/main.py!}
 ```
 
 ////
@@ -159,7 +159,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_py310/main.py!}
 ```
 
 ////
@@ -173,7 +173,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/main.py!}
+{!> ../../docs_src/app_testing/app_b/main.py!}
 ```
 
 ////
@@ -183,7 +183,7 @@ Prefer to use the `Annotated` version if possible.
 You could then update `test_main.py` with the extended tests:
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/test_main.py!}
+{!> ../../docs_src/app_testing/app_b/test_main.py!}
 ```
 
 Whenever you need the client to pass information in the request and you don't know how to, you can search (Google) how to do it in `httpx`, or even how to do it with `requests`, as HTTPX's design is based on Requests' design.
index 5161b891be23b3e2bd959dbb55a24f0edc347c0c..a18af202267038eda8e42823644da63d4f0a74cc 100644 (file)
@@ -305,7 +305,6 @@ markdown_extensions:
 
   # Other extensions
   mdx_include:
-    base_path: docs
 
 extra:
   analytics:
index 664604c594ff32091b731bd04285d235c2888c3b..4a0625c255119639a0bb026f080993e9035367a3 100644 (file)
@@ -15,7 +15,7 @@ Pero también quieres que acepte nuevos ítems. Cuando los ítems no existan ant
 Para conseguir esto importa `JSONResponse` y devuelve ahí directamente tu contenido, asignando el `status_code` que quieras:
 
 ```Python hl_lines="4  25"
-{!../../../docs_src/additional_status_codes/tutorial001.py!}
+{!../../docs_src/additional_status_codes/tutorial001.py!}
 ```
 
 /// warning | Advertencia
index 18f96213f40f9a49a3a0bb8cc2ddfb5acd935663..f6813f0ff5fb702ab5ca980d2a72bc4b3d8e5b34 100644 (file)
@@ -13,7 +13,7 @@ Puedes asignar el `operationId` de OpenAPI para ser usado en tu *operación de p
 En este caso tendrías que asegurarte de que sea único para cada operación.
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
 ```
 
 ### Usando el nombre de la *función de la operación de path* en el operationId
@@ -23,7 +23,7 @@ Si quieres usar tus nombres de funciones de API como `operationId`s, puedes iter
 Deberías hacerlo después de adicionar todas tus *operaciones de path*.
 
 ```Python hl_lines="2 12 13 14 15 16 17 18 19 20 21 24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
 ```
 
 /// tip | Consejo
@@ -45,7 +45,7 @@ Incluso si están en diferentes módulos (archivos Python).
 Para excluir una *operación de path* del esquema OpenAPI generado (y por tanto del la documentación generada automáticamente), usa el parámetro `include_in_schema` y asigna el valor como `False`;
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
 ```
 
 ## Descripción avanzada desde el docstring
@@ -57,5 +57,5 @@ Agregar un `\f` (un carácter de "form feed" escapado) hace que **FastAPI** trun
 No será mostrado en la documentación, pero otras herramientas (como Sphinx) serán capaces de usar el resto.
 
 ```Python hl_lines="19 20 21 22 23 24 25 26 27 28 29"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
 ```
index ecd9fad416fa378465fb3d3f4c2fee69ba7dbee1..ddfd05a77fdbf8a7d9e19ac70981da72ce40c7c1 100644 (file)
@@ -21,7 +21,7 @@ Puedes declarar un parámetro de tipo `Response` en tu *función de la operació
 Y luego puedes establecer el `status_code` en ese objeto de respuesta *temporal*.
 
 ```Python hl_lines="1  9  12"
-{!../../../docs_src/response_change_status_code/tutorial001.py!}
+{!../../docs_src/response_change_status_code/tutorial001.py!}
 ```
 
 Y luego puedes retornar cualquier objeto que necesites, como normalmente lo harías (un `dict`, un modelo de base de datos, etc).
index 4eeab3fd0d3b52254de182cbd6218bbe9165c8b5..8800d25108f5ed8efc7041d5ec582706ff680772 100644 (file)
@@ -35,7 +35,7 @@ Por ejemplo, no puedes poner un modelo Pydantic en una `JSONResponse` sin primer
 Para esos casos, puedes usar el `jsonable_encoder` para convertir tus datos antes de pasarlos a la respuesta:
 
 ```Python hl_lines="4 6 20 21"
-{!../../../docs_src/response_directly/tutorial001.py!}
+{!../../docs_src/response_directly/tutorial001.py!}
 ```
 
 /// note | Detalles Técnicos
@@ -57,7 +57,7 @@ Digamos que quieres devolver una respuesta <a href="https://en.wikipedia.org/wik
 Podrías poner tu contenido XML en un string, ponerlo en una `Response` y devolverlo:
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ## Notas
index c3aa2099310618654af775ac3f40e78257cb3a74..01d4fbc082a3f72cfae8231aa8c9fdb99c463f04 100644 (file)
@@ -7,7 +7,7 @@ Puedes declarar un parámetro de tipo `Response` en tu *función de operación d
 Y entonces, podrás configurar las cookies en ese objeto de response *temporal*.
 
 ```Python hl_lines="1  7-8"
-{!../../../docs_src/response_headers/tutorial002.py!}
+{!../../docs_src/response_headers/tutorial002.py!}
 ```
 
 Posteriormente, puedes devolver cualquier objeto que necesites, como normalmente harías (un `dict`, un modelo de base de datos, etc).
@@ -26,7 +26,7 @@ Adicionalmente, puedes añadir headers cuando se retorne una `Response` directam
 Crea un response tal como se describe en [Retornar una respuesta directamente](response-directly.md){.internal-link target=_blank} y pasa los headers como un parámetro adicional:
 
 ```Python hl_lines="10-12"
-{!../../../docs_src/response_headers/tutorial001.py!}
+{!../../docs_src/response_headers/tutorial001.py!}
 ```
 
 /// note | Detalles Técnicos
index 590c2e828b5fc35d81adc34cf67d4ce0f323e7b5..9e5f3c9d50c3504df19048c2451db4179d8635c9 100644 (file)
@@ -36,7 +36,7 @@ Dependiendo de tus casos de uso, podrías preferir usar una library diferente, p
 Aquí hay una pequeña muestra de cómo podrías integrar Strawberry con FastAPI:
 
 ```Python hl_lines="3  22  25-26"
-{!../../../docs_src/graphql/tutorial001.py!}
+{!../../docs_src/graphql/tutorial001.py!}
 ```
 
 Puedes aprender más sobre Strawberry en la <a href="https://strawberry.rocks/" class="external-link" target="_blank">documentación de Strawberry</a>.
index c873385bcba33d9f7630fc8223a4232f009b77b7..156907ad12d4818eebf9696881a01780765d7dd6 100644 (file)
@@ -23,7 +23,7 @@ Si eres un experto en Python y ya lo sabes todo sobre los type hints, salta al s
 Comencemos con un ejemplo simple:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 Llamar este programa nos muestra el siguiente <abbr title="en español: salida">output</abbr>:
@@ -39,7 +39,7 @@ La función hace lo siguiente:
 * Las <abbr title="las junta como si fuesen una. Con el contenido de una después de la otra. En inglés: concatenate.">concatena</abbr> con un espacio en la mitad.
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### Edítalo
@@ -83,7 +83,7 @@ Eso es todo.
 Esos son los "type hints":
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 No es lo mismo a declarar valores por defecto, como sería con:
@@ -113,7 +113,7 @@ Con esto puedes moverte hacia abajo viendo las opciones hasta que encuentras una
 Mira esta función que ya tiene type hints:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 Como el editor conoce el tipo de las variables no solo obtienes auto-completado, si no que también obtienes chequeo de errores:
@@ -123,7 +123,7 @@ Como el editor conoce el tipo de las variables no solo obtienes auto-completado,
 Ahora que sabes que tienes que arreglarlo convierte `age` a un string con `str(age)`:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## Declarando tipos
@@ -144,7 +144,7 @@ Por ejemplo, puedes usar:
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### Tipos con sub-tipos
@@ -162,7 +162,7 @@ Por ejemplo, vamos a definir una variable para que sea una `list` compuesta de `
 De `typing`, importa `List` (con una `L` mayúscula):
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 Declara la variable con la misma sintaxis de los dos puntos (`:`).
@@ -172,7 +172,7 @@ Pon `List` como el tipo.
 Como la lista es un tipo que permite tener un "sub-tipo" pones el sub-tipo en corchetes `[]`:
 
 ```Python hl_lines="4"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 Esto significa: la variable `items` es una `list` y cada uno de los ítems en esta lista es un `str`.
@@ -192,7 +192,7 @@ El editor aún sabe que es un `str` y provee soporte para ello.
 Harías lo mismo para declarar `tuple`s y `set`s:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial007.py!}
+{!../../docs_src/python_types/tutorial007.py!}
 ```
 
 Esto significa:
@@ -209,7 +209,7 @@ El primer sub-tipo es para los keys del `dict`.
 El segundo sub-tipo es para los valores del `dict`:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial008.py!}
+{!../../docs_src/python_types/tutorial008.py!}
 ```
 
 Esto significa:
@@ -225,13 +225,13 @@ También puedes declarar una clase como el tipo de una variable.
 Digamos que tienes una clase `Person`con un nombre:
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 Entonces puedes declarar una variable que sea de tipo `Person`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 Una vez más tendrás todo el soporte del editor:
@@ -253,7 +253,7 @@ Y obtienes todo el soporte del editor con el objeto resultante.
 Tomado de la documentación oficial de Pydantic:
 
 ```Python
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 /// info | Información
index 3eaea31f931c7ddbd94be8ca841faa8beb02a909..e858e34e8ad08db09c841d478054538c47d076ee 100644 (file)
@@ -9,7 +9,7 @@ Primero importa `Cookie`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Primero importa `Cookie`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Primero importa `Cookie`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Es preferible utilizar la versión `Annotated` si es posible.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Es preferible utilizar la versión `Annotated` si es posible.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
@@ -67,7 +67,7 @@ El primer valor es el valor por defecto, puedes pasar todos los parámetros adic
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ El primer valor es el valor por defecto, puedes pasar todos los parámetros adic
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@ El primer valor es el valor por defecto, puedes pasar todos los parámetros adic
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ Es preferible utilizar la versión `Annotated` si es posible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -111,7 +111,7 @@ Es preferible utilizar la versión `Annotated` si es posible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
index 8d8909b970ddf2a00e0668ff6bfbafc2c7685ec1..68df00e64e72fb429ed728f61ee144b4c27f0b9c 100644 (file)
@@ -3,7 +3,7 @@
 Un archivo muy simple de FastAPI podría verse así:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Copia eso a un archivo `main.py`.
@@ -134,7 +134,7 @@ También podrías usarlo para generar código automáticamente, para los cliente
 ### Paso 1: importa `FastAPI`
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI` es una clase de Python que provee toda la funcionalidad para tu API.
@@ -150,7 +150,7 @@ También puedes usar toda la funcionalidad de <a href="https://www.starlette.io/
 ### Paso 2: crea un "instance" de `FastAPI`
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Aquí la variable `app` será un instance de la clase `FastAPI`.
@@ -172,7 +172,7 @@ $ uvicorn main:app --reload
 Si creas un app como:
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
 ```
 
 y lo guardas en un archivo `main.py`, entonces ejecutarías `uvicorn` así:
@@ -251,7 +251,7 @@ Nosotros también los llamaremos "**operación**".
 #### Define un *decorador de operaciones de path*
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 El `@app.get("/")` le dice a **FastAPI** que la función que tiene justo debajo está a cargo de manejar los requests que van a:
@@ -307,7 +307,7 @@ Esta es nuestra  "**función de la operación de path**":
 * **función**: es la función debajo del "decorador" (debajo de `@app.get("/")`).
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Esto es una función de Python.
@@ -321,7 +321,7 @@ En este caso es una función `async`.
 También podrías definirla como una función estándar en lugar de `async def`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note | Nota
@@ -333,7 +333,7 @@ Si no sabes la diferencia, revisa el [Async: *"¿Tienes prisa?"*](../async.md#ti
 ### Paso 5: devuelve el contenido
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Puedes devolver `dict`, `list`, valores singulares como un `str`, `int`, etc.
index e09e0381fc69bce7b92415f1b7aec369a771247b..167c88659367182099af7072f1927dda72e806d0 100644 (file)
@@ -3,7 +3,7 @@
 Puedes declarar los "parámetros" o "variables" con la misma sintaxis que usan los format strings de Python:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
 ```
 
 El valor del parámetro de path `item_id` será pasado a tu función como el argumento `item_id`.
@@ -19,7 +19,7 @@ Entonces, si corres este ejemplo y vas a <a href="http://127.0.0.1:8000/items/fo
 Puedes declarar el tipo de un parámetro de path en la función usando las anotaciones de tipos estándar de Python:
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
 ```
 
 En este caso, `item_id` es declarado como un `int`.
@@ -122,7 +122,7 @@ Digamos algo como `/users/me` que sea para obtener datos del usuario actual.
 Porque las *operaciones de path* son evaluadas en orden, tienes que asegurarte de que el path para `/users/me` sea declarado antes que el path para `/users/{user_id}`:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
 ```
 
 De otra manera el path para `/users/{user_id}` coincidiría también con `/users/me` "pensando" que está recibiendo el parámetro `user_id` con el valor `"me"`.
@@ -140,7 +140,7 @@ Al heredar desde `str` la documentación de la API podrá saber que los valores
 Luego crea atributos de clase con valores fijos, que serán los valores disponibles válidos:
 
 ```Python hl_lines="1  6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// info | Información
@@ -160,7 +160,7 @@ Si lo estás dudando, "AlexNet", "ResNet", y "LeNet" son solo nombres de <abbr t
 Luego, crea un *parámetro de path* con anotaciones de tipos usando la clase enum que creaste (`ModelName`):
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 ### Revisa la documentación
@@ -178,7 +178,7 @@ El valor del *parámetro de path* será un *enumeration member*.
 Puedes compararlo con el *enumeration member* en el enum (`ModelName`) que creaste:
 
 ```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 #### Obtén el *enumeration value*
@@ -186,7 +186,7 @@ Puedes compararlo con el *enumeration member* en el enum (`ModelName`) que creas
 Puedes obtener el valor exacto (un `str` en este caso) usando `model_name.value`, o en general, `your_enum_member.value`:
 
 ```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// tip | Consejo
@@ -202,7 +202,7 @@ Puedes devolver *enum members* desde tu *operación de path* inclusive en un bod
 Ellos serán convertidos a sus valores correspondientes (strings en este caso) antes de devolverlos al cliente:
 
 ```Python hl_lines="18  21  23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 En tu cliente obtendrás una respuesta en JSON como:
@@ -243,7 +243,7 @@ En este caso el nombre del parámetro es `file_path` y la última parte, `:path`
 Entonces lo puedes usar con:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
 ```
 
 /// tip | Consejo
index 6f88fd6170946482610ba72879d2c77f16451ecc..f9b5cf69d29dc6fe85f66cb0b609ed66ecec00f6 100644 (file)
@@ -3,7 +3,7 @@
 Cuando declaras otros parámetros de la función que no hacen parte de los parámetros de path estos se interpretan automáticamente como parámetros de "query".
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
 ```
 
 El query es el conjunto de pares de key-value que van después del `?` en la URL, separados por caracteres `&`.
@@ -64,7 +64,7 @@ Los valores de los parámetros en tu función serán:
 Del mismo modo puedes declarar parámetros de query opcionales definiendo el valor por defecto como `None`:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial002.py!}
+{!../../docs_src/query_params/tutorial002.py!}
 ```
 
 En este caso el parámetro de la función `q` será opcional y será `None` por defecto.
@@ -88,7 +88,7 @@ El `Union` en `Union[str, None]` no es usado por FastAPI (FastAPI solo usará la
 También puedes declarar tipos `bool` y serán convertidos:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial003.py!}
+{!../../docs_src/query_params/tutorial003.py!}
 ```
 
 En este caso, si vas a:
@@ -132,7 +132,7 @@ No los tienes que declarar en un orden específico.
 Serán detectados por nombre:
 
 ```Python hl_lines="8  10"
-{!../../../docs_src/query_params/tutorial004.py!}
+{!../../docs_src/query_params/tutorial004.py!}
 ```
 
 ## Parámetros de query requeridos
@@ -144,7 +144,7 @@ Si no quieres añadir un valor específico sino solo hacerlo opcional, pon el va
 Pero cuando quieres hacer que un parámetro de query sea requerido, puedes simplemente no declararle un valor por defecto:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
 ```
 
 Aquí el parámetro de query `needy` es un parámetro de query requerido, del tipo `str`.
@@ -190,7 +190,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
 Por supuesto que también puedes definir algunos parámetros como requeridos, con un valor por defecto y otros completamente opcionales:
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params/tutorial006.py!}
+{!../../docs_src/query_params/tutorial006.py!}
 ```
 
 En este caso hay 3 parámetros de query:
index 6f2359b94ee513b4e96d1ecbde27fb89578ded42..5e43267768d6d9db15f8c603460e90335eae6913 100644 (file)
@@ -13,7 +13,7 @@
 
 
 ```Python hl_lines="3  6-8"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### زیر برنامه
@@ -23,7 +23,7 @@
 این زیر برنامه فقط یکی دیگر از برنامه های استاندارد FastAPI است، اما این برنامه ای است که متصل می شود:
 
 ```Python hl_lines="11  14-16"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### اتصال زیر برنامه
@@ -31,7 +31,7 @@
 در برنامه سطح بالا `app` اتصال زیر برنامه `subapi` در این نمونه `/subapi` در مسیر قرار میدهد و میشود:
 
 ```Python hl_lines="11  19"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### اسناد API خودکار را بررسی کنید
index e3ee5fcbc311c71f52be6c7f90536a537c5d71c7..ca631d5073fceb0f64b0316cf56fe273ca9e8c15 100644 (file)
@@ -31,7 +31,7 @@
 * شما می‌توانید سپس `پاسخ` را تغییر داده و پس از آن را برگردانید.
 
 ```Python hl_lines="8-9  11  14"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 /// نکته | به خاطر داشته باشید که هدرهای اختصاصی سفارشی را می توان با استفاده از پیشوند "X-" اضافه کرد.
@@ -57,7 +57,7 @@
 به عنوان مثال، می‌توانید یک هدر سفارشی به نام `X-Process-Time` که شامل زمان پردازش درخواست و تولید پاسخ به صورت ثانیه است، اضافه کنید.
 
 ```Python hl_lines="10  12-13"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
  ## سایر میان افزار
index 44bbf50f8375b4dcba29cdd4bb0487b047b37020..52a0a079253fa3d8c2b4d8bf7628ed1b96ab6f33 100644 (file)
@@ -27,7 +27,7 @@ Chacun de ces `dict` de réponse peut avoir une clé `model`, contenant un modè
 Par exemple, pour déclarer une autre réponse avec un code HTTP `404` et un modèle Pydantic `Message`, vous pouvez écrire :
 
 ```Python hl_lines="18 22"
-{!../../../docs_src/additional_responses/tutorial001.py!}
+{!../../docs_src/additional_responses/tutorial001.py!}
 ```
 
 /// note | "Remarque"
@@ -178,7 +178,7 @@ Vous pouvez utiliser ce même paramètre `responses` pour ajouter différents ty
 Par exemple, vous pouvez ajouter un type de média supplémentaire `image/png`, en déclarant que votre *opération de chemin* peut renvoyer un objet JSON (avec le type de média `application/json`) ou une image PNG :
 
 ```Python hl_lines="19-24 28"
-{!../../../docs_src/additional_responses/tutorial002.py!}
+{!../../docs_src/additional_responses/tutorial002.py!}
 ```
 
 /// note | "Remarque"
@@ -208,7 +208,7 @@ Par exemple, vous pouvez déclarer une réponse avec un code HTTP `404` qui util
 Et une réponse avec un code HTTP `200` qui utilise votre `response_model`, mais inclut un `example` personnalisé :
 
 ```Python hl_lines="20-31"
-{!../../../docs_src/additional_responses/tutorial003.py!}
+{!../../docs_src/additional_responses/tutorial003.py!}
 ```
 
 Tout sera combiné et inclus dans votre OpenAPI, et affiché dans la documentation de l'API :
@@ -244,7 +244,7 @@ Vous pouvez utiliser cette technique pour réutiliser certaines réponses préd
 Par exemple:
 
 ```Python hl_lines="13-17 26"
-{!../../../docs_src/additional_responses/tutorial004.py!}
+{!../../docs_src/additional_responses/tutorial004.py!}
 ```
 
 ## Plus d'informations sur les réponses OpenAPI
index 46db2e0b66551021a229bb9f87055e7ba1ae31e6..06a8043ea47ef8d9cf00b278b9550f6213d7d0e7 100644 (file)
@@ -15,7 +15,7 @@ Mais vous voulez aussi qu'il accepte de nouveaux éléments. Et lorsque les él
 Pour y parvenir, importez `JSONResponse` et renvoyez-y directement votre contenu, en définissant le `status_code` que vous souhaitez :
 
 ```Python hl_lines="4 25"
-{!../../../docs_src/additional_status_codes/tutorial001.py!}
+{!../../docs_src/additional_status_codes/tutorial001.py!}
 ```
 
 /// warning | "Attention"
index 4727020aeb08c5d7c0a4bb3408817b890880acd3..94b20b0f33c5bd68267fc3c4b2d57ca1c955db79 100644 (file)
@@ -13,7 +13,7 @@ Dans OpenAPI, les chemins sont des ressources, tels que /users/ ou /items/, expo
 Vous devez vous assurer qu'il est unique pour chaque opération.
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
 ```
 
 ### Utilisation du nom *path operation function* comme operationId
@@ -23,7 +23,7 @@ Si vous souhaitez utiliser les noms de fonction de vos API comme `operationId`,
 Vous devriez le faire après avoir ajouté toutes vos *paramètres de chemin*.
 
 ```Python hl_lines="2  12-21  24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
 ```
 
 /// tip | "Astuce"
@@ -45,7 +45,7 @@ Même s'ils se trouvent dans des modules différents (fichiers Python).
 Pour exclure un *chemin* du schéma OpenAPI généré (et donc des systèmes de documentation automatiques), utilisez le paramètre `include_in_schema` et assignez-lui la valeur `False` :
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
 ```
 
 ## Description avancée de docstring
@@ -57,7 +57,7 @@ L'ajout d'un `\f` (un caractère d'échappement "form feed") va permettre à **F
 Il n'apparaîtra pas dans la documentation, mais d'autres outils (tel que Sphinx) pourront utiliser le reste.
 
 ```Python hl_lines="19-29"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
 ```
 
 ## Réponses supplémentaires
@@ -99,7 +99,7 @@ Vous pouvez étendre le schéma OpenAPI pour une *opération de chemin* en utili
 Cet `openapi_extra` peut être utile, par exemple, pour déclarer [OpenAPI Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions) :
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial005.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial005.py!}
 ```
 
 Si vous ouvrez la documentation automatique de l'API, votre extension apparaîtra au bas du *chemin* spécifique.
@@ -148,7 +148,7 @@ Par exemple, vous pouvez décider de lire et de valider la requête avec votre p
 Vous pouvez le faire avec `openapi_extra` :
 
 ```Python hl_lines="20-37 39-40"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial006.py !}
+{!../../docs_src/path_operation_advanced_configuration/tutorial006.py !}
 ```
 
 Dans cet exemple, nous n'avons déclaré aucun modèle Pydantic. En fait, le corps de la requête n'est même pas <abbr title="converti d'un format simple, comme des octets, en objets Python">parsé</abbr> en tant que JSON, il est lu directement en tant que `bytes`, et la fonction `magic_data_reader()` serait chargé de l'analyser d'une manière ou d'une autre.
@@ -164,7 +164,7 @@ Et vous pouvez le faire même si le type de données dans la requête n'est pas
 Dans cet exemple, nous n'utilisons pas les fonctionnalités de FastAPI pour extraire le schéma JSON des modèles Pydantic ni la validation automatique pour JSON. En fait, nous déclarons le type de contenu de la requête en tant que YAML, et non JSON :
 
 ```Python hl_lines="17-22  24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
 ```
 
 Néanmoins, bien que nous n'utilisions pas la fonctionnalité par défaut, nous utilisons toujours un modèle Pydantic pour générer manuellement le schéma JSON pour les données que nous souhaitons recevoir en YAML.
@@ -174,7 +174,7 @@ Ensuite, nous utilisons directement la requête et extrayons son contenu en tant
 Et nous analysons directement ce contenu YAML, puis nous utilisons à nouveau le même modèle Pydantic pour valider le contenu YAML :
 
 ```Python hl_lines="26-33"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial007.py!}
 ```
 
 /// tip | "Astuce"
index 49ca322300636d506fc2623df5b426e21c82e650..80876bc18b03cc4c8278f21f433ddfb44880836c 100644 (file)
@@ -35,7 +35,7 @@ Par exemple, vous ne pouvez pas mettre un modèle Pydantic dans une `JSONRespons
 Pour ces cas, vous pouvez spécifier un appel à `jsonable_encoder` pour convertir vos données avant de les passer à une réponse :
 
 ```Python hl_lines="6-7  21-22"
-{!../../../docs_src/response_directly/tutorial001.py!}
+{!../../docs_src/response_directly/tutorial001.py!}
 ```
 
 /// note | "Détails techniques"
@@ -57,7 +57,7 @@ Disons que vous voulez retourner une réponse <a href="https://en.wikipedia.org/
 Vous pouvez mettre votre contenu XML dans une chaîne de caractères, la placer dans une `Response`, et la retourner :
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ## Notes
index e3c99e0a9f26fc66d60d820b32eac380f25b4d1e..2992347be88292c733fe2c6fc24fe22b5e752892 100644 (file)
@@ -24,7 +24,7 @@ Si vous êtes un expert Python, et que vous savez déjà **tout** sur les annota
 Prenons un exemple simple :
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 Exécuter ce programe affiche :
@@ -40,7 +40,7 @@ La fonction :
 * Concatène les résultats avec un espace entre les deux.
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### Limitations
@@ -85,7 +85,7 @@ C'est tout.
 Ce sont des annotations de types :
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 À ne pas confondre avec la déclaration de valeurs par défaut comme ici :
@@ -115,7 +115,7 @@ Vous pouvez donc dérouler les options jusqu'à trouver la méthode à laquelle
 Cette fonction possède déjà des annotations de type :
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 Comme l'éditeur connaît le type des variables, vous n'avez pas seulement l'auto-complétion, mais aussi de la détection d'erreurs :
@@ -125,7 +125,7 @@ Comme l'éditeur connaît le type des variables, vous n'avez pas seulement l'aut
 Maintenant que vous avez connaissance du problème, convertissez `age` en <abbr title="string">chaîne de caractères</abbr> grâce à `str(age)` :
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## Déclarer des types
@@ -146,7 +146,7 @@ Comme par exemple :
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### Types génériques avec des paramètres de types
@@ -164,7 +164,7 @@ Par exemple, définissons une variable comme `list` de `str`.
 Importez `List` (avec un `L` majuscule) depuis `typing`.
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 Déclarez la variable, en utilisant la syntaxe des deux-points (`:`).
@@ -174,7 +174,7 @@ Et comme type, mettez `List`.
 Les listes étant un type contenant des types internes, mettez ces derniers entre crochets (`[`, `]`) :
 
 ```Python hl_lines="4"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 /// tip | "Astuce"
@@ -202,7 +202,7 @@ Et pourtant, l'éditeur sait qu'elle est de type `str` et pourra donc vous aider
 C'est le même fonctionnement pour déclarer un `tuple` ou un `set` :
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial007.py!}
+{!../../docs_src/python_types/tutorial007.py!}
 ```
 
 Dans cet exemple :
@@ -217,7 +217,7 @@ Pour définir un `dict`, il faut lui passer 2 paramètres, séparés par une vir
 Le premier paramètre de type est pour les clés et le second pour les valeurs du dictionnaire (`dict`).
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial008.py!}
+{!../../docs_src/python_types/tutorial008.py!}
 ```
 
 Dans cet exemple :
@@ -231,7 +231,7 @@ Dans cet exemple :
 Vous pouvez aussi utiliser `Optional` pour déclarer qu'une variable a un type, comme `str` mais qu'il est "optionnel" signifiant qu'il pourrait aussi être `None`.
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 Utiliser `Optional[str]` plutôt que `str` permettra à l'éditeur de vous aider à détecter les erreurs où vous supposeriez qu'une valeur est toujours de type `str`, alors qu'elle pourrait aussi être `None`.
@@ -256,13 +256,13 @@ Vous pouvez aussi déclarer une classe comme type d'une variable.
 Disons que vous avez une classe `Person`, avec une variable `name` :
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Vous pouvez ensuite déclarer une variable de type `Person` :
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Et vous aurez accès, encore une fois, au support complet offert par l'éditeur :
@@ -284,7 +284,7 @@ Ainsi, votre éditeur vous offrira un support adapté pour l'objet résultant.
 Extrait de la documentation officielle de **Pydantic** :
 
 ```Python
-{!../../../docs_src/python_types/tutorial011.py!}
+{!../../docs_src/python_types/tutorial011.py!}
 ```
 
 /// info
index f7cf1a6ccc17eccfa5f7bb948e6be0c589ccd094..d971d293dc9ecd4d170deca0f31e4f840643d2b8 100644 (file)
@@ -17,7 +17,7 @@ Cela comprend, par exemple :
 Pour commencer, importez `BackgroundTasks` et définissez un paramètre dans votre *fonction de chemin* avec `BackgroundTasks` comme type déclaré.
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 **FastAPI** créera l'objet de type `BackgroundTasks` pour vous et le passera comme paramètre.
@@ -33,7 +33,7 @@ Dans cet exemple, la fonction de tâche écrira dans un fichier (afin de simuler
 L'opération d'écriture n'utilisant ni `async` ni `await`, on définit la fonction avec un `def` normal.
 
 ```Python hl_lines="6-9"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 ## Ajouter une tâche d'arrière-plan
@@ -42,7 +42,7 @@ Dans votre *fonction de chemin*, passez votre fonction de tâche à l'objet de t
 
 
 ```Python hl_lines="14"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 `.add_task()` reçoit comme arguments :
@@ -58,7 +58,7 @@ Utiliser `BackgroundTasks` fonctionne aussi avec le système d'injection de dép
 **FastAPI** sait quoi faire dans chaque cas et comment réutiliser le même objet, afin que tous les paramètres de type `BackgroundTasks` soient fusionnés et que les tâches soient exécutées en arrière-plan :
 
 ```Python hl_lines="13  15  22  25"
-{!../../../docs_src/background_tasks/tutorial002.py!}
+{!../../docs_src/background_tasks/tutorial002.py!}
 ```
 
 Dans cet exemple, les messages seront écrits dans le fichier `log.txt` après que la réponse soit envoyée.
index fd8e5d6882a4c1805fd43b11ec4cf6b43f8717bb..dafd869e32d8c89aed8ffba99a469fd6259a1bee 100644 (file)
@@ -11,7 +11,7 @@ Vous pouvez également déclarer des paramètres body comme étant optionnels, e
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-20"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@ Vous pouvez également déclarer des paramètres body comme étant optionnels, e
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-20"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ Vous pouvez également déclarer des paramètres body comme étant optionnels, e
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-21"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an.py!}
 ```
 
 ////
@@ -41,7 +41,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="17-19"
-{!> ../../../docs_src/body_multiple_params/tutorial001_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -55,7 +55,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="19-21"
-{!> ../../../docs_src/body_multiple_params/tutorial001.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@ Mais vous pouvez également déclarer plusieurs paramètres provenant de body, p
 //// tab | Python 3.10+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial002_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -92,7 +92,7 @@ Mais vous pouvez également déclarer plusieurs paramètres provenant de body, p
 //// tab | Python 3.8+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial002.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002.py!}
 ```
 
 ////
@@ -138,7 +138,7 @@ Mais vous pouvez indiquer à **FastAPI** de la traiter comme une variable de bod
 //// tab | Python 3.10+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -146,7 +146,7 @@ Mais vous pouvez indiquer à **FastAPI** de la traiter comme une variable de bod
 //// tab | Python 3.9+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -154,7 +154,7 @@ Mais vous pouvez indiquer à **FastAPI** de la traiter comme une variable de bod
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an.py!}
 ```
 
 ////
@@ -168,7 +168,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial003_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -182,7 +182,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial003.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003.py!}
 ```
 
 ////
@@ -228,7 +228,7 @@ Par exemple :
 //// tab | Python 3.10+
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -236,7 +236,7 @@ Par exemple :
 //// tab | Python 3.9+
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -244,7 +244,7 @@ Par exemple :
 //// tab | Python 3.8+
 
 ```Python hl_lines="28"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an.py!}
 ```
 
 ////
@@ -258,7 +258,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="25"
-{!> ../../../docs_src/body_multiple_params/tutorial004_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -272,7 +272,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004.py!}
 ```
 
 ////
@@ -300,7 +300,7 @@ Voici un exemple complet :
 //// tab | Python 3.10+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -308,7 +308,7 @@ Voici un exemple complet :
 //// tab | Python 3.9+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -316,7 +316,7 @@ Voici un exemple complet :
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an.py!}
 ```
 
 ////
@@ -330,7 +330,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/body_multiple_params/tutorial005_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_py310.py!}
 ```
 
 ////
@@ -344,7 +344,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005.py!}
 ```
 
 ////
index 9a5121f10ae453ec04fb13b9ebc46dc17503649e..96fff2ca6d6f0a5cf35c8b9e3a6842bffce91cd5 100644 (file)
@@ -23,7 +23,7 @@ Ceci étant découragé, la documentation interactive générée par Swagger UI
 Commencez par importer la classe `BaseModel` du module `pydantic` :
 
 ```Python hl_lines="4"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
 ```
 
 ## Créez votre modèle de données
@@ -33,7 +33,7 @@ Déclarez ensuite votre modèle de données en tant que classe qui hérite de `B
 Utilisez les types Python standard pour tous les attributs :
 
 ```Python hl_lines="7-11"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
 ```
 
 Tout comme pour la déclaration de paramètres de requête, quand un attribut de modèle a une valeur par défaut, il n'est pas nécessaire. Sinon, cet attribut doit être renseigné dans le corps de la requête. Pour rendre ce champ optionnel simplement, utilisez `None` comme valeur par défaut.
@@ -63,7 +63,7 @@ Par exemple, le modèle ci-dessus déclare un "objet" JSON (ou `dict` Python) te
 Pour l'ajouter à votre *opération de chemin*, déclarez-le comme vous déclareriez des paramètres de chemin ou de requête :
 
 ```Python hl_lines="18"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
 ```
 
 ...et déclarez que son type est le modèle que vous avez créé : `Item`.
@@ -132,7 +132,7 @@ Ce qui améliore le support pour les modèles Pydantic avec :
 Dans la fonction, vous pouvez accéder à tous les attributs de l'objet du modèle directement :
 
 ```Python hl_lines="21"
-{!../../../docs_src/body/tutorial002.py!}
+{!../../docs_src/body/tutorial002.py!}
 ```
 
 ## Corps de la requête + paramètres de chemin
@@ -142,7 +142,7 @@ Vous pouvez déclarer des paramètres de chemin et un corps de requête pour la
 **FastAPI** est capable de reconnaître que les paramètres de la fonction qui correspondent aux paramètres de chemin doivent être **récupérés depuis le chemin**, et que les paramètres de fonctions déclarés comme modèles Pydantic devraient être **récupérés depuis le corps de la requête**.
 
 ```Python hl_lines="17-18"
-{!../../../docs_src/body/tutorial003.py!}
+{!../../docs_src/body/tutorial003.py!}
 ```
 
 ## Corps de la requête + paramètres de chemin et de requête
@@ -152,7 +152,7 @@ Vous pouvez aussi déclarer un **corps**, et des paramètres de **chemin** et de
 **FastAPI** saura reconnaître chacun d'entre eux et récupérer la bonne donnée au bon endroit.
 
 ```Python hl_lines="18"
-{!../../../docs_src/body/tutorial004.py!}
+{!../../docs_src/body/tutorial004.py!}
 ```
 
 Les paramètres de la fonction seront reconnus comme tel :
index bcd780a82f1d1bd2ef53d474f134091c12276b47..914277699e73a7a2018d4c8371d8fcfdd1049e36 100644 (file)
@@ -7,7 +7,7 @@ Vous pouvez connecter le <abbr title="En anglais: debugger">débogueur</abbr> da
 Dans votre application FastAPI, importez et exécutez directement `uvicorn` :
 
 ```Python hl_lines="1  15"
-{!../../../docs_src/debugging/tutorial001.py!}
+{!../../docs_src/debugging/tutorial001.py!}
 ```
 
 ### À propos de `__name__ == "__main__"`
index bf476d99039f6b5d35773c0e84aa01ea63c6717f..e9511b02995a9a556f64663f3d1ab906217a43c7 100644 (file)
@@ -3,7 +3,7 @@
 Le fichier **FastAPI** le plus simple possible pourrait ressembler à cela  :
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Copiez ce code dans un fichier nommé `main.py`.
@@ -135,7 +135,7 @@ Vous pourriez aussi l'utiliser pour générer du code automatiquement, pour les
 ### Étape 1 : import `FastAPI`
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI` est une classe Python qui fournit toutes les fonctionnalités nécessaires au lancement de votre API.
@@ -151,7 +151,7 @@ Vous pouvez donc aussi utiliser toutes les fonctionnalités de <a href="https://
 ### Étape 2 : créer une "instance" `FastAPI`
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Ici la variable `app` sera une "instance" de la classe `FastAPI`.
@@ -173,7 +173,7 @@ $ uvicorn main:app --reload
 Si vous créez votre app avec :
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
 ```
 
 Et la mettez dans un fichier `main.py`, alors vous appelleriez `uvicorn` avec :
@@ -251,7 +251,7 @@ Nous allons donc aussi appeler ces dernières des "**opérations**".
 #### Définir un *décorateur d'opération de chemin*
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Le `@app.get("/")` dit à **FastAPI** que la fonction en dessous est chargée de gérer les requêtes qui vont sur :
@@ -307,7 +307,7 @@ Voici notre "**fonction de chemin**" (ou fonction d'opération de chemin) :
 * **fonction** : la fonction sous le "décorateur" (sous `@app.get("/")`).
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 C'est une fonction Python.
@@ -321,7 +321,7 @@ Ici, c'est une fonction asynchrone (définie avec `async def`).
 Vous pourriez aussi la définir comme une fonction classique plutôt qu'avec `async def` :
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note
@@ -333,7 +333,7 @@ Si vous ne connaissez pas la différence, allez voir la section [Concurrence : *
 ### Étape 5 : retourner le contenu
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Vous pouvez retourner un dictionnaire (`dict`), une liste (`list`), des valeurs seules comme des chaines de caractères (`str`) et des entiers (`int`), etc.
index eedd59f91c030ddf4b6d6eddb494f4a9f6522ab6..82e317ff799beecb9d6105d0d74a0d036b53850a 100644 (file)
@@ -9,7 +9,7 @@ Tout d'abord, importez `Path` de `fastapi`, et importez `Annotated` :
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Tout d'abord, importez `Path` de `fastapi`, et importez `Annotated` :
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Tout d'abord, importez `Path` de `fastapi`, et importez `Annotated` :
 //// tab | Python 3.8+
 
 ```Python hl_lines="3-4"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -77,7 +77,7 @@ Par exemple, pour déclarer une valeur de métadonnée `title` pour le paramètr
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -85,7 +85,7 @@ Par exemple, pour déclarer une valeur de métadonnée `title` pour le paramètr
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@ Par exemple, pour déclarer une valeur de métadonnée `title` pour le paramètr
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
 ```
 
 ////
@@ -107,7 +107,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -121,7 +121,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -163,7 +163,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002.py!}
 ```
 
 ////
@@ -173,7 +173,7 @@ Mais gardez à l'esprit que si vous utilisez `Annotated`, vous n'aurez pas ce pr
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -181,7 +181,7 @@ Mais gardez à l'esprit que si vous utilisez `Annotated`, vous n'aurez pas ce pr
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002_an.py!}
 ```
 
 ////
@@ -210,7 +210,7 @@ Passez `*`, comme premier paramètre de la fonction.
 Python ne fera rien avec ce `*`, mais il saura que tous les paramètres suivants doivent être appelés comme arguments "mots-clés" (paires clé-valeur), également connus sous le nom de <abbr title="De : K-ey W-ord Arg-uments"><code>kwargs</code></abbr>. Même s'ils n'ont pas de valeur par défaut.
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
 ```
 
 # Avec `Annotated`
@@ -220,7 +220,7 @@ Gardez à l'esprit que si vous utilisez `Annotated`, comme vous n'utilisez pas l
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -228,7 +228,7 @@ Gardez à l'esprit que si vous utilisez `Annotated`, comme vous n'utilisez pas l
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
 ```
 
 ////
@@ -242,7 +242,7 @@ Ici, avec `ge=1`, `item_id` devra être un nombre entier "`g`reater than or `e`q
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -250,7 +250,7 @@ Ici, avec `ge=1`, `item_id` devra être un nombre entier "`g`reater than or `e`q
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
 ```
 
 ////
@@ -264,7 +264,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004.py!}
 ```
 
 ////
@@ -279,7 +279,7 @@ La même chose s'applique pour :
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -287,7 +287,7 @@ La même chose s'applique pour :
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
 ```
 
 ////
@@ -301,7 +301,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004.py!}
 ```
 
 ////
@@ -316,7 +316,7 @@ La même chose s'applique pour :
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -324,7 +324,7 @@ La même chose s'applique pour :
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
 ```
 
 ////
@@ -338,7 +338,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005.py!}
 ```
 
 ////
@@ -356,7 +356,7 @@ Et la même chose pour <abbr title="less than"><code>lt</code></abbr>.
 //// tab | Python 3.9+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -364,7 +364,7 @@ Et la même chose pour <abbr title="less than"><code>lt</code></abbr>.
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
 ```
 
 ////
@@ -378,7 +378,7 @@ Préférez utiliser la version `Annotated` si possible.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006.py!}
 ```
 
 ////
index 94c36a20d05278a1be11de7df395762f498e68ec..34012c278b734c8bda91058530f575efaf776609 100644 (file)
@@ -5,7 +5,7 @@ Vous pouvez déclarer des "paramètres" ou "variables" de chemin avec la même s
 
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
 ```
 
 La valeur du paramètre `item_id` sera transmise à la fonction dans l'argument `item_id`.
@@ -23,7 +23,7 @@ Vous pouvez déclarer le type d'un paramètre de chemin dans la fonction, en uti
 
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
 ```
 
 Ici, `item_id` est déclaré comme `int`.
@@ -132,7 +132,7 @@ Et vous avez un second chemin : `/users/{user_id}` pour récupérer de la donné
 Les *fonctions de chemin* étant évaluées dans l'ordre, il faut s'assurer que la fonction correspondant à `/users/me` est déclarée avant celle de `/users/{user_id}` :
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
 ```
 
 Sinon, le chemin `/users/{user_id}` correspondrait aussi à `/users/me`, la fonction "croyant" qu'elle a reçu un paramètre `user_id` avec pour valeur `"me"`.
@@ -150,7 +150,7 @@ En héritant de `str` la documentation sera capable de savoir que les valeurs do
 Créez ensuite des attributs de classe avec des valeurs fixes, qui seront les valeurs autorisées pour cette énumération.
 
 ```Python hl_lines="1  6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// info
@@ -170,7 +170,7 @@ Pour ceux qui se demandent, "AlexNet", "ResNet", et "LeNet" sont juste des noms
 Créez ensuite un *paramètre de chemin* avec une annotation de type désignant l'énumération créée précédemment (`ModelName`) :
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 ### Documentation
@@ -188,7 +188,7 @@ La valeur du *paramètre de chemin* sera un des "membres" de l'énumération.
 Vous pouvez comparer ce paramètre avec les membres de votre énumération `ModelName` :
 
 ```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 #### Récupérer la *valeur de l'énumération*
@@ -196,7 +196,7 @@ Vous pouvez comparer ce paramètre avec les membres de votre énumération `Mode
 Vous pouvez obtenir la valeur réel d'un membre (une chaîne de caractères ici), avec `model_name.value`, ou en général, `votre_membre_d'enum.value` :
 
 ```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// tip | "Astuce"
@@ -212,7 +212,7 @@ Vous pouvez retourner des *membres d'énumération* dans vos *fonctions de chemi
 Ils seront convertis vers leurs valeurs correspondantes (chaînes de caractères ici) avant d'être transmis au client :
 
 ```Python hl_lines="18  21  23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 Le client recevra une réponse JSON comme celle-ci :
@@ -253,7 +253,7 @@ Dans ce cas, le nom du paramètre est `file_path`, et la dernière partie, `:pat
 Vous pouvez donc l'utilisez comme tel :
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
 ```
 
 /// tip | "Astuce"
index 63578ec404f90095075d7cbc12bafc48f362ecc8..b71d1548a5e111e31797ea5fb3559fffa3b48a62 100644 (file)
@@ -5,7 +5,7 @@
 Commençons avec cette application pour exemple :
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!../../docs_src/query_params_str_validations/tutorial001.py!}
 ```
 
 Le paramètre de requête `q` a pour type `Union[str, None]` (ou `str | None` en Python 3.10), signifiant qu'il est de type `str` mais pourrait aussi être égal à `None`, et bien sûr, la valeur par défaut est `None`, donc **FastAPI** saura qu'il n'est pas requis.
@@ -27,7 +27,7 @@ Nous allons imposer que bien que `q` soit un paramètre optionnel, dès qu'il es
 Pour cela, importez d'abord `Query` depuis `fastapi` :
 
 ```Python hl_lines="3"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 ## Utiliser `Query` comme valeur par défaut
@@ -35,7 +35,7 @@ Pour cela, importez d'abord `Query` depuis `fastapi` :
 Construisez ensuite la valeur par défaut de votre paramètre avec `Query`, en choisissant 50 comme `max_length` :
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 Comme nous devons remplacer la valeur par défaut `None` dans la fonction par `Query()`, nous pouvons maintenant définir la valeur par défaut avec le paramètre `Query(default=None)`, il sert le même objectif qui est de définir cette valeur par défaut.
@@ -87,7 +87,7 @@ Cela va valider les données, montrer une erreur claire si ces dernières ne son
 Vous pouvez aussi rajouter un second paramètre `min_length` :
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!../../docs_src/query_params_str_validations/tutorial003.py!}
 ```
 
 ## Ajouter des validations par expressions régulières
@@ -95,7 +95,7 @@ Vous pouvez aussi rajouter un second paramètre `min_length` :
 On peut définir une <abbr title="Une expression régulière, regex ou regexp est une suite de caractères qui définit un pattern de correspondance pour les chaînes de caractères.">expression régulière</abbr> à laquelle le paramètre doit correspondre :
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!../../docs_src/query_params_str_validations/tutorial004.py!}
 ```
 
 Cette expression régulière vérifie que la valeur passée comme paramètre :
@@ -115,7 +115,7 @@ De la même façon que vous pouvez passer `None` comme premier argument pour l'u
 Disons que vous déclarez le paramètre `q` comme ayant une longueur minimale de `3`, et une valeur par défaut étant `"fixedquery"` :
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!../../docs_src/query_params_str_validations/tutorial005.py!}
 ```
 
 /// note | "Rappel"
@@ -147,7 +147,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 Donc pour déclarer une valeur comme requise tout en utilisant `Query`, il faut utiliser `...` comme premier argument :
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!../../docs_src/query_params_str_validations/tutorial006.py!}
 ```
 
 /// info
@@ -165,7 +165,7 @@ Quand on définit un paramètre de requête explicitement avec `Query` on peut a
 Par exemple, pour déclarer un paramètre de requête `q` qui peut apparaître plusieurs fois dans une URL, on écrit :
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!../../docs_src/query_params_str_validations/tutorial011.py!}
 ```
 
 Ce qui fait qu'avec une URL comme :
@@ -202,7 +202,7 @@ La documentation sera donc mise à jour automatiquement pour autoriser plusieurs
 Et l'on peut aussi définir une liste de valeurs par défaut si aucune n'est fournie :
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!../../docs_src/query_params_str_validations/tutorial012.py!}
 ```
 
 Si vous allez à :
@@ -229,7 +229,7 @@ et la réponse sera :
 Il est aussi possible d'utiliser directement `list` plutôt que `List[str]` :
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!../../docs_src/query_params_str_validations/tutorial013.py!}
 ```
 
 /// note
@@ -257,13 +257,13 @@ Il se peut donc que certains d'entre eux n'utilisent pas toutes les métadonnée
 Vous pouvez ajouter un `title` :
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!../../docs_src/query_params_str_validations/tutorial007.py!}
 ```
 
 Et une `description` :
 
 ```Python hl_lines="13"
-{!../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!../../docs_src/query_params_str_validations/tutorial008.py!}
 ```
 
 ## Alias de paramètres
@@ -285,7 +285,7 @@ Mais vous avez vraiment envie que ce soit exactement `item-query`...
 Pour cela vous pouvez déclarer un `alias`, et cet alias est ce qui sera utilisé pour trouver la valeur du paramètre :
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!../../docs_src/query_params_str_validations/tutorial009.py!}
 ```
 
 ## Déprécier des paramètres
@@ -297,7 +297,7 @@ Il faut qu'il continue à exister pendant un certain temps car vos clients l'uti
 On utilise alors l'argument `deprecated=True` de `Query` :
 
 ```Python hl_lines="18"
-{!../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!../../docs_src/query_params_str_validations/tutorial010.py!}
 ```
 
 La documentation le présentera comme il suit :
index b9f1540c955cd31d4195ade054c66d99cbb24d5a..c847a8f5b69bb798316e50a21a953a6fc1594d22 100644 (file)
@@ -3,7 +3,7 @@
 Quand vous déclarez des paramètres dans votre fonction de chemin qui ne font pas partie des paramètres indiqués dans le chemin associé, ces paramètres sont automatiquement considérés comme des paramètres de "requête".
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
 ```
 
 La partie appelée requête (ou **query**) dans une URL est l'ensemble des paires clés-valeurs placées après le `?` , séparées par des `&`.
@@ -64,7 +64,7 @@ Les valeurs des paramètres de votre fonction seront :
 De la même façon, vous pouvez définir des paramètres de requête comme optionnels, en leur donnant comme valeur par défaut `None` :
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial002.py!}
+{!../../docs_src/query_params/tutorial002.py!}
 ```
 
 Ici, le paramètre `q` sera optionnel, et aura `None` comme valeur par défaut.
@@ -88,7 +88,7 @@ Le `Optional` dans `Optional[str]` n'est pas utilisé par **FastAPI** (**FastAPI
 Vous pouvez aussi déclarer des paramètres de requête comme booléens (`bool`), **FastAPI** les convertira :
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial003.py!}
+{!../../docs_src/query_params/tutorial003.py!}
 ```
 
 Avec ce code, en allant sur :
@@ -132,7 +132,7 @@ Et vous n'avez pas besoin de les déclarer dans un ordre spécifique.
 Ils seront détectés par leurs noms :
 
 ```Python hl_lines="8  10"
-{!../../../docs_src/query_params/tutorial004.py!}
+{!../../docs_src/query_params/tutorial004.py!}
 ```
 
 ## Paramètres de requête requis
@@ -144,7 +144,7 @@ Si vous ne voulez pas leur donner de valeur par défaut mais juste les rendre op
 Mais si vous voulez rendre un paramètre de requête obligatoire, vous pouvez juste ne pas y affecter de valeur par défaut :
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
 ```
 
 Ici le paramètre `needy` est un paramètre requis (ou obligatoire) de type `str`.
@@ -190,7 +190,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
 Et bien sur, vous pouvez définir certains paramètres comme requis, certains avec des valeurs par défaut et certains entièrement optionnels :
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params/tutorial006.py!}
+{!../../docs_src/query_params/tutorial006.py!}
 ```
 
 Ici, on a donc 3 paramètres de requête :
index 622affa6eb70dd0ed5d933e460d00846bde59767..904d539e77e550e61ec3f9d9870c926181c2b032 100644 (file)
@@ -15,7 +15,7 @@
 これを達成するには、 `JSONResponse` をインポートし、 `status_code` を設定して直接内容を返します。
 
 ```Python hl_lines="4  25"
-{!../../../docs_src/additional_status_codes/tutorial001.py!}
+{!../../docs_src/additional_status_codes/tutorial001.py!}
 ```
 
 /// warning | "注意"
index a7ce6b54d93417b932fb8e697eb85e541538b3f0..88269700e00ee43274f8f493a9a6c63f873137de 100644 (file)
@@ -25,7 +25,7 @@
 使いたい `Response` クラス (サブクラス) をインポートし、 *path operationデコレータ* に宣言します。
 
 ```Python hl_lines="2  7"
-{!../../../docs_src/custom_response/tutorial001b.py!}
+{!../../docs_src/custom_response/tutorial001b.py!}
 ```
 
 /// info | "情報"
@@ -52,7 +52,7 @@
 * *path operation* のパラメータ `content_type` に `HTMLResponse` を渡す。
 
 ```Python hl_lines="2  7"
-{!../../../docs_src/custom_response/tutorial002.py!}
+{!../../docs_src/custom_response/tutorial002.py!}
 ```
 
 /// info | "情報"
@@ -72,7 +72,7 @@
 上記と同じ例において、 `HTMLResponse` を返すと、このようになります:
 
 ```Python hl_lines="2  7  19"
-{!../../../docs_src/custom_response/tutorial003.py!}
+{!../../docs_src/custom_response/tutorial003.py!}
 ```
 
 /// warning | "注意"
@@ -98,7 +98,7 @@
 例えば、このようになります:
 
 ```Python hl_lines="7  21  23"
-{!../../../docs_src/custom_response/tutorial004.py!}
+{!../../docs_src/custom_response/tutorial004.py!}
 ```
 
 この例では、関数 `generate_html_response()` は、`str` のHTMLを返すのではなく `Response` を生成して返しています。
 FastAPI (実際にはStarlette) は自動的にContent-Lengthヘッダーを含みます。また、media_typeに基づいたContent-Typeヘッダーを含み、テキストタイプのためにcharsetを追加します。
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ### `HTMLResponse`
@@ -151,7 +151,7 @@ FastAPI (実際にはStarlette) は自動的にContent-Lengthヘッダーを含
 テキストやバイトを受け取り、プレーンテキストのレスポンスを返します。
 
 ```Python hl_lines="2  7  9"
-{!../../../docs_src/custom_response/tutorial005.py!}
+{!../../docs_src/custom_response/tutorial005.py!}
 ```
 
 ### `JSONResponse`
@@ -175,7 +175,7 @@ FastAPI (実際にはStarlette) は自動的にContent-Lengthヘッダーを含
 ///
 
 ```Python hl_lines="2  7"
-{!../../../docs_src/custom_response/tutorial001.py!}
+{!../../docs_src/custom_response/tutorial001.py!}
 ```
 
 /// tip | "豆知識"
@@ -189,7 +189,7 @@ FastAPI (実際にはStarlette) は自動的にContent-Lengthヘッダーを含
 HTTPリダイレクトを返します。デフォルトでは307ステータスコード (Temporary Redirect) となります。
 
 ```Python hl_lines="2  9"
-{!../../../docs_src/custom_response/tutorial006.py!}
+{!../../docs_src/custom_response/tutorial006.py!}
 ```
 
 ### `StreamingResponse`
@@ -197,7 +197,7 @@ HTTPリダイレクトを返します。デフォルトでは307ステータス
 非同期なジェネレータか通常のジェネレータ・イテレータを受け取り、レスポンスボディをストリームします。
 
 ```Python hl_lines="2  14"
-{!../../../docs_src/custom_response/tutorial007.py!}
+{!../../docs_src/custom_response/tutorial007.py!}
 ```
 
 #### `StreamingResponse` をファイルライクなオブジェクトとともに使う
@@ -207,7 +207,7 @@ HTTPリダイレクトを返します。デフォルトでは307ステータス
 これにはクラウドストレージとの連携や映像処理など、多くのライブラリが含まれています。
 
 ```Python hl_lines="2  10-12  14"
-{!../../../docs_src/custom_response/tutorial008.py!}
+{!../../docs_src/custom_response/tutorial008.py!}
 ```
 
 /// tip | "豆知識"
@@ -230,7 +230,7 @@ HTTPリダイレクトを返します。デフォルトでは307ステータス
 ファイルレスポンスには、適切な `Content-Length` 、 `Last-Modified` 、 `ETag` ヘッダーが含まれます。
 
 ```Python hl_lines="2  10"
-{!../../../docs_src/custom_response/tutorial009.py!}
+{!../../docs_src/custom_response/tutorial009.py!}
 ```
 
 ## デフォルトレスポンスクラス
@@ -242,7 +242,7 @@ HTTPリダイレクトを返します。デフォルトでは307ステータス
 以下の例では、 **FastAPI** は、全ての *path operation* で `JSONResponse` の代わりに `ORJSONResponse` をデフォルトとして利用します。
 
 ```Python hl_lines="2  4"
-{!../../../docs_src/custom_response/tutorial010.py!}
+{!../../docs_src/custom_response/tutorial010.py!}
 ```
 
 /// tip | "豆知識"
index ae60126cbc3efda4e58660c10170aaf1f3dbcde8..2dab4aec1585e4efea1d431f254982e3e5908dba 100644 (file)
@@ -13,7 +13,7 @@
 `operation_id` は各オペレーションで一意にする必要があります。
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
 ```
 
 ### *path operation関数* の名前をoperationIdとして使用する
@@ -23,7 +23,7 @@ APIの関数名を `operationId` として利用したい場合、すべてのAP
 そうする場合は、すべての *path operation* を追加した後に行う必要があります。
 
 ```Python hl_lines="2  12-21  24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
 ```
 
 /// tip | "豆知識"
@@ -45,7 +45,7 @@ APIの関数名を `operationId` として利用したい場合、すべてのAP
 生成されるOpenAPIスキーマ (つまり、自動ドキュメント生成の仕組み) から *path operation* を除外するには、 `include_in_schema` パラメータを `False` にします。
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
 ```
 
 ## docstringによる説明の高度な設定
@@ -57,5 +57,5 @@ APIの関数名を `operationId` として利用したい場合、すべてのAP
 ドキュメントには表示されませんが、他のツール (例えばSphinx) では残りの部分を利用できるでしょう。
 
 ```Python hl_lines="19-29"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
 ```
index 5c25471b1b09d0b146125f6cdfecb5f26f03b84d..167d15589f4fa5e3d3723fa58774f3da6bb0d906 100644 (file)
@@ -35,7 +35,7 @@
 このようなケースでは、レスポンスにデータを含める前に `jsonable_encoder` を使ってデータを変換できます。
 
 ```Python hl_lines="6-7  21-22"
-{!../../../docs_src/response_directly/tutorial001.py!}
+{!../../docs_src/response_directly/tutorial001.py!}
 ```
 
 /// note | "技術詳細"
@@ -57,7 +57,7 @@
 XMLを文字列にし、`Response` に含め、それを返します。
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ## 備考
index 615f9d17c8763ae2bd76f368ffca2690b50ffe74..f7bcb6af3497d278463eec33c8407732044d618e 100644 (file)
@@ -39,7 +39,7 @@ $ pip install websockets
 しかし、これはWebSocketのサーバーサイドに焦点を当て、実用的な例を示す最も簡単な方法です。
 
 ```Python hl_lines="2  6-38  41-43"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 ## `websocket` を作成する
@@ -47,7 +47,7 @@ $ pip install websockets
 **FastAPI** アプリケーションで、`websocket` を作成します。
 
 ```Python hl_lines="1  46-47"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 /// note | "技術詳細"
@@ -63,7 +63,7 @@ $ pip install websockets
 WebSocketルートでは、 `await` を使ってメッセージの送受信ができます。
 
 ```Python hl_lines="48-52"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 バイナリやテキストデータ、JSONデータを送受信できます。
@@ -116,7 +116,7 @@ WebSocketエンドポイントでは、`fastapi` から以下をインポート
 これらは、他のFastAPI エンドポイント/*path operation* の場合と同じように機能します。
 
 ```Python hl_lines="58-65  68-83"
-{!../../../docs_src/websockets/tutorial002.py!}
+{!../../docs_src/websockets/tutorial002.py!}
 ```
 
 /// info | "情報"
@@ -165,7 +165,7 @@ $ uvicorn main:app --reload
 WebSocket接続が閉じられると、 `await websocket.receive_text()` は例外 `WebSocketDisconnect` を発生させ、この例のようにキャッチして処理することができます。
 
 ```Python hl_lines="81-83"
-{!../../../docs_src/websockets/tutorial003.py!}
+{!../../docs_src/websockets/tutorial003.py!}
 ```
 
 試してみるには、
index b892ed6c6489fac04e29799ba14b982a5ffef6a9..053d481f7a2edb5d270783991f9c8044faab9e69 100644 (file)
@@ -30,7 +30,7 @@
 例えば、
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/conditional_openapi/tutorial001.py!}
+{!../../docs_src/conditional_openapi/tutorial001.py!}
 ```
 
 ここでは `openapi_url` の設定を、デフォルトの `"/openapi.json"` のまま宣言しています。
index 730a209ab18b383c53f909ab851ff6a741165fa0..7af6ce0c0b14880081170b1dc1ac068424703408 100644 (file)
@@ -23,7 +23,7 @@
 簡単な例から始めてみましょう:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 このプログラムを実行すると以下が出力されます:
@@ -39,7 +39,7 @@ John Doe
 * 真ん中にスペースを入れて<abbr title="次から次へと中身を入れて一つにまとめる">連結</abbr>します。
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### 編集
@@ -83,7 +83,7 @@ John Doe
 それが「型ヒント」です:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 これは、以下のようにデフォルト値を宣言するのと同じではありません:
@@ -113,7 +113,7 @@ John Doe
 この関数を見てください。すでに型ヒントを持っています:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 エディタは変数の型を知っているので、補完だけでなく、エラーチェックをすることもできます。
@@ -123,7 +123,7 @@ John Doe
 これで`age`を`str(age)`で文字列に変換して修正する必要があることがわかります:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## 型の宣言
@@ -144,7 +144,7 @@ John Doe
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### 型パラメータを持つジェネリック型
@@ -162,7 +162,7 @@ John Doe
 `typing`から`List`をインポートします(大文字の`L`を含む):
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 同じようにコロン(`:`)の構文で変数を宣言します。
@@ -172,7 +172,7 @@ John Doe
 リストはいくつかの内部の型を含む型なので、それらを角括弧で囲んでいます。
 
 ```Python hl_lines="4"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 /// tip | "豆知識"
@@ -200,7 +200,7 @@ John Doe
 `tuple`と`set`の宣言も同様です:
 
 ```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial007.py!}
+{!../../docs_src/python_types/tutorial007.py!}
 ```
 
 つまり:
@@ -218,7 +218,7 @@ John Doe
 2番目の型パラメータは`dict`の値です。
 
 ```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial008.py!}
+{!../../docs_src/python_types/tutorial008.py!}
 ```
 
 つまり:
@@ -232,7 +232,7 @@ John Doe
 また、`Optional`を使用して、変数が`str`のような型を持つことを宣言することもできますが、それは「オプション」であり、`None`にすることもできます。
 
 ```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 ただの`str`の代わりに`Optional[str]`を使用することで、エディタは値が常に`str`であると仮定している場合に実際には`None`である可能性があるエラーを検出するのに役立ちます。
@@ -257,13 +257,13 @@ John Doe
 例えば、`Person`クラスという名前のクラスがあるとしましょう:
 
 ```Python hl_lines="1 2 3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 変数の型を`Person`として宣言することができます:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 そして、再び、すべてのエディタのサポートを得ることができます:
@@ -285,7 +285,7 @@ John Doe
 Pydanticの公式ドキュメントから引用:
 
 ```Python
-{!../../../docs_src/python_types/tutorial011.py!}
+{!../../docs_src/python_types/tutorial011.py!}
 ```
 
 /// info | "情報"
index 6094c370fde65b92556ff15d6543f977e87c4a8a..6f93408175ba6bceb31509d5d9530fa62b0e68dd 100644 (file)
@@ -16,7 +16,7 @@
 まず初めに、`BackgroundTasks` をインポートし、` BackgroundTasks` の型宣言と共に、*path operation 関数* のパラメーターを定義します:
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 **FastAPI** は、`BackgroundTasks` 型のオブジェクトを作成し、そのパラメーターに渡します。
@@ -34,7 +34,7 @@
 また、書き込み操作では `async` と `await` を使用しないため、通常の `def` で関数を定義します。
 
 ```Python hl_lines="6-9"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 ## バックグラウンドタスクの追加
@@ -42,7 +42,7 @@
 *path operations 関数* 内で、`.add_task()` メソッドを使用してタスク関数を *background tasks* オブジェクトに渡します。
 
 ```Python hl_lines="14"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 `.add_task()` は以下の引数を受け取ります:
@@ -58,7 +58,7 @@
 **FastAPI** は、それぞれの場合の処理​​方法と同じオブジェクトの再利用方法を知っているため、すべてのバックグラウンドタスクがマージされ、バックグラウンドで後で実行されます。
 
 ```Python hl_lines="13  15  22  25"
-{!../../../docs_src/background_tasks/tutorial002.py!}
+{!../../docs_src/background_tasks/tutorial002.py!}
 ```
 
 この例では、レスポンスが送信された *後* にメッセージが `log.txt` ファイルに書き込まれます。
index b9f6d694b6c43daa66cce466b6a196da1a5eb55a..1d386040aa985e037624079bfc9fa03ea8db4778 100644 (file)
@@ -7,7 +7,7 @@
 まず、以下のようにインポートします:
 
 ```Python hl_lines="4"
-{!../../../docs_src/body_fields/tutorial001.py!}
+{!../../docs_src/body_fields/tutorial001.py!}
 ```
 
 /// warning | "注意"
@@ -21,7 +21,7 @@
 以下のように`Field`をモデルの属性として使用することができます:
 
 ```Python hl_lines="11 12 13 14"
-{!../../../docs_src/body_fields/tutorial001.py!}
+{!../../docs_src/body_fields/tutorial001.py!}
 ```
 
 `Field`は`Query`や`Path`、`Body`と同じように動作し、全く同様のパラメータなどを持ちます。
index c051fde2484330357be879b6caa020177dcb7435..647143ee54fda586c7d30e5ffce118d3bf250581 100644 (file)
@@ -9,7 +9,7 @@
 また、デフォルトの`None`を設定することで、ボディパラメータをオプションとして宣言することもできます:
 
 ```Python hl_lines="19 20 21"
-{!../../../docs_src/body_multiple_params/tutorial001.py!}
+{!../../docs_src/body_multiple_params/tutorial001.py!}
 ```
 
 /// note | "備考"
@@ -34,7 +34,7 @@
 しかし、`item`と`user`のように複数のボディパラメータを宣言することもできます:
 
 ```Python hl_lines="22"
-{!../../../docs_src/body_multiple_params/tutorial002.py!}
+{!../../docs_src/body_multiple_params/tutorial002.py!}
 ```
 
 この場合、**FastAPI**は関数内に複数のボディパラメータ(Pydanticモデルである2つのパラメータ)があることに気付きます。
@@ -78,7 +78,7 @@
 
 
 ```Python hl_lines="23"
-{!../../../docs_src/body_multiple_params/tutorial003.py!}
+{!../../docs_src/body_multiple_params/tutorial003.py!}
 ```
 
 この場合、**FastAPI** は以下のようなボディを期待します:
@@ -115,7 +115,7 @@ q: str = None
 以下において:
 
 ```Python hl_lines="27"
-{!../../../docs_src/body_multiple_params/tutorial004.py!}
+{!../../docs_src/body_multiple_params/tutorial004.py!}
 ```
 
 /// info | "情報"
@@ -139,7 +139,7 @@ item: Item = Body(..., embed=True)
 以下において:
 
 ```Python hl_lines="17"
-{!../../../docs_src/body_multiple_params/tutorial005.py!}
+{!../../docs_src/body_multiple_params/tutorial005.py!}
 ```
 
 この場合、**FastAPI** は以下のようなボディを期待します:
index 59ee6729545d59b9ac84ad070a47b7b9a97038a7..8703a40e7d6ff95d6771590e7229d63b2bb60564 100644 (file)
@@ -7,7 +7,7 @@
 属性をサブタイプとして定義することができます。例えば、Pythonの`list`は以下のように定義できます:
 
 ```Python hl_lines="12"
-{!../../../docs_src/body_nested_models/tutorial001.py!}
+{!../../docs_src/body_nested_models/tutorial001.py!}
 ```
 
 これにより、各項目の型は宣言されていませんが、`tags`はある項目のリストになります。
@@ -21,7 +21,7 @@
 まず、Pythonの標準の`typing`モジュールから`List`をインポートします:
 
 ```Python hl_lines="1"
-{!../../../docs_src/body_nested_models/tutorial002.py!}
+{!../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ### タイプパラメータを持つ`List`の宣言
@@ -44,7 +44,7 @@ my_list: List[str]
 そのため、以下の例では`tags`を具体的な「文字列のリスト」にすることができます:
 
 ```Python hl_lines="14"
-{!../../../docs_src/body_nested_models/tutorial002.py!}
+{!../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ## セット型
@@ -56,7 +56,7 @@ my_list: List[str]
 そのため、以下のように、`Set`をインポートして`str`の`set`として`tags`を宣言することができます:
 
 ```Python hl_lines="1 14"
-{!../../../docs_src/body_nested_models/tutorial003.py!}
+{!../../docs_src/body_nested_models/tutorial003.py!}
 ```
 
 これを使えば、データが重複しているリクエストを受けた場合でも、ユニークな項目のセットに変換されます。
@@ -80,7 +80,7 @@ Pydanticモデルの各属性には型があります。
 例えば、`Image`モデルを定義することができます:
 
 ```Python hl_lines="9 10 11"
-{!../../../docs_src/body_nested_models/tutorial004.py!}
+{!../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ### サブモデルを型として使用
@@ -88,7 +88,7 @@ Pydanticモデルの各属性には型があります。
 そして、それを属性の型として使用することができます:
 
 ```Python hl_lines="20"
-{!../../../docs_src/body_nested_models/tutorial004.py!}
+{!../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 これは **FastAPI** が以下のようなボディを期待することを意味します:
@@ -123,7 +123,7 @@ Pydanticモデルの各属性には型があります。
 例えば、`Image`モデルのように`url`フィールドがある場合、`str`の代わりにPydanticの`HttpUrl`を指定することができます:
 
 ```Python hl_lines="4 10"
-{!../../../docs_src/body_nested_models/tutorial005.py!}
+{!../../docs_src/body_nested_models/tutorial005.py!}
 ```
 
 文字列は有効なURLであることが確認され、そのようにJSONスキーマ・OpenAPIで文書化されます。
@@ -133,7 +133,7 @@ Pydanticモデルの各属性には型があります。
 Pydanticモデルを`list`や`set`などのサブタイプとして使用することもできます:
 
 ```Python hl_lines="20"
-{!../../../docs_src/body_nested_models/tutorial006.py!}
+{!../../docs_src/body_nested_models/tutorial006.py!}
 ```
 
 これは、次のようなJSONボディを期待します(変換、検証、ドキュメントなど):
@@ -173,7 +173,7 @@ Pydanticモデルを`list`や`set`などのサブタイプとして使用する
 深くネストされた任意のモデルを定義することができます:
 
 ```Python hl_lines="9 14 20 23 27"
-{!../../../docs_src/body_nested_models/tutorial007.py!}
+{!../../docs_src/body_nested_models/tutorial007.py!}
 ```
 
 /// info | "情報"
@@ -193,7 +193,7 @@ images: List[Image]
 以下のように:
 
 ```Python hl_lines="15"
-{!../../../docs_src/body_nested_models/tutorial008.py!}
+{!../../docs_src/body_nested_models/tutorial008.py!}
 ```
 
 ## あらゆる場所でのエディタサポート
@@ -225,7 +225,7 @@ Pydanticモデルではなく、`dict`を直接使用している場合はこの
 この場合、`int`のキーと`float`の値を持つものであれば、どんな`dict`でも受け入れることができます:
 
 ```Python hl_lines="15"
-{!../../../docs_src/body_nested_models/tutorial009.py!}
+{!../../docs_src/body_nested_models/tutorial009.py!}
 ```
 
 /// tip | "豆知識"
index 672a03a642db037462da0750a9d6834a24e6102f..fde9f4f5e4349130d43f474715a6e82f94067f9d 100644 (file)
@@ -7,7 +7,7 @@
 `jsonable_encoder`を用いて、入力データをJSON形式で保存できるデータに変換することができます(例:NoSQLデータベース)。例えば、`datetime`を`str`に変換します。
 
 ```Python hl_lines="30 31 32 33 34 35"
-{!../../../docs_src/body_updates/tutorial001.py!}
+{!../../docs_src/body_updates/tutorial001.py!}
 ```
 
 既存のデータを置き換えるべきデータを受け取るために`PUT`は使用されます。
@@ -57,7 +57,7 @@
 これを使うことで、デフォルト値を省略して、設定された(リクエストで送られた)データのみを含む`dict`を生成することができます:
 
 ```Python hl_lines="34"
-{!../../../docs_src/body_updates/tutorial002.py!}
+{!../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ### Pydanticの`update`パラメータ
@@ -67,7 +67,7 @@
 `stored_item_model.copy(update=update_data)`のように:
 
 ```Python hl_lines="35"
-{!../../../docs_src/body_updates/tutorial002.py!}
+{!../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ### 部分的更新のまとめ
@@ -86,7 +86,7 @@
 * 更新されたモデルを返します。
 
 ```Python hl_lines="30 31 32 33 34 35 36 37"
-{!../../../docs_src/body_updates/tutorial002.py!}
+{!../../docs_src/body_updates/tutorial002.py!}
 ```
 
 /// tip | "豆知識"
index 017ff89863bb31951d29822459fb3cffb95375b7..888d4388acceaa2e2ecaaca02a9f283d1f3b9675 100644 (file)
@@ -23,7 +23,7 @@ GET リクエストでボディを送信することは、仕様では未定義
 ます初めに、 `pydantic` から `BaseModel` をインポートする必要があります:
 
 ```Python hl_lines="2"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
 ```
 
 ## データモデルの作成
@@ -33,7 +33,7 @@ GET リクエストでボディを送信することは、仕様では未定義
 すべての属性にpython標準の型を使用します:
 
 ```Python hl_lines="5-9"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
 ```
 
 クエリパラメータの宣言と同様に、モデル属性がデフォルト値をもつとき、必須な属性ではなくなります。それ以外は必須になります。オプショナルな属性にしたい場合は `None` を使用してください。
@@ -63,7 +63,7 @@ GET リクエストでボディを送信することは、仕様では未定義
 *パスオペレーション* に加えるために、パスパラメータやクエリパラメータと同じ様に宣言します:
 
 ```Python hl_lines="16"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
 ```
 
 ...そして、作成したモデル `Item` で型を宣言します。
@@ -132,7 +132,7 @@ GET リクエストでボディを送信することは、仕様では未定義
 関数内部で、モデルの全ての属性に直接アクセスできます:
 
 ```Python hl_lines="19"
-{!../../../docs_src/body/tutorial002.py!}
+{!../../docs_src/body/tutorial002.py!}
 ```
 
 ## リクエストボディ + パスパラメータ
@@ -142,7 +142,7 @@ GET リクエストでボディを送信することは、仕様では未定義
 **FastAPI** はパスパラメータである関数パラメータは**パスから受け取り**、Pydanticモデルによって宣言された関数パラメータは**リクエストボディから受け取る**ということを認識します。
 
 ```Python hl_lines="15-16"
-{!../../../docs_src/body/tutorial003.py!}
+{!../../docs_src/body/tutorial003.py!}
 ```
 
 ## リクエストボディ + パスパラメータ + クエリパラメータ
@@ -152,7 +152,7 @@ GET リクエストでボディを送信することは、仕様では未定義
 **FastAPI** はそれぞれを認識し、適切な場所からデータを取得します。
 
 ```Python hl_lines="16"
-{!../../../docs_src/body/tutorial004.py!}
+{!../../docs_src/body/tutorial004.py!}
 ```
 
 関数パラメータは以下の様に認識されます:
index 2128852098a01152db754c93dbd8e19c6ff97e29..1f45db17c2a9c827b7c9c78d653bdc110c6ba605 100644 (file)
@@ -7,7 +7,7 @@
 まず、`Cookie`をインポートします:
 
 ```Python hl_lines="3"
-{!../../../docs_src/cookie_params/tutorial001.py!}
+{!../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ## `Cookie`のパラメータを宣言
@@ -17,7 +17,7 @@
 最初の値がデフォルト値で、追加の検証パラメータや注釈パラメータをすべて渡すことができます:
 
 ```Python hl_lines="9"
-{!../../../docs_src/cookie_params/tutorial001.py!}
+{!../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 /// note | "技術詳細"
index 738240342fc6cddbd2e9b759bb648850f3a05697..9530c51bfe81d27b1afe5b55b7c7f0985d068dde 100644 (file)
@@ -47,7 +47,7 @@
 * 特定のHTTPヘッダー、またはワイルドカード `"*"`を使用してすべて許可。
 
 ```Python hl_lines="2  6-11  13-19"
-{!../../../docs_src/cors/tutorial001.py!}
+{!../../docs_src/cors/tutorial001.py!}
 ```
 
 `CORSMiddleware` 実装のデフォルトのパラメータはCORSに関して制限を与えるものになっているので、ブラウザにドメインを跨いで特定のオリジン、メソッド、またはヘッダーを使用可能にするためには、それらを明示的に有効にする必要があります
index 06b8ad277200266b6be166ca49b531adb50ebfa7..be0ff81d48a1fbb88678b55bb1dd507e4fb130f7 100644 (file)
@@ -7,7 +7,7 @@ Visual Studio CodeやPyCharmなどを使用して、エディター上でデバ
 FastAPIアプリケーション上で、`uvicorn` を直接インポートして実行します:
 
 ```Python hl_lines="1  15"
-{!../../../docs_src/debugging/tutorial001.py!}
+{!../../docs_src/debugging/tutorial001.py!}
 ```
 
 ### `__name__ == "__main__"` について
index 69b67d042ac8f8ded59ec1ed258ce45602be1ad1..fb23a7b2b982fe602fb67296d6880e60fb6de3f7 100644 (file)
@@ -7,7 +7,7 @@
 前の例では、依存関係("dependable")から`dict`を返していました:
 
 ```Python hl_lines="9"
-{!../../../docs_src/dependencies/tutorial001.py!}
+{!../../docs_src/dependencies/tutorial001.py!}
 ```
 
 しかし、*path operation関数*のパラメータ`commons`に`dict`が含まれています。
@@ -72,19 +72,19 @@ FastAPIが実際にチェックしているのは、それが「呼び出し可
 そこで、上で紹介した依存関係の`common_parameters`を`CommonQueryParams`クラスに変更します:
 
 ```Python hl_lines="11 12 13 14 15"
-{!../../../docs_src/dependencies/tutorial002.py!}
+{!../../docs_src/dependencies/tutorial002.py!}
 ```
 
 クラスのインスタンスを作成するために使用される`__init__`メソッドに注目してください:
 
 ```Python hl_lines="12"
-{!../../../docs_src/dependencies/tutorial002.py!}
+{!../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ...以前の`common_parameters`と同じパラメータを持っています:
 
 ```Python hl_lines="8"
-{!../../../docs_src/dependencies/tutorial001.py!}
+{!../../docs_src/dependencies/tutorial001.py!}
 ```
 
 これらのパラメータは **FastAPI** が依存関係を「解決」するために使用するものです。
@@ -102,7 +102,7 @@ FastAPIが実際にチェックしているのは、それが「呼び出し可
 これで、このクラスを使用して依存関係を宣言することができます。
 
 ```Python hl_lines="19"
-{!../../../docs_src/dependencies/tutorial002.py!}
+{!../../docs_src/dependencies/tutorial002.py!}
 ```
 
 **FastAPI** は`CommonQueryParams`クラスを呼び出します。これにより、そのクラスの「インスタンス」が作成され、インスタンスはパラメータ`commons`として関数に渡されます。
@@ -144,7 +144,7 @@ commons = Depends(CommonQueryParams)
 以下にあるように:
 
 ```Python hl_lines="19"
-{!../../../docs_src/dependencies/tutorial003.py!}
+{!../../docs_src/dependencies/tutorial003.py!}
 ```
 
 しかし、型を宣言することは推奨されています。そうすれば、エディタは`commons`のパラメータとして何が渡されるかを知ることができ、コードの補完や型チェックなどを行うのに役立ちます:
@@ -180,7 +180,7 @@ commons: CommonQueryParams = Depends()
 同じ例では以下のようになります:
 
 ```Python hl_lines="19"
-{!../../../docs_src/dependencies/tutorial004.py!}
+{!../../docs_src/dependencies/tutorial004.py!}
 ```
 
 ...そして **FastAPI** は何をすべきか知っています。
index c6472cab5c1d1683ae67352fa54fa327ff1a2a0d..59f21c3df7aee2d0d1a303bdd115f7e71a3fb05e 100644 (file)
@@ -15,7 +15,7 @@
 それは`Depends()`の`list`であるべきです:
 
 ```Python hl_lines="17"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
 ```
 
 これらの依存関係は、通常の依存関係と同様に実行・解決されます。しかし、それらの値(何かを返す場合)は*path operation関数*には渡されません。
@@ -39,7 +39,7 @@
 これらはリクエストの要件(ヘッダのようなもの)やその他のサブ依存関係を宣言することができます:
 
 ```Python hl_lines="6 11"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ### 例外の発生
@@ -47,7 +47,7 @@
 これらの依存関係は通常の依存関係と同じように、例外を`raise`発生させることができます:
 
 ```Python hl_lines="8 13"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ### 戻り値
@@ -57,7 +57,7 @@
 つまり、すでにどこかで使っている通常の依存関係(値を返すもの)を再利用することができ、値は使われなくても依存関係は実行されます:
 
 ```Python hl_lines="9 14"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ## *path operations*のグループに対する依存関係
index 3f22a7a7b0412adb77589853734351a4c5e6253f..7ef1caf0d42eae3dd1b6055d49ae609311699df0 100644 (file)
@@ -42,19 +42,19 @@ pip install async-exit-stack async-generator
 レスポンスを送信する前に`yield`文を含む前のコードのみが実行されます。
 
 ```Python hl_lines="2 3 4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 生成された値は、*path operations*や他の依存関係に注入されるものです:
 
 ```Python hl_lines="4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 `yield`文に続くコードは、レスポンスが送信された後に実行されます:
 
 ```Python hl_lines="5 6"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 /// tip | "豆知識"
@@ -76,7 +76,7 @@ pip install async-exit-stack async-generator
 同様に、`finally`を用いて例外があったかどうかにかかわらず、終了ステップを確実に実行することができます。
 
 ```Python hl_lines="3 5"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 ## `yield`を持つサブ依存関係
@@ -88,7 +88,7 @@ pip install async-exit-stack async-generator
 例えば、`dependency_c`は`dependency_b`と`dependency_b`に依存する`dependency_a`に、依存することができます:
 
 ```Python hl_lines="4 12 20"
-{!../../../docs_src/dependencies/tutorial008.py!}
+{!../../docs_src/dependencies/tutorial008.py!}
 ```
 
 そして、それらはすべて`yield`を使用することができます。
@@ -98,7 +98,7 @@ pip install async-exit-stack async-generator
 そして、`dependency_b`は`dependency_a`(ここでは`dep_a`という名前)の値を終了コードで利用できるようにする必要があります。
 
 ```Python hl_lines="16 17 24 25"
-{!../../../docs_src/dependencies/tutorial008.py!}
+{!../../docs_src/dependencies/tutorial008.py!}
 ```
 
 同様に、`yield`と`return`が混在した依存関係を持つこともできます。
@@ -234,7 +234,7 @@ Pythonでは、<a href="https://docs.python.org/3/reference/datamodel.html#conte
 また、依存関数の中で`with`や`async with`文を使用することによって`yield`を持つ **FastAPI** の依存関係の中でそれらを使用することができます:
 
 ```Python hl_lines="1 2 3 4 5 6 7 8 9 13"
-{!../../../docs_src/dependencies/tutorial010.py!}
+{!../../docs_src/dependencies/tutorial010.py!}
 ```
 
 /// tip | "豆知識"
index 000148d1c3d336da2c7e9aa3f1c8adef8f804b88..f6728ee84ef36442965f2e3cdadea4cf9a9eda69 100644 (file)
@@ -32,7 +32,7 @@
 以下のように、*path operation関数*と同じパラメータを全て取ることができる関数にすぎません:
 
 ```Python hl_lines="8 9"
-{!../../../docs_src/dependencies/tutorial001.py!}
+{!../../docs_src/dependencies/tutorial001.py!}
 ```
 
 これだけです。
@@ -56,7 +56,7 @@
 ### `Depends`のインポート
 
 ```Python hl_lines="3"
-{!../../../docs_src/dependencies/tutorial001.py!}
+{!../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ### "dependant"での依存関係の宣言
@@ -64,7 +64,7 @@
 *path operation関数*のパラメータに`Body`や`Query`などを使用するのと同じように、新しいパラメータに`Depends`を使用することができます:
 
 ```Python hl_lines="13  18"
-{!../../../docs_src/dependencies/tutorial001.py!}
+{!../../docs_src/dependencies/tutorial001.py!}
 ```
 
 関数のパラメータに`Depends`を使用するのは`Body`や`Query`などと同じですが、`Depends`の動作は少し異なります。
index e183f28baea49e4319155a71d1c8609ea9a86177..754ec028e421ced9f5ee323320689d16a2315245 100644 (file)
@@ -11,7 +11,7 @@
 以下のような最初の依存関係(「依存可能なもの」)を作成することができます:
 
 ```Python hl_lines="8 9"
-{!../../../docs_src/dependencies/tutorial005.py!}
+{!../../docs_src/dependencies/tutorial005.py!}
 ```
 
 これはオプショナルのクエリパラメータ`q`を`str`として宣言し、それを返すだけです。
@@ -23,7 +23,7 @@
 そして、別の依存関数(「依存可能なもの」)を作成して、同時にそれ自身の依存関係を宣言することができます(つまりそれ自身も「依存」です):
 
 ```Python hl_lines="13"
-{!../../../docs_src/dependencies/tutorial005.py!}
+{!../../docs_src/dependencies/tutorial005.py!}
 ```
 
 宣言されたパラメータに注目してみましょう:
@@ -38,7 +38,7 @@
 以下のように依存関係を使用することができます:
 
 ```Python hl_lines="21"
-{!../../../docs_src/dependencies/tutorial005.py!}
+{!../../docs_src/dependencies/tutorial005.py!}
 ```
 
 /// info | "情報"
index 086e1fc63ee7c16515e6e9f6da4f8dd907855017..ea522f91ff0ece359b322c73c7cdaec0be46d507 100644 (file)
@@ -21,7 +21,7 @@ JSON互換のデータのみを受信するデータベース`fase_db`がある
 Pydanticモデルのようなオブジェクトを受け取り、JSON互換版を返します:
 
 ```Python hl_lines="5 22"
-{!../../../docs_src/encoder/tutorial001.py!}
+{!../../docs_src/encoder/tutorial001.py!}
 ```
 
 この例では、Pydanticモデルを`dict`に、`datetime`を`str`に変換します。
index c0fdbd58c963872489d1ae1f540a001086915949..7f1b146489d8dc94b291c50b9ba6c8c4eef69091 100644 (file)
 ここでは、上記の型のいくつかを使用したパラメータを持つ*path operation*の例を示します。
 
 ```Python hl_lines="1 2 12-16"
-{!../../../docs_src/extra_data_types/tutorial001.py!}
+{!../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 関数内のパラメータは自然なデータ型を持っていることに注意してください。そして、以下のように通常の日付操作を行うことができます:
 
 ```Python hl_lines="18 19"
-{!../../../docs_src/extra_data_types/tutorial001.py!}
+{!../../docs_src/extra_data_types/tutorial001.py!}
 ```
index 90a22d3fa6364281dbc64f9d469952611b0bf4bb..f739e81b486964b0e0bed3dd5eedaea4dc344da3 100644 (file)
@@ -21,7 +21,7 @@
 ここでは、パスワードフィールドをもつモデルがどのように見えるのか、また、どこで使われるのか、大まかなイメージを紹介します:
 
 ```Python hl_lines="9  11  16  22  24  29-30  33-35  40-41"
-{!../../../docs_src/extra_models/tutorial001.py!}
+{!../../docs_src/extra_models/tutorial001.py!}
 ```
 
 ### `**user_in.dict()`について
@@ -157,7 +157,7 @@ UserInDB(
 このようにして、モデル間の違いだけを宣言することができます:
 
 ```Python hl_lines="9  15 16  19 20  23 24"
-{!../../../docs_src/extra_models/tutorial002.py!}
+{!../../docs_src/extra_models/tutorial002.py!}
 ```
 
 ## `Union`または`anyOf`
@@ -169,7 +169,7 @@ OpenAPIでは`anyOf`で定義されます。
 そのためには、標準的なPythonの型ヒント<a href="https://docs.python.org/3/library/typing.html#typing.Union" class="external-link" target="_blank">`typing.Union`</a>を使用します:
 
 ```Python hl_lines="1 14 15 18 19 20 33"
-{!../../../docs_src/extra_models/tutorial003.py!}
+{!../../docs_src/extra_models/tutorial003.py!}
 ```
 
 ## モデルのリスト
@@ -179,7 +179,7 @@ OpenAPIでは`anyOf`で定義されます。
 そのためには、標準のPythonの`typing.List`を使用する:
 
 ```Python hl_lines="1 20"
-{!../../../docs_src/extra_models/tutorial004.py!}
+{!../../docs_src/extra_models/tutorial004.py!}
 ```
 
 ## 任意の`dict`を持つレスポンス
@@ -191,7 +191,7 @@ OpenAPIでは`anyOf`で定義されます。
 この場合、`typing.Dict`を使用することができます:
 
 ```Python hl_lines="1 8"
-{!../../../docs_src/extra_models/tutorial005.py!}
+{!../../docs_src/extra_models/tutorial005.py!}
 ```
 
 ## まとめ
index dbe8e4518bd1b16fac304faef4f46de22a0e8f87..77f3b5fbe661dcd2b24adc29efea2f122c2c3703 100644 (file)
@@ -3,7 +3,7 @@
 最もシンプルなFastAPIファイルは以下のようになります:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 これを`main.py`にコピーします。
@@ -134,7 +134,7 @@ OpenAPIスキーマは、FastAPIに含まれている2つのインタラクテ
 ### Step 1: `FastAPI`をインポート
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI`は、APIのすべての機能を提供するPythonクラスです。
@@ -150,7 +150,7 @@ OpenAPIスキーマは、FastAPIに含まれている2つのインタラクテ
 ### Step 2: `FastAPI`の「インスタンス」を生成
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 ここで、`app`変数が`FastAPI`クラスの「インスタンス」になります。
 
@@ -171,7 +171,7 @@ $ uvicorn main:app --reload
 以下のようなアプリを作成したとき:
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
 ```
 
 そして、それを`main.py`ファイルに置き、次のように`uvicorn`を呼び出します:
@@ -250,7 +250,7 @@ APIを構築するときは、通常、これらの特定のHTTPメソッドを
 #### *パスオペレーションデコレータ*を定義
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 `@app.get("/")`は直下の関数が下記のリクエストの処理を担当することを**FastAPI**に伝えます:
 
@@ -305,7 +305,7 @@ Pythonにおける`@something`シンタックスはデコレータと呼ばれ
 * **関数**: 「デコレータ」の直下にある関数 (`@app.get("/")`の直下) です。
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 これは、Pythonの関数です。
@@ -319,7 +319,7 @@ Pythonにおける`@something`シンタックスはデコレータと呼ばれ
 `async def`の代わりに通常の関数として定義することもできます:
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note | "備考"
@@ -331,7 +331,7 @@ Pythonにおける`@something`シンタックスはデコレータと呼ばれ
 ### Step 5: コンテンツの返信
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `dict`、`list`、`str`、`int`などを返すことができます。
index 8be054858e10c7fae7b49a33a7594330a674a5a0..e94f16b21a0513f93860b55b7a1f7132bc64a083 100644 (file)
@@ -26,7 +26,7 @@ HTTPレスポンスをエラーでクライアントに返すには、`HTTPExcep
 ### `HTTPException`のインポート
 
 ```Python hl_lines="1"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 ```
 
 ### コード内での`HTTPException`の発生
@@ -42,7 +42,7 @@ Pythonの例外なので、`return`ではなく、`raise`です。
 この例では、クライアントが存在しないIDでアイテムを要求した場合、`404`のステータスコードを持つ例外を発生させます:
 
 ```Python hl_lines="11"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 ```
 
 ### レスポンス結果
@@ -82,7 +82,7 @@ Pythonの例外なので、`return`ではなく、`raise`です。
 しかし、高度なシナリオのために必要な場合には、カスタムヘッダーを追加することができます:
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial002.py!}
+{!../../docs_src/handling_errors/tutorial002.py!}
 ```
 
 ## カスタム例外ハンドラのインストール
@@ -96,7 +96,7 @@ Pythonの例外なので、`return`ではなく、`raise`です。
 カスタム例外ハンドラを`@app.exception_handler()`で追加することができます:
 
 ```Python hl_lines="5 6 7  13 14 15 16 17 18  24"
-{!../../../docs_src/handling_errors/tutorial003.py!}
+{!../../docs_src/handling_errors/tutorial003.py!}
 ```
 
 ここで、`/unicorns/yolo`をリクエストすると、*path operation*は`UnicornException`を`raise`します。
@@ -136,7 +136,7 @@ Pythonの例外なので、`return`ではなく、`raise`です。
 この例外ハンドラは`Requset`と例外を受け取ります。
 
 ```Python hl_lines="2 14 15 16"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 ```
 
 これで、`/items/foo`にアクセスすると、デフォルトのJSONエラーの代わりに以下が返されます:
@@ -189,7 +189,7 @@ path -> item_id
 例えば、これらのエラーに対しては、JSONではなくプレーンテキストを返すようにすることができます:
 
 ```Python hl_lines="3 4  9 10 11 22"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 ```
 
 /// note | "技術詳細"
@@ -207,7 +207,7 @@ path -> item_id
 アプリ開発中に本体のログを取ってデバッグしたり、ユーザーに返したりなどに使用することができます。
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial005.py!}
+{!../../docs_src/handling_errors/tutorial005.py!}
 ```
 
 ここで、以下のような無効な項目を送信してみてください:
@@ -269,7 +269,7 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
 デフォルトの例外ハンドラを`fastapi.exception_handlers`からインポートして再利用することができます:
 
 ```Python hl_lines="2 3 4 5 15 21"
-{!../../../docs_src/handling_errors/tutorial006.py!}
+{!../../docs_src/handling_errors/tutorial006.py!}
 ```
 
 この例では、非常に表現力のあるメッセージでエラーを`print`しています。
index 4fab3d423b017379b822827b452eebe38a5f16a2..3180b78b5688d05c74107159ed0b0d79f51434ad 100644 (file)
@@ -7,7 +7,7 @@
 まず、`Header`をインポートします:
 
 ```Python hl_lines="3"
-{!../../../docs_src/header_params/tutorial001.py!}
+{!../../docs_src/header_params/tutorial001.py!}
 ```
 
 ## `Header`のパラメータの宣言
@@ -17,7 +17,7 @@
 最初の値がデフォルト値で、追加の検証パラメータや注釈パラメータをすべて渡すことができます。
 
 ```Python hl_lines="9"
-{!../../../docs_src/header_params/tutorial001.py!}
+{!../../docs_src/header_params/tutorial001.py!}
 ```
 
 /// note | "技術詳細"
@@ -51,7 +51,7 @@
 もしなんらかの理由でアンダースコアからハイフンへの自動変換を無効にする必要がある場合は、`Header`の`convert_underscores`に`False`を設定してください:
 
 ```Python hl_lines="9"
-{!../../../docs_src/header_params/tutorial002.py!}
+{!../../docs_src/header_params/tutorial002.py!}
 ```
 
 /// warning | "注意"
@@ -71,7 +71,7 @@
 例えば、複数回出現する可能性のある`X-Token`のヘッダを定義するには、以下のように書くことができます:
 
 ```Python hl_lines="9"
-{!../../../docs_src/header_params/tutorial003.py!}
+{!../../docs_src/header_params/tutorial003.py!}
 ```
 
 もし、その*path operation*で通信する場合は、次のように2つのHTTPヘッダーを送信します:
index eb85dc3895179faab32ffcd151190f399640f96b..8285b479e8fba0f7a9f04186db99a8b296dcc145 100644 (file)
@@ -14,7 +14,7 @@
 これらを設定するには、パラメータ `title`、`description`、`version` を使用します:
 
 ```Python hl_lines="4-6"
-{!../../../docs_src/metadata/tutorial001.py!}
+{!../../docs_src/metadata/tutorial001.py!}
 ```
 
 この設定では、自動APIドキュメントは以下の様になります:
@@ -42,7 +42,7 @@
 タグのためのメタデータを作成し、それを `openapi_tags` パラメータに渡します。
 
 ```Python hl_lines="3-16  18"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
 ```
 
 説明文 (description) の中で Markdown を使用できることに注意してください。たとえば、「login」は太字 (**login**) で表示され、「fancy」は斜体 (_fancy_) で表示されます。
@@ -58,7 +58,7 @@
 `tags` パラメーターを使用して、それぞれの *path operations* (および `APIRouter`) を異なるタグに割り当てます:
 
 ```Python hl_lines="21  26"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
 ```
 
 /// info | "情報"
@@ -88,7 +88,7 @@
 たとえば、`/api/v1/openapi.json` で提供されるように設定するには:
 
 ```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial002.py!}
+{!../../docs_src/metadata/tutorial002.py!}
 ```
 
 OpenAPIスキーマを完全に無効にする場合は、`openapi_url=None` を設定できます。これにより、それを使用するドキュメントUIも無効になります。
@@ -107,5 +107,5 @@ OpenAPIスキーマを完全に無効にする場合は、`openapi_url=None` を
 たとえば、`/documentation` でSwagger UIが提供されるように設定し、ReDocを無効にするには:
 
 ```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial003.py!}
+{!../../docs_src/metadata/tutorial003.py!}
 ```
index 05e1b7a8ce7dff4591b57bb47659c2e0b1e7556c..f4a503720c7057ae595706f8065431976635c7a1 100644 (file)
@@ -32,7 +32,7 @@
 * その後、`response` を返す前にさらに `response` を変更することもできます。
 
 ```Python hl_lines="8-9  11  14"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 /// tip | "豆知識"
@@ -60,7 +60,7 @@
 例えば、リクエストの処理とレスポンスの生成にかかった秒数を含むカスタムヘッダー `X-Process-Time` を追加できます:
 
 ```Python hl_lines="10  12-13"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 ## その他のミドルウェア
index def12bd0812bd6532bad4ec6e565606d61271ba3..7eceb377d5bc5773625006c7a4b39e5b18f64a18 100644 (file)
@@ -17,7 +17,7 @@
 しかし、それぞれの番号コードが何のためのものか覚えていない場合は、`status`のショートカット定数を使用することができます:
 
 ```Python hl_lines="3  17"
-{!../../../docs_src/path_operation_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_configuration/tutorial001.py!}
 ```
 
 そのステータスコードはレスポンスで使用され、OpenAPIスキーマに追加されます。
@@ -35,7 +35,7 @@
 `tags`パラメータを`str`の`list`(通常は1つの`str`)と一緒に渡すと、*path operation*にタグを追加できます:
 
 ```Python hl_lines="17  22  27"
-{!../../../docs_src/path_operation_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_configuration/tutorial002.py!}
 ```
 
 これらはOpenAPIスキーマに追加され、自動ドキュメントのインターフェースで使用されます:
@@ -47,7 +47,7 @@
 `summary`と`description`を追加できます:
 
 ```Python hl_lines="20-21"
-{!../../../docs_src/path_operation_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_configuration/tutorial003.py!}
 ```
 
 ## docstringを用いた説明
@@ -57,7 +57,7 @@
 docstringに<a href="https://en.wikipedia.org/wiki/Markdown" class="external-link" target="_blank">Markdown</a>を記述すれば、正しく解釈されて表示されます。(docstringのインデントを考慮して)
 
 ```Python hl_lines="19-27"
-{!../../../docs_src/path_operation_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_configuration/tutorial004.py!}
 ```
 
 これは対話的ドキュメントで使用されます:
@@ -69,7 +69,7 @@ docstringに<a href="https://en.wikipedia.org/wiki/Markdown" class="external-lin
 `response_description`パラメータでレスポンスの説明をすることができます。
 
 ```Python hl_lines="21"
-{!../../../docs_src/path_operation_configuration/tutorial005.py!}
+{!../../docs_src/path_operation_configuration/tutorial005.py!}
 ```
 
 /// info | "情報"
@@ -93,7 +93,7 @@ OpenAPIは*path operation*ごとにレスポンスの説明を必要としてい
 *path operation*を<abbr title="非推奨、使わない方がよい">deprecated</abbr>としてマークする必要があるが、それを削除しない場合は、`deprecated`パラメータを渡します:
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_operation_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_configuration/tutorial006.py!}
 ```
 
 対話的ドキュメントでは非推奨と明記されます:
index 9f0b72585f9d39bda970fa0b3065a8b78ce67a9c..42fbb2ee2c3b64cf45b00f4c95f55636e760d86c 100644 (file)
@@ -7,7 +7,7 @@
 まず初めに、`fastapi`から`Path`をインポートします:
 
 ```Python hl_lines="1"
-{!../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ## メタデータの宣言
@@ -17,7 +17,7 @@
 例えば、パスパラメータ`item_id`に対して`title`のメタデータを宣言するには以下のようにします:
 
 ```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 /// note | "備考"
@@ -47,7 +47,7 @@ Pythonは「デフォルト」を持たない値の前に「デフォルト」
 そのため、以下のように関数を宣言することができます:
 
 ```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial002.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial002.py!}
 ```
 
 ## 必要に応じてパラメータを並び替えるトリック
@@ -59,7 +59,7 @@ Pythonは「デフォルト」を持たない値の前に「デフォルト」
 Pythonはその`*`で何かをすることはありませんが、それ以降のすべてのパラメータがキーワード引数(キーと値のペア)として呼ばれるべきものであると知っているでしょう。それは<abbr title="From: K-ey W-ord Arg-uments"><code>kwargs</code></abbr>としても知られています。たとえデフォルト値がなくても。
 
 ```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
 ```
 
 ## 数値の検証: 以上
@@ -69,7 +69,7 @@ Pythonはその`*`で何かをすることはありませんが、それ以降
 ここで、`ge=1`の場合、`item_id`は\b`1`「より大きい`g`か、同じ`e`」整数でなれけばなりません。
 
 ```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial004.py!}
 ```
 
 ## 数値の検証: より大きいと小なりイコール
@@ -80,7 +80,7 @@ Pythonはその`*`で何かをすることはありませんが、それ以降
 * `le`: 小なりイコール(`l`ess than or `e`qual)
 
 ```Python hl_lines="9"
-{!../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial005.py!}
 ```
 
 ## 数値の検証: 浮動小数点、 大なり小なり
@@ -94,7 +94,7 @@ Pythonはその`*`で何かをすることはありませんが、それ以降
 これは<abbr title="未満"><code>lt</code></abbr>も同じです。
 
 ```Python hl_lines="11"
-{!../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial006.py!}
 ```
 
 ## まとめ
index 0a79160127338409df88a2b20a0c4640c5234887..e1cb67a13a4e4fda66427cc62f65295e9e3376b9 100644 (file)
@@ -3,7 +3,7 @@
 Pythonのformat文字列と同様のシンタックスで「パスパラメータ」や「パス変数」を宣言できます:
 
 ```Python hl_lines="6 7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
 ```
 
 パスパラメータ `item_id` の値は、引数 `item_id` として関数に渡されます。
@@ -19,7 +19,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
 標準のPythonの型アノテーションを使用して、関数内のパスパラメータの型を宣言できます:
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
 ```
 
 ここでは、 `item_id` は `int` として宣言されています。
@@ -122,7 +122,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
 *path operations* は順に評価されるので、 `/users/me` が `/users/{user_id}` よりも先に宣言されているか確認する必要があります:
 
 ```Python hl_lines="6 11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
 ```
 
 それ以外の場合、 `/users/{users_id}` は `/users/me` としてもマッチします。値が「"me"」であるパラメータ `user_id` を受け取ると「考え」ます。
@@ -140,7 +140,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
 そして、固定値のクラス属性を作ります。すると、その値が使用可能な値となります:
 
 ```Python hl_lines="1 6 7 8 9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// info | "情報"
@@ -160,7 +160,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
 次に、作成したenumクラスである`ModelName`を使用した型アノテーションをもつ*パスパラメータ*を作成します:
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 ### ドキュメントの確認
@@ -178,7 +178,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
 これは、作成した列挙型 `ModelName` の*列挙型メンバ*と比較できます:
 
 ```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 #### *列挙値*の取得
@@ -186,7 +186,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
 `model_name.value` 、もしくは一般に、 `your_enum_member.value` を使用して実際の値 (この場合は `str`) を取得できます。
 
 ```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// tip | "豆知識"
@@ -202,7 +202,7 @@ Pythonのformat文字列と同様のシンタックスで「パスパラメー
 それらはクライアントに返される前に適切な値 (この場合は文字列) に変換されます。
 
 ```Python hl_lines="18  21  23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 クライアントは以下の様なJSONレスポンスを得ます:
@@ -243,7 +243,7 @@ Starletteのオプションを直接使用することで、以下のURLの様
 したがって、以下の様に使用できます:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
 ```
 
 /// tip | "豆知識"
index ada04884493b1c89cc92bb6da117ff411b4bcbba..9e54a6f5578263ed2e0f4f6637cbf0cda8979bc0 100644 (file)
@@ -5,7 +5,7 @@
 以下のアプリケーションを例にしてみましょう:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!../../docs_src/query_params_str_validations/tutorial001.py!}
 ```
 
 クエリパラメータ `q` は `Optional[str]` 型で、`None` を許容する `str` 型を意味しており、デフォルトは `None` です。そのため、FastAPIはそれが必須ではないと理解します。
@@ -27,7 +27,7 @@ FastAPIは、 `q` はデフォルト値が `=None` であるため、必須で
 そのために、まずは`fastapi`から`Query`をインポートします:
 
 ```Python hl_lines="3"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 ## デフォルト値として`Query`を使用
@@ -35,7 +35,7 @@ FastAPIは、 `q` はデフォルト値が `=None` であるため、必須で
 パラメータのデフォルト値として使用し、パラメータ`max_length`を50に設定します:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 デフォルト値`None`を`Query(default=None)`に置き換える必要があるので、`Query`の最初の引数はデフォルト値を定義するのと同じです。
@@ -87,7 +87,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
 パラメータ`min_length`も追加することができます:
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!../../docs_src/query_params_str_validations/tutorial003.py!}
 ```
 
 ## 正規表現の追加
@@ -95,7 +95,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
 パラメータが一致するべき<abbr title="正規表現とは、文字列の検索パターンを定義する文字列です。">正規表現</abbr>を定義することができます:
 
 ```Python hl_lines="11"
-{!../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!../../docs_src/query_params_str_validations/tutorial004.py!}
 ```
 
 この特定の正規表現は受け取ったパラメータの値をチェックします:
@@ -115,7 +115,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
 クエリパラメータ`q`の`min_length`を`3`とし、デフォルト値を`fixedquery`としてみましょう:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!../../docs_src/query_params_str_validations/tutorial005.py!}
 ```
 
 /// note | "備考"
@@ -147,7 +147,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 そのため、`Query`を使用して必須の値を宣言する必要がある場合は、第一引数に`...`を使用することができます:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!../../docs_src/query_params_str_validations/tutorial006.py!}
 ```
 
 /// info | "情報"
@@ -165,7 +165,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 例えば、URL内に複数回出現するクエリパラメータ`q`を宣言するには以下のように書きます:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!../../docs_src/query_params_str_validations/tutorial011.py!}
 ```
 
 そしてURLは以下です:
@@ -202,7 +202,7 @@ http://localhost:8000/items/?q=foo&q=bar
 また、値が指定されていない場合はデフォルトの`list`を定義することもできます。
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!../../docs_src/query_params_str_validations/tutorial012.py!}
 ```
 
 以下のURLを開くと:
@@ -227,7 +227,7 @@ http://localhost:8000/items/
 `List[str]`の代わりに直接`list`を使うこともできます:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!../../docs_src/query_params_str_validations/tutorial013.py!}
 ```
 
 /// note | "備考"
@@ -255,13 +255,13 @@ http://localhost:8000/items/
 `title`を追加できます:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!../../docs_src/query_params_str_validations/tutorial007.py!}
 ```
 
 `description`を追加できます:
 
 ```Python hl_lines="13"
-{!../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!../../docs_src/query_params_str_validations/tutorial008.py!}
 ```
 
 ## エイリアスパラメータ
@@ -283,7 +283,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 それならば、`alias`を宣言することができます。エイリアスはパラメータの値を見つけるのに使用されます:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!../../docs_src/query_params_str_validations/tutorial009.py!}
 ```
 
 ## 非推奨パラメータ
@@ -295,7 +295,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 その場合、`Query`にパラメータ`deprecated=True`を渡します:
 
 ```Python hl_lines="18"
-{!../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!../../docs_src/query_params_str_validations/tutorial010.py!}
 ```
 
 ドキュメントは以下のようになります:
index c0eb2d0964125160b9c93cd627d0d5c35ce70c61..6d41d3742dfa86b0ec79fa075836eb4245856b47 100644 (file)
@@ -3,7 +3,7 @@
 パスパラメータではない関数パラメータを宣言すると、それらは自動的に "クエリ" パラメータとして解釈されます。
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
 ```
 
 クエリはURL内で `?` の後に続くキーとバリューの組で、 `&` で区切られています。
@@ -64,7 +64,7 @@ http://127.0.0.1:8000/items/?skip=20
 同様に、デフォルト値を `None` とすることで、オプショナルなクエリパラメータを宣言できます:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial002.py!}
+{!../../docs_src/query_params/tutorial002.py!}
 ```
 
 この場合、関数パラメータ `q` はオプショナルとなり、デフォルトでは `None` になります。
@@ -80,7 +80,7 @@ http://127.0.0.1:8000/items/?skip=20
 `bool` 型も宣言できます。これは以下の様に変換されます:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial003.py!}
+{!../../docs_src/query_params/tutorial003.py!}
 ```
 
 この場合、以下にアクセスすると:
@@ -124,7 +124,7 @@ http://127.0.0.1:8000/items/foo?short=yes
 名前で判別されます:
 
 ```Python hl_lines="8  10"
-{!../../../docs_src/query_params/tutorial004.py!}
+{!../../docs_src/query_params/tutorial004.py!}
 ```
 
 ## 必須のクエリパラメータ
@@ -136,7 +136,7 @@ http://127.0.0.1:8000/items/foo?short=yes
 しかしクエリパラメータを必須にしたい場合は、ただデフォルト値を宣言しなければよいです:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
 ```
 
 ここで、クエリパラメータ `needy` は `str` 型の必須のクエリパラメータです
@@ -182,7 +182,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
 そして当然、あるパラメータを必須に、別のパラメータにデフォルト値を設定し、また別のパラメータをオプショナルにできます:
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params/tutorial006.py!}
+{!../../docs_src/query_params/tutorial006.py!}
 ```
 
 この場合、3つのクエリパラメータがあります。:
index d8effc219e86a52e1573a92fc252b15c76943295..e03b9166d7ce7d5687310f4a81e689ca7c693cf5 100644 (file)
@@ -13,7 +13,7 @@
 ## `File`と`Form`のインポート
 
 ```Python hl_lines="1"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 ## `File`と`Form`のパラメータの定義
@@ -21,7 +21,7 @@
 ファイルやフォームのパラメータは`Body`や`Query`の場合と同じように作成します:
 
 ```Python hl_lines="8"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 ファイルとフォームフィールドがフォームデータとしてアップロードされ、ファイルとフォームフィールドを受け取ります。
index d04dc810bad94300d13883191b879872dcfaa315..eb453c04a6193e8dadba6ea8541b37393ed3d0f4 100644 (file)
@@ -15,7 +15,7 @@ JSONの代わりにフィールドを受け取る場合は、`Form`を使用し
 `fastapi`から`Form`をインポートします:
 
 ```Python hl_lines="1"
-{!../../../docs_src/request_forms/tutorial001.py!}
+{!../../docs_src/request_forms/tutorial001.py!}
 ```
 
 ## `Form`のパラメータの定義
@@ -23,7 +23,7 @@ JSONの代わりにフィールドを受け取る場合は、`Form`を使用し
 `Body`や`Query`の場合と同じようにフォームパラメータを作成します:
 
 ```Python hl_lines="7"
-{!../../../docs_src/request_forms/tutorial001.py!}
+{!../../docs_src/request_forms/tutorial001.py!}
 ```
 
 例えば、OAuth2仕様が使用できる方法の1つ(「パスワードフロー」と呼ばれる)では、フォームフィールドとして`username`と`password`を送信する必要があります。
index 7bb5e282517ba547346c65c1063ccfb9a15f8328..973f893de771ddcb6a2b3df60e27be05cdb30af0 100644 (file)
@@ -9,7 +9,7 @@
 * など。
 
 ```Python hl_lines="17"
-{!../../../docs_src/response_model/tutorial001.py!}
+{!../../docs_src/response_model/tutorial001.py!}
 ```
 
 /// note | "備考"
@@ -42,13 +42,13 @@ FastAPIは`response_model`を使って以下のことをします:
 ここでは`UserIn`モデルを宣言しています。それには平文のパスワードが含まれています:
 
 ```Python hl_lines="9 11"
-{!../../../docs_src/response_model/tutorial002.py!}
+{!../../docs_src/response_model/tutorial002.py!}
 ```
 
 そして、このモデルを使用して入力を宣言し、同じモデルを使って出力を宣言しています:
 
 ```Python hl_lines="17 18"
-{!../../../docs_src/response_model/tutorial002.py!}
+{!../../docs_src/response_model/tutorial002.py!}
 ```
 
 これで、ブラウザがパスワードを使ってユーザーを作成する際に、APIがレスポンスで同じパスワードを返すようになりました。
@@ -68,19 +68,19 @@ FastAPIは`response_model`を使って以下のことをします:
 代わりに、平文のパスワードを持つ入力モデルと、パスワードを持たない出力モデルを作成することができます:
 
 ```Python hl_lines="9 11 16"
-{!../../../docs_src/response_model/tutorial003.py!}
+{!../../docs_src/response_model/tutorial003.py!}
 ```
 
 ここでは、*path operation関数*がパスワードを含む同じ入力ユーザーを返しているにもかかわらず:
 
 ```Python hl_lines="24"
-{!../../../docs_src/response_model/tutorial003.py!}
+{!../../docs_src/response_model/tutorial003.py!}
 ```
 
 ...`response_model`を`UserOut`と宣言したことで、パスワードが含まれていません:
 
 ```Python hl_lines="22"
-{!../../../docs_src/response_model/tutorial003.py!}
+{!../../docs_src/response_model/tutorial003.py!}
 ```
 
 そのため、**FastAPI** は出力モデルで宣言されていない全てのデータをフィルタリングしてくれます(Pydanticを使用)。
@@ -100,7 +100,7 @@ FastAPIは`response_model`を使って以下のことをします:
 レスポンスモデルにはデフォルト値を設定することができます:
 
 ```Python hl_lines="11 13 14"
-{!../../../docs_src/response_model/tutorial004.py!}
+{!../../docs_src/response_model/tutorial004.py!}
 ```
 
 * `description: str = None`は`None`がデフォルト値です。
@@ -116,7 +116,7 @@ FastAPIは`response_model`を使って以下のことをします:
 *path operation デコレータ*に`response_model_exclude_unset=True`パラメータを設定することができます:
 
 ```Python hl_lines="24"
-{!../../../docs_src/response_model/tutorial004.py!}
+{!../../docs_src/response_model/tutorial004.py!}
 ```
 
 そして、これらのデフォルト値はレスポンスに含まれず、実際に設定された値のみが含まれます。
@@ -206,7 +206,7 @@ FastAPIは十分に賢いので(実際には、Pydanticが十分に賢い)`d
 ///
 
 ```Python hl_lines="31 37"
-{!../../../docs_src/response_model/tutorial005.py!}
+{!../../docs_src/response_model/tutorial005.py!}
 ```
 
 /// tip | "豆知識"
@@ -222,7 +222,7 @@ FastAPIは十分に賢いので(実際には、Pydanticが十分に賢い)`d
 もし`set`を使用することを忘れて、代わりに`list`や`tuple`を使用しても、FastAPIはそれを`set`に変換して正しく動作します:
 
 ```Python hl_lines="31 37"
-{!../../../docs_src/response_model/tutorial006.py!}
+{!../../docs_src/response_model/tutorial006.py!}
 ```
 
 ## まとめ
index 945767894f22e15f4727a65a5ad2b7d880745fef..90b2908871b3b40d1ff671515aa15114b2b08907 100644 (file)
@@ -9,7 +9,7 @@
 * など。
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 /// note | "備考"
@@ -77,7 +77,7 @@ HTTPでは、レスポンスの一部として3桁の数字のステータス
 先ほどの例をもう一度見てみましょう:
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 `201`は「作成完了」のためのステータスコードです。
@@ -87,7 +87,7 @@ HTTPでは、レスポンスの一部として3桁の数字のステータス
 `fastapi.status`の便利な変数を利用することができます。
 
 ```Python hl_lines="1 6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
 ```
 
 それらは便利です。それらは同じ番号を保持しており、その方法ではエディタの自動補完を使用してそれらを見つけることができます。
index a3cd5eb5491fd0ab334defe6ca61c52c29566f81..baf1bbedd4a4cb410f9a54c7cd436c72cc1e310a 100644 (file)
@@ -11,7 +11,7 @@ JSON Schemaの追加情報を宣言する方法はいくつかあります。
 <a href="https://docs.pydantic.dev/latest/concepts/json_schema/#schema-customization" class="external-link" target="_blank">Pydanticのドキュメント: スキーマのカスタマイズ</a>で説明されているように、`Config`と`schema_extra`を使ってPydanticモデルの例を宣言することができます:
 
 ```Python hl_lines="15 16 17 18 19 20 21 22 23"
-{!../../../docs_src/schema_extra_example/tutorial001.py!}
+{!../../docs_src/schema_extra_example/tutorial001.py!}
 ```
 
 その追加情報はそのまま出力され、JSON Schemaに追加されます。
@@ -21,7 +21,7 @@ JSON Schemaの追加情報を宣言する方法はいくつかあります。
 後述する`Field`、`Path`、`Query`、`Body`などでは、任意の引数を関数に渡すことでJSON Schemaの追加情報を宣言することもできます:
 
 ```Python hl_lines="4 10 11 12 13"
-{!../../../docs_src/schema_extra_example/tutorial002.py!}
+{!../../docs_src/schema_extra_example/tutorial002.py!}
 ```
 
 /// warning | "注意"
@@ -37,7 +37,7 @@ JSON Schemaの追加情報を宣言する方法はいくつかあります。
 例えば、`Body`にボディリクエストの`example`を渡すことができます:
 
 ```Python hl_lines="21 22 23 24 25 26"
-{!../../../docs_src/schema_extra_example/tutorial003.py!}
+{!../../docs_src/schema_extra_example/tutorial003.py!}
 ```
 
 ## ドキュメントのUIの例
index c78a3755e968c10038695141abc67ed456eb423b..51f7bf829a9e2a8f748f3e373644f46b722e6f98 100644 (file)
@@ -21,7 +21,7 @@
 `main.py`に、下記の例をコピーします:
 
 ```Python
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 ## 実行
@@ -129,7 +129,7 @@ OAuth2は、バックエンドやAPIがユーザーを認証するサーバー
 `OAuth2PasswordBearer` クラスのインスタンスを作成する時に、パラメーター`tokenUrl`を渡します。このパラメーターには、クライアント (ユーザーのブラウザで動作するフロントエンド) がトークンを取得するために`ユーザー名`と`パスワード`を送信するURLを指定します。
 
 ```Python hl_lines="6"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 /// tip | "豆知識"
@@ -169,7 +169,7 @@ oauth2_scheme(some, parameters)
 これで`oauth2_scheme`を`Depends`で依存関係に渡すことができます。
 
 ```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 この依存関係は、*path operation function*のパラメーター`token`に代入される`str`を提供します。
index 250f66b818c69cb0f83b91b34204ecea6b24f0dc..0edbd983f345850f42d3f436e4aba465ae39eb86 100644 (file)
@@ -3,7 +3,7 @@
 一つ前の章では、(依存性注入システムに基づいた)セキュリティシステムは、 *path operation関数* に `str` として `token` を与えていました:
 
 ```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 しかし、それはまだそんなに有用ではありません。
@@ -17,7 +17,7 @@
 ボディを宣言するのにPydanticを使用するのと同じやり方で、Pydanticを別のどんなところでも使うことができます:
 
 ```Python hl_lines="5  12-16"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
 ```
 
 ## 依存関係 `get_current_user` を作成
@@ -31,7 +31,7 @@
 以前直接 *path operation* の中でしていたのと同じように、新しい依存関係である `get_current_user` は `str` として `token` を受け取るようになります:
 
 ```Python hl_lines="25"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
 ```
 
 ## ユーザーの取得
@@ -39,7 +39,7 @@
 `get_current_user` は作成した(偽物の)ユーティリティ関数を使って、 `str` としてトークンを受け取り、先ほどのPydanticの `User` モデルを返却します:
 
 ```Python hl_lines="19-22  26-27"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
 ```
 
 ## 現在のユーザーの注入
@@ -47,7 +47,7 @@
 ですので、 `get_current_user` に対して同様に *path operation* の中で `Depends` を利用できます。
 
 ```Python hl_lines="31"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
 ```
 
 Pydanticモデルの `User` として、 `current_user` の型を宣言することに注意してください。
@@ -104,7 +104,7 @@ Pydanticモデルの `User` として、 `current_user` の型を宣言するこ
 さらに、こうした何千もの *path operations* は、たった3行で表現できるのです:
 
 ```Python hl_lines="30-32"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
 ```
 
 ## まとめ
index 4f6aebd4c353e69eadf20a6bb94b68a41816b24b..b2f51161070c4080b88e155f12054957943ffee1 100644 (file)
@@ -119,7 +119,7 @@ PassLibのcontextには、検証だけが許された非推奨の古いハッシ
 さらに、ユーザーを認証して返す関数も作成します。
 
 ```Python hl_lines="7  48  55-56  59-60  69-75"
-{!../../../docs_src/security/tutorial004.py!}
+{!../../docs_src/security/tutorial004.py!}
 ```
 
 /// note | "備考"
@@ -157,7 +157,7 @@ JWTトークンの署名に使用するアルゴリズム`"HS256"`を指定し
 新しいアクセストークンを生成するユーティリティ関数を作成します。
 
 ```Python hl_lines="6  12-14  28-30  78-86"
-{!../../../docs_src/security/tutorial004.py!}
+{!../../docs_src/security/tutorial004.py!}
 ```
 
 ## 依存関係の更新
@@ -169,7 +169,7 @@ JWTトークンの署名に使用するアルゴリズム`"HS256"`を指定し
 トークンが無効な場合は、すぐにHTTPエラーを返します。
 
 ```Python hl_lines="89-106"
-{!../../../docs_src/security/tutorial004.py!}
+{!../../docs_src/security/tutorial004.py!}
 ```
 
 ## `/token` パスオペレーションの更新
@@ -179,7 +179,7 @@ JWTトークンの署名に使用するアルゴリズム`"HS256"`を指定し
 JWTアクセストークンを作成し、それを返します。
 
 ```Python hl_lines="115-130"
-{!../../../docs_src/security/tutorial004.py!}
+{!../../docs_src/security/tutorial004.py!}
 ```
 
 ### JWTの"subject" `sub` についての技術的な詳細
index c9d95bc3478fb51fa800c5f5d285afb9099c9271..e6002a1fb6e25c82e6b5d64dd3f1dbc40591119b 100644 (file)
@@ -8,7 +8,7 @@
 * `StaticFiles()` インスタンスを生成し、特定のパスに「マウント」。
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
 ```
 
 /// note | "技術詳細"
index 3ed03ebeaa3a35655411048fbd9a1addfb0c1353..6c5e712e84a6c609a41b2230363a740b7b60be6a 100644 (file)
@@ -19,7 +19,7 @@
 チェックしたい Python の標準的な式と共に、シンプルに `assert` 文を記述します。
 
 ```Python hl_lines="2  12  15-18"
-{!../../../docs_src/app_testing/tutorial001.py!}
+{!../../docs_src/app_testing/tutorial001.py!}
 ```
 
 /// tip | "豆知識"
@@ -57,7 +57,7 @@ FastAPIアプリケーションへのリクエストの送信とは別に、テ
 **FastAPI** アプリに `main.py` ファイルがあるとします:
 
 ```Python
-{!../../../docs_src/app_testing/main.py!}
+{!../../docs_src/app_testing/main.py!}
 ```
 
 ### テストファイル
@@ -65,7 +65,7 @@ FastAPIアプリケーションへのリクエストの送信とは別に、テ
 次に、テストを含む `test_main.py` ファイルを作成し、`main` モジュール (`main.py`) から `app` をインポートします:
 
 ```Python
-{!../../../docs_src/app_testing/test_main.py!}
+{!../../docs_src/app_testing/test_main.py!}
 ```
 
 ## テスト: 例の拡張
@@ -86,7 +86,7 @@ FastAPIアプリケーションへのリクエストの送信とは別に、テ
 //// tab | Python 3.10+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_py310/main.py!}
 ```
 
 ////
@@ -94,7 +94,7 @@ FastAPIアプリケーションへのリクエストの送信とは別に、テ
 //// tab | Python 3.6+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/main.py!}
+{!> ../../docs_src/app_testing/app_b/main.py!}
 ```
 
 ////
@@ -104,7 +104,7 @@ FastAPIアプリケーションへのリクエストの送信とは別に、テ
 次に、先程のものに拡張版のテストを加えた、`test_main_b.py` を作成します。
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/test_main.py!}
+{!> ../../docs_src/app_testing/app_b/test_main.py!}
 ```
 
 リクエストに情報を渡せるクライアントが必要で、その方法がわからない場合はいつでも、`httpx` での実現方法を検索 (Google) できます。
index e155f41f10d798af79c87c8405af2f89856e7afb..94867c1988e481811d5cd59d75dfa4f451a39d67 100644 (file)
@@ -15,7 +15,7 @@
 응용 프로그램을 시작하기 전에 실행하려는 함수를 "startup" 이벤트로 선언합니다:
 
 ```Python hl_lines="8"
-{!../../../docs_src/events/tutorial001.py!}
+{!../../docs_src/events/tutorial001.py!}
 ```
 
 이 경우 `startup` 이벤트 핸들러 함수는 단순히 몇 가지 값으로 구성된 `dict` 형식의 "데이터베이스"를 초기화합니다.
@@ -29,7 +29,7 @@
 응용 프로그램이 종료될 때 실행하려는 함수를 추가하려면 `"shutdown"` 이벤트로 선언합니다:
 
 ```Python hl_lines="6"
-{!../../../docs_src/events/tutorial002.py!}
+{!../../docs_src/events/tutorial002.py!}
 ```
 
 이 예제에서 `shutdown` 이벤트 핸들러 함수는 `"Application shutdown"`이라는 텍스트가 적힌 `log.txt` 파일을 추가할 것입니다.
index 5c458e48de59d4581d53bbddb5ddd8b946b70538..6d73461898a07afb98af4cda05bbaf708eeafff6 100644 (file)
@@ -23,7 +23,7 @@
 간단한 예제부터 시작해봅시다:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 이 프로그램을 실행한 결과값:
@@ -39,7 +39,7 @@ John Doe
 * 두 단어를 중간에 공백을 두고 <abbr title="두 개를 하나로 차례차례 이어지게 하다">연결</abbr>합니다.
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### 코드 수정
@@ -83,7 +83,7 @@ John Doe
 이게 "타입 힌트"입니다:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 타입힌트는 다음과 같이 기본 값을 선언하는 것과는 다릅니다:
@@ -113,7 +113,7 @@ John Doe
 아래 함수를 보면, 이미 타입 힌트가 적용되어 있는 걸 볼 수 있습니다:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 편집기가 변수의 타입을 알고 있기 때문에, 자동완성 뿐 아니라 에러도 확인할 수 있습니다:
@@ -123,7 +123,7 @@ John Doe
 이제 고쳐야하는 걸 알기 때문에, `age`를 `str(age)`과 같이 문자열로 바꾸게 됩니다:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## 타입 선언
@@ -144,7 +144,7 @@ John Doe
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### 타입 매개변수를 활용한 Generic(제네릭) 타입
@@ -162,7 +162,7 @@ John Doe
 `typing`에서  `List`(대문자 `L`)를 import 합니다.
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 콜론(`:`) 문법을 이용하여 변수를 선언합니다.
@@ -172,7 +172,7 @@ John Doe
 이때 배열은 내부 타입을 포함하는 타입이기 때문에 대괄호 안에 넣어줍니다.
 
 ```Python hl_lines="4"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 /// tip | "팁"
@@ -200,7 +200,7 @@ John Doe
 `tuple`과 `set`도 동일하게 선언할 수 있습니다.
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial007.py!}
+{!../../docs_src/python_types/tutorial007.py!}
 ```
 
 이 뜻은 아래와 같습니다:
@@ -217,7 +217,7 @@ John Doe
 두 번째 매개변수는  `dict`의 값(value)입니다.
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial008.py!}
+{!../../docs_src/python_types/tutorial008.py!}
 ```
 
 이 뜻은 아래와 같습니다:
@@ -231,7 +231,7 @@ John Doe
 `str`과 같이 타입을 선언할 때 `Optional`을 쓸 수도 있는데, "선택적(Optional)"이기때문에 `None`도 될 수 있습니다:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 `Optional[str]`을 `str` 대신 쓰게 되면, 특정 값이 실제로는 `None`이 될 수도 있는데 항상 `str`이라고 가정하는 상황에서 에디터가 에러를 찾게 도와줄 수 있습니다.
@@ -256,13 +256,13 @@ John Doe
 이름(name)을 가진 `Person` 클래스가 있다고 해봅시다.
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 그렇게 하면 변수를 `Person`이라고 선언할 수 있게 됩니다.
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 그리고 역시나 모든 에디터 도움을 받게 되겠죠.
@@ -284,7 +284,7 @@ John Doe
 Pydantic 공식 문서 예시:
 
 ```Python
-{!../../../docs_src/python_types/tutorial011.py!}
+{!../../docs_src/python_types/tutorial011.py!}
 ```
 
 /// info | "정보"
index 880a1c198b2304eb46daf537bbb2d45d10e420b1..376c52524db31b2d4fa9e1eeb0d6f8227d0dd7e9 100644 (file)
@@ -16,7 +16,7 @@ FastAPI에서는 응답을 반환한 후에 실행할 백그라운드 작업을
 먼저 아래와 같이 `BackgroundTasks`를 임포트하고, `BackgroundTasks`를 _경로 작동 함수_ 에서 매개변수로 가져오고 정의합니다.
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 **FastAPI** 는 `BackgroundTasks` 개체를 생성하고, 매개 변수로 전달합니다.
@@ -34,7 +34,7 @@ FastAPI에서는 응답을 반환한 후에 실행할 백그라운드 작업을
 그리고 이 작업은 `async`와 `await`를 사용하지 않으므로 일반 `def` 함수로 선언합니다.
 
 ```Python hl_lines="6-9"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 ## 백그라운드 작업 추가
@@ -42,7 +42,7 @@ FastAPI에서는 응답을 반환한 후에 실행할 백그라운드 작업을
 _경로 작동 함수_ 내에서 작업 함수를 `.add_task()` 함수 통해 _백그라운드 작업_ 개체에 전달합니다.
 
 ```Python hl_lines="14"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 `.add_task()` 함수는 다음과 같은 인자를 받습니다 :
@@ -60,7 +60,7 @@ _경로 작동 함수_ 내에서 작업 함수를 `.add_task()` 함수 통해 _
 //// tab | Python 3.6 and above
 
 ```Python hl_lines="13  15  22  25"
-{!> ../../../docs_src/background_tasks/tutorial002.py!}
+{!> ../../docs_src/background_tasks/tutorial002.py!}
 ```
 
 ////
@@ -68,7 +68,7 @@ _경로 작동 함수_ 내에서 작업 함수를 `.add_task()` 함수 통해 _
 //// tab | Python 3.10 and above
 
 ```Python hl_lines="11  13  20  23"
-{!> ../../../docs_src/background_tasks/tutorial002_py310.py!}
+{!> ../../docs_src/background_tasks/tutorial002_py310.py!}
 ```
 
 ////
index b74722e2667750137c8530bd4eb54c2652166ec2..a13159c2713df21dd8ee60749e9389fabd704126 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 ///
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -87,7 +87,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="12-15"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="9-12"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
index 023575e1bbafd00a73214b870f5b66eba4cdac35..0a0f34585bcc9e833f8e3eeebb1ed22d34ba5b22 100644 (file)
@@ -11,7 +11,7 @@
 또한, 기본 값을 `None`으로 설정해 본문 매개변수를 선택사항으로 선언할 수 있습니다.
 
 ```Python hl_lines="19-21"
-{!../../../docs_src/body_multiple_params/tutorial001.py!}
+{!../../docs_src/body_multiple_params/tutorial001.py!}
 ```
 
 /// note | "참고"
@@ -36,7 +36,7 @@
 하지만, 다중 본문 매개변수 역시 선언할 수 있습니다. 예. `item`과 `user`:
 
 ```Python hl_lines="22"
-{!../../../docs_src/body_multiple_params/tutorial002.py!}
+{!../../docs_src/body_multiple_params/tutorial002.py!}
 ```
 
 이 경우에, **FastAPI**는 이 함수 안에 한 개 이상의 본문 매개변수(Pydantic 모델인 두 매개변수)가 있다고 알 것입니다.
@@ -80,7 +80,7 @@ FastAPI는 요청을 자동으로 변환해, 매개변수의 `item`과 `user`를
 
 
 ```Python hl_lines="23"
-{!../../../docs_src/body_multiple_params/tutorial003.py!}
+{!../../docs_src/body_multiple_params/tutorial003.py!}
 ```
 
 이 경우에는 **FastAPI**는 본문을 이와 같이 예측할 것입니다:
@@ -111,7 +111,7 @@ FastAPI는 요청을 자동으로 변환해, 매개변수의 `item`과 `user`를
 기본적으로 단일 값은 쿼리 매개변수로 해석되므로, 명시적으로 `Query`를 추가할 필요가 없고, 아래처럼 할 수 있습니다:
 
 ```Python hl_lines="27"
-{!../../../docs_src/body_multiple_params/tutorial004.py!}
+{!../../docs_src/body_multiple_params/tutorial004.py!}
 ```
 
 이렇게:
@@ -135,7 +135,7 @@ Pydantic 모델 `Item`의 `item`을 본문 매개변수로 오직 한개만 갖
 하지만, 만약 모델 내용에 `item `키를 가진 JSON으로 예측하길 원한다면, 추가적인 본문 매개변수를 선언한 것처럼 `Body`의 특별한 매개변수인 `embed`를 사용할 수 있습니다:
 
 ```Python hl_lines="17"
-{!../../../docs_src/body_multiple_params/tutorial005.py!}
+{!../../docs_src/body_multiple_params/tutorial005.py!}
 ```
 
 아래 처럼:
index 4d785f64b16a60111da9e932b3ccd124d5048b15..12fb4e0cc1a94e2410b9ea464682fad34a0f7228 100644 (file)
@@ -6,7 +6,7 @@
 어트리뷰트를 서브타입으로 정의할 수 있습니다. 예를 들어 파이썬 `list`는:
 
 ```Python hl_lines="14"
-{!../../../docs_src/body_nested_models/tutorial001.py!}
+{!../../docs_src/body_nested_models/tutorial001.py!}
 ```
 
 이는 `tags`를 항목 리스트로 만듭니다. 각 항목의 타입을 선언하지 않더라도요.
@@ -20,7 +20,7 @@
 먼저, 파이썬 표준 `typing` 모듈에서 `List`를 임포트합니다:
 
 ```Python hl_lines="1"
-{!../../../docs_src/body_nested_models/tutorial002.py!}
+{!../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ### 타입 매개변수로 `List` 선언
@@ -43,7 +43,7 @@ my_list: List[str]
 마찬가지로 예제에서 `tags`를 구체적으로 "문자열의 리스트"로 만들 수 있습니다:
 
 ```Python hl_lines="14"
-{!../../../docs_src/body_nested_models/tutorial002.py!}
+{!../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ## 집합 타입
@@ -55,7 +55,7 @@ my_list: List[str]
 그렇다면 `Set`을 임포트 하고 `tags`를 `str`의 `set`으로 선언할 수 있습니다:
 
 ```Python hl_lines="1  14"
-{!../../../docs_src/body_nested_models/tutorial003.py!}
+{!../../docs_src/body_nested_models/tutorial003.py!}
 ```
 
 덕분에 중복 데이터가 있는 요청을 수신하더라도 고유한 항목들의 집합으로 변환됩니다.
@@ -79,7 +79,7 @@ Pydantic 모델의 각 어트리뷰트는 타입을 갖습니다.
 예를 들어, `Image` 모델을 선언할 수 있습니다:
 
 ```Python hl_lines="9-11"
-{!../../../docs_src/body_nested_models/tutorial004.py!}
+{!../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ### 서브모듈을 타입으로 사용
@@ -87,7 +87,7 @@ Pydantic 모델의 각 어트리뷰트는 타입을 갖습니다.
 그리고 어트리뷰트의 타입으로 사용할 수 있습니다:
 
 ```Python hl_lines="20"
-{!../../../docs_src/body_nested_models/tutorial004.py!}
+{!../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 이는 **FastAPI**가 다음과 유사한 본문을 기대한다는 것을 의미합니다:
@@ -122,7 +122,7 @@ Pydantic 모델의 각 어트리뷰트는 타입을 갖습니다.
 예를 들어 `Image` 모델 안에 `url` 필드를 `str` 대신 Pydantic의 `HttpUrl`로 선언할 수 있습니다:
 
 ```Python hl_lines="4  10"
-{!../../../docs_src/body_nested_models/tutorial005.py!}
+{!../../docs_src/body_nested_models/tutorial005.py!}
 ```
 
 이 문자열이 유효한 URL인지 검사하고 JSON 스키마/OpenAPI로 문서화 됩니다.
@@ -132,7 +132,7 @@ Pydantic 모델의 각 어트리뷰트는 타입을 갖습니다.
 `list`, `set` 등의 서브타입으로 Pydantic 모델을 사용할 수도 있습니다:
 
 ```Python hl_lines="20"
-{!../../../docs_src/body_nested_models/tutorial006.py!}
+{!../../docs_src/body_nested_models/tutorial006.py!}
 ```
 
 아래와 같은 JSON 본문으로 예상(변환, 검증, 문서화 등을)합니다:
@@ -172,7 +172,7 @@ Pydantic 모델의 각 어트리뷰트는 타입을 갖습니다.
 단독으로 깊게 중첩된 모델을 정의할 수 있습니다:
 
 ```Python hl_lines="9  14  20  23  27"
-{!../../../docs_src/body_nested_models/tutorial007.py!}
+{!../../docs_src/body_nested_models/tutorial007.py!}
 ```
 
 /// info | "정보"
@@ -192,7 +192,7 @@ images: List[Image]
 이를 아래처럼:
 
 ```Python hl_lines="15"
-{!../../../docs_src/body_nested_models/tutorial008.py!}
+{!../../docs_src/body_nested_models/tutorial008.py!}
 ```
 
 ## 어디서나 편집기 지원
@@ -224,7 +224,7 @@ Pydantic 모델 대신에 `dict`를 직접 사용하여 작업할 경우, 이러
 이 경우, `float` 값을 가진 `int` 키가 있는 모든 `dict`를 받아들입니다:
 
 ```Python hl_lines="15"
-{!../../../docs_src/body_nested_models/tutorial009.py!}
+{!../../docs_src/body_nested_models/tutorial009.py!}
 ```
 
 /// tip | "팁"
index 337218eb4656f987f683983605de2db339c7fa16..8df8d556e9d0dc27eacc95fdb688532fdbde40ca 100644 (file)
@@ -25,7 +25,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -33,7 +33,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="5-9"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -55,7 +55,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="7-11"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -89,7 +89,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/body/tutorial002_py310.py!}
+{!> ../../docs_src/body/tutorial002_py310.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/body/tutorial002.py!}
+{!> ../../docs_src/body/tutorial002.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="15-16"
-{!> ../../../docs_src/body/tutorial003_py310.py!}
+{!> ../../docs_src/body/tutorial003_py310.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/body/tutorial003.py!}
+{!> ../../docs_src/body/tutorial003.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial004_py310.py!}
+{!> ../../docs_src/body/tutorial004_py310.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial004.py!}
+{!> ../../docs_src/body/tutorial004.py!}
 ```
 
 ////
index 5f129b63fc73b8c7389f29f81e8f08556f4b094e..1e21e069da765c6760901f28cb2afbdb98647ec6 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
@@ -67,7 +67,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
index 312fdee1ba154a644ae60092f82cb0fc621402a0..65357ae3f664ea52254b482a44e3295ba12701e3 100644 (file)
@@ -47,7 +47,7 @@
 * 특정한 HTTP 헤더 또는 와일드카드 `"*"` 를 사용한 모든 HTTP 헤더.
 
 ```Python hl_lines="2  6-11  13-19"
-{!../../../docs_src/cors/tutorial001.py!}
+{!../../docs_src/cors/tutorial001.py!}
 ```
 
 `CORSMiddleware` 에서 사용하는 기본 매개변수는 제한적이므로, 브라우저가 교차-도메인 상황에서 특정한 출처, 메소드, 헤더 등을 사용할 수 있도록 하려면 이들을 명시적으로 허용해야 합니다.
index cb45e516922eda1b0e284810505004d827cbd5b1..27e8f9abff638a9534f1fb55627b54dee8241803 100644 (file)
@@ -7,7 +7,7 @@
 FastAPI 애플리케이션에서 `uvicorn`을 직접 임포트하여 실행합니다
 
 ```Python hl_lines="1  15"
-{!../../../docs_src/debugging/tutorial001.py!}
+{!../../docs_src/debugging/tutorial001.py!}
 ```
 
 ### `__name__ == "__main__"` 에 대하여
index 259fe4b6d6c855bed1742c7e089f7e60e953a0fc..7430efbb4e7bb015656254863cab9a0b410b109d 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | 파이썬 3.6 이상
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
 //// tab | 파이썬 3.6 이상
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -92,7 +92,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="9-13"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -102,7 +102,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
 //// tab | 파이썬 3.6 이상
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -110,7 +110,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -120,7 +120,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
 //// tab | 파이썬 3.6 이상
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -128,7 +128,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -150,7 +150,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
 //// tab | 파이썬 3.6 이상
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -158,7 +158,7 @@ FastAPI가 실질적으로 확인하는 것은 "호출 가능성"(함수, 클래
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -203,7 +203,7 @@ commons = Depends(CommonQueryParams)
 //// tab | 파이썬 3.6 이상
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003.py!}
+{!> ../../docs_src/dependencies/tutorial003.py!}
 ```
 
 ////
@@ -211,7 +211,7 @@ commons = Depends(CommonQueryParams)
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial003_py310.py!}
+{!> ../../docs_src/dependencies/tutorial003_py310.py!}
 ```
 
 ////
@@ -251,7 +251,7 @@ commons: CommonQueryParams = Depends()
 //// tab | 파이썬 3.6 이상
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004.py!}
+{!> ../../docs_src/dependencies/tutorial004.py!}
 ```
 
 ////
@@ -259,7 +259,7 @@ commons: CommonQueryParams = Depends()
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial004_py310.py!}
+{!> ../../docs_src/dependencies/tutorial004_py310.py!}
 ```
 
 ////
index bc8af488da6a4594f5def5d84ac2e94a6c2fc87b..e71ba8546d8fd6088e9c99c5e6230c716455562c 100644 (file)
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="7  12"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@
 ///
 
 ```Python hl_lines="6  11"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  14"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="9  14"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
index 2ce2cf4f2524e57472d885cde4f6d6d8d8ace987..dd6586c3edf769645cc6523d26ec2293c8f289a3 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial012_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial012_an_py39.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial012_an.py!}
+{!> ../../docs_src/dependencies/tutorial012_an.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/dependencies/tutorial012.py!}
+{!> ../../docs_src/dependencies/tutorial012.py!}
 ```
 
 ////
index 361989e2bfb653f712553e6f5fa7052693dbbf56..f7b2f1788934d244cbae60111bd2f776c2fe6d5e 100644 (file)
@@ -34,7 +34,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -42,7 +42,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -50,7 +50,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-12"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -64,7 +64,7 @@
 ///
 
 ```Python hl_lines="6-7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -78,7 +78,7 @@
 ///
 
 ```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -124,7 +124,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -132,7 +132,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -146,7 +146,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -160,7 +160,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
 //// tab | Python 3.10+
 
 ```Python hl_lines="13  18"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
 //// tab | Python 3.9+
 
 ```Python hl_lines="15  20"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -188,7 +188,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
 //// tab | Python 3.8+
 
 ```Python hl_lines="16  21"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -202,7 +202,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
 ///
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -216,7 +216,7 @@ FastAPI는 0.95.0 버전부터 `Annotated`에 대한 지원을 (그리고 이를
 ///
 
 ```Python hl_lines="15  20"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -279,7 +279,7 @@ commons: Annotated[dict, Depends(common_parameters)]
 //// tab | Python 3.10+
 
 ```Python hl_lines="12  16  21"
-{!> ../../../docs_src/dependencies/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an_py310.py!}
 ```
 
 ////
@@ -287,7 +287,7 @@ commons: Annotated[dict, Depends(common_parameters)]
 //// tab | Python 3.9+
 
 ```Python hl_lines="14  18  23"
-{!> ../../../docs_src/dependencies/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an_py39.py!}
 ```
 
 ////
@@ -295,7 +295,7 @@ commons: Annotated[dict, Depends(common_parameters)]
 //// tab | Python 3.8+
 
 ```Python hl_lines="15  19  24"
-{!> ../../../docs_src/dependencies/tutorial001_02_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an.py!}
 ```
 
 ////
index b8e87449c1ee5a2d653b2d6ec6dcae7177dde0c0..732566d6dc3db1fd0e2832d0764a000d330a8b5d 100644 (file)
@@ -21,7 +21,7 @@ JSON 호환 가능 데이터만 수신하는 `fake_db` 데이터베이스가 존
 Pydantic 모델과 같은 객체를 받고 JSON 호환 가능한 버전으로 반환합니다:
 
 ```Python hl_lines="5  22"
-{!../../../docs_src/encoder/tutorial001.py!}
+{!../../docs_src/encoder/tutorial001.py!}
 ```
 
 이 예시는 Pydantic 모델을 `dict`로, `datetime` 형식을 `str`로 변환합니다.
index df3c7a06e71d50b5290d02c5077c95a359680ffb..8baaa64fc3199aac2b8bb3797e2fd06f07d14037 100644 (file)
@@ -58,7 +58,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  3  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -66,7 +66,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  3  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  3  13-17"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
 ```
 
 ////
@@ -88,7 +88,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1  2  11-15"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
@@ -102,7 +102,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1  2  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
@@ -112,7 +112,7 @@ Prefer to use the `Annotated` version if possible.
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -120,7 +120,7 @@ Prefer to use the `Annotated` version if possible.
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -128,7 +128,7 @@ Prefer to use the `Annotated` version if possible.
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-20"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
 ```
 
 ////
@@ -142,7 +142,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
@@ -156,7 +156,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
index 52e53fd89b554b726b8ae7bc6bf04df8340fb3f2..c2c48fb3edc334c5c516e9f2fc4789b9ee3ae26c 100644 (file)
@@ -3,7 +3,7 @@
 가장 단순한 FastAPI 파일은 다음과 같이 보일 것입니다:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 위 코드를 `main.py`에 복사합니다.
@@ -134,7 +134,7 @@ API와 통신하는 클라이언트(프론트엔드, 모바일, IoT 애플리케
 ### 1 단계: `FastAPI` 임포트
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI`는 당신의 API를 위한 모든 기능을 제공하는 파이썬 클래스입니다.
@@ -150,7 +150,7 @@ API와 통신하는 클라이언트(프론트엔드, 모바일, IoT 애플리케
 ### 2 단계: `FastAPI` "인스턴스" 생성
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 여기에서 `app` 변수는 `FastAPI` 클래스의 "인스턴스"가 됩니다.
@@ -172,7 +172,7 @@ $ uvicorn main:app --reload
 아래처럼 앱을 만든다면:
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
 ```
 
 이를 `main.py` 파일에 넣고, `uvicorn`을 아래처럼 호출해야 합니다:
@@ -251,7 +251,7 @@ API를 설계할 때 일반적으로 특정 행동을 수행하기 위해 특정
 #### *경로 작동 데코레이터* 정의
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `@app.get("/")`은 **FastAPI**에게 바로 아래에 있는 함수가 다음으로 이동하는 요청을 처리한다는 것을 알려줍니다.
@@ -307,7 +307,7 @@ API를 설계할 때 일반적으로 특정 행동을 수행하기 위해 특정
 * **함수**: 는 "데코레이터" 아래에 있는 함수입니다 (`@app.get("/")` 아래).
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 이것은 파이썬 함수입니다.
@@ -321,7 +321,7 @@ URL "`/`"에 대한 `GET` 작동을 사용하는 요청을 받을 때마다 **Fa
 `async def`을 이용하는 대신 일반 함수로 정의할 수 있습니다:
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note | "참고"
@@ -333,7 +333,7 @@ URL "`/`"에 대한 `GET` 작동을 사용하는 요청을 받을 때마다 **Fa
 ### 5 단계: 콘텐츠 반환
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `dict`, `list`, 단일값을 가진 `str`, `int` 등을 반환할 수 있습니다.
index d403b9175162ef7744a1b45c44171babe47c0c07..26e19886934434598589467ee216f0d77742f217 100644 (file)
@@ -7,7 +7,7 @@
 먼저 `Header`를 임포트합니다:
 
 ```Python hl_lines="3"
-{!../../../docs_src/header_params/tutorial001.py!}
+{!../../docs_src/header_params/tutorial001.py!}
 ```
 
 ## `Header` 매개변수 선언
@@ -17,7 +17,7 @@
 첫 번째 값은 기본값이며, 추가 검증이나 어노테이션 매개변수 모두 전달할 수 있습니다:
 
 ```Python hl_lines="9"
-{!../../../docs_src/header_params/tutorial001.py!}
+{!../../docs_src/header_params/tutorial001.py!}
 ```
 
 /// note | "기술 세부사항"
@@ -51,7 +51,7 @@
 만약 언더스코어를 하이픈으로 자동 변환을 비활성화해야 할 어떤 이유가 있다면, `Header`의 `convert_underscores` 매개변수를 `False`로 설정하십시오:
 
 ```Python hl_lines="10"
-{!../../../docs_src/header_params/tutorial002.py!}
+{!../../docs_src/header_params/tutorial002.py!}
 ```
 
 /// warning | "경고"
@@ -71,7 +71,7 @@
 예를 들어, 두 번 이상 나타날 수 있는 `X-Token`헤더를 선언하려면, 다음과 같이 작성합니다:
 
 ```Python hl_lines="9"
-{!../../../docs_src/header_params/tutorial003.py!}
+{!../../docs_src/header_params/tutorial003.py!}
 ```
 
 다음과 같은 두 개의 HTTP 헤더를 전송하여 해당 *경로* 와 통신할 경우:
index 84f67bd26fc637e09ffb6ce1a7b33880d9adf988..f36f11a2736052e8490c0c149781eb3041ed21f5 100644 (file)
@@ -32,7 +32,7 @@
 * `response`를 반환하기 전에 추가로 `response`를 수정할 수 있습니다.
 
 ```Python hl_lines="8-9  11  14"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 /// tip | "팁"
@@ -60,7 +60,7 @@
 예를 들어, 요청을 수행하고 응답을 생성하는데 까지 걸린 시간 값을 가지고 있는 `X-Process-Time` 같은 사용자 정의 헤더를 추가할 수 있습니다.
 
 ```Python hl_lines="10  12-13"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 ## 다른 미들웨어
index b6608a14d6a27665eb1e0770312819ee6bf52032..6ebe613a80dbcf9b18c7bd7620859ef232d45488 100644 (file)
@@ -17,7 +17,7 @@
 하지만 각 코드의 의미를 모른다면, `status`에 있는 단축 상수들을 사용할수 있습니다:
 
 ```Python hl_lines="3  17"
-{!../../../docs_src/path_operation_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_configuration/tutorial001.py!}
 ```
 
 각 상태 코드들은 응답에 사용되며, OpenAPI 스키마에 추가됩니다.
@@ -35,7 +35,7 @@
 (보통 단일 `str`인) `str`로 구성된 `list`와 함께 매개변수 `tags`를 전달하여, `경로 작동`에 태그를 추가할 수 있습니다:
 
 ```Python hl_lines="17  22  27"
-{!../../../docs_src/path_operation_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_configuration/tutorial002.py!}
 ```
 
 전달된 태그들은 OpenAPI의 스키마에 추가되며, 자동 문서 인터페이스에서 사용됩니다:
@@ -47,7 +47,7 @@
 `summary`와 `description`을 추가할 수 있습니다:
 
 ```Python hl_lines="20-21"
-{!../../../docs_src/path_operation_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_configuration/tutorial003.py!}
 ```
 
 ## 독스트링으로 만든 기술
@@ -57,7 +57,7 @@
 <a href="https://ko.wikipedia.org/wiki/%EB%A7%88%ED%81%AC%EB%8B%A4%EC%9A%B4" class="external-link" target="_blank">마크다운</a> 문법으로 독스트링을 작성할 수 있습니다, 작성된 마크다운 형식의 독스트링은 (마크다운의 들여쓰기를 고려하여) 올바르게 화면에 출력됩니다.
 
 ```Python hl_lines="19-27"
-{!../../../docs_src/path_operation_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_configuration/tutorial004.py!}
 ```
 
 이는 대화형 문서에서 사용됩니다:
@@ -69,7 +69,7 @@
 `response_description` 매개변수로 응답에 관한 설명을 명시할 수 있습니다:
 
 ```Python hl_lines="21"
-{!../../../docs_src/path_operation_configuration/tutorial005.py!}
+{!../../docs_src/path_operation_configuration/tutorial005.py!}
 ```
 
 /// info | "정보"
@@ -93,7 +93,7 @@ OpenAPI는 각 *경로 작동*이 응답에 관한 설명을 요구할 것을 
 단일 *경로 작동*을 없애지 않고 <abbr title="구식, 사용하지 않는것이 권장됨">지원중단</abbr>을 해야한다면, `deprecated` 매개변수를 전달하면 됩니다.
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_operation_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_configuration/tutorial006.py!}
 ```
 
 대화형 문서에 지원중단이라고 표시됩니다.
index 6d3215c2450a455042f79e25be541097ba2dd313..caab2d453aa416f5a2a7b4766ba63793c99216f8 100644 (file)
@@ -7,7 +7,7 @@
 먼저 `fastapi`에서 `Path`를 임포트합니다:
 
 ```Python hl_lines="3"
-{!../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ## 메타데이터 선언
@@ -17,7 +17,7 @@
 예를 들어, `title` 메타데이터 값을 경로 매개변수 `item_id`에 선언하려면 다음과 같이 입력할 수 있습니다:
 
 ```Python hl_lines="10"
-{!../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 /// note | "참고"
@@ -47,7 +47,7 @@
 따라서 함수를 다음과 같이 선언 할 수 있습니다:
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial002.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial002.py!}
 ```
 
 ## 필요한 경우 매개변수 정렬하기, 트릭
@@ -59,7 +59,7 @@
 파이썬은 `*`으로 아무런 행동도 하지 않지만, 따르는 매개변수들은 <abbr title="유래: K-ey W-ord Arg-uments"><code>kwargs</code></abbr>로도 알려진 키워드 인자(키-값 쌍)여야 함을 인지합니다. 기본값을 가지고 있지 않더라도 그렇습니다.
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
 ```
 
 ## 숫자 검증: 크거나 같음
@@ -69,7 +69,7 @@
 여기서 `ge=1`인 경우, `item_id`는 `1`보다 "크거나(`g`reater) 같은(`e`qual)" 정수형 숫자여야 합니다.
 
 ```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial004.py!}
 ```
 
 ## 숫자 검증: 크거나 같음 및 작거나 같음
@@ -80,7 +80,7 @@
 * `le`: 작거나 같은(`l`ess than or `e`qual)
 
 ```Python hl_lines="9"
-{!../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial005.py!}
 ```
 
 ## 숫자 검증: 부동소수, 크거나 및 작거나
@@ -94,7 +94,7 @@
 <abbr title="less than"><code>lt</code></abbr> 역시 마찬가지입니다.
 
 ```Python hl_lines="11"
-{!../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial006.py!}
 ```
 
 ## 요약
index 67a2d899d4cd7b39d192d894bdc07ba75a2bfe8c..09a27a7b3a422a7c5cc88fa39d7be3de26fb86d9 100644 (file)
@@ -3,7 +3,7 @@
 파이썬의 포맷 문자열 리터럴에서 사용되는 문법을 이용하여 경로 "매개변수" 또는 "변수"를 선언할 수 있습니다:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
 ```
 
 경로 매개변수 `item_id`의 값은 함수의 `item_id` 인자로 전달됩니다.
@@ -19,7 +19,7 @@
 파이썬 표준 타입 어노테이션을 사용하여 함수에 있는 경로 매개변수의 타입을 선언할 수 있습니다:
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
 ```
 
 위의 예시에서, `item_id`는 `int`로 선언되었습니다.
 *경로 작동*은 순차적으로 실행되기 때문에 `/users/{user_id}` 이전에 `/users/me`를 먼저 선언해야 합니다:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
 ```
 
 그렇지 않으면 `/users/{user_id}`는 `/users/me` 요청 또한 매개변수 `user_id`의 값이 `"me"`인 것으로 "생각하게" 됩니다.
 가능한 값들에 해당하는 고정된 값의 클래스 어트리뷰트들을 만듭니다:
 
 ```Python hl_lines="1  6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// info | "정보"
 생성한 열거형 클래스(`ModelName`)를 사용하는 타입 어노테이션으로 *경로 매개변수*를 만듭니다:
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 ### 문서 확인
 열거형 `ModelName`의 *열거형 멤버*를 비교할 수 있습니다:
 
 ```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 #### *열거형 값* 가져오기
 `model_name.value` 또는 일반적으로 `your_enum_member.value`를 이용하여 실제 값(위 예시의 경우 `str`)을 가져올 수 있습니다:
 
 ```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// tip | "팁"
 클라이언트에 반환하기 전에 해당 값(이 경우 문자열)으로 변환됩니다:
 
 ```Python hl_lines="18  21  23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 클라이언트는 아래의 JSON 응답을 얻습니다:
@@ -243,7 +243,7 @@ Starlette의 옵션을 직접 이용하여 다음과 같은 URL을 사용함으
 따라서 다음과 같이 사용할 수 있습니다:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
 ```
 
 /// tip | "팁"
index 11193950b2033479b04b4bb7ac8a9b39c778a9d0..e44f6dd16c705652adda3682a42a0d4d64c2a47b 100644 (file)
@@ -5,7 +5,7 @@
 이 응용 프로그램을 예로 들어보겠습니다:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!../../docs_src/query_params_str_validations/tutorial001.py!}
 ```
 
 쿼리 매개변수 `q`는 `Optional[str]` 자료형입니다. 즉, `str` 자료형이지만 `None` 역시 될 수 있음을 뜻하고, 실제로 기본값은 `None`이기 때문에 FastAPI는 이 매개변수가 필수가 아니라는 것을 압니다.
@@ -27,7 +27,7 @@ FastAPI는 `q`의 기본값이 `= None`이기 때문에 필수가 아님을 압
 이를 위해 먼저 `fastapi`에서 `Query`를 임포트합니다:
 
 ```Python hl_lines="3"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 ## 기본값으로 `Query` 사용
@@ -35,7 +35,7 @@ FastAPI는 `q`의 기본값이 `= None`이기 때문에 필수가 아님을 압
 이제 `Query`를 매개변수의 기본값으로 사용하여 `max_length` 매개변수를 50으로 설정합니다:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 기본값 `None`을 `Query(None)`으로 바꿔야 하므로, `Query`의 첫 번째 매개변수는 기본값을 정의하는 것과 같은 목적으로 사용됩니다.
@@ -87,7 +87,7 @@ q: str = Query(None, max_length=50)
 매개변수 `min_length` 또한 추가할 수 있습니다:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!../../docs_src/query_params_str_validations/tutorial003.py!}
 ```
 
 ## 정규식 추가
@@ -95,7 +95,7 @@ q: str = Query(None, max_length=50)
 매개변수와 일치해야 하는 <abbr title="정규표현식(regular expression), regex 또는 regexp는 문자열 조회 패턴을 정의하는 문자들의 순열입니다">정규표현식</abbr>을 정의할 수 있습니다:
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!../../docs_src/query_params_str_validations/tutorial004.py!}
 ```
 
 이 특정 정규표현식은 전달 받은 매개변수 값을 검사합니다:
@@ -115,7 +115,7 @@ q: str = Query(None, max_length=50)
 `min_length`가 `3`이고, 기본값이 `"fixedquery"`인 쿼리 매개변수 `q`를 선언해봅시다:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!../../docs_src/query_params_str_validations/tutorial005.py!}
 ```
 
 /// note | "참고"
@@ -147,7 +147,7 @@ q: Optional[str] = Query(None, min_length=3)
 그래서 `Query`를 필수값으로 만들어야 할 때면, 첫 번째 인자로 `...`를 사용할 수 있습니다:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!../../docs_src/query_params_str_validations/tutorial006.py!}
 ```
 
 /// info | "정보"
@@ -165,7 +165,7 @@ q: Optional[str] = Query(None, min_length=3)
 예를 들어, URL에서 여러번 나오는  `q` 쿼리 매개변수를 선언하려면 다음과 같이 작성할 수 있습니다:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!../../docs_src/query_params_str_validations/tutorial011.py!}
 ```
 
 아래와 같은 URL을 사용합니다:
@@ -202,7 +202,7 @@ http://localhost:8000/items/?q=foo&q=bar
 그리고 제공된 값이 없으면 기본 `list` 값을 정의할 수도 있습니다:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!../../docs_src/query_params_str_validations/tutorial012.py!}
 ```
 
 아래로 이동한다면:
@@ -227,7 +227,7 @@ http://localhost:8000/items/
 `List[str]` 대신 `list`를 직접 사용할 수도 있습니다:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!../../docs_src/query_params_str_validations/tutorial013.py!}
 ```
 
 /// note | "참고"
@@ -255,13 +255,13 @@ http://localhost:8000/items/
 `title`을 추가할 수 있습니다:
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!../../docs_src/query_params_str_validations/tutorial007.py!}
 ```
 
 그리고 `description`도 추가할 수 있습니다:
 
 ```Python hl_lines="13"
-{!../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!../../docs_src/query_params_str_validations/tutorial008.py!}
 ```
 
 ## 별칭 매개변수
@@ -283,7 +283,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 이럴 경우 `alias`를 선언할 수 있으며, 해당 별칭은 매개변수 값을 찾는 데 사용됩니다:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!../../docs_src/query_params_str_validations/tutorial009.py!}
 ```
 
 ## 매개변수 사용하지 않게 하기
@@ -295,7 +295,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 그렇다면 `deprecated=True` 매개변수를 `Query`로 전달합니다:
 
 ```Python hl_lines="18"
-{!../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!../../docs_src/query_params_str_validations/tutorial010.py!}
 ```
 
 문서가 아래와 같이 보일겁니다:
index e71444c188a0b28614040ee8440d9c6299acb2a0..b2a946c092514e5f9acfd22ec225c5ffc13b69c8 100644 (file)
@@ -3,7 +3,7 @@
 경로 매개변수의 일부가 아닌 다른 함수 매개변수를 선언하면 "쿼리" 매개변수로 자동 해석합니다.
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
 ```
 
 쿼리는 URL에서 `?` 후에 나오고 `&`으로 구분되는 키-값 쌍의 집합입니다.
@@ -64,7 +64,7 @@ http://127.0.0.1:8000/items/?skip=20
 같은 방법으로 기본값을 `None`으로 설정하여 선택적 매개변수를 선언할 수 있습니다:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial002.py!}
+{!../../docs_src/query_params/tutorial002.py!}
 ```
 
 이 경우 함수 매개변수 `q`는 선택적이며 기본값으로 `None` 값이 됩니다.
@@ -88,7 +88,7 @@ FastAPI는 `q`가 `= None`이므로 선택적이라는 것을 인지합니다.
 `bool` 형으로 선언할 수도 있고, 아래처럼 변환됩니다:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial003.py!}
+{!../../docs_src/query_params/tutorial003.py!}
 ```
 
 이 경우, 아래로 이동하면:
@@ -133,7 +133,7 @@ http://127.0.0.1:8000/items/foo?short=yes
 매개변수들은 이름으로 감지됩니다:
 
 ```Python hl_lines="8  10"
-{!../../../docs_src/query_params/tutorial004.py!}
+{!../../docs_src/query_params/tutorial004.py!}
 ```
 
 ## 필수 쿼리 매개변수
@@ -145,7 +145,7 @@ http://127.0.0.1:8000/items/foo?short=yes
 그러나 쿼리 매개변수를 필수로 만들려면 단순히 기본값을 선언하지 않으면 됩니다:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
 ```
 
 여기 쿼리 매개변수 `needy`는 `str`형인 필수 쿼리 매개변수입니다.
@@ -191,7 +191,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
 그리고 물론, 일부 매개변수는 필수로, 다른 일부는 기본값을, 또 다른 일부는 선택적으로 선언할 수 있습니다:
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params/tutorial006.py!}
+{!../../docs_src/query_params/tutorial006.py!}
 ```
 
 위 예시에서는 3가지 쿼리 매개변수가 있습니다:
index b7781ef5eac3ee3f47023de5c913ad281bae0a2f..40579dd51a5bd1dbf450ff30fd05e7f2ba26bb44 100644 (file)
@@ -17,7 +17,7 @@
 `fastapi` 에서 `File` 과 `UploadFile` 을 임포트 합니다:
 
 ```Python hl_lines="1"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
 ```
 
 ## `File` 매개변수 정의
@@ -25,7 +25,7 @@
 `Body` 및 `Form` 과 동일한 방식으로 파일의 매개변수를 생성합니다:
 
 ```Python hl_lines="7"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
 ```
 
 /// info | "정보"
@@ -55,7 +55,7 @@ File의 본문을 선언할 때, 매개변수가 쿼리 매개변수 또는 본
 `File` 매개변수를 `UploadFile` 타입으로 정의합니다:
 
 ```Python hl_lines="12"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
 ```
 
 `UploadFile` 을 사용하는 것은 `bytes` 과 비교해 다음과 같은 장점이 있습니다:
@@ -143,7 +143,7 @@ HTML의 폼들(`<form></form>`)이 서버에 데이터를 전송하는 방식은
 이 기능을 사용하기 위해 , `bytes` 의 `List` 또는 `UploadFile` 를 선언하기 바랍니다:
 
 ```Python hl_lines="10  15"
-{!../../../docs_src/request_files/tutorial002.py!}
+{!../../docs_src/request_files/tutorial002.py!}
 ```
 
 선언한대로, `bytes` 의 `list` 또는 `UploadFile` 들을 전송받을 것입니다.
index 0867414eae24ef4e46e86c117611db28f61fede8..24501fe34f06c109bdad37bc6f2530a99603620c 100644 (file)
@@ -13,7 +13,7 @@
 ## `File` 및 `Form` 업로드
 
 ```Python hl_lines="1"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 ## `File` 및 `Form` 매개변수 정의
@@ -21,7 +21,7 @@
 `Body` 및 `Query`와 동일한 방식으로 파일과 폼의 매개변수를 생성합니다:
 
 ```Python hl_lines="8"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 파일과 폼 필드는 폼 데이터 형식으로 업로드되어 파일과 폼 필드로 전달됩니다.
index fc74a60b3b39f3751896c3260a4af5f05094f001..74034e34de2a777690ac599d49f1753f06646dec 100644 (file)
@@ -9,7 +9,7 @@
 * 기타.
 
 ```Python hl_lines="17"
-{!../../../docs_src/response_model/tutorial001.py!}
+{!../../docs_src/response_model/tutorial001.py!}
 ```
 
 /// note | "참고"
@@ -42,13 +42,13 @@ FastAPI는 이 `response_model`를 사용하여:
 여기서 우리는 평문 비밀번호를 포함하는 `UserIn` 모델을 선언합니다:
 
 ```Python hl_lines="9  11"
-{!../../../docs_src/response_model/tutorial002.py!}
+{!../../docs_src/response_model/tutorial002.py!}
 ```
 
 그리고 이 모델을 사용하여 입력을 선언하고 같은 모델로 출력을 선언합니다:
 
 ```Python hl_lines="17-18"
-{!../../../docs_src/response_model/tutorial002.py!}
+{!../../docs_src/response_model/tutorial002.py!}
 ```
 
 이제 브라우저가 비밀번호로 사용자를 만들 때마다 API는 응답으로 동일한 비밀번호를 반환합니다.
@@ -68,19 +68,19 @@ FastAPI는 이 `response_model`를 사용하여:
 대신 평문 비밀번호로 입력 모델을 만들고 해당 비밀번호 없이 출력 모델을 만들 수 있습니다:
 
 ```Python hl_lines="9  11  16"
-{!../../../docs_src/response_model/tutorial003.py!}
+{!../../docs_src/response_model/tutorial003.py!}
 ```
 
 여기서 *경로 작동 함수*가 비밀번호를 포함하는 동일한 입력 사용자를 반환할지라도:
 
 ```Python hl_lines="24"
-{!../../../docs_src/response_model/tutorial003.py!}
+{!../../docs_src/response_model/tutorial003.py!}
 ```
 
 ...`response_model`을 `UserOut` 모델로 선언했기 때문에 비밀번호를 포함하지 않습니다:
 
 ```Python hl_lines="22"
-{!../../../docs_src/response_model/tutorial003.py!}
+{!../../docs_src/response_model/tutorial003.py!}
 ```
 
 따라서 **FastAPI**는 출력 모델에서 선언하지 않은 모든 데이터를 (Pydantic을 사용하여) 필터링합니다.
@@ -100,7 +100,7 @@ FastAPI는 이 `response_model`를 사용하여:
 응답 모델은 아래와 같이 기본값을 가질 수 있습니다:
 
 ```Python hl_lines="11  13-14"
-{!../../../docs_src/response_model/tutorial004.py!}
+{!../../docs_src/response_model/tutorial004.py!}
 ```
 
 * `description: Optional[str] = None`은 기본값으로 `None`을 갖습니다.
@@ -116,7 +116,7 @@ FastAPI는 이 `response_model`를 사용하여:
 *경로 작동 데코레이터* 매개변수를 `response_model_exclude_unset=True`로 설정 할 수 있습니다:
 
 ```Python hl_lines="24"
-{!../../../docs_src/response_model/tutorial004.py!}
+{!../../docs_src/response_model/tutorial004.py!}
 ```
 
 이러한 기본값은 응답에 포함되지 않고 실제로 설정된 값만 포함됩니다.
@@ -208,7 +208,7 @@ Pydantic 모델이 하나만 있고 출력에서 ​​일부 데이터를 제
 ///
 
 ```Python hl_lines="31  37"
-{!../../../docs_src/response_model/tutorial005.py!}
+{!../../docs_src/response_model/tutorial005.py!}
 ```
 
 /// tip | "팁"
@@ -224,7 +224,7 @@ Pydantic 모델이 하나만 있고 출력에서 ​​일부 데이터를 제
 `list` 또는 `tuple` 대신 `set`을 사용하는 법을 잊었더라도, FastAPI는 `set`으로 변환하고 정상적으로 작동합니다:
 
 ```Python hl_lines="31  37"
-{!../../../docs_src/response_model/tutorial006.py!}
+{!../../docs_src/response_model/tutorial006.py!}
 ```
 
 ## 요약
index 48cb49cbfe52730f3b967846e716bf245b805780..57eef6ba170b2d639ec60354103aaecef9acd9c8 100644 (file)
@@ -9,7 +9,7 @@
 * 기타
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 /// note | "참고"
@@ -77,7 +77,7 @@ HTTP는 세자리의 숫자 상태 코드를 응답의 일부로 전송합니다
 상기 예시 참고:
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 `201` 은 "생성됨"를 의미하는 상태 코드입니다.
@@ -87,7 +87,7 @@ HTTP는 세자리의 숫자 상태 코드를 응답의 일부로 전송합니다
 `fastapi.status` 의 편의 변수를 사용할 수 있습니다.
 
 ```Python hl_lines="1  6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
 ```
 
 이것은 단순히 작업을 편리하게 하기 위한 것으로, HTTP 상태 코드와 동일한 번호를 갖고있지만, 이를 사용하면 편집기의 자동완성 기능을 사용할 수 있습니다:
index 7b5ccdd324aa3bfc9a326fb04253a045795ea4d2..71052b334889168f835d09ad263d09b8be8fe4bd 100644 (file)
@@ -11,7 +11,7 @@
 //// tab | Python 3.10+ Pydantic v2
 
 ```Python hl_lines="13-24"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@
 //// tab | Python 3.10+ Pydantic v1
 
 ```Python hl_lines="13-23"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310_pv1.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310_pv1.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@
 //// tab | Python 3.8+ Pydantic v2
 
 ```Python hl_lines="15-26"
-{!> ../../../docs_src/schema_extra_example/tutorial001.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@
 //// tab | Python 3.8+ Pydantic v1
 
 ```Python hl_lines="15-25"
-{!> ../../../docs_src/schema_extra_example/tutorial001_pv1.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_pv1.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 //// tab | Python 3.10+
 
 ```Python hl_lines="2  8-11"
-{!> ../../../docs_src/schema_extra_example/tutorial002_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002_py310.py!}
 ```
 
 ////
@@ -91,7 +91,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  10-13"
-{!> ../../../docs_src/schema_extra_example/tutorial002.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 //// tab | Python 3.10+
 
 ```Python hl_lines="22-29"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -125,7 +125,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 //// tab | Python 3.9+
 
 ```Python hl_lines="22-29"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -133,7 +133,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 //// tab | Python 3.8+
 
 ```Python hl_lines="23-30"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 ///
 
 ```Python hl_lines="18-25"
-{!> ../../../docs_src/schema_extra_example/tutorial003_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_py310.py!}
 ```
 
 ////
@@ -161,7 +161,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 ///
 
 ```Python hl_lines="20-27"
-{!> ../../../docs_src/schema_extra_example/tutorial003.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 //// tab | Python 3.10+
 
 ```Python hl_lines="23-38"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -187,7 +187,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 //// tab | Python 3.9+
 
 ```Python hl_lines="23-38"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -195,7 +195,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 //// tab | Python 3.8+
 
 ```Python hl_lines="24-39"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an.py!}
 ```
 
 ////
@@ -209,7 +209,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 ///
 
 ```Python hl_lines="19-34"
-{!> ../../../docs_src/schema_extra_example/tutorial004_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_py310.py!}
 ```
 
 ////
@@ -223,7 +223,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 ///
 
 ```Python hl_lines="21-36"
-{!> ../../../docs_src/schema_extra_example/tutorial004.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004.py!}
 ```
 
 ////
@@ -270,7 +270,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 //// tab | Python 3.10+
 
 ```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -278,7 +278,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 //// tab | Python 3.9+
 
 ```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -286,7 +286,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 //// tab | Python 3.8+
 
 ```Python hl_lines="24-50"
-{!> ../../../docs_src/schema_extra_example/tutorial005_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_an.py!}
 ```
 
 ////
@@ -300,7 +300,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 ///
 
 ```Python hl_lines="19-45"
-{!> ../../../docs_src/schema_extra_example/tutorial005_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005_py310.py!}
 ```
 
 ////
@@ -314,7 +314,7 @@ Pydantic 모델과 같이 `Field()`를 사용할 때 추가적인 `examples`를
 ///
 
 ```Python hl_lines="21-47"
-{!> ../../../docs_src/schema_extra_example/tutorial005.py!}
+{!> ../../docs_src/schema_extra_example/tutorial005.py!}
 ```
 
 ////
index 9bf3d4ee1b313f0b86ee55804c8859bb059fb994..56f5792a74d7b0801a1e17e3aeacdd963795f3ba 100644 (file)
@@ -3,7 +3,7 @@
 이전 장에서 (의존성 주입 시스템을 기반으로 한)보안 시스템은 *경로 작동 함수*에서 `str`로 `token`을 제공했습니다:
 
 ```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 그러나 아직도 유용하지 않습니다.
@@ -19,7 +19,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
 //// tab | 파이썬 3.7 이상
 
 ```Python hl_lines="5  12-16"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="3  10-14"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
 //// tab | 파이썬 3.7 이상
 
 ```Python hl_lines="25"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -65,7 +65,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
 //// tab | 파이썬 3.7 이상
 
 ```Python hl_lines="19-22  26-27"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="17-20  24-25"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -85,7 +85,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
 //// tab | 파이썬 3.7 이상
 
 ```Python hl_lines="31"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@ Pydantic을 사용하여 본문을 선언하는 것과 같은 방식으로 다
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="29"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
@@ -153,7 +153,7 @@ Pydantic 모델인 `User`로 `current_user`의 타입을 선언하는 것을 알
 //// tab | 파이썬 3.7 이상
 
 ```Python hl_lines="30-32"
-{!> ../../../docs_src/security/tutorial002.py!}
+{!> ../../docs_src/security/tutorial002.py!}
 ```
 
 ////
@@ -161,7 +161,7 @@ Pydantic 모델인 `User`로 `current_user`의 타입을 선언하는 것을 알
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="28-30"
-{!> ../../../docs_src/security/tutorial002_py310.py!}
+{!> ../../docs_src/security/tutorial002_py310.py!}
 ```
 
 ////
index 9593f96f5eaa431a44e716d1e44f1aedc64c34ae..fd18c1d479bc136fd8812ae20ce2ee973a56804e 100644 (file)
@@ -55,7 +55,7 @@ OAuth2의 경우 문자열일 뿐입니다.
 //// tab | 파이썬 3.7 이상
 
 ```Python hl_lines="4  76"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -63,7 +63,7 @@ OAuth2의 경우 문자열일 뿐입니다.
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="2  74"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ OAuth2 사양은 실제로 `password`라는 고정 값이 있는 `grant_type` 
 //// tab | 파이썬 3.7 이상
 
 ```Python hl_lines="3  77-79"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -125,7 +125,7 @@ OAuth2 사양은 실제로 `password`라는 고정 값이 있는 `grant_type` 
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="1  75-77"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -157,7 +157,7 @@ OAuth2 사양은 실제로 `password`라는 고정 값이 있는 `grant_type` 
 //// tab | P파이썬 3.7 이상
 
 ```Python hl_lines="80-83"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -165,7 +165,7 @@ OAuth2 사양은 실제로 `password`라는 고정 값이 있는 `grant_type` 
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="78-81"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -213,7 +213,7 @@ UserInDB(
 //// tab | 파이썬 3.7 이상
 
 ```Python hl_lines="85"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -221,7 +221,7 @@ UserInDB(
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="83"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
@@ -253,7 +253,7 @@ UserInDB(
 //// tab | 파이썬 3.7 이상
 
 ```Python hl_lines="58-66  69-72  90"
-{!> ../../../docs_src/security/tutorial003.py!}
+{!> ../../docs_src/security/tutorial003.py!}
 ```
 
 ////
@@ -261,7 +261,7 @@ UserInDB(
 //// tab | 파이썬 3.10 이상
 
 ```Python hl_lines="55-64  67-70  88"
-{!> ../../../docs_src/security/tutorial003_py310.py!}
+{!> ../../docs_src/security/tutorial003_py310.py!}
 ```
 
 ////
index 360aaaa6be713fee715cf8e37698cd0abab207e5..90a60d1939d6b320bed0fb15a1c36899c2d7cc54 100644 (file)
@@ -8,7 +8,7 @@
 * 특정 경로에 `StaticFiles()` 인스턴스를 "마운트" 합니다.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
 ```
 
 /// note | "기술적 세부사항"
index a5562b7950a040cd5ef95ec92de8c6b4e46e388e..00052037cc6ae14e4f60fb9b5a72a5b65a680089 100644 (file)
@@ -23,7 +23,7 @@ Als je een Python expert bent en alles al weet over type hints, sla dan dit hoof
 Laten we beginnen met een eenvoudig voorbeeld:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 Het aanroepen van dit programma leidt tot het volgende resultaat:
@@ -40,7 +40,7 @@ De functie voert het volgende uit:
 * <abbr title="Voegt ze samen, als één. Met de inhoud van de een na de ander.">Voeg samen</abbr> met een spatie in het midden.
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### Bewerk het
@@ -84,7 +84,7 @@ Dat is alles.
 Dat zijn de "type hints":
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 Dit is niet hetzelfde als het declareren van standaardwaarden zoals bij:
@@ -114,7 +114,7 @@ Nu kun je de opties bekijken en er doorheen scrollen totdat je de optie vindt di
 Bekijk deze functie, deze heeft al type hints:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 Omdat de editor de types van de variabelen kent, krijgt u niet alleen aanvulling, maar ook controles op fouten:
@@ -124,7 +124,7 @@ Omdat de editor de types van de variabelen kent, krijgt u niet alleen aanvulling
 Nu weet je hoe je het moet oplossen, converteer `age` naar een string met `str(age)`:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## Types declareren
@@ -145,7 +145,7 @@ Je kunt bijvoorbeeld het volgende gebruiken:
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### Generieke types met typeparameters
@@ -183,7 +183,7 @@ Als type, vul `list` in.
 Doordat de list een type is dat enkele interne types bevat, zet je ze tussen vierkante haakjes:
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006_py39.py!}
+{!> ../../docs_src/python_types/tutorial006_py39.py!}
 ```
 
 ////
@@ -193,7 +193,7 @@ Doordat de list een type is dat enkele interne types bevat, zet je ze tussen vie
 Van `typing`, importeer `List` (met een hoofdletter `L`):
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 Declareer de variabele met dezelfde dubbele punt (`:`) syntax.
@@ -203,7 +203,7 @@ Zet als type de `List` die je hebt geïmporteerd uit `typing`.
 Doordat de list een type is dat enkele interne types bevat, zet je ze tussen vierkante haakjes:
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 ////
@@ -241,7 +241,7 @@ Je kunt hetzelfde doen om `tuple`s en `set`s te declareren:
 //// tab | Python 3.9+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial007_py39.py!}
+{!> ../../docs_src/python_types/tutorial007_py39.py!}
 ```
 
 ////
@@ -249,7 +249,7 @@ Je kunt hetzelfde doen om `tuple`s en `set`s te declareren:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial007.py!}
+{!> ../../docs_src/python_types/tutorial007.py!}
 ```
 
 ////
@@ -270,7 +270,7 @@ De tweede typeparameter is voor de waarden  (values) van het `dict`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008_py39.py!}
+{!> ../../docs_src/python_types/tutorial008_py39.py!}
 ```
 
 ////
@@ -278,7 +278,7 @@ De tweede typeparameter is voor de waarden  (values) van het `dict`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008.py!}
+{!> ../../docs_src/python_types/tutorial008.py!}
 ```
 
 ////
@@ -300,7 +300,7 @@ In Python 3.10 is er ook een **nieuwe syntax** waarin je de mogelijke types kunt
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008b_py310.py!}
+{!> ../../docs_src/python_types/tutorial008b_py310.py!}
 ```
 
 ////
@@ -308,7 +308,7 @@ In Python 3.10 is er ook een **nieuwe syntax** waarin je de mogelijke types kunt
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008b.py!}
+{!> ../../docs_src/python_types/tutorial008b.py!}
 ```
 
 ////
@@ -322,7 +322,7 @@ Je kunt declareren dat een waarde een type kan hebben, zoals `str`, maar dat het
 In Python 3.6 en hoger (inclusief Python 3.10) kun je het declareren door `Optional` te importeren en te gebruiken vanuit de `typing`-module.
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 Door `Optional[str]` te gebruiken in plaats van alleen `str`, kan de editor je helpen fouten te detecteren waarbij je ervan uit zou kunnen gaan dat een waarde altijd een `str` is, terwijl het in werkelijkheid ook `None` zou kunnen zijn.
@@ -334,7 +334,7 @@ Dit betekent ook dat je in Python 3.10 `EenType | None` kunt gebruiken:
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial009_py310.py!}
+{!> ../../docs_src/python_types/tutorial009_py310.py!}
 ```
 
 ////
@@ -342,7 +342,7 @@ Dit betekent ook dat je in Python 3.10 `EenType | None` kunt gebruiken:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009.py!}
+{!> ../../docs_src/python_types/tutorial009.py!}
 ```
 
 ////
@@ -350,7 +350,7 @@ Dit betekent ook dat je in Python 3.10 `EenType | None` kunt gebruiken:
 //// tab | Python 3.8+ alternative
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009b.py!}
+{!> ../../docs_src/python_types/tutorial009b.py!}
 ```
 
 ////
@@ -371,7 +371,7 @@ Het gaat alleen om de woorden en naamgeving. Maar die naamgeving kan invloed heb
 Laten we als voorbeeld deze functie nemen:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009c.py!}
+{!../../docs_src/python_types/tutorial009c.py!}
 ```
 
 De parameter `name` is gedefinieerd als `Optional[str]`, maar is **niet optioneel**, je kunt de functie niet aanroepen zonder de parameter:
@@ -389,7 +389,7 @@ say_hi(name=None)  # Dit werkt, None is geldig 🎉
 Het goede nieuws is dat als je eenmaal Python 3.10 gebruikt, je je daar geen zorgen meer over hoeft te maken, omdat je dan gewoon `|` kunt gebruiken om unions van types te definiëren:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009c_py310.py!}
+{!../../docs_src/python_types/tutorial009c_py310.py!}
 ```
 
 Dan hoef je je geen zorgen te maken over namen als `Optional` en `Union`. 😎
@@ -453,13 +453,13 @@ Je kunt een klasse ook declareren als het type van een variabele.
 Stel dat je een klasse `Person` hebt, met een naam:
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Vervolgens kun je een variabele van het type `Persoon` declareren:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Dan krijg je ook nog eens volledige editorondersteuning:
@@ -487,7 +487,7 @@ Een voorbeeld uit de officiële Pydantic-documentatie:
 //// tab | Python 3.10+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py310.py!}
+{!> ../../docs_src/python_types/tutorial011_py310.py!}
 ```
 
 ////
@@ -495,7 +495,7 @@ Een voorbeeld uit de officiële Pydantic-documentatie:
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py39.py!}
+{!> ../../docs_src/python_types/tutorial011_py39.py!}
 ```
 
 ////
@@ -503,7 +503,7 @@ Een voorbeeld uit de officiële Pydantic-documentatie:
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011.py!}
+{!> ../../docs_src/python_types/tutorial011.py!}
 ```
 
 ////
@@ -533,7 +533,7 @@ Python heeft ook een functie waarmee je **extra <abbr title="Data over de data,
 In Python 3.9 is `Annotated` onderdeel van de standaardpakket, dus je kunt het importeren vanuit `typing`.
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial013_py39.py!}
+{!> ../../docs_src/python_types/tutorial013_py39.py!}
 ```
 
 ////
@@ -545,7 +545,7 @@ In versies lager dan Python 3.9 importeer je `Annotated` vanuit `typing_extensio
 Het wordt al geïnstalleerd met **FastAPI**.
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial013.py!}
+{!> ../../docs_src/python_types/tutorial013.py!}
 ```
 
 ////
index 8f1b9b922cd78870afaccf7a28e25086b44e3200..99c425f12b45255ba4bd8439e357c5d9ddc6e5da 100644 (file)
@@ -3,7 +3,7 @@
 Najprostszy plik FastAPI może wyglądać tak:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Skopiuj to do pliku `main.py`.
@@ -134,7 +134,7 @@ Możesz go również użyć do automatycznego generowania kodu dla klientów, kt
 ### Krok 1: zaimportuj `FastAPI`
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI` jest klasą, która zapewnia wszystkie funkcjonalności Twojego API.
@@ -150,7 +150,7 @@ Oznacza to, że możesz korzystać ze wszystkich funkcjonalności <a href="https
 ### Krok 2: utwórz instancję `FastAPI`
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Zmienna `app` będzie tutaj "instancją" klasy `FastAPI`.
@@ -172,7 +172,7 @@ $ uvicorn main:app --reload
 Jeśli stworzysz swoją aplikację, np.:
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
 ```
 
 I umieścisz to w pliku `main.py`, to będziesz mógł tak wywołać `uvicorn`:
@@ -251,7 +251,7 @@ Będziemy je również nazywali "**operacjami**".
 #### Zdefiniuj *dekorator operacji na ścieżce*
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `@app.get("/")` mówi **FastAPI** że funkcja poniżej odpowiada za obsługę żądań, które trafiają do:
@@ -307,7 +307,7 @@ To jest nasza "**funkcja obsługująca ścieżkę**":
 * **funkcja**: to funkcja poniżej "dekoratora" (poniżej `@app.get("/")`).
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Jest to funkcja Python.
@@ -321,7 +321,7 @@ W tym przypadku jest to funkcja "asynchroniczna".
 Możesz również zdefiniować to jako normalną funkcję zamiast `async def`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note
@@ -333,7 +333,7 @@ Jeśli nie znasz różnicy, sprawdź [Async: *"In a hurry?"*](../async.md#in-a-h
 ### Krok 5: zwróć zawartość
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Możesz zwrócić `dict`, `list`, pojedynczą wartość jako `str`, `int`, itp.
index c27301b616d5fb39b048908b3c37d1f713618ab4..46cf1efc3ecead6b44f8c93353e942cf6369786f 100644 (file)
@@ -27,7 +27,7 @@ O **FastAPI** pegará este modelo, gerará o esquema JSON dele e incluirá no lo
 Por exemplo, para declarar um outro retorno com o status code `404` e um modelo do Pydantic chamado `Message`, você pode escrever:
 
 ```Python hl_lines="18  22"
-{!../../../docs_src/additional_responses/tutorial001.py!}
+{!../../docs_src/additional_responses/tutorial001.py!}
 ```
 
 /// note | "Nota"
@@ -178,7 +178,7 @@ Você pode utilizar o mesmo parâmetro `responses` para adicionar diferentes med
 Por exemplo, você pode adicionar um media type adicional de `image/png`, declarando que a sua *operação de caminho* pode retornar um objeto JSON (com o media type `application/json`) ou uma imagem PNG:
 
 ```Python hl_lines="19-24  28"
-{!../../../docs_src/additional_responses/tutorial002.py!}
+{!../../docs_src/additional_responses/tutorial002.py!}
 ```
 
 /// note | "Nota"
@@ -208,7 +208,7 @@ Por exemplo, você pode declarar um retorno com o código de status `404` que ut
 E um retorno com o código de status `200` que utiliza o seu `response_model`, porém inclui um `example` customizado:
 
 ```Python hl_lines="20-31"
-{!../../../docs_src/additional_responses/tutorial003.py!}
+{!../../docs_src/additional_responses/tutorial003.py!}
 ```
 
 Isso será combinado e incluído em seu OpenAPI, e disponibilizado na documentação da sua API:
@@ -244,7 +244,7 @@ Você pode utilizar essa técnica para reutilizar alguns retornos predefinidos n
 Por exemplo:
 
 ```Python hl_lines="13-17  26"
-{!../../../docs_src/additional_responses/tutorial004.py!}
+{!../../docs_src/additional_responses/tutorial004.py!}
 ```
 
 ## Mais informações sobre retornos OpenAPI
index a0869f34276ea65c6e28fb2089cca694889086a0..02bb4c0154071149557a153ce5314287b7ade512 100644 (file)
@@ -17,7 +17,7 @@ Para conseguir isso, importe `JSONResponse` e retorne o seu conteúdo diretament
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  25"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an_py310.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Para conseguir isso, importe `JSONResponse` e retorne o seu conteúdo diretament
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  25"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an_py39.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -33,7 +33,7 @@ Para conseguir isso, importe `JSONResponse` e retorne o seu conteúdo diretament
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  26"
-{!> ../../../docs_src/additional_status_codes/tutorial001_an.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_an.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@ Faça uso da versão `Annotated` quando possível.
 ///
 
 ```Python hl_lines="2  23"
-{!> ../../../docs_src/additional_status_codes/tutorial001_py310.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001_py310.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ Faça uso da versão `Annotated` quando possível.
 ///
 
 ```Python hl_lines="4  25"
-{!> ../../../docs_src/additional_status_codes/tutorial001.py!}
+{!> ../../docs_src/additional_status_codes/tutorial001.py!}
 ```
 
 ////
index 5a7b921b2ee72b009352c45a9e5e528ceadb3daa..a656390a466f99f60c3be23a965debe274007d97 100644 (file)
@@ -21,7 +21,7 @@ Para fazer isso, nós declaramos o método `__call__`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -29,7 +29,7 @@ Para fazer isso, nós declaramos o método `__call__`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@ E agora, nós podemos utilizar o `__init__` para declarar os parâmetros da inst
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -65,7 +65,7 @@ E agora, nós podemos utilizar o `__init__` para declarar os parâmetros da inst
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@ Nós poderíamos criar uma instância desta classe com:
 //// tab | Python 3.9+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -101,7 +101,7 @@ Nós poderíamos criar uma instância desta classe com:
 //// tab | Python 3.8+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
 ```
 
 ////
@@ -115,7 +115,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
 ```
 
 ////
@@ -137,7 +137,7 @@ checker(q="somequery")
 //// tab | Python 3.9+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/dependencies/tutorial011_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -145,7 +145,7 @@ checker(q="somequery")
 //// tab | Python 3.8+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/dependencies/tutorial011_an.py!}
+{!> ../../docs_src/dependencies/tutorial011_an.py!}
 ```
 
 ////
@@ -159,7 +159,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial011.py!}
+{!> ../../docs_src/dependencies/tutorial011.py!}
 ```
 
 ////
index 7cac262627f212f5ecdc927b32b28177ffb34d14..c81d6124be85fe339c9a743f142524092204875d 100644 (file)
@@ -33,13 +33,13 @@ Para um exemplos simples, vamos considerar uma estrutura de arquivos semelhante
 O arquivo `main.py` teria:
 
 ```Python
-{!../../../docs_src/async_tests/main.py!}
+{!../../docs_src/async_tests/main.py!}
 ```
 
 O arquivo `test_main.py` teria os testes para para o arquivo `main.py`, ele poderia ficar assim:
 
 ```Python
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
 ```
 
 ## Executá-lo
@@ -61,7 +61,7 @@ $ pytest
 O marcador `@pytest.mark.anyio` informa ao pytest que esta função de teste deve ser invocada de maneira assíncrona:
 
 ```Python hl_lines="7"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
 ```
 
 /// tip | "Dica"
@@ -73,7 +73,7 @@ Note que a função de teste é `async def` agora, no lugar de apenas `def` como
 Então podemos criar um `AsyncClient` com a aplicação, e enviar requisições assíncronas para ela utilizando `await`.
 
 ```Python hl_lines="9-12"
-{!../../../docs_src/async_tests/test_main.py!}
+{!../../docs_src/async_tests/test_main.py!}
 ```
 
 Isso é equivalente a:
index 2dfc5ca25fe519ae3caf237486cd3b3fa1723487..3c65b5a0a113f68e619d056b3ab3b26eb083bf15 100644 (file)
@@ -19,7 +19,7 @@ Nesse caso, o caminho original `/app` seria servido em `/api/v1/app`.
 Embora todo o seu código esteja escrito assumindo que existe apenas `/app`.
 
 ```Python hl_lines="6"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
 ```
 
 E o proxy estaria **"removendo"** o **prefixo do caminho** dinamicamente antes de transmitir a solicitação para o servidor da aplicação (provavelmente Uvicorn via CLI do FastAPI), mantendo sua aplicação convencida de que está sendo servida em `/app`, para que você não precise atualizar todo o seu código para incluir o prefixo `/api/v1`.
@@ -99,7 +99,7 @@ Você pode obter o `root_path` atual usado pela sua aplicação para cada solici
 Aqui estamos incluindo ele na mensagem apenas para fins de demonstração.
 
 ```Python hl_lines="8"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
 ```
 
 Então, se você iniciar o Uvicorn com:
@@ -128,7 +128,7 @@ A resposta seria algo como:
 Alternativamente, se você não tiver uma maneira de fornecer uma opção de linha de comando como `--root-path` ou equivalente, você pode definir o parâmetro `--root-path` ao criar sua aplicação FastAPI:
 
 ```Python hl_lines="3"
-{!../../../docs_src/behind_a_proxy/tutorial002.py!}
+{!../../docs_src/behind_a_proxy/tutorial002.py!}
 ```
 
 Passar o `root_path`h para `FastAPI` seria o equivalente a passar a opção de linha de comando `--root-path` para Uvicorn ou Hypercorn.
@@ -310,7 +310,7 @@ Se você passar uma lista personalizada de `servers` e houver um `root_path` (po
 Por exemplo:
 
 ```Python hl_lines="4-7"
-{!../../../docs_src/behind_a_proxy/tutorial003.py!}
+{!../../docs_src/behind_a_proxy/tutorial003.py!}
 ```
 
 Gerará um OpenAPI schema como:
@@ -359,7 +359,7 @@ A interface de documentação interagirá com o servidor que você selecionar.
 Se você não quiser que o **FastAPI** inclua um servidor automático usando o `root_path`, você pode usar o parâmetro `root_path_in_servers=False`:
 
 ```Python hl_lines="9"
-{!../../../docs_src/behind_a_proxy/tutorial004.py!}
+{!../../docs_src/behind_a_proxy/tutorial004.py!}
 ```
 
 e então ele não será incluído no OpenAPI schema.
index 5f722763edf85663b16c856d7f424df920f63878..02f5b6d2b7d86af20195e67fddacbdcb52a7bd4c 100644 (file)
@@ -32,7 +32,7 @@ Vamos iniciar com um exemplo e ver isso detalhadamente.
 Nós criamos uma função assíncrona chamada `lifespan()` com `yield` como este:
 
 ```Python hl_lines="16  19"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 Aqui nós estamos simulando a *inicialização* custosa do carregamento do modelo colocando a (falsa) função de modelo no dicionário com modelos de _machine learning_ antes do `yield`. Este código será executado **antes** da aplicação **começar a receber requisições**, durante a *inicialização*.
@@ -52,7 +52,7 @@ Talvez você precise inicializar uma nova versão, ou apenas cansou de executá-
 A primeira coisa a notar, é que estamos definindo uma função assíncrona com `yield`. Isso é muito semelhante à Dependências com `yield`.
 
 ```Python hl_lines="14-19"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 A primeira parte da função, antes do `yield`, será  executada **antes** da aplicação inicializar.
@@ -66,7 +66,7 @@ Se você verificar, a função está decorada com um `@asynccontextmanager`.
 Que converte a função em algo chamado de "**Gerenciador de Contexto Assíncrono**".
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 Um **gerenciador de contexto** em Python é algo que você pode usar em uma declaração `with`, por exemplo, `open()` pode ser usado como um gerenciador de contexto:
@@ -90,7 +90,7 @@ No nosso exemplo de código acima, nós não usamos ele diretamente, mas nós pa
 O parâmetro `lifespan` da aplicação `FastAPI` usa um **Gerenciador de Contexto Assíncrono**, então nós podemos passar nosso novo gerenciador de contexto assíncrono do `lifespan` para ele.
 
 ```Python hl_lines="22"
-{!../../../docs_src/events/tutorial003.py!}
+{!../../docs_src/events/tutorial003.py!}
 ```
 
 ## Eventos alternativos (deprecados)
@@ -114,7 +114,7 @@ Essas funções podem ser declaradas com `async def` ou `def` normal.
 Para adicionar uma função que deve rodar antes da aplicação iniciar, declare-a com o evento `"startup"`:
 
 ```Python hl_lines="8"
-{!../../../docs_src/events/tutorial001.py!}
+{!../../docs_src/events/tutorial001.py!}
 ```
 
 Nesse caso, a função de manipulação de evento `startup` irá inicializar os itens do "banco de dados" (só um `dict`) com alguns valores.
@@ -128,7 +128,7 @@ E sua aplicação não irá começar a receber requisições até que todos os m
 Para adicionar uma função que deve ser executada quando a aplicação estiver encerrando, declare ela com o evento `"shutdown"`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/events/tutorial002.py!}
+{!../../docs_src/events/tutorial002.py!}
 ```
 
 Aqui, a função de manipulação de evento `shutdown` irá escrever uma linha de texto `"Application shutdown"` no arquivo `log.txt`.
index 2ccd0e81963d75472c9c21c4b905e1681a5f82be..5a0226c74214f52b99249db31220065da7856f6a 100644 (file)
@@ -33,7 +33,7 @@ Webhooks estão disponíveis a partir do OpenAPI 3.1.0, e possui suporte do Fast
 Quando você cria uma aplicação com o **FastAPI**, existe um atributo chamado `webhooks`, que você utilizar para defini-los da mesma maneira que você definiria as suas **operações de rotas**, utilizando por exemplo `@app.webhooks.post()`.
 
 ```Python hl_lines="9-13  36-53"
-{!../../../docs_src/openapi_webhooks/tutorial001.py!}
+{!../../docs_src/openapi_webhooks/tutorial001.py!}
 ```
 
 Os webhooks que você define aparecerão no esquema do **OpenAPI** e na **página de documentação** gerada automaticamente.
index 99695c8317de8a0af1cedb8f2a99a4ade6f377d4..2ac5eca185616df8e6dc2523419531d2c35d1427 100644 (file)
@@ -21,7 +21,7 @@ Você pode declarar um parâmetro do tipo `Response` em sua *função de operaç
 E então você pode definir o `status_code` neste objeto de retorno temporal.
 
 ```Python hl_lines="1  9  12"
-{!../../../docs_src/response_change_status_code/tutorial001.py!}
+{!../../docs_src/response_change_status_code/tutorial001.py!}
 ```
 
 E então você pode retornar qualquer objeto que você precise, como você faria normalmente (um `dict`, um modelo de banco de dados, etc.).
index fc571d39ba4470c4a0c21e0c106a8cc8ac04d354..fd2a0eef11c48c0ca8c0312d5748e41ff8760fd8 100644 (file)
@@ -35,7 +35,7 @@ Por exemplo, você não pode colocar um modelo do Pydantic em uma `JSONResponse`
 Para esses casos, você pode usar o `jsonable_encoder` para converter seus dados antes de repassá-los para a resposta:
 
 ```Python hl_lines="6-7  21-22"
-{!../../../docs_src/response_directly/tutorial001.py!}
+{!../../docs_src/response_directly/tutorial001.py!}
 ```
 
 /// note | Detalhes Técnicos
@@ -57,7 +57,7 @@ Vamos dizer quer retornar uma resposta <a href="https://pt.wikipedia.org/wiki/XM
 Você pode colocar o seu conteúdo XML em uma string, colocar em uma `Response`, e retorná-lo:
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ## Notas
index 103d622c7d2d88661e8cf9bc0938d8f3e91b36ce..26983a10385073c31bcb63c6e83e3c820e2cb88e 100644 (file)
@@ -23,7 +23,7 @@ Então, quando você digitar o usuário e senha, o navegador os envia automatica
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  8  12"
-{!> ../../../docs_src/security/tutorial006_an_py39.py!}
+{!> ../../docs_src/security/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Então, quando você digitar o usuário e senha, o navegador os envia automatica
 //// tab | Python 3.8+
 
 ```Python hl_lines="2  7  11"
-{!> ../../../docs_src/security/tutorial006_an.py!}
+{!> ../../docs_src/security/tutorial006_an.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="2  6  10"
-{!> ../../../docs_src/security/tutorial006.py!}
+{!> ../../docs_src/security/tutorial006.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@ Então nós podemos utilizar o `secrets.compare_digest()` para garantir que o `c
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  12-24"
-{!> ../../../docs_src/security/tutorial007_an_py39.py!}
+{!> ../../docs_src/security/tutorial007_an_py39.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@ Então nós podemos utilizar o `secrets.compare_digest()` para garantir que o `c
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  12-24"
-{!> ../../../docs_src/security/tutorial007_an.py!}
+{!> ../../docs_src/security/tutorial007_an.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="1  11-21"
-{!> ../../../docs_src/security/tutorial007.py!}
+{!> ../../docs_src/security/tutorial007.py!}
 ```
 
 ////
@@ -164,7 +164,7 @@ Após detectar que as credenciais estão incorretas, retorne um `HTTPException`
 //// tab | Python 3.9+
 
 ```Python hl_lines="26-30"
-{!> ../../../docs_src/security/tutorial007_an_py39.py!}
+{!> ../../docs_src/security/tutorial007_an_py39.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ Após detectar que as credenciais estão incorretas, retorne um `HTTPException`
 //// tab | Python 3.8+
 
 ```Python hl_lines="26-30"
-{!> ../../../docs_src/security/tutorial007_an.py!}
+{!> ../../docs_src/security/tutorial007_an.py!}
 ```
 
 ////
@@ -186,7 +186,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="23-27"
-{!> ../../../docs_src/security/tutorial007.py!}
+{!> ../../docs_src/security/tutorial007.py!}
 ```
 
 ////
index 4ad7c807e3b1597188c3cf84fcd9b8c17a059715..fa4594c890887ce25444ea4e68e1b2e8ef9fca97 100644 (file)
@@ -65,7 +65,7 @@ Primeiro, vamos olhar rapidamente as partes que mudam dos exemplos do **Tutorial
 //// tab | Python 3.10+
 
 ```Python hl_lines="5  9  13  47  65  106  108-116  122-125  129-135  140  156"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@ Primeiro, vamos olhar rapidamente as partes que mudam dos exemplos do **Tutorial
 //// tab | Python 3.9+
 
 ```Python hl_lines="2  5  9  13  47  65  106  108-116  122-125  129-135  140  156"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -81,7 +81,7 @@ Primeiro, vamos olhar rapidamente as partes que mudam dos exemplos do **Tutorial
 //// tab | Python 3.8+
 
 ```Python hl_lines="2  5  9  13  48  66  107  109-117  123-126  130-136  141  157"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -95,7 +95,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="4  8  12  46  64  105  107-115  121-124  128-134  139  155"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -109,7 +109,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="2  5  9  13  47  65  106  108-116  122-125  129-135  140  156"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -123,7 +123,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="2  5  9  13  47  65  106  108-116  122-125  129-135  140  156"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -139,7 +139,7 @@ O parâmetro `scopes` recebe um `dict` contendo cada escopo como chave e a descr
 //// tab | Python 3.10+
 
 ```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ O parâmetro `scopes` recebe um `dict` contendo cada escopo como chave e a descr
 //// tab | Python 3.9+
 
 ```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -155,7 +155,7 @@ O parâmetro `scopes` recebe um `dict` contendo cada escopo como chave e a descr
 //// tab | Python 3.8+
 
 ```Python hl_lines="64-67"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -169,7 +169,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="62-65"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -183,7 +183,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -197,7 +197,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="63-66"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -229,7 +229,7 @@ Porém em sua aplicação, por segurança, você deve garantir que você apenas
 //// tab | Python 3.10+
 
 ```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ Porém em sua aplicação, por segurança, você deve garantir que você apenas
 //// tab | Python 3.9+
 
 ```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ Porém em sua aplicação, por segurança, você deve garantir que você apenas
 //// tab | Python 3.8+
 
 ```Python hl_lines="157"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -259,7 +259,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="155"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -287,7 +287,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="156"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -319,7 +319,7 @@ Nós estamos fazendo isso aqui para demonstrar como o **FastAPI** lida com escop
 //// tab | Python 3.10+
 
 ```Python hl_lines="5  140  171"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -327,7 +327,7 @@ Nós estamos fazendo isso aqui para demonstrar como o **FastAPI** lida com escop
 //// tab | Python 3.9+
 
 ```Python hl_lines="5  140  171"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -335,7 +335,7 @@ Nós estamos fazendo isso aqui para demonstrar como o **FastAPI** lida com escop
 //// tab | Python 3.8+
 
 ```Python hl_lines="5  141  172"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -349,7 +349,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="4  139  168"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -363,7 +363,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="5  140  169"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -377,7 +377,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="5  140  169"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -409,7 +409,7 @@ A classe `SecurityScopes` é semelhante à classe `Request` (`Request` foi utili
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  106"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -417,7 +417,7 @@ A classe `SecurityScopes` é semelhante à classe `Request` (`Request` foi utili
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  106"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -425,7 +425,7 @@ A classe `SecurityScopes` é semelhante à classe `Request` (`Request` foi utili
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  107"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -439,7 +439,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="8  105"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -453,7 +453,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="9  106"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -467,7 +467,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="9  106"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -487,7 +487,7 @@ Nesta exceção, nós incluímos os escopos necessários (se houver algum) como
 //// tab | Python 3.10+
 
 ```Python hl_lines="106  108-116"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -495,7 +495,7 @@ Nesta exceção, nós incluímos os escopos necessários (se houver algum) como
 //// tab | Python 3.9+
 
 ```Python hl_lines="106  108-116"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -503,7 +503,7 @@ Nesta exceção, nós incluímos os escopos necessários (se houver algum) como
 //// tab | Python 3.8+
 
 ```Python hl_lines="107  109-117"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -517,7 +517,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="105  107-115"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -531,7 +531,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="106  108-116"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -545,7 +545,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="106  108-116"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -567,7 +567,7 @@ Nós também verificamos que nós temos um usuário com o "*username*", e caso c
 //// tab | Python 3.10+
 
 ```Python hl_lines="47  117-128"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -575,7 +575,7 @@ Nós também verificamos que nós temos um usuário com o "*username*", e caso c
 //// tab | Python 3.9+
 
 ```Python hl_lines="47  117-128"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -583,7 +583,7 @@ Nós também verificamos que nós temos um usuário com o "*username*", e caso c
 //// tab | Python 3.8+
 
 ```Python hl_lines="48  118-129"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -597,7 +597,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="46  116-127"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -611,7 +611,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="47  117-128"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -625,7 +625,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="47  117-128"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
@@ -639,7 +639,7 @@ Para isso, nós utilizamos `security_scopes.scopes`, que contém uma `list` com
 //// tab | Python 3.10+
 
 ```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005_an_py310.py!}
+{!> ../../docs_src/security/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -647,7 +647,7 @@ Para isso, nós utilizamos `security_scopes.scopes`, que contém uma `list` com
 //// tab | Python 3.9+
 
 ```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005_an_py39.py!}
+{!> ../../docs_src/security/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -655,7 +655,7 @@ Para isso, nós utilizamos `security_scopes.scopes`, que contém uma `list` com
 //// tab | Python 3.8+
 
 ```Python hl_lines="130-136"
-{!> ../../../docs_src/security/tutorial005_an.py!}
+{!> ../../docs_src/security/tutorial005_an.py!}
 ```
 
 ////
@@ -669,7 +669,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="128-134"
-{!> ../../../docs_src/security/tutorial005_py310.py!}
+{!> ../../docs_src/security/tutorial005_py310.py!}
 ```
 
 ////
@@ -683,7 +683,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005_py39.py!}
+{!> ../../docs_src/security/tutorial005_py39.py!}
 ```
 
 ////
@@ -697,7 +697,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="129-135"
-{!> ../../../docs_src/security/tutorial005.py!}
+{!> ../../docs_src/security/tutorial005.py!}
 ```
 
 ////
index db2b4c9cc46c480f30a299c996ca19e928886b20..d32b70ed429bca46f85654aba835bc47888fe4f1 100644 (file)
@@ -181,7 +181,7 @@ Você pode utilizar todas as ferramentas e funcionalidades de validação que s
 //// tab | Pydantic v2
 
 ```Python hl_lines="2  5-8  11"
-{!> ../../../docs_src/settings/tutorial001.py!}
+{!> ../../docs_src/settings/tutorial001.py!}
 ```
 
 ////
@@ -195,7 +195,7 @@ Na versão 1 do Pydantic você importaria `BaseSettings` diretamente do módulo
 ///
 
 ```Python hl_lines="2  5-8  11"
-{!> ../../../docs_src/settings/tutorial001_pv1.py!}
+{!> ../../docs_src/settings/tutorial001_pv1.py!}
 ```
 
 ////
@@ -215,7 +215,7 @@ Depois ele irá converter e validar os dados. Assim, quando você utilizar aquel
 Depois, Você pode utilizar o novo objeto `settings` na sua aplicação:
 
 ```Python hl_lines="18-20"
-{!../../../docs_src/settings/tutorial001.py!}
+{!../../docs_src/settings/tutorial001.py!}
 ```
 
 ### Executando o servidor
@@ -251,13 +251,13 @@ Você também pode incluir essas configurações em um arquivo de um módulo sep
 Por exemplo, você pode adicionar um arquivo `config.py` com:
 
 ```Python
-{!../../../docs_src/settings/app01/config.py!}
+{!../../docs_src/settings/app01/config.py!}
 ```
 
 E utilizar essa configuração em `main.py`:
 
 ```Python hl_lines="3  11-13"
-{!../../../docs_src/settings/app01/main.py!}
+{!../../docs_src/settings/app01/main.py!}
 ```
 
 /// dica
@@ -277,7 +277,7 @@ Isso é especialmente útil durante os testes, já que é bastante simples sobre
 Baseando-se no exemplo anterior, seu arquivo `config.py` seria parecido com isso:
 
 ```Python hl_lines="10"
-{!../../../docs_src/settings/app02/config.py!}
+{!../../docs_src/settings/app02/config.py!}
 ```
 
 Perceba que dessa vez não criamos uma instância padrão `settings = Settings()`.
@@ -289,7 +289,7 @@ Agora criamos a dependência que retorna um novo objeto `config.Settings()`.
 //// tab | Python 3.9+
 
 ```Python hl_lines="6  12-13"
-{!> ../../../docs_src/settings/app02_an_py39/main.py!}
+{!> ../../docs_src/settings/app02_an_py39/main.py!}
 ```
 
 ////
@@ -297,7 +297,7 @@ Agora criamos a dependência que retorna um novo objeto `config.Settings()`.
 //// tab | Python 3.8+
 
 ```Python hl_lines="6  12-13"
-{!> ../../../docs_src/settings/app02_an/main.py!}
+{!> ../../docs_src/settings/app02_an/main.py!}
 ```
 
 ////
@@ -311,7 +311,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="5  11-12"
-{!> ../../../docs_src/settings/app02/main.py!}
+{!> ../../docs_src/settings/app02/main.py!}
 ```
 
 ////
@@ -329,7 +329,7 @@ E então podemos declarar essas configurações como uma dependência na funçã
 //// tab | Python 3.9+
 
 ```Python hl_lines="17  19-21"
-{!> ../../../docs_src/settings/app02_an_py39/main.py!}
+{!> ../../docs_src/settings/app02_an_py39/main.py!}
 ```
 
 ////
@@ -337,7 +337,7 @@ E então podemos declarar essas configurações como uma dependência na funçã
 //// tab | Python 3.8+
 
 ```Python hl_lines="17  19-21"
-{!> ../../../docs_src/settings/app02_an/main.py!}
+{!> ../../docs_src/settings/app02_an/main.py!}
 ```
 
 ////
@@ -351,7 +351,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="16  18-20"
-{!> ../../../docs_src/settings/app02/main.py!}
+{!> ../../docs_src/settings/app02/main.py!}
 ```
 
 ////
@@ -361,7 +361,7 @@ Utilize a versão com `Annotated` se possível.
 Então seria muito fácil fornecer uma configuração diferente durante a execução dos testes sobrescrevendo a dependência de `get_settings`:
 
 ```Python hl_lines="9-10  13  21"
-{!../../../docs_src/settings/app02/test_main.py!}
+{!../../docs_src/settings/app02/test_main.py!}
 ```
 
 Na sobrescrita da dependência, definimos um novo valor para `admin_email` quando instanciamos um novo objeto `Settings`, e então retornamos esse novo objeto.
@@ -406,7 +406,7 @@ E então adicionar o seguinte código em `config.py`:
 //// tab | Pydantic v2
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/settings/app03_an/config.py!}
+{!> ../../docs_src/settings/app03_an/config.py!}
 ```
 
 /// dica
@@ -420,7 +420,7 @@ O atributo `model_config` é usado apenas para configuração do Pydantic. Você
 //// tab | Pydantic v1
 
 ```Python hl_lines="9-10"
-{!> ../../../docs_src/settings/app03_an/config_pv1.py!}
+{!> ../../docs_src/settings/app03_an/config_pv1.py!}
 ```
 
 /// dica
@@ -465,7 +465,7 @@ Mas como estamos utilizando o decorador `@lru_cache` acima, o objeto `Settings`
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  11"
-{!> ../../../docs_src/settings/app03_an_py39/main.py!}
+{!> ../../docs_src/settings/app03_an_py39/main.py!}
 ```
 
 ////
@@ -473,7 +473,7 @@ Mas como estamos utilizando o decorador `@lru_cache` acima, o objeto `Settings`
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  11"
-{!> ../../../docs_src/settings/app03_an/main.py!}
+{!> ../../docs_src/settings/app03_an/main.py!}
 ```
 
 ////
@@ -487,7 +487,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="1  10"
-{!> ../../../docs_src/settings/app03/main.py!}
+{!> ../../docs_src/settings/app03/main.py!}
 ```
 
 ////
index 8149edc5aa93deb1ef01b85b889a977b1c83cae8..7f0381cc2fe04196a49c995b12dd08edef96ec98 100644 (file)
@@ -11,7 +11,7 @@ Se você precisar ter duas aplicações FastAPI independentes, cada uma com seu
 Primeiro, crie a aplicação principal, de nível superior, **FastAPI**, e suas *operações de rota*:
 
 ```Python hl_lines="3  6-8"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### Sub-aplicação
@@ -21,7 +21,7 @@ Em seguida, crie sua sub-aplicação e suas *operações de rota*.
 Essa sub-aplicação é apenas outra aplicação FastAPI padrão, mas esta é a que será "montada":
 
 ```Python hl_lines="11  14-16"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### Monte a sub-aplicação
@@ -31,7 +31,7 @@ Na sua aplicação de nível superior, `app`, monte a sub-aplicação, `subapi`.
 Neste caso, ela será montada no caminho `/subapi`:
 
 ```Python hl_lines="11  19"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### Verifique a documentação automática da API
index 6d231b3c25e62073c4d67d82436a8b13373d2355..88a5b940e97e4ee4f1c74e9dcbca9883d71a6cc1 100644 (file)
@@ -26,7 +26,7 @@ $ pip install jinja2
 * Use o `template` que você criou para renderizar e retornar uma `TemplateResponse`, passe o nome do template, o request object, e um "context" dict com pares chave-valor a serem usados dentro do template do Jinja2.
 
 ```Python hl_lines="4  11  15-18"
-{!../../../docs_src/templates/tutorial001.py!}
+{!../../docs_src/templates/tutorial001.py!}
 ```
 
 /// note
@@ -56,7 +56,7 @@ Você também poderia usar `from starlette.templating import Jinja2Templates`.
 Então você pode escrever um template em `templates/item.html`, por exemplo:
 
 ```jinja hl_lines="7"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
 ```
 
 ### Interpolação de Valores no Template
@@ -110,13 +110,13 @@ Por exemplo, com um ID de `42`, isso renderizará:
 Você também pode usar `url_for()` dentro do template e usá-lo, por examplo, com o `StaticFiles` que você montou com o `name="static"`.
 
 ```jinja hl_lines="4"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
 ```
 
 Neste exemplo, ele seria vinculado a um arquivo CSS em `static/styles.css` com:
 
 ```CSS hl_lines="4"
-{!../../../docs_src/templates/static/styles.css!}
+{!../../docs_src/templates/static/styles.css!}
 ```
 
 E como você está usando `StaticFiles`, este arquivo CSS será automaticamente servido pela sua aplicação FastAPI na URL `/static/styles.css`.
index 747dd7d06f2b7adf7656d216a0786a8be43d8626..f978350a528b947d2074b10187f2f93ee5e609ca 100644 (file)
@@ -31,7 +31,7 @@ E então o **FastAPI** chamará a sobreposição no lugar da dependência origin
 //// tab | Python 3.10+
 
 ```Python hl_lines="26-27  30"
-{!> ../../../docs_src/dependency_testing/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ E então o **FastAPI** chamará a sobreposição no lugar da dependência origin
 //// tab | Python 3.9+
 
 ```Python hl_lines="28-29  32"
-{!> ../../../docs_src/dependency_testing/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@ E então o **FastAPI** chamará a sobreposição no lugar da dependência origin
 //// tab | Python 3.8+
 
 ```Python hl_lines="29-30  33"
-{!> ../../../docs_src/dependency_testing/tutorial001_an.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_an.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="24-25  28"
-{!> ../../../docs_src/dependency_testing/tutorial001_py310.py!}
+{!> ../../docs_src/dependency_testing/tutorial001_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="28-29  32"
-{!> ../../../docs_src/dependency_testing/tutorial001.py!}
+{!> ../../docs_src/dependency_testing/tutorial001.py!}
 ```
 
 ////
index 392fb741cac0858f2a290774562966a05e1d99a7..b6796e8351c32846555dd6f0e042a1259f13d5c2 100644 (file)
@@ -3,5 +3,5 @@
 Quando você precisa que os seus manipuladores de eventos (`startup` e `shutdown`) sejam executados em seus testes, você pode utilizar o `TestClient` usando a instrução `with`:
 
 ```Python hl_lines="9-12  20-24"
-{!../../../docs_src/app_testing/tutorial003.py!}
+{!../../docs_src/app_testing/tutorial003.py!}
 ```
index f458a05d4e115ccbb3cf1e2294e2b28b296ebbb1..daa610df63c7495e703b03de3676ecad4cdc4634 100644 (file)
@@ -5,7 +5,7 @@ Você pode usar o mesmo `TestClient` para testar WebSockets.
 Para isso, você utiliza o `TestClient` dentro de uma instrução `with`, conectando com o WebSocket:
 
 ```Python hl_lines="27-31"
-{!../../../docs_src/app_testing/tutorial002.py!}
+{!../../docs_src/app_testing/tutorial002.py!}
 ```
 
 /// note | "Nota"
index 3dd0a8aefe57b55d9dddfc8f639932e25b4e4989..c2114c214d2f95f8f154f4d5eeeb3c46759a7ac4 100644 (file)
@@ -30,7 +30,7 @@ Vamos imaginar que você deseja obter o endereço de IP/host do cliente dentro d
 Para isso você precisa acessar a requisição diretamente.
 
 ```Python hl_lines="1  7-8"
-{!../../../docs_src/using_request_directly/tutorial001.py!}
+{!../../docs_src/using_request_directly/tutorial001.py!}
 ```
 
 Ao declarar o parâmetro com o tipo sendo um `Request` em sua *função de operação de rota*, o **FastAPI** saberá como passar o `Request` neste parâmetro.
index 2c7ac1ffededf0da94067c3a26110ed100976ff4..e6d08c8dbb0fde439410b481a5e32dedc9d871a1 100644 (file)
@@ -13,7 +13,7 @@ Em seguinda, encapsular a aplicação WSGI (e.g. Flask) com o middleware.
 E então **"montar"** em um caminho de rota.
 
 ```Python hl_lines="2-3  23"
-{!../../../docs_src/wsgi/tutorial001.py!}
+{!../../docs_src/wsgi/tutorial001.py!}
 ```
 
 ## Conferindo
index cfa652fa50ea3030bb8e61e4484eee52fad1ae71..675b812e6609d02deabc8171310961c5bf2c4d54 100644 (file)
@@ -30,7 +30,7 @@ Você pode usar facilmente as mesmas configurações do Pydantic para configurar
 Por exemplo:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/conditional_openapi/tutorial001.py!}
+{!../../docs_src/conditional_openapi/tutorial001.py!}
 ```
 
 Aqui declaramos a configuração `openapi_url` com o mesmo padrão de `"/openapi.json"`.
index ceb8c634e7b5c6b2e95cbb1676ad16aca1a94de8..58bb1557ca06db6002a74c840bc3cc83f09b5f91 100644 (file)
@@ -19,7 +19,7 @@ Sem alterar as configurações, o destaque de sintaxe é habilitado por padrão:
 Mas você pode desabilitá-lo definindo `syntaxHighlight` como `False`:
 
 ```Python hl_lines="3"
-{!../../../docs_src/configure_swagger_ui/tutorial001.py!}
+{!../../docs_src/configure_swagger_ui/tutorial001.py!}
 ```
 
 ...e então o Swagger UI não mostrará mais o destaque de sintaxe:
@@ -31,7 +31,7 @@ Mas você pode desabilitá-lo definindo `syntaxHighlight` como `False`:
 Da mesma forma que você pode definir o tema de destaque de sintaxe com a chave `"syntaxHighlight.theme"` (observe que há um ponto no meio):
 
 ```Python hl_lines="3"
-{!../../../docs_src/configure_swagger_ui/tutorial002.py!}
+{!../../docs_src/configure_swagger_ui/tutorial002.py!}
 ```
 
 Essa configuração alteraria o tema de cores de destaque de sintaxe:
@@ -45,7 +45,7 @@ O FastAPI inclui alguns parâmetros de configuração padrão apropriados para a
 Inclui estas configurações padrão:
 
 ```Python
-{!../../../fastapi/openapi/docs.py[ln:7-23]!}
+{!../../fastapi/openapi/docs.py[ln:7-23]!}
 ```
 
 Você pode substituir qualquer um deles definindo um valor diferente no argumento `swagger_ui_parameters`.
@@ -53,7 +53,7 @@ Você pode substituir qualquer um deles definindo um valor diferente no argument
 Por exemplo, para desabilitar `deepLinking` você pode passar essas configurações para `swagger_ui_parameters`:
 
 ```Python hl_lines="3"
-{!../../../docs_src/configure_swagger_ui/tutorial003.py!}
+{!../../docs_src/configure_swagger_ui/tutorial003.py!}
 ```
 
 ## Outros parâmetros da UI do Swagger
index 0b711aa5e5927cd68b3d5b41319ecee1c674fbc0..2cfd790c5867cc3daf9760758be7932708612514 100644 (file)
@@ -36,7 +36,7 @@ Dependendo do seu caso de uso, você pode preferir usar uma biblioteca diferente
 Aqui está uma pequena prévia de como você poderia integrar Strawberry com FastAPI:
 
 ```Python hl_lines="3  22  25-26"
-{!../../../docs_src/graphql/tutorial001.py!}
+{!../../docs_src/graphql/tutorial001.py!}
 ```
 
 Você pode aprender mais sobre Strawberry na <a href="https://strawberry.rocks/" class="external-link" target="_blank">documentação do Strawberry</a>.
index 86630cd2adc253a82925ecdedf65b4a00f63c873..05faa860c6d802d7e6c648c952ad3ac85c89b381 100644 (file)
@@ -23,7 +23,7 @@ Se você é um especialista em Python e já sabe tudo sobre type hints, pule par
 Vamos começar com um exemplo simples:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 A chamada deste programa gera:
@@ -39,7 +39,7 @@ A função faz o seguinte:
 * <abbr title = "Agrupa-os, como um. Com o conteúdo de um após o outro."> Concatena </abbr> com um espaço no meio.
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### Edite-o
@@ -83,7 +83,7 @@ para:
 Esses são os "type hints":
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 Isso não é o mesmo que declarar valores padrão como seria com:
@@ -113,7 +113,7 @@ Com isso, você pode rolar, vendo as opções, até encontrar o que "toca uma ca
 Marque esta função, ela já possui type hints:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 Como o editor conhece os tipos de variáveis, você não apenas obtém a conclusão, mas também as verificações de erro:
@@ -123,7 +123,7 @@ Como o editor conhece os tipos de variáveis, você não apenas obtém a conclus
 Agora você sabe que precisa corrigí-lo, converta `age` em uma string com `str (age)`:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## Tipos de declaração
@@ -144,7 +144,7 @@ Você pode usar, por exemplo:
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### Tipos genéricos com parâmetros de tipo
@@ -162,7 +162,7 @@ Por exemplo, vamos definir uma variável para ser uma `lista` de `str`.
 Em `typing`, importe `List` (com um `L` maiúsculo):
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 Declare a variável com a mesma sintaxe de dois pontos (`:`).
@@ -172,7 +172,7 @@ Como o tipo, coloque a `List`.
 Como a lista é um tipo que contém alguns tipos internos, você os coloca entre colchetes:
 
 ```Python hl_lines="4"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 /// tip | "Dica"
@@ -200,7 +200,7 @@ E, ainda assim, o editor sabe que é um `str` e fornece suporte para isso.
 Você faria o mesmo para declarar `tuple`s e `set`s:
 
 ```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial007.py!}
+{!../../docs_src/python_types/tutorial007.py!}
 ```
 
 Isso significa que:
@@ -217,7 +217,7 @@ O primeiro parâmetro de tipo é para as chaves do `dict`.
 O segundo parâmetro de tipo é para os valores do `dict`:
 
 ```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial008.py!}
+{!../../docs_src/python_types/tutorial008.py!}
 ```
 
 Isso significa que:
@@ -231,7 +231,7 @@ Isso significa que:
 Você também pode usar o `Opcional` para declarar que uma variável tem um tipo, como `str`, mas que é "opcional", o que significa que também pode ser `None`:
 
 ```Python hl_lines="1 4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 O uso de `Opcional [str]` em vez de apenas `str` permitirá que o editor o ajude a detectar erros, onde você pode estar assumindo que um valor é sempre um `str`, quando na verdade também pode ser `None`.
@@ -256,13 +256,13 @@ Você também pode declarar uma classe como o tipo de uma variável.
 Digamos que você tenha uma classe `Person`, com um nome:
 
 ```Python hl_lines="1 2 3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Então você pode declarar que uma variável é do tipo `Person`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 E então, novamente, você recebe todo o suporte do editor:
@@ -284,7 +284,7 @@ E você recebe todo o suporte do editor com esse objeto resultante.
 Retirado dos documentos oficiais dos Pydantic:
 
 ```Python
-{!../../../docs_src/python_types/tutorial011.py!}
+{!../../docs_src/python_types/tutorial011.py!}
 ```
 
 /// info | "Informação"
index 625fa2b111d23175d21af0e0b796ad2cb4a7cb46..2b5f824648f6356772ff635e5dcb58150aaf9af4 100644 (file)
@@ -16,7 +16,7 @@ Isso inclui, por exemplo:
 Primeiro, importe `BackgroundTasks` e defina um parâmetro em sua _função de operação de caminho_ com uma declaração de tipo de `BackgroundTasks`:
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 O **FastAPI** criará o objeto do tipo `BackgroundTasks` para você e o passará como esse parâmetro.
@@ -34,7 +34,7 @@ Nesse caso, a função de tarefa gravará em um arquivo (simulando o envio de um
 E como a operação de gravação não usa `async` e `await`, definimos a função com `def` normal:
 
 ```Python hl_lines="6-9"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 ## Adicionar a tarefa em segundo plano
@@ -42,7 +42,7 @@ E como a operação de gravação não usa `async` e `await`, definimos a funç
 Dentro de sua _função de operação de caminho_, passe sua função de tarefa para o objeto _tarefas em segundo plano_ com o método `.add_task()`:
 
 ```Python hl_lines="14"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 `.add_task()` recebe como argumentos:
@@ -58,7 +58,7 @@ Usar `BackgroundTasks` também funciona com o sistema de injeção de dependênc
 O **FastAPI** sabe o que fazer em cada caso e como reutilizar o mesmo objeto, de forma que todas as tarefas em segundo plano sejam mescladas e executadas em segundo plano posteriormente:
 
 ```Python hl_lines="13  15  22  25"
-{!../../../docs_src/background_tasks/tutorial002.py!}
+{!../../docs_src/background_tasks/tutorial002.py!}
 ```
 
 Neste exemplo, as mensagens serão gravadas no arquivo `log.txt` _após_ o envio da resposta.
index 7137bf865d8eb30cb23b7cecda568e5d589dadf4..fcc30961f86f27d31e119b452f7c952316d40558 100644 (file)
@@ -86,7 +86,7 @@ Você pode criar as *operações de rotas* para esse módulo usando o `APIRouter
 você o importa e cria uma "instância" da mesma maneira que faria com a classe `FastAPI`:
 
 ```Python hl_lines="1  3" title="app/routers/users.py"
-{!../../../docs_src/bigger_applications/app/routers/users.py!}
+{!../../docs_src/bigger_applications/app/routers/users.py!}
 ```
 
 ### *Operações de Rota* com `APIRouter`
@@ -96,7 +96,7 @@ E então você o utiliza para declarar suas *operações de rota*.
 Utilize-o da mesma maneira que utilizaria a classe  `FastAPI`:
 
 ```Python hl_lines="6  11  16" title="app/routers/users.py"
-{!../../../docs_src/bigger_applications/app/routers/users.py!}
+{!../../docs_src/bigger_applications/app/routers/users.py!}
 ```
 
 Você pode pensar em `APIRouter` como uma classe "mini `FastAPI`".
@@ -124,7 +124,7 @@ Agora usaremos uma dependência simples para ler um cabeçalho `X-Token` persona
 //// tab | Python 3.9+
 
 ```Python hl_lines="3  6-8" title="app/dependencies.py"
-{!> ../../../docs_src/bigger_applications/app_an_py39/dependencies.py!}
+{!> ../../docs_src/bigger_applications/app_an_py39/dependencies.py!}
 ```
 
 ////
@@ -132,7 +132,7 @@ Agora usaremos uma dependência simples para ler um cabeçalho `X-Token` persona
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  5-7" title="app/dependencies.py"
-{!> ../../../docs_src/bigger_applications/app_an/dependencies.py!}
+{!> ../../docs_src/bigger_applications/app_an/dependencies.py!}
 ```
 
 ////
@@ -146,7 +146,7 @@ Prefira usar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="1  4-6" title="app/dependencies.py"
-{!> ../../../docs_src/bigger_applications/app/dependencies.py!}
+{!> ../../docs_src/bigger_applications/app/dependencies.py!}
 ```
 
 ////
@@ -182,7 +182,7 @@ Sabemos que todas as *operações de rota* neste módulo têm o mesmo:
 Então, em vez de adicionar tudo isso a cada *operação de rota*, podemos adicioná-lo ao `APIRouter`.
 
 ```Python hl_lines="5-10  16  21" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 Como o caminho de cada *operação de rota* deve começar com `/`, como em:
@@ -243,7 +243,7 @@ E precisamos obter a função de dependência do módulo `app.dependencies`, o a
 Então usamos uma importação relativa com `..` para as dependências:
 
 ```Python hl_lines="3" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 #### Como funcionam as importações relativas
@@ -316,7 +316,7 @@ Não estamos adicionando o prefixo `/items` nem `tags=["items"]` a cada *operaç
 Mas ainda podemos adicionar _mais_ `tags` que serão aplicadas a uma *operação de rota* específica, e também algumas `respostas` extras específicas para essa *operação de rota*:
 
 ```Python hl_lines="30-31" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 /// tip | "Dica"
@@ -344,7 +344,7 @@ Você importa e cria uma classe `FastAPI` normalmente.
 E podemos até declarar [dependências globais](dependencies/global-dependencies.md){.internal-link target=_blank} que serão combinadas com as dependências para cada `APIRouter`:
 
 ```Python hl_lines="1  3  7" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 ### Importe o `APIRouter`
@@ -352,7 +352,7 @@ E podemos até declarar [dependências globais](dependencies/global-dependencies
 Agora importamos os outros submódulos que possuem `APIRouter`s:
 
 ```Python hl_lines="4-5" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 Como os arquivos `app/routers/users.py` e `app/routers/items.py` são submódulos que fazem parte do mesmo pacote Python `app`, podemos usar um único ponto `.` para importá-los usando "importações relativas".
@@ -417,7 +417,7 @@ o `router` de `users` sobrescreveria o de `items` e não poderíamos usá-los ao
 Então, para poder usar ambos no mesmo arquivo, importamos os submódulos diretamente:
 
 ```Python hl_lines="5" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 ### Incluir o `APIRouter`s para `usuários` e `itens`
@@ -425,7 +425,7 @@ Então, para poder usar ambos no mesmo arquivo, importamos os submódulos direta
 Agora, vamos incluir os `roteadores` dos submódulos `usuários` e `itens`:
 
 ```Python hl_lines="10-11" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 /// info | "Informação"
@@ -467,7 +467,7 @@ Ele contém um `APIRouter` com algumas *operações de rota* de administração
 Para este exemplo, será super simples. Mas digamos que, como ele é compartilhado com outros projetos na organização, não podemos modificá-lo e adicionar um `prefix`, `dependencies`, `tags`, etc. diretamente ao `APIRouter`:
 
 ```Python hl_lines="3" title="app/internal/admin.py"
-{!../../../docs_src/bigger_applications/app/internal/admin.py!}
+{!../../docs_src/bigger_applications/app/internal/admin.py!}
 ```
 
 Mas ainda queremos definir um `prefixo` personalizado ao incluir o `APIRouter` para que todas as suas *operações de rota* comecem com `/admin`, queremos protegê-lo com as `dependências` que já temos para este projeto e queremos incluir `tags` e `responses`.
@@ -475,7 +475,7 @@ Mas ainda queremos definir um `prefixo` personalizado ao incluir o `APIRouter` p
 Podemos declarar tudo isso sem precisar modificar o `APIRouter` original passando esses parâmetros para `app.include_router()`:
 
 ```Python hl_lines="14-17" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 Dessa forma, o `APIRouter` original permanecerá inalterado, para que possamos compartilhar o mesmo arquivo `app/internal/admin.py` com outros projetos na organização.
@@ -498,7 +498,7 @@ Também podemos adicionar *operações de rota* diretamente ao aplicativo `FastA
 Aqui fazemos isso... só para mostrar que podemos 🤷:
 
 ```Python hl_lines="21-23" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 e funcionará corretamente, junto com todas as outras *operações de rota* adicionadas com `app.include_router()`.
index cce37cd55c417d6b63f6de87aabca08deff0d76f..ab9377fdb26989cd6d52f164dc561624d22aedb3 100644 (file)
@@ -7,7 +7,7 @@ Da mesma forma que você pode declarar validações adicionais e metadados nos p
 Primeiro, você tem que importá-lo:
 
 ```Python hl_lines="4"
-{!../../../docs_src/body_fields/tutorial001.py!}
+{!../../docs_src/body_fields/tutorial001.py!}
 ```
 
 /// warning | "Aviso"
@@ -21,7 +21,7 @@ Note que `Field` é importado diretamente do `pydantic`, não do `fastapi` como
 Você pode então utilizar `Field` com atributos do modelo:
 
 ```Python hl_lines="11-14"
-{!../../../docs_src/body_fields/tutorial001.py!}
+{!../../docs_src/body_fields/tutorial001.py!}
 ```
 
 `Field` funciona da mesma forma que `Query`, `Path` e `Body`, ele possui todos os mesmos parâmetros, etc.
index d36dd60b3027fafa2da359609bb4eece96f0ab5e..400813a7b94c8c2f56fae41dfa1767c3c05ec05a 100644 (file)
@@ -11,7 +11,7 @@ E você também pode declarar parâmetros de corpo como opcionais, definindo o v
 //// tab | Python 3.10+
 
 ```Python hl_lines="17-19"
-{!> ../../../docs_src/body_multiple_params/tutorial001_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@ E você também pode declarar parâmetros de corpo como opcionais, definindo o v
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-21"
-{!> ../../../docs_src/body_multiple_params/tutorial001.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001.py!}
 ```
 
 ////
@@ -48,7 +48,7 @@ Mas você pode também declarar múltiplos parâmetros de corpo, por exemplo, `i
 //// tab | Python 3.10+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial002_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -56,7 +56,7 @@ Mas você pode também declarar múltiplos parâmetros de corpo, por exemplo, `i
 //// tab | Python 3.8+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial002.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002.py!}
 ```
 
 ////
@@ -103,7 +103,7 @@ Mas você pode instruir o **FastAPI** para tratá-lo como outra chave do corpo u
 //// tab | Python 3.8+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial003.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003.py!}
 ```
 
 ////
@@ -111,7 +111,7 @@ Mas você pode instruir o **FastAPI** para tratá-lo como outra chave do corpo u
 //// tab | Python 3.10+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial003_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -157,7 +157,7 @@ Por exemplo:
 //// tab | Python 3.10+
 
 ```Python hl_lines="26"
-{!> ../../../docs_src/body_multiple_params/tutorial004_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -165,7 +165,7 @@ Por exemplo:
 //// tab | Python 3.8+
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004.py!}
 ```
 
 ////
@@ -193,7 +193,7 @@ como em:
 //// tab | Python 3.10+
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/body_multiple_params/tutorial005_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_py310.py!}
 ```
 
 ////
@@ -201,7 +201,7 @@ como em:
 //// tab | Python 3.8+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005.py!}
 ```
 
 ////
index 7d933b27fcdef19d83fb791857239eaef6331e11..3aa79d563f5a33b11d7e128b764e63c2c64ea1e6 100644 (file)
@@ -7,7 +7,7 @@ Com o **FastAPI**, você pode definir, validar, documentar e usar modelos profun
 Você pode definir um atributo como um subtipo. Por exemplo, uma `list` do Python:
 
 ```Python hl_lines="14"
-{!../../../docs_src/body_nested_models/tutorial001.py!}
+{!../../docs_src/body_nested_models/tutorial001.py!}
 ```
 
 Isso fará com que tags seja uma lista de itens mesmo sem declarar o tipo dos elementos desta lista.
@@ -21,7 +21,7 @@ Mas o Python tem uma maneira específica de declarar listas com tipos internos o
 Primeiramente, importe `List` do módulo `typing` que já vem por padrão no Python:
 
 ```Python hl_lines="1"
-{!../../../docs_src/body_nested_models/tutorial002.py!}
+{!../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ### Declare a `List` com um parâmetro de tipo
@@ -45,7 +45,7 @@ Portanto, em nosso exemplo, podemos fazer com que `tags` sejam especificamente u
 
 
 ```Python hl_lines="14"
-{!../../../docs_src/body_nested_models/tutorial002.py!}
+{!../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ## Tipo "set"
@@ -59,7 +59,7 @@ Então podemos importar `Set` e declarar `tags` como um `set` de `str`s:
 
 
 ```Python hl_lines="1  14"
-{!../../../docs_src/body_nested_models/tutorial003.py!}
+{!../../docs_src/body_nested_models/tutorial003.py!}
 ```
 
 Com isso, mesmo que você receba uma requisição contendo dados duplicados, ela será convertida em um conjunto de itens exclusivos.
@@ -83,7 +83,7 @@ Tudo isso, aninhado arbitrariamente.
 Por exemplo, nós podemos definir um modelo `Image`:
 
 ```Python hl_lines="9-11"
-{!../../../docs_src/body_nested_models/tutorial004.py!}
+{!../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ### Use o sub-modelo como um tipo
@@ -91,7 +91,7 @@ Por exemplo, nós podemos definir um modelo `Image`:
 E então podemos usa-lo como o tipo de um atributo:
 
 ```Python hl_lines="20"
-{!../../../docs_src/body_nested_models/tutorial004.py!}
+{!../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 Isso significa que o **FastAPI** vai esperar um corpo similar à:
@@ -126,7 +126,7 @@ Para ver todas as opções possíveis, cheque a documentação para os<a href="h
 Por exemplo, no modelo `Image` nós temos um campo `url`, nós podemos declara-lo como um `HttpUrl` do Pydantic invés de como uma `str`:
 
 ```Python hl_lines="4  10"
-{!../../../docs_src/body_nested_models/tutorial005.py!}
+{!../../docs_src/body_nested_models/tutorial005.py!}
 ```
 
 A string será verificada para se tornar uma URL válida e documentada no esquema JSON/1OpenAPI como tal.
@@ -136,7 +136,7 @@ A string será verificada para se tornar uma URL válida e documentada no esquem
 Você também pode usar modelos Pydantic como subtipos de `list`, `set`, etc:
 
 ```Python hl_lines="20"
-{!../../../docs_src/body_nested_models/tutorial006.py!}
+{!../../docs_src/body_nested_models/tutorial006.py!}
 ```
 
 Isso vai esperar(converter, validar, documentar, etc) um corpo JSON tal qual:
@@ -176,7 +176,7 @@ Note como o campo `images` agora tem uma lista de objetos de image.
 Você pode definir modelos profundamente aninhados de forma arbitrária:
 
 ```Python hl_lines="9  14  20  23  27"
-{!../../../docs_src/body_nested_models/tutorial007.py!}
+{!../../docs_src/body_nested_models/tutorial007.py!}
 ```
 
 /// info | "informação"
@@ -197,7 +197,7 @@ images: List[Image]
 como em:
 
 ```Python hl_lines="15"
-{!../../../docs_src/body_nested_models/tutorial008.py!}
+{!../../docs_src/body_nested_models/tutorial008.py!}
 ```
 
 ## Suporte de editor em todo canto
@@ -229,7 +229,7 @@ Outro caso útil é quando você deseja ter chaves de outro tipo, por exemplo, `
 Neste caso, você aceitaria qualquer `dict`, desde que tenha chaves` int` com valores `float`:
 
 ```Python hl_lines="9"
-{!../../../docs_src/body_nested_models/tutorial009.py!}
+{!../../docs_src/body_nested_models/tutorial009.py!}
 ```
 
 /// tip | "Dica"
index f67687fb50adfbdc13ef0a95d5363dc9ae4bdf25..429e4fd5ac6ea62eaa78879bd03d8b9ea4612322 100644 (file)
@@ -23,7 +23,7 @@ Como é desencorajado, a documentação interativa com Swagger UI não irá most
 Primeiro, você precisa importar `BaseModel` do `pydantic`:
 
 ```Python hl_lines="4"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
 ```
 
 ## Crie seu modelo de dados
@@ -33,7 +33,7 @@ Então você declara seu modelo de dados como uma classe que herda `BaseModel`.
 Utilize os tipos Python padrão para todos os atributos:
 
 ```Python hl_lines="7-11"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
 ```
 
 Assim como quando declaramos parâmetros de consulta, quando um atributo do modelo possui um valor padrão, ele se torna opcional. Caso contrário, se torna obrigatório. Use `None` para torná-lo opcional.
@@ -63,7 +63,7 @@ Por exemplo, o modelo acima declara um JSON "`object`" (ou `dict` no Python) com
 Para adicionar o corpo na *função de operação de rota*, declare-o da mesma maneira que você declarou parâmetros de rota e consulta:
 
 ```Python hl_lines="18"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
 ```
 
 ...E declare o tipo como o modelo que você criou, `Item`.
@@ -132,7 +132,7 @@ Melhora o suporte do editor para seus modelos Pydantic com::
 Dentro da função, você pode acessar todos os atributos do objeto do modelo diretamente:
 
 ```Python hl_lines="21"
-{!../../../docs_src/body/tutorial002.py!}
+{!../../docs_src/body/tutorial002.py!}
 ```
 
 ## Corpo da requisição + parâmetros de rota
@@ -142,7 +142,7 @@ Você pode declarar parâmetros de rota e corpo da requisição ao mesmo tempo.
 O **FastAPI** irá reconhecer que os parâmetros da função que combinam com parâmetros de rota devem ser **retirados da rota**, e parâmetros da função que são declarados como modelos Pydantic sejam **retirados do corpo da requisição**.
 
 ```Python hl_lines="17-18"
-{!../../../docs_src/body/tutorial003.py!}
+{!../../docs_src/body/tutorial003.py!}
 ```
 
 ## Corpo da requisição + parâmetros de rota + parâmetros de consulta
@@ -152,7 +152,7 @@ Você também pode declarar parâmetros de **corpo**, **rota** e **consulta**, a
 O **FastAPI** irá reconhecer cada um deles e retirar a informação do local correto.
 
 ```Python hl_lines="18"
-{!../../../docs_src/body/tutorial004.py!}
+{!../../docs_src/body/tutorial004.py!}
 ```
 
 Os parâmetros da função serão reconhecidos conforme abaixo:
index bb59dcd2c16df72da2f1fc2385eeff0849eefe32..50bec8cf7f3ec2ed60ce19b34fb2c293cc8151d1 100644 (file)
@@ -9,7 +9,7 @@ Primeiro importe `Cookie`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Primeiro importe `Cookie`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Primeiro importe `Cookie`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
@@ -68,7 +68,7 @@ Você pode definir o valor padrão, assim como todas as validações extras ou p
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -76,7 +76,7 @@ Você pode definir o valor padrão, assim como todas as validações extras ou p
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@ Você pode definir o valor padrão, assim como todas as validações extras ou p
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -98,7 +98,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -112,7 +112,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
index e5e2f8c277398ed04f7aa6c3d442d5cf54c0ca76..16c4e9bf5dca1819de99908ada51db92be13b5e6 100644 (file)
@@ -47,7 +47,7 @@ Você também pode especificar se o seu backend permite:
 * Cabeçalhos HTTP específicos ou todos eles com o curinga `"*"`.
 
 ```Python hl_lines="2  6-11  13-19"
-{!../../../docs_src/cors/tutorial001.py!}
+{!../../docs_src/cors/tutorial001.py!}
 ```
 
 Os parâmetros padrão usados ​​pela implementação `CORSMiddleware` são restritivos por padrão, então você precisará habilitar explicitamente as origens, métodos ou cabeçalhos específicos para que os navegadores tenham permissão para usá-los em um contexto de domínios diferentes.
index 54582fcbcb0738bea9bb5c491cdac05802813da3..6bac7eb85e451f4799a3ba25411edec94089cfc5 100644 (file)
@@ -7,7 +7,7 @@ Você pode conectar o depurador no seu editor, por exemplo, com o Visual Studio
 Em seu aplicativo FastAPI, importe e execute `uvicorn` diretamente:
 
 ```Python hl_lines="1  15"
-{!../../../docs_src/debugging/tutorial001.py!}
+{!../../docs_src/debugging/tutorial001.py!}
 ```
 
 ### Sobre `__name__ == "__main__"`
index 420503b8786e2263a32b966b38de08c1ba88580c..179bfefb52209e368e85258ab57cc47b43540706 100644 (file)
@@ -9,7 +9,7 @@ No exemplo anterior, nós retornávamos um `dict` da nossa dependência ("injet
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ No exemplo anterior, nós retornávamos um `dict` da nossa dependência ("injet
 //// tab | Python 3.9+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ No exemplo anterior, nós retornávamos um `dict` da nossa dependência ("injet
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -122,7 +122,7 @@ Então, podemos mudar o "injetável" na dependência `common_parameters` acima p
 //// tab | Python 3.10+
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -130,7 +130,7 @@ Então, podemos mudar o "injetável" na dependência `common_parameters` acima p
 //// tab | Python 3.9+
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -138,7 +138,7 @@ Então, podemos mudar o "injetável" na dependência `common_parameters` acima p
 //// tab | Python 3.8+
 
 ```Python hl_lines="12-16"
-{!> ../../../docs_src/dependencies/tutorial002_an.py!}
+{!> ../../docs_src/dependencies/tutorial002_an.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="9-13"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -166,7 +166,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -176,7 +176,7 @@ Observe o método `__init__` usado para criar uma instância da classe:
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -184,7 +184,7 @@ Observe o método `__init__` usado para criar uma instância da classe:
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -192,7 +192,7 @@ Observe o método `__init__` usado para criar uma instância da classe:
 //// tab | Python 3.8+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial002_an.py!}
+{!> ../../docs_src/dependencies/tutorial002_an.py!}
 ```
 
 ////
@@ -206,7 +206,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -220,7 +220,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -230,7 +230,7 @@ Utilize a versão com `Annotated` se possível.
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -238,7 +238,7 @@ Utilize a versão com `Annotated` se possível.
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -246,7 +246,7 @@ Utilize a versão com `Annotated` se possível.
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -260,7 +260,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -274,7 +274,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -296,7 +296,7 @@ Agora você pode declarar sua dependência utilizando essa classe.
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -304,7 +304,7 @@ Agora você pode declarar sua dependência utilizando essa classe.
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -312,7 +312,7 @@ Agora você pode declarar sua dependência utilizando essa classe.
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial002_an.py!}
+{!> ../../docs_src/dependencies/tutorial002_an.py!}
 ```
 
 ////
@@ -326,7 +326,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -340,7 +340,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -440,7 +440,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -448,7 +448,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -456,7 +456,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial003_an.py!}
+{!> ../../docs_src/dependencies/tutorial003_an.py!}
 ```
 
 ////
@@ -470,7 +470,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial003_py310.py!}
+{!> ../../docs_src/dependencies/tutorial003_py310.py!}
 ```
 
 ////
@@ -484,7 +484,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003.py!}
+{!> ../../docs_src/dependencies/tutorial003.py!}
 ```
 
 ////
@@ -578,7 +578,7 @@ O mesmo exemplo ficaria então dessa forma:
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -586,7 +586,7 @@ O mesmo exemplo ficaria então dessa forma:
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -594,7 +594,7 @@ O mesmo exemplo ficaria então dessa forma:
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial004_an.py!}
+{!> ../../docs_src/dependencies/tutorial004_an.py!}
 ```
 
 ////
@@ -608,7 +608,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial004_py310.py!}
+{!> ../../docs_src/dependencies/tutorial004_py310.py!}
 ```
 
 ////
@@ -622,7 +622,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004.py!}
+{!> ../../docs_src/dependencies/tutorial004.py!}
 ```
 
 ////
index 4a7a29390131cdaa24ffe68b1445a23771edc425..7d70869456fb4f7e4a1282e22cd96d8662beec69 100644 (file)
@@ -17,7 +17,7 @@ Ele deve ser uma lista de `Depends()`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Ele deve ser uma lista de `Depends()`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Utilize a versão com `Annotated` se possível
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Dependências podem declarar requisitos de requisições (como cabeçalhos) ou o
 //// tab | Python 3.9+
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@ Dependências podem declarar requisitos de requisições (como cabeçalhos) ou o
 //// tab | Python 3.8+
 
 ```Python hl_lines="7  12"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ Utilize a versão com `Annotated` se possível
 ///
 
 ```Python hl_lines="6  11"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
@@ -109,7 +109,7 @@ Essas dependências podem levantar exceções, da mesma forma que dependências
 //// tab | Python 3.9+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Essas dependências podem levantar exceções, da mesma forma que dependências
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  14"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -131,7 +131,7 @@ Utilize a versão com `Annotated` se possível
 ///
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
@@ -145,7 +145,7 @@ Então, você pode reutilizar uma dependência comum (que retorna um valor) que
 //// tab | Python 3.9+
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -153,7 +153,7 @@ Então, você pode reutilizar uma dependência comum (que retorna um valor) que
 //// tab | Python 3.8+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -169,7 +169,7 @@ Então, você pode reutilizar uma dependência comum (que retorna um valor) que
    Utilize a versão com `Annotated` se possível
 
 ```Python hl_lines="9  14"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
index 16c2cf8997f843e5dcaaea75b866359eca1b471f..d90bebe397bb6945ed9a3f57847bd20ef2370576 100644 (file)
@@ -30,19 +30,19 @@ Por exemplo, você poderia utilizar isso para criar uma sessão do banco de dado
 Apenas o código anterior a declaração com `yield` e o código contendo essa declaração são executados antes de criar uma resposta.
 
 ```Python hl_lines="2-4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 O valor gerado (yielded) é o que é injetado nas *operações de rota* e outras dependências.
 
 ```Python hl_lines="4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 O código após o `yield` é executado após a resposta ser entregue:
 
 ```Python hl_lines="5-6"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 /// tip | "Dica"
@@ -64,7 +64,7 @@ Então, você pode procurar por essa exceção específica dentro da dependênci
 Da mesma forma, você pode utilizar `finally` para garantir que os passos de saída são executados, com ou sem exceções.
 
 ```python hl_lines="3  5"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 ## Subdependências com `yield`
@@ -78,7 +78,7 @@ Por exemplo, `dependency_c` pode depender de `dependency_b`, e `dependency_b` de
 //// tab | python 3.9+
 
 ```python hl_lines="6  14  22"
-{!> ../../../docs_src/dependencies/tutorial008_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -86,7 +86,7 @@ Por exemplo, `dependency_c` pode depender de `dependency_b`, e `dependency_b` de
 //// tab | python 3.8+
 
 ```python hl_lines="5  13  21"
-{!> ../../../docs_src/dependencies/tutorial008_an.py!}
+{!> ../../docs_src/dependencies/tutorial008_an.py!}
 ```
 
 ////
@@ -100,7 +100,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```python hl_lines="4  12  20"
-{!> ../../../docs_src/dependencies/tutorial008.py!}
+{!> ../../docs_src/dependencies/tutorial008.py!}
 ```
 
 ////
@@ -114,7 +114,7 @@ E, por outro lado, `dependency_b` precisa que o valor de `dependency_a` (nomeada
 //// tab | python 3.9+
 
 ```python hl_lines="18-19  26-27"
-{!> ../../../docs_src/dependencies/tutorial008_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -122,7 +122,7 @@ E, por outro lado, `dependency_b` precisa que o valor de `dependency_a` (nomeada
 //// tab | python 3.8+
 
 ```python hl_lines="17-18  25-26"
-{!> ../../../docs_src/dependencies/tutorial008_an.py!}
+{!> ../../docs_src/dependencies/tutorial008_an.py!}
 ```
 
 ////
@@ -136,7 +136,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```python hl_lines="16-17  24-25"
-{!> ../../../docs_src/dependencies/tutorial008.py!}
+{!> ../../docs_src/dependencies/tutorial008.py!}
 ```
 
 ////
@@ -174,7 +174,7 @@ Mas ela existe para ser utilizada caso você precise. 🤓
 //// tab | python 3.9+
 
 ```python hl_lines="18-22  31"
-{!> ../../../docs_src/dependencies/tutorial008b_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008b_an_py39.py!}
 ```
 
 ////
@@ -182,7 +182,7 @@ Mas ela existe para ser utilizada caso você precise. 🤓
 //// tab | python 3.8+
 
 ```python hl_lines="17-21  30"
-{!> ../../../docs_src/dependencies/tutorial008b_an.py!}
+{!> ../../docs_src/dependencies/tutorial008b_an.py!}
 ```
 
 ////
@@ -196,7 +196,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```python hl_lines="16-20  29"
-{!> ../../../docs_src/dependencies/tutorial008b.py!}
+{!> ../../docs_src/dependencies/tutorial008b.py!}
 ```
 
 ////
@@ -210,7 +210,7 @@ Se você capturar uma exceção com `except` em uma dependência que utilize `yi
 //// tab | Python 3.9+
 
 ```Python hl_lines="15-16"
-{!> ../../../docs_src/dependencies/tutorial008c_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008c_an_py39.py!}
 ```
 
 ////
@@ -218,7 +218,7 @@ Se você capturar uma exceção com `except` em uma dependência que utilize `yi
 //// tab | Python 3.8+
 
 ```Python hl_lines="14-15"
-{!> ../../../docs_src/dependencies/tutorial008c_an.py!}
+{!> ../../docs_src/dependencies/tutorial008c_an.py!}
 ```
 
 ////
@@ -232,7 +232,7 @@ utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="13-14"
-{!> ../../../docs_src/dependencies/tutorial008c.py!}
+{!> ../../docs_src/dependencies/tutorial008c.py!}
 ```
 
 ////
@@ -248,7 +248,7 @@ Você pode relançar a mesma exceção utilizando `raise`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial008d_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008d_an_py39.py!}
 ```
 
 ////
@@ -256,7 +256,7 @@ Você pode relançar a mesma exceção utilizando `raise`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial008d_an.py!}
+{!> ../../docs_src/dependencies/tutorial008d_an.py!}
 ```
 
 ////
@@ -270,7 +270,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/dependencies/tutorial008d.py!}
+{!> ../../docs_src/dependencies/tutorial008d.py!}
 ```
 
 ////
@@ -403,7 +403,7 @@ Em python, você pode criar Gerenciadores de Contexto ao <a href="https://docs.p
 Você também pode usá-los dentro de dependências com `yield` do **FastAPI** ao utilizar `with` ou `async with` dentro da função da dependência:
 
 ```Python hl_lines="1-9  13"
-{!../../../docs_src/dependencies/tutorial010.py!}
+{!../../docs_src/dependencies/tutorial010.py!}
 ```
 
 /// tip | "Dica"
index 96dbaee5e9fa97d7d2823a506886bed0c2d41a70..60a88940c25ce52af540327cf8491af3334cddeb 100644 (file)
@@ -9,7 +9,7 @@ Nesse caso, elas serão aplicadas a todas as *operações de rota* da aplicaçã
 //// tab | Python 3.9+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial012_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial012_an_py39.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Nesse caso, elas serão aplicadas a todas as *operações de rota* da aplicaçã
 //// tab | Python 3.8+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial012_an.py!}
+{!> ../../docs_src/dependencies/tutorial012_an.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/dependencies/tutorial012.py!}
+{!> ../../docs_src/dependencies/tutorial012.py!}
 ```
 
 ////
index f7b32966ca19c291b20a8c944d23edb472dfa064..2a63e7ab8ea40183288edf4bd8a2ea86ba32c62f 100644 (file)
@@ -34,7 +34,7 @@ Ela é apenas uma função que pode receber os mesmos parâmetros de uma *funç
 //// tab | Python 3.10+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -42,7 +42,7 @@ Ela é apenas uma função que pode receber os mesmos parâmetros de uma *funç
 //// tab | Python 3.9+
 
 ```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -50,7 +50,7 @@ Ela é apenas uma função que pode receber os mesmos parâmetros de uma *funç
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-12"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -64,7 +64,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="6-7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -78,7 +78,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ Certifique-se de [Atualizar a versão do FastAPI](../../deployment/versions.md#a
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -124,7 +124,7 @@ Certifique-se de [Atualizar a versão do FastAPI](../../deployment/versions.md#a
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -132,7 +132,7 @@ Certifique-se de [Atualizar a versão do FastAPI](../../deployment/versions.md#a
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -146,7 +146,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -160,7 +160,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ Da mesma forma que você utiliza `Body`, `Query`, etc. Como parâmetros de sua *
 //// tab | Python 3.10+
 
 ```Python hl_lines="13  18"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ Da mesma forma que você utiliza `Body`, `Query`, etc. Como parâmetros de sua *
 //// tab | Python 3.9+
 
 ```Python hl_lines="15  20"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -188,7 +188,7 @@ Da mesma forma que você utiliza `Body`, `Query`, etc. Como parâmetros de sua *
 //// tab | Python 3.8+
 
 ```Python hl_lines="16  21"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -202,7 +202,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -216,7 +216,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="15  20"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -279,7 +279,7 @@ Mas como estamos utilizando `Annotated`, podemos guardar esse valor `Annotated`
 //// tab | Python 3.10+
 
 ```Python hl_lines="12  16  21"
-{!> ../../../docs_src/dependencies/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an_py310.py!}
 ```
 
 ////
@@ -287,7 +287,7 @@ Mas como estamos utilizando `Annotated`, podemos guardar esse valor `Annotated`
 //// tab | Python 3.9+
 
 ```Python hl_lines="14  18  23"
-{!> ../../../docs_src/dependencies/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an_py39.py!}
 ```
 
 ////
@@ -295,7 +295,7 @@ Mas como estamos utilizando `Annotated`, podemos guardar esse valor `Annotated`
 //// tab | Python 3.8+
 
 ```Python hl_lines="15  19  24"
-{!> ../../../docs_src/dependencies/tutorial001_02_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an.py!}
 ```
 
 ////
index 279bf3339549411062559e4910c22c622cff2eea..b890fe79312f29ccc5e79d43ad556d60c5c818f9 100644 (file)
@@ -13,7 +13,7 @@ Você pode criar uma primeira dependência (injetável) dessa forma:
 //// tab | Python 3.10+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -21,7 +21,7 @@ Você pode criar uma primeira dependência (injetável) dessa forma:
 //// tab | Python 3.9+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -29,7 +29,7 @@ Você pode criar uma primeira dependência (injetável) dessa forma:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-10"
-{!> ../../../docs_src/dependencies/tutorial005_an.py!}
+{!> ../../docs_src/dependencies/tutorial005_an.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="6-7"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@ Então, você pode criar uma outra função para uma dependência (um "injetáve
 //// tab | Python 3.10+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -81,7 +81,7 @@ Então, você pode criar uma outra função para uma dependência (um "injetáve
 //// tab | Python 3.9+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -89,7 +89,7 @@ Então, você pode criar uma outra função para uma dependência (um "injetáve
 //// tab | Python 3.8+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/dependencies/tutorial005_an.py!}
+{!> ../../docs_src/dependencies/tutorial005_an.py!}
 ```
 
 ////
@@ -103,7 +103,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
@@ -136,7 +136,7 @@ Então podemos utilizar a dependência com:
 //// tab | Python 3.10+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/dependencies/tutorial005_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -144,7 +144,7 @@ Então podemos utilizar a dependência com:
 //// tab | Python 3.9+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/dependencies/tutorial005_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ Então podemos utilizar a dependência com:
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/dependencies/tutorial005_an.py!}
+{!> ../../docs_src/dependencies/tutorial005_an.py!}
 ```
 
 ////
@@ -166,7 +166,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
index c104098eea981e871e67e3b9f55c55ba208a8d38..c8ce77e743e16cb9c86d234a057f4f03762cdfe4 100644 (file)
@@ -23,7 +23,7 @@ A função recebe um objeto, como um modelo Pydantic e retorna uma versão compa
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  21"
-{!> ../../../docs_src/encoder/tutorial001_py310.py!}
+{!> ../../docs_src/encoder/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ A função recebe um objeto, como um modelo Pydantic e retorna uma versão compa
 //// tab | Python 3.8+
 
 ```Python hl_lines="5  22"
-{!> ../../../docs_src/encoder/tutorial001.py!}
+{!> ../../docs_src/encoder/tutorial001.py!}
 ```
 
 ////
index 5d50d89424ac5e57e99f3fe7f01c909b33626630..78f7ac6947be7d7c45e8a28d11092fa2706b56aa 100644 (file)
@@ -56,11 +56,11 @@ Aqui estão alguns dos tipos de dados adicionais que você pode usar:
 Aqui está um exemplo de *operação de rota* com parâmetros utilizando-se de alguns dos tipos acima.
 
 ```Python hl_lines="1  3  12-16"
-{!../../../docs_src/extra_data_types/tutorial001.py!}
+{!../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 Note que os parâmetros dentro da função tem seu tipo de dados natural, e você pode, por exemplo, realizar manipulações normais de data, como:
 
 ```Python hl_lines="18-19"
-{!../../../docs_src/extra_data_types/tutorial001.py!}
+{!../../docs_src/extra_data_types/tutorial001.py!}
 ```
index 564aeadca6c68bd9b9f8034f0235ba445fef15aa..03227f2bb3cfa802fadc80758ec89954c42ea81d 100644 (file)
@@ -23,7 +23,7 @@ Aqui está uma ideia geral de como os modelos poderiam parecer com seus campos d
 //// tab | Python 3.8 and above
 
 ```Python hl_lines="9  11  16  22  24  29-30  33-35  40-41"
-{!> ../../../docs_src/extra_models/tutorial001.py!}
+{!> ../../docs_src/extra_models/tutorial001.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Aqui está uma ideia geral de como os modelos poderiam parecer com seus campos d
 //// tab | Python 3.10 and above
 
 ```Python hl_lines="7  9  14  20  22  27-28  31-33  38-39"
-{!> ../../../docs_src/extra_models/tutorial001_py310.py!}
+{!> ../../docs_src/extra_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ Dessa forma, podemos declarar apenas as diferenças entre os modelos (com `passw
 //// tab | Python 3.8 and above
 
 ```Python hl_lines="9  15-16  19-20  23-24"
-{!> ../../../docs_src/extra_models/tutorial002.py!}
+{!> ../../docs_src/extra_models/tutorial002.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Dessa forma, podemos declarar apenas as diferenças entre os modelos (com `passw
 //// tab | Python 3.10 and above
 
 ```Python hl_lines="7  13-14  17-18  21-22"
-{!> ../../../docs_src/extra_models/tutorial002_py310.py!}
+{!> ../../docs_src/extra_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -201,7 +201,7 @@ Ao definir um <a href="https://docs.pydantic.dev/latest/concepts/types/#unions"
 //// tab | Python 3.8 and above
 
 ```Python hl_lines="1  14-15  18-20  33"
-{!> ../../../docs_src/extra_models/tutorial003.py!}
+{!> ../../docs_src/extra_models/tutorial003.py!}
 ```
 
 ////
@@ -209,7 +209,7 @@ Ao definir um <a href="https://docs.pydantic.dev/latest/concepts/types/#unions"
 //// tab | Python 3.10 and above
 
 ```Python hl_lines="1  14-15  18-20  33"
-{!> ../../../docs_src/extra_models/tutorial003_py310.py!}
+{!> ../../docs_src/extra_models/tutorial003_py310.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ Para isso, use o padrão Python `typing.List` (ou simplesmente `list` no Python
 //// tab | Python 3.8 and above
 
 ```Python hl_lines="1  20"
-{!> ../../../docs_src/extra_models/tutorial004.py!}
+{!> ../../docs_src/extra_models/tutorial004.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ Para isso, use o padrão Python `typing.List` (ou simplesmente `list` no Python
 //// tab | Python 3.9 and above
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/extra_models/tutorial004_py39.py!}
+{!> ../../docs_src/extra_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -261,7 +261,7 @@ Neste caso, você pode usar `typing.Dict` (ou simplesmente dict no Python 3.9 e
 //// tab | Python 3.8 and above
 
 ```Python hl_lines="1  8"
-{!> ../../../docs_src/extra_models/tutorial005.py!}
+{!> ../../docs_src/extra_models/tutorial005.py!}
 ```
 
 ////
@@ -269,7 +269,7 @@ Neste caso, você pode usar `typing.Dict` (ou simplesmente dict no Python 3.9 e
 //// tab | Python 3.9 and above
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/extra_models/tutorial005_py39.py!}
+{!> ../../docs_src/extra_models/tutorial005_py39.py!}
 ```
 
 ////
index 4c2a8a8e3cb9ea2fd0be4b0ecb84218813949776..4990b5984d5b1791675dbc83026acea386122734 100644 (file)
@@ -3,7 +3,7 @@
 O arquivo FastAPI mais simples pode se parecer com:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Copie o conteúdo para um arquivo `main.py`.
@@ -134,7 +134,7 @@ Você também pode usá-lo para gerar código automaticamente para clientes que
 ### Passo 1: importe `FastAPI`
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI` é uma classe Python que fornece todas as funcionalidades para sua API.
@@ -150,7 +150,7 @@ Você pode usar todas as funcionalidades do <a href="https://www.starlette.io/"
 ### Passo 2: crie uma "instância" de `FastAPI`
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Aqui, a variável `app` será uma "instância" da classe `FastAPI`.
@@ -172,7 +172,7 @@ $ uvicorn main:app --reload
 Se você criar a sua aplicação como:
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
 ```
 
 E colocar em um arquivo `main.py`, você iria chamar o `uvicorn` assim:
@@ -251,7 +251,7 @@ Vamos chamá-los de "**operações**" também.
 #### Defina um *decorador de rota*
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 O `@app.get("/")` diz ao **FastAPI** que a função logo abaixo é responsável por tratar as requisições que vão para:
@@ -307,7 +307,7 @@ Esta é a nossa "**função de rota**":
 * **função**: é a função abaixo do "decorador" (abaixo do `@app.get("/")`).
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Esta é uma função Python.
@@ -321,7 +321,7 @@ Neste caso, é uma função `assíncrona`.
 Você também pode defini-la como uma função normal em vez de `async def`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note | "Nota"
@@ -333,7 +333,7 @@ Se você não sabe a diferença, verifique o [Async: *"Com pressa?"*](../async.m
 ### Passo 5: retorne o conteúdo
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Você pode retornar um `dict`, `list` e valores singulares como `str`, `int`, etc.
index 6bebf604e364cf839d888e975febe1a8376c4eee..4a042f2195b14b46ed5bacbead0954d2b0cc74cc 100644 (file)
@@ -27,7 +27,7 @@ Para retornar ao cliente *responses* HTTP com erros, use o `HTTPException`.
 ### Import `HTTPException`
 
 ```Python hl_lines="1"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 ```
 
 ### Lance o `HTTPException` no seu código.
@@ -43,7 +43,7 @@ O benefício de lançar uma exceção em vez de retornar um valor ficará mais e
 Neste exemplo, quando o cliente pede, na requisição, por um item cujo ID não existe, a exceção com o status code `404` é lançada:
 
 ```Python hl_lines="11"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 ```
 
 ### A response resultante
@@ -84,7 +84,7 @@ Você provavelmente não precisará utilizar esses headers diretamente no seu c
 Mas caso você precise, para um cenário mais complexo, você pode adicionar headers customizados:
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial002.py!}
+{!../../docs_src/handling_errors/tutorial002.py!}
 ```
 
 ## Instalando manipuladores de exceções customizados
@@ -96,7 +96,7 @@ Digamos que você tenha uma exceção customizada `UnicornException` que você (
 Nesse cenário, se você precisa manipular essa exceção de modo global com o FastAPI, você pode adicionar um manipulador de exceção customizada com `@app.exception_handler()`.
 
 ```Python hl_lines="5-7  13-18  24"
-{!../../../docs_src/handling_errors/tutorial003.py!}
+{!../../docs_src/handling_errors/tutorial003.py!}
 ```
 
 Nesse cenário, se você fizer uma requisição para `/unicorns/yolo`, a *operação de caminho* vai lançar (`raise`) o `UnicornException`.
@@ -132,7 +132,7 @@ Quando a requisição contém dados inválidos, **FastAPI** internamente lança
 Para sobrescrevê-lo, importe o `RequestValidationError` e use-o com o `@app.exception_handler(RequestValidationError)` para decorar o manipulador de exceções.
 
 ```Python hl_lines="2  14-16"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 ```
 
 Se você for ao `/items/foo`, em vez de receber o JSON padrão com o erro:
@@ -183,7 +183,7 @@ Do mesmo modo, você pode sobreescrever o `HTTPException`.
 Por exemplo, você pode querer retornar uma *response* em *plain text* ao invés de um JSON para os seguintes erros:
 
 ```Python hl_lines="3-4  9-11  22"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 ```
 
 /// note | "Detalhes Técnicos"
@@ -255,7 +255,7 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
 Se você quer usar a exceção em conjunto com o mesmo manipulador de exceção *default* do **FastAPI**, você pode importar e re-usar esses manipuladores de exceção do `fastapi.exception_handlers`:
 
 ```Python hl_lines="2-5  15  21"
-{!../../../docs_src/handling_errors/tutorial006.py!}
+{!../../docs_src/handling_errors/tutorial006.py!}
 ```
 
 Nesse exemplo você apenas imprime (`print`) o erro com uma mensagem expressiva. Mesmo assim, dá para pegar a ideia. Você pode usar a exceção e então apenas re-usar o manipulador de exceção *default*.
index 809fb5cf1ab2ecb626a54732a72654d44f118ad1..f7be2b0b75aadcf63242a03fe2678bb901dc0366 100644 (file)
@@ -9,7 +9,7 @@ Primeiro importe `Header`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/header_params/tutorial001_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Primeiro importe `Header`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001.py!}
+{!> ../../docs_src/header_params/tutorial001.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ O primeiro valor é o valor padrão, você pode passar todas as validações adi
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/header_params/tutorial001_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ O primeiro valor é o valor padrão, você pode passar todas as validações adi
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001.py!}
+{!> ../../docs_src/header_params/tutorial001.py!}
 ```
 
 ////
@@ -77,7 +77,7 @@ Se por algum motivo você precisar desabilitar a conversão automática de subli
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/header_params/tutorial002_py310.py!}
+{!> ../../docs_src/header_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -85,7 +85,7 @@ Se por algum motivo você precisar desabilitar a conversão automática de subli
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial002.py!}
+{!> ../../docs_src/header_params/tutorial002.py!}
 ```
 
 ////
@@ -109,7 +109,7 @@ Por exemplo, para declarar um cabeçalho de `X-Token` que pode aparecer mais de
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/header_params/tutorial003_py310.py!}
+{!> ../../docs_src/header_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Por exemplo, para declarar um cabeçalho de `X-Token` que pode aparecer mais de
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_py39.py!}
+{!> ../../docs_src/header_params/tutorial003_py39.py!}
 ```
 
 ////
@@ -125,7 +125,7 @@ Por exemplo, para declarar um cabeçalho de `X-Token` que pode aparecer mais de
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003.py!}
+{!> ../../docs_src/header_params/tutorial003.py!}
 ```
 
 ////
index 1760246ee959fd83c6e2a1ce4697121c7c477a58..35c61d5fc8cc69215516122c9acabfbdf491ee59 100644 (file)
@@ -32,7 +32,7 @@ A função middleware recebe:
 * Você pode então modificar ainda mais o `response` antes de retorná-lo.
 
 ```Python hl_lines="8-9  11  14"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 /// tip | "Dica"
@@ -60,7 +60,7 @@ E também depois que a `response` é gerada, antes de retorná-la.
 Por exemplo, você pode adicionar um cabeçalho personalizado `X-Process-Time` contendo o tempo em segundos que levou para processar a solicitação e gerar uma resposta:
 
 ```Python hl_lines="10  12-13"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 ## Outros middlewares
index c578137804c7a99de3da218be87e34a6394b7f65..48753d7259b4f65e510d831da4470e71b5f5b900 100644 (file)
@@ -19,7 +19,7 @@ Mas se você não se lembrar o que cada código numérico significa, pode usar a
 //// tab | Python 3.8 and above
 
 ```Python hl_lines="3  17"
-{!> ../../../docs_src/path_operation_configuration/tutorial001.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ Mas se você não se lembrar o que cada código numérico significa, pode usar a
 //// tab | Python 3.9 and above
 
 ```Python hl_lines="3  17"
-{!> ../../../docs_src/path_operation_configuration/tutorial001_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001_py39.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@ Mas se você não se lembrar o que cada código numérico significa, pode usar a
 //// tab | Python 3.10 and above
 
 ```Python hl_lines="1  15"
-{!> ../../../docs_src/path_operation_configuration/tutorial001_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001_py310.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@ Você pode adicionar tags para sua *operação de rota*, passe o parâmetro `tag
 //// tab | Python 3.8 and above
 
 ```Python hl_lines="17  22  27"
-{!> ../../../docs_src/path_operation_configuration/tutorial002.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002.py!}
 ```
 
 ////
@@ -65,7 +65,7 @@ Você pode adicionar tags para sua *operação de rota*, passe o parâmetro `tag
 //// tab | Python 3.9 and above
 
 ```Python hl_lines="17  22  27"
-{!> ../../../docs_src/path_operation_configuration/tutorial002_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002_py39.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@ Você pode adicionar tags para sua *operação de rota*, passe o parâmetro `tag
 //// tab | Python 3.10 and above
 
 ```Python hl_lines="15  20  25"
-{!> ../../../docs_src/path_operation_configuration/tutorial002_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002_py310.py!}
 ```
 
 ////
@@ -91,7 +91,7 @@ Nestes casos, pode fazer sentido armazenar as tags em um `Enum`.
 **FastAPI** suporta isso da mesma maneira que com strings simples:
 
 ```Python hl_lines="1  8-10  13  18"
-{!../../../docs_src/path_operation_configuration/tutorial002b.py!}
+{!../../docs_src/path_operation_configuration/tutorial002b.py!}
 ```
 
 ## Resumo e descrição
@@ -101,7 +101,7 @@ Você pode adicionar um `summary` e uma `description`:
 //// tab | Python 3.8 and above
 
 ```Python hl_lines="20-21"
-{!> ../../../docs_src/path_operation_configuration/tutorial003.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003.py!}
 ```
 
 ////
@@ -109,7 +109,7 @@ Você pode adicionar um `summary` e uma `description`:
 //// tab | Python 3.9 and above
 
 ```Python hl_lines="20-21"
-{!> ../../../docs_src/path_operation_configuration/tutorial003_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003_py39.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Você pode adicionar um `summary` e uma `description`:
 //// tab | Python 3.10 and above
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/path_operation_configuration/tutorial003_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003_py310.py!}
 ```
 
 ////
@@ -131,7 +131,7 @@ Você pode escrever <a href="https://en.wikipedia.org/wiki/Markdown" class="exte
 //// tab | Python 3.8 and above
 
 ```Python hl_lines="19-27"
-{!> ../../../docs_src/path_operation_configuration/tutorial004.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004.py!}
 ```
 
 ////
@@ -139,7 +139,7 @@ Você pode escrever <a href="https://en.wikipedia.org/wiki/Markdown" class="exte
 //// tab | Python 3.9 and above
 
 ```Python hl_lines="19-27"
-{!> ../../../docs_src/path_operation_configuration/tutorial004_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004_py39.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ Você pode escrever <a href="https://en.wikipedia.org/wiki/Markdown" class="exte
 //// tab | Python 3.10 and above
 
 ```Python hl_lines="17-25"
-{!> ../../../docs_src/path_operation_configuration/tutorial004_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004_py310.py!}
 ```
 
 ////
@@ -164,7 +164,7 @@ Você pode especificar a descrição da resposta com o parâmetro `response_desc
 //// tab | Python 3.8 and above
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/path_operation_configuration/tutorial005.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ Você pode especificar a descrição da resposta com o parâmetro `response_desc
 //// tab | Python 3.9 and above
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/path_operation_configuration/tutorial005_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005_py39.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ Você pode especificar a descrição da resposta com o parâmetro `response_desc
 //// tab | Python 3.10 and above
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/path_operation_configuration/tutorial005_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005_py310.py!}
 ```
 
 ////
@@ -206,7 +206,7 @@ Então, se você não fornecer uma, o **FastAPI** irá gerar automaticamente uma
 Se você precisar marcar uma *operação de rota* como <abbr title="obsoleta, recomendada não usá-la">descontinuada</abbr>, mas sem removê-la, passe o parâmetro `deprecated`:
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_operation_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_configuration/tutorial006.py!}
 ```
 
 Ela será claramente marcada como descontinuada nas documentações interativas:
index 08ed03f756b6c3756bef4bde190b95a666766b0d..28c55482f7ff65c1b71df030e059bf01f66c181f 100644 (file)
@@ -9,7 +9,7 @@ Primeiro, importe `Path` de `fastapi`:
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@ Primeiro, importe `Path` de `fastapi`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ Por exemplo para declarar um valor de metadado `title` para o parâmetro de rota
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Por exemplo para declarar um valor de metadado `title` para o parâmetro de rota
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@ Isso não faz diferença para o **FastAPI**. Ele vai detectar os parâmetros pel
 Então, você pode declarar sua função assim:
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial002.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial002.py!}
 ```
 
 ## Ordene os parâmetros de a acordo com sua necessidade, truques
@@ -83,7 +83,7 @@ Passe `*`, como o primeiro parâmetro da função.
 O Python não vai fazer nada com esse `*`, mas ele vai saber que a partir dali os parâmetros seguintes deverão ser chamados argumentos nomeados (pares chave-valor), também conhecidos como <abbr title="Do inglês: K-ey W-ord Arg-uments"><code>kwargs</code></abbr>. Mesmo que eles não possuam um valor padrão.
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
 ```
 
 ## Validações numéricas: maior que ou igual
@@ -93,7 +93,7 @@ Com `Query` e `Path` (e outras que você verá mais tarde) você pode declarar r
 Aqui, com `ge=1`, `item_id` precisará ser um número inteiro maior que ("`g`reater than") ou igual ("`e`qual") a 1.
 
 ```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial004.py!}
 ```
 
 ## Validações numéricas: maior que e menor que ou igual
@@ -104,7 +104,7 @@ O mesmo se aplica para:
 * `le`: menor que ou igual (`l`ess than or `e`qual)
 
 ```Python hl_lines="9"
-{!../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial005.py!}
 ```
 
 ## Validações numéricas: valores do tipo float, maior que e menor que
@@ -118,7 +118,7 @@ Assim, `0.5` seria um valor válido. Mas `0.0` ou `0` não seria.
 E o mesmo para <abbr title="less than"><code>lt</code></abbr>.
 
 ```Python hl_lines="11"
-{!../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial006.py!}
 ```
 
 ## Recapitulando
index fb872e4f52c7e912f0d0461588e90555a1ed20a0..a68354a1bc52e057973f62c581c3ce1134f0f7e4 100644 (file)
@@ -3,7 +3,7 @@
 Você pode declarar os "parâmetros" ou "variáveis" com a mesma sintaxe utilizada pelo formato de strings do Python:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
 ```
 
 O valor do parâmetro que foi passado à `item_id` será passado para a sua função como o argumento `item_id`.
@@ -19,7 +19,7 @@ Então, se você rodar este exemplo e for até <a href="http://127.0.0.1:8000/it
 Você pode declarar o tipo de um parâmetro na função usando as anotações padrões do Python:
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
 ```
 
 Nesse caso, `item_id` está sendo declarado como um `int`.
@@ -130,7 +130,7 @@ E então você pode ter também uma rota `/users/{user_id}` para pegar dados sob
 Porque as operações de rota são avaliadas em ordem, você precisa ter certeza que a rota para `/users/me` está sendo declarado antes da rota `/users/{user_id}`:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
 ```
 
 Caso contrário, a rota para `/users/{user_id}` coincidiria também para `/users/me`, "pensando" que estaria recebendo o parâmetro `user_id` com o valor de `"me"`.
@@ -148,7 +148,7 @@ Por herdar de `str` a documentação da API vai ser capaz de saber que os valore
 Assim, crie atributos de classe com valores fixos, que serão os valores válidos disponíveis.
 
 ```Python hl_lines="1  6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// info | "informação"
@@ -170,7 +170,7 @@ Assim, crie atributos de classe com valores fixos, que serão os valores válido
 Logo, crie um *parâmetro de rota* com anotações de tipo usando a classe enum que você criou (`ModelName`):
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 ### Revise a documentação
@@ -188,7 +188,7 @@ O valor do *parâmetro da rota* será um *membro de enumeration*.
 Você pode comparar eles com o *membro de enumeration* no enum `ModelName` que você criou:
 
 ```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 #### Obtenha o *valor de enumerate*
@@ -196,7 +196,7 @@ Você pode comparar eles com o *membro de enumeration* no enum `ModelName` que v
 Você pode ter o valor exato de enumerate (um `str` nesse caso) usando `model_name.value`, ou em geral, `your_enum_member.value`:
 
 ```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// tip | "Dica"
@@ -214,7 +214,7 @@ Você pode retornar *membros de enum* da sua *rota de operação*, em um corpo J
 Eles serão convertidos para o seus valores correspondentes (strings nesse caso) antes de serem retornados ao cliente:
 
 ```Python hl_lines="18  21  23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 No seu cliente você vai obter uma resposta JSON como:
@@ -255,7 +255,7 @@ Nesse caso, o nome do parâmetro é `file_path`, e a última parte, `:path`, diz
 Então, você poderia usar ele com:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
 ```
 
 /// tip | "Dica"
index eac8795937d474a7cca687c18358d8752eded1ef..e6dcf748e85e0021e82b4f633efaa53b6a06bbbb 100644 (file)
@@ -5,7 +5,7 @@ O **FastAPI** permite que você declare informações adicionais e validações
 Vamos utilizar essa aplicação como exemplo:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!../../docs_src/query_params_str_validations/tutorial001.py!}
 ```
 
 O parâmetro de consulta `q` é do tipo `Union[str, None]`, o que significa que é do tipo `str` mas que também pode ser `None`, e de fato, o valor padrão é `None`, então o FastAPI saberá que não é obrigatório.
@@ -27,7 +27,7 @@ Nós iremos forçar que mesmo o parâmetro `q` seja opcional, sempre que informa
 Para isso, primeiro importe `Query` de `fastapi`:
 
 ```Python hl_lines="3"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 ## Use `Query` como o valor padrão
@@ -35,7 +35,7 @@ Para isso, primeiro importe `Query` de `fastapi`:
 Agora utilize-o como valor padrão do seu parâmetro, definindo o parâmetro `max_length` para 50:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 Note que substituímos o valor padrão de `None` para `Query(default=None)`, o primeiro parâmetro de `Query` serve para o mesmo propósito: definir o valor padrão do parâmetro.
@@ -87,7 +87,7 @@ Isso irá validar os dados, mostrar um erro claro quando os dados forem inválid
 Você também pode incluir um parâmetro `min_length`:
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!../../docs_src/query_params_str_validations/tutorial003.py!}
 ```
 
 ## Adicionando expressões regulares
@@ -95,7 +95,7 @@ Você também pode incluir um parâmetro `min_length`:
 Você pode definir uma <abbr title="Uma expressão regular, regex ou regexp é uma sequência de caracteres que define um parâmetro de busca para textos.">expressão regular</abbr> que combine com um padrão esperado pelo parâmetro:
 
 ```Python hl_lines="11"
-{!../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!../../docs_src/query_params_str_validations/tutorial004.py!}
 ```
 
 Essa expressão regular específica verifica se o valor recebido no parâmetro:
@@ -115,7 +115,7 @@ Da mesma maneira que você utiliza `None` como o primeiro argumento para ser uti
 Vamos dizer que você queira que o parâmetro de consulta `q` tenha um `min_length` de `3`, e um valor padrão de `"fixedquery"`, então declararíamos assim:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!../../docs_src/query_params_str_validations/tutorial005.py!}
 ```
 
 /// note | "Observação"
@@ -147,7 +147,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 Então, quando você precisa declarar um parâmetro obrigatório utilizando o `Query`, você pode utilizar `...` como o primeiro argumento:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!../../docs_src/query_params_str_validations/tutorial006.py!}
 ```
 
 /// info | "Informação"
@@ -165,7 +165,7 @@ Quando você declara explicitamente um parâmetro com `Query` você pode declar
 Por exemplo, para declarar que o parâmetro `q` pode aparecer diversas vezes na URL, você escreveria:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!../../docs_src/query_params_str_validations/tutorial011.py!}
 ```
 
 Então, com uma URL assim:
@@ -202,7 +202,7 @@ A documentação interativa da API irá atualizar de acordo, permitindo múltipl
 E você também pode definir uma lista (`list`) de valores padrão caso nenhum seja informado:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!../../docs_src/query_params_str_validations/tutorial012.py!}
 ```
 
 Se você for até:
@@ -227,7 +227,7 @@ O valor padrão de `q` será: `["foo", "bar"]` e sua resposta será:
 Você também pode utilizar o tipo `list` diretamente em vez de `List[str]`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!../../docs_src/query_params_str_validations/tutorial013.py!}
 ```
 
 /// note | "Observação"
@@ -255,13 +255,13 @@ Algumas delas não exibem todas as informações extras que declaramos, ainda qu
 Você pode adicionar um `title`:
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!../../docs_src/query_params_str_validations/tutorial007.py!}
 ```
 
 E uma `description`:
 
 ```Python hl_lines="13"
-{!../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!../../docs_src/query_params_str_validations/tutorial008.py!}
 ```
 
 ## Apelidos (alias) de parâmetros
@@ -283,7 +283,7 @@ Mas ainda você precisa que o nome seja exatamente `item-query`...
 Então você pode declarar um `alias`, e esse apelido (alias) que será utilizado para encontrar o valor do parâmetro:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!../../docs_src/query_params_str_validations/tutorial009.py!}
 ```
 
 ## Parâmetros descontinuados
@@ -295,7 +295,7 @@ Você tem que deixá-lo ativo por um tempo, já que existem clientes o utilizand
 Então você passa o parâmetro `deprecated=True` para `Query`:
 
 ```Python hl_lines="18"
-{!../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!../../docs_src/query_params_str_validations/tutorial010.py!}
 ```
 
 Na documentação aparecerá assim:
index 78d54f09bf7c461052b08e800ee925e762e4a8e7..6e6699cd536098871366a75676982523102136cc 100644 (file)
@@ -3,7 +3,7 @@
 Quando você declara outros parâmetros na função que não fazem parte dos parâmetros da rota, esses parâmetros são automaticamente interpretados como parâmetros de "consulta".
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
 ```
 
 A consulta é o conjunto de pares chave-valor que vai depois de `?` na URL, separado pelo caractere `&`.
@@ -66,7 +66,7 @@ Da mesma forma, você pode declarar parâmetros de consulta opcionais, definindo
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial002_py310.py!}
+{!> ../../docs_src/query_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@ Da mesma forma, você pode declarar parâmetros de consulta opcionais, definindo
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial002.py!}
+{!> ../../docs_src/query_params/tutorial002.py!}
 ```
 
 ////
@@ -94,7 +94,7 @@ Você também pode declarar tipos `bool`, e eles serão convertidos:
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial003_py310.py!}
+{!> ../../docs_src/query_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -102,7 +102,7 @@ Você também pode declarar tipos `bool`, e eles serão convertidos:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial003.py!}
+{!> ../../docs_src/query_params/tutorial003.py!}
 ```
 
 ////
@@ -150,7 +150,7 @@ Eles serão detectados pelo nome:
 //// tab | Python 3.10+
 
 ```Python hl_lines="6  8"
-{!> ../../../docs_src/query_params/tutorial004_py310.py!}
+{!> ../../docs_src/query_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -158,7 +158,7 @@ Eles serão detectados pelo nome:
 //// tab | Python 3.8+
 
 ```Python hl_lines="8  10"
-{!> ../../../docs_src/query_params/tutorial004.py!}
+{!> ../../docs_src/query_params/tutorial004.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ Caso você não queira adicionar um valor específico mas queira apenas torná-l
 Porém, quando você quiser fazer com que o parâmetro de consulta seja obrigatório, você pode simplesmente não declarar nenhum valor como padrão.
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
 ```
 
 Aqui o parâmetro de consulta `needy` é um valor obrigatório, do tipo `str`.
@@ -220,7 +220,7 @@ E claro, você pode definir alguns parâmetros como obrigatórios, alguns possui
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params/tutorial006_py310.py!}
+{!> ../../docs_src/query_params/tutorial006_py310.py!}
 ```
 
 ////
@@ -228,7 +228,7 @@ E claro, você pode definir alguns parâmetros como obrigatórios, alguns possui
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params/tutorial006.py!}
+{!> ../../docs_src/query_params/tutorial006.py!}
 ```
 
 ////
index a9db18e9dcb10d0a108e507bbb06c999f57ae580..837e24c3420b733a030b66443b70125cc8c7a58c 100644 (file)
@@ -27,7 +27,7 @@ Você precisa apenas declarar um **modelo Pydantic** com os campos que deseja re
 //// tab | Python 3.9+
 
 ```Python hl_lines="9-11  15"
-{!> ../../../docs_src/request_form_models/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_form_models/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@ Você precisa apenas declarar um **modelo Pydantic** com os campos que deseja re
 //// tab | Python 3.8+
 
 ```Python hl_lines="8-10  14"
-{!> ../../../docs_src/request_form_models/tutorial001_an.py!}
+{!> ../../docs_src/request_form_models/tutorial001_an.py!}
 ```
 
 ////
@@ -49,7 +49,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="7-9  13"
-{!> ../../../docs_src/request_form_models/tutorial001.py!}
+{!> ../../docs_src/request_form_models/tutorial001.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@ Você pode utilizar a configuração de modelo do Pydantic para `proibir` qualqu
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/request_form_models/tutorial002_an_py39.py!}
+{!> ../../docs_src/request_form_models/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -87,7 +87,7 @@ Você pode utilizar a configuração de modelo do Pydantic para `proibir` qualqu
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/request_form_models/tutorial002_an.py!}
+{!> ../../docs_src/request_form_models/tutorial002_an.py!}
 ```
 
 ////
@@ -101,7 +101,7 @@ Prefira utilizar a versão `Annotated` se possível.
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/request_form_models/tutorial002.py!}
+{!> ../../docs_src/request_form_models/tutorial002.py!}
 ```
 
 ////
index 2cf4063861ec5da33a89a64fbbb260ae6551790f..29488b4f26ef7440f42768213cc8ec352116322f 100644 (file)
@@ -13,7 +13,7 @@ Por exemplo: `pip install python-multipart`.
 ## Importe `File` e `Form`
 
 ```Python hl_lines="1"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 ## Defina parâmetros de `File` e `Form`
@@ -21,7 +21,7 @@ Por exemplo: `pip install python-multipart`.
 Crie parâmetros de arquivo e formulário da mesma forma que você faria para `Body` ou `Query`:
 
 ```Python hl_lines="8"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 Os arquivos e campos de formulário serão carregados como dados de formulário e você receberá os arquivos e campos de formulário.
index fc8c7bbada71673375ba6aa0dbb6885fe922695c..1e2faf269b8d293357ae4e754fef12ed68408728 100644 (file)
@@ -15,7 +15,7 @@ Ex: `pip install python-multipart`.
 Importe `Form` de `fastapi`:
 
 ```Python hl_lines="1"
-{!../../../docs_src/request_forms/tutorial001.py!}
+{!../../docs_src/request_forms/tutorial001.py!}
 ```
 
 ## Declare parâmetros de `Form`
@@ -23,7 +23,7 @@ Importe `Form` de `fastapi`:
 Crie parâmetros de formulário da mesma forma que você faria para `Body` ou `Query`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/request_forms/tutorial001.py!}
+{!../../docs_src/request_forms/tutorial001.py!}
 ```
 
 Por exemplo, em uma das maneiras que a especificação OAuth2 pode ser usada (chamada "fluxo de senha"), é necessário enviar um `username` e uma `password` como campos do formulário.
index 60e4ecb26a829b6f9fb5c19d7cf89f9806ee6907..39bfe284a7809d5c1e0bed74ca21627c43afbe95 100644 (file)
@@ -19,7 +19,7 @@ Importe `File` e `UploadFile` do `fastapi`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@ Importe `File` e `UploadFile` do `fastapi`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
 ```
 
 ////
@@ -41,7 +41,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Cria os parâmetros do arquivo da mesma forma que você faria para `Body` ou `Fo
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@ Cria os parâmetros do arquivo da mesma forma que você faria para `Body` ou `Fo
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
 ```
 
 ////
@@ -109,7 +109,7 @@ Defina um parâmetro de arquivo com o tipo `UploadFile`
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -117,7 +117,7 @@ Defina um parâmetro de arquivo com o tipo `UploadFile`
 //// tab | Python 3.8+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
 ```
 
 ////
@@ -131,7 +131,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
 ```
 
 ////
@@ -220,7 +220,7 @@ Você pode definir um arquivo como opcional utilizando as anotações de tipo pa
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py310.py!}
 ```
 
 ////
@@ -228,7 +228,7 @@ Você pode definir um arquivo como opcional utilizando as anotações de tipo pa
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py39.py!}
 ```
 
 ////
@@ -236,7 +236,7 @@ Você pode definir um arquivo como opcional utilizando as anotações de tipo pa
 //// tab | Python 3.8+
 
 ```Python hl_lines="10  18"
-{!> ../../../docs_src/request_files/tutorial001_02_an.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an.py!}
 ```
 
 ////
@@ -250,7 +250,7 @@ Utilize a versão com `Annotated`, se possível
 ///
 
 ```Python hl_lines="7  15"
-{!> ../../../docs_src/request_files/tutorial001_02_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_py310.py!}
 ```
 
 ////
@@ -264,7 +264,7 @@ Utilize a versão com `Annotated`, se possível
 ///
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02.py!}
+{!> ../../docs_src/request_files/tutorial001_02.py!}
 ```
 
 ////
@@ -276,7 +276,7 @@ Você também pode utilizar `File()` com `UploadFile`, por exemplo, para definir
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  15"
-{!> ../../../docs_src/request_files/tutorial001_03_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an_py39.py!}
 ```
 
 ////
@@ -284,7 +284,7 @@ Você também pode utilizar `File()` com `UploadFile`, por exemplo, para definir
 //// tab | Python 3.8+
 
 ```Python hl_lines="8  14"
-{!> ../../../docs_src/request_files/tutorial001_03_an.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an.py!}
 ```
 
 ////
@@ -298,7 +298,7 @@ Utilize a versão com `Annotated` se possível
 ///
 
 ```Python hl_lines="7  13"
-{!> ../../../docs_src/request_files/tutorial001_03.py!}
+{!> ../../docs_src/request_files/tutorial001_03.py!}
 ```
 
 ////
@@ -314,7 +314,7 @@ Para usar isso, declare uma lista de `bytes` ou `UploadFile`:
 //// tab | Python 3.9+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/request_files/tutorial002_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -322,7 +322,7 @@ Para usar isso, declare uma lista de `bytes` ou `UploadFile`:
 //// tab | Python 3.8+
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/request_files/tutorial002_an.py!}
+{!> ../../docs_src/request_files/tutorial002_an.py!}
 ```
 
 ////
@@ -336,7 +336,7 @@ Utilize a versão com `Annotated` se possível
 ///
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/request_files/tutorial002_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_py39.py!}
 ```
 
 ////
@@ -350,7 +350,7 @@ Utilize a versão com `Annotated` se possível
 ///
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/request_files/tutorial002.py!}
+{!> ../../docs_src/request_files/tutorial002.py!}
 ```
 
 ////
@@ -372,7 +372,7 @@ E da mesma forma que antes, você pode utilizar `File()` para definir parâmetro
 //// tab | Python 3.9+
 
 ```Python hl_lines="11  18-20"
-{!> ../../../docs_src/request_files/tutorial003_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -380,7 +380,7 @@ E da mesma forma que antes, você pode utilizar `File()` para definir parâmetro
 //// tab | Python 3.8+
 
 ```Python hl_lines="12  19-21"
-{!> ../../../docs_src/request_files/tutorial003_an.py!}
+{!> ../../docs_src/request_files/tutorial003_an.py!}
 ```
 
 ////
@@ -394,7 +394,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="9  16"
-{!> ../../../docs_src/request_files/tutorial003_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_py39.py!}
 ```
 
 ////
@@ -408,7 +408,7 @@ Utilize a versão com `Annotated` se possível.
 ///
 
 ```Python hl_lines="11  18"
-{!> ../../../docs_src/request_files/tutorial003.py!}
+{!> ../../docs_src/request_files/tutorial003.py!}
 ```
 
 ////
index dc8e120485786b151eedc476e2dad873178a8add..bc4a2cd348634be2e32523c016194e02394d3511 100644 (file)
@@ -9,7 +9,7 @@ Da mesma forma que você pode especificar um modelo de resposta, você também p
 * etc.
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 /// note | "Nota"
@@ -78,7 +78,7 @@ Para saber mais sobre cada código de status e qual código serve para quê, ver
 Vamos ver o exemplo anterior novamente:
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 `201` é o código de status para "Criado".
@@ -88,7 +88,7 @@ Mas você não precisa memorizar o que cada um desses códigos significa.
 Você pode usar as variáveis de conveniência de `fastapi.status`.
 
 ```Python hl_lines="1  6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
 ```
 
 Eles são apenas uma conveniência, eles possuem o mesmo número, mas dessa forma você pode usar o autocomplete do editor para encontrá-los:
index a291db045b14c81eefc2339808368244ffbcbe04..2d78e4ef1f222f0d4874c4711020e95e4c57502f 100644 (file)
@@ -9,7 +9,7 @@ Aqui estão várias formas de se fazer isso.
 Você pode declarar um `example` para um modelo Pydantic usando `Config` e `schema_extra`, conforme descrito em <a href="https://docs.pydantic.dev/latest/concepts/json_schema/#schema-customization" class="external-link" target="_blank">Documentação do Pydantic: Schema customization</a>:
 
 ```Python hl_lines="15-23"
-{!../../../docs_src/schema_extra_example/tutorial001.py!}
+{!../../docs_src/schema_extra_example/tutorial001.py!}
 ```
 
 Essas informações extras serão adicionadas como se encontram no **JSON Schema** de resposta desse modelo e serão usadas na documentação da API.
@@ -29,7 +29,7 @@ Ao usar `Field ()` com modelos Pydantic, você também pode declarar informaçõ
 Você pode usar isso para adicionar um `example` para cada campo:
 
 ```Python hl_lines="4  10-13"
-{!../../../docs_src/schema_extra_example/tutorial002.py!}
+{!../../docs_src/schema_extra_example/tutorial002.py!}
 ```
 
 /// warning | "Atenção"
@@ -57,7 +57,7 @@ você também pode declarar um dado `example` ou um grupo de `examples` com info
 Aqui nós passamos um `example` dos dados esperados por `Body()`:
 
 ```Python hl_lines="21-26"
-{!../../../docs_src/schema_extra_example/tutorial003.py!}
+{!../../docs_src/schema_extra_example/tutorial003.py!}
 ```
 
 ### Exemplo na UI da documentação
@@ -80,7 +80,7 @@ Cada `dict` de exemplo específico em `examples` pode conter:
 * `externalValue`: alternativa ao `value`, uma URL apontando para o exemplo. Embora isso possa não ser suportado por tantas ferramentas quanto `value`.
 
 ```Python hl_lines="22-48"
-{!../../../docs_src/schema_extra_example/tutorial004.py!}
+{!../../docs_src/schema_extra_example/tutorial004.py!}
 ```
 
 ### Exemplos na UI da documentação
index 007fefcb96a5a471a8ac6506c4e25e3b10b37d24..9fb94fe674b1e23bbbad91094de146cad5cede0b 100644 (file)
@@ -20,7 +20,7 @@ Vamos primeiro usar o código e ver como funciona, e depois voltaremos para ente
 Copie o exemplo em um arquivo `main.py`:
 
 ```Python
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 ## Execute-o
@@ -136,7 +136,7 @@ Neste exemplo, nós vamos usar o **OAuth2** com o fluxo de **Senha**, usando um
 Quando nós criamos uma instância da classe `OAuth2PasswordBearer`, nós passamos pelo parâmetro `tokenUrl` Esse parâmetro contém a URL que o client (o frontend rodando no browser do usuário) vai usar para mandar o `username` e `senha` para obter um token.
 
 ```Python hl_lines="6"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 /// tip | "Dica"
@@ -180,7 +180,7 @@ Então, pode ser usado com `Depends`.
 Agora você pode passar aquele `oauth2_scheme` em uma dependência com `Depends`.
 
 ```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 Esse dependência vai fornecer uma `str` que é atribuído ao parâmetro `token da *função do path operation*
index efaf07dfbb04426c2a6a3c021c792f0a69c77288..901fca1d21aab5897fa50da7ae1550e07e9c9de5 100644 (file)
@@ -8,7 +8,7 @@ Você pode servir arquivos estáticos automaticamente de um diretório usando `S
 * "Monte" uma instância de `StaticFiles()` em um caminho específico.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
 ```
 
 /// note | "Detalhes técnicos"
index f734a7d9a5d22ddf8e532e5cc68239146575a82e..4e28a43c09b66fc32ad53af3caf870094e74f0e5 100644 (file)
@@ -31,7 +31,7 @@ Use o objeto `TestClient` da mesma forma que você faz com `httpx`.
 Escreva instruções `assert` simples com as expressões Python padrão que você precisa verificar (novamente, `pytest` padrão).
 
 ```Python hl_lines="2  12  15-18"
-{!../../../docs_src/app_testing/tutorial001.py!}
+{!../../docs_src/app_testing/tutorial001.py!}
 ```
 
 /// tip | "Dica"
@@ -79,7 +79,7 @@ No arquivo `main.py` você tem seu aplicativo **FastAPI**:
 
 
 ```Python
-{!../../../docs_src/app_testing/main.py!}
+{!../../docs_src/app_testing/main.py!}
 ```
 
 ### Arquivo de teste
@@ -97,7 +97,7 @@ Então você poderia ter um arquivo `test_main.py` com seus testes. Ele poderia
 Como esse arquivo está no mesmo pacote, você pode usar importações relativas para importar o objeto `app` do módulo `main` (`main.py`):
 
 ```Python hl_lines="3"
-{!../../../docs_src/app_testing/test_main.py!}
+{!../../docs_src/app_testing/test_main.py!}
 ```
 
 ...e ter o código para os testes como antes.
@@ -129,7 +129,7 @@ Ambas as *operações de rotas* requerem um cabeçalho `X-Token`.
 //// tab | Python 3.10+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py310/main.py!}
 ```
 
 ////
@@ -137,7 +137,7 @@ Ambas as *operações de rotas* requerem um cabeçalho `X-Token`.
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an_py39/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py39/main.py!}
 ```
 
 ////
@@ -145,7 +145,7 @@ Ambas as *operações de rotas* requerem um cabeçalho `X-Token`.
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an/main.py!}
+{!> ../../docs_src/app_testing/app_b_an/main.py!}
 ```
 
 ////
@@ -159,7 +159,7 @@ Prefira usar a versão `Annotated` se possível.
 ///
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_py310/main.py!}
 ```
 
 ////
@@ -173,7 +173,7 @@ Prefira usar a versão `Annotated` se possível.
 ///
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/main.py!}
+{!> ../../docs_src/app_testing/app_b/main.py!}
 ```
 
 ////
@@ -183,7 +183,7 @@ Prefira usar a versão `Annotated` se possível.
 Você pode então atualizar `test_main.py` com os testes estendidos:
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/test_main.py!}
+{!> ../../docs_src/app_testing/app_b/test_main.py!}
 ```
 
 Sempre que você precisar que o cliente passe informações na requisição e não souber como, você pode pesquisar (no Google) como fazer isso no `httpx`, ou até mesmo como fazer isso com `requests`, já que o design do HTTPX é baseado no design do Requests.
index c052bc675686d811da976410720b3933aa463fdb..e5905304a359eb82e0d649004d66858f43e80688 100644 (file)
@@ -23,7 +23,7 @@ Python имеет поддержку необязательных аннотац
 Давайте начнем с простого примера:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 Вызов этой программы выводит:
@@ -39,7 +39,7 @@ John Doe
 * <abbr title="Объединяет в одно целое, последовательно, друг за другом.">Соединяет</abbr> их через пробел.
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### Отредактируем пример
@@ -83,7 +83,7 @@ John Doe
 Это аннотации типов:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 Это не то же самое, что объявление значений по умолчанию, например:
@@ -113,7 +113,7 @@ John Doe
 Проверьте эту функцию, она уже имеет аннотации типов:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 Поскольку редактор знает типы переменных, вы получаете не только дополнение, но и проверки ошибок:
@@ -123,7 +123,7 @@ John Doe
 Теперь вы знаете, что вам нужно исправить, преобразовав `age` в строку с `str(age)`:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## Объявление типов
@@ -144,7 +144,7 @@ John Doe
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### Generic-типы с параметрами типов
@@ -162,7 +162,7 @@ John Doe
 Импортируйте `List` из `typing` (с заглавной `L`):
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 Объявите переменную с тем же синтаксисом двоеточия (`:`).
@@ -172,7 +172,7 @@ John Doe
 Поскольку список является типом, содержащим некоторые внутренние типы, вы помещаете их в квадратные скобки:
 
 ```Python hl_lines="4"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 /// tip
@@ -200,7 +200,7 @@ John Doe
 Вы бы сделали то же самое, чтобы объявить `tuple` и `set`:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial007.py!}
+{!../../docs_src/python_types/tutorial007.py!}
 ```
 
 Это означает:
@@ -217,7 +217,7 @@ John Doe
 Второй параметр типа предназначен для значений `dict`:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial008.py!}
+{!../../docs_src/python_types/tutorial008.py!}
 ```
 
 Это означает:
@@ -231,7 +231,7 @@ John Doe
 Вы также можете использовать `Optional`, чтобы объявить, что переменная имеет тип, например, `str`, но это является «необязательным», что означает, что она также может быть `None`:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 Использование `Optional[str]` вместо просто `str` позволит редактору помочь вам в обнаружении ошибок, в которых вы могли бы предположить, что значение всегда является `str`, хотя на самом деле это может быть и `None`.
@@ -256,13 +256,13 @@ John Doe
 Допустим, у вас есть класс `Person` с полем `name`:
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Тогда вы можете объявить переменную типа `Person`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 И снова вы получаете полную поддержку редактора:
@@ -284,7 +284,7 @@ John Doe
 Взято из официальной документации Pydantic:
 
 ```Python
-{!../../../docs_src/python_types/tutorial011.py!}
+{!../../docs_src/python_types/tutorial011.py!}
 ```
 
 /// info
index 073276848ecacc780cd6cd3658cc95abc0c36564..0f6ce0eb320975fd9549e6cf798a897da94076cc 100644 (file)
@@ -16,7 +16,7 @@
 Сначала импортируйте `BackgroundTasks`, потом добавьте в функцию параметр с типом `BackgroundTasks`:
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 **FastAPI** создаст объект класса `BackgroundTasks` для вас и запишет его в параметр.
@@ -34,7 +34,7 @@
 Так как операция записи не использует `async` и `await`, мы определим ее как обычную `def`:
 
 ```Python hl_lines="6-9"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 ## Добавление фоновой задачи
@@ -42,7 +42,7 @@
 Внутри функции вызовите метод `.add_task()` у объекта *background tasks* и передайте ему функцию, которую хотите выполнить в фоне:
 
 ```Python hl_lines="14"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 `.add_task()` принимает следующие аргументы:
@@ -60,7 +60,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="11  13  20  23"
-{!> ../../../docs_src/background_tasks/tutorial002_py310.py!}
+{!> ../../docs_src/background_tasks/tutorial002_py310.py!}
 ```
 
 ////
@@ -68,7 +68,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="13  15  22  25"
-{!> ../../../docs_src/background_tasks/tutorial002.py!}
+{!> ../../docs_src/background_tasks/tutorial002.py!}
 ```
 
 ////
index f4db0e9ff34c7a35fcd84ee4c15fa32bfad53a31..f3b2c6113837938bc33c2dfee4c53d7aa1bb5c62 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="9-12"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
index 107e6293b05e2687ef53969aa3e3db07f014f0b2..53965f0ec09a17a24c72074a532d50e65c524748 100644 (file)
@@ -11,7 +11,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-20"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-20"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-21"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an.py!}
 ```
 
 ////
@@ -41,7 +41,7 @@
 ///
 
 ```Python hl_lines="17-19"
-{!> ../../../docs_src/body_multiple_params/tutorial001_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -55,7 +55,7 @@
 ///
 
 ```Python hl_lines="19-21"
-{!> ../../../docs_src/body_multiple_params/tutorial001.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial002_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -92,7 +92,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial002.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial003_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial003.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003.py!}
 ```
 
 ////
@@ -229,7 +229,7 @@ q: str | None = None
 //// tab | Python 3.10+
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ q: str | None = None
 //// tab | Python 3.9+
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ q: str | None = None
 //// tab | Python 3.8+
 
 ```Python hl_lines="28"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an.py!}
 ```
 
 ////
@@ -259,7 +259,7 @@ q: str | None = None
 ///
 
 ```Python hl_lines="25"
-{!> ../../../docs_src/body_multiple_params/tutorial004_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ q: str | None = None
 ///
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004.py!}
 ```
 
 ////
@@ -301,7 +301,7 @@ item: Item = Body(embed=True)
 //// tab | Python 3.10+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -309,7 +309,7 @@ item: Item = Body(embed=True)
 //// tab | Python 3.9+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -317,7 +317,7 @@ item: Item = Body(embed=True)
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an.py!}
 ```
 
 ////
@@ -331,7 +331,7 @@ item: Item = Body(embed=True)
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/body_multiple_params/tutorial005_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_py310.py!}
 ```
 
 ////
@@ -345,7 +345,7 @@ item: Item = Body(embed=True)
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005.py!}
 ```
 
 ////
index ecb8b92a7fc4e2a40fa3448f80edb5463ef31f04..780946725a745d95e3c2bdeee796598bde40f0e9 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial001_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial001.py!}
+{!> ../../docs_src/body_nested_models/tutorial001.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@
 Но в версиях Python до 3.9 (начиная с 3.6) сначала вам необходимо импортировать `List` из стандартного модуля `typing` в Python:
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/body_nested_models/tutorial002.py!}
+{!> ../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ### Объявление `list` с указанием типов для вложенных элементов
@@ -68,7 +68,7 @@ my_list: List[str]
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial002_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -76,7 +76,7 @@ my_list: List[str]
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial002_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial002_py39.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@ my_list: List[str]
 //// tab | Python 3.8+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial002.py!}
+{!> ../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ////
@@ -100,7 +100,7 @@ my_list: List[str]
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial003_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial003_py310.py!}
 ```
 
 ////
@@ -108,7 +108,7 @@ my_list: List[str]
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial003_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial003_py39.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ my_list: List[str]
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  14"
-{!> ../../../docs_src/body_nested_models/tutorial003.py!}
+{!> ../../docs_src/body_nested_models/tutorial003.py!}
 ```
 
 ////
@@ -144,7 +144,7 @@ my_list: List[str]
 //// tab | Python 3.10+
 
 ```Python hl_lines="7-9"
-{!> ../../../docs_src/body_nested_models/tutorial004_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py310.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ my_list: List[str]
 //// tab | Python 3.9+
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/body_nested_models/tutorial004_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -160,7 +160,7 @@ my_list: List[str]
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/body_nested_models/tutorial004.py!}
+{!> ../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ////
@@ -172,7 +172,7 @@ my_list: List[str]
 //// tab | Python 3.10+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_nested_models/tutorial004_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py310.py!}
 ```
 
 ////
@@ -180,7 +180,7 @@ my_list: List[str]
 //// tab | Python 3.9+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial004_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -188,7 +188,7 @@ my_list: List[str]
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial004.py!}
+{!> ../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ////
@@ -227,7 +227,7 @@ my_list: List[str]
 //// tab | Python 3.10+
 
 ```Python hl_lines="2  8"
-{!> ../../../docs_src/body_nested_models/tutorial005_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial005_py310.py!}
 ```
 
 ////
@@ -235,7 +235,7 @@ my_list: List[str]
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  10"
-{!> ../../../docs_src/body_nested_models/tutorial005_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial005_py39.py!}
 ```
 
 ////
@@ -243,7 +243,7 @@ my_list: List[str]
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  10"
-{!> ../../../docs_src/body_nested_models/tutorial005.py!}
+{!> ../../docs_src/body_nested_models/tutorial005.py!}
 ```
 
 ////
@@ -257,7 +257,7 @@ my_list: List[str]
 //// tab | Python 3.10+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_nested_models/tutorial006_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial006_py310.py!}
 ```
 
 ////
@@ -265,7 +265,7 @@ my_list: List[str]
 //// tab | Python 3.9+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial006_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial006_py39.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ my_list: List[str]
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial006.py!}
+{!> ../../docs_src/body_nested_models/tutorial006.py!}
 ```
 
 ////
@@ -317,7 +317,7 @@ my_list: List[str]
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  12  18  21  25"
-{!> ../../../docs_src/body_nested_models/tutorial007_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial007_py310.py!}
 ```
 
 ////
@@ -325,7 +325,7 @@ my_list: List[str]
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  14  20  23  27"
-{!> ../../../docs_src/body_nested_models/tutorial007_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial007_py39.py!}
 ```
 
 ////
@@ -333,7 +333,7 @@ my_list: List[str]
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  14  20  23  27"
-{!> ../../../docs_src/body_nested_models/tutorial007.py!}
+{!> ../../docs_src/body_nested_models/tutorial007.py!}
 ```
 
 ////
@@ -363,7 +363,7 @@ images: list[Image]
 //// tab | Python 3.9+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/body_nested_models/tutorial008_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial008_py39.py!}
 ```
 
 ////
@@ -371,7 +371,7 @@ images: list[Image]
 //// tab | Python 3.8+
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/body_nested_models/tutorial008.py!}
+{!> ../../docs_src/body_nested_models/tutorial008.py!}
 ```
 
 ////
@@ -407,7 +407,7 @@ images: list[Image]
 //// tab | Python 3.9+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/body_nested_models/tutorial009_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial009_py39.py!}
 ```
 
 ////
@@ -415,7 +415,7 @@ images: list[Image]
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/body_nested_models/tutorial009.py!}
+{!> ../../docs_src/body_nested_models/tutorial009.py!}
 ```
 
 ////
index c458329d8825af71c143dbd386247d4c0069184e..3ecfe52f4f145c8e59570797eb41f00d78760811 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="28-33"
-{!> ../../../docs_src/body_updates/tutorial001_py310.py!}
+{!> ../../docs_src/body_updates/tutorial001_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="30-35"
-{!> ../../../docs_src/body_updates/tutorial001_py39.py!}
+{!> ../../docs_src/body_updates/tutorial001_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.6+
 
 ```Python hl_lines="30-35"
-{!> ../../../docs_src/body_updates/tutorial001.py!}
+{!> ../../docs_src/body_updates/tutorial001.py!}
 ```
 
 ////
@@ -77,7 +77,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="32"
-{!> ../../../docs_src/body_updates/tutorial002_py310.py!}
+{!> ../../docs_src/body_updates/tutorial002_py310.py!}
 ```
 
 ////
@@ -85,7 +85,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="34"
-{!> ../../../docs_src/body_updates/tutorial002_py39.py!}
+{!> ../../docs_src/body_updates/tutorial002_py39.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@
 //// tab | Python 3.6+
 
 ```Python hl_lines="34"
-{!> ../../../docs_src/body_updates/tutorial002.py!}
+{!> ../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="33"
-{!> ../../../docs_src/body_updates/tutorial002_py310.py!}
+{!> ../../docs_src/body_updates/tutorial002_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="35"
-{!> ../../../docs_src/body_updates/tutorial002_py39.py!}
+{!> ../../docs_src/body_updates/tutorial002_py39.py!}
 ```
 
 ////
 //// tab | Python 3.6+
 
 ```Python hl_lines="35"
-{!> ../../../docs_src/body_updates/tutorial002.py!}
+{!> ../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="28-35"
-{!> ../../../docs_src/body_updates/tutorial002_py310.py!}
+{!> ../../docs_src/body_updates/tutorial002_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="30-37"
-{!> ../../../docs_src/body_updates/tutorial002_py39.py!}
+{!> ../../docs_src/body_updates/tutorial002_py39.py!}
 ```
 
 ////
 //// tab | Python 3.6+
 
 ```Python hl_lines="30-37"
-{!> ../../../docs_src/body_updates/tutorial002.py!}
+{!> ../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ////
index c3e6326da0d3ea6200c23e9fb831286ffceea1a6..91b169d07b589dbd743ffc95f1d0ac754290ded2 100644 (file)
@@ -23,7 +23,7 @@
 Первое, что вам необходимо сделать, это импортировать `BaseModel` из пакета `pydantic`:
 
 ```Python hl_lines="4"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
 ```
 
 ## Создание вашей собственной модели
@@ -33,7 +33,7 @@
 Используйте аннотации типов Python для всех атрибутов:
 
 ```Python hl_lines="7-11"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
 ```
 
 Также как и при описании параметров запроса, когда атрибут модели имеет значение по умолчанию, он является необязательным. Иначе он обязателен. Используйте `None`, чтобы сделать его необязательным без использования конкретных значений по умолчанию.
@@ -63,7 +63,7 @@
 Чтобы добавить параметр к вашему *обработчику*, объявите его также, как вы объявляли параметры пути или параметры запроса:
 
 ```Python hl_lines="18"
-{!../../../docs_src/body/tutorial001.py!}
+{!../../docs_src/body/tutorial001.py!}
 ```
 
 ...и укажите созданную модель в качестве типа параметра, `Item`.
 Внутри функции вам доступны все атрибуты объекта модели напрямую:
 
 ```Python hl_lines="21"
-{!../../../docs_src/body/tutorial002.py!}
+{!../../docs_src/body/tutorial002.py!}
 ```
 
 ## Тело запроса + параметры пути
 **FastAPI** распознает, какие параметры функции соответствуют параметрам пути и должны быть **получены из пути**, а какие параметры функции, объявленные как модели Pydantic, должны быть **получены из тела запроса**.
 
 ```Python hl_lines="17-18"
-{!../../../docs_src/body/tutorial003.py!}
+{!../../docs_src/body/tutorial003.py!}
 ```
 
 ## Тело запроса + параметры пути + параметры запроса
 **FastAPI** распознает каждый из них и возьмет данные из правильного источника.
 
 ```Python hl_lines="18"
-{!../../../docs_src/body/tutorial004.py!}
+{!../../docs_src/body/tutorial004.py!}
 ```
 
 Параметры функции распознаются следующим образом:
index e88b9d7eee10ba2e9f2758e44b566b01d5974d0e..2a73a591832ec9c263ac19954b1da6a12ebc121d 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
index 8528332081b5c152b0b371beef0fe367fc093efc..8d415a2c143663a77262a8787b8f61946fd687c1 100644 (file)
@@ -47,7 +47,7 @@
 * Отдельных HTTP-заголовков или всех вместе, используя `"*"`.
 
 ```Python hl_lines="2  6-11  13-19"
-{!../../../docs_src/cors/tutorial001.py!}
+{!../../docs_src/cors/tutorial001.py!}
 ```
 
 `CORSMiddleware` использует для параметров "запрещающие" значения по умолчанию, поэтому вам нужно явным образом разрешить использование отдельных источников, методов или заголовков, чтобы браузеры могли использовать их в кросс-доменном контексте.
index 685fb73566bb8ff980e5148324b2fd5ff54bdd8d..606a32bfced7c56091183b156eae91b4f99ecbb3 100644 (file)
@@ -7,7 +7,7 @@
 В вашем FastAPI приложении, импортируйте и вызовите `uvicorn` напрямую:
 
 ```Python hl_lines="1  15"
-{!../../../docs_src/debugging/tutorial001.py!}
+{!../../docs_src/debugging/tutorial001.py!}
 ```
 
 ### Описание `__name__ == "__main__"`
index d0471bacaf8a14c8de4eafc6237bfbbe991b5603..161101bb306336b8de6c1e631269caa70847d431 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.6+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -120,7 +120,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.10+
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -128,7 +128,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.9+
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -136,7 +136,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.6+
 
 ```Python hl_lines="12-16"
-{!> ../../../docs_src/dependencies/tutorial002_an.py!}
+{!> ../../docs_src/dependencies/tutorial002_an.py!}
 ```
 
 ////
@@ -150,7 +150,7 @@ fluffy = Cat(name="Mr Fluffy")
 ///
 
 ```Python hl_lines="9-13"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -164,7 +164,7 @@ fluffy = Cat(name="Mr Fluffy")
 ///
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -174,7 +174,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -182,7 +182,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -190,7 +190,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.6+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial002_an.py!}
+{!> ../../docs_src/dependencies/tutorial002_an.py!}
 ```
 
 ////
@@ -204,7 +204,7 @@ fluffy = Cat(name="Mr Fluffy")
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -218,7 +218,7 @@ fluffy = Cat(name="Mr Fluffy")
 ///
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -228,7 +228,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -236,7 +236,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -244,7 +244,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.6+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -258,7 +258,7 @@ fluffy = Cat(name="Mr Fluffy")
 ///
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -272,7 +272,7 @@ fluffy = Cat(name="Mr Fluffy")
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -294,7 +294,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -302,7 +302,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -310,7 +310,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.6+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial002_an.py!}
+{!> ../../docs_src/dependencies/tutorial002_an.py!}
 ```
 
 ////
@@ -324,7 +324,7 @@ fluffy = Cat(name="Mr Fluffy")
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -338,7 +338,7 @@ fluffy = Cat(name="Mr Fluffy")
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -438,7 +438,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -446,7 +446,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -454,7 +454,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.6+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial003_an.py!}
+{!> ../../docs_src/dependencies/tutorial003_an.py!}
 ```
 
 ////
@@ -468,7 +468,7 @@ commons = Depends(CommonQueryParams)
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial003_py310.py!}
+{!> ../../docs_src/dependencies/tutorial003_py310.py!}
 ```
 
 ////
@@ -482,7 +482,7 @@ commons = Depends(CommonQueryParams)
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003.py!}
+{!> ../../docs_src/dependencies/tutorial003.py!}
 ```
 
 ////
@@ -575,7 +575,7 @@ commons: CommonQueryParams = Depends()
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -583,7 +583,7 @@ commons: CommonQueryParams = Depends()
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -591,7 +591,7 @@ commons: CommonQueryParams = Depends()
 //// tab | Python 3.6+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/dependencies/tutorial004_an.py!}
+{!> ../../docs_src/dependencies/tutorial004_an.py!}
 ```
 
 ////
@@ -605,7 +605,7 @@ commons: CommonQueryParams = Depends()
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial004_py310.py!}
+{!> ../../docs_src/dependencies/tutorial004_py310.py!}
 ```
 
 ////
@@ -619,7 +619,7 @@ commons: CommonQueryParams = Depends()
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004.py!}
+{!> ../../docs_src/dependencies/tutorial004.py!}
 ```
 
 ////
index 11df4b47451b624a272829f7ec261b004e77b96a..305ce46cb51967ce331276aa75310c2827c7ea19 100644 (file)
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="7  12"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@
 ///
 
 ```Python hl_lines="6  11"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  14"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/dependencies/tutorial006_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial006_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/dependencies/tutorial006_an.py!}
+{!> ../../docs_src/dependencies/tutorial006_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="9  14"
-{!> ../../../docs_src/dependencies/tutorial006.py!}
+{!> ../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ////
index ece7ef8e3bf183334cd30ee47b94987b31914a15..99a86e999ea9c9aad94135c23b6a08418581ed19 100644 (file)
@@ -30,19 +30,19 @@ FastAPI поддерживает зависимости, которые выпо
 Перед созданием ответа будет выполнен только код до и включая `yield`.
 
 ```Python hl_lines="2-4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 Полученное значение и есть то, что будет внедрено в функцию операции пути и другие зависимости:
 
 ```Python hl_lines="4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 Код, следующий за оператором `yield`, выполняется после доставки ответа:
 
 ```Python hl_lines="5-6"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 /// tip | "Подсказка"
@@ -64,7 +64,7 @@ FastAPI поддерживает зависимости, которые выпо
 Таким же образом можно использовать `finally`, чтобы убедиться, что обязательные шаги при выходе выполнены, независимо от того, было ли исключение или нет.
 
 ```Python hl_lines="3  5"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 ## Подзависимости с `yield`
@@ -78,7 +78,7 @@ FastAPI поддерживает зависимости, которые выпо
 //// tab | Python 3.9+
 
 ```Python hl_lines="6  14  22"
-{!> ../../../docs_src/dependencies/tutorial008_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -86,7 +86,7 @@ FastAPI поддерживает зависимости, которые выпо
 //// tab | Python 3.6+
 
 ```Python hl_lines="5  13  21"
-{!> ../../../docs_src/dependencies/tutorial008_an.py!}
+{!> ../../docs_src/dependencies/tutorial008_an.py!}
 ```
 
 ////
@@ -100,7 +100,7 @@ FastAPI поддерживает зависимости, которые выпо
 ///
 
 ```Python hl_lines="4  12  20"
-{!> ../../../docs_src/dependencies/tutorial008.py!}
+{!> ../../docs_src/dependencies/tutorial008.py!}
 ```
 
 ////
@@ -114,7 +114,7 @@ FastAPI поддерживает зависимости, которые выпо
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-19  26-27"
-{!> ../../../docs_src/dependencies/tutorial008_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -122,7 +122,7 @@ FastAPI поддерживает зависимости, которые выпо
 //// tab | Python 3.6+
 
 ```Python hl_lines="17-18  25-26"
-{!> ../../../docs_src/dependencies/tutorial008_an.py!}
+{!> ../../docs_src/dependencies/tutorial008_an.py!}
 ```
 
 ////
@@ -136,7 +136,7 @@ FastAPI поддерживает зависимости, которые выпо
 ///
 
 ```Python hl_lines="16-17  24-25"
-{!> ../../../docs_src/dependencies/tutorial008.py!}
+{!> ../../docs_src/dependencies/tutorial008.py!}
 ```
 
 ////
@@ -304,7 +304,7 @@ with open("./somefile.txt") as f:
 `with` или `async with` внутри функции зависимости:
 
 ```Python hl_lines="1-9  13"
-{!../../../docs_src/dependencies/tutorial010.py!}
+{!../../docs_src/dependencies/tutorial010.py!}
 ```
 
 /// tip | "Подсказка"
index 9e03e3723025adcd00c2d03d83cbb0a2b3bba216..7dbd50ae12618795c23b80bc8a47194377cc9357 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial012_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial012_an_py39.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial012_an.py!}
+{!> ../../docs_src/dependencies/tutorial012_an.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/dependencies/tutorial012.py!}
+{!> ../../docs_src/dependencies/tutorial012.py!}
 ```
 
 ////
index b244b3fdc4917dbb20885b1a133e8d045a83a194..fcd9f46dc2c2a291676cba0851e6e72b2ce2c3fb 100644 (file)
@@ -32,7 +32,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -40,7 +40,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -48,7 +48,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-12"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
@@ -62,7 +62,7 @@
 ///
 
 ```Python hl_lines="6-7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -76,7 +76,7 @@
 ///
 
 ```Python hl_lines="8-11"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="13  18"
-{!> ../../../docs_src/dependencies/tutorial001_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="15  20"
-{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="16  21"
-{!> ../../../docs_src/dependencies/tutorial001_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="15  20"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ commons: Annotated[dict, Depends(common_parameters)]
 //// tab | Python 3.10+
 
 ```Python hl_lines="12  16  21"
-{!> ../../../docs_src/dependencies/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an_py310.py!}
 ```
 
 ////
@@ -281,7 +281,7 @@ commons: Annotated[dict, Depends(common_parameters)]
 //// tab | Python 3.9+
 
 ```Python hl_lines="14  18  23"
-{!> ../../../docs_src/dependencies/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an_py39.py!}
 ```
 
 ////
@@ -289,7 +289,7 @@ commons: Annotated[dict, Depends(common_parameters)]
 //// tab | Python 3.8+
 
 ```Python hl_lines="15  19  24"
-{!> ../../../docs_src/dependencies/tutorial001_02_an.py!}
+{!> ../../docs_src/dependencies/tutorial001_02_an.py!}
 ```
 
 ////
index 332470396b685115fbbd0a0ad2e87a8b1c3fd07e..ae0fd0824d3427d604e7f646b7a25553f9dbf2ea 100644 (file)
@@ -13,7 +13,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -21,7 +21,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -29,7 +29,7 @@
 //// tab | Python 3.6+
 
 ```Python hl_lines="9-10"
-{!> ../../../docs_src/dependencies/tutorial005_an.py!}
+{!> ../../docs_src/dependencies/tutorial005_an.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@
 ///
 
 ```Python hl_lines="6-7"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@
 ///
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -81,7 +81,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -89,7 +89,7 @@
 //// tab | Python 3.6+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/dependencies/tutorial005_an.py!}
+{!> ../../docs_src/dependencies/tutorial005_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/dependencies/tutorial005_an_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/dependencies/tutorial005_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial005_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.6+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/dependencies/tutorial005_an.py!}
+{!> ../../docs_src/dependencies/tutorial005_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial005_py310.py!}
+{!> ../../docs_src/dependencies/tutorial005_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/dependencies/tutorial005.py!}
+{!> ../../docs_src/dependencies/tutorial005.py!}
 ```
 
 ////
index 02c3587f3fc14141dcd75d9774d1dd4cb8213542..c9900cb2c15db8b1c174fea740751efb05b0d7ed 100644 (file)
@@ -23,7 +23,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  21"
-{!> ../../../docs_src/encoder/tutorial001_py310.py!}
+{!> ../../docs_src/encoder/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | Python 3.6+
 
 ```Python hl_lines="5  22"
-{!> ../../../docs_src/encoder/tutorial001.py!}
+{!> ../../docs_src/encoder/tutorial001.py!}
 ```
 
 ////
index 2650bb0aff8da51808b76c5b2dcfdf159650178d..82cb0ff7a0f25ba6f97ecb3f4f221d97e67f6353 100644 (file)
@@ -58,7 +58,7 @@
 //// tab | Python 3.8 и выше
 
 ```Python hl_lines="1  3  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
@@ -66,7 +66,7 @@
 //// tab | Python 3.10 и выше
 
 ```Python hl_lines="1  2  11-15"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
@@ -76,7 +76,7 @@
 //// tab | Python 3.8 и выше
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@
 //// tab | Python 3.10 и выше
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
index 2aac76aa3be4f58b258ef5ef084242472ca81261..e7ff3f40f21d70c64760e0358688887dd3859c03 100644 (file)
@@ -23,7 +23,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  9  14  20  22  27-28  31-33  38-39"
-{!> ../../../docs_src/extra_models/tutorial001_py310.py!}
+{!> ../../docs_src/extra_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  11  16  22  24  29-30  33-35  40-41"
-{!> ../../../docs_src/extra_models/tutorial001.py!}
+{!> ../../docs_src/extra_models/tutorial001.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ UserInDB(
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  13-14  17-18  21-22"
-{!> ../../../docs_src/extra_models/tutorial002_py310.py!}
+{!> ../../docs_src/extra_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ UserInDB(
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  15-16  19-20  23-24"
-{!> ../../../docs_src/extra_models/tutorial002.py!}
+{!> ../../docs_src/extra_models/tutorial002.py!}
 ```
 
 ////
@@ -201,7 +201,7 @@ UserInDB(
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  14-15  18-20  33"
-{!> ../../../docs_src/extra_models/tutorial003_py310.py!}
+{!> ../../docs_src/extra_models/tutorial003_py310.py!}
 ```
 
 ////
@@ -209,7 +209,7 @@ UserInDB(
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  14-15  18-20  33"
-{!> ../../../docs_src/extra_models/tutorial003.py!}
+{!> ../../docs_src/extra_models/tutorial003.py!}
 ```
 
 ////
@@ -237,7 +237,7 @@ some_variable: PlaneItem | CarItem
 //// tab | Python 3.9+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/extra_models/tutorial004_py39.py!}
+{!> ../../docs_src/extra_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ some_variable: PlaneItem | CarItem
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  20"
-{!> ../../../docs_src/extra_models/tutorial004.py!}
+{!> ../../docs_src/extra_models/tutorial004.py!}
 ```
 
 ////
@@ -261,7 +261,7 @@ some_variable: PlaneItem | CarItem
 //// tab | Python 3.9+
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/extra_models/tutorial005_py39.py!}
+{!> ../../docs_src/extra_models/tutorial005_py39.py!}
 ```
 
 ////
@@ -269,7 +269,7 @@ some_variable: PlaneItem | CarItem
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  8"
-{!> ../../../docs_src/extra_models/tutorial005.py!}
+{!> ../../docs_src/extra_models/tutorial005.py!}
 ```
 
 ////
index e60d58823a4106a348e9caf302d6c4c7da7d4840..b1de217cd48b847ac7d17460fd73679e8603acf0 100644 (file)
@@ -3,7 +3,7 @@
 Самый простой FastAPI файл может выглядеть так:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Скопируйте в файл `main.py`.
@@ -134,7 +134,7 @@ OpenAPI описывает схему API. Эта схема содержит о
 ### Шаг 1: импортируйте `FastAPI`
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI` это класс в Python, который предоставляет всю функциональность для API.
@@ -150,7 +150,7 @@ OpenAPI описывает схему API. Эта схема содержит о
 ### Шаг 2: создайте экземпляр `FastAPI`
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Переменная `app` является экземпляром класса `FastAPI`.
@@ -172,7 +172,7 @@ $ uvicorn main:app --reload
 Если создать такое приложение:
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
 ```
 
 И поместить его в `main.py`, тогда вызов `uvicorn` будет таким:
@@ -251,7 +251,7 @@ https://example.com/items/foo
 #### Определите *декоратор операции пути (path operation decorator)*
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Декоратор `@app.get("/")` указывает **FastAPI**, что функция, прямо под ним, отвечает за обработку запросов, поступающих по адресу:
@@ -307,7 +307,7 @@ https://example.com/items/foo
 * **функция**: функция ниже "декоратора" (ниже `@app.get("/")`).
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Это обычная Python функция.
@@ -321,7 +321,7 @@ https://example.com/items/foo
 Вы также можете определить ее как обычную функцию вместо `async def`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note | "Технические детали"
@@ -333,7 +333,7 @@ https://example.com/items/foo
 ### Шаг 5: верните результат
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Вы можете вернуть `dict`, `list`, отдельные значения `str`, `int` и т.д.
index 028f3e0d2ddbeaf89da882e1862b6cc08d58fede..e7bfb85aa3434670ee8b80af87e24b194cbfbf61 100644 (file)
@@ -26,7 +26,7 @@
 ### Импортируйте `HTTPException`
 
 ```Python hl_lines="1"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 ```
 
 ### Вызовите `HTTPException` в своем коде
@@ -42,7 +42,7 @@
 В данном примере, когда клиент запрашивает элемент по несуществующему ID, возникает исключение со статус-кодом `404`:
 
 ```Python hl_lines="11"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 ```
 
 ### Возвращаемый ответ
@@ -82,7 +82,7 @@
 Но в случае, если это необходимо для продвинутого сценария, можно добавить пользовательские заголовки:
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial002.py!}
+{!../../docs_src/handling_errors/tutorial002.py!}
 ```
 
 ## Установка пользовательских обработчиков исключений
@@ -96,7 +96,7 @@
 Можно добавить собственный обработчик исключений с помощью `@app.exception_handler()`:
 
 ```Python hl_lines="5-7  13-18  24"
-{!../../../docs_src/handling_errors/tutorial003.py!}
+{!../../docs_src/handling_errors/tutorial003.py!}
 ```
 
 Здесь, если запросить `/unicorns/yolo`, то *операция пути* вызовет `UnicornException`.
 Обработчик исключения получит объект `Request` и исключение.
 
 ```Python hl_lines="2  14-16"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 ```
 
 Теперь, если перейти к `/items/foo`, то вместо стандартной JSON-ошибки с:
@@ -189,7 +189,7 @@ path -> item_id
 Например, для этих ошибок можно вернуть обычный текстовый ответ вместо JSON:
 
 ```Python hl_lines="3-4  9-11  22"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 ```
 
 /// note | "Технические детали"
@@ -207,7 +207,7 @@ path -> item_id
 Вы можете использовать его при разработке приложения для регистрации тела и его отладки, возврата пользователю и т.д.
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial005.py!}
+{!../../docs_src/handling_errors/tutorial005.py!}
 ```
 
 Теперь попробуйте отправить недействительный элемент, например:
@@ -267,7 +267,7 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
 Если вы хотите использовать исключение вместе с теми же обработчиками исключений по умолчанию из **FastAPI**, вы можете импортировать и повторно использовать обработчики исключений по умолчанию из `fastapi.exception_handlers`:
 
 ```Python hl_lines="2-5  15  21"
-{!../../../docs_src/handling_errors/tutorial006.py!}
+{!../../docs_src/handling_errors/tutorial006.py!}
 ```
 
 В этом примере вы просто `выводите в терминал` ошибку с очень выразительным сообщением, но идея вам понятна. Вы можете использовать исключение, а затем просто повторно использовать стандартные обработчики исключений.
index 3b5e383282787928b57668d47a521b84e017c203..18e1e60d07330bffdd2a8e43b924cacf367cbe50 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001_an.py!}
+{!> ../../docs_src/header_params/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/header_params/tutorial001_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001.py!}
+{!> ../../docs_src/header_params/tutorial001.py!}
 ```
 
 ////
@@ -67,7 +67,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial001_an.py!}
+{!> ../../docs_src/header_params/tutorial001_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/header_params/tutorial001_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001.py!}
+{!> ../../docs_src/header_params/tutorial001.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial002_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial002_an_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/header_params/tutorial002_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial002_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/header_params/tutorial002_an.py!}
+{!> ../../docs_src/header_params/tutorial002_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/header_params/tutorial002_py310.py!}
+{!> ../../docs_src/header_params/tutorial002_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial002.py!}
+{!> ../../docs_src/header_params/tutorial002.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial003_an_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial003_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial003_an.py!}
+{!> ../../docs_src/header_params/tutorial003_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/header_params/tutorial003_py310.py!}
+{!> ../../docs_src/header_params/tutorial003_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_py39.py!}
+{!> ../../docs_src/header_params/tutorial003_py39.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003.py!}
+{!> ../../docs_src/header_params/tutorial003.py!}
 ```
 
 ////
index 9799fe538f16027f75f554b09e376843d0c27d53..246458f420cd05666cf63a2cd28b6a556b8573c5 100644 (file)
@@ -18,7 +18,7 @@
 Вы можете задать их следующим образом:
 
 ```Python hl_lines="3-16  19-31"
-{!../../../docs_src/metadata/tutorial001.py!}
+{!../../docs_src/metadata/tutorial001.py!}
 ```
 
 /// tip | "Подсказка"
@@ -52,7 +52,7 @@
 Создайте метаданные для ваших тегов и передайте их в параметре `openapi_tags`:
 
 ```Python hl_lines="3-16  18"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
 ```
 
 Помните, что вы можете использовать Markdown внутри описания, к примеру "login" будет отображен жирным шрифтом (**login**) и "fancy" будет отображаться курсивом (_fancy_).
@@ -67,7 +67,7 @@
 Используйте параметр `tags` с вашими *операциями пути* (и `APIRouter`ами), чтобы присвоить им различные теги:
 
 ```Python hl_lines="21  26"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
 ```
 
 /// info | "Дополнительная информация"
@@ -97,7 +97,7 @@
 К примеру, чтобы задать её отображение по адресу `/api/v1/openapi.json`:
 
 ```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial002.py!}
+{!../../docs_src/metadata/tutorial002.py!}
 ```
 
 Если вы хотите отключить схему OpenAPI полностью, вы можете задать `openapi_url=None`, это также отключит пользовательские интерфейсы документации, которые его использует.
 К примеру, чтобы задать отображение Swagger UI по адресу `/documentation` и отключить ReDoc:
 
 ```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial003.py!}
+{!../../docs_src/metadata/tutorial003.py!}
 ```
index 26b1726aded7d34b60b95752e7552f6266a8655b..5f3855af291e40d05b2c26b25736aa1ade4c2861 100644 (file)
@@ -19,7 +19,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  15"
-{!> ../../../docs_src/path_operation_configuration/tutorial001_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001_py310.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="3  17"
-{!> ../../../docs_src/path_operation_configuration/tutorial001_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001_py39.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="3  17"
-{!> ../../../docs_src/path_operation_configuration/tutorial001.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial001.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="15  20  25"
-{!> ../../../docs_src/path_operation_configuration/tutorial002_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002_py310.py!}
 ```
 
 ////
@@ -65,7 +65,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="17  22  27"
-{!> ../../../docs_src/path_operation_configuration/tutorial002_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002_py39.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="17  22  27"
-{!> ../../../docs_src/path_operation_configuration/tutorial002.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial002.py!}
 ```
 
 ////
@@ -91,7 +91,7 @@
 **FastAPI** поддерживает это так же, как и в случае с обычными строками:
 
 ```Python hl_lines="1  8-10  13  18"
-{!../../../docs_src/path_operation_configuration/tutorial002b.py!}
+{!../../docs_src/path_operation_configuration/tutorial002b.py!}
 ```
 
 ## Краткое и развёрнутое содержание
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/path_operation_configuration/tutorial003_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="20-21"
-{!> ../../../docs_src/path_operation_configuration/tutorial003_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="20-21"
-{!> ../../../docs_src/path_operation_configuration/tutorial003.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial003.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="17-25"
-{!> ../../../docs_src/path_operation_configuration/tutorial004_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="19-27"
-{!> ../../../docs_src/path_operation_configuration/tutorial004_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-27"
-{!> ../../../docs_src/path_operation_configuration/tutorial004.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial004.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/path_operation_configuration/tutorial005_py310.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/path_operation_configuration/tutorial005_py39.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/path_operation_configuration/tutorial005.py!}
+{!> ../../docs_src/path_operation_configuration/tutorial005.py!}
 ```
 
 ////
@@ -205,7 +205,7 @@ OpenAPI указывает, что каждой *операции пути* не
 Если вам необходимо пометить *операцию пути* как <abbr title="устаревшее, не рекомендовано к использованию">устаревшую</abbr>, при этом не удаляя её, передайте параметр `deprecated`:
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_operation_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_configuration/tutorial006.py!}
 ```
 
 Он будет четко помечен как устаревший в интерактивной документации:
index ced12c826e6804e22bedd77cf4ce249b28d90c8b..bf42ec7253056bd66437df474feeeb98768bafcb 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="3-4"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -77,7 +77,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -85,7 +85,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -167,7 +167,7 @@ Path-параметр всегда является обязательным, п
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002.py!}
 ```
 
 ////
@@ -177,7 +177,7 @@ Path-параметр всегда является обязательным, п
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -185,7 +185,7 @@ Path-параметр всегда является обязательным, п
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002_an.py!}
 ```
 
 ////
@@ -214,7 +214,7 @@ Path-параметр всегда является обязательным, п
 Python не будет ничего делать с `*`, но он будет знать, что все следующие параметры являются именованными аргументами (парами ключ-значение), также известными как <abbr title="From: K-ey W-ord Arg-uments"><code>kwargs</code></abbr>, даже если у них нет значений по умолчанию.
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
 ```
 
 ### Лучше с `Annotated`
@@ -224,7 +224,7 @@ Python не будет ничего делать с `*`, но он будет з
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -232,7 +232,7 @@ Python не будет ничего делать с `*`, но он будет з
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial003_an.py!}
 ```
 
 ////
@@ -246,7 +246,7 @@ Python не будет ничего делать с `*`, но он будет з
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -254,7 +254,7 @@ Python не будет ничего делать с `*`, но он будет з
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004_an.py!}
 ```
 
 ////
@@ -268,7 +268,7 @@ Python не будет ничего делать с `*`, но он будет з
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial004.py!}
 ```
 
 ////
@@ -283,7 +283,7 @@ Python не будет ничего делать с `*`, но он будет з
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -291,7 +291,7 @@ Python не будет ничего делать с `*`, но он будет з
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005_an.py!}
 ```
 
 ////
@@ -305,7 +305,7 @@ Python не будет ничего делать с `*`, но он будет з
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial005.py!}
 ```
 
 ////
@@ -323,7 +323,7 @@ Python не будет ничего делать с `*`, но он будет з
 //// tab | Python 3.9+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -331,7 +331,7 @@ Python не будет ничего делать с `*`, но он будет з
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006_an.py!}
 ```
 
 ////
@@ -345,7 +345,7 @@ Python не будет ничего делать с `*`, но он будет з
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial006.py!}
 ```
 
 ////
index dc3d64af4a125c9dfae1f4a87516250b51701696..d1d76cf7b0617defe2c5a142b4c5dfde69b6b45f 100644 (file)
@@ -3,7 +3,7 @@
 Вы можете определить "параметры" или "переменные" пути, используя синтаксис форматированных строк Python:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
 ```
 
 Значение параметра пути `item_id` будет передано в функцию в качестве аргумента `item_id`.
@@ -19,7 +19,7 @@
 Вы можете объявить тип параметра пути в функции, используя стандартные аннотации типов Python.
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
 ```
 
 Здесь, `item_id` объявлен типом `int`.
 
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
 ```
 
 Иначе путь для `/users/{user_id}` также будет соответствовать `/users/me`, "подразумевая", что он получает параметр `user_id` со значением `"me"`.
 Аналогично, вы не можете переопределить операцию с путем:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003b.py!}
+{!../../docs_src/path_params/tutorial003b.py!}
 ```
 
 Первый будет выполняться всегда, так как путь совпадает первым.
 Затем создайте атрибуты класса с фиксированными допустимыми значениями:
 
 ```Python hl_lines="1  6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// info | "Дополнительная информация"
 Определите *параметр пути*, используя в аннотации типа класс перечисления (`ModelName`), созданный ранее:
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 ### Проверьте документацию
 Вы можете сравнить это значение с *элементом перечисления* класса `ModelName`:
 
 ```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 #### Получение *значения перечисления*
 Можно получить фактическое значение (в данном случае - `str`) с помощью `model_name.value` или в общем случае `your_enum_member.value`:
 
 ```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// tip | "Подсказка"
 Они будут преобразованы в соответствующие значения (в данном случае - строки) перед их возвратом клиенту:
 
 ```Python hl_lines="18  21  23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 Вы отправите клиенту такой JSON-ответ:
 
@@ -251,7 +251,7 @@ OpenAPI не поддерживает способов объявления *п
 Можете использовать так:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
 ```
 
 /// tip | "Подсказка"
index e6653a837545613613d0bbb0f2d6448af43854ad..0054af6ed40571613967169698b4e35f1d55e57d 100644 (file)
@@ -7,7 +7,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial001_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -15,7 +15,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001.py!}
 ```
 
 ////
@@ -46,7 +46,7 @@ FastAPI определит параметр `q` как необязательн
 В Python 3.9 или выше, `Annotated` является частью стандартной библиотеки, таким образом вы можете импортировать его из `typing`.
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -58,7 +58,7 @@ FastAPI определит параметр `q` как необязательн
 Эта библиотека будет установлена вместе с FastAPI.
 
 ```Python hl_lines="3-4"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ q: Annotated[Union[str, None]] = None
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -124,7 +124,7 @@ q: Annotated[Union[str, None]] = None
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
 ```
 
 ////
@@ -154,7 +154,7 @@ q: Annotated[Union[str, None]] = None
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial002_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002_py310.py!}
 ```
 
 ////
@@ -162,7 +162,7 @@ q: Annotated[Union[str, None]] = None
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 ////
@@ -268,7 +268,7 @@ q: str = Query(default="rick")
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -276,7 +276,7 @@ q: str = Query(default="rick")
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -284,7 +284,7 @@ q: str = Query(default="rick")
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_an.py!}
 ```
 
 ////
@@ -298,7 +298,7 @@ q: str = Query(default="rick")
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial003_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003_py310.py!}
 ```
 
 ////
@@ -312,7 +312,7 @@ q: str = Query(default="rick")
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial003.py!}
 ```
 
 ////
@@ -324,7 +324,7 @@ q: str = Query(default="rick")
 //// tab | Python 3.10+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -332,7 +332,7 @@ q: str = Query(default="rick")
 //// tab | Python 3.9+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -340,7 +340,7 @@ q: str = Query(default="rick")
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_an.py!}
 ```
 
 ////
@@ -354,7 +354,7 @@ q: str = Query(default="rick")
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial004_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004_py310.py!}
 ```
 
 ////
@@ -368,7 +368,7 @@ q: str = Query(default="rick")
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial004.py!}
 ```
 
 ////
@@ -392,7 +392,7 @@ q: str = Query(default="rick")
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial005_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -400,7 +400,7 @@ q: str = Query(default="rick")
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial005_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005_an.py!}
 ```
 
 ////
@@ -414,7 +414,7 @@ q: str = Query(default="rick")
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial005.py!}
 ```
 
 ////
@@ -462,7 +462,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -470,7 +470,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006_an.py!}
 ```
 
 ////
@@ -484,7 +484,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006.py!}
 ```
 
 /// tip | "Подсказка"
@@ -504,7 +504,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b_an_py39.py!}
 ```
 
 ////
@@ -512,7 +512,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b_an.py!}
 ```
 
 ////
@@ -526,7 +526,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006b.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006b.py!}
 ```
 
 ////
@@ -550,7 +550,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an_py310.py!}
 ```
 
 ////
@@ -558,7 +558,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an_py39.py!}
 ```
 
 ////
@@ -566,7 +566,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_an.py!}
 ```
 
 ////
@@ -580,7 +580,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c_py310.py!}
 ```
 
 ////
@@ -594,7 +594,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006c.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006c.py!}
 ```
 
 ////
@@ -612,7 +612,7 @@ Pydantic, мощь которого используется в FastAPI для 
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  10"
-{!> ../../../docs_src/query_params_str_validations/tutorial006d_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006d_an_py39.py!}
 ```
 
 ////
@@ -620,7 +620,7 @@ Pydantic, мощь которого используется в FastAPI для 
 //// tab | Python 3.8+
 
 ```Python hl_lines="2  9"
-{!> ../../../docs_src/query_params_str_validations/tutorial006d_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006d_an.py!}
 ```
 
 ////
@@ -634,7 +634,7 @@ Pydantic, мощь которого используется в FastAPI для 
 ///
 
 ```Python hl_lines="2  8"
-{!> ../../../docs_src/query_params_str_validations/tutorial006d.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial006d.py!}
 ```
 
 ////
@@ -654,7 +654,7 @@ Pydantic, мощь которого используется в FastAPI для 
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an_py310.py!}
 ```
 
 ////
@@ -662,7 +662,7 @@ Pydantic, мощь которого используется в FastAPI для 
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an_py39.py!}
 ```
 
 ////
@@ -670,7 +670,7 @@ Pydantic, мощь которого используется в FastAPI для 
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_an.py!}
 ```
 
 ////
@@ -684,7 +684,7 @@ Pydantic, мощь которого используется в FastAPI для 
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py310.py!}
 ```
 
 ////
@@ -698,7 +698,7 @@ Pydantic, мощь которого используется в FastAPI для 
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011_py39.py!}
 ```
 
 ////
@@ -712,7 +712,7 @@ Pydantic, мощь которого используется в FastAPI для 
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial011.py!}
 ```
 
 ////
@@ -753,7 +753,7 @@ http://localhost:8000/items/?q=foo&q=bar
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_an_py39.py!}
 ```
 
 ////
@@ -761,7 +761,7 @@ http://localhost:8000/items/?q=foo&q=bar
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_an.py!}
 ```
 
 ////
@@ -775,7 +775,7 @@ http://localhost:8000/items/?q=foo&q=bar
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial012_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012_py39.py!}
 ```
 
 ////
@@ -789,7 +789,7 @@ http://localhost:8000/items/?q=foo&q=bar
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial012.py!}
 ```
 
 ////
@@ -818,7 +818,7 @@ http://localhost:8000/items/
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial013_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013_an_py39.py!}
 ```
 
 ////
@@ -826,7 +826,7 @@ http://localhost:8000/items/
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial013_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013_an.py!}
 ```
 
 ////
@@ -840,7 +840,7 @@ http://localhost:8000/items/
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial013.py!}
 ```
 
 ////
@@ -872,7 +872,7 @@ http://localhost:8000/items/
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an_py310.py!}
 ```
 
 ////
@@ -880,7 +880,7 @@ http://localhost:8000/items/
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an_py39.py!}
 ```
 
 ////
@@ -888,7 +888,7 @@ http://localhost:8000/items/
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_an.py!}
 ```
 
 ////
@@ -902,7 +902,7 @@ http://localhost:8000/items/
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial007_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007_py310.py!}
 ```
 
 ////
@@ -916,7 +916,7 @@ http://localhost:8000/items/
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial007.py!}
 ```
 
 ////
@@ -926,7 +926,7 @@ http://localhost:8000/items/
 //// tab | Python 3.10+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an_py310.py!}
 ```
 
 ////
@@ -934,7 +934,7 @@ http://localhost:8000/items/
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -942,7 +942,7 @@ http://localhost:8000/items/
 //// tab | Python 3.8+
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_an.py!}
 ```
 
 ////
@@ -956,7 +956,7 @@ http://localhost:8000/items/
 ///
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial008_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008_py310.py!}
 ```
 
 ////
@@ -970,7 +970,7 @@ http://localhost:8000/items/
 ///
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial008.py!}
 ```
 
 ////
@@ -996,7 +996,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an_py310.py!}
 ```
 
 ////
@@ -1004,7 +1004,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an_py39.py!}
 ```
 
 ////
@@ -1012,7 +1012,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_an.py!}
 ```
 
 ////
@@ -1026,7 +1026,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial009_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009_py310.py!}
 ```
 
 ////
@@ -1040,7 +1040,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial009.py!}
 ```
 
 ////
@@ -1056,7 +1056,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an_py310.py!}
 ```
 
 ////
@@ -1064,7 +1064,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | Python 3.9+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an_py39.py!}
 ```
 
 ////
@@ -1072,7 +1072,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_an.py!}
 ```
 
 ////
@@ -1086,7 +1086,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 ///
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/query_params_str_validations/tutorial010_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010_py310.py!}
 ```
 
 ////
@@ -1100,7 +1100,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 ///
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial010.py!}
 ```
 
 ////
@@ -1116,7 +1116,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an_py310.py!}
 ```
 
 ////
@@ -1124,7 +1124,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an_py39.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an_py39.py!}
 ```
 
 ////
@@ -1132,7 +1132,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_an.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_an.py!}
 ```
 
 ////
@@ -1146,7 +1146,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params_str_validations/tutorial014_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014_py310.py!}
 ```
 
 ////
@@ -1160,7 +1160,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params_str_validations/tutorial014.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial014.py!}
 ```
 
 ////
index 061f9be041c0bba36475bf365f7eb9a399dc432f..edf06746b974f3d4d3359118b0e39b4ce5dc93a5 100644 (file)
@@ -3,7 +3,7 @@
 Когда вы объявляете параметры функции, которые не являются параметрами пути,  они автоматически интерпретируются как "query"-параметры.
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
 ```
 
 Query-параметры представляют из себя набор пар ключ-значение, которые идут после знака `?` в URL-адресе, разделенные символами `&`.
@@ -66,7 +66,7 @@ http://127.0.0.1:8000/items/?skip=20
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial002_py310.py!}
+{!> ../../docs_src/query_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@ http://127.0.0.1:8000/items/?skip=20
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial002.py!}
+{!> ../../docs_src/query_params/tutorial002.py!}
 ```
 
 ////
@@ -94,7 +94,7 @@ http://127.0.0.1:8000/items/?skip=20
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial003_py310.py!}
+{!> ../../docs_src/query_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -102,7 +102,7 @@ http://127.0.0.1:8000/items/?skip=20
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial003.py!}
+{!> ../../docs_src/query_params/tutorial003.py!}
 ```
 
 ////
@@ -151,7 +151,7 @@ http://127.0.0.1:8000/items/foo?short=yes
 //// tab | Python 3.10+
 
 ```Python hl_lines="6  8"
-{!> ../../../docs_src/query_params/tutorial004_py310.py!}
+{!> ../../docs_src/query_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -159,7 +159,7 @@ http://127.0.0.1:8000/items/foo?short=yes
 //// tab | Python 3.8+
 
 ```Python hl_lines="8  10"
-{!> ../../../docs_src/query_params/tutorial004.py!}
+{!> ../../docs_src/query_params/tutorial004.py!}
 ```
 
 ////
@@ -173,7 +173,7 @@ http://127.0.0.1:8000/items/foo?short=yes
 Но если вы хотите сделать query-параметр обязательным, вы можете просто не указывать значение по умолчанию:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
 ```
 
 Здесь параметр запроса `needy` является обязательным параметром с типом данных  `str`.
@@ -221,7 +221,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params/tutorial006_py310.py!}
+{!> ../../docs_src/query_params/tutorial006_py310.py!}
 ```
 
 ////
@@ -229,7 +229,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params/tutorial006.py!}
+{!> ../../docs_src/query_params/tutorial006.py!}
 ```
 
 ////
index 1fbc4acc0bc7dbead128be1e028b903c31cffb9c..34b9c94fa2835c7771e1996be98d2c0bf9558547 100644 (file)
@@ -19,7 +19,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@
 //// tab | Python 3.6+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
 ```
 
 ////
@@ -41,7 +41,7 @@
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -61,7 +61,7 @@
 //// tab | Python 3.6+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/request_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.6+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/request_files/tutorial001_an.py!}
+{!> ../../docs_src/request_files/tutorial001_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/request_files/tutorial001.py!}
+{!> ../../docs_src/request_files/tutorial001.py!}
 ```
 
 ////
@@ -220,7 +220,7 @@ contents = myfile.file.read()
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py310.py!}
 ```
 
 ////
@@ -228,7 +228,7 @@ contents = myfile.file.read()
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an_py39.py!}
 ```
 
 ////
@@ -236,7 +236,7 @@ contents = myfile.file.read()
 //// tab | Python 3.6+
 
 ```Python hl_lines="10  18"
-{!> ../../../docs_src/request_files/tutorial001_02_an.py!}
+{!> ../../docs_src/request_files/tutorial001_02_an.py!}
 ```
 
 ////
@@ -250,7 +250,7 @@ contents = myfile.file.read()
 ///
 
 ```Python hl_lines="7  15"
-{!> ../../../docs_src/request_files/tutorial001_02_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_py310.py!}
 ```
 
 ////
@@ -264,7 +264,7 @@ contents = myfile.file.read()
 ///
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02.py!}
+{!> ../../docs_src/request_files/tutorial001_02.py!}
 ```
 
 ////
@@ -276,7 +276,7 @@ contents = myfile.file.read()
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  15"
-{!> ../../../docs_src/request_files/tutorial001_03_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an_py39.py!}
 ```
 
 ////
@@ -284,7 +284,7 @@ contents = myfile.file.read()
 //// tab | Python 3.6+
 
 ```Python hl_lines="8  14"
-{!> ../../../docs_src/request_files/tutorial001_03_an.py!}
+{!> ../../docs_src/request_files/tutorial001_03_an.py!}
 ```
 
 ////
@@ -298,7 +298,7 @@ contents = myfile.file.read()
 ///
 
 ```Python hl_lines="7  13"
-{!> ../../../docs_src/request_files/tutorial001_03.py!}
+{!> ../../docs_src/request_files/tutorial001_03.py!}
 ```
 
 ////
@@ -314,7 +314,7 @@ contents = myfile.file.read()
 //// tab | Python 3.9+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/request_files/tutorial002_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -322,7 +322,7 @@ contents = myfile.file.read()
 //// tab | Python 3.6+
 
 ```Python hl_lines="11  16"
-{!> ../../../docs_src/request_files/tutorial002_an.py!}
+{!> ../../docs_src/request_files/tutorial002_an.py!}
 ```
 
 ////
@@ -336,7 +336,7 @@ contents = myfile.file.read()
 ///
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/request_files/tutorial002_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_py39.py!}
 ```
 
 ////
@@ -350,7 +350,7 @@ contents = myfile.file.read()
 ///
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/request_files/tutorial002.py!}
+{!> ../../docs_src/request_files/tutorial002.py!}
 ```
 
 ////
@@ -372,7 +372,7 @@ contents = myfile.file.read()
 //// tab | Python 3.9+
 
 ```Python hl_lines="11  18-20"
-{!> ../../../docs_src/request_files/tutorial003_an_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -380,7 +380,7 @@ contents = myfile.file.read()
 //// tab | Python 3.6+
 
 ```Python hl_lines="12  19-21"
-{!> ../../../docs_src/request_files/tutorial003_an.py!}
+{!> ../../docs_src/request_files/tutorial003_an.py!}
 ```
 
 ////
@@ -394,7 +394,7 @@ contents = myfile.file.read()
 ///
 
 ```Python hl_lines="9  16"
-{!> ../../../docs_src/request_files/tutorial003_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_py39.py!}
 ```
 
 ////
@@ -408,7 +408,7 @@ contents = myfile.file.read()
 ///
 
 ```Python hl_lines="11  18"
-{!> ../../../docs_src/request_files/tutorial003.py!}
+{!> ../../docs_src/request_files/tutorial003.py!}
 ```
 
 ////
index b38962866a208e348cde5fbbfea6e8671df545c6..9b449bcd9bba7a1f75c6072ba50ca274a04ee940 100644 (file)
@@ -15,7 +15,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -23,7 +23,7 @@
 //// tab | Python 3.6+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an.py!}
 ```
 
 ////
@@ -37,7 +37,7 @@
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 ////
@@ -49,7 +49,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="10-12"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -57,7 +57,7 @@
 //// tab | Python 3.6+
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/request_forms_and_files/tutorial001_an.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001_an.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!> ../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 ////
index 3737f13472771ee0368a19e92f0cf355858eb20c..93b44437b2215080c808ff193a3cc789c2d459b8 100644 (file)
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
 ```
 
 ////
@@ -51,7 +51,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -59,7 +59,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
 ```
 
 ////
index f8c910fe958c8b93ec0ab1d1cbd57354b15ef87d..363e64676ffe2cf1082a1beba64928176bab49f7 100644 (file)
@@ -7,7 +7,7 @@ FastAPI позволяет использовать **аннотации тип
 //// tab | Python 3.10+
 
 ```Python hl_lines="16  21"
-{!> ../../../docs_src/response_model/tutorial001_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py310.py!}
 ```
 
 ////
@@ -15,7 +15,7 @@ FastAPI позволяет использовать **аннотации тип
 //// tab | Python 3.9+
 
 ```Python hl_lines="18  23"
-{!> ../../../docs_src/response_model/tutorial001_01_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_01_py39.py!}
 ```
 
 ////
@@ -23,7 +23,7 @@ FastAPI позволяет использовать **аннотации тип
 //// tab | Python 3.8+
 
 ```Python hl_lines="18  23"
-{!> ../../../docs_src/response_model/tutorial001_01.py!}
+{!> ../../docs_src/response_model/tutorial001_01.py!}
 ```
 
 ////
@@ -62,7 +62,7 @@ FastAPI будет использовать этот возвращаемый т
 //// tab | Python 3.10+
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_py310.py!}
 ```
 
 ////
@@ -70,7 +70,7 @@ FastAPI будет использовать этот возвращаемый т
 //// tab | Python 3.9+
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_py39.py!}
 ```
 
 ////
@@ -78,7 +78,7 @@ FastAPI будет использовать этот возвращаемый т
 //// tab | Python 3.8+
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001.py!}
+{!> ../../docs_src/response_model/tutorial001.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ FastAPI будет использовать значение `response_model` д
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  9"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
 ```
 
 ////
@@ -124,7 +124,7 @@ FastAPI будет использовать значение `response_model` д
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  11"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
 ```
 
 ////
@@ -142,7 +142,7 @@ FastAPI будет использовать значение `response_model` д
 //// tab | Python 3.10+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/response_model/tutorial002_py310.py!}
+{!> ../../docs_src/response_model/tutorial002_py310.py!}
 ```
 
 ////
@@ -150,7 +150,7 @@ FastAPI будет использовать значение `response_model` д
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/response_model/tutorial002.py!}
+{!> ../../docs_src/response_model/tutorial002.py!}
 ```
 
 ////
@@ -174,7 +174,7 @@ FastAPI будет использовать значение `response_model` д
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  11  16"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -182,7 +182,7 @@ FastAPI будет использовать значение `response_model` д
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  11  16"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -192,7 +192,7 @@ FastAPI будет использовать значение `response_model` д
 //// tab | Python 3.10+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -200,7 +200,7 @@ FastAPI будет использовать значение `response_model` д
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -210,7 +210,7 @@ FastAPI будет использовать значение `response_model` д
 //// tab | Python 3.10+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -218,7 +218,7 @@ FastAPI будет использовать значение `response_model` д
 //// tab | Python 3.8+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -248,7 +248,7 @@ FastAPI будет использовать значение `response_model` д
 //// tab | Python 3.10+
 
 ```Python hl_lines="7-10  13-14  18"
-{!> ../../../docs_src/response_model/tutorial003_01_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_01_py310.py!}
 ```
 
 ////
@@ -256,7 +256,7 @@ FastAPI будет использовать значение `response_model` д
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-13  15-16  20"
-{!> ../../../docs_src/response_model/tutorial003_01.py!}
+{!> ../../docs_src/response_model/tutorial003_01.py!}
 ```
 
 ////
@@ -302,7 +302,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
 Самый частый сценарий использования - это [возвращать Response напрямую, как описано в расширенной документации](../advanced/response-directly.md){.internal-link target=_blank}.
 
 ```Python hl_lines="8  10-11"
-{!> ../../../docs_src/response_model/tutorial003_02.py!}
+{!> ../../docs_src/response_model/tutorial003_02.py!}
 ```
 
 Это поддерживается FastAPI по-умолчанию, т.к. аннотация проставлена в классе (или подклассе) `Response`.
@@ -314,7 +314,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
 Вы также можете указать подкласс `Response` в аннотации типа:
 
 ```Python hl_lines="8-9"
-{!> ../../../docs_src/response_model/tutorial003_03.py!}
+{!> ../../docs_src/response_model/tutorial003_03.py!}
 ```
 
 Это сработает, потому что `RedirectResponse` является подклассом `Response` и FastAPI автоматически обработает этот простейший случай.
@@ -328,7 +328,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/response_model/tutorial003_04_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_04_py310.py!}
 ```
 
 ////
@@ -336,7 +336,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/response_model/tutorial003_04.py!}
+{!> ../../docs_src/response_model/tutorial003_04.py!}
 ```
 
 ////
@@ -354,7 +354,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/response_model/tutorial003_05_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_05_py310.py!}
 ```
 
 ////
@@ -362,7 +362,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/response_model/tutorial003_05.py!}
+{!> ../../docs_src/response_model/tutorial003_05.py!}
 ```
 
 ////
@@ -376,7 +376,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  11-12"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
 ```
 
 ////
@@ -384,7 +384,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
 //// tab | Python 3.9+
 
 ```Python hl_lines="11  13-14"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
 ```
 
 ////
@@ -392,7 +392,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
 //// tab | Python 3.8+
 
 ```Python hl_lines="11  13-14"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
 ```
 
 ////
@@ -412,7 +412,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
 //// tab | Python 3.10+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial004_py310.py!}
+{!> ../../docs_src/response_model/tutorial004_py310.py!}
 ```
 
 ////
@@ -420,7 +420,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
 //// tab | Python 3.9+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004_py39.py!}
+{!> ../../docs_src/response_model/tutorial004_py39.py!}
 ```
 
 ////
@@ -428,7 +428,7 @@ FastAPI совместно с Pydantic выполнит некоторую ма
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial004.py!}
+{!> ../../docs_src/response_model/tutorial004.py!}
 ```
 
 ////
@@ -523,7 +523,7 @@ FastAPI достаточно умен (на самом деле, это засл
 //// tab | Python 3.10+
 
 ```Python hl_lines="29  35"
-{!> ../../../docs_src/response_model/tutorial005_py310.py!}
+{!> ../../docs_src/response_model/tutorial005_py310.py!}
 ```
 
 ////
@@ -531,7 +531,7 @@ FastAPI достаточно умен (на самом деле, это засл
 //// tab | Python 3.8+
 
 ```Python hl_lines="31  37"
-{!> ../../../docs_src/response_model/tutorial005.py!}
+{!> ../../docs_src/response_model/tutorial005.py!}
 ```
 
 ////
@@ -551,7 +551,7 @@ FastAPI достаточно умен (на самом деле, это засл
 //// tab | Python 3.10+
 
 ```Python hl_lines="29  35"
-{!> ../../../docs_src/response_model/tutorial006_py310.py!}
+{!> ../../docs_src/response_model/tutorial006_py310.py!}
 ```
 
 ////
@@ -559,7 +559,7 @@ FastAPI достаточно умен (на самом деле, это засл
 //// tab | Python 3.8+
 
 ```Python hl_lines="31  37"
-{!> ../../../docs_src/response_model/tutorial006.py!}
+{!> ../../docs_src/response_model/tutorial006.py!}
 ```
 
 ////
index a36c42d054592dc376bc687df725bcebb22f182d..48808bea77cce5ab337ff70572e9529a77ee78b8 100644 (file)
@@ -9,7 +9,7 @@
 * и других.
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 /// note | "Примечание"
@@ -77,7 +77,7 @@ FastAPI знает об этом и создаст документацию Open
 Рассмотрим предыдущий пример еще раз:
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 `201` – это код статуса "Создано".
@@ -87,7 +87,7 @@ FastAPI знает об этом и создаст документацию Open
 Для удобства вы можете использовать переменные из `fastapi.status`.
 
 ```Python hl_lines="1  6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
 ```
 
 Они содержат те же числовые значения, но позволяют использовать подсказки редактора для выбора кода статуса:
index 1b216de3af15028a6746ca3b05b9839408cb03b5..daa264afc86914f390c53629dd4d7cb1fe5b0a3a 100644 (file)
@@ -11,7 +11,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="13-21"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="15-23"
-{!> ../../../docs_src/schema_extra_example/tutorial001.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="2  8-11"
-{!> ../../../docs_src/schema_extra_example/tutorial002_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002_py310.py!}
 ```
 
 ////
@@ -51,7 +51,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  10-13"
-{!> ../../../docs_src/schema_extra_example/tutorial002.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="22-27"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -91,7 +91,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="22-27"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -99,7 +99,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="23-28"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="18-23"
-{!> ../../../docs_src/schema_extra_example/tutorial003_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="20-25"
-{!> ../../../docs_src/schema_extra_example/tutorial003.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="23-49"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="24-50"
-{!> ../../../docs_src/schema_extra_example/tutorial004_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="19-45"
-{!> ../../../docs_src/schema_extra_example/tutorial004_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="21-47"
-{!> ../../../docs_src/schema_extra_example/tutorial004.py!}
+{!> ../../docs_src/schema_extra_example/tutorial004.py!}
 ```
 
 ////
index 444a069154f65197d94af71ddc408e7406afe255..c98ce2c60a0bb9db312f61b45af8ab6eeafbd9fa 100644 (file)
@@ -23,7 +23,7 @@
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@
 ///
 
 ```Python
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
 ```
 
 ////
@@ -155,7 +155,7 @@ OAuth2 был разработан для того, чтобы бэкэнд ил
 //// tab | Python 3.9+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -163,7 +163,7 @@ OAuth2 был разработан для того, чтобы бэкэнд ил
 //// tab | Python 3.8+
 
 ```Python  hl_lines="7"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
 ```
 
 ////
@@ -177,7 +177,7 @@ OAuth2 был разработан для того, чтобы бэкэнд ил
 ///
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
 ```
 
 ////
@@ -221,7 +221,7 @@ oauth2_scheme(some, parameters)
 //// tab | Python 3.9+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -229,7 +229,7 @@ oauth2_scheme(some, parameters)
 //// tab | Python 3.8+
 
 ```Python  hl_lines="11"
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
 ```
 
 ////
@@ -243,7 +243,7 @@ oauth2_scheme(some, parameters)
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
 ```
 
 ////
index ccddae249c4d310d44e79965483e35ebe2031d88..4734554f30b731839ba02c6c1abf95fa5552db1e 100644 (file)
@@ -8,7 +8,7 @@
 * "Примонтируйте" экземпляр `StaticFiles()` с указанием определенной директории.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
 ```
 
 /// note | "Технические детали"
index efefbfb01765e49f06c856615254ff660fa2d687..ae045bbbee5d133eeb36585702f2948f03a74062 100644 (file)
@@ -27,7 +27,7 @@
 Напишите простое утверждение с `assert` дабы проверить истинность Python-выражения (это тоже стандарт `pytest`).
 
 ```Python hl_lines="2  12  15-18"
-{!../../../docs_src/app_testing/tutorial001.py!}
+{!../../docs_src/app_testing/tutorial001.py!}
 ```
 
 /// tip | "Подсказка"
@@ -75,7 +75,7 @@
 
 
 ```Python
-{!../../../docs_src/app_testing/main.py!}
+{!../../docs_src/app_testing/main.py!}
 ```
 
 ### Файл тестов
@@ -93,7 +93,7 @@
 Так как оба файла находятся в одной директории, для импорта объекта приложения из файла `main` в файл `test_main` Вы можете использовать относительный импорт:
 
 ```Python hl_lines="3"
-{!../../../docs_src/app_testing/test_main.py!}
+{!../../docs_src/app_testing/test_main.py!}
 ```
 
 ...и писать дальше тесты, как и раньше.
 //// tab | Python 3.10+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py310/main.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an_py39/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py39/main.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an/main.py!}
+{!> ../../docs_src/app_testing/app_b_an/main.py!}
 ```
 
 ////
 ///
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_py310/main.py!}
 ```
 
 ////
 ///
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/main.py!}
+{!> ../../docs_src/app_testing/app_b/main.py!}
 ```
 
 ////
 Теперь обновим файл `test_main.py`, добавив в него тестов:
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/test_main.py!}
+{!> ../../docs_src/app_testing/app_b/test_main.py!}
 ```
 
 Если Вы не знаете, как передать информацию в запросе, можете воспользоваться поисковиком (погуглить) и задать вопрос: "Как передать информацию в запросе с помощью `httpx`", можно даже спросить: "Как передать информацию в запросе с помощью `requests`", поскольку дизайн HTTPX основан на дизайне Requests.
index 59a2499e206a2589b29e07c4106bec9f3df17137..aa8a040d0e82871941d264d9cff6598c43f41f71 100644 (file)
@@ -5,7 +5,7 @@ WebSockets testi yapmak için `TestClient`'ı kullanabilirsiniz.
 Bu işlem için, `TestClient`'ı bir `with` ifadesinde kullanarak WebSocket'e bağlanabilirsiniz:
 
 ```Python hl_lines="27-31"
-{!../../../docs_src/app_testing/tutorial002.py!}
+{!../../docs_src/app_testing/tutorial002.py!}
 ```
 
 /// note | "Not"
index 54a6f20e29e8dabcc1592878bc33dac0af3253ff..bc8da16df380afeea238bf3004dc592bf0d7c672 100644 (file)
@@ -13,7 +13,7 @@ Ardından WSGI (örneğin Flask) uygulamanızı middleware ile sarmalayın.
 Son olarak da bir yol altında bağlama işlemini gerçekleştirin.
 
 ```Python hl_lines="2-3  23"
-{!../../../docs_src/wsgi/tutorial001.py!}
+{!../../docs_src/wsgi/tutorial001.py!}
 ```
 
 ## Kontrol Edelim
index b8b880c6d93969939259460ba821ae64270a3e36..9584a57322aa7dd0e5e118e22408fde987f0cf08 100644 (file)
@@ -23,7 +23,7 @@ Python uzmanıysanız ve tip belirteçleri ilgili her şeyi zaten biliyorsanız,
 Basit bir örnek ile başlayalım:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 Programın çıktısı:
@@ -39,7 +39,7 @@ Fonksiyon sırayla şunları yapar:
 * Değişkenleri aralarında bir boşlukla beraber <abbr title="Onları bir bütün olarak sırayla birleştirir.">Birleştirir</abbr>.
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### Düzenle
@@ -83,7 +83,7 @@ Bu kadar.
 İşte bunlar "tip belirteçleri":
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 Bu, aşağıdaki gibi varsayılan değerleri bildirmekle aynı şey değildir:
@@ -113,7 +113,7 @@ Aradığınızı bulana kadar seçenekleri kaydırabilirsiniz:
 Bu fonksiyon, zaten tür belirteçlerine sahip:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 Editör değişkenlerin tiplerini bildiğinden, yalnızca otomatik tamamlama değil, hata kontrolleri de sağlar:
@@ -123,7 +123,7 @@ Editör değişkenlerin tiplerini bildiğinden, yalnızca otomatik tamamlama de
 Artık `age` değişkenini `str(age)` olarak kullanmanız gerektiğini biliyorsunuz:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## Tip bildirme
@@ -144,7 +144,7 @@ Yalnızca `str` değil, tüm standart Python tiplerinin bildirebilirsiniz.
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### Tip parametreleri ile Generic tipler
@@ -162,7 +162,7 @@ Bu tür tip belirteçlerini desteklemek için özel olarak mevcuttur.
 From `typing`, import `List` (büyük harf olan `L` ile):
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 Değişkenin tipini yine iki nokta üstüste (`:`) ile belirleyin.
@@ -172,7 +172,7 @@ tip olarak `List` kullanın.
 Liste, bazı dahili tipleri içeren bir tür olduğundan, bunları köşeli parantez içine alırsınız:
 
 ```Python hl_lines="4"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 /// tip | "Ipucu"
@@ -200,7 +200,7 @@ Ve yine, editör bunun bir `str` ​​olduğunu biliyor ve bunun için destek s
 `Tuple` ve `set`lerin tiplerini bildirmek için de aynısını yapıyoruz:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial007.py!}
+{!../../docs_src/python_types/tutorial007.py!}
 ```
 
 Bu şu anlama geliyor:
@@ -217,7 +217,7 @@ Bir `dict` tanımlamak için virgülle ayrılmış iki parametre verebilirsiniz.
 İkinci parametre ise `dict` değerinin `value` değeri içindir:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial008.py!}
+{!../../docs_src/python_types/tutorial008.py!}
 ```
 
 Bu şu anlama gelir:
@@ -231,7 +231,7 @@ Bu şu anlama gelir:
 `Optional` bir değişkenin `str`gibi bir tipi olabileceğini ama isteğe bağlı olarak tipinin `None` olabileceğini belirtir:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 `str` yerine `Optional[str]` kullanmak editorün bu değerin her zaman `str` tipinde değil bazen `None` tipinde de olabileceğini belirtir ve hataları tespit etmemizde yardımcı olur.
@@ -256,13 +256,13 @@ Bir değişkenin tipini bir sınıf ile bildirebilirsiniz.
 Diyelim ki  `name` değerine sahip `Person` sınıfınız var:
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Sonra bir değişkeni 'Person' tipinde tanımlayabilirsiniz:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Ve yine bütün editör desteğini alırsınız:
@@ -284,7 +284,7 @@ Ve ortaya çıkan nesne üzerindeki bütün editör desteğini alırsınız.
 Resmi Pydantic dokümanlarından alınmıştır:
 
 ```Python
-{!../../../docs_src/python_types/tutorial011.py!}
+{!../../docs_src/python_types/tutorial011.py!}
 ```
 
 /// info
index 807f85e8a6ee9b4ce6553d8fadc61b875c19582e..895cf9b03250e9496abb63599e324e4d3f144816 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
@@ -67,7 +67,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -111,7 +111,7 @@ Mümkün mertebe 'Annotated' sınıfını kullanmaya çalışın.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
index 76c035992b6cfcb3a93ae455dc7975ffdc3eaaab..335fcaeced3a767e715dbbbf7bda571fb6400c21 100644 (file)
@@ -3,7 +3,7 @@
 En sade FastAPI dosyası şu şekilde görünür:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Yukarıdaki içeriği bir `main.py` dosyasına kopyalayalım.
@@ -134,7 +134,7 @@ Ayrıca, API'ınızla iletişim kuracak önyüz, mobil veya IoT uygulamaları gi
 ### Adım 1: `FastAPI`yı Projemize Dahil Edelim
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI`, API'niz için tüm işlevselliği sağlayan bir Python sınıfıdır.
@@ -150,7 +150,7 @@ Ayrıca, API'ınızla iletişim kuracak önyüz, mobil veya IoT uygulamaları gi
 ### Adım 2: Bir `FastAPI` "Örneği" Oluşturalım
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Burada `app` değişkeni `FastAPI` sınıfının bir örneği olacaktır.
@@ -172,7 +172,7 @@ $ uvicorn main:app --reload
 Uygulamanızı aşağıdaki gibi oluşturursanız:
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
 ```
 
 Ve bunu `main.py` dosyasına yerleştirirseniz eğer `uvicorn` komutunu şu şekilde çalıştırabilirsiniz:
@@ -251,7 +251,7 @@ Biz de onları "**operasyonlar**" olarak adlandıracağız.
 #### Bir *Yol Operasyonu Dekoratörü* Tanımlayalım
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `@app.get("/")` dekoratörü, **FastAPI**'a hemen altındaki fonksiyonun aşağıdaki durumlardan sorumlu olduğunu söyler:
@@ -307,7 +307,7 @@ Aşağıdaki, bizim **yol operasyonu fonksiyonumuzdur**:
 * **fonksiyon**: "dekoratör"ün (`@app.get("/")`'in) altındaki fonksiyondur.
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Bu bir Python fonksiyonudur.
@@ -321,7 +321,7 @@ Bu durumda bu fonksiyon bir `async` fonksiyondur.
 Bu fonksiyonu `async def` yerine normal bir fonksiyon olarak da tanımlayabilirsiniz.
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note | "Not"
@@ -333,7 +333,7 @@ Eğer farkı bilmiyorsanız, [Async: *"Aceleniz mi var?"*](../async.md#in-a-hurr
 ### Adım 5: İçeriği Geri Döndürün
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Bir `dict`, `list` veya `str`, `int` gibi tekil değerler döndürebilirsiniz.
index d36242083d1fb8df4917ed3849374d061a5880c1..9017d99abd37f3336291674fc4c74aae5ea6f5a9 100644 (file)
@@ -3,7 +3,7 @@
 Yol "parametrelerini" veya "değişkenlerini" Python <abbr title="String Biçimleme: Format String">string biçimlemede</abbr> kullanılan sözdizimi ile tanımlayabilirsiniz.
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
 ```
 
 Yol parametresi olan `item_id`'nin değeri, fonksiyonunuza `item_id` argümanı olarak aktarılacaktır.
@@ -19,7 +19,7 @@ Eğer bu örneği çalıştırıp <a href="http://127.0.0.1:8000/items/foo" clas
 Standart Python tip belirteçlerini kullanarak yol parametresinin tipini fonksiyonun içerisinde tanımlayabilirsiniz.
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
 ```
 
 Bu durumda, `item_id` bir `int` olarak tanımlanacaktır.
@@ -124,7 +124,7 @@ Benzer şekilde `/users/{user_id}` gibi tanımlanmış ve belirli bir kullanıc
 *Yol operasyonları* sıralı bir şekilde gözden geçirildiğinden dolayı `/users/me` yolunun `/users/{user_id}` yolundan önce tanımlanmış olmasından emin olmanız gerekmektedir:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
 ```
 
 Aksi halde, `/users/{user_id}` yolu `"me"` değerinin `user_id` parametresi için gönderildiğini "düşünerek" `/users/me` ile de eşleşir.
@@ -132,7 +132,7 @@ Aksi halde, `/users/{user_id}` yolu `"me"` değerinin `user_id` parametresi içi
 Benzer şekilde, bir yol operasyonunu yeniden tanımlamanız mümkün değildir:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003b.py!}
+{!../../docs_src/path_params/tutorial003b.py!}
 ```
 
 Yol, ilk kısım ile eşleştiğinden dolayı her koşulda ilk yol operasyonu kullanılacaktır.
@@ -150,7 +150,7 @@ Eğer *yol parametresi* alan bir *yol operasyonunuz* varsa ve alabileceği *yol
 Sonrasında, sınıf içerisinde, mevcut ve geçerli değerler olacak olan sabit değerli özelliklerini oluşturalım:
 
 ```Python hl_lines="1  6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// info | "Bilgi"
@@ -170,7 +170,7 @@ Merak ediyorsanız söyleyeyim, "AlexNet", "ResNet" ve "LeNet" isimleri Makine 
 Sonrasında, yarattığımız enum sınıfını (`ModelName`) kullanarak tip belirteci aracılığıyla bir *yol parametresi* oluşturalım:
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 ### Dokümana Göz Atalım
@@ -188,7 +188,7 @@ Sonrasında, yarattığımız enum sınıfını (`ModelName`) kullanarak tip bel
 Parametreyi, yarattığınız enum olan `ModelName` içerisindeki *enumeration üyesi* ile karşılaştırabilirsiniz:
 
 ```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 #### *Enumeration Değerini* Edinelim
@@ -196,7 +196,7 @@ Parametreyi, yarattığınız enum olan `ModelName` içerisindeki *enumeration 
 `model_name.value` veya genel olarak `your_enum_member.value` tanımlarını kullanarak (bu durumda bir `str` olan) gerçek değere ulaşabilirsiniz:
 
 ```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// tip | "İpucu"
@@ -212,7 +212,7 @@ JSON gövdesine (örneğin bir `dict`) gömülü olsalar bile *yol operasyonunda
 Bu üyeler istemciye iletilmeden önce kendilerine karşılık gelen değerlerine (bu durumda string) dönüştürüleceklerdir:
 
 ```Python hl_lines="18  21  23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 İstemci tarafında şuna benzer bir JSON yanıtı ile karşılaşırsınız:
@@ -253,7 +253,7 @@ Bu durumda, parametrenin adı `file_path` olacaktır ve son kısım olan `:path`
 Böylece şunun gibi bir kullanım yapabilirsiniz:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
 ```
 
 /// tip | "İpucu"
index bf66dbe743e0d7f9b991170b33cec6e967f9ad45..886f5783f4e8cf2678eae424b9623079bcf6012b 100644 (file)
@@ -3,7 +3,7 @@
 Fonksiyonda yol parametrelerinin parçası olmayan diğer tanımlamalar otomatik olarak "sorgu" parametresi olarak yorumlanır.
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
 ```
 
 Sorgu, bağlantıdaki `?` kısmından sonra gelen ve `&` işareti ile ayrılan anahtar-değer çiftlerinin oluşturduğu bir kümedir.
@@ -66,7 +66,7 @@ Aynı şekilde, varsayılan değerlerini `None` olarak atayarak isteğe bağlı
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial002_py310.py!}
+{!> ../../docs_src/query_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@ Aynı şekilde, varsayılan değerlerini `None` olarak atayarak isteğe bağlı
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial002.py!}
+{!> ../../docs_src/query_params/tutorial002.py!}
 ```
 
 ////
@@ -94,7 +94,7 @@ Aşağıda görüldüğü gibi dönüştürülmek üzere `bool` tipleri de tanı
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial003_py310.py!}
+{!> ../../docs_src/query_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -102,7 +102,7 @@ Aşağıda görüldüğü gibi dönüştürülmek üzere `bool` tipleri de tanı
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial003.py!}
+{!> ../../docs_src/query_params/tutorial003.py!}
 ```
 
 ////
@@ -151,7 +151,7 @@ Ve parametreleri, herhangi bir sıraya koymanıza da gerek yoktur.
 //// tab | Python 3.10+
 
 ```Python hl_lines="6  8"
-{!> ../../../docs_src/query_params/tutorial004_py310.py!}
+{!> ../../docs_src/query_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -159,7 +159,7 @@ Ve parametreleri, herhangi bir sıraya koymanıza da gerek yoktur.
 //// tab | Python 3.8+
 
 ```Python hl_lines="8  10"
-{!> ../../../docs_src/query_params/tutorial004.py!}
+{!> ../../docs_src/query_params/tutorial004.py!}
 ```
 
 ////
@@ -173,7 +173,7 @@ Parametre için belirli bir değer atamak istemeyip parametrenin sadece isteğe
 Fakat, bir sorgu parametresini zorunlu yapmak istiyorsanız varsayılan bir değer atamamanız yeterli olacaktır:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
 ```
 
 Burada `needy` parametresi `str` tipinden oluşan zorunlu bir sorgu parametresidir.
@@ -223,7 +223,7 @@ Ve elbette, bazı parametreleri zorunlu, bazılarını varsayılan değerli ve b
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params/tutorial006_py310.py!}
+{!> ../../docs_src/query_params/tutorial006_py310.py!}
 ```
 
 ////
@@ -231,7 +231,7 @@ Ve elbette, bazı parametreleri zorunlu, bazılarını varsayılan değerli ve b
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params/tutorial006.py!}
+{!> ../../docs_src/query_params/tutorial006.py!}
 ```
 
 ////
index 8e8ccfba4690ba4f6e89f659913e2d1d8d49785e..19b6150ffa0c7f28487cf241f377cd7f065824c1 100644 (file)
@@ -17,7 +17,7 @@ Formları kullanmak için öncelikle <a href="https://github.com/Kludex/python-m
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@ Formları kullanmak için öncelikle <a href="https://github.com/Kludex/python-m
 //// tab | Python 3.8+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
 ```
 
 ////
@@ -51,7 +51,7 @@ Form parametrelerini `Body` veya `Query` için yaptığınız gibi oluşturun:
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/request_forms/tutorial001_an_py39.py!}
+{!> ../../docs_src/request_forms/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -59,7 +59,7 @@ Form parametrelerini `Body` veya `Query` için yaptığınız gibi oluşturun:
 //// tab | Python 3.8+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/request_forms/tutorial001_an.py!}
+{!> ../../docs_src/request_forms/tutorial001_an.py!}
 ```
 
 ////
@@ -73,7 +73,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/request_forms/tutorial001.py!}
+{!> ../../docs_src/request_forms/tutorial001.py!}
 ```
 
 ////
index b82be611f924c09f752083a2c0c0b0b6e003d369..8bff59744e884fdeab21453578fec65481d5424b 100644 (file)
@@ -8,7 +8,7 @@
 * Bir `StaticFiles()` örneğini belirli bir yola bağlayın.
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
 ```
 
 /// note | "Teknik Detaylar"
index 511a5264a7000c4afbafe9eb139de22a97b43647..573b5372c5803c65dfecaf200bcb58fe47895a32 100644 (file)
@@ -23,7 +23,7 @@ Python підтримує додаткові "підказки типу" ("type
 Давайте почнемо з простого прикладу:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 Виклик цієї програми виводить:
@@ -39,7 +39,7 @@ John Doe
 * <abbr title="З’єднує їх, як одне ціле. З вмістом один за одним.">Конкатенує</abbr> їх разом із пробілом по середині.
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### Редагуйте це
@@ -83,7 +83,7 @@ John Doe
 Це "type hints":
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 Це не те саме, що оголошення значень за замовчуванням, як це було б з:
@@ -113,7 +113,7 @@ John Doe
 Перевірте цю функцію, вона вже має анотацію типу:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 Оскільки редактор знає типи змінних, ви не тільки отримаєте автозаповнення, ви також отримаєте перевірку помилок:
@@ -123,7 +123,7 @@ John Doe
 Тепер ви знаєте, щоб виправити це, вам потрібно перетворити `age` у строку з допомогою `str(age)`:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## Оголошення типів
@@ -144,7 +144,7 @@ John Doe
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### Generic-типи з параметрами типів
@@ -172,7 +172,7 @@ John Doe
 З модуля `typing`, імпортуємо `List` (з великої літери `L`):
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 Оголосимо змінну з тим самим синтаксисом двокрапки (`:`).
@@ -182,7 +182,7 @@ John Doe
 Оскільки список є типом, який містить деякі внутрішні типи, ви поміщаєте їх у квадратні дужки:
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 ////
@@ -196,7 +196,7 @@ John Doe
 Оскільки список є типом, який містить деякі внутрішні типи, ви поміщаєте їх у квадратні дужки:
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006_py39.py!}
+{!> ../../docs_src/python_types/tutorial006_py39.py!}
 ```
 
 ////
@@ -234,7 +234,7 @@ John Doe
 //// tab | Python 3.8 і вище
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial007.py!}
+{!> ../../docs_src/python_types/tutorial007.py!}
 ```
 
 ////
@@ -242,7 +242,7 @@ John Doe
 //// tab | Python 3.9 і вище
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial007_py39.py!}
+{!> ../../docs_src/python_types/tutorial007_py39.py!}
 ```
 
 ////
@@ -263,7 +263,7 @@ John Doe
 //// tab | Python 3.8 і вище
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008.py!}
+{!> ../../docs_src/python_types/tutorial008.py!}
 ```
 
 ////
@@ -271,7 +271,7 @@ John Doe
 //// tab | Python 3.9 і вище
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008_py39.py!}
+{!> ../../docs_src/python_types/tutorial008_py39.py!}
 ```
 
 ////
@@ -293,7 +293,7 @@ John Doe
 //// tab | Python 3.8 і вище
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008b.py!}
+{!> ../../docs_src/python_types/tutorial008b.py!}
 ```
 
 ////
@@ -301,7 +301,7 @@ John Doe
 //// tab | Python 3.10 і вище
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008b_py310.py!}
+{!> ../../docs_src/python_types/tutorial008b_py310.py!}
 ```
 
 ////
@@ -315,7 +315,7 @@ John Doe
 У Python 3.6 і вище (включаючи Python 3.10) ви можете оголосити його, імпортувавши та використовуючи `Optional` з модуля `typing`.
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 Використання `Optional[str]` замість просто `str` дозволить редактору допомогти вам виявити помилки, коли ви могли б вважати, що значенням завжди є `str`, хоча насправді воно також може бути `None`.
@@ -327,7 +327,7 @@ John Doe
 //// tab | Python 3.8 і вище
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009.py!}
+{!> ../../docs_src/python_types/tutorial009.py!}
 ```
 
 ////
@@ -335,7 +335,7 @@ John Doe
 //// tab | Python 3.8 і вище - альтернатива
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009b.py!}
+{!> ../../docs_src/python_types/tutorial009b.py!}
 ```
 
 ////
@@ -343,7 +343,7 @@ John Doe
 //// tab | Python 3.10 і вище
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial009_py310.py!}
+{!> ../../docs_src/python_types/tutorial009_py310.py!}
 ```
 
 ////
@@ -407,13 +407,13 @@ John Doe
 Скажімо, у вас є клас `Person` з імʼям:
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Потім ви можете оголосити змінну типу `Person`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 І знову ж таки, ви отримуєте всю підтримку редактора:
@@ -437,7 +437,7 @@ John Doe
 //// tab | Python 3.8 і вище
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011.py!}
+{!> ../../docs_src/python_types/tutorial011.py!}
 ```
 
 ////
@@ -445,7 +445,7 @@ John Doe
 //// tab | Python 3.9 і вище
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py39.py!}
+{!> ../../docs_src/python_types/tutorial011_py39.py!}
 ```
 
 ////
@@ -453,7 +453,7 @@ John Doe
 //// tab | Python 3.10 і вище
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py310.py!}
+{!> ../../docs_src/python_types/tutorial011_py310.py!}
 ```
 
 ////
index e4d5b1fad14bf4b2a3a9d59b8bd189f79cdfde04..b1f6459321a4492af361e5e2d2ee1429a484f9e2 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 ///
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -87,7 +87,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="12-15"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="9-12"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
index 50fd76f84baea79831b72b610325ea4958c19c6a..1e41888310ab61af0ebde21c23e0220c863ee58b 100644 (file)
@@ -25,7 +25,7 @@
 //// tab | Python 3.8 і вище
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -33,7 +33,7 @@
 //// tab | Python 3.10 і вище
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@
 //// tab | Python 3.8 і вище
 
 ```Python hl_lines="7-11"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -55,7 +55,7 @@
 //// tab | Python 3.10 і вище
 
 ```Python hl_lines="5-9"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -89,7 +89,7 @@
 //// tab | Python 3.8 і вище
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@
 //// tab | Python 3.10 і вище
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
 //// tab | Python 3.8 і вище
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/body/tutorial002.py!}
+{!> ../../docs_src/body/tutorial002.py!}
 ```
 
 ////
 //// tab | Python 3.10 і вище
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/body/tutorial002_py310.py!}
+{!> ../../docs_src/body/tutorial002_py310.py!}
 ```
 
 ////
 //// tab | Python 3.8 і вище
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/body/tutorial003.py!}
+{!> ../../docs_src/body/tutorial003.py!}
 ```
 
 ////
 //// tab | Python 3.10 і вище
 
 ```Python hl_lines="15-16"
-{!> ../../../docs_src/body/tutorial003_py310.py!}
+{!> ../../docs_src/body/tutorial003_py310.py!}
 ```
 
 ////
 //// tab | Python 3.8 і вище
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial004.py!}
+{!> ../../docs_src/body/tutorial004.py!}
 ```
 
 ////
 //// tab | Python 3.10 і вище
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial004_py310.py!}
+{!> ../../docs_src/body/tutorial004_py310.py!}
 ```
 
 ////
index 4720a42bae990f69397c6206921447a6ff5c0d2d..40ca4f6e6c76ff192237f7dbb391544d1a806591 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
@@ -67,7 +67,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
index 9ef8d5c5dbca5164554e0dd8f266b66fa4271c76..39dca9be8b2352ba08ef8a337ae65d7b7cbefd2d 100644 (file)
@@ -23,7 +23,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  21"
-{!> ../../../docs_src/encoder/tutorial001_py310.py!}
+{!> ../../docs_src/encoder/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="5  22"
-{!> ../../../docs_src/encoder/tutorial001.py!}
+{!> ../../docs_src/encoder/tutorial001.py!}
 ```
 
 ////
index 54cbd4b0004fcbb63427a9353ab684938b7eb69b..5e6c364e450214937062a1ce87117c4ea9555128 100644 (file)
@@ -58,7 +58,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  3  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -66,7 +66,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  3  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  3  13-17"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
 ```
 
 ////
@@ -88,7 +88,7 @@
 ///
 
 ```Python hl_lines="1  2  11-15"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="1  2  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-20"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
index 784da65f59e448924d9b2466120bdcc4e37dfb89..6f79c0d1d69928f1a6a040b61da671d4b9ad422c 100644 (file)
@@ -3,7 +3,7 @@
 Найпростіший файл FastAPI може виглядати так:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Скопіюйте це до файлу `main.py`.
@@ -158,7 +158,7 @@ OpenAPI описує схему для вашого API. І ця схема вк
 ### Крок 1: імпортуємо `FastAPI`
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI` це клас у Python, який надає всю функціональність для API.
@@ -174,7 +174,7 @@ OpenAPI описує схему для вашого API. І ця схема вк
 ### Крок 2: створюємо екземпляр `FastAPI`
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 Змінна `app` є екземпляром класу `FastAPI`.
 
@@ -243,7 +243,7 @@ https://example.com/items/foo
 #### Визначте декоратор операції шляху (path operation decorator)
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 Декоратор `@app.get("/")` вказує **FastAPI**, що функція нижче, відповідає за обробку запитів, які надходять до неї:
 
@@ -298,7 +298,7 @@ https://example.com/items/foo
 * **функція**: це функція, яка знаходиться нижче "декоратора" (нижче `@app.get("/")`).
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Це звичайна функція Python.
@@ -312,7 +312,7 @@ FastAPI викликатиме її щоразу, коли отримає зап
 Ви також можете визначити її як звичайну функцію замість `async def`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note | "Примітка"
@@ -324,7 +324,7 @@ FastAPI викликатиме її щоразу, коли отримає зап
 ### Крок 5: поверніть результат
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Ви можете повернути `dict`, `list`, а також окремі значення `str`, `int`, ітд.
index 99d1d207fb91cd4d6d2b3c4320838353062fdb2b..275b0eb3908d30f05bd8a46177da7c214643ec74 100644 (file)
@@ -23,7 +23,7 @@ Nếu bạn là một chuyên gia về Python, và bạn đã biết mọi thứ
 Hãy bắt đầu với một ví dụ đơn giản:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 Kết quả khi gọi chương trình này:
@@ -39,7 +39,7 @@ Hàm thực hiện như sau:
 * <abbr title="Đặt chúng lại với nhau thành một. Với các nội dung lần lượt.">Nối</abbr> chúng lại với nhau bằng một kí tự trắng ở giữa.
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### Sửa đổi
@@ -83,7 +83,7 @@ Chính là nó.
 Những thứ đó là "type hints":
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 Đó không giống như khai báo những giá trị mặc định giống như:
@@ -113,7 +113,7 @@ Với cái đó, bạn có thể cuộn, nhìn thấy các lựa chọn, cho đ
 Kiểm tra hàm này, nó đã có gợi ý kiểu dữ liệu:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 Bởi vì trình soạn thảo biết kiểu dữ liệu của các biến, bạn không chỉ có được completion, bạn cũng được kiểm tra lỗi:
@@ -123,7 +123,7 @@ Bởi vì trình soạn thảo biết kiểu dữ liệu của các biến, bạ
 Bây giờ bạn biết rằng bạn phải sửa nó, chuyển `age` sang một xâu với `str(age)`:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## Khai báo các kiểu dữ liệu
@@ -144,7 +144,7 @@ Bạn có thể sử dụng, ví dụ:
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### Các kiểu dữ liệu tổng quát với tham số kiểu dữ liệu
@@ -182,7 +182,7 @@ Tương tự kiểu dữ liệu `list`.
 Như danh sách là một kiểu dữ liệu chứa một vài kiểu dữ liệu có sẵn, bạn đặt chúng trong các dấu ngoặc vuông:
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006_py39.py!}
+{!> ../../docs_src/python_types/tutorial006_py39.py!}
 ```
 
 ////
@@ -192,7 +192,7 @@ Như danh sách là một kiểu dữ liệu chứa một vài kiểu dữ liệ
 Từ `typing`, import `List` (với chữ cái `L` viết hoa):
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 Khai báo biến với cùng dấu hai chấm (`:`).
@@ -202,7 +202,7 @@ Tương tự như kiểu dữ liệu, `List` bạn import từ `typing`.
 Như danh sách là một kiểu dữ liệu chứa các kiểu dữ liệu có sẵn, bạn đặt chúng bên trong dấu ngoặc vuông:
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/python_types/tutorial006.py!}
+{!> ../../docs_src/python_types/tutorial006.py!}
 ```
 
 ////
@@ -240,7 +240,7 @@ Bạn sẽ làm điều tương tự để khai báo các `tuple` và  các `set
 //// tab | Python 3.9+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial007_py39.py!}
+{!> ../../docs_src/python_types/tutorial007_py39.py!}
 ```
 
 ////
@@ -248,7 +248,7 @@ Bạn sẽ làm điều tương tự để khai báo các `tuple` và  các `set
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial007.py!}
+{!> ../../docs_src/python_types/tutorial007.py!}
 ```
 
 ////
@@ -269,7 +269,7 @@ Tham số kiểu dữ liệu thứ hai dành cho giá trị của `dict`.
 //// tab | Python 3.9+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008_py39.py!}
+{!> ../../docs_src/python_types/tutorial008_py39.py!}
 ```
 
 ////
@@ -277,7 +277,7 @@ Tham số kiểu dữ liệu thứ hai dành cho giá trị của `dict`.
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008.py!}
+{!> ../../docs_src/python_types/tutorial008.py!}
 ```
 
 ////
@@ -302,7 +302,7 @@ Trong Python 3.10 cũng có một **cú pháp mới** mà bạn có thể đặt
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial008b_py310.py!}
+{!> ../../docs_src/python_types/tutorial008b_py310.py!}
 ```
 
 ////
@@ -310,7 +310,7 @@ Trong Python 3.10 cũng có một **cú pháp mới** mà bạn có thể đặt
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial008b.py!}
+{!> ../../docs_src/python_types/tutorial008b.py!}
 ```
 
 ////
@@ -324,7 +324,7 @@ Bạn có thể khai báo một giá trị có thể có một kiểu dữ liệ
 Trong Python 3.6 hoặc lớn hơn (bao gồm Python 3.10) bạn có thể khai báo nó bằng các import và sử dụng `Optional` từ mô đun `typing`.
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009.py!}
+{!../../docs_src/python_types/tutorial009.py!}
 ```
 
 Sử dụng `Optional[str]` thay cho `str` sẽ cho phép trình soạn thảo giúp bạn phát hiện các lỗi mà bạn có thể gặp như một giá trị luôn là một `str`, trong khi thực tế nó rất có thể là `None`.
@@ -336,7 +336,7 @@ Sử dụng `Optional[str]` thay cho `str` sẽ cho phép trình soạn thảo g
 //// tab | Python 3.10+
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/python_types/tutorial009_py310.py!}
+{!> ../../docs_src/python_types/tutorial009_py310.py!}
 ```
 
 ////
@@ -344,7 +344,7 @@ Sử dụng `Optional[str]` thay cho `str` sẽ cho phép trình soạn thảo g
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009.py!}
+{!> ../../docs_src/python_types/tutorial009.py!}
 ```
 
 ////
@@ -352,7 +352,7 @@ Sử dụng `Optional[str]` thay cho `str` sẽ cho phép trình soạn thảo g
 //// tab | Python 3.8+ alternative
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial009b.py!}
+{!> ../../docs_src/python_types/tutorial009b.py!}
 ```
 
 ////
@@ -375,7 +375,7 @@ Nó chỉ là về các từ và tên. Nhưng những từ đó có thể ảnh
 Cho một ví dụ, hãy để ý hàm này:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009c.py!}
+{!../../docs_src/python_types/tutorial009c.py!}
 ```
 
 Tham số `name` được định nghĩa là `Optional[str]`, nhưng nó **không phải là tùy chọn**, bạn không thể gọi hàm mà không có tham số:
@@ -393,7 +393,7 @@ say_hi(name=None)  # This works, None is valid 🎉
 Tin tốt là, khi bạn sử dụng Python 3.10, bạn sẽ không phải lo lắng về điều đó, bạn sẽ có thể sử dụng `|` để định nghĩa hợp của các kiểu dữ liệu một cách đơn giản:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial009c_py310.py!}
+{!../../docs_src/python_types/tutorial009c_py310.py!}
 ```
 
 Và sau đó, bạn sẽ không phải lo rằng những cái tên như `Optional` và `Union`. 😎
@@ -458,13 +458,13 @@ Bạn cũng có thể khai báo một lớp như là kiểu dữ liệu của m
 Hãy nói rằng bạn muốn có một lớp `Person` với một tên:
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Sau đó bạn có thể khai báo một biến có kiểu là `Person`:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 Và lại một lần nữa, bạn có được tất cả sự hỗ trợ từ trình soạn thảo:
@@ -492,7 +492,7 @@ Một ví dụ từ tài liệu chính thức của Pydantic:
 //// tab | Python 3.10+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py310.py!}
+{!> ../../docs_src/python_types/tutorial011_py310.py!}
 ```
 
 ////
@@ -500,7 +500,7 @@ Một ví dụ từ tài liệu chính thức của Pydantic:
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011_py39.py!}
+{!> ../../docs_src/python_types/tutorial011_py39.py!}
 ```
 
 ////
@@ -508,7 +508,7 @@ Một ví dụ từ tài liệu chính thức của Pydantic:
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/python_types/tutorial011.py!}
+{!> ../../docs_src/python_types/tutorial011.py!}
 ```
 
 ////
@@ -538,7 +538,7 @@ Python cũng có một tính năng cho phép đặt **metadata bổ sung** trong
 Trong Python 3.9, `Annotated` là một phần của thư viện chuẩn, do đó bạn có thể import nó từ `typing`.
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial013_py39.py!}
+{!> ../../docs_src/python_types/tutorial013_py39.py!}
 ```
 
 ////
@@ -550,7 +550,7 @@ Trong Python 3.9, `Annotated` là một phần của thư viện chuẩn, do đ
 Nó đã được cài đặt sẵng cùng với **FastAPI**.
 
 ```Python hl_lines="1  4"
-{!> ../../../docs_src/python_types/tutorial013.py!}
+{!> ../../docs_src/python_types/tutorial013.py!}
 ```
 
 ////
index ce808eb915306014bc2eed74b6da255c0027e61d..d80d78506827d24ce3573a4ab24049d6634e26ff 100644 (file)
@@ -3,7 +3,7 @@
 Tệp tin FastAPI đơn giản nhất có thể trông như này:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Sao chép sang một tệp tin `main.py`.
@@ -134,7 +134,7 @@ Bạn cũng có thể sử dụng nó để sinh code tự động, với các c
 ### Bước 1: import `FastAPI`
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI` là một Python class cung cấp tất cả chức năng cho API của bạn.
@@ -150,7 +150,7 @@ Bạn cũng có thể sử dụng tất cả <a href="https://www.starlette.io/"
 ### Bước 2: Tạo một `FastAPI` "instance"
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Biến `app` này là một "instance" của class `FastAPI`.
@@ -172,7 +172,7 @@ $ uvicorn main:app --reload
 Nếu bạn tạo ứng dụng của bạn giống như:
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
 ```
 
 Và đặt nó trong một tệp tin `main.py`, sau đó bạn sẽ gọi `uvicorn` giống như:
@@ -251,7 +251,7 @@ Chúng ta cũng sẽ gọi chúng là "**các toán tử**".
 #### Định nghĩa moojt *decorator cho đường dẫn toán tử*
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `@app.get("/")` nói **FastAPI** rằng hàm bên dưới có trách nhiệm xử lí request tới:
@@ -307,7 +307,7 @@ Ví dụ, khi sử dụng GraphQL bạn thông thường thực hiện tất c
 * **hàm**: là hàm bên dưới "decorator" (bên dưới `@app.get("/")`).
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Đây là một hàm Python.
@@ -321,7 +321,7 @@ Trong trường hợp này, nó là một hàm `async`.
 Bạn cũng có thể định nghĩa nó như là một hàm thông thường thay cho `async def`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note
@@ -333,7 +333,7 @@ Nếu bạn không biết sự khác nhau, kiểm tra [Async: *"Trong khi vội
 ### Bước 5: Nội dung trả về
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 Bạn có thể trả về một `dict`, `list`, một trong những giá trị đơn như `str`, `int`,...
index 1fc63493372fbdefd019b6930fbb85069deb21a6..f051b12a4d4c67b64067130787b6df5da2935395 100644 (file)
@@ -17,7 +17,7 @@
 
 例如,要声明另一个具有状态码 `404` 和`Pydantic`模型 `Message` 的响应,可以写:
 ```Python hl_lines="18  22"
-{!../../../docs_src/additional_responses/tutorial001.py!}
+{!../../docs_src/additional_responses/tutorial001.py!}
 ```
 
 /// note
 例如,您可以添加一个额外的媒体类型` image/png` ,声明您的路径操作可以返回JSON对象(媒体类型 `application/json` )或PNG图像:
 
 ```Python hl_lines="19-24  28"
-{!../../../docs_src/additional_responses/tutorial002.py!}
+{!../../docs_src/additional_responses/tutorial002.py!}
 ```
 
 /// note
 以及一个状态码为 `200` 的响应,它使用您的 `response_model` ,但包含自定义的 `example` :
 
 ```Python hl_lines="20-31"
-{!../../../docs_src/additional_responses/tutorial003.py!}
+{!../../docs_src/additional_responses/tutorial003.py!}
 ```
 
 所有这些都将被合并并包含在您的OpenAPI中,并在API文档中显示:
@@ -220,7 +220,7 @@ new_dict = {**old_dict, "new key": "new value"}
 您可以使用该技术在路径操作中重用一些预定义的响应,并将它们与其他自定义响应相结合。
 **例如:**
 ```Python hl_lines="13-17  26"
-{!../../../docs_src/additional_responses/tutorial004.py!}
+{!../../docs_src/additional_responses/tutorial004.py!}
 ```
 ## 有关OpenAPI响应的更多信息
 
index 06320faad1926ef923a77413bd35801ae0de979a..f79b853ef8353f4123ab8d37e28090105738a969 100644 (file)
@@ -15,7 +15,7 @@
 要实现它,导入 `JSONResponse`,然后在其中直接返回你的内容,并将 `status_code` 设置为为你要的值。
 
 ```Python hl_lines="4  25"
-{!../../../docs_src/additional_status_codes/tutorial001.py!}
+{!../../docs_src/additional_status_codes/tutorial001.py!}
 ```
 
 /// warning | "警告"
index 3d8afbb62c9dc158e93aa4eeeed479f8524d9da6..f3fe1e395d834cfebc97f8ca9aa50c8b4f67a0a5 100644 (file)
@@ -19,7 +19,7 @@ Python 可以把类实例变为**可调用项**。
 为此,需要声明 `__call__` 方法:
 
 ```Python hl_lines="10"
-{!../../../docs_src/dependencies/tutorial011.py!}
+{!../../docs_src/dependencies/tutorial011.py!}
 ```
 
 本例中,**FastAPI**  使用 `__call__` 检查附加参数及子依赖项,稍后,还要调用它向*路径操作函数*传递值。
@@ -29,7 +29,7 @@ Python 可以把类实例变为**可调用项**。
 接下来,使用 `__init__` 声明用于**参数化**依赖项的实例参数:
 
 ```Python hl_lines="7"
-{!../../../docs_src/dependencies/tutorial011.py!}
+{!../../docs_src/dependencies/tutorial011.py!}
 ```
 
 本例中,**FastAPI** 不使用 `__init__`,我们要直接在代码中使用。
@@ -39,7 +39,7 @@ Python 可以把类实例变为**可调用项**。
 使用以下代码创建类实例:
 
 ```Python hl_lines="16"
-{!../../../docs_src/dependencies/tutorial011.py!}
+{!../../docs_src/dependencies/tutorial011.py!}
 ```
 
 这样就可以**参数化**依赖项,它包含 `checker.fixed_content` 的属性 - `"bar"`。
@@ -57,7 +57,7 @@ checker(q="somequery")
 ……并用*路径操作函数*的参数 `fixed_content_included` 返回依赖项的值:
 
 ```Python hl_lines="20"
-{!../../../docs_src/dependencies/tutorial011.py!}
+{!../../docs_src/dependencies/tutorial011.py!}
 ```
 
 /// tip | "提示"
index 52f6acda1a12f6af54ffe659c3a87de99687c8d2..8c4b6bb0417dd6c3b183ef612f8ff9b5d8b46b6d 100644 (file)
@@ -93,7 +93,7 @@ ASGI 规范定义的 `root_path` 就是为了这种用例。
 我们在这里的信息里包含 `roo_path` 只是为了演示。
 
 ```Python hl_lines="8"
-{!../../../docs_src/behind_a_proxy/tutorial001.py!}
+{!../../docs_src/behind_a_proxy/tutorial001.py!}
 ```
 
 然后,用以下命令启动 Uvicorn:
@@ -122,7 +122,7 @@ $ uvicorn main:app --root-path /api/v1
 还有一种方案,如果不能提供 `--root-path` 或等效的命令行选项,则在创建 FastAPI 应用时要设置 `root_path` 参数。
 
 ```Python hl_lines="3"
-{!../../../docs_src/behind_a_proxy/tutorial002.py!}
+{!../../docs_src/behind_a_proxy/tutorial002.py!}
 ```
 
 传递 `root_path` 给 `FastAPI` 与传递 `--root-path` 命令行选项给 Uvicorn 或 Hypercorn 一样。
@@ -304,7 +304,7 @@ $ uvicorn main:app --root-path /api/v1
 例如:
 
 ```Python hl_lines="4-7"
-{!../../../docs_src/behind_a_proxy/tutorial003.py!}
+{!../../docs_src/behind_a_proxy/tutorial003.py!}
 ```
 
 这段代码生产如下 OpenAPI 概图:
@@ -353,7 +353,7 @@ API 文档与所选的服务器进行交互。
 如果不想让 **FastAPI** 包含使用 `root_path` 的自动服务器,则要使用参数 `root_path_in_servers=False`:
 
 ```Python hl_lines="9"
-{!../../../docs_src/behind_a_proxy/tutorial004.py!}
+{!../../docs_src/behind_a_proxy/tutorial004.py!}
 ```
 
 这样,就不会在 OpenAPI 概图中包含服务器了。
index 9594c72ac4c9eeca1f96f7344457ad48076574cf..27c026904da730f24d4bf04fd166f0dac5bbd340 100644 (file)
@@ -25,7 +25,7 @@
 导入你想要使用的 `Response` 类(子类)然后在 *路径操作装饰器* 中声明它。
 
 ```Python hl_lines="2 7"
-{!../../../docs_src/custom_response/tutorial001b.py!}
+{!../../docs_src/custom_response/tutorial001b.py!}
 ```
 
 /// info | "提示"
@@ -52,7 +52,7 @@
 * 将 `HTMLResponse` 作为你的 *路径操作* 的 `response_class` 参数传入。
 
 ```Python hl_lines="2 7"
-{!../../../docs_src/custom_response/tutorial002.py!}
+{!../../docs_src/custom_response/tutorial002.py!}
 ```
 
 /// info | "提示"
@@ -72,7 +72,7 @@
 和上面一样的例子,返回一个 `HTMLResponse` 看起来可能是这样:
 
 ```Python hl_lines="2 7 19"
-{!../../../docs_src/custom_response/tutorial003.py!}
+{!../../docs_src/custom_response/tutorial003.py!}
 ```
 
 /// warning | "警告"
@@ -98,7 +98,7 @@
 比如像这样:
 
 ```Python hl_lines="7 23 21"
-{!../../../docs_src/custom_response/tutorial004.py!}
+{!../../docs_src/custom_response/tutorial004.py!}
 ```
 
 在这个例子中,函数 `generate_html_response()` 已经生成并返回 `Response` 对象而不是在 `str` 中返回 HTML。
@@ -140,7 +140,7 @@ FastAPI(实际上是 Starlette)将自动包含 Content-Length 的头。它
 
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ### `HTMLResponse`
@@ -152,7 +152,7 @@ FastAPI(实际上是 Starlette)将自动包含 Content-Length 的头。它
 接受文本或字节并返回纯文本响应。
 
 ```Python hl_lines="2  7  9"
-{!../../../docs_src/custom_response/tutorial005.py!}
+{!../../docs_src/custom_response/tutorial005.py!}
 ```
 
 ### `JSONResponse`
@@ -177,7 +177,7 @@ FastAPI(实际上是 Starlette)将自动包含 Content-Length 的头。它
 ///
 
 ```Python hl_lines="2 7"
-{!../../../docs_src/custom_response/tutorial001.py!}
+{!../../docs_src/custom_response/tutorial001.py!}
 ```
 
 /// tip | "小贴士"
@@ -191,7 +191,7 @@ FastAPI(实际上是 Starlette)将自动包含 Content-Length 的头。它
 返回 HTTP 重定向。默认情况下使用 307 状态代码(临时重定向)。
 
 ```Python hl_lines="2  9"
-{!../../../docs_src/custom_response/tutorial006.py!}
+{!../../docs_src/custom_response/tutorial006.py!}
 ```
 
 ### `StreamingResponse`
@@ -199,7 +199,7 @@ FastAPI(实际上是 Starlette)将自动包含 Content-Length 的头。它
 采用异步生成器或普通生成器/迭代器,然后流式传输响应主体。
 
 ```Python hl_lines="2  14"
-{!../../../docs_src/custom_response/tutorial007.py!}
+{!../../docs_src/custom_response/tutorial007.py!}
 ```
 
 #### 对类似文件的对象使用 `StreamingResponse`
@@ -209,7 +209,7 @@ FastAPI(实际上是 Starlette)将自动包含 Content-Length 的头。它
 包括许多与云存储,视频处理等交互的库。
 
 ```Python hl_lines="2  10-12  14"
-{!../../../docs_src/custom_response/tutorial008.py!}
+{!../../docs_src/custom_response/tutorial008.py!}
 ```
 
 /// tip | "小贴士"
@@ -232,7 +232,7 @@ FastAPI(实际上是 Starlette)将自动包含 Content-Length 的头。它
 文件响应将包含适当的 `Content-Length`,`Last-Modified` 和 `ETag` 的响应头。
 
 ```Python hl_lines="2  10"
-{!../../../docs_src/custom_response/tutorial009.py!}
+{!../../docs_src/custom_response/tutorial009.py!}
 ```
 
 ## 额外文档
index 72567e24589bc77f1c12fa8008310a2b33ef131f..f33c05ff47f53f75fcf87571c01457a818120627 100644 (file)
@@ -5,7 +5,7 @@ FastAPI 基于 **Pydantic** 构建,前文已经介绍过如何使用 Pydantic
 但 FastAPI 还可以使用数据类(<a href="https://docs.python.org/3/library/dataclasses.html" class="external-link" target="_blank">`dataclasses`</a>):
 
 ```Python hl_lines="1  7-12  19-20"
-{!../../../docs_src/dataclasses/tutorial001.py!}
+{!../../docs_src/dataclasses/tutorial001.py!}
 ```
 
 这还是借助于 **Pydantic** 及其<a href="https://pydantic-docs.helpmanual.io/usage/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">内置的 `dataclasses`</a>。
@@ -35,7 +35,7 @@ FastAPI 基于 **Pydantic** 构建,前文已经介绍过如何使用 Pydantic
 在 `response_model` 参数中使用 `dataclasses`:
 
 ```Python hl_lines="1  7-13  19"
-{!../../../docs_src/dataclasses/tutorial002.py!}
+{!../../docs_src/dataclasses/tutorial002.py!}
 ```
 
 本例把数据类自动转换为 Pydantic 数据类。
@@ -53,7 +53,7 @@ API 文档中也会显示相关概图:
 本例把标准的 `dataclasses` 直接替换为 `pydantic.dataclasses`:
 
 ```{ .python .annotate hl_lines="1  5  8-11  14-17  23-25  28" }
-{!../../../docs_src/dataclasses/tutorial003.py!}
+{!../../docs_src/dataclasses/tutorial003.py!}
 ```
 
 1. 本例依然要从标准的 `dataclasses` 中导入 `field`;
index c9389f533c920c0a8d3ee9634dfd3f5250dbb61e..e5b44f32175b09d4c0f76e111d311d115ade6c7b 100644 (file)
@@ -15,7 +15,7 @@
 使用 `startup` 事件声明 `app` 启动前运行的函数:
 
 ```Python hl_lines="8"
-{!../../../docs_src/events/tutorial001.py!}
+{!../../docs_src/events/tutorial001.py!}
 ```
 
 本例中,`startup` 事件处理器函数为项目数据库(只是**字典**)提供了一些初始值。
@@ -29,7 +29,7 @@
 使用 `shutdown` 事件声明 `app` 关闭时运行的函数:
 
 ```Python hl_lines="6"
-{!../../../docs_src/events/tutorial002.py!}
+{!../../docs_src/events/tutorial002.py!}
 ```
 
 此处,`shutdown` 事件处理器函数在 `log.txt` 中写入一行文本 `Application shutdown`。
index 56aad3bd26580a0af1b1e784ed05f7aac02677b2..baf13136137ccb43799daa62b2cfe131cac7fc57 100644 (file)
@@ -19,7 +19,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="7-9  12-13  16-17  21"
-{!> ../../../docs_src/generate_clients/tutorial001_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial001_py39.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-11  14-15  18  19  23"
-{!> ../../../docs_src/generate_clients/tutorial001.py!}
+{!> ../../docs_src/generate_clients/tutorial001.py!}
 ```
 
 ////
@@ -138,7 +138,7 @@ frontend-app@1.0.0 generate-client /home/user/code/frontend-app
 //// tab | Python 3.9+
 
 ```Python hl_lines="21  26  34"
-{!> ../../../docs_src/generate_clients/tutorial002_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial002_py39.py!}
 ```
 
 ////
@@ -146,7 +146,7 @@ frontend-app@1.0.0 generate-client /home/user/code/frontend-app
 //// tab | Python 3.8+
 
 ```Python hl_lines="23  28  36"
-{!> ../../../docs_src/generate_clients/tutorial002.py!}
+{!> ../../docs_src/generate_clients/tutorial002.py!}
 ```
 
 ////
@@ -199,7 +199,7 @@ FastAPI为每个*路径操作*使用一个**唯一ID**,它用于**操作ID**
 //// tab | Python 3.9+
 
 ```Python hl_lines="6-7  10"
-{!> ../../../docs_src/generate_clients/tutorial003_py39.py!}
+{!> ../../docs_src/generate_clients/tutorial003_py39.py!}
 ```
 
 ////
@@ -207,7 +207,7 @@ FastAPI为每个*路径操作*使用一个**唯一ID**,它用于**操作ID**
 //// tab | Python 3.8+
 
 ```Python hl_lines="8-9  12"
-{!> ../../../docs_src/generate_clients/tutorial003.py!}
+{!> ../../docs_src/generate_clients/tutorial003.py!}
 ```
 
 ////
@@ -233,7 +233,7 @@ FastAPI为每个*路径操作*使用一个**唯一ID**,它用于**操作ID**
 我们可以将 OpenAPI JSON 下载到一个名为`openapi.json`的文件中,然后使用以下脚本**删除此前缀的标签**:
 
 ```Python
-{!../../../docs_src/generate_clients/tutorial004.py!}
+{!../../docs_src/generate_clients/tutorial004.py!}
 ```
 
 通过这样做,操作ID将从类似于 `items-get_items` 的名称重命名为 `get_items` ,这样客户端生成器就可以生成更简洁的方法名称。
index 926082b94fa7f491045b8ea33a75d5b73bf80b9e..525dc89ac5f20fa6c529e443bd4508ca467560b2 100644 (file)
@@ -58,7 +58,7 @@ app.add_middleware(UnicornMiddleware, some_config="rainbow")
 任何传向 `http` 或 `ws` 的请求都会被重定向至安全方案。
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/advanced_middleware/tutorial001.py!}
+{!../../docs_src/advanced_middleware/tutorial001.py!}
 ```
 
 ## `TrustedHostMiddleware`
@@ -66,7 +66,7 @@ app.add_middleware(UnicornMiddleware, some_config="rainbow")
 强制所有传入请求都必须正确设置 `Host` 请求头,以防 HTTP 主机头攻击。
 
 ```Python hl_lines="2  6-8"
-{!../../../docs_src/advanced_middleware/tutorial002.py!}
+{!../../docs_src/advanced_middleware/tutorial002.py!}
 ```
 
 支持以下参数:
@@ -82,7 +82,7 @@ app.add_middleware(UnicornMiddleware, some_config="rainbow")
 中间件会处理标准响应与流响应。
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/advanced_middleware/tutorial003.py!}
+{!../../docs_src/advanced_middleware/tutorial003.py!}
 ```
 
 支持以下参数:
index 7c7323cb5e88c113f1aadea2a87b11af1d20446c..dc1c2539ba45f10cd338d60cd55fd073a669105f 100644 (file)
@@ -32,7 +32,7 @@ API 的用户 (外部开发者)要在您的 API 内使用 POST 请求创建
 这部分代码很常规,您对绝大多数代码应该都比较熟悉了:
 
 ```Python hl_lines="10-14  37-54"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 /// tip | "提示"
@@ -93,7 +93,7 @@ requests.post(callback_url, json={"description": "Invoice paid", "paid": True})
 首先,新建包含一些用于回调的 `APIRouter`。
 
 ```Python hl_lines="5  26"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 ### 创建回调*路径操作*
@@ -106,7 +106,7 @@ requests.post(callback_url, json={"description": "Invoice paid", "paid": True})
 * 还要声明要返回的响应,例如,`response_model=InvoiceEventReceived`
 
 ```Python hl_lines="17-19  22-23  29-33"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 回调*路径操作*与常规*路径操作*有两点主要区别:
@@ -176,7 +176,7 @@ JSON 请求体包含如下内容:
 现在使用 API *路径操作装饰器*的参数 `callbacks`,从回调路由传递属性 `.routes`(实际上只是路由/路径操作的**列表**):
 
 ```Python hl_lines="36"
-{!../../../docs_src/openapi_callbacks/tutorial001.py!}
+{!../../docs_src/openapi_callbacks/tutorial001.py!}
 ```
 
 /// tip | "提示"
index c378469162f5dc6fc44e312838a76ceec2707cbf..0d77dd69e80aa5a53bf5eaba82839b5db0be8114 100644 (file)
@@ -13,7 +13,7 @@
 务必确保每个操作路径的 `operation_id` 都是唯一的。
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial001.py!}
 ```
 
 ### 使用 *路径操作函数* 的函数名作为 operationId
@@ -23,7 +23,7 @@
 你应该在添加了所有 *路径操作* 之后执行此操作。
 
 ```Python hl_lines="2 12 13 14 15 16 17 18 19 20 21 24"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial002.py!}
 ```
 
 /// tip
@@ -45,7 +45,7 @@
 使用参数 `include_in_schema` 并将其设置为 `False` ,来从生成的 OpenAPI 方案中排除一个 *路径操作*(这样一来,就从自动化文档系统中排除掉了)。
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial003.py!}
 ```
 
 ## docstring 的高级描述
@@ -58,5 +58,5 @@
 
 
 ```Python hl_lines="19 20 21 22 23 24 25 26 27 28 29"
-{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_advanced_configuration/tutorial004.py!}
 ```
index a289cf20178f0bd6b4bbe76a2e8c5686c07f358d..c38f80f1f1f2c1972251b72efb5cb24510ec49d6 100644 (file)
@@ -21,7 +21,7 @@
 然后你可以在这个*临时*响应对象中设置`status_code`。
 
 ```Python hl_lines="1  9  12"
-{!../../../docs_src/response_change_status_code/tutorial001.py!}
+{!../../docs_src/response_change_status_code/tutorial001.py!}
 ```
 
 然后你可以像平常一样返回任何你需要的对象(例如一个`dict`或者一个数据库模型)。如果你声明了一个`response_model`,它仍然会被用来过滤和转换你返回的对象。
index dd942a981b935ae785e0eb272e86b1b4aa1ff4e7..5772664b0302e65add540bee91ef1f0375582646 100644 (file)
@@ -5,7 +5,7 @@
 你可以在 *路径函数* 中定义一个类型为 `Response`的参数,这样你就可以在这个临时响应对象中设置cookie了。
 
 ```Python hl_lines="1  8-9"
-{!../../../docs_src/response_cookies/tutorial002.py!}
+{!../../docs_src/response_cookies/tutorial002.py!}
 ```
 
 而且你还可以根据你的需要响应不同的对象,比如常用的 `dict`,数据库model等。
@@ -25,7 +25,7 @@
 然后设置Cookies,并返回:
 
 ```Python hl_lines="10-12"
-{!../../../docs_src/response_cookies/tutorial001.py!}
+{!../../docs_src/response_cookies/tutorial001.py!}
 ```
 
 /// tip
index b2c7de8fd3196244bc1f16bc23d0e250a1e57490..9d191c62239b0006f343bb448eaef322793ec6dd 100644 (file)
@@ -36,7 +36,7 @@
 
 
 ```Python hl_lines="4 6 20 21"
-{!../../../docs_src/response_directly/tutorial001.py!}
+{!../../docs_src/response_directly/tutorial001.py!}
 ```
 
 /// note | "技术细节"
@@ -58,7 +58,7 @@
 你可以把你的 XML 内容放到一个字符串中,放到一个 `Response` 中,然后返回。
 
 ```Python hl_lines="1  18"
-{!../../../docs_src/response_directly/tutorial002.py!}
+{!../../docs_src/response_directly/tutorial002.py!}
 ```
 
 ## 说明
index e18d1620da647b40d38fbce4710a627c8e2adc2c..d593fdccc0dc3b3e472eeb14f52782b8682e2c95 100644 (file)
@@ -6,7 +6,7 @@
 
 然后你可以在这个*临时*响应对象中设置头部。
 ```Python hl_lines="1  7-8"
-{!../../../docs_src/response_headers/tutorial002.py!}
+{!../../docs_src/response_headers/tutorial002.py!}
 ```
 
 然后你可以像平常一样返回任何你需要的对象(例如一个`dict`或者一个数据库模型)。如果你声明了一个`response_model`,它仍然会被用来过滤和转换你返回的对象。
@@ -21,7 +21,7 @@
 
 按照[直接返回响应](response-directly.md){.internal-link target=_blank}中所述创建响应,并将头部作为附加参数传递:
 ```Python hl_lines="10-12"
-{!../../../docs_src/response_headers/tutorial001.py!}
+{!../../docs_src/response_headers/tutorial001.py!}
 ```
 
 
index a76353186d99954d9af6be9fa5231432d83d240c..06c6dbbab5b647059aa496944f9bfa99da799319 100644 (file)
@@ -23,7 +23,7 @@ HTTP 基础授权让浏览器显示内置的用户名与密码提示。
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  8  12"
-{!> ../../../docs_src/security/tutorial006_an_py39.py!}
+{!> ../../docs_src/security/tutorial006_an_py39.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@ HTTP 基础授权让浏览器显示内置的用户名与密码提示。
 //// tab | Python 3.8+
 
 ```Python hl_lines="2  7  11"
-{!> ../../../docs_src/security/tutorial006_an.py!}
+{!> ../../docs_src/security/tutorial006_an.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@ HTTP 基础授权让浏览器显示内置的用户名与密码提示。
 ///
 
 ```Python hl_lines="2  6  10"
-{!> ../../../docs_src/security/tutorial006.py!}
+{!> ../../docs_src/security/tutorial006.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@ HTTP 基础授权让浏览器显示内置的用户名与密码提示。
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  12-24"
-{!> ../../../docs_src/security/tutorial007_an_py39.py!}
+{!> ../../docs_src/security/tutorial007_an_py39.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@ HTTP 基础授权让浏览器显示内置的用户名与密码提示。
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  12-24"
-{!> ../../../docs_src/security/tutorial007_an.py!}
+{!> ../../docs_src/security/tutorial007_an.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@ HTTP 基础授权让浏览器显示内置的用户名与密码提示。
 ///
 
 ```Python hl_lines="1  11-21"
-{!> ../../../docs_src/security/tutorial007.py!}
+{!> ../../docs_src/security/tutorial007.py!}
 ```
 
 ////
@@ -163,7 +163,7 @@ if "stanleyjobsox" == "stanleyjobson" and "love123" == "swordfish":
 //// tab | Python 3.9+
 
 ```Python hl_lines="26-30"
-{!> ../../../docs_src/security/tutorial007_an_py39.py!}
+{!> ../../docs_src/security/tutorial007_an_py39.py!}
 ```
 
 ////
@@ -171,7 +171,7 @@ if "stanleyjobsox" == "stanleyjobson" and "love123" == "swordfish":
 //// tab | Python 3.8+
 
 ```Python hl_lines="26-30"
-{!> ../../../docs_src/security/tutorial007_an.py!}
+{!> ../../docs_src/security/tutorial007_an.py!}
 ```
 
 ////
@@ -185,7 +185,7 @@ if "stanleyjobsox" == "stanleyjobson" and "love123" == "swordfish":
 ///
 
 ```Python hl_lines="23-27"
-{!> ../../../docs_src/security/tutorial007.py!}
+{!> ../../docs_src/security/tutorial007.py!}
 ```
 
 ////
index b75ae11a4bbd685614fd9f51c9b0067acc41f7a6..d6354230e797f512ebe9d18bfed270bbd9dc81a5 100644 (file)
@@ -63,7 +63,7 @@ OAuth2 中,**作用域**只是声明特定权限的字符串。
 首先,快速浏览一下以下代码与**用户指南**中 [OAuth2 实现密码哈希与 Bearer  JWT 令牌验证](../../tutorial/security/oauth2-jwt.md){.internal-link target=_blank}一章中代码的区别。以下代码使用 OAuth2 作用域:
 
 ```Python hl_lines="2  4  8  12  46  64  105  107-115  121-124  128-134  139  153"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 下面,我们逐步说明修改的代码内容。
@@ -75,7 +75,7 @@ OAuth2 中,**作用域**只是声明特定权限的字符串。
 `scopes` 参数接收**字典**,键是作用域、值是作用域的描述:
 
 ```Python hl_lines="62-65"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 因为声明了作用域,所以登录或授权时会在 API 文档中显示。
@@ -103,7 +103,7 @@ OAuth2 中,**作用域**只是声明特定权限的字符串。
 ///
 
 ```Python hl_lines="153"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 ## 在*路径操作*与依赖项中声明作用域
@@ -131,7 +131,7 @@ OAuth2 中,**作用域**只是声明特定权限的字符串。
 ///
 
 ```Python hl_lines="4  139  166"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 /// info | "技术细节"
@@ -159,7 +159,7 @@ OAuth2 中,**作用域**只是声明特定权限的字符串。
 `SecuriScopes` 类与 `Request` 类似(`Request` 用于直接提取请求对象)。
 
 ```Python hl_lines="8  105"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 ## 使用 `scopes`
@@ -175,7 +175,7 @@ OAuth2 中,**作用域**只是声明特定权限的字符串。
 该异常包含了作用域所需的(如有),以空格分割的字符串(使用 `scope_str`)。该字符串要放到包含作用域的 `WWW-Authenticate` 请求头中(这也是规范的要求)。
 
 ```Python hl_lines="105  107-115"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 ## 校验 `username` 与数据形状
@@ -193,7 +193,7 @@ OAuth2 中,**作用域**只是声明特定权限的字符串。
 还可以使用用户名验证用户,如果没有用户,也会触发之前创建的异常。
 
 ```Python hl_lines="46  116-127"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 ## 校验 `scopes`
@@ -203,7 +203,7 @@ OAuth2 中,**作用域**只是声明特定权限的字符串。
 为此,要使用包含所有作用域**字符串列表**的 `security_scopes.scopes`, 。
 
 ```Python hl_lines="128-134"
-{!../../../docs_src/security/tutorial005.py!}
+{!../../docs_src/security/tutorial005.py!}
 ```
 
 ## 依赖项树与作用域
index 37a2d98d319b47cfd6cf782b50ad7cb4320eddfc..4d35731cb23e141de7560139f1cdef1687bfb805 100644 (file)
@@ -151,7 +151,7 @@ Hello World from Python
 您可以使用与 Pydantic 模型相同的验证功能和工具,比如不同的数据类型和使用 `Field()` 进行附加验证。
 
 ```Python hl_lines="2  5-8  11"
-{!../../../docs_src/settings/tutorial001.py!}
+{!../../docs_src/settings/tutorial001.py!}
 ```
 
 /// tip
@@ -169,7 +169,7 @@ Hello World from Python
 然后,您可以在应用程序中使用新的 `settings` 对象:
 
 ```Python hl_lines="18-20"
-{!../../../docs_src/settings/tutorial001.py!}
+{!../../docs_src/settings/tutorial001.py!}
 ```
 
 ### 运行服务器
@@ -205,13 +205,13 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp"uvicorn main:app
 例如,您可以创建一个名为 `config.py` 的文件,其中包含以下内容:
 
 ```Python
-{!../../../docs_src/settings/app01/config.py!}
+{!../../docs_src/settings/app01/config.py!}
 ```
 
 然后在一个名为 `main.py` 的文件中使用它:
 
 ```Python hl_lines="3  11-13"
-{!../../../docs_src/settings/app01/main.py!}
+{!../../docs_src/settings/app01/main.py!}
 ```
 
 /// tip
@@ -231,7 +231,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp"uvicorn main:app
 根据前面的示例,您的 `config.py` 文件可能如下所示:
 
 ```Python hl_lines="10"
-{!../../../docs_src/settings/app02/config.py!}
+{!../../docs_src/settings/app02/config.py!}
 ```
 
 请注意,现在我们不创建默认实例 `settings = Settings()`。
@@ -243,7 +243,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp"uvicorn main:app
 //// tab | Python 3.9+
 
 ```Python hl_lines="6  12-13"
-{!> ../../../docs_src/settings/app02_an_py39/main.py!}
+{!> ../../docs_src/settings/app02_an_py39/main.py!}
 ```
 
 ////
@@ -251,7 +251,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp"uvicorn main:app
 //// tab | Python 3.8+
 
 ```Python hl_lines="6  12-13"
-{!> ../../../docs_src/settings/app02_an/main.py!}
+{!> ../../docs_src/settings/app02_an/main.py!}
 ```
 
 ////
@@ -265,7 +265,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp"uvicorn main:app
 ///
 
 ```Python hl_lines="5  11-12"
-{!> ../../../docs_src/settings/app02/main.py!}
+{!> ../../docs_src/settings/app02/main.py!}
 ```
 
 ////
@@ -283,7 +283,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp"uvicorn main:app
 //// tab | Python 3.9+
 
 ```Python hl_lines="17  19-21"
-{!> ../../../docs_src/settings/app02_an_py39/main.py!}
+{!> ../../docs_src/settings/app02_an_py39/main.py!}
 ```
 
 ////
@@ -291,7 +291,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp"uvicorn main:app
 //// tab | Python 3.8+
 
 ```Python hl_lines="17  19-21"
-{!> ../../../docs_src/settings/app02_an/main.py!}
+{!> ../../docs_src/settings/app02_an/main.py!}
 ```
 
 ////
@@ -305,7 +305,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp"uvicorn main:app
 ///
 
 ```Python hl_lines="16  18-20"
-{!> ../../../docs_src/settings/app02/main.py!}
+{!> ../../docs_src/settings/app02/main.py!}
 ```
 
 ////
@@ -315,7 +315,7 @@ $ ADMIN_EMAIL="deadpool@example.com" APP_NAME="ChimichangApp"uvicorn main:app
 然后,在测试期间,通过创建 `get_settings` 的依赖项覆盖,很容易提供一个不同的设置对象:
 
 ```Python hl_lines="9-10  13  21"
-{!../../../docs_src/settings/app02/test_main.py!}
+{!../../docs_src/settings/app02/test_main.py!}
 ```
 
 在依赖项覆盖中,我们在创建新的 `Settings` 对象时为 `admin_email` 设置了一个新值,然后返回该新对象。
@@ -358,7 +358,7 @@ APP_NAME="ChimichangApp"
 然后,您可以使用以下方式更新您的 `config.py`:
 
 ```Python hl_lines="9-10"
-{!../../../docs_src/settings/app03/config.py!}
+{!../../docs_src/settings/app03/config.py!}
 ```
 
 在这里,我们在 Pydantic 的 `Settings` 类中创建了一个名为 `Config` 的类,并将 `env_file` 设置为我们想要使用的 dotenv 文件的文件名。
@@ -395,7 +395,7 @@ def get_settings():
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  11"
-{!> ../../../docs_src/settings/app03_an_py39/main.py!}
+{!> ../../docs_src/settings/app03_an_py39/main.py!}
 ```
 
 ////
@@ -403,7 +403,7 @@ def get_settings():
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  11"
-{!> ../../../docs_src/settings/app03_an/main.py!}
+{!> ../../docs_src/settings/app03_an/main.py!}
 ```
 
 ////
@@ -417,7 +417,7 @@ def get_settings():
 ///
 
 ```Python hl_lines="1  10"
-{!> ../../../docs_src/settings/app03/main.py!}
+{!> ../../docs_src/settings/app03/main.py!}
 ```
 
 ////
index a26301b50a72e4c94e2022ddd09dd35e8eda36ca..f93ab1d24274116d40f1cb489732e338f19c2c49 100644 (file)
@@ -11,7 +11,7 @@
 首先,创建主(顶层)**FastAPI** 应用及其*路径操作*:
 
 ```Python hl_lines="3  6-8"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### 子应用
@@ -21,7 +21,7 @@
 子应用只是另一个标准 FastAPI 应用,但这个应用是被**挂载**的应用:
 
 ```Python hl_lines="11  14-16"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### 挂载子应用
@@ -31,7 +31,7 @@
 本例的子应用挂载在 `/subapi` 路径下:
 
 ```Python hl_lines="11  19"
-{!../../../docs_src/sub_applications/tutorial001.py!}
+{!../../docs_src/sub_applications/tutorial001.py!}
 ```
 
 ### 查看文档
index b09644e393192c59fe07dad633b39b4270bd5535..1159302a93ccd4de17c8339afedeb761d8bad239 100644 (file)
@@ -28,7 +28,7 @@ $ pip install jinja2
 * 使用 `templates` 渲染并返回 `TemplateResponse`, 传递模板的名称、request对象以及一个包含多个键值对(用于Jinja2模板)的"context"字典,
 
 ```Python hl_lines="4  11  15-16"
-{!../../../docs_src/templates/tutorial001.py!}
+{!../../docs_src/templates/tutorial001.py!}
 ```
 
 /// note | "笔记"
@@ -57,7 +57,7 @@ $ pip install jinja2
 编写模板 `templates/item.html`,代码如下:
 
 ```jinja hl_lines="7"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
 ```
 
 ### 模板上下文
@@ -111,13 +111,13 @@ Item ID: 42
 你还可以在模板内部将 `url_for()`用于静态文件,例如你挂载的 `name="static"`的 `StaticFiles`。
 
 ```jinja hl_lines="4"
-{!../../../docs_src/templates/templates/item.html!}
+{!../../docs_src/templates/templates/item.html!}
 ```
 
 本例中,它将链接到 `static/styles.css`中的CSS文件:
 
 ```CSS hl_lines="4"
-{!../../../docs_src/templates/static/styles.css!}
+{!../../docs_src/templates/static/styles.css!}
 ```
 
 因为使用了 `StaticFiles`, **FastAPI** 应用会自动提供位于 URL `/static/styles.css`的 CSS 文件。
index 58bf9af8c563dcd53ad352fc45e25110d0d4bc4a..ecab4f65b2fc6a9d6d5d3fc5420bdddc3d1de54c 100644 (file)
@@ -49,7 +49,7 @@
 但其余的会话代码基本上都是一样的,只要复制就可以了。
 
 ```Python hl_lines="8-13"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
+{!../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
 ```
 
 /// tip | "提示"
@@ -73,7 +73,7 @@ Base.metadata.create_all(bind=engine)
 因此,要在测试代码中添加这行代码创建新的数据库文件。
 
 ```Python hl_lines="16"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
+{!../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
 ```
 
 ## 覆盖依赖项
@@ -81,7 +81,7 @@ Base.metadata.create_all(bind=engine)
 接下来,创建覆盖依赖项,并为应用添加覆盖内容。
 
 ```Python hl_lines="19-24  27"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
+{!../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
 ```
 
 /// tip | "提示"
@@ -95,7 +95,7 @@ Base.metadata.create_all(bind=engine)
 然后,就可以正常测试了。
 
 ```Python hl_lines="32-47"
-{!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
+{!../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
 ```
 
 测试期间,所有在数据库中所做的修改都在 `test.db` 里,不会影响主应用的 `sql_app.db`。
index cc9a38200e54e1166094982cea9e21898661d6e3..c3d912e2f68a19b088b7de77935d312a4db12a18 100644 (file)
@@ -29,7 +29,7 @@
 这样一来,**FastAPI** 就会调用覆盖依赖项,不再调用原依赖项。
 
 ```Python hl_lines="26-27  30"
-{!../../../docs_src/dependency_testing/tutorial001.py!}
+{!../../docs_src/dependency_testing/tutorial001.py!}
 ```
 
 /// tip | "提示"
index 222a67c8cffe5c7f269b01e662505f3bfaceab12..00e661cd21e316eb1d10f52bde5e24e699a90cfa 100644 (file)
@@ -3,5 +3,5 @@
 使用 `TestClient` 和 `with` 语句,在测试中运行事件处理器(`startup` 与 `shutdown`)。
 
 ```Python hl_lines="9-12  20-24"
-{!../../../docs_src/app_testing/tutorial003.py!}
+{!../../docs_src/app_testing/tutorial003.py!}
 ```
index 795b739458656ff1ec3b12d901458ff3b373260d..a69053f243868895daab21b4f80dc164f29ef8c1 100644 (file)
@@ -5,7 +5,7 @@
 为此,要在 `with` 语句中使用 `TestClient` 连接 WebSocket。
 
 ```Python hl_lines="27-31"
-{!../../../docs_src/app_testing/tutorial002.py!}
+{!../../docs_src/app_testing/tutorial002.py!}
 ```
 
 /// note | "笔记"
index bc9e898d976a97a749babef9628edf56025ce91e..992458217f47385b09bad4a8cf807a459461dec7 100644 (file)
@@ -30,7 +30,7 @@
 此时,需要直接访问请求。
 
 ```Python hl_lines="1  7-8"
-{!../../../docs_src/using_request_directly/tutorial001.py!}
+{!../../docs_src/using_request_directly/tutorial001.py!}
 ```
 
 把*路径操作函数*的参数类型声明为 `Request`,**FastAPI** 就能把 `Request` 传递到参数里。
index 3fcc36dfee7f94124e9fd94d4ddea6da6f1daa22..15ae84c5815a3222edf28b2ee6f87ecb161d5bd9 100644 (file)
@@ -35,7 +35,7 @@ $ pip install websockets
 但这是一种专注于 WebSockets 的服务器端并提供一个工作示例的最简单方式:
 
 ```Python hl_lines="2  6-38  41-43"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 ## 创建 `websocket`
@@ -43,7 +43,7 @@ $ pip install websockets
 在您的 **FastAPI** 应用程序中,创建一个 `websocket`:
 
 ```Python hl_lines="1  46-47"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 /// note | "技术细节"
@@ -59,7 +59,7 @@ $ pip install websockets
 在您的 WebSocket 路由中,您可以使用 `await` 等待消息并发送消息。
 
 ```Python hl_lines="48-52"
-{!../../../docs_src/websockets/tutorial001.py!}
+{!../../docs_src/websockets/tutorial001.py!}
 ```
 
 您可以接收和发送二进制、文本和 JSON 数据。
@@ -112,7 +112,7 @@ $ uvicorn main:app --reload
 //// tab | Python 3.10+
 
 ```Python hl_lines="68-69  82"
-{!> ../../../docs_src/websockets/tutorial002_an_py310.py!}
+{!> ../../docs_src/websockets/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -120,7 +120,7 @@ $ uvicorn main:app --reload
 //// tab | Python 3.9+
 
 ```Python hl_lines="68-69  82"
-{!> ../../../docs_src/websockets/tutorial002_an_py39.py!}
+{!> ../../docs_src/websockets/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -128,7 +128,7 @@ $ uvicorn main:app --reload
 //// tab | Python 3.8+
 
 ```Python hl_lines="69-70  83"
-{!> ../../../docs_src/websockets/tutorial002_an.py!}
+{!> ../../docs_src/websockets/tutorial002_an.py!}
 ```
 
 ////
@@ -142,7 +142,7 @@ $ uvicorn main:app --reload
 ///
 
 ```Python hl_lines="66-67  79"
-{!> ../../../docs_src/websockets/tutorial002_py310.py!}
+{!> ../../docs_src/websockets/tutorial002_py310.py!}
 ```
 
 ////
@@ -156,7 +156,7 @@ $ uvicorn main:app --reload
 ///
 
 ```Python hl_lines="68-69  81"
-{!> ../../../docs_src/websockets/tutorial002.py!}
+{!> ../../docs_src/websockets/tutorial002.py!}
 ```
 
 ////
@@ -203,7 +203,7 @@ $ uvicorn main:app --reload
 //// tab | Python 3.9+
 
 ```Python hl_lines="79-81"
-{!> ../../../docs_src/websockets/tutorial003_py39.py!}
+{!> ../../docs_src/websockets/tutorial003_py39.py!}
 ```
 
 ////
@@ -211,7 +211,7 @@ $ uvicorn main:app --reload
 //// tab | Python 3.8+
 
 ```Python hl_lines="81-83"
-{!> ../../../docs_src/websockets/tutorial003.py!}
+{!> ../../docs_src/websockets/tutorial003.py!}
 ```
 
 ////
index 179ec88aabafbbfccc268d984f32942ac55f615a..92bd998d0b017fc6fd0df36576ec77f8e265278d 100644 (file)
@@ -13,7 +13,7 @@
 之后将其挂载到某一个路径下。
 
 ```Python hl_lines="2-3  22"
-{!../../../docs_src/wsgi/tutorial001.py!}
+{!../../docs_src/wsgi/tutorial001.py!}
 ```
 
 ## 检查
index 17f89b22f88281cdea552db8465781feaf8871fe..1a2daeec1997620da8858257d3e338c61a57063d 100644 (file)
@@ -19,7 +19,7 @@ FastAPI会将这些配置转换为 **JSON**,使其与 JavaScript 兼容,因
 但是你可以通过设置 `syntaxHighlight` 为 `False` 来禁用 Swagger UI 中的语法高亮:
 
 ```Python hl_lines="3"
-{!../../../docs_src/configure_swagger_ui/tutorial001.py!}
+{!../../docs_src/configure_swagger_ui/tutorial001.py!}
 ```
 
 ...在此之后,Swagger UI 将不会高亮代码:
@@ -31,7 +31,7 @@ FastAPI会将这些配置转换为 **JSON**,使其与 JavaScript 兼容,因
 同样地,你也可以通过设置键 `"syntaxHighlight.theme"` 来设置语法高亮主题(注意中间有一个点):
 
 ```Python hl_lines="3"
-{!../../../docs_src/configure_swagger_ui/tutorial002.py!}
+{!../../docs_src/configure_swagger_ui/tutorial002.py!}
 ```
 
 这个配置会改变语法高亮主题:
@@ -45,7 +45,7 @@ FastAPI 包含了一些默认配置参数,适用于大多数用例。
 其包括这些默认配置参数:
 
 ```Python
-{!../../../fastapi/openapi/docs.py[ln:7-23]!}
+{!../../fastapi/openapi/docs.py[ln:7-23]!}
 ```
 
 你可以通过在 `swagger_ui_parameters` 中设置不同的值来覆盖它们。
@@ -53,7 +53,7 @@ FastAPI 包含了一些默认配置参数,适用于大多数用例。
 比如,如果要禁用 `deepLinking`,你可以像这样传递设置到 `swagger_ui_parameters` 中:
 
 ```Python hl_lines="3"
-{!../../../docs_src/configure_swagger_ui/tutorial003.py!}
+{!../../docs_src/configure_swagger_ui/tutorial003.py!}
 ```
 
 ## 其他 Swagger UI 参数
index c788525391e46743eb4a0b5b15e3a959c290996b..dab6bd4c011e2f86112cc4dca71ad7f34b0133d3 100644 (file)
@@ -23,7 +23,7 @@
 让我们从一个简单的例子开始:
 
 ```Python
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 运行这段程序将输出:
@@ -39,7 +39,7 @@ John Doe
 * 中间用一个空格来<abbr title="将它们按顺序放置组合成一个整体。">拼接</abbr>它们。
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial001.py!}
+{!../../docs_src/python_types/tutorial001.py!}
 ```
 
 ### 修改示例
@@ -83,7 +83,7 @@ John Doe
 这些就是"类型提示":
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial002.py!}
+{!../../docs_src/python_types/tutorial002.py!}
 ```
 
 这和声明默认值是不同的,例如:
@@ -113,7 +113,7 @@ John Doe
 下面是一个已经有类型提示的函数:
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial003.py!}
+{!../../docs_src/python_types/tutorial003.py!}
 ```
 
 因为编辑器已经知道了这些变量的类型,所以不仅能对代码进行补全,还能检查其中的错误:
@@ -123,7 +123,7 @@ John Doe
 现在你知道了必须先修复这个问题,通过 `str(age)` 把 `age` 转换成字符串:
 
 ```Python hl_lines="2"
-{!../../../docs_src/python_types/tutorial004.py!}
+{!../../docs_src/python_types/tutorial004.py!}
 ```
 
 ## 声明类型
@@ -144,7 +144,7 @@ John Doe
 * `bytes`
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial005.py!}
+{!../../docs_src/python_types/tutorial005.py!}
 ```
 
 ### 嵌套类型
@@ -162,7 +162,7 @@ John Doe
 从 `typing` 模块导入 `List`(注意是大写的 `L`):
 
 ```Python hl_lines="1"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 同样以冒号(`:`)来声明这个变量。
@@ -172,7 +172,7 @@ John Doe
 由于列表是带有"子类型"的类型,所以我们把子类型放在方括号中:
 
 ```Python hl_lines="4"
-{!../../../docs_src/python_types/tutorial006.py!}
+{!../../docs_src/python_types/tutorial006.py!}
 ```
 
 这表示:"变量 `items` 是一个 `list`,并且这个列表里的每一个元素都是 `str`"。
@@ -192,7 +192,7 @@ John Doe
 声明 `tuple` 和 `set` 的方法也是一样的:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial007.py!}
+{!../../docs_src/python_types/tutorial007.py!}
 ```
 
 这表示:
@@ -209,7 +209,7 @@ John Doe
 第二个子类型声明 `dict` 的所有值:
 
 ```Python hl_lines="1  4"
-{!../../../docs_src/python_types/tutorial008.py!}
+{!../../docs_src/python_types/tutorial008.py!}
 ```
 
 这表示:
@@ -225,13 +225,13 @@ John Doe
 假设你有一个名为 `Person` 的类,拥有 name 属性:
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 接下来,你可以将一个变量声明为 `Person` 类型:
 
 ```Python hl_lines="6"
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 然后,你将再次获得所有的编辑器支持:
@@ -253,7 +253,7 @@ John Doe
 下面的例子来自 Pydantic 官方文档:
 
 ```Python
-{!../../../docs_src/python_types/tutorial010.py!}
+{!../../docs_src/python_types/tutorial010.py!}
 ```
 
 /// info
index 95fd7b6b572ceb6c04371e9fb0f64de7430eedda..fc9312bc5ee6cd98664b13c2f3ae6484e400b027 100644 (file)
@@ -16,7 +16,7 @@
 首先导入 `BackgroundTasks` 并在 *路径操作函数* 中使用类型声明 `BackgroundTasks` 定义一个参数:
 
 ```Python hl_lines="1  13"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 **FastAPI** 会创建一个 `BackgroundTasks` 类型的对象并作为该参数传入。
@@ -34,7 +34,7 @@
 由于写操作不使用 `async` 和 `await`,我们用普通的 `def` 定义函数:
 
 ```Python hl_lines="6-9"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 ## 添加后台任务
@@ -42,7 +42,7 @@
 在你的 *路径操作函数* 里,用 `.add_task()` 方法将任务函数传到 *后台任务* 对象中:
 
 ```Python hl_lines="14"
-{!../../../docs_src/background_tasks/tutorial001.py!}
+{!../../docs_src/background_tasks/tutorial001.py!}
 ```
 
 `.add_task()` 接收以下参数:
@@ -60,7 +60,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="13  15  22  25"
-{!> ../../../docs_src/background_tasks/tutorial002_an_py310.py!}
+{!> ../../docs_src/background_tasks/tutorial002_an_py310.py!}
 ```
 
 ////
@@ -68,7 +68,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="13  15  22  25"
-{!> ../../../docs_src/background_tasks/tutorial002_an_py39.py!}
+{!> ../../docs_src/background_tasks/tutorial002_an_py39.py!}
 ```
 
 ////
@@ -76,7 +76,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="14  16  23  26"
-{!> ../../../docs_src/background_tasks/tutorial002_an.py!}
+{!> ../../docs_src/background_tasks/tutorial002_an.py!}
 ```
 
 ////
@@ -90,7 +90,7 @@
 ///
 
 ```Python hl_lines="11  13  20  23"
-{!> ../../../docs_src/background_tasks/tutorial002_py310.py!}
+{!> ../../docs_src/background_tasks/tutorial002_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="13  15  22  25"
-{!> ../../../docs_src/background_tasks/tutorial002.py!}
+{!> ../../docs_src/background_tasks/tutorial002.py!}
 ```
 
 ////
index a0c7095e93e38901681eeee0dd93b8920be4a2f4..64afd99afeb5b45a0fba9dfd8e38c7f72b9f13f3 100644 (file)
@@ -86,7 +86,7 @@ from app.routers import items
 你可以导入它并通过与 `FastAPI` 类相同的方式创建一个「实例」:
 
 ```Python hl_lines="1  3" title="app/routers/users.py"
-{!../../../docs_src/bigger_applications/app/routers/users.py!}
+{!../../docs_src/bigger_applications/app/routers/users.py!}
 ```
 
 ### 使用 `APIRouter` 的*路径操作*
@@ -96,7 +96,7 @@ from app.routers import items
 使用方式与 `FastAPI` 类相同:
 
 ```Python hl_lines="6  11  16" title="app/routers/users.py"
-{!../../../docs_src/bigger_applications/app/routers/users.py!}
+{!../../docs_src/bigger_applications/app/routers/users.py!}
 ```
 
 你可以将 `APIRouter` 视为一个「迷你 `FastAPI`」类。
@@ -122,7 +122,7 @@ from app.routers import items
 现在我们将使用一个简单的依赖项来读取一个自定义的 `X-Token` 请求首部:
 
 ```Python hl_lines="1  4-6" title="app/dependencies.py"
-{!../../../docs_src/bigger_applications/app/dependencies.py!}
+{!../../docs_src/bigger_applications/app/dependencies.py!}
 ```
 
 /// tip
@@ -156,7 +156,7 @@ from app.routers import items
 因此,我们可以将其添加到 `APIRouter` 中,而不是将其添加到每个路径操作中。
 
 ```Python hl_lines="5-10  16  21" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 由于每个*路径操作*的路径都必须以 `/` 开头,例如:
@@ -217,7 +217,7 @@ async def read_item(item_id: str):
 因此,我们通过 `..` 对依赖项使用了相对导入:
 
 ```Python hl_lines="3" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 #### 相对导入如何工作
@@ -290,7 +290,7 @@ from ...dependencies import get_token_header
 但是我们仍然可以添加*更多*将会应用于特定的*路径操作*的 `tags`,以及一些特定于该*路径操作*的额外 `responses`:
 
 ```Python hl_lines="30-31" title="app/routers/items.py"
-{!../../../docs_src/bigger_applications/app/routers/items.py!}
+{!../../docs_src/bigger_applications/app/routers/items.py!}
 ```
 
 /// tip
@@ -318,7 +318,7 @@ from ...dependencies import get_token_header
 我们甚至可以声明[全局依赖项](dependencies/global-dependencies.md){.internal-link target=_blank},它会和每个 `APIRouter` 的依赖项组合在一起:
 
 ```Python hl_lines="1  3  7" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 ### 导入 `APIRouter`
@@ -326,7 +326,7 @@ from ...dependencies import get_token_header
 现在,我们导入具有 `APIRouter` 的其他子模块:
 
 ```Python hl_lines="5" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 由于文件 `app/routers/users.py` 和 `app/routers/items.py` 是同一 Python 包 `app` 一个部分的子模块,因此我们可以使用单个点 ` .` 通过「相对导入」来导入它们。
@@ -391,7 +391,7 @@ from .routers.users import router
 因此,为了能够在同一个文件中使用它们,我们直接导入子模块:
 
 ```Python hl_lines="5" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 ### 包含 `users` 和 `items` 的 `APIRouter`
@@ -399,7 +399,7 @@ from .routers.users import router
 现在,让我们来包含来自 `users` 和 `items` 子模块的 `router`。
 
 ```Python hl_lines="10-11" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 /// info
@@ -441,7 +441,7 @@ from .routers.users import router
 对于此示例,它将非常简单。但是假设由于它是与组织中的其他项目所共享的,因此我们无法对其进行修改,以及直接在 `APIRouter` 中添加 `prefix`、`dependencies`、`tags` 等:
 
 ```Python hl_lines="3" title="app/internal/admin.py"
-{!../../../docs_src/bigger_applications/app/internal/admin.py!}
+{!../../docs_src/bigger_applications/app/internal/admin.py!}
 ```
 
 但是我们仍然希望在包含 `APIRouter` 时设置一个自定义的 `prefix`,以便其所有*路径操作*以 `/admin` 开头,我们希望使用本项目已经有的 `dependencies` 保护它,并且我们希望它包含自定义的 `tags` 和 `responses`。
@@ -449,7 +449,7 @@ from .routers.users import router
 我们可以通过将这些参数传递给 `app.include_router()` 来完成所有的声明,而不必修改原始的 `APIRouter`:
 
 ```Python hl_lines="14-17" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 这样,原始的 `APIRouter` 将保持不变,因此我们仍然可以与组织中的其他项目共享相同的 `app/internal/admin.py` 文件。
@@ -472,7 +472,7 @@ from .routers.users import router
 这里我们这样做了...只是为了表明我们可以做到🤷:
 
 ```Python hl_lines="21-23" title="app/main.py"
-{!../../../docs_src/bigger_applications/app/main.py!}
+{!../../docs_src/bigger_applications/app/main.py!}
 ```
 
 它将与通过 `app.include_router()` 添加的所有其他*路径操作*一起正常运行。
index 6e4c385dd61e70dc9a9875bab0481a40fbfaf1c2..ac59d7e6aa289a440e83d19ec57e42fe4f73d568 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 ///
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_fields/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -87,7 +87,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="12-15"
-{!> ../../../docs_src/body_fields/tutorial001_an.py!}
+{!> ../../docs_src/body_fields/tutorial001_an.py!}
 ```
 
 ////
@@ -101,7 +101,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9-12"
-{!> ../../../docs_src/body_fields/tutorial001_py310.py!}
+{!> ../../docs_src/body_fields/tutorial001_py310.py!}
 ```
 
 ////
@@ -115,7 +115,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="11-14"
-{!> ../../../docs_src/body_fields/tutorial001.py!}
+{!> ../../docs_src/body_fields/tutorial001.py!}
 ```
 
 ////
index fe951e544736a59b6504f3ce4db6974fc80a61af..c3bc0db9e543d96ea3756a1829dd4c76ef33fd13 100644 (file)
@@ -11,7 +11,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-20"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-20"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-21"
-{!> ../../../docs_src/body_multiple_params/tutorial001_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_an.py!}
 ```
 
 ////
@@ -41,7 +41,7 @@
 ///
 
 ```Python hl_lines="17-19"
-{!> ../../../docs_src/body_multiple_params/tutorial001_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -55,7 +55,7 @@
 ///
 
 ```Python hl_lines="19-21"
-{!> ../../../docs_src/body_multiple_params/tutorial001.py!}
+{!> ../../docs_src/body_multiple_params/tutorial001.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial002_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -92,7 +92,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial002.py!}
+{!> ../../docs_src/body_multiple_params/tutorial002.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="23"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/body_multiple_params/tutorial003_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_multiple_params/tutorial003_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/body_multiple_params/tutorial003.py!}
+{!> ../../docs_src/body_multiple_params/tutorial003.py!}
 ```
 
 ////
@@ -225,7 +225,7 @@ q: str = None
 //// tab | Python 3.10+
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -233,7 +233,7 @@ q: str = None
 //// tab | Python 3.9+
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -241,7 +241,7 @@ q: str = None
 //// tab | Python 3.8+
 
 ```Python hl_lines="28"
-{!> ../../../docs_src/body_multiple_params/tutorial004_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_an.py!}
 ```
 
 ////
@@ -255,7 +255,7 @@ q: str = None
 ///
 
 ```Python hl_lines="25"
-{!> ../../../docs_src/body_multiple_params/tutorial004_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -269,7 +269,7 @@ q: str = None
 ///
 
 ```Python hl_lines="27"
-{!> ../../../docs_src/body_multiple_params/tutorial004.py!}
+{!> ../../docs_src/body_multiple_params/tutorial004.py!}
 ```
 
 ////
@@ -297,7 +297,7 @@ item: Item = Body(embed=True)
 //// tab | Python 3.10+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an_py310.py!}
 ```
 
 ////
@@ -305,7 +305,7 @@ item: Item = Body(embed=True)
 //// tab | Python 3.9+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an_py39.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an_py39.py!}
 ```
 
 ////
@@ -313,7 +313,7 @@ item: Item = Body(embed=True)
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_multiple_params/tutorial005_an.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_an.py!}
 ```
 
 ////
@@ -327,7 +327,7 @@ item: Item = Body(embed=True)
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/body_multiple_params/tutorial005_py310.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005_py310.py!}
 ```
 
 ////
@@ -341,7 +341,7 @@ item: Item = Body(embed=True)
 ///
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/body_multiple_params/tutorial005.py!}
+{!> ../../docs_src/body_multiple_params/tutorial005.py!}
 ```
 
 ////
index 26837abc6d70b63a8018d5ca0761f308b6368d4b..316ba9878dfa8f627732033be06468bf1befb97b 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial001_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial001.py!}
+{!> ../../docs_src/body_nested_models/tutorial001.py!}
 ```
 
 ////
@@ -33,7 +33,7 @@
 首先,从 Python 的标准库 `typing` 模块中导入 `List`:
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/body_nested_models/tutorial002.py!}
+{!> ../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ### 声明具有子类型的 List
@@ -58,7 +58,7 @@ my_list: List[str]
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial002_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -66,7 +66,7 @@ my_list: List[str]
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial002_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial002_py39.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@ my_list: List[str]
 //// tab | Python 3.8+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial002.py!}
+{!> ../../docs_src/body_nested_models/tutorial002.py!}
 ```
 
 ////
@@ -90,7 +90,7 @@ Python 具有一种特殊的数据类型来保存一组唯一的元素,即 `se
 //// tab | Python 3.10+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/body_nested_models/tutorial003_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial003_py310.py!}
 ```
 
 ////
@@ -98,7 +98,7 @@ Python 具有一种特殊的数据类型来保存一组唯一的元素,即 `se
 //// tab | Python 3.9+
 
 ```Python hl_lines="14"
-{!> ../../../docs_src/body_nested_models/tutorial003_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial003_py39.py!}
 ```
 
 ////
@@ -106,7 +106,7 @@ Python 具有一种特殊的数据类型来保存一组唯一的元素,即 `se
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  14"
-{!> ../../../docs_src/body_nested_models/tutorial003.py!}
+{!> ../../docs_src/body_nested_models/tutorial003.py!}
 ```
 
 ////
@@ -134,7 +134,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.10+
 
 ```Python hl_lines="7-9"
-{!> ../../../docs_src/body_nested_models/tutorial004_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py310.py!}
 ```
 
 ////
@@ -142,7 +142,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.9+
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/body_nested_models/tutorial004_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -150,7 +150,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.8+
 
 ```Python hl_lines="9-11"
-{!> ../../../docs_src/body_nested_models/tutorial004.py!}
+{!> ../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ////
@@ -162,7 +162,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.10+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_nested_models/tutorial004_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py310.py!}
 ```
 
 ////
@@ -170,7 +170,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.9+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial004_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -178,7 +178,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial004.py!}
+{!> ../../docs_src/body_nested_models/tutorial004.py!}
 ```
 
 ////
@@ -217,7 +217,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.10+
 
 ```Python hl_lines="2  8"
-{!> ../../../docs_src/body_nested_models/tutorial005_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial005_py310.py!}
 ```
 
 ////
@@ -225,7 +225,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.9+
 
 ```Python hl_lines="4  10"
-{!> ../../../docs_src/body_nested_models/tutorial005_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial005_py39.py!}
 ```
 
 ////
@@ -233,7 +233,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  10"
-{!> ../../../docs_src/body_nested_models/tutorial005.py!}
+{!> ../../docs_src/body_nested_models/tutorial005.py!}
 ```
 
 ////
@@ -247,7 +247,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.10+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body_nested_models/tutorial006_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial006_py310.py!}
 ```
 
 ////
@@ -255,7 +255,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.9+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial006_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial006_py39.py!}
 ```
 
 ////
@@ -263,7 +263,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.8+
 
 ```Python hl_lines="20"
-{!> ../../../docs_src/body_nested_models/tutorial006.py!}
+{!> ../../docs_src/body_nested_models/tutorial006.py!}
 ```
 
 ////
@@ -307,7 +307,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  12  18  21  25"
-{!> ../../../docs_src/body_nested_models/tutorial007_py310.py!}
+{!> ../../docs_src/body_nested_models/tutorial007_py310.py!}
 ```
 
 ////
@@ -315,7 +315,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.9+
 
 ```Python hl_lines="9  14  20  23  27"
-{!> ../../../docs_src/body_nested_models/tutorial007_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial007_py39.py!}
 ```
 
 ////
@@ -323,7 +323,7 @@ Pydantic 模型的每个属性都具有类型。
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  14  20  23  27"
-{!> ../../../docs_src/body_nested_models/tutorial007.py!}
+{!> ../../docs_src/body_nested_models/tutorial007.py!}
 ```
 
 ////
@@ -347,7 +347,7 @@ images: List[Image]
 //// tab | Python 3.9+
 
 ```Python hl_lines="13"
-{!> ../../../docs_src/body_nested_models/tutorial008_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial008_py39.py!}
 ```
 
 ////
@@ -355,7 +355,7 @@ images: List[Image]
 //// tab | Python 3.8+
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/body_nested_models/tutorial008.py!}
+{!> ../../docs_src/body_nested_models/tutorial008.py!}
 ```
 
 ////
@@ -391,7 +391,7 @@ images: List[Image]
 //// tab | Python 3.9+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/body_nested_models/tutorial009_py39.py!}
+{!> ../../docs_src/body_nested_models/tutorial009_py39.py!}
 ```
 
 ////
@@ -399,7 +399,7 @@ images: List[Image]
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/body_nested_models/tutorial009.py!}
+{!> ../../docs_src/body_nested_models/tutorial009.py!}
 ```
 
 ////
index 6c74d12e06a2d4e360599fea54d23940e5058c36..5e9008d6a1954ae1545a0763dc0edeaf8ad31a6a 100644 (file)
@@ -7,7 +7,7 @@
 把输入数据转换为以 JSON 格式存储的数据(比如,使用 NoSQL 数据库时),可以使用 `jsonable_encoder`。例如,把 `datetime` 转换为 `str`。
 
 ```Python hl_lines="30-35"
-{!../../../docs_src/body_updates/tutorial001.py!}
+{!../../docs_src/body_updates/tutorial001.py!}
 ```
 
 `PUT` 用于接收替换现有数据的数据。
@@ -57,7 +57,7 @@
 然后再用它生成一个只含已设置(在请求中所发送)数据,且省略了默认值的 `dict`:
 
 ```Python hl_lines="34"
-{!../../../docs_src/body_updates/tutorial002.py!}
+{!../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ### 使用 Pydantic 的 `update` 参数
@@ -67,7 +67,7 @@
 例如,`stored_item_model.copy(update=update_data)`:
 
 ```Python hl_lines="35"
-{!../../../docs_src/body_updates/tutorial002.py!}
+{!../../docs_src/body_updates/tutorial002.py!}
 ```
 
 ### 更新部分数据小结
@@ -86,7 +86,7 @@
 * 返回更新后的模型。
 
 ```Python hl_lines="30-37"
-{!../../../docs_src/body_updates/tutorial002.py!}
+{!../../docs_src/body_updates/tutorial002.py!}
 ```
 
 /// tip | "提示"
index c47abec7740f0bcaf820f21512f012b9444bbe60..67a7f28e0a2c38141cdec3b9b194bf12223fce51 100644 (file)
@@ -25,7 +25,7 @@ API 基本上肯定要发送**响应体**,但是客户端不一定发送**请
 //// tab | Python 3.10+
 
 ```Python hl_lines="2"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -33,7 +33,7 @@ API 基本上肯定要发送**响应体**,但是客户端不一定发送**请
 //// tab | Python 3.8+
 
 ```Python hl_lines="4"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -47,7 +47,7 @@ API 基本上肯定要发送**响应体**,但是客户端不一定发送**请
 //// tab | Python 3.10+
 
 ```Python hl_lines="5-9"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -55,7 +55,7 @@ API 基本上肯定要发送**响应体**,但是客户端不一定发送**请
 //// tab | Python 3.8+
 
 ```Python hl_lines="7-11"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -89,7 +89,7 @@ API 基本上肯定要发送**响应体**,但是客户端不一定发送**请
 //// tab | Python 3.10+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial001_py310.py!}
+{!> ../../docs_src/body/tutorial001_py310.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@ API 基本上肯定要发送**响应体**,但是客户端不一定发送**请
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial001.py!}
+{!> ../../docs_src/body/tutorial001.py!}
 ```
 
 ////
@@ -170,7 +170,7 @@ Pydantic 模型的 JSON 概图是 OpenAPI 生成的概图部件,可在 API 文
 //// tab | Python 3.10+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/body/tutorial002_py310.py!}
+{!> ../../docs_src/body/tutorial002_py310.py!}
 ```
 
 ////
@@ -178,7 +178,7 @@ Pydantic 模型的 JSON 概图是 OpenAPI 生成的概图部件,可在 API 文
 //// tab | Python 3.8+
 
 ```Python hl_lines="21"
-{!> ../../../docs_src/body/tutorial002.py!}
+{!> ../../docs_src/body/tutorial002.py!}
 ```
 
 ////
@@ -192,7 +192,7 @@ Pydantic 模型的 JSON 概图是 OpenAPI 生成的概图部件,可在 API 文
 //// tab | Python 3.10+
 
 ```Python hl_lines="15-16"
-{!> ../../../docs_src/body/tutorial003_py310.py!}
+{!> ../../docs_src/body/tutorial003_py310.py!}
 ```
 
 ////
@@ -200,7 +200,7 @@ Pydantic 模型的 JSON 概图是 OpenAPI 生成的概图部件,可在 API 文
 //// tab | Python 3.8+
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/body/tutorial003.py!}
+{!> ../../docs_src/body/tutorial003.py!}
 ```
 
 ////
@@ -214,7 +214,7 @@ Pydantic 模型的 JSON 概图是 OpenAPI 生成的概图部件,可在 API 文
 //// tab | Python 3.10+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/body/tutorial004_py310.py!}
+{!> ../../docs_src/body/tutorial004_py310.py!}
 ```
 
 ////
@@ -222,7 +222,7 @@ Pydantic 模型的 JSON 概图是 OpenAPI 生成的概图部件,可在 API 文
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/body/tutorial004.py!}
+{!> ../../docs_src/body/tutorial004.py!}
 ```
 
 ////
index 7ca77696ee8736b49e89cabbd0ddfb73a4325555..b01c28238afb3f527bbb75bd3023522fd193cee9 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
@@ -68,7 +68,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -76,7 +76,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -84,7 +84,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/cookie_params/tutorial001_an.py!}
+{!> ../../docs_src/cookie_params/tutorial001_an.py!}
 ```
 
 ////
@@ -98,7 +98,7 @@
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/cookie_params/tutorial001_py310.py!}
+{!> ../../docs_src/cookie_params/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/cookie_params/tutorial001.py!}
+{!> ../../docs_src/cookie_params/tutorial001.py!}
 ```
 
 ////
index de880f347142a5d1e2a53437a0da45d66cef94fe..1166d5c97b64ef078ca86df9283b57924a563270 100644 (file)
@@ -47,7 +47,7 @@
 * 特定的 HTTP headers 或者使用通配符 `"*"` 允许所有 headers。
 
 ```Python hl_lines="2  6-11  13-19"
-{!../../../docs_src/cors/tutorial001.py!}
+{!../../docs_src/cors/tutorial001.py!}
 ```
 
 默认情况下,这个 `CORSMiddleware` 实现所使用的默认参数较为保守,所以你需要显式地启用特定的源、方法或者 headers,以便浏览器能够在跨域上下文中使用它们。
index 945094207235ea3bea2300bccfb74fb349835b90..a5afa1aaa2c8ed396a7a668f35a801075c6d6c66 100644 (file)
@@ -7,7 +7,7 @@
 在你的 FastAPI 应用中直接导入 `uvicorn` 并运行:
 
 ```Python hl_lines="1  15"
-{!../../../docs_src/debugging/tutorial001.py!}
+{!../../docs_src/debugging/tutorial001.py!}
 ```
 
 ### 关于 `__name__ == "__main__"`
index 9932f90fc2eb2c7fa226516d1a51d679a5af4ca7..917459d1d0473ba8a478f191dfb50c5dca714511 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -86,7 +86,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.10+
 
 ```Python hl_lines="9-13"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -94,7 +94,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.8+
 
 ```Python hl_lines="11-15"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -104,7 +104,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -112,7 +112,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.6+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -122,7 +122,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.10+
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
+{!> ../../docs_src/dependencies/tutorial001_py310.py!}
 ```
 
 ////
@@ -130,7 +130,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.6+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/dependencies/tutorial001.py!}
+{!> ../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ////
@@ -152,7 +152,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.10+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
+{!> ../../docs_src/dependencies/tutorial002_py310.py!}
 ```
 
 ////
@@ -160,7 +160,7 @@ fluffy = Cat(name="Mr Fluffy")
 //// tab | Python 3.6+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial002.py!}
+{!> ../../docs_src/dependencies/tutorial002.py!}
 ```
 
 ////
@@ -206,7 +206,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.10+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial003_py310.py!}
+{!> ../../docs_src/dependencies/tutorial003_py310.py!}
 ```
 
 ////
@@ -214,7 +214,7 @@ commons = Depends(CommonQueryParams)
 //// tab | Python 3.6+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial003.py!}
+{!> ../../docs_src/dependencies/tutorial003.py!}
 ```
 
 ////
@@ -254,7 +254,7 @@ commons: CommonQueryParams = Depends()
 //// tab | Python 3.10+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial004_py310.py!}
+{!> ../../docs_src/dependencies/tutorial004_py310.py!}
 ```
 
 ////
@@ -262,7 +262,7 @@ commons: CommonQueryParams = Depends()
 //// tab | Python 3.6+
 
 ```Python hl_lines="19"
-{!> ../../../docs_src/dependencies/tutorial004.py!}
+{!> ../../docs_src/dependencies/tutorial004.py!}
 ```
 
 ////
index e6bbd47c14f4f1509915338610b195f54afc6b24..c7cfe0531a259c9b172c6601651860b0d01cac05 100644 (file)
@@ -15,7 +15,7 @@
 该参数的值是由 `Depends()` 组成的 `list`:
 
 ```Python hl_lines="17"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
 ```
 
 路径操作装饰器依赖项(以下简称为**“路径装饰器依赖项”**)的执行或解析方式和普通依赖项一样,但就算这些依赖项会返回值,它们的值也不会传递给*路径操作函数*。
@@ -47,7 +47,7 @@
 路径装饰器依赖项可以声明请求的需求项(比如响应头)或其他子依赖项:
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ### 触发异常
@@ -55,7 +55,7 @@
 路径装饰器依赖项与正常的依赖项一样,可以 `raise` 异常:
 
 ```Python hl_lines="8  13"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ### 返回值
@@ -65,7 +65,7 @@
 因此,可以复用在其他位置使用过的、(能返回值的)普通依赖项,即使没有使用这个值,也会执行该依赖项:
 
 ```Python hl_lines="9  14"
-{!../../../docs_src/dependencies/tutorial006.py!}
+{!../../docs_src/dependencies/tutorial006.py!}
 ```
 
 ## 为一组路径操作定义依赖项
index 6058f787815062c8058885fc5dc3b8e08e25a1c3..a30313719c602ab6a11586f31d108e0b3c0d73a5 100644 (file)
@@ -30,19 +30,19 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 在发送响应之前,只会执行 `yield` 语句及之前的代码:
 
 ```Python hl_lines="2-4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 生成的值会注入到 *路由函数* 和其他依赖项中:
 
 ```Python hl_lines="4"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 `yield` 语句后面的代码会在创建响应后,发送响应前执行:
 
 ```Python hl_lines="5-6"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 
 /// tip | 提示
@@ -64,7 +64,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 同样,你也可以使用 `finally` 来确保退出步骤得到执行,无论是否存在异常。
 
 ```Python hl_lines="3  5"
-{!../../../docs_src/dependencies/tutorial007.py!}
+{!../../docs_src/dependencies/tutorial007.py!}
 ```
 ## 使用 `yield` 的子依赖项
 
@@ -77,7 +77,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 //// tab | Python 3.9+
 
 ```Python hl_lines="6  14  22"
-{!> ../../../docs_src/dependencies/tutorial008_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -85,7 +85,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 //// tab | Python 3.8+
 
 ```Python hl_lines="5  13  21"
-{!> ../../../docs_src/dependencies/tutorial008_an.py!}
+{!> ../../docs_src/dependencies/tutorial008_an.py!}
 ```
 
 ////
@@ -99,7 +99,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 ///
 
 ```Python hl_lines="4  12  20"
-{!> ../../../docs_src/dependencies/tutorial008.py!}
+{!> ../../docs_src/dependencies/tutorial008.py!}
 ```
 
 ////
@@ -113,7 +113,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-19  26-27"
-{!> ../../../docs_src/dependencies/tutorial008_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008_an_py39.py!}
 ```
 
 ////
@@ -121,7 +121,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 //// tab | Python 3.8+
 
 ```Python hl_lines="17-18  25-26"
-{!> ../../../docs_src/dependencies/tutorial008_an.py!}
+{!> ../../docs_src/dependencies/tutorial008_an.py!}
 ```
 
 ////
@@ -135,7 +135,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 ///
 
 ```Python hl_lines="16-17  24-25"
-{!> ../../../docs_src/dependencies/tutorial008.py!}
+{!> ../../docs_src/dependencies/tutorial008.py!}
 ```
 
 ////
@@ -173,7 +173,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-22  31"
-{!> ../../../docs_src/dependencies/tutorial008b_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008b_an_py39.py!}
 ```
 
 ////
@@ -181,7 +181,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 //// tab | Python 3.8+
 
 ```Python hl_lines="17-21  30"
-{!> ../../../docs_src/dependencies/tutorial008b_an.py!}
+{!> ../../docs_src/dependencies/tutorial008b_an.py!}
 ```
 
 ////
@@ -195,7 +195,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 ///
 
 ```Python hl_lines="16-20  29"
-{!> ../../../docs_src/dependencies/tutorial008b.py!}
+{!> ../../docs_src/dependencies/tutorial008b.py!}
 ```
 
 ////
@@ -209,7 +209,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 //// tab | Python 3.9+
 
 ```Python hl_lines="15-16"
-{!> ../../../docs_src/dependencies/tutorial008c_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008c_an_py39.py!}
 ```
 
 ////
@@ -217,7 +217,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 //// tab | Python 3.8+
 
 ```Python hl_lines="14-15"
-{!> ../../../docs_src/dependencies/tutorial008c_an.py!}
+{!> ../../docs_src/dependencies/tutorial008c_an.py!}
 ```
 
 ////
@@ -231,7 +231,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 ///
 
 ```Python hl_lines="13-14"
-{!> ../../../docs_src/dependencies/tutorial008c.py!}
+{!> ../../docs_src/dependencies/tutorial008c.py!}
 ```
 
 ////
@@ -247,7 +247,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 //// tab | Python 3.9+
 
 ```Python hl_lines="17"
-{!> ../../../docs_src/dependencies/tutorial008d_an_py39.py!}
+{!> ../../docs_src/dependencies/tutorial008d_an_py39.py!}
 ```
 
 ////
@@ -255,7 +255,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 //// tab | Python 3.8+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/dependencies/tutorial008d_an.py!}
+{!> ../../docs_src/dependencies/tutorial008d_an.py!}
 ```
 
 ////
@@ -269,7 +269,7 @@ FastAPI支持在完成后执行一些<abbr title='有时也被称为"退出"("ex
 ///
 
 ```Python hl_lines="15"
-{!> ../../../docs_src/dependencies/tutorial008d.py!}
+{!> ../../docs_src/dependencies/tutorial008d.py!}
 ```
 
 ////
@@ -400,7 +400,7 @@ with open("./somefile.txt") as f:
 你也可以在 **FastAPI** 的 `yield` 依赖项中通过 `with` 或者 `async with` 语句来使用它们:
 
 ```Python hl_lines="1-9  13"
-{!../../../docs_src/dependencies/tutorial010.py!}
+{!../../docs_src/dependencies/tutorial010.py!}
 ```
 
 /// tip | 提示
index 3f7afa32cd1b3479ca261abfb06e38ba1e728af8..66f153f6b828962994126232a7fb24cdb64d8dd7 100644 (file)
@@ -7,7 +7,7 @@
 这样一来,就可以为所有*路径操作*应用该依赖项:
 
 ```Python hl_lines="15"
-{!../../../docs_src/dependencies/tutorial012.py!}
+{!../../docs_src/dependencies/tutorial012.py!}
 ```
 
 [*路径装饰器依赖项*](dependencies-in-path-operation-decorators.md){.internal-link target=_blank} 一章的思路均适用于全局依赖项, 在本例中,这些依赖项可以用于应用中的所有*路径操作*。
index b360bf71ea683439f21bf99442880dff71d1dec6..b039e1654372b5c7355c2ff0c19baf85ceabdacd 100644 (file)
@@ -32,7 +32,7 @@ FastAPI 提供了简单易用,但功能强大的**<abbr title="也称为组件
 依赖项就是一个函数,且可以使用与*路径操作函数*相同的参数:
 
 ```Python hl_lines="8-11"
-{!../../../docs_src/dependencies/tutorial001.py!}
+{!../../docs_src/dependencies/tutorial001.py!}
 ```
 
 大功告成。
@@ -56,7 +56,7 @@ FastAPI 提供了简单易用,但功能强大的**<abbr title="也称为组件
 ### 导入 `Depends`
 
 ```Python hl_lines="3"
-{!../../../docs_src/dependencies/tutorial001.py!}
+{!../../docs_src/dependencies/tutorial001.py!}
 ```
 
 ### 声明依赖项
@@ -64,7 +64,7 @@ FastAPI 提供了简单易用,但功能强大的**<abbr title="也称为组件
 与在*路径操作函数*参数中使用 `Body`、`Query` 的方式相同,声明依赖项需要使用 `Depends` 和一个新的参数:
 
 ```Python hl_lines="15  20"
-{!../../../docs_src/dependencies/tutorial001.py!}
+{!../../docs_src/dependencies/tutorial001.py!}
 ```
 
 虽然,在路径操作函数的参数中使用 `Depends` 的方式与 `Body`、`Query` 相同,但 `Depends` 的工作方式略有不同。
index d2a204c3d2c2296411238d2707af62ae923d8911..dd4c608571d0905a70374bda4eb39daaa7fb9396 100644 (file)
@@ -11,7 +11,7 @@ FastAPI 支持创建含**子依赖项**的依赖项。
 下列代码创建了第一层依赖项:
 
 ```Python hl_lines="8-9"
-{!../../../docs_src/dependencies/tutorial005.py!}
+{!../../docs_src/dependencies/tutorial005.py!}
 ```
 
 这段代码声明了类型为 `str` 的可选查询参数 `q`,然后返回这个查询参数。
@@ -23,7 +23,7 @@ FastAPI 支持创建含**子依赖项**的依赖项。
 接下来,创建另一个依赖项函数,并同时用该依赖项自身再声明一个依赖项(所以这也是一个「依赖项」):
 
 ```Python hl_lines="13"
-{!../../../docs_src/dependencies/tutorial005.py!}
+{!../../docs_src/dependencies/tutorial005.py!}
 ```
 
 这里重点说明一下声明的参数:
@@ -38,7 +38,7 @@ FastAPI 支持创建含**子依赖项**的依赖项。
 接下来,就可以使用依赖项:
 
 ```Python hl_lines="22"
-{!../../../docs_src/dependencies/tutorial005.py!}
+{!../../docs_src/dependencies/tutorial005.py!}
 ```
 
 /// info | "信息"
index 8270a40931559934c1fbef6e567040482cf998b3..41f37cd8d5f0177d5ce0aa7de039915f945b2c4d 100644 (file)
@@ -23,7 +23,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="4  21"
-{!> ../../../docs_src/encoder/tutorial001_py310.py!}
+{!> ../../docs_src/encoder/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="5  22"
-{!> ../../../docs_src/encoder/tutorial001.py!}
+{!> ../../docs_src/encoder/tutorial001.py!}
 ```
 
 ////
index 3b50da01f0c2dd8db4dc8bcb463229418412292e..ea5798b67863bd4672d62c027bde82d1a8a1a07b 100644 (file)
@@ -58,7 +58,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  3  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -66,7 +66,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  3  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  3  13-17"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
 ```
 
 ////
@@ -88,7 +88,7 @@
 ///
 
 ```Python hl_lines="1  2  11-15"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="1  2  12-16"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="19-20"
-{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="17-18"
-{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
+{!> ../../docs_src/extra_data_types/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="18-19"
-{!> ../../../docs_src/extra_data_types/tutorial001.py!}
+{!> ../../docs_src/extra_data_types/tutorial001.py!}
 ```
 
 ////
index b23d4188f5a47f114c849de03c3d4a5104a67f4c..6649b06c7f84a403c82247c4b912bacef81ba6e2 100644 (file)
@@ -23,7 +23,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  9  14  20  22  27-28  31-33  38-39"
-{!> ../../../docs_src/extra_models/tutorial001_py310.py!}
+{!> ../../docs_src/extra_models/tutorial001_py310.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  11  16  22  24  29-30  33-35  40-41"
-{!> ../../../docs_src/extra_models/tutorial001.py!}
+{!> ../../docs_src/extra_models/tutorial001.py!}
 ```
 
 ////
@@ -173,7 +173,7 @@ FastAPI 可以做得更好。
 //// tab | Python 3.10+
 
 ```Python hl_lines="7  13-14  17-18  21-22"
-{!> ../../../docs_src/extra_models/tutorial002_py310.py!}
+{!> ../../docs_src/extra_models/tutorial002_py310.py!}
 ```
 
 ////
@@ -181,7 +181,7 @@ FastAPI 可以做得更好。
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  15-16  19-20  23-24"
-{!> ../../../docs_src/extra_models/tutorial002.py!}
+{!> ../../docs_src/extra_models/tutorial002.py!}
 ```
 
 ////
@@ -203,7 +203,7 @@ FastAPI 可以做得更好。
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  14-15  18-20  33"
-{!> ../../../docs_src/extra_models/tutorial003_py310.py!}
+{!> ../../docs_src/extra_models/tutorial003_py310.py!}
 ```
 
 ////
@@ -211,7 +211,7 @@ FastAPI 可以做得更好。
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  14-15  18-20  33"
-{!> ../../../docs_src/extra_models/tutorial003.py!}
+{!> ../../docs_src/extra_models/tutorial003.py!}
 ```
 
 ////
@@ -225,7 +225,7 @@ FastAPI 可以做得更好。
 //// tab | Python 3.9+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/extra_models/tutorial004_py39.py!}
+{!> ../../docs_src/extra_models/tutorial004_py39.py!}
 ```
 
 ////
@@ -233,7 +233,7 @@ FastAPI 可以做得更好。
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  20"
-{!> ../../../docs_src/extra_models/tutorial004.py!}
+{!> ../../docs_src/extra_models/tutorial004.py!}
 ```
 
 ////
@@ -249,7 +249,7 @@ FastAPI 可以做得更好。
 //// tab | Python 3.9+
 
 ```Python hl_lines="6"
-{!> ../../../docs_src/extra_models/tutorial005_py39.py!}
+{!> ../../docs_src/extra_models/tutorial005_py39.py!}
 ```
 
 ////
@@ -257,7 +257,7 @@ FastAPI 可以做得更好。
 //// tab | Python 3.8+
 
 ```Python hl_lines="1  8"
-{!> ../../../docs_src/extra_models/tutorial005.py!}
+{!> ../../docs_src/extra_models/tutorial005.py!}
 ```
 
 ////
index 779d1b8beb8a2fd008de45a51abd6cd940494953..b9bbca1931fa56d870eae7948bc56ea58ccf2973 100644 (file)
@@ -3,7 +3,7 @@
 最简单的 FastAPI 文件可能像下面这样:
 
 ```Python
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 将其复制到 `main.py` 文件中。
@@ -135,7 +135,7 @@ OpenAPI 为你的 API 定义 API 模式。该模式中包含了你的 API 发送
 ### 步骤 1:导入 `FastAPI`
 
 ```Python hl_lines="1"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `FastAPI` 是一个为你的 API 提供了所有功能的 Python 类。
@@ -151,7 +151,7 @@ OpenAPI 为你的 API 定义 API 模式。该模式中包含了你的 API 发送
 ### 步骤 2:创建一个 `FastAPI`「实例」
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 这里的变量 `app` 会是 `FastAPI` 类的一个「实例」。
@@ -173,7 +173,7 @@ $ uvicorn main:app --reload
 如果你像下面这样创建应用:
 
 ```Python hl_lines="3"
-{!../../../docs_src/first_steps/tutorial002.py!}
+{!../../docs_src/first_steps/tutorial002.py!}
 ```
 
 将代码放入 `main.py` 文件中,然后你可以像下面这样运行 `uvicorn`:
@@ -252,7 +252,7 @@ https://example.com/items/foo
 #### 定义一个*路径操作装饰器*
 
 ```Python hl_lines="6"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 `@app.get("/")` 告诉 **FastAPI** 在它下方的函数负责处理如下访问请求:
@@ -308,7 +308,7 @@ https://example.com/items/foo
 * **函数**:是位于「装饰器」下方的函数(位于 `@app.get("/")` 下方)。
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 这是一个 Python 函数。
@@ -322,7 +322,7 @@ https://example.com/items/foo
 你也可以将其定义为常规函数而不使用 `async def`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/first_steps/tutorial003.py!}
+{!../../docs_src/first_steps/tutorial003.py!}
 ```
 
 /// note
@@ -334,7 +334,7 @@ https://example.com/items/foo
 ### 步骤 5:返回内容
 
 ```Python hl_lines="8"
-{!../../../docs_src/first_steps/tutorial001.py!}
+{!../../docs_src/first_steps/tutorial001.py!}
 ```
 
 你可以返回一个 `dict`、`list`,像 `str`、`int` 一样的单个值,等等。
index b5c027d44d239a0ed9cc462ff58488cfae05f6ff..0820c363cc35cabbc0ad3718f2f7608c0e64f81e 100644 (file)
@@ -26,7 +26,7 @@
 ### 导入 `HTTPException`
 
 ```Python hl_lines="1"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 
 ```
 
@@ -43,7 +43,7 @@
 本例中,客户端用 `ID` 请求的 `item` 不存在时,触发状态码为 `404` 的异常:
 
 ```Python hl_lines="11"
-{!../../../docs_src/handling_errors/tutorial001.py!}
+{!../../docs_src/handling_errors/tutorial001.py!}
 
 ```
 
@@ -86,7 +86,7 @@
 但对于某些高级应用场景,还是需要添加自定义响应头:
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial002.py!}
+{!../../docs_src/handling_errors/tutorial002.py!}
 
 ```
 
 此时,可以用 `@app.exception_handler()` 添加自定义异常控制器:
 
 ```Python hl_lines="5-7  13-18  24"
-{!../../../docs_src/handling_errors/tutorial003.py!}
+{!../../docs_src/handling_errors/tutorial003.py!}
 
 ```
 
 这样,异常处理器就可以接收 `Request` 与异常。
 
 ```Python hl_lines="2  14-16"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 
 ```
 
@@ -199,7 +199,7 @@ path -> item_id
 例如,只为错误返回纯文本响应,而不是返回 JSON 格式的内容:
 
 ```Python hl_lines="3-4  9-11  22"
-{!../../../docs_src/handling_errors/tutorial004.py!}
+{!../../docs_src/handling_errors/tutorial004.py!}
 
 ```
 
@@ -218,7 +218,7 @@ path -> item_id
 开发时,可以用这个请求体生成日志、调试错误,并返回给用户。
 
 ```Python hl_lines="14"
-{!../../../docs_src/handling_errors/tutorial005.py!}
+{!../../docs_src/handling_errors/tutorial005.py!}
 
 ```
 
@@ -284,7 +284,7 @@ FastAPI 支持先对异常进行某些处理,然后再使用 **FastAPI** 中
 从 `fastapi.exception_handlers` 中导入要复用的默认异常处理器:
 
 ```Python hl_lines="2-5  15  21"
-{!../../../docs_src/handling_errors/tutorial006.py!}
+{!../../docs_src/handling_errors/tutorial006.py!}
 
 ```
 
index a9064c519832fad85b1a207c17a74fd50bb2324a..4de8bf4df65f4175cf08ff82445263f74b0e33ce 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001_an.py!}
+{!> ../../docs_src/header_params/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/header_params/tutorial001_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/header_params/tutorial001.py!}
+{!> ../../docs_src/header_params/tutorial001.py!}
 ```
 
 ////
@@ -67,7 +67,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial001_an.py!}
+{!> ../../docs_src/header_params/tutorial001_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/header_params/tutorial001_py310.py!}
+{!> ../../docs_src/header_params/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial001.py!}
+{!> ../../docs_src/header_params/tutorial001.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial002_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial002_an_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/header_params/tutorial002_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial002_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="12"
-{!> ../../../docs_src/header_params/tutorial002_an.py!}
+{!> ../../docs_src/header_params/tutorial002_an.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/header_params/tutorial002_py310.py!}
+{!> ../../docs_src/header_params/tutorial002_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial002.py!}
+{!> ../../docs_src/header_params/tutorial002.py!}
 ```
 
 ////
 //// tab | Python 3.10+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_an_py310.py!}
+{!> ../../docs_src/header_params/tutorial003_an_py310.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_an_py39.py!}
+{!> ../../docs_src/header_params/tutorial003_an_py39.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/header_params/tutorial003_an.py!}
+{!> ../../docs_src/header_params/tutorial003_an.py!}
 ```
 
 ////
@@ -247,7 +247,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/header_params/tutorial003_py310.py!}
+{!> ../../docs_src/header_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -261,7 +261,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003_py39.py!}
+{!> ../../docs_src/header_params/tutorial003_py39.py!}
 ```
 
 ////
@@ -275,7 +275,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/header_params/tutorial003.py!}
+{!> ../../docs_src/header_params/tutorial003.py!}
 ```
 
 ////
index 3316e2ce4ba60bf3df715673d10376e95f27b0c8..7252db9f620ba88314a457562cd1275800ade50c 100644 (file)
@@ -19,7 +19,7 @@
 你可以按如下方式设置它们:
 
 ```Python hl_lines="4-6"
-{!../../../docs_src/metadata/tutorial001.py!}
+{!../../docs_src/metadata/tutorial001.py!}
 ```
 
 /// tip
@@ -41,7 +41,7 @@
 创建标签元数据并把它传递给 `openapi_tags` 参数:
 
 ```Python hl_lines="3-16  18"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
 ```
 
 注意你可以在描述内使用 Markdown,例如「login」会显示为粗体(**login**)以及「fancy」会显示为斜体(_fancy_)。
@@ -57,7 +57,7 @@
 将 `tags` 参数和*路径操作*(以及 `APIRouter`)一起使用,将其分配给不同的标签:
 
 ```Python hl_lines="21  26"
-{!../../../docs_src/metadata/tutorial004.py!}
+{!../../docs_src/metadata/tutorial004.py!}
 ```
 
 /// info | "信息"
@@ -87,7 +87,7 @@
 例如,将其设置为服务于 `/api/v1/openapi.json`:
 
 ```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial002.py!}
+{!../../docs_src/metadata/tutorial002.py!}
 ```
 
 如果你想完全禁用 OpenAPI 模式,可以将其设置为 `openapi_url=None`,这样也会禁用使用它的文档用户界面。
 例如,设置 Swagger UI 服务于 `/documentation` 并禁用 ReDoc:
 
 ```Python hl_lines="3"
-{!../../../docs_src/metadata/tutorial003.py!}
+{!../../docs_src/metadata/tutorial003.py!}
 ```
index 7cc6cac422bdd962edd3e60db6a33eb40f440555..fb2874ba357ff6664ebff930a637994c7532bc48 100644 (file)
@@ -32,7 +32,7 @@
 * 然后你可以在返回 `response` 前进一步修改它.
 
 ```Python hl_lines="8-9  11  14"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 /// tip
@@ -60,7 +60,7 @@
 例如你可以添加自定义请求头 `X-Process-Time` 包含以秒为单位的接收请求和生成响应的时间:
 
 ```Python hl_lines="10  12-13"
-{!../../../docs_src/middleware/tutorial001.py!}
+{!../../docs_src/middleware/tutorial001.py!}
 ```
 
 ## 其他中间件
index ac0177128d7a9b2a79c747b55180c1cff850499c..12e1f24ba11da15154449f99fbfece4ff4037522 100644 (file)
@@ -17,7 +17,7 @@
 如果记不住数字码的涵义,也可以用 `status` 的快捷常量:
 
 ```Python hl_lines="3  17"
-{!../../../docs_src/path_operation_configuration/tutorial001.py!}
+{!../../docs_src/path_operation_configuration/tutorial001.py!}
 ```
 
 状态码在响应中使用,并会被添加到 OpenAPI 概图。
@@ -35,7 +35,7 @@
 `tags` 参数的值是由 `str` 组成的 `list` (一般只有一个 `str` ),`tags` 用于为*路径操作*添加标签:
 
 ```Python hl_lines="17  22  27"
-{!../../../docs_src/path_operation_configuration/tutorial002.py!}
+{!../../docs_src/path_operation_configuration/tutorial002.py!}
 ```
 
 OpenAPI 概图会自动添加标签,供 API 文档接口使用:
@@ -47,7 +47,7 @@ OpenAPI 概图会自动添加标签,供 API 文档接口使用:
 路径装饰器还支持 `summary` 和 `description` 这两个参数:
 
 ```Python hl_lines="20-21"
-{!../../../docs_src/path_operation_configuration/tutorial003.py!}
+{!../../docs_src/path_operation_configuration/tutorial003.py!}
 ```
 
 ## 文档字符串(`docstring`)
@@ -57,7 +57,7 @@ OpenAPI 概图会自动添加标签,供 API 文档接口使用:
 文档字符串支持 <a href="https://en.wikipedia.org/wiki/Markdown" class="external-link" target="_blank">Markdown</a>,能正确解析和显示 Markdown 的内容,但要注意文档字符串的缩进。
 
 ```Python hl_lines="19-27"
-{!../../../docs_src/path_operation_configuration/tutorial004.py!}
+{!../../docs_src/path_operation_configuration/tutorial004.py!}
 ```
 
 下图为 Markdown 文本在 API 文档中的显示效果:
@@ -69,7 +69,7 @@ OpenAPI 概图会自动添加标签,供 API 文档接口使用:
 `response_description` 参数用于定义响应的描述说明:
 
 ```Python hl_lines="21"
-{!../../../docs_src/path_operation_configuration/tutorial005.py!}
+{!../../docs_src/path_operation_configuration/tutorial005.py!}
 ```
 
 /// info | "说明"
@@ -93,7 +93,7 @@ OpenAPI 规定每个*路径操作*都要有响应描述。
 `deprecated` 参数可以把*路径操作*标记为<abbr title="过时,建议不要使用">弃用</abbr>,无需直接删除:
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_operation_configuration/tutorial006.py!}
+{!../../docs_src/path_operation_configuration/tutorial006.py!}
 ```
 
 API 文档会把该路径操作标记为弃用:
index 6310ad8d24389802b317f0e5ccb75b1711486ffe..29197ac5316563c9892586b856bc731ec0408a96 100644 (file)
@@ -9,7 +9,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -17,7 +17,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="1  3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -25,7 +25,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="3-4"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
 ```
 
 ////
@@ -39,7 +39,7 @@
 ///
 
 ```Python hl_lines="1"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -53,7 +53,7 @@
 ///
 
 ```Python hl_lines="3"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
@@ -67,7 +67,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py!}
 ```
 
 ////
@@ -75,7 +75,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -83,7 +83,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="11"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_an.py!}
 ```
 
 ////
@@ -97,7 +97,7 @@
 ///
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial001.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/path_params_numeric_validations/tutorial002.py!}
+{!> ../../docs_src/path_params_numeric_validations/tutorial002.py!}
 ```
 
 ////
 Python 不会对该 `*` 做任何事情,但是它将知道之后的所有参数都应作为关键字参数(键值对),也被称为 <abbr title="来自:K-ey W-ord Arg-uments"><code>kwargs</code></abbr>,来调用。即使它们没有默认值。
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params_numeric_validations/tutorial003.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial003.py!}
 ```
 
 ## 数值校验:大于等于
@@ -175,7 +175,7 @@ Python 不会对该 `*` 做任何事情,但是它将知道之后的所有参
 像下面这样,添加 `ge=1` 后,`item_id` 将必须是一个大于(`g`reater than)或等于(`e`qual)`1` 的整数。
 
 ```Python hl_lines="8"
-{!../../../docs_src/path_params_numeric_validations/tutorial004.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial004.py!}
 ```
 
 ## 数值校验:大于和小于等于
@@ -186,7 +186,7 @@ Python 不会对该 `*` 做任何事情,但是它将知道之后的所有参
 * `le`:小于等于(`l`ess than or `e`qual)
 
 ```Python hl_lines="9"
-{!../../../docs_src/path_params_numeric_validations/tutorial005.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial005.py!}
 ```
 
 ## 数值校验:浮点数、大于和小于
@@ -200,7 +200,7 @@ Python 不会对该 `*` 做任何事情,但是它将知道之后的所有参
 对于 <abbr title="less than"><code>lt</code></abbr> 也是一样的。
 
 ```Python hl_lines="11"
-{!../../../docs_src/path_params_numeric_validations/tutorial006.py!}
+{!../../docs_src/path_params_numeric_validations/tutorial006.py!}
 ```
 
 ## 总结
index 091dcbeb0d72c563430b54f11dad79cad57a027a..a29ee0e2b9ec2a543b703ecf9d4b13e5f2e14303 100644 (file)
@@ -3,7 +3,7 @@
 FastAPI 支持使用 Python 字符串格式化语法声明**路径参数**(**变量**):
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/path_params/tutorial001.py!}
+{!../../docs_src/path_params/tutorial001.py!}
 ```
 
 这段代码把路径参数 `item_id` 的值传递给路径函数的参数 `item_id`。
@@ -19,7 +19,7 @@ FastAPI 支持使用 Python 字符串格式化语法声明**路径参数**(**
 使用 Python 标准类型注解,声明路径操作函数中路径参数的类型。
 
 ```Python hl_lines="7"
-{!../../../docs_src/path_params/tutorial002.py!}
+{!../../docs_src/path_params/tutorial002.py!}
 ```
 
 本例把 `item_id` 的类型声明为 `int`。
@@ -122,7 +122,7 @@ FastAPI 充分地利用了 <a href="https://docs.pydantic.dev/" class="external-
 由于*路径操作*是按顺序依次运行的,因此,一定要在 `/users/{user_id}` 之前声明 `/users/me` :
 
 ```Python hl_lines="6  11"
-{!../../../docs_src/path_params/tutorial003.py!}
+{!../../docs_src/path_params/tutorial003.py!}
 ```
 
 否则,`/users/{user_id}` 将匹配 `/users/me`,FastAPI 会**认为**正在接收值为 `"me"` 的 `user_id` 参数。
@@ -140,7 +140,7 @@ FastAPI 充分地利用了 <a href="https://docs.pydantic.dev/" class="external-
 然后,创建包含固定值的类属性,这些固定值是可用的有效值:
 
 ```Python hl_lines="1  6-9"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// info | "说明"
@@ -160,7 +160,7 @@ Python 3.4 及之后版本支持<a href="https://docs.python.org/3/library/enum.
 使用 Enum 类(`ModelName`)创建使用类型注解的*路径参数*:
 
 ```Python hl_lines="16"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 ### 查看文档
@@ -178,7 +178,7 @@ Python 3.4 及之后版本支持<a href="https://docs.python.org/3/library/enum.
 枚举类 `ModelName` 中的*枚举元素*支持比较操作:
 
 ```Python hl_lines="17"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 #### 获取*枚举值*
@@ -186,7 +186,7 @@ Python 3.4 及之后版本支持<a href="https://docs.python.org/3/library/enum.
 使用 `model_name.value` 或 `your_enum_member.value` 获取实际的值(本例中为**字符串**):
 
 ```Python hl_lines="20"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 /// tip | "提示"
@@ -202,7 +202,7 @@ Python 3.4 及之后版本支持<a href="https://docs.python.org/3/library/enum.
 返回给客户端之前,要把枚举元素转换为对应的值(本例中为字符串):
 
 ```Python hl_lines="18  21  23"
-{!../../../docs_src/path_params/tutorial005.py!}
+{!../../docs_src/path_params/tutorial005.py!}
 ```
 
 客户端中的 JSON 响应如下:
@@ -243,7 +243,7 @@ OpenAPI 不支持声明包含路径的*路径参数*,因为这会导致测试
 用法如下:
 
 ```Python hl_lines="6"
-{!../../../docs_src/path_params/tutorial004.py!}
+{!../../docs_src/path_params/tutorial004.py!}
 ```
 
 /// tip | "提示"
index cb4beb0ca39506b46b31749654500c67556da3d3..70e6f8a96864f8b4a473696e6c75f8af6b9d74ec 100644 (file)
@@ -7,7 +7,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params_str_validations/tutorial001_py310.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001_py310.py!}
 ```
 
 ////
@@ -15,7 +15,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params_str_validations/tutorial001.py!}
+{!> ../../docs_src/query_params_str_validations/tutorial001.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 为此,首先从 `fastapi` 导入 `Query`:
 
 ```Python hl_lines="1"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 ## 使用 `Query` 作为默认值
@@ -39,7 +39,7 @@
 现在,将 `Query` 用作查询参数的默认值,并将它的 `max_length` 参数设置为 50:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial002.py!}
+{!../../docs_src/query_params_str_validations/tutorial002.py!}
 ```
 
 由于我们必须用 `Query(default=None)` 替换默认值 `None`,`Query` 的第一个参数同样也是用于定义默认值。
@@ -71,7 +71,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
 你还可以添加 `min_length` 参数:
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial003.py!}
+{!../../docs_src/query_params_str_validations/tutorial003.py!}
 ```
 
 ## 添加正则表达式
@@ -79,7 +79,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
 你可以定义一个参数值必须匹配的<abbr title="正则表达式或正则是定义字符串搜索模式的字符序列。">正则表达式</abbr>:
 
 ```Python hl_lines="11"
-{!../../../docs_src/query_params_str_validations/tutorial004.py!}
+{!../../docs_src/query_params_str_validations/tutorial004.py!}
 ```
 
 这个指定的正则表达式通过以下规则检查接收到的参数值:
@@ -99,7 +99,7 @@ q: Union[str, None] = Query(default=None, max_length=50)
 假设你想要声明查询参数 `q`,使其 `min_length` 为 `3`,并且默认值为 `fixedquery`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial005.py!}
+{!../../docs_src/query_params_str_validations/tutorial005.py!}
 ```
 
 /// note
@@ -131,7 +131,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 因此,当你在使用 `Query` 且需要声明一个值是必需的时,只需不声明默认参数:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006.py!}
+{!../../docs_src/query_params_str_validations/tutorial006.py!}
 ```
 
 ### 使用省略号(`...`)声明必需参数
@@ -139,7 +139,7 @@ q: Union[str, None] = Query(default=None, min_length=3)
 有另一种方法可以显式的声明一个值是必需的,即将默认参数的默认值设为 `...` :
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial006b.py!}
+{!../../docs_src/query_params_str_validations/tutorial006b.py!}
 ```
 
 /// info
@@ -158,7 +158,7 @@ Pydantic 和 FastAPI 使用它来显式的声明需要一个值。
 为此,你可以声明`None`是一个有效的类型,并仍然使用`default=...`:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial006c.py!}
+{!../../docs_src/query_params_str_validations/tutorial006c.py!}
 ```
 
 /// tip
@@ -172,7 +172,7 @@ Pydantic 是 FastAPI 中所有数据验证和序列化的核心,当你在没
 如果你觉得使用 `...` 不舒服,你也可以从 Pydantic 导入并使用 `Required`:
 
 ```Python hl_lines="2  8"
-{!../../../docs_src/query_params_str_validations/tutorial006d.py!}
+{!../../docs_src/query_params_str_validations/tutorial006d.py!}
 ```
 
 /// tip
@@ -188,7 +188,7 @@ Pydantic 是 FastAPI 中所有数据验证和序列化的核心,当你在没
 例如,要声明一个可在 URL 中出现多次的查询参数 `q`,你可以这样写:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial011.py!}
+{!../../docs_src/query_params_str_validations/tutorial011.py!}
 ```
 
 然后,输入如下网址:
@@ -225,7 +225,7 @@ http://localhost:8000/items/?q=foo&q=bar
 你还可以定义在没有任何给定值时的默认 `list` 值:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial012.py!}
+{!../../docs_src/query_params_str_validations/tutorial012.py!}
 ```
 
 如果你访问:
@@ -250,7 +250,7 @@ http://localhost:8000/items/
 你也可以直接使用 `list` 代替 `List [str]`:
 
 ```Python hl_lines="7"
-{!../../../docs_src/query_params_str_validations/tutorial013.py!}
+{!../../docs_src/query_params_str_validations/tutorial013.py!}
 ```
 
 /// note
@@ -278,13 +278,13 @@ http://localhost:8000/items/
 你可以添加 `title`:
 
 ```Python hl_lines="10"
-{!../../../docs_src/query_params_str_validations/tutorial007.py!}
+{!../../docs_src/query_params_str_validations/tutorial007.py!}
 ```
 
 以及 `description`:
 
 ```Python hl_lines="13"
-{!../../../docs_src/query_params_str_validations/tutorial008.py!}
+{!../../docs_src/query_params_str_validations/tutorial008.py!}
 ```
 
 ## 别名参数
@@ -306,7 +306,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 这时你可以用 `alias` 参数声明一个别名,该别名将用于在 URL 中查找查询参数值:
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params_str_validations/tutorial009.py!}
+{!../../docs_src/query_params_str_validations/tutorial009.py!}
 ```
 
 ## 弃用参数
@@ -318,7 +318,7 @@ http://127.0.0.1:8000/items/?item-query=foobaritems
 那么将参数 `deprecated=True` 传入 `Query`:
 
 ```Python hl_lines="18"
-{!../../../docs_src/query_params_str_validations/tutorial010.py!}
+{!../../docs_src/query_params_str_validations/tutorial010.py!}
 ```
 
 文档将会像下面这样展示它:
index 6853e3899b04528c9b8bd1d39717d839dfe40d35..f17d43d3abc130286a7e22b757941e516c565efd 100644 (file)
@@ -3,7 +3,7 @@
 声明的参数不是路径参数时,路径操作函数会把该参数自动解释为**查询**参数。
 
 ```Python hl_lines="9"
-{!../../../docs_src/query_params/tutorial001.py!}
+{!../../docs_src/query_params/tutorial001.py!}
 ```
 
 查询字符串是键值对的集合,这些键值对位于 URL 的 `?` 之后,以 `&` 分隔。
@@ -66,7 +66,7 @@ http://127.0.0.1:8000/items/?skip=20
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial002_py310.py!}
+{!> ../../docs_src/query_params/tutorial002_py310.py!}
 ```
 
 ////
@@ -74,7 +74,7 @@ http://127.0.0.1:8000/items/?skip=20
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial002.py!}
+{!> ../../docs_src/query_params/tutorial002.py!}
 ```
 
 ////
@@ -103,7 +103,7 @@ FastAPI 不使用 `Optional[str]` 中的 `Optional`(只使用 `str`),但 `
 //// tab | Python 3.10+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/query_params/tutorial003_py310.py!}
+{!> ../../docs_src/query_params/tutorial003_py310.py!}
 ```
 
 ////
@@ -111,7 +111,7 @@ FastAPI 不使用 `Optional[str]` 中的 `Optional`(只使用 `str`),但 `
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/query_params/tutorial003.py!}
+{!> ../../docs_src/query_params/tutorial003.py!}
 ```
 
 ////
@@ -160,7 +160,7 @@ FastAPI 通过参数名进行检测:
 //// tab | Python 3.10+
 
 ```Python hl_lines="6 8"
-{!> ../../../docs_src/query_params/tutorial004_py310.py!}
+{!> ../../docs_src/query_params/tutorial004_py310.py!}
 ```
 
 ////
@@ -168,7 +168,7 @@ FastAPI 通过参数名进行检测:
 //// tab | Python 3.8+
 
 ```Python hl_lines="8 10"
-{!> ../../../docs_src/query_params/tutorial004.py!}
+{!> ../../docs_src/query_params/tutorial004.py!}
 ```
 
 ////
@@ -182,7 +182,7 @@ FastAPI 通过参数名进行检测:
 如果要把查询参数设置为**必选**,就不要声明默认值:
 
 ```Python hl_lines="6-7"
-{!../../../docs_src/query_params/tutorial005.py!}
+{!../../docs_src/query_params/tutorial005.py!}
 ```
 
 这里的查询参数 `needy` 是类型为 `str` 的必选查询参数。
@@ -230,7 +230,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
 //// tab | Python 3.10+
 
 ```Python hl_lines="8"
-{!> ../../../docs_src/query_params/tutorial006_py310.py!}
+{!> ../../docs_src/query_params/tutorial006_py310.py!}
 ```
 
 ////
@@ -238,7 +238,7 @@ http://127.0.0.1:8000/items/foo-item?needy=sooooneedy
 //// tab | Python 3.8+
 
 ```Python hl_lines="10"
-{!> ../../../docs_src/query_params/tutorial006.py!}
+{!> ../../docs_src/query_params/tutorial006.py!}
 ```
 
 ////
index d5d0fb671c13187840eee54875b9a19e1986634f..026771495936783d0e2b4e0b61b0903a44f3bac9 100644 (file)
@@ -17,7 +17,7 @@
 从 `fastapi` 导入 `File` 和 `UploadFile`:
 
 ```Python hl_lines="1"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
 ```
 
 ## 定义 `File` 参数
@@ -25,7 +25,7 @@
 创建文件(`File`)参数的方式与 `Body` 和 `Form` 一样:
 
 ```Python hl_lines="7"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
 ```
 
 /// info | "说明"
@@ -55,7 +55,7 @@
 定义文件参数时使用 `UploadFile`:
 
 ```Python hl_lines="12"
-{!../../../docs_src/request_files/tutorial001.py!}
+{!../../docs_src/request_files/tutorial001.py!}
 ```
 
 `UploadFile` 与 `bytes` 相比有更多优势:
@@ -141,7 +141,7 @@ contents = myfile.file.read()
 //// tab | Python 3.9+
 
 ```Python hl_lines="7  14"
-{!> ../../../docs_src/request_files/tutorial001_02_py310.py!}
+{!> ../../docs_src/request_files/tutorial001_02_py310.py!}
 ```
 
 ////
@@ -149,7 +149,7 @@ contents = myfile.file.read()
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  17"
-{!> ../../../docs_src/request_files/tutorial001_02.py!}
+{!> ../../docs_src/request_files/tutorial001_02.py!}
 ```
 
 ////
@@ -159,7 +159,7 @@ contents = myfile.file.read()
 您也可以将 `File()` 与 `UploadFile` 一起使用,例如,设置额外的元数据:
 
 ```Python hl_lines="13"
-{!../../../docs_src/request_files/tutorial001_03.py!}
+{!../../docs_src/request_files/tutorial001_03.py!}
 ```
 
 ## 多文件上传
@@ -173,7 +173,7 @@ FastAPI 支持同时上传多个文件。
 //// tab | Python 3.9+
 
 ```Python hl_lines="8  13"
-{!> ../../../docs_src/request_files/tutorial002_py39.py!}
+{!> ../../docs_src/request_files/tutorial002_py39.py!}
 ```
 
 ////
@@ -181,7 +181,7 @@ FastAPI 支持同时上传多个文件。
 //// tab | Python 3.8+
 
 ```Python hl_lines="10  15"
-{!> ../../../docs_src/request_files/tutorial002.py!}
+{!> ../../docs_src/request_files/tutorial002.py!}
 ```
 
 ////
@@ -204,7 +204,7 @@ FastAPI 支持同时上传多个文件。
 //// tab | Python 3.9+
 
 ```Python hl_lines="16"
-{!> ../../../docs_src/request_files/tutorial003_py39.py!}
+{!> ../../docs_src/request_files/tutorial003_py39.py!}
 ```
 
 ////
@@ -212,7 +212,7 @@ FastAPI 支持同时上传多个文件。
 //// tab | Python 3.8+
 
 ```Python hl_lines="18"
-{!> ../../../docs_src/request_files/tutorial003.py!}
+{!> ../../docs_src/request_files/tutorial003.py!}
 ```
 
 ////
index 723cf5b18cc2473e5a42f512cb1b2dd29334103e..ae0fd82ca163a248b5972d8153915ab172b02773 100644 (file)
@@ -13,7 +13,7 @@ FastAPI 支持同时使用 `File` 和 `Form` 定义文件和表单字段。
 ## 导入 `File` 与 `Form`
 
 ```Python hl_lines="1"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 ## 定义 `File` 与 `Form` 参数
@@ -21,7 +21,7 @@ FastAPI 支持同时使用 `File` 和 `Form` 定义文件和表单字段。
 创建文件和表单参数的方式与 `Body` 和 `Query` 一样:
 
 ```Python hl_lines="8"
-{!../../../docs_src/request_forms_and_files/tutorial001.py!}
+{!../../docs_src/request_forms_and_files/tutorial001.py!}
 ```
 
 文件和表单字段作为表单数据上传与接收。
index 6cc472ac198d25a17e74347bf863c54adcf1f092..94c8839b356a58228da0df31bc04149aa04e0913 100644 (file)
@@ -15,7 +15,7 @@
 从 `fastapi` 导入 `Form`:
 
 ```Python hl_lines="1"
-{!../../../docs_src/request_forms/tutorial001.py!}
+{!../../docs_src/request_forms/tutorial001.py!}
 ```
 
 ## 定义 `Form` 参数
@@ -23,7 +23,7 @@
 创建表单(`Form`)参数的方式与 `Body` 和 `Query` 一样:
 
 ```Python hl_lines="7"
-{!../../../docs_src/request_forms/tutorial001.py!}
+{!../../docs_src/request_forms/tutorial001.py!}
 ```
 
 例如,OAuth2 规范的 "密码流" 模式规定要通过表单字段发送 `username` 和 `password`。
index 3c196c9648f1ed5a0f6338b8c6b9bf539d0a9c1a..40fb407209782bb23fadcec0503e2e7e6c481c03 100644 (file)
@@ -11,7 +11,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001_py310.py!}
+{!> ../../docs_src/response_model/tutorial001_py310.py!}
 ```
 
 ////
@@ -19,7 +19,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001_py39.py!}
+{!> ../../docs_src/response_model/tutorial001_py39.py!}
 ```
 
 ////
@@ -27,7 +27,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="17  22  24-27"
-{!> ../../../docs_src/response_model/tutorial001.py!}
+{!> ../../docs_src/response_model/tutorial001.py!}
 ```
 
 ////
@@ -62,13 +62,13 @@ FastAPI 将使用此 `response_model` 来:
 现在我们声明一个 `UserIn` 模型,它将包含一个明文密码属性。
 
 ```Python hl_lines="9  11"
-{!../../../docs_src/response_model/tutorial002.py!}
+{!../../docs_src/response_model/tutorial002.py!}
 ```
 
 我们正在使用此模型声明输入数据,并使用同一模型声明输出数据:
 
 ```Python hl_lines="17-18"
-{!../../../docs_src/response_model/tutorial002.py!}
+{!../../docs_src/response_model/tutorial002.py!}
 ```
 
 现在,每当浏览器使用一个密码创建用户时,API 都会在响应中返回相同的密码。
@@ -90,7 +90,7 @@ FastAPI 将使用此 `response_model` 来:
 //// tab | Python 3.10+
 
 ```Python hl_lines="9  11  16"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -98,7 +98,7 @@ FastAPI 将使用此 `response_model` 来:
 //// tab | Python 3.8+
 
 ```Python hl_lines="9  11  16"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -108,7 +108,7 @@ FastAPI 将使用此 `response_model` 来:
 //// tab | Python 3.10+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -116,7 +116,7 @@ FastAPI 将使用此 `response_model` 来:
 //// tab | Python 3.8+
 
 ```Python hl_lines="24"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -126,7 +126,7 @@ FastAPI 将使用此 `response_model` 来:
 //// tab | Python 3.10+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003_py310.py!}
+{!> ../../docs_src/response_model/tutorial003_py310.py!}
 ```
 
 ////
@@ -134,7 +134,7 @@ FastAPI 将使用此 `response_model` 来:
 //// tab | Python 3.8+
 
 ```Python hl_lines="22"
-{!> ../../../docs_src/response_model/tutorial003.py!}
+{!> ../../docs_src/response_model/tutorial003.py!}
 ```
 
 ////
@@ -156,7 +156,7 @@ FastAPI 将使用此 `response_model` 来:
 你的响应模型可以具有默认值,例如:
 
 ```Python hl_lines="11  13-14"
-{!../../../docs_src/response_model/tutorial004.py!}
+{!../../docs_src/response_model/tutorial004.py!}
 ```
 
 * `description: Union[str, None] = None` 具有默认值 `None`。
@@ -172,7 +172,7 @@ FastAPI 将使用此 `response_model` 来:
 你可以设置*路径操作装饰器*的 `response_model_exclude_unset=True` 参数:
 
 ```Python hl_lines="24"
-{!../../../docs_src/response_model/tutorial004.py!}
+{!../../docs_src/response_model/tutorial004.py!}
 ```
 
 然后响应中将不会包含那些默认值,而是仅有实际设置的值。
@@ -263,7 +263,7 @@ FastAPI 通过 Pydantic 模型的 `.dict()` 配合 <a href="https://docs.pydanti
 ///
 
 ```Python hl_lines="31  37"
-{!../../../docs_src/response_model/tutorial005.py!}
+{!../../docs_src/response_model/tutorial005.py!}
 ```
 
 /// tip
@@ -279,7 +279,7 @@ FastAPI 通过 Pydantic 模型的 `.dict()` 配合 <a href="https://docs.pydanti
 如果你忘记使用 `set` 而是使用 `list` 或 `tuple`,FastAPI 仍会将其转换为 `set` 并且正常工作:
 
 ```Python hl_lines="31  37"
-{!../../../docs_src/response_model/tutorial006.py!}
+{!../../docs_src/response_model/tutorial006.py!}
 ```
 
 ## 总结
index 506cd4a43b7d760ac42fbb162c05b3cbac2d40fd..55bf502aee5de8ae51261c2a0bf523cf648cd8f1 100644 (file)
@@ -9,7 +9,7 @@
 * 等……
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 /// note | "笔记"
@@ -77,7 +77,7 @@ FastAPI 可以进行识别,并生成表明无响应体的 OpenAPI 文档。
 再看下之前的例子:
 
 ```Python hl_lines="6"
-{!../../../docs_src/response_status_code/tutorial001.py!}
+{!../../docs_src/response_status_code/tutorial001.py!}
 ```
 
 `201` 表示**已创建**的状态码。
@@ -87,7 +87,7 @@ FastAPI 可以进行识别,并生成表明无响应体的 OpenAPI 文档。
 可以使用 `fastapi.status` 中的快捷变量。
 
 ```Python hl_lines="1  6"
-{!../../../docs_src/response_status_code/tutorial002.py!}
+{!../../docs_src/response_status_code/tutorial002.py!}
 ```
 
 这只是一种快捷方式,具有相同的数字代码,但它可以使用编辑器的自动补全功能:
index 6063bd731eeb3c55b704ecb9b4d0dae05fb5789e..b3883e4d38040e5da429d817e861b7ea2642dc80 100644 (file)
@@ -13,7 +13,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="13-21"
-{!> ../../../docs_src/schema_extra_example/tutorial001_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001_py310.py!}
 ```
 
 ////
@@ -21,7 +21,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="15-23"
-{!> ../../../docs_src/schema_extra_example/tutorial001.py!}
+{!> ../../docs_src/schema_extra_example/tutorial001.py!}
 ```
 
 ////
@@ -35,7 +35,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="2  8-11"
-{!> ../../../docs_src/schema_extra_example/tutorial002_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002_py310.py!}
 ```
 
 ////
@@ -43,7 +43,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="4  10-13"
-{!> ../../../docs_src/schema_extra_example/tutorial002.py!}
+{!> ../../docs_src/schema_extra_example/tutorial002.py!}
 ```
 
 ////
@@ -63,7 +63,7 @@
 //// tab | Python 3.10+
 
 ```Python hl_lines="22-27"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py310.py!}
 ```
 
 ////
@@ -71,7 +71,7 @@
 //// tab | Python 3.9+
 
 ```Python hl_lines="22-27"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an_py39.py!}
 ```
 
 ////
@@ -79,7 +79,7 @@
 //// tab | Python 3.8+
 
 ```Python hl_lines="23-28"
-{!> ../../../docs_src/schema_extra_example/tutorial003_an.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_an.py!}
 ```
 
 ////
@@ -93,7 +93,7 @@
 ///
 
 ```Python hl_lines="18-23"
-{!> ../../../docs_src/schema_extra_example/tutorial003_py310.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003_py310.py!}
 ```
 
 ////
 ///
 
 ```Python hl_lines="20-25"
-{!> ../../../docs_src/schema_extra_example/tutorial003.py!}
+{!> ../../docs_src/schema_extra_example/tutorial003.py!}
 ```
 
 ////
index 266a5fcdf84ca7b313a6ffb5ed91107ce6e42977..8294b64449a8a9000413931998a14077b9c2bb77 100644 (file)
@@ -23,7 +23,7 @@
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/security/tutorial001_an_py39.py!}
+{!> ../../docs_src/security/tutorial001_an_py39.py!}
 ```
 
 ////
@@ -31,7 +31,7 @@
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/security/tutorial001_an.py!}
+{!> ../../docs_src/security/tutorial001_an.py!}
 ```
 
 ////
@@ -45,7 +45,7 @@
 ///
 
 ```Python
-{!> ../../../docs_src/security/tutorial001.py!}
+{!> ../../docs_src/security/tutorial001.py!}
 ```
 
 ////
@@ -155,7 +155,7 @@ OAuth2 的设计目标是为了让后端或 API 独立于服务器验证用户
 创建 `OAuth2PasswordBearer` 的类实例时,要传递 `tokenUrl` 参数。该参数包含客户端(用户浏览器中运行的前端) 的 URL,用于发送 `username` 与 `password`,并获取令牌。
 
 ```Python hl_lines="6"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 /// tip | "提示"
@@ -195,7 +195,7 @@ oauth2_scheme(some, parameters)
 接下来,使用 `Depends` 把 `oauth2_scheme` 传入依赖项。
 
 ```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 该依赖项使用字符串(`str`)接收*路径操作函数*的参数 `token` 。
index f8094e86a85d546c64e93288f465f19e205ae0c7..97461817a145a33ca5404615ef8a15c91a290302 100644 (file)
@@ -3,7 +3,7 @@
 上一章中,(基于依赖注入系统的)安全系统向*路径操作函数*传递了 `str` 类型的 `token`:
 
 ```Python hl_lines="10"
-{!../../../docs_src/security/tutorial001.py!}
+{!../../docs_src/security/tutorial001.py!}
 ```
 
 但这并不实用。
@@ -18,7 +18,7 @@
 与使用 Pydantic 声明请求体相同,并且可在任何位置使用:
 
 ```Python hl_lines="5  12-16"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
 ```
 
 ## 创建 `get_current_user` 依赖项
@@ -32,7 +32,7 @@
 与之前直接在路径操作中的做法相同,新的 `get_current_user` 依赖项从子依赖项 `oauth2_scheme` 中接收 `str` 类型的 `token`:
 
 ```Python hl_lines="25"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
 ```
 
 ## 获取用户
@@ -40,7 +40,7 @@
 `get_current_user` 使用创建的(伪)工具函数,该函数接收 `str` 类型的令牌,并返回 Pydantic 的 `User` 模型:
 
 ```Python hl_lines="19-22  26-27"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
 ```
 
 ## 注入当前用户
@@ -48,7 +48,7 @@
 在*路径操作* 的 `Depends` 中使用 `get_current_user`:
 
 ```Python hl_lines="31"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
 ```
 
 注意,此处把 `current_user` 的类型声明为 Pydantic 的 `User` 模型。
 所有*路径操作*只需 3 行代码就可以了:
 
 ```Python hl_lines="30-32"
-{!../../../docs_src/security/tutorial002.py!}
+{!../../docs_src/security/tutorial002.py!}
 ```
 
 ## 小结
index 690bd1789b194a4b8b05eac3f20d12034375943b..8e497b844c1718023747f700edf92e2cffda133d 100644 (file)
@@ -117,7 +117,7 @@ PassLib 上下文还支持使用不同哈希算法的功能,包括只能校验
 //// tab | Python 3.10+
 
 ```Python hl_lines="8  49  56-57  60-61  70-76"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -125,7 +125,7 @@ PassLib 上下文还支持使用不同哈希算法的功能,包括只能校验
 //// tab | Python 3.9+
 
 ```Python hl_lines="8  49  56-57  60-61  70-76"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -133,7 +133,7 @@ PassLib 上下文还支持使用不同哈希算法的功能,包括只能校验
 //// tab | Python 3.8+
 
 ```Python hl_lines="8  50  57-58  61-62  71-77"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
 ```
 
 ////
@@ -147,7 +147,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="7  48  55-56  59-60  69-75"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -161,7 +161,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="8  49  56-57  60-61  70-76"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
@@ -201,7 +201,7 @@ $ openssl rand -hex 32
 创建生成新的访问令牌的工具函数。
 
 ```Python hl_lines="6  12-14  28-30  78-86"
-{!../../../docs_src/security/tutorial004.py!}
+{!../../docs_src/security/tutorial004.py!}
 ```
 
 ## 更新依赖项
@@ -215,7 +215,7 @@ $ openssl rand -hex 32
 //// tab | Python 3.10+
 
 ```Python hl_lines="4 7  13-15  29-31  79-87"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -223,7 +223,7 @@ $ openssl rand -hex 32
 //// tab | Python 3.9+
 
 ```Python hl_lines="4 7  13-15  29-31  79-87"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -231,7 +231,7 @@ $ openssl rand -hex 32
 //// tab | Python 3.8+
 
 ```Python hl_lines="4 7  14-16  30-32 80-88"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
 ```
 
 ////
@@ -245,7 +245,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="3 6  12-14  28-30  78-86"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -259,7 +259,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="4 7  13-15  29-31  79-87"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
@@ -273,7 +273,7 @@ Prefer to use the `Annotated` version if possible.
 //// tab | Python 3.10+
 
 ```Python hl_lines="118-133"
-{!> ../../../docs_src/security/tutorial004_an_py310.py!}
+{!> ../../docs_src/security/tutorial004_an_py310.py!}
 ```
 
 ////
@@ -281,7 +281,7 @@ Prefer to use the `Annotated` version if possible.
 //// tab | Python 3.9+
 
 ```Python hl_lines="118-133"
-{!> ../../../docs_src/security/tutorial004_an_py39.py!}
+{!> ../../docs_src/security/tutorial004_an_py39.py!}
 ```
 
 ////
@@ -289,7 +289,7 @@ Prefer to use the `Annotated` version if possible.
 //// tab | Python 3.8+
 
 ```Python hl_lines="119-134"
-{!> ../../../docs_src/security/tutorial004_an.py!}
+{!> ../../docs_src/security/tutorial004_an.py!}
 ```
 
 ////
@@ -303,7 +303,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="115-130"
-{!> ../../../docs_src/security/tutorial004_py310.py!}
+{!> ../../docs_src/security/tutorial004_py310.py!}
 ```
 
 ////
@@ -317,7 +317,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python hl_lines="116-131"
-{!> ../../../docs_src/security/tutorial004.py!}
+{!> ../../docs_src/security/tutorial004.py!}
 ```
 
 ////
index 261421dad0dd1182717d883e3d594685d24a9100..1f031a6b2eb8401b86262f746de5e106358d6118 100644 (file)
@@ -53,7 +53,7 @@ OAuth2 中,**作用域**只是声明指定权限的字符串。
 首先,导入 `OAuth2PasswordRequestForm`,然后,在 `/token` *路径操作* 中,用 `Depends` 把该类作为依赖项。
 
 ```Python hl_lines="4  76"
-{!../../../docs_src/security/tutorial003.py!}
+{!../../docs_src/security/tutorial003.py!}
 ```
 
 `OAuth2PasswordRequestForm` 是用以下几项内容声明表单请求体的类依赖项:
@@ -103,7 +103,7 @@ OAuth2 中,**作用域**只是声明指定权限的字符串。
 本例使用 `HTTPException` 异常显示此错误:
 
 ```Python hl_lines="3  77-79"
-{!../../../docs_src/security/tutorial003.py!}
+{!../../docs_src/security/tutorial003.py!}
 ```
 
 ### 校验密码
@@ -131,7 +131,7 @@ OAuth2 中,**作用域**只是声明指定权限的字符串。
 这样一来,窃贼就无法在其它应用中使用窃取的密码,要知道,很多用户在所有系统中都使用相同的密码,风险超大。
 
 ```Python hl_lines="80-83"
-{!../../../docs_src/security/tutorial003.py!}
+{!../../docs_src/security/tutorial003.py!}
 ```
 
 #### 关于 `**user_dict`
@@ -175,7 +175,7 @@ UserInDB(
 ///
 
 ```Python hl_lines="85"
-{!../../../docs_src/security/tutorial003.py!}
+{!../../docs_src/security/tutorial003.py!}
 ```
 
 /// tip | "提示"
@@ -203,7 +203,7 @@ UserInDB(
 因此,在端点中,只有当用户存在、通过身份验证、且状态为激活时,才能获得该用户:
 
 ```Python hl_lines="58-67  69-72  90"
-{!../../../docs_src/security/tutorial003.py!}
+{!../../docs_src/security/tutorial003.py!}
 ```
 
 /// info | "说明"
index 45ec71f7ca69ada9eb5de1f6ae41066714d33bbd..379c441436a01b1d67f7c96db3e9bf54a26fcc8d 100644 (file)
@@ -118,13 +118,13 @@ $ pip install sqlalchemy
 ### 导入 SQLAlchemy 部件
 
 ```Python hl_lines="1-3"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 ### 为 SQLAlchemy 定义数据库 URL地址
 
 ```Python hl_lines="5-6"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 在这个例子中,我们正在“连接”到一个 SQLite 数据库(用 SQLite 数据库打开一个文件)。
@@ -154,7 +154,7 @@ SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db"
 我们稍后会将这个`engine`在其他地方使用。
 
 ```Python hl_lines="8-10"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 #### 注意
@@ -192,7 +192,7 @@ connect_args={"check_same_thread": False}
 要创建`SessionLocal`类,请使用函数`sessionmaker`:
 
 ```Python hl_lines="11"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 ### 创建一个`Base`类
@@ -202,7 +202,7 @@ connect_args={"check_same_thread": False}
 稍后我们将继承这个类,来创建每个数据库模型或类(ORM 模型):
 
 ```Python hl_lines="13"
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 ## 创建数据库模型
@@ -228,7 +228,7 @@ SQLAlchemy 使用的“**模型**”这个术语 来指代与数据库交互的
 这些类就是 SQLAlchemy 模型。
 
 ```Python hl_lines="4  7-8  18-19"
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
 ```
 
 这个`__tablename__`属性是用来告诉 SQLAlchemy 要在数据库中为每个模型使用的数据库表的名称。
@@ -244,7 +244,7 @@ SQLAlchemy 使用的“**模型**”这个术语 来指代与数据库交互的
 我们传递一个 SQLAlchemy “类型”,如`Integer`、`String`和`Boolean`,它定义了数据库中的类型,作为参数。
 
 ```Python hl_lines="1  10-13  21-24"
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
 ```
 
 ### 创建关系
@@ -256,7 +256,7 @@ SQLAlchemy 使用的“**模型**”这个术语 来指代与数据库交互的
 这将或多或少会成为一种“神奇”属性,其中表示该表与其他相关的表中的值。
 
 ```Python hl_lines="2  15  26"
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
 ```
 
 当访问 user 中的属性`items`时,如 中`my_user.items`,它将有一个`Item`SQLAlchemy 模型列表(来自`items`表),这些模型具有指向`users`表中此记录的外键。
@@ -292,7 +292,7 @@ SQLAlchemy 使用的“**模型**”这个术语 来指代与数据库交互的
 //// tab | Python 3.10+
 
 ```Python hl_lines="1  4-6  9-10  21-22  25-26"
-{!> ../../../docs_src/sql_databases/sql_app_py310/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py310/schemas.py!}
 ```
 
 ////
@@ -300,7 +300,7 @@ SQLAlchemy 使用的“**模型**”这个术语 来指代与数据库交互的
 //// tab | Python 3.9+
 
 ```Python hl_lines="3  6-8  11-12  23-24  27-28"
-{!> ../../../docs_src/sql_databases/sql_app_py39/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/schemas.py!}
 ```
 
 ////
@@ -308,7 +308,7 @@ SQLAlchemy 使用的“**模型**”这个术语 来指代与数据库交互的
 //// tab | Python 3.8+
 
 ```Python hl_lines="3  6-8  11-12  23-24  27-28"
-{!> ../../../docs_src/sql_databases/sql_app/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app/schemas.py!}
 ```
 
 ////
@@ -342,7 +342,7 @@ name: str
 //// tab | Python 3.10+
 
 ```Python hl_lines="13-15  29-32"
-{!> ../../../docs_src/sql_databases/sql_app_py310/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py310/schemas.py!}
 ```
 
 ////
@@ -350,7 +350,7 @@ name: str
 //// tab | Python 3.9+
 
 ```Python hl_lines="15-17  31-34"
-{!> ../../../docs_src/sql_databases/sql_app_py39/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/schemas.py!}
 ```
 
 ////
@@ -358,7 +358,7 @@ name: str
 //// tab | Python 3.8+
 
 ```Python hl_lines="15-17  31-34"
-{!> ../../../docs_src/sql_databases/sql_app/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app/schemas.py!}
 ```
 
 ////
@@ -380,7 +380,7 @@ name: str
 //// tab | Python 3.10+
 
 ```Python hl_lines="13  17-18  29  34-35"
-{!> ../../../docs_src/sql_databases/sql_app_py310/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py310/schemas.py!}
 ```
 
 ////
@@ -388,7 +388,7 @@ name: str
 //// tab | Python 3.9+
 
 ```Python hl_lines="15  19-20  31  36-37"
-{!> ../../../docs_src/sql_databases/sql_app_py39/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/schemas.py!}
 ```
 
 ////
@@ -396,7 +396,7 @@ name: str
 //// tab | Python 3.8+
 
 ```Python hl_lines="15  19-20  31  36-37"
-{!> ../../../docs_src/sql_databases/sql_app/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app/schemas.py!}
 ```
 
 ////
@@ -474,7 +474,7 @@ current_user.items
 * 查询多个项目。
 
 ```Python hl_lines="1  3  6-7  10-11  14-15  27-28"
-{!../../../docs_src/sql_databases/sql_app/crud.py!}
+{!../../docs_src/sql_databases/sql_app/crud.py!}
 ```
 
 /// tip
@@ -495,7 +495,7 @@ current_user.items
 * 使用`refresh`来刷新您的实例对象(以便它包含来自数据库的任何新数据,例如生成的 ID)。
 
 ```Python hl_lines="18-24  31-36"
-{!../../../docs_src/sql_databases/sql_app/crud.py!}
+{!../../docs_src/sql_databases/sql_app/crud.py!}
 ```
 
 /// tip
@@ -547,7 +547,7 @@ SQLAlchemy 模型`User`包含一个`hashed_password`,它应该是一个包含
 //// tab | Python 3.9+
 
 ```Python hl_lines="7"
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
 ```
 
 ////
@@ -555,7 +555,7 @@ SQLAlchemy 模型`User`包含一个`hashed_password`,它应该是一个包含
 //// tab | Python 3.8+
 
 ```Python hl_lines="9"
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
 ```
 
 ////
@@ -585,7 +585,7 @@ SQLAlchemy 模型`User`包含一个`hashed_password`,它应该是一个包含
 //// tab | Python 3.9+
 
 ```Python hl_lines="13-18"
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
 ```
 
 ////
@@ -593,7 +593,7 @@ SQLAlchemy 模型`User`包含一个`hashed_password`,它应该是一个包含
 //// tab | Python 3.8+
 
 ```Python hl_lines="15-20"
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
 ```
 
 ////
@@ -617,7 +617,7 @@ SQLAlchemy 模型`User`包含一个`hashed_password`,它应该是一个包含
 //// tab | Python 3.9+
 
 ```Python hl_lines="22  30  36  45  51"
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
 ```
 
 ////
@@ -625,7 +625,7 @@ SQLAlchemy 模型`User`包含一个`hashed_password`,它应该是一个包含
 //// tab | Python 3.8+
 
 ```Python hl_lines="24  32  38  47  53"
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
 ```
 
 ////
@@ -645,7 +645,7 @@ SQLAlchemy 模型`User`包含一个`hashed_password`,它应该是一个包含
 //// tab | Python 3.9+
 
 ```Python hl_lines="21-26  29-32  35-40  43-47  50-53"
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
 ```
 
 ////
@@ -653,7 +653,7 @@ SQLAlchemy 模型`User`包含一个`hashed_password`,它应该是一个包含
 //// tab | Python 3.8+
 
 ```Python hl_lines="23-28  31-34  37-42  45-49  52-55"
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
 ```
 
 ////
@@ -740,13 +740,13 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 * `sql_app/database.py`:
 
 ```Python
-{!../../../docs_src/sql_databases/sql_app/database.py!}
+{!../../docs_src/sql_databases/sql_app/database.py!}
 ```
 
 * `sql_app/models.py`:
 
 ```Python
-{!../../../docs_src/sql_databases/sql_app/models.py!}
+{!../../docs_src/sql_databases/sql_app/models.py!}
 ```
 
 * `sql_app/schemas.py`:
@@ -754,7 +754,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 //// tab | Python 3.10+
 
 ```Python
-{!> ../../../docs_src/sql_databases/sql_app_py310/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py310/schemas.py!}
 ```
 
 ////
@@ -762,7 +762,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/sql_databases/sql_app_py39/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/schemas.py!}
 ```
 
 ////
@@ -770,7 +770,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/sql_databases/sql_app/schemas.py!}
+{!> ../../docs_src/sql_databases/sql_app/schemas.py!}
 ```
 
 ////
@@ -778,7 +778,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 * `sql_app/crud.py`:
 
 ```Python
-{!../../../docs_src/sql_databases/sql_app/crud.py!}
+{!../../docs_src/sql_databases/sql_app/crud.py!}
 ```
 
 * `sql_app/main.py`:
@@ -786,7 +786,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/sql_databases/sql_app_py39/main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/main.py!}
 ```
 
 ////
@@ -794,7 +794,7 @@ def read_user(user_id: int, db: Session = Depends(get_db)):
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/sql_databases/sql_app/main.py!}
+{!> ../../docs_src/sql_databases/sql_app/main.py!}
 ```
 
 ////
@@ -851,7 +851,7 @@ $ uvicorn sql_app.main:app --reload
 //// tab | Python 3.9+
 
 ```Python hl_lines="12-20"
-{!> ../../../docs_src/sql_databases/sql_app_py39/alt_main.py!}
+{!> ../../docs_src/sql_databases/sql_app_py39/alt_main.py!}
 ```
 
 ////
@@ -859,7 +859,7 @@ $ uvicorn sql_app.main:app --reload
 //// tab | Python 3.8+
 
 ```Python hl_lines="14-22"
-{!> ../../../docs_src/sql_databases/sql_app/alt_main.py!}
+{!> ../../docs_src/sql_databases/sql_app/alt_main.py!}
 ```
 
 ////
index 3d14f34d87ad4b2a811d2a5319d79c710d331eb4..37e90ad43d37cf2e0c12fdf3fa4695b3fbf9a63d 100644 (file)
@@ -8,7 +8,7 @@
 * "挂载"(Mount) 一个 `StaticFiles()` 实例到一个指定路径。
 
 ```Python hl_lines="2  6"
-{!../../../docs_src/static_files/tutorial001.py!}
+{!../../docs_src/static_files/tutorial001.py!}
 ```
 
 /// note | "技术细节"
index 18c35e8c67cd0ea243356f14ff868092df71387e..173e6f8a68d3d22a4e2ff21bbf7cd197602237cd 100644 (file)
@@ -27,7 +27,7 @@
 为你需要检查的地方用标准的Python表达式写个简单的 `assert` 语句(重申,标准的`pytest`)。
 
 ```Python hl_lines="2  12  15-18"
-{!../../../docs_src/app_testing/tutorial001.py!}
+{!../../docs_src/app_testing/tutorial001.py!}
 ```
 
 /// tip | "提示"
@@ -75,7 +75,7 @@
 
 
 ```Python
-{!../../../docs_src/app_testing/main.py!}
+{!../../docs_src/app_testing/main.py!}
 ```
 
 ### 测试文件
@@ -93,7 +93,7 @@
 因为这文件在同一个包中,所以你可以通过相对导入从 `main` 模块(`main.py`)导入`app`对象:
 
 ```Python hl_lines="3"
-{!../../../docs_src/app_testing/test_main.py!}
+{!../../docs_src/app_testing/test_main.py!}
 ```
 
 ...然后测试代码和之前一样的。
 //// tab | Python 3.10+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py310/main.py!}
 ```
 
 ////
 //// tab | Python 3.9+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an_py39/main.py!}
+{!> ../../docs_src/app_testing/app_b_an_py39/main.py!}
 ```
 
 ////
 //// tab | Python 3.8+
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_an/main.py!}
+{!> ../../docs_src/app_testing/app_b_an/main.py!}
 ```
 
 ////
@@ -155,7 +155,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b_py310/main.py!}
+{!> ../../docs_src/app_testing/app_b_py310/main.py!}
 ```
 
 ////
@@ -169,7 +169,7 @@ Prefer to use the `Annotated` version if possible.
 ///
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/main.py!}
+{!> ../../docs_src/app_testing/app_b/main.py!}
 ```
 
 ////
@@ -179,7 +179,7 @@ Prefer to use the `Annotated` version if possible.
 然后您可以使用扩展后的测试更新`test_main.py`:
 
 ```Python
-{!> ../../../docs_src/app_testing/app_b/test_main.py!}
+{!> ../../docs_src/app_testing/app_b/test_main.py!}
 ```
 
 每当你需要客户端在请求中传递信息,但你不知道如何传递时,你可以通过搜索(谷歌)如何用 `httpx`做,或者是用 `requests` 做,毕竟HTTPX的设计是基于Requests的设计的。