Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 441 - 450 of 880 for def2 (0.09 seconds)

  1. docs_src/app_testing/app_b_an_py310/main.py

    @app.get("/items/{item_id}", response_model=Item)
    async def read_main(item_id: str, x_token: Annotated[str, Header()]):
        if x_token != fake_secret_token:
            raise HTTPException(status_code=400, detail="Invalid X-Token header")
        if item_id not in fake_db:
            raise HTTPException(status_code=404, detail="Item not found")
        return fake_db[item_id]
    
    
    @app.post("/items/")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 04 13:32:24 GMT 2026
    - 1.1K bytes
    - Click Count (0)
  2. docs/ru/docs/index.md

    app = FastAPI()
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: str | None = None):
        return {"item_id": item_id, "q": q}
    ```
    
    <details markdown="1">
    <summary>Или используйте <code>async def</code>...</summary>
    
    Если ваш код использует `async` / `await`, используйте `async def`:
    
    ```Python hl_lines="7  12"
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:56:20 GMT 2026
    - 30.4K bytes
    - Click Count (0)
  3. docs/zh-hant/docs/advanced/dataclasses.md

       FastAPI 仍能將資料<dfn title="將資料轉換成可傳輸的格式">序列化</dfn>為 JSON。
    7. 這裡 `response_model` 使用的是「`Author` dataclass 的清單」這種型別註記。
    
       同樣地,你可以把 `dataclasses` 與標準型別註記組合使用。
    8. 注意這個「路徑操作函式」使用的是一般的 `def` 而非 `async def`。
    
       一如往常,在 FastAPI 中你可以視需要混用 `def` 與 `async def`。
    
       如果需要複習何時用哪個,請參考文件中關於 [`async` 與 `await`](../async.md#in-a-hurry) 的章節「In a hurry?」。
    9. 這個「路徑操作函式」回傳的不是 dataclass(雖然也可以),而是一個包含內部資料的字典清單。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 3.8K bytes
    - Click Count (0)
  4. ci/official/utilities/convert_msys_paths_to_win_paths.py

    This is necessary on Windows, because some applications do not understand/handle
    Linux-like paths MSYS uses, for example, Docker.
    """
    
    import argparse
    import os
    
    
    def should_convert(var_name: str,
                       blacklist: list[str] | None,
                       whitelist_prefix: list[str] | None):
      """Check the variable name against white/black lists."""
    Created: Tue Apr 07 12:39:13 GMT 2026
    - Last Modified: Wed Aug 07 23:01:25 GMT 2024
    - 2.5K bytes
    - Click Count (0)
  5. build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/ElasticsearchTestBasePluginFuncTest.groovy

    import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
    import org.gradle.testkit.runner.TaskOutcome
    
    class ElasticsearchTestBasePluginFuncTest extends AbstractGradleFuncTest {
    
        def "can configure nonInputProperties for test tasks"() {
            given:
            file("src/test/java/acme/SomeTests.java").text = """
    
            public class SomeTests {
                @org.junit.Test
    Created: Wed Apr 08 16:19:15 GMT 2026
    - Last Modified: Tue Jun 01 09:19:30 GMT 2021
    - 1.7K bytes
    - Click Count (0)
  6. src/main/resources/fess_indices/fess/tr/stopwords.txt

    birşey
    birşeyi
    biz
    bize
    bizden
    bizi
    bizim
    böyle
    böylece
    bu
    buna
    bunda
    bundan
    bunlar
    bunları
    bunların
    bunu
    bunun
    burada
    çok
    çünkü
    da
    daha
    dahi
    de
    defa
    değil
    diğer
    diye
    doksan
    dokuz
    dolayı
    dolayısıyla
    dört
    edecek
    eden
    ederek
    edilecek
    ediliyor
    edilmesi
    ediyor
    eğer
    elli
    en
    etmesi
    etti
    ettiği
    ettiğini
    gibi
    Created: Tue Mar 31 13:07:34 GMT 2026
    - Last Modified: Thu Jul 19 06:31:02 GMT 2018
    - 1.5K bytes
    - Click Count (0)
  7. docs/fr/docs/tutorial/background-tasks.md

    Elle peut être une fonction asynchrone (`async def`) ou une fonction normale (`def`), **FastAPI** saura la gérer correctement.
    
    Dans cet exemple, la fonction de tâche écrira dans un fichier (afin de simuler un envoi d'email).
    
    L'opération d'écriture n'utilisant ni `async` ni `await`, on définit la fonction avec un `def` normal.
    
    {* ../../docs_src/background_tasks/tutorial001_py310.py hl[6:9] *}
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:37:13 GMT 2026
    - 5.5K bytes
    - Click Count (0)
  8. docs/ru/docs/advanced/stream-data.md

    Но во многих случаях чтение файла или «файлоподобного» объекта будет блокировать.
    
    ///
    
    Чтобы не блокировать цикл событий, вы можете просто объявить *функцию-обработчик пути* обычной `def` вместо `async def`. Тогда FastAPI выполнит её в воркере из пула потоков (threadpool), чтобы не блокировать основной цикл.
    
    {* ../../docs_src/stream_data/tutorial002_py310.py ln[30:34] hl[31] *}
    
    /// tip | Совет
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:56:20 GMT 2026
    - 8.9K bytes
    - Click Count (0)
  9. docs/en/docs/advanced/events.md

    You can define event handlers (functions) that need to be executed before the application starts up, or when the application is shutting down.
    
    These functions can be declared with `async def` or normal `def`.
    
    ### `startup` event { #startup-event }
    
    To add a function that should be run before the application starts, declare it with the event `"startup"`:
    
    {* ../../docs_src/events/tutorial001_py310.py hl[8] *}
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 7.8K bytes
    - Click Count (0)
  10. docs/pt/docs/advanced/events.md

    Você pode definir manipuladores de eventos (funções) que precisam ser executados antes de a aplicação iniciar ou quando a aplicação estiver encerrando.
    
    Essas funções podem ser declaradas com `async def` ou `def` normal.
    
    ### Evento `startup` { #startup-event }
    
    Para adicionar uma função que deve rodar antes de a aplicação iniciar, declare-a com o evento `"startup"`:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:20:43 GMT 2026
    - 8.7K bytes
    - Click Count (0)
Back to Top