Skip to content

Commit

Permalink
Sync with tiangolo#10442
Browse files Browse the repository at this point in the history
  • Loading branch information
nilslindemann committed Oct 17, 2023
1 parent 446476b commit 323ed7f
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions docs/de/docs/tutorial/dependencies/classes-as-dependencies.md
Expand Up @@ -18,7 +18,7 @@ Im vorherigen Beispiel haben wir ein `dict` von unserer Abhängigkeit ("Dependab
{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
```

=== "Python 3.6+"
=== "Python 3.8+"

```Python hl_lines="12"
{!> ../../../docs_src/dependencies/tutorial001_an.py!}
Expand All @@ -33,7 +33,7 @@ Im vorherigen Beispiel haben wir ein `dict` von unserer Abhängigkeit ("Dependab
{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
```

=== "Python 3.6+ nicht annotiert"
=== "Python 3.8+ nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand Down Expand Up @@ -115,7 +115,7 @@ Dann können wir das "Dependable" `common_parameters` der Abhängigkeit von oben
{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
```

=== "Python 3.6+"
=== "Python 3.8+"

```Python hl_lines="12-16"
{!> ../../../docs_src/dependencies/tutorial002_an.py!}
Expand All @@ -130,7 +130,7 @@ Dann können wir das "Dependable" `common_parameters` der Abhängigkeit von oben
{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
```

=== "Python 3.6+ nicht annotiert"
=== "Python 3.8+ nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand All @@ -153,7 +153,7 @@ Achten Sie auf die Methode `__init__`, die zum Erstellen der Instanz der Klasse
{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
```

=== "Python 3.6+"
=== "Python 3.8+"

```Python hl_lines="13"
{!> ../../../docs_src/dependencies/tutorial002_an.py!}
Expand All @@ -168,7 +168,7 @@ Achten Sie auf die Methode `__init__`, die zum Erstellen der Instanz der Klasse
{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
```

=== "Python 3.6+ nicht annotiert"
=== "Python 3.8+ nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand All @@ -191,7 +191,7 @@ Achten Sie auf die Methode `__init__`, die zum Erstellen der Instanz der Klasse
{!> ../../../docs_src/dependencies/tutorial001_an_py39.py!}
```

=== "Python 3.6+"
=== "Python 3.8+"

```Python hl_lines="10"
{!> ../../../docs_src/dependencies/tutorial001_an.py!}
Expand All @@ -206,7 +206,7 @@ Achten Sie auf die Methode `__init__`, die zum Erstellen der Instanz der Klasse
{!> ../../../docs_src/dependencies/tutorial001_py310.py!}
```

=== "Python 3.6+ nicht annotiert"
=== "Python 3.8+ nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand Down Expand Up @@ -241,7 +241,7 @@ Jetzt können Sie Ihre Abhängigkeit mithilfe dieser Klasse deklarieren.
{!> ../../../docs_src/dependencies/tutorial002_an_py39.py!}
```

=== "Python 3.6+"
=== "Python 3.8+"

```Python hl_lines="20"
{!> ../../../docs_src/dependencies/tutorial002_an.py!}
Expand All @@ -256,7 +256,7 @@ Jetzt können Sie Ihre Abhängigkeit mithilfe dieser Klasse deklarieren.
{!> ../../../docs_src/dependencies/tutorial002_py310.py!}
```

=== "Python 3.6+ nicht annotiert"
=== "Python 3.8+ nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand All @@ -271,13 +271,13 @@ Jetzt können Sie Ihre Abhängigkeit mithilfe dieser Klasse deklarieren.

Beachten Sie, wie wir `CommonQueryParams` im obigen Code zweimal schreiben:

=== "Python 3.6+"
=== "Python 3.8+"

```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
```

=== "Python 3.6+ nicht annotiert"
=== "Python 3.8+ nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand All @@ -300,13 +300,13 @@ Aus diesem extrahiert FastAPI die deklarierten Parameter, und dieses ist es, was

In diesem Fall hat das erste `CommonQueryParams` in:

=== "Python 3.6+"
=== "Python 3.8+"

```Python
commons: Annotated[CommonQueryParams, ...
```

=== "Python 3.6+ nicht annotiert"
=== "Python 3.8+ nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand All @@ -319,13 +319,13 @@ In diesem Fall hat das erste `CommonQueryParams` in:

Sie könnten tatsächlich einfach schreiben:

=== "Python 3.6+"
=== "Python 3.8+"

```Python
commons: Annotated[Any, Depends(CommonQueryParams)]
```

=== "Python 3.6+ nicht annotiert"
=== "Python 3.8+ nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand All @@ -348,7 +348,7 @@ Sie könnten tatsächlich einfach schreiben:
{!> ../../../docs_src/dependencies/tutorial003_an_py39.py!}
```

=== "Python 3.6+"
=== "Python 3.8+"

```Python hl_lines="20"
{!> ../../../docs_src/dependencies/tutorial003_an.py!}
Expand All @@ -363,7 +363,7 @@ Sie könnten tatsächlich einfach schreiben:
{!> ../../../docs_src/dependencies/tutorial003_py310.py!}
```

=== "Python 3.6+ nicht annotiert"
=== "Python 3.8+ nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand All @@ -380,13 +380,13 @@ 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:

=== "Python 3.6+"
=== "Python 3.8+"

```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
```

=== "Python 3.6+ nicht annotiert"
=== "Python 3.8+ nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand All @@ -401,13 +401,13 @@ In diesem speziellen Fall können Sie Folgendes tun:

Anstatt zu schreiben:

=== "Python 3.6+"
=== "Python 3.8+"

```Python
commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
```

=== "Python 3.6+ nicht annotiert"
=== "Python 3.8+ nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand All @@ -418,13 +418,13 @@ Anstatt zu schreiben:

... schreiben Sie:

=== "Python 3.6+"
=== "Python 3.8+"

```Python
commons: Annotated[CommonQueryParams, Depends()]
```

=== "Python 3.6 nicht annotiert"
=== "Python 3.8 nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand All @@ -449,7 +449,7 @@ Dasselbe Beispiel würde dann so aussehen:
{!> ../../../docs_src/dependencies/tutorial004_an_py39.py!}
```

=== "Python 3.6+"
=== "Python 3.8+"

```Python hl_lines="20"
{!> ../../../docs_src/dependencies/tutorial004_an.py!}
Expand All @@ -464,7 +464,7 @@ Dasselbe Beispiel würde dann so aussehen:
{!> ../../../docs_src/dependencies/tutorial004_py310.py!}
```

=== "Python 3.6+ nicht annotiert"
=== "Python 3.8+ nicht annotiert"

!!! tip
Bevorzugen Sie die `Annotated`-Version, falls möglich.
Expand Down

0 comments on commit 323ed7f

Please sign in to comment.