Browse Source

Update tab labels for embedded code examples (En + translations)

pull/14510/head
Yurii Motov 7 months ago
parent
commit
8247b626b7
  1. 2
      docs/de/docs/tutorial/body.md
  2. 22
      docs/de/docs/tutorial/dependencies/classes-as-dependencies.md
  3. 4
      docs/de/docs/tutorial/dependencies/sub-dependencies.md
  4. 4
      docs/de/docs/tutorial/query-params-str-validations.md
  5. 2
      docs/en/docs/tutorial/body.md
  6. 24
      docs/en/docs/tutorial/dependencies/classes-as-dependencies.md
  7. 4
      docs/en/docs/tutorial/dependencies/sub-dependencies.md
  8. 4
      docs/en/docs/tutorial/query-params-str-validations.md
  9. 2
      docs/es/docs/tutorial/body.md
  10. 22
      docs/es/docs/tutorial/dependencies/classes-as-dependencies.md
  11. 4
      docs/es/docs/tutorial/dependencies/sub-dependencies.md
  12. 4
      docs/es/docs/tutorial/query-params-str-validations.md
  13. 2
      docs/pt/docs/tutorial/body.md
  14. 22
      docs/pt/docs/tutorial/dependencies/classes-as-dependencies.md
  15. 4
      docs/pt/docs/tutorial/dependencies/sub-dependencies.md
  16. 4
      docs/pt/docs/tutorial/query-params-str-validations.md
  17. 2
      docs/ru/docs/tutorial/body.md
  18. 22
      docs/ru/docs/tutorial/dependencies/classes-as-dependencies.md
  19. 4
      docs/ru/docs/tutorial/dependencies/sub-dependencies.md
  20. 4
      docs/ru/docs/tutorial/query-params-str-validations.md

2
docs/de/docs/tutorial/body.md

@ -162,7 +162,7 @@ Die Funktionsparameter werden wie folgt erkannt:
FastAPI weiß, dass der Wert von `q` nicht erforderlich ist, aufgrund des definierten Defaultwertes `= None`. FastAPI weiß, dass der Wert von `q` nicht erforderlich ist, aufgrund des definierten Defaultwertes `= None`.
Das `str | None` (Python 3.10+) oder `Union` in `Union[str, None]` (Python 3.8+) wird von FastAPI nicht verwendet, um zu bestimmen, dass der Wert nicht erforderlich ist. FastAPI weiß, dass er nicht erforderlich ist, weil er einen Defaultwert von `= None` hat. Das `str | None` (Python 3.10+) oder `Union` in `Union[str, None]` (Python 3.9+) wird von FastAPI nicht verwendet, um zu bestimmen, dass der Wert nicht erforderlich ist. FastAPI weiß, dass er nicht erforderlich ist, weil er einen Defaultwert von `= None` hat.
Das Hinzufügen der Typannotationen ermöglicht jedoch Ihrem Editor, Ihnen eine bessere Unterstützung zu bieten und Fehler zu erkennen. Das Hinzufügen der Typannotationen ermöglicht jedoch Ihrem Editor, Ihnen eine bessere Unterstützung zu bieten und Fehler zu erkennen.

22
docs/de/docs/tutorial/dependencies/classes-as-dependencies.md

@ -101,7 +101,7 @@ Jetzt können Sie Ihre Abhängigkeit mithilfe dieser Klasse deklarieren.
Beachten Sie, wie wir `CommonQueryParams` im obigen Code zweimal schreiben: Beachten Sie, wie wir `CommonQueryParams` im obigen Code zweimal schreiben:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -109,7 +109,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ nicht annotiert //// tab | Python 3.9+ nicht annotiert
/// tip | Tipp /// tip | Tipp
@ -137,7 +137,7 @@ Aus diesem extrahiert FastAPI die deklarierten Parameter, und dieses ist es, was
In diesem Fall hat das erste `CommonQueryParams` in: In diesem Fall hat das erste `CommonQueryParams` in:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, ... commons: Annotated[CommonQueryParams, ...
@ -145,7 +145,7 @@ commons: Annotated[CommonQueryParams, ...
//// ////
//// tab | Python 3.8+ nicht annotiert //// tab | Python 3.9+ nicht annotiert
/// tip | Tipp /// tip | Tipp
@ -163,7 +163,7 @@ commons: CommonQueryParams ...
Sie könnten tatsächlich einfach schreiben: Sie könnten tatsächlich einfach schreiben:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[Any, Depends(CommonQueryParams)] commons: Annotated[Any, Depends(CommonQueryParams)]
@ -171,7 +171,7 @@ commons: Annotated[Any, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ nicht annotiert //// tab | Python 3.9+ nicht annotiert
/// tip | Tipp /// tip | Tipp
@ -197,7 +197,7 @@ Es wird jedoch empfohlen, den Typ zu deklarieren, da Ihr Editor so weiß, was al
Aber Sie sehen, dass wir hier etwas Codeduplizierung haben, indem wir `CommonQueryParams` zweimal schreiben: Aber Sie sehen, dass wir hier etwas Codeduplizierung haben, indem wir `CommonQueryParams` zweimal schreiben:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -205,7 +205,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ nicht annotiert //// tab | Python 3.9+ nicht annotiert
/// tip | Tipp /// tip | Tipp
@ -225,7 +225,7 @@ In diesem speziellen Fall können Sie Folgendes tun:
Anstatt zu schreiben: Anstatt zu schreiben:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -233,7 +233,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ nicht annotiert //// tab | Python 3.9+ nicht annotiert
/// tip | Tipp /// tip | Tipp
@ -249,7 +249,7 @@ commons: CommonQueryParams = Depends(CommonQueryParams)
... schreiben Sie: ... schreiben Sie:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends()] commons: Annotated[CommonQueryParams, Depends()]

4
docs/de/docs/tutorial/dependencies/sub-dependencies.md

@ -62,7 +62,7 @@ Und es speichert den zurückgegebenen Wert in einem <abbr title="Mechanismus, de
In einem fortgeschrittenen Szenario, bei dem Sie wissen, dass die Abhängigkeit bei jedem Schritt (möglicherweise mehrmals) in demselben Request aufgerufen werden muss, anstatt den zwischengespeicherten Wert zu verwenden, können Sie den Parameter `use_cache=False` festlegen, wenn Sie `Depends` verwenden: In einem fortgeschrittenen Szenario, bei dem Sie wissen, dass die Abhängigkeit bei jedem Schritt (möglicherweise mehrmals) in demselben Request aufgerufen werden muss, anstatt den zwischengespeicherten Wert zu verwenden, können Sie den Parameter `use_cache=False` festlegen, wenn Sie `Depends` verwenden:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python hl_lines="1" ```Python hl_lines="1"
async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]): async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]):
@ -71,7 +71,7 @@ async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_ca
//// ////
//// tab | Python 3.8+ nicht annotiert //// tab | Python 3.9+ nicht annotiert
/// tip | Tipp /// tip | Tipp

4
docs/de/docs/tutorial/query-params-str-validations.md

@ -55,7 +55,7 @@ q: str | None = None
//// ////
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
q: Union[str, None] = None q: Union[str, None] = None
@ -73,7 +73,7 @@ q: Annotated[str | None] = None
//// ////
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
q: Annotated[Union[str, None]] = None q: Annotated[Union[str, None]] = None

2
docs/en/docs/tutorial/body.md

@ -163,7 +163,7 @@ The function parameters will be recognized as follows:
FastAPI will know that the value of `q` is not required because of the default value `= None`. FastAPI will know that the value of `q` is not required because of the default value `= None`.
The `str | None` (Python 3.10+) or `Union` in `Union[str, None]` (Python 3.8+) is not used by FastAPI to determine that the value is not required, it will know it's not required because it has a default value of `= None`. The `str | None` (Python 3.10+) or `Union` in `Union[str, None]` (Python 3.9+) is not used by FastAPI to determine that the value is not required, it will know it's not required because it has a default value of `= None`.
But adding the type annotations will allow your editor to give you better support and detect errors. But adding the type annotations will allow your editor to give you better support and detect errors.

24
docs/en/docs/tutorial/dependencies/classes-as-dependencies.md

@ -101,7 +101,7 @@ Now you can declare your dependency using this class.
Notice how we write `CommonQueryParams` twice in the above code: Notice how we write `CommonQueryParams` twice in the above code:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -109,7 +109,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip /// tip
@ -137,7 +137,7 @@ It is from this one that FastAPI will extract the declared parameters and that i
In this case, the first `CommonQueryParams`, in: In this case, the first `CommonQueryParams`, in:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, ... commons: Annotated[CommonQueryParams, ...
@ -145,7 +145,7 @@ commons: Annotated[CommonQueryParams, ...
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip /// tip
@ -163,7 +163,7 @@ commons: CommonQueryParams ...
You could actually write just: You could actually write just:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[Any, Depends(CommonQueryParams)] commons: Annotated[Any, Depends(CommonQueryParams)]
@ -171,7 +171,7 @@ commons: Annotated[Any, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip /// tip
@ -197,7 +197,7 @@ But declaring the type is encouraged as that way your editor will know what will
But you see that we are having some code repetition here, writing `CommonQueryParams` twice: But you see that we are having some code repetition here, writing `CommonQueryParams` twice:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -205,7 +205,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip /// tip
@ -225,7 +225,7 @@ For those specific cases, you can do the following:
Instead of writing: Instead of writing:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -233,7 +233,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip /// tip
@ -249,7 +249,7 @@ commons: CommonQueryParams = Depends(CommonQueryParams)
...you write: ...you write:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends()] commons: Annotated[CommonQueryParams, Depends()]
@ -257,7 +257,7 @@ commons: Annotated[CommonQueryParams, Depends()]
//// ////
//// tab | Python 3.8 non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip /// tip

4
docs/en/docs/tutorial/dependencies/sub-dependencies.md

@ -62,7 +62,7 @@ And it will save the returned value in a <abbr title="A utility/system to store
In an advanced scenario where you know you need the dependency to be called at every step (possibly multiple times) in the same request instead of using the "cached" value, you can set the parameter `use_cache=False` when using `Depends`: In an advanced scenario where you know you need the dependency to be called at every step (possibly multiple times) in the same request instead of using the "cached" value, you can set the parameter `use_cache=False` when using `Depends`:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python hl_lines="1" ```Python hl_lines="1"
async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]): async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]):
@ -71,7 +71,7 @@ async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_ca
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip /// tip

4
docs/en/docs/tutorial/query-params-str-validations.md

@ -55,7 +55,7 @@ q: str | None = None
//// ////
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
q: Union[str, None] = None q: Union[str, None] = None
@ -73,7 +73,7 @@ q: Annotated[str | None] = None
//// ////
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
q: Annotated[Union[str, None]] = None q: Annotated[Union[str, None]] = None

2
docs/es/docs/tutorial/body.md

@ -161,7 +161,7 @@ Los parámetros de la función se reconocerán de la siguiente manera:
FastAPI sabrá que el valor de `q` no es requerido debido al valor por defecto `= None`. FastAPI sabrá que el valor de `q` no es requerido debido al valor por defecto `= None`.
El `str | None` (Python 3.10+) o `Union` en `Union[str, None]` (Python 3.8+) no es utilizado por FastAPI para determinar que el valor no es requerido, sabrá que no es requerido porque tiene un valor por defecto de `= None`. El `str | None` (Python 3.10+) o `Union` en `Union[str, None]` (Python 3.9+) no es utilizado por FastAPI para determinar que el valor no es requerido, sabrá que no es requerido porque tiene un valor por defecto de `= None`.
Pero agregar las anotaciones de tipos permitirá que tu editor te brinde un mejor soporte y detecte errores. Pero agregar las anotaciones de tipos permitirá que tu editor te brinde un mejor soporte y detecte errores.

22
docs/es/docs/tutorial/dependencies/classes-as-dependencies.md

@ -101,7 +101,7 @@ Ahora puedes declarar tu dependencia usando esta clase.
Nota cómo escribimos `CommonQueryParams` dos veces en el código anterior: Nota cómo escribimos `CommonQueryParams` dos veces en el código anterior:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -109,7 +109,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ sin `Annotated` //// tab | Python 3.9+ sin `Annotated`
/// tip | Consejo /// tip | Consejo
@ -137,7 +137,7 @@ Es a partir de este que **FastAPI** extraerá los parámetros declarados y es lo
En este caso, el primer `CommonQueryParams`, en: En este caso, el primer `CommonQueryParams`, en:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, ... commons: Annotated[CommonQueryParams, ...
@ -145,7 +145,7 @@ commons: Annotated[CommonQueryParams, ...
//// ////
//// tab | Python 3.8+ sin `Annotated` //// tab | Python 3.9+ sin `Annotated`
/// tip | Consejo /// tip | Consejo
@ -163,7 +163,7 @@ commons: CommonQueryParams ...
De hecho, podrías escribir simplemente: De hecho, podrías escribir simplemente:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[Any, Depends(CommonQueryParams)] commons: Annotated[Any, Depends(CommonQueryParams)]
@ -171,7 +171,7 @@ commons: Annotated[Any, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ sin `Annotated` //// tab | Python 3.9+ sin `Annotated`
/// tip | Consejo /// tip | Consejo
@ -197,7 +197,7 @@ Pero declarar el tipo es recomendable, ya que de esa manera tu editor sabrá lo
Pero ves que estamos teniendo algo de repetición de código aquí, escribiendo `CommonQueryParams` dos veces: Pero ves que estamos teniendo algo de repetición de código aquí, escribiendo `CommonQueryParams` dos veces:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -205,7 +205,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ sin `Annotated` //// tab | Python 3.9+ sin `Annotated`
/// tip | Consejo /// tip | Consejo
@ -225,7 +225,7 @@ Para esos casos específicos, puedes hacer lo siguiente:
En lugar de escribir: En lugar de escribir:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -233,7 +233,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ sin `Annotated` //// tab | Python 3.9+ sin `Annotated`
/// tip | Consejo /// tip | Consejo
@ -249,7 +249,7 @@ commons: CommonQueryParams = Depends(CommonQueryParams)
...escribes: ...escribes:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends()] commons: Annotated[CommonQueryParams, Depends()]

4
docs/es/docs/tutorial/dependencies/sub-dependencies.md

@ -62,7 +62,7 @@ Y guardará el valor devuelto en un <abbr title="Una utilidad/sistema para almac
En un escenario avanzado donde sabes que necesitas que la dependencia se llame en cada paso (posiblemente varias veces) en el mismo request en lugar de usar el valor "cache", puedes establecer el parámetro `use_cache=False` al usar `Depends`: En un escenario avanzado donde sabes que necesitas que la dependencia se llame en cada paso (posiblemente varias veces) en el mismo request en lugar de usar el valor "cache", puedes establecer el parámetro `use_cache=False` al usar `Depends`:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python hl_lines="1" ```Python hl_lines="1"
async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]): async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]):
@ -71,7 +71,7 @@ async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_ca
//// ////
//// tab | Python 3.8+ sin Anotaciones //// tab | Python 3.9+ sin Anotaciones
/// tip | Consejo /// tip | Consejo

4
docs/es/docs/tutorial/query-params-str-validations.md

@ -55,7 +55,7 @@ q: str | None = None
//// ////
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
q: Union[str, None] = None q: Union[str, None] = None
@ -73,7 +73,7 @@ q: Annotated[str | None] = None
//// ////
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
q: Annotated[Union[str, None]] = None q: Annotated[Union[str, None]] = None

2
docs/pt/docs/tutorial/body.md

@ -161,7 +161,7 @@ Os parâmetros da função serão reconhecidos conforme abaixo:
O FastAPI saberá que o valor de `q` não é obrigatório por causa do valor padrão `= None`. O FastAPI saberá que o valor de `q` não é obrigatório por causa do valor padrão `= None`.
O `str | None` (Python 3.10+) ou o `Union` em `Union[str, None]` (Python 3.8+) não é utilizado pelo FastAPI para determinar que o valor não é obrigatório, ele saberá que não é obrigatório porque tem um valor padrão `= None`. O `str | None` (Python 3.10+) ou o `Union` em `Union[str, None]` (Python 3.9+) não é utilizado pelo FastAPI para determinar que o valor não é obrigatório, ele saberá que não é obrigatório porque tem um valor padrão `= None`.
Mas adicionar as anotações de tipo permitirá ao seu editor oferecer um suporte melhor e detectar erros. Mas adicionar as anotações de tipo permitirá ao seu editor oferecer um suporte melhor e detectar erros.

22
docs/pt/docs/tutorial/dependencies/classes-as-dependencies.md

@ -101,7 +101,7 @@ O **FastAPI** chama a classe `CommonQueryParams`. Isso cria uma "instância" des
Perceba como escrevemos `CommonQueryParams` duas vezes no código abaixo: Perceba como escrevemos `CommonQueryParams` duas vezes no código abaixo:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -109,7 +109,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip | Dica /// tip | Dica
@ -137,7 +137,7 @@ O último `CommonQueryParams`, em:
Nesse caso, o primeiro `CommonQueryParams`, em: Nesse caso, o primeiro `CommonQueryParams`, em:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, ... commons: Annotated[CommonQueryParams, ...
@ -145,7 +145,7 @@ commons: Annotated[CommonQueryParams, ...
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip | Dica /// tip | Dica
@ -163,7 +163,7 @@ commons: CommonQueryParams ...
Na verdade você poderia escrever apenas: Na verdade você poderia escrever apenas:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[Any, Depends(CommonQueryParams)] commons: Annotated[Any, Depends(CommonQueryParams)]
@ -171,7 +171,7 @@ commons: Annotated[Any, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip | Dica /// tip | Dica
@ -197,7 +197,7 @@ Mas declarar o tipo é encorajado por que é a forma que o seu editor de texto s
Mas você pode ver que temos uma repetição do código neste exemplo, escrevendo `CommonQueryParams` duas vezes: Mas você pode ver que temos uma repetição do código neste exemplo, escrevendo `CommonQueryParams` duas vezes:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -205,7 +205,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip | Dica /// tip | Dica
@ -225,7 +225,7 @@ Para esses casos específicos, você pode fazer o seguinte:
Em vez de escrever: Em vez de escrever:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -233,7 +233,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip | Dica /// tip | Dica
@ -249,7 +249,7 @@ commons: CommonQueryParams = Depends(CommonQueryParams)
...escreva: ...escreva:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends()] commons: Annotated[CommonQueryParams, Depends()]

4
docs/pt/docs/tutorial/dependencies/sub-dependencies.md

@ -62,7 +62,7 @@ E o valor retornado é salvo em um <abbr title="Um utilitário/sistema para arma
Em um cenário avançado onde você precise que a dependência seja calculada em cada passo (possivelmente várias vezes) de uma requisição em vez de utilizar o valor em "cache", você pode definir o parâmetro `use_cache=False` em `Depends`: Em um cenário avançado onde você precise que a dependência seja calculada em cada passo (possivelmente várias vezes) de uma requisição em vez de utilizar o valor em "cache", você pode definir o parâmetro `use_cache=False` em `Depends`:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python hl_lines="1" ```Python hl_lines="1"
async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]): async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]):
@ -71,7 +71,7 @@ async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_ca
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip | Dica /// tip | Dica

4
docs/pt/docs/tutorial/query-params-str-validations.md

@ -55,7 +55,7 @@ q: str | None = None
//// ////
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
q: Union[str, None] = None q: Union[str, None] = None
@ -73,7 +73,7 @@ q: Annotated[str | None] = None
//// ////
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
q: Annotated[Union[str, None]] = None q: Annotated[Union[str, None]] = None

2
docs/ru/docs/tutorial/body.md

@ -161,7 +161,7 @@ JSON Schema ваших моделей будет частью сгенериро
FastAPI понимает, что значение `q` не является обязательным из-за значения по умолчанию `= None`. FastAPI понимает, что значение `q` не является обязательным из-за значения по умолчанию `= None`.
Аннотации типов `str | None` (Python 3.10+) или `Union[str, None]` (Python 3.8+) не используются FastAPI для определения обязательности; он узнает, что параметр не обязателен, потому что у него есть значение по умолчанию `= None`. Аннотации типов `str | None` (Python 3.10+) или `Union[str, None]` (Python 3.9+) не используются FastAPI для определения обязательности; он узнает, что параметр не обязателен, потому что у него есть значение по умолчанию `= None`.
Но добавление аннотаций типов позволит вашему редактору кода лучше вас поддерживать и обнаруживать ошибки. Но добавление аннотаций типов позволит вашему редактору кода лучше вас поддерживать и обнаруживать ошибки.

22
docs/ru/docs/tutorial/dependencies/classes-as-dependencies.md

@ -101,7 +101,7 @@ fluffy = Cat(name="Mr Fluffy")
Обратите внимание, что в приведенном выше коде мы два раза пишем `CommonQueryParams`: Обратите внимание, что в приведенном выше коде мы два раза пишем `CommonQueryParams`:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -109,7 +109,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip | Подсказка /// tip | Подсказка
@ -137,7 +137,7 @@ commons: CommonQueryParams = Depends(CommonQueryParams)
В этом случае первый `CommonQueryParams`, в: В этом случае первый `CommonQueryParams`, в:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, ... commons: Annotated[CommonQueryParams, ...
@ -145,7 +145,7 @@ commons: Annotated[CommonQueryParams, ...
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip | Подсказка /// tip | Подсказка
@ -163,7 +163,7 @@ commons: CommonQueryParams ...
На самом деле можно написать просто: На самом деле можно написать просто:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[Any, Depends(CommonQueryParams)] commons: Annotated[Any, Depends(CommonQueryParams)]
@ -171,7 +171,7 @@ commons: Annotated[Any, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip | Подсказка /// tip | Подсказка
@ -197,7 +197,7 @@ commons = Depends(CommonQueryParams)
Но вы видите, что здесь мы имеем некоторое повторение кода, дважды написав `CommonQueryParams`: Но вы видите, что здесь мы имеем некоторое повторение кода, дважды написав `CommonQueryParams`:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -205,7 +205,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip | Подсказка /// tip | Подсказка
@ -225,7 +225,7 @@ commons: CommonQueryParams = Depends(CommonQueryParams)
Вместо того чтобы писать: Вместо того чтобы писать:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)] commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
@ -233,7 +233,7 @@ commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
//// ////
//// tab | Python 3.8+ non-Annotated //// tab | Python 3.9+ non-Annotated
/// tip | Подсказка /// tip | Подсказка
@ -249,7 +249,7 @@ commons: CommonQueryParams = Depends(CommonQueryParams)
...следует написать: ...следует написать:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
commons: Annotated[CommonQueryParams, Depends()] commons: Annotated[CommonQueryParams, Depends()]

4
docs/ru/docs/tutorial/dependencies/sub-dependencies.md

@ -62,7 +62,7 @@ query_extractor --> query_or_cookie_extractor --> read_query
В расширенном сценарии, когда вы знаете, что вам нужно, чтобы зависимость вызывалась на каждом шаге (возможно, несколько раз) в одном и том же запросе, вместо использования "кэшированного" значения, вы можете установить параметр `use_cache=False` при использовании `Depends`: В расширенном сценарии, когда вы знаете, что вам нужно, чтобы зависимость вызывалась на каждом шаге (возможно, несколько раз) в одном и том же запросе, вместо использования "кэшированного" значения, вы можете установить параметр `use_cache=False` при использовании `Depends`:
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python hl_lines="1" ```Python hl_lines="1"
async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]): async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]):
@ -71,7 +71,7 @@ async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_ca
//// ////
//// tab | Python 3.8+ без Annotated //// tab | Python 3.9+ без Annotated
/// tip | Подсказка /// tip | Подсказка

4
docs/ru/docs/tutorial/query-params-str-validations.md

@ -55,7 +55,7 @@ q: str | None = None
//// ////
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
q: Union[str, None] = None q: Union[str, None] = None
@ -73,7 +73,7 @@ q: Annotated[str | None] = None
//// ////
//// tab | Python 3.8+ //// tab | Python 3.9+
```Python ```Python
q: Annotated[Union[str, None]] = None q: Annotated[Union[str, None]] = None

Loading…
Cancel
Save